Skip to content

Commit

Permalink
Helpers: TON: Use Tx Fee or Calculate
Browse files Browse the repository at this point in the history
  • Loading branch information
imsk17 committed Jun 26, 2024
1 parent 4a2a232 commit de23ec5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/chains/ton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,8 @@ export function tonHandler({
nativeCoin: () => 'TON',
chainName: () => chainName,
async txFee(tc) {
return (
(await bridgeReader.getChainFees()).get(tc) ??
raise(`Chain Fees not configured for Chain ID${2}`)
);
const fee = await bridgeReader.getProtocolFee() + ((await bridgeReader.getChainFees()).get(tc) ?? raise("Chain fees not configured for this chain"))
return fee
},
async token(symbol) {
const tokens = await bridgeReader.getTokens();
Expand Down Expand Up @@ -348,14 +346,16 @@ export function tonHandler({
const fsid = BigInt(`0x${sha256_sync(fromSymbol).toString("hex")}`);
const tid = BigInt(`0x${sha256_sync(targetSymbol).toString("hex")}`);
const isWrapped = await isWrappedToken(cid, fsid, tid);
const bridgeFees = await bridgeReader.getProtocolFee() + (await (await bridgeReader.getChainFees()).get(cid) ?? raise("No chain fee set for this chain."))
const gs =
fee !== undefined
? {
value: fee,
}
: {
value: bridgeFees,
value:
(await bridgeReader.getProtocolFee()) +
((await bridgeReader.getChainFees()).get(cid) ??
raise("Chain fees not configured for this chain")),
};
if (tid === nativeTokenId) {
await transferTon(bc, signer, destAddress, targetSymbol, cid, amt, gs);
Expand Down

0 comments on commit de23ec5

Please sign in to comment.