xssnick / tonutils-go

TON SDK Library in pure Golang for interacting with The Open Network ecosystem using native protocols, such as ADNL, RLDP and etc.
Apache License 2.0
535 stars 109 forks source link

return tx after Transfer #224

Closed iw4p closed 4 weeks ago

iw4p commented 3 months ago

Hi! Thanks for your great library.

I have an issue about getting tx after calling func (w *Wallet) Transfer. Right now I am passing context, address, amount and comment to Transfer, but the only return is error. How can I broadcast my transaction with amount, address and comment, and get the tx?

One solution is after transaction I can read the last transaction, but this does not work for me as the number of requests are high in a sec.

I checked the SendManyWaitTxHash and SendManyWaitTransaction but they only accept ctx and message.

xssnick commented 3 months ago

Hi, you can use SendManyWaitTransaction and build transfer message, use this function to build transfer message and pass it to send wait: https://github.com/xssnick/tonutils-go/blob/d6bf268a935041bc64ca3fdeb206940566bc9e71/ton/wallet/wallet.go#L386

iw4p commented 3 months ago

Great, Thank you. Also one more question, can I contribute a method for my scenario to tonutils-go? I think a lot of people needs to broadcast a single transaction easily and get the tx id in return. Is it ok that I implement it for tonutils-go and open a PR?

xssnick commented 3 months ago

Sure, maybe we can make new universal method SendWaitTransaction which accepts both slices and single message using (msgs …Message), it is better to return full transaction like in SendManyWaitTransaction, tx hash field so it includes id

iw4p commented 2 months ago

PR 228