ston-fi / omniston-sdk

Monorepo with SDK for the STON.fi Omniston protocol
MIT License
10 stars 5 forks source link

Issue with Adding Fee Transfer to Messages Array in sendTransaction for TON Connect SDK #2

Open LifeStyleClarity opened 3 weeks ago

LifeStyleClarity commented 3 weeks ago

I'm trying to integrate a fee transfer to a separate wallet within the sendTransaction function using TON Connect SDK. I’ve attempted to append a fee transfer message to the messages array before sending the transaction. The code looks like this:

const messages = tx.transaction.ton.messages;
  const feeAmountInNanotons = (0.01 * 1e9).toString();

  // // Append the fee transfer message to the existing messages array
  messages.push({
     targetAddress: feeWallet,
     sendAmount: feeAmountInNanotons,
     payload: "",
   });

  // Send the transaction using TON Connect UI
  await tonConnect.sendTransaction({
    validUntil: Date.now() + 1000000, // Transaction validity period
    messages: messages.map((message) => ({
      address: message.targetAddress,
      amount: message.sendAmount,
      payload: message.payload,
    })),
  });

The transaction does not include the additional fee transfer message as expected. It seems the fee message isn’t being appended correctly, or there’s an issue with the way the SDK processes multiple messages. I need to ensure that the fee goes to the feeWallet while keeping the rest of the transaction intact.

The sendTransaction function should include both the original transaction message and the appended fee transfer message to the feeWallet address.

Would you guys be able to help me.

Justwada2005 commented 2 weeks ago

Ok