-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get the gas fee when transfer ton or jetton token #281
Comments
Sorry bro, theoretically, you can’t know the exact fee before the transaction is confirmed.
but there is a workaround method to estimate the fee from the history of similar transactions. Some third-party APIs provide such methods, for example: And, when your transaction was confirmed, you can use the return of tx, _, err := w.SendWaitTransaction(ctx, msg)
fmt.Println("fee:", tx.TotalFees.Coins.String()) |
thanks |
HI, can you help me pls. I need a example, I tried a lot but failed: body := cell.BeginCell().
MustStoreUInt(0xf8a7ea5, 32). // method ID
MustStoreUInt(uint64(rand.Int63()), 64). // queryId
MustStoreCoins(ethx.Uint64(amount.Nano())). // amount
MustStoreAddr(to). // destination
MustStoreAddr(tokenWallet.Address()). // responseDestination
MustStoreMaybeRef(comment). // customPayload
MustStoreCoins(ethx.Uint64(tlb.MustFromTON("0.05").Nano())). // forwardTonAmount
MustStoreSlice(forwardPayload.ToBOC(), forwardPayload.BitsSize()). // forwardPayload
EndCell()
feeInfo, _, err := consts.ClientTon.ApiIterator.Next().Apiv2Api.ApiV3PostV2EstimateFee(context.Background(), toncenter.V2EstimateFeeRequest{
Address: usdt.String(),
Body: base64.StdEncoding.EncodeToString(body.ToBOC()),
IgnoreChksig: true,
}) responst: Although there are no errors, I believe the returned information must be incorrect because its value is approximately 10 times different from the actual value. |
hi bro, do you solved it? |
fwd fee plus storage fee = total 0.000494994 TON, seems to be no problem.
Em, fwd fee plus storage fee = total 0.000494994 TON, seems to be no problem. |
The values differ by an order of magnitude of 10. |
Bro, the estimate API is ONLY for normal transaction, The way you transfer jettons is not normal. The API takes the records of previous normal transactions to match similar transactions |
ohw, I see tonweb.ts is surpported |
Nice, Typescript Ton ecosystem is much better than golang. hahahahhhhh |
How to get the estimate gas fee when transfer ton or jetton token ?
The text was updated successfully, but these errors were encountered: