@@ -9,21 +9,14 @@ This message is used to withdraw funds from the Injective Chain via the [peggy c
99Note that a $10 USD bridge fee will be charged for this transaction to cover for the ethereum gas fee on top of the standard INJ transaction fee.
1010
1111``` ts
12- import {
13- TokenPrice ,
14- MsgSendToEth ,
15- DenomClientAsync ,
16- MsgBroadcasterWithPk ,
17- } from ' @injectivelabs/sdk-ts'
12+ import { TokenPrice , MsgSendToEth , DenomClientAsync , TokenStaticFactory , MsgBroadcasterWithPk } from ' @injectivelabs/sdk-ts'
1813import { BigNumberInBase } from ' @injectivelabs/utils'
1914import { ChainId } from ' @injectivelabs/ts-types'
2015import { getNetworkEndpoints , Network } from ' @injectivelabs/networks'
2116// refer to https://docs.ts.injective.network/readme/assets/injective-list
2217import { tokens } from ' ../data/tokens.json'
2318
24- export const tokenFactoryStatic = new TokenFactoryStatic (
25- tokens as TokenStatic [],
26- )
19+ export const tokenStaticFactory = new TokenStaticFactory (tokens as TokenStatic [])
2720
2821const tokenPriceMap = new TokenPrice (Network .Mainnet )
2922const tokenService = new TokenService ({
@@ -38,7 +31,7 @@ const denomClient = new DenomClientAsync(Network.Mainnet, {
3831})
3932
4033const tokenSymbol = ' INJ'
41- const tokenMeta = tokenFactoryStatic .toToken (tokenSymbol )
34+ const tokenMeta = tokenStaticFactory .toToken (tokenSymbol )
4235
4336const amount = 1
4437const injectiveAddress = ' inj1...'
@@ -50,12 +43,8 @@ if (!tokenMeta) {
5043}
5144
5245const tokenUsdPrice = tokenPriceMap [tokenMeta .coinGeckoId ]
53- const amountToFixed = new BigNumberInBase (amount )
54- .toWei (tokenMeta .decimals )
55- .toFixed ()
56- const bridgeFeeInToken = new BigNumberInBase (ETH_BRIDGE_FEE_IN_USD )
57- .dividedBy (tokenUsdPrice )
58- .toFixed ()
46+ const amountToFixed = new BigNumberInBase (amount ).toWei (tokenMeta .decimals ).toFixed ()
47+ const bridgeFeeInToken = new BigNumberInBase (ETH_BRIDGE_FEE_IN_USD ).dividedBy (tokenUsdPrice ).toFixed ()
5948
6049const msg = MsgSendToEth .fromJSON ({
6150 injectiveAddress ,
0 commit comments