viem 2.53.1 → 2.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/_cjs/actions/index.js +3 -2
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/token/approve.js +62 -0
- package/_cjs/actions/token/approve.js.map +1 -0
- package/_cjs/actions/token/approveSync.js +25 -0
- package/_cjs/actions/token/approveSync.js.map +1 -0
- package/_cjs/actions/token/getAllowance.js +32 -0
- package/_cjs/actions/token/getAllowance.js.map +1 -0
- package/_cjs/actions/token/getBalance.js +41 -0
- package/_cjs/actions/token/getBalance.js.map +1 -0
- package/_cjs/actions/token/getMetadata.js +40 -0
- package/_cjs/actions/token/getMetadata.js.map +1 -0
- package/_cjs/actions/token/getTotalSupply.js +32 -0
- package/_cjs/actions/token/getTotalSupply.js.map +1 -0
- package/_cjs/actions/token/index.js +20 -0
- package/_cjs/actions/token/index.js.map +1 -0
- package/_cjs/actions/token/internal.js +125 -0
- package/_cjs/actions/token/internal.js.map +1 -0
- package/_cjs/actions/token/transfer.js +70 -0
- package/_cjs/actions/token/transfer.js.map +1 -0
- package/_cjs/actions/token/transferSync.js +25 -0
- package/_cjs/actions/token/transferSync.js.map +1 -0
- package/_cjs/chains/definitions/battlechain.js +31 -0
- package/_cjs/chains/definitions/battlechain.js.map +1 -0
- package/_cjs/chains/definitions/marooTestnet.js +30 -0
- package/_cjs/chains/definitions/marooTestnet.js.map +1 -0
- package/_cjs/chains/index.js +18 -14
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/clients/createClient.js +39 -1
- package/_cjs/clients/createClient.js.map +1 -1
- package/_cjs/clients/createPublicClient.js.map +1 -1
- package/_cjs/clients/createWalletClient.js.map +1 -1
- package/_cjs/clients/decorators/public.js +11 -0
- package/_cjs/clients/decorators/public.js.map +1 -1
- package/_cjs/clients/decorators/wallet.js +8 -0
- package/_cjs/clients/decorators/wallet.js.map +1 -1
- package/_cjs/clients/transports/http.js +2 -1
- package/_cjs/clients/transports/http.js.map +1 -1
- package/_cjs/errors/encoding.js +9 -1
- package/_cjs/errors/encoding.js.map +1 -1
- package/_cjs/errors/request.js +24 -1
- package/_cjs/errors/request.js.map +1 -1
- package/_cjs/errors/transaction.js +9 -1
- package/_cjs/errors/transaction.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/index.js +9 -6
- package/_cjs/index.js.map +1 -1
- package/_cjs/tempo/Client.js.map +1 -1
- package/_cjs/tempo/Decorator.js +234 -215
- package/_cjs/tempo/Decorator.js.map +1 -1
- package/_cjs/tempo/actions/token.js +210 -112
- package/_cjs/tempo/actions/token.js.map +1 -1
- package/_cjs/tempo/internal/utils.js +108 -0
- package/_cjs/tempo/internal/utils.js.map +1 -1
- package/_cjs/tokens/defineToken.js +21 -0
- package/_cjs/tokens/defineToken.js.map +1 -0
- package/_cjs/tokens/definitions/alphausd.js +14 -0
- package/_cjs/tokens/definitions/alphausd.js.map +1 -0
- package/_cjs/tokens/definitions/betausd.js +14 -0
- package/_cjs/tokens/definitions/betausd.js.map +1 -0
- package/_cjs/tokens/definitions/brla.js +14 -0
- package/_cjs/tokens/definitions/brla.js.map +1 -0
- package/_cjs/tokens/definitions/cbbtc.js +14 -0
- package/_cjs/tokens/definitions/cbbtc.js.map +1 -0
- package/_cjs/tokens/definitions/chfau.js +14 -0
- package/_cjs/tokens/definitions/chfau.js.map +1 -0
- package/_cjs/tokens/definitions/cusd.js +14 -0
- package/_cjs/tokens/definitions/cusd.js.map +1 -0
- package/_cjs/tokens/definitions/dlusd.js +14 -0
- package/_cjs/tokens/definitions/dlusd.js.map +1 -0
- package/_cjs/tokens/definitions/eurau.js +14 -0
- package/_cjs/tokens/definitions/eurau.js.map +1 -0
- package/_cjs/tokens/definitions/eurce.js +15 -0
- package/_cjs/tokens/definitions/eurce.js.map +1 -0
- package/_cjs/tokens/definitions/frxusd.js +14 -0
- package/_cjs/tokens/definitions/frxusd.js.map +1 -0
- package/_cjs/tokens/definitions/gbpa.js +14 -0
- package/_cjs/tokens/definitions/gbpa.js.map +1 -0
- package/_cjs/tokens/definitions/gusd.js +14 -0
- package/_cjs/tokens/definitions/gusd.js.map +1 -0
- package/_cjs/tokens/definitions/iusd.js +14 -0
- package/_cjs/tokens/definitions/iusd.js.map +1 -0
- package/_cjs/tokens/definitions/pathusd.js +15 -0
- package/_cjs/tokens/definitions/pathusd.js.map +1 -0
- package/_cjs/tokens/definitions/reusd.js +14 -0
- package/_cjs/tokens/definitions/reusd.js.map +1 -0
- package/_cjs/tokens/definitions/rusd.js +14 -0
- package/_cjs/tokens/definitions/rusd.js.map +1 -0
- package/_cjs/tokens/definitions/sbc.js +14 -0
- package/_cjs/tokens/definitions/sbc.js.map +1 -0
- package/_cjs/tokens/definitions/siusd.js +14 -0
- package/_cjs/tokens/definitions/siusd.js.map +1 -0
- package/_cjs/tokens/definitions/stcusd.js +14 -0
- package/_cjs/tokens/definitions/stcusd.js.map +1 -0
- package/_cjs/tokens/definitions/susde.js +14 -0
- package/_cjs/tokens/definitions/susde.js.map +1 -0
- package/_cjs/tokens/definitions/syrupusdc.js +14 -0
- package/_cjs/tokens/definitions/syrupusdc.js.map +1 -0
- package/_cjs/tokens/definitions/thetausd.js +14 -0
- package/_cjs/tokens/definitions/thetausd.js.map +1 -0
- package/_cjs/tokens/definitions/usd1.js +14 -0
- package/_cjs/tokens/definitions/usd1.js.map +1 -0
- package/_cjs/tokens/definitions/usdb.js +14 -0
- package/_cjs/tokens/definitions/usdb.js.map +1 -0
- package/_cjs/tokens/definitions/usdc.js +41 -0
- package/_cjs/tokens/definitions/usdc.js.map +1 -0
- package/_cjs/tokens/definitions/usdce.js +15 -0
- package/_cjs/tokens/definitions/usdce.js.map +1 -0
- package/_cjs/tokens/definitions/usde.js +14 -0
- package/_cjs/tokens/definitions/usde.js.map +1 -0
- package/_cjs/tokens/definitions/usdt0.js +14 -0
- package/_cjs/tokens/definitions/usdt0.js.map +1 -0
- package/_cjs/tokens/definitions/wsrusd.js +14 -0
- package/_cjs/tokens/definitions/wsrusd.js.map +1 -0
- package/_cjs/tokens/index.js +64 -0
- package/_cjs/tokens/index.js.map +1 -0
- package/_cjs/utils/encoding/fromRlp.js +7 -4
- package/_cjs/utils/encoding/fromRlp.js.map +1 -1
- package/_cjs/utils/rpc/http.js +58 -3
- package/_cjs/utils/rpc/http.js.map +1 -1
- package/_cjs/utils/transaction/parseTransaction.js +4 -1
- package/_cjs/utils/transaction/parseTransaction.js.map +1 -1
- package/_esm/actions/index.js +1 -0
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/token/approve.js +123 -0
- package/_esm/actions/token/approve.js.map +1 -0
- package/_esm/actions/token/approveSync.js +50 -0
- package/_esm/actions/token/approveSync.js.map +1 -0
- package/_esm/actions/token/getAllowance.js +62 -0
- package/_esm/actions/token/getAllowance.js.map +1 -0
- package/_esm/actions/token/getBalance.js +70 -0
- package/_esm/actions/token/getBalance.js.map +1 -0
- package/_esm/actions/token/getMetadata.js +60 -0
- package/_esm/actions/token/getMetadata.js.map +1 -0
- package/_esm/actions/token/getTotalSupply.js +60 -0
- package/_esm/actions/token/getTotalSupply.js.map +1 -0
- package/_esm/actions/token/index.js +10 -0
- package/_esm/actions/token/index.js.map +1 -0
- package/_esm/actions/token/internal.js +188 -0
- package/_esm/actions/token/internal.js.map +1 -0
- package/_esm/actions/token/transfer.js +147 -0
- package/_esm/actions/token/transfer.js.map +1 -0
- package/_esm/actions/token/transferSync.js +54 -0
- package/_esm/actions/token/transferSync.js.map +1 -0
- package/_esm/chains/definitions/battlechain.js +28 -0
- package/_esm/chains/definitions/battlechain.js.map +1 -0
- package/_esm/chains/definitions/marooTestnet.js +27 -0
- package/_esm/chains/definitions/marooTestnet.js.map +1 -0
- package/_esm/chains/index.js +2 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/clients/createClient.js +53 -1
- package/_esm/clients/createClient.js.map +1 -1
- package/_esm/clients/createPublicClient.js.map +1 -1
- package/_esm/clients/createWalletClient.js.map +1 -1
- package/_esm/clients/decorators/public.js +17 -0
- package/_esm/clients/decorators/public.js.map +1 -1
- package/_esm/clients/decorators/wallet.js +8 -0
- package/_esm/clients/decorators/wallet.js.map +1 -1
- package/_esm/clients/transports/http.js +2 -1
- package/_esm/clients/transports/http.js.map +1 -1
- package/_esm/errors/encoding.js +7 -0
- package/_esm/errors/encoding.js.map +1 -1
- package/_esm/errors/request.js +22 -0
- package/_esm/errors/request.js.map +1 -1
- package/_esm/errors/transaction.js +7 -0
- package/_esm/errors/transaction.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/index.js +3 -3
- package/_esm/index.js.map +1 -1
- package/_esm/tempo/Client.js.map +1 -1
- package/_esm/tempo/Decorator.js +234 -218
- package/_esm/tempo/Decorator.js.map +1 -1
- package/_esm/tempo/actions/token.js +335 -186
- package/_esm/tempo/actions/token.js.map +1 -1
- package/_esm/tempo/actions/wallet.js +1 -1
- package/_esm/tempo/internal/utils.js +154 -0
- package/_esm/tempo/internal/utils.js.map +1 -1
- package/_esm/tokens/defineToken.js +57 -0
- package/_esm/tokens/defineToken.js.map +1 -0
- package/_esm/tokens/definitions/alphausd.js +12 -0
- package/_esm/tokens/definitions/alphausd.js.map +1 -0
- package/_esm/tokens/definitions/betausd.js +12 -0
- package/_esm/tokens/definitions/betausd.js.map +1 -0
- package/_esm/tokens/definitions/brla.js +12 -0
- package/_esm/tokens/definitions/brla.js.map +1 -0
- package/_esm/tokens/definitions/cbbtc.js +12 -0
- package/_esm/tokens/definitions/cbbtc.js.map +1 -0
- package/_esm/tokens/definitions/chfau.js +12 -0
- package/_esm/tokens/definitions/chfau.js.map +1 -0
- package/_esm/tokens/definitions/cusd.js +12 -0
- package/_esm/tokens/definitions/cusd.js.map +1 -0
- package/_esm/tokens/definitions/dlusd.js +12 -0
- package/_esm/tokens/definitions/dlusd.js.map +1 -0
- package/_esm/tokens/definitions/eurau.js +12 -0
- package/_esm/tokens/definitions/eurau.js.map +1 -0
- package/_esm/tokens/definitions/eurce.js +13 -0
- package/_esm/tokens/definitions/eurce.js.map +1 -0
- package/_esm/tokens/definitions/frxusd.js +12 -0
- package/_esm/tokens/definitions/frxusd.js.map +1 -0
- package/_esm/tokens/definitions/gbpa.js +12 -0
- package/_esm/tokens/definitions/gbpa.js.map +1 -0
- package/_esm/tokens/definitions/gusd.js +12 -0
- package/_esm/tokens/definitions/gusd.js.map +1 -0
- package/_esm/tokens/definitions/iusd.js +12 -0
- package/_esm/tokens/definitions/iusd.js.map +1 -0
- package/_esm/tokens/definitions/pathusd.js +13 -0
- package/_esm/tokens/definitions/pathusd.js.map +1 -0
- package/_esm/tokens/definitions/reusd.js +12 -0
- package/_esm/tokens/definitions/reusd.js.map +1 -0
- package/_esm/tokens/definitions/rusd.js +12 -0
- package/_esm/tokens/definitions/rusd.js.map +1 -0
- package/_esm/tokens/definitions/sbc.js +12 -0
- package/_esm/tokens/definitions/sbc.js.map +1 -0
- package/_esm/tokens/definitions/siusd.js +12 -0
- package/_esm/tokens/definitions/siusd.js.map +1 -0
- package/_esm/tokens/definitions/stcusd.js +12 -0
- package/_esm/tokens/definitions/stcusd.js.map +1 -0
- package/_esm/tokens/definitions/susde.js +12 -0
- package/_esm/tokens/definitions/susde.js.map +1 -0
- package/_esm/tokens/definitions/syrupusdc.js +12 -0
- package/_esm/tokens/definitions/syrupusdc.js.map +1 -0
- package/_esm/tokens/definitions/thetausd.js +12 -0
- package/_esm/tokens/definitions/thetausd.js.map +1 -0
- package/_esm/tokens/definitions/usd1.js +12 -0
- package/_esm/tokens/definitions/usd1.js.map +1 -0
- package/_esm/tokens/definitions/usdb.js +12 -0
- package/_esm/tokens/definitions/usdb.js.map +1 -0
- package/_esm/tokens/definitions/usdc.js +67 -0
- package/_esm/tokens/definitions/usdc.js.map +1 -0
- package/_esm/tokens/definitions/usdce.js +13 -0
- package/_esm/tokens/definitions/usdce.js.map +1 -0
- package/_esm/tokens/definitions/usde.js +12 -0
- package/_esm/tokens/definitions/usde.js.map +1 -0
- package/_esm/tokens/definitions/usdt0.js +12 -0
- package/_esm/tokens/definitions/usdt0.js.map +1 -0
- package/_esm/tokens/definitions/wsrusd.js +12 -0
- package/_esm/tokens/definitions/wsrusd.js.map +1 -0
- package/_esm/tokens/index.js +32 -0
- package/_esm/tokens/index.js.map +1 -0
- package/_esm/utils/encoding/fromRlp.js +8 -5
- package/_esm/utils/encoding/fromRlp.js.map +1 -1
- package/_esm/utils/rpc/http.js +59 -4
- package/_esm/utils/rpc/http.js.map +1 -1
- package/_esm/utils/transaction/parseTransaction.js +5 -2
- package/_esm/utils/transaction/parseTransaction.js.map +1 -1
- package/_types/actions/index.d.ts +1 -0
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/token/approve.d.ts +253 -0
- package/_types/actions/token/approve.d.ts.map +1 -0
- package/_types/actions/token/approveSync.d.ts +57 -0
- package/_types/actions/token/approveSync.d.ts.map +1 -0
- package/_types/actions/token/getAllowance.d.ts +77 -0
- package/_types/actions/token/getAllowance.d.ts.map +1 -0
- package/_types/actions/token/getBalance.d.ts +69 -0
- package/_types/actions/token/getBalance.d.ts.map +1 -0
- package/_types/actions/token/getMetadata.d.ts +43 -0
- package/_types/actions/token/getMetadata.d.ts.map +1 -0
- package/_types/actions/token/getTotalSupply.d.ts +63 -0
- package/_types/actions/token/getTotalSupply.d.ts.map +1 -0
- package/_types/actions/token/index.d.ts +9 -0
- package/_types/actions/token/index.d.ts.map +1 -0
- package/_types/actions/token/internal.d.ts +168 -0
- package/_types/actions/token/internal.d.ts.map +1 -0
- package/_types/actions/token/transfer.d.ts +288 -0
- package/_types/actions/token/transfer.d.ts.map +1 -0
- package/_types/actions/token/transferSync.d.ts +61 -0
- package/_types/actions/token/transferSync.d.ts.map +1 -0
- package/_types/chains/definitions/battlechain.d.ts +447 -0
- package/_types/chains/definitions/battlechain.d.ts.map +1 -0
- package/_types/chains/definitions/marooTestnet.d.ts +49 -0
- package/_types/chains/definitions/marooTestnet.d.ts.map +1 -0
- package/_types/chains/index.d.ts +2 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/clients/createClient.d.ts +24 -6
- package/_types/clients/createClient.d.ts.map +1 -1
- package/_types/clients/createPublicClient.d.ts +4 -3
- package/_types/clients/createPublicClient.d.ts.map +1 -1
- package/_types/clients/createWalletClient.d.ts +4 -3
- package/_types/clients/createWalletClient.d.ts.map +1 -1
- package/_types/clients/decorators/public.d.ts +128 -3
- package/_types/clients/decorators/public.d.ts.map +1 -1
- package/_types/clients/decorators/wallet.d.ts +208 -3
- package/_types/clients/decorators/wallet.d.ts.map +1 -1
- package/_types/clients/transports/http.d.ts +2 -0
- package/_types/clients/transports/http.d.ts.map +1 -1
- package/_types/errors/encoding.d.ts +8 -0
- package/_types/errors/encoding.d.ts.map +1 -1
- package/_types/errors/request.d.ts +11 -0
- package/_types/errors/request.d.ts.map +1 -1
- package/_types/errors/transaction.d.ts +8 -0
- package/_types/errors/transaction.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/index.d.ts +4 -3
- package/_types/index.d.ts.map +1 -1
- package/_types/tempo/Client.d.ts +1 -1
- package/_types/tempo/Client.d.ts.map +1 -1
- package/_types/tempo/Decorator.d.ts +88 -5
- package/_types/tempo/Decorator.d.ts.map +1 -1
- package/_types/tempo/actions/token.d.ts +223 -151
- package/_types/tempo/actions/token.d.ts.map +1 -1
- package/_types/tempo/actions/wallet.d.ts +3 -3
- package/_types/tempo/internal/types.d.ts +17 -0
- package/_types/tempo/internal/types.d.ts.map +1 -1
- package/_types/tempo/internal/utils.d.ts +73 -0
- package/_types/tempo/internal/utils.d.ts.map +1 -1
- package/_types/tokens/defineToken.d.ts +112 -0
- package/_types/tokens/defineToken.d.ts.map +1 -0
- package/_types/tokens/definitions/alphausd.d.ts +11 -0
- package/_types/tokens/definitions/alphausd.d.ts.map +1 -0
- package/_types/tokens/definitions/betausd.d.ts +11 -0
- package/_types/tokens/definitions/betausd.d.ts.map +1 -0
- package/_types/tokens/definitions/brla.d.ts +11 -0
- package/_types/tokens/definitions/brla.d.ts.map +1 -0
- package/_types/tokens/definitions/cbbtc.d.ts +11 -0
- package/_types/tokens/definitions/cbbtc.d.ts.map +1 -0
- package/_types/tokens/definitions/chfau.d.ts +11 -0
- package/_types/tokens/definitions/chfau.d.ts.map +1 -0
- package/_types/tokens/definitions/cusd.d.ts +11 -0
- package/_types/tokens/definitions/cusd.d.ts.map +1 -0
- package/_types/tokens/definitions/dlusd.d.ts +11 -0
- package/_types/tokens/definitions/dlusd.d.ts.map +1 -0
- package/_types/tokens/definitions/eurau.d.ts +11 -0
- package/_types/tokens/definitions/eurau.d.ts.map +1 -0
- package/_types/tokens/definitions/eurce.d.ts +12 -0
- package/_types/tokens/definitions/eurce.d.ts.map +1 -0
- package/_types/tokens/definitions/frxusd.d.ts +11 -0
- package/_types/tokens/definitions/frxusd.d.ts.map +1 -0
- package/_types/tokens/definitions/gbpa.d.ts +11 -0
- package/_types/tokens/definitions/gbpa.d.ts.map +1 -0
- package/_types/tokens/definitions/gusd.d.ts +11 -0
- package/_types/tokens/definitions/gusd.d.ts.map +1 -0
- package/_types/tokens/definitions/iusd.d.ts +11 -0
- package/_types/tokens/definitions/iusd.d.ts.map +1 -0
- package/_types/tokens/definitions/pathusd.d.ts +12 -0
- package/_types/tokens/definitions/pathusd.d.ts.map +1 -0
- package/_types/tokens/definitions/reusd.d.ts +11 -0
- package/_types/tokens/definitions/reusd.d.ts.map +1 -0
- package/_types/tokens/definitions/rusd.d.ts +11 -0
- package/_types/tokens/definitions/rusd.d.ts.map +1 -0
- package/_types/tokens/definitions/sbc.d.ts +11 -0
- package/_types/tokens/definitions/sbc.d.ts.map +1 -0
- package/_types/tokens/definitions/siusd.d.ts +11 -0
- package/_types/tokens/definitions/siusd.d.ts.map +1 -0
- package/_types/tokens/definitions/stcusd.d.ts +11 -0
- package/_types/tokens/definitions/stcusd.d.ts.map +1 -0
- package/_types/tokens/definitions/susde.d.ts +11 -0
- package/_types/tokens/definitions/susde.d.ts.map +1 -0
- package/_types/tokens/definitions/syrupusdc.d.ts +11 -0
- package/_types/tokens/definitions/syrupusdc.d.ts.map +1 -0
- package/_types/tokens/definitions/thetausd.d.ts +11 -0
- package/_types/tokens/definitions/thetausd.d.ts.map +1 -0
- package/_types/tokens/definitions/usd1.d.ts +11 -0
- package/_types/tokens/definitions/usd1.d.ts.map +1 -0
- package/_types/tokens/definitions/usdb.d.ts +11 -0
- package/_types/tokens/definitions/usdb.d.ts.map +1 -0
- package/_types/tokens/definitions/usdc.d.ts +67 -0
- package/_types/tokens/definitions/usdc.d.ts.map +1 -0
- package/_types/tokens/definitions/usdce.d.ts +12 -0
- package/_types/tokens/definitions/usdce.d.ts.map +1 -0
- package/_types/tokens/definitions/usde.d.ts +11 -0
- package/_types/tokens/definitions/usde.d.ts.map +1 -0
- package/_types/tokens/definitions/usdt0.d.ts +11 -0
- package/_types/tokens/definitions/usdt0.d.ts.map +1 -0
- package/_types/tokens/definitions/wsrusd.d.ts +11 -0
- package/_types/tokens/definitions/wsrusd.d.ts.map +1 -0
- package/_types/tokens/index.d.ts +31 -0
- package/_types/tokens/index.d.ts.map +1 -0
- package/_types/utils/encoding/fromRlp.d.ts +2 -2
- package/_types/utils/encoding/fromRlp.d.ts.map +1 -1
- package/_types/utils/rpc/http.d.ts +6 -2
- package/_types/utils/rpc/http.d.ts.map +1 -1
- package/_types/utils/transaction/parseTransaction.d.ts +2 -2
- package/_types/utils/transaction/parseTransaction.d.ts.map +1 -1
- package/actions/index.ts +1 -0
- package/actions/token/approve.ts +202 -0
- package/actions/token/approveSync.ts +95 -0
- package/actions/token/getAllowance.ts +105 -0
- package/actions/token/getBalance.ts +115 -0
- package/actions/token/getMetadata.ts +98 -0
- package/actions/token/getTotalSupply.ts +97 -0
- package/actions/token/index.ts +9 -0
- package/actions/token/internal.ts +367 -0
- package/actions/token/transfer.ts +230 -0
- package/actions/token/transferSync.ts +99 -0
- package/chains/definitions/battlechain.ts +28 -0
- package/chains/definitions/marooTestnet.ts +27 -0
- package/chains/index.ts +2 -0
- package/clients/createClient.ts +90 -8
- package/clients/createPublicClient.ts +22 -4
- package/clients/createWalletClient.ts +22 -4
- package/clients/decorators/public.ts +166 -4
- package/clients/decorators/wallet.ts +242 -3
- package/clients/transports/http.ts +4 -0
- package/errors/encoding.ts +11 -0
- package/errors/request.ts +17 -0
- package/errors/transaction.ts +11 -0
- package/errors/version.ts +1 -1
- package/index.ts +7 -0
- package/package.json +6 -1
- package/tempo/Client.ts +4 -2
- package/tempo/Decorator.ts +398 -337
- package/tempo/actions/token.ts +519 -296
- package/tempo/actions/wallet.ts +3 -3
- package/tempo/internal/types.ts +19 -0
- package/tempo/internal/utils.ts +204 -0
- package/tokens/defineToken.ts +142 -0
- package/tokens/definitions/alphausd.ts +13 -0
- package/tokens/definitions/betausd.ts +13 -0
- package/tokens/definitions/brla.ts +13 -0
- package/tokens/definitions/cbbtc.ts +13 -0
- package/tokens/definitions/chfau.ts +13 -0
- package/tokens/definitions/cusd.ts +13 -0
- package/tokens/definitions/dlusd.ts +13 -0
- package/tokens/definitions/eurau.ts +13 -0
- package/tokens/definitions/eurce.ts +14 -0
- package/tokens/definitions/frxusd.ts +13 -0
- package/tokens/definitions/gbpa.ts +13 -0
- package/tokens/definitions/gusd.ts +13 -0
- package/tokens/definitions/iusd.ts +13 -0
- package/tokens/definitions/pathusd.ts +14 -0
- package/tokens/definitions/reusd.ts +13 -0
- package/tokens/definitions/rusd.ts +13 -0
- package/tokens/definitions/sbc.ts +13 -0
- package/tokens/definitions/siusd.ts +13 -0
- package/tokens/definitions/stcusd.ts +13 -0
- package/tokens/definitions/susde.ts +13 -0
- package/tokens/definitions/syrupusdc.ts +13 -0
- package/tokens/definitions/thetausd.ts +13 -0
- package/tokens/definitions/usd1.ts +13 -0
- package/tokens/definitions/usdb.ts +13 -0
- package/tokens/definitions/usdc.ts +67 -0
- package/tokens/definitions/usdce.ts +14 -0
- package/tokens/definitions/usde.ts +13 -0
- package/tokens/definitions/usdt0.ts +13 -0
- package/tokens/definitions/wsrusd.ts +13 -0
- package/tokens/index.ts +31 -0
- package/tokens/package.json +6 -0
- package/utils/encoding/fromRlp.ts +22 -3
- package/utils/rpc/http.ts +70 -2
- package/utils/transaction/parseTransaction.ts +7 -2
|
@@ -13,6 +13,7 @@ exports.createSync = createSync;
|
|
|
13
13
|
exports.getAllowance = getAllowance;
|
|
14
14
|
exports.getBalance = getBalance;
|
|
15
15
|
exports.getMetadata = getMetadata;
|
|
16
|
+
exports.getTotalSupply = getTotalSupply;
|
|
16
17
|
exports.getRoleAdmin = getRoleAdmin;
|
|
17
18
|
exports.hasRole = hasRole;
|
|
18
19
|
exports.grantRoles = grantRoles;
|
|
@@ -48,41 +49,59 @@ exports.watchUpdateQuoteToken = watchUpdateQuoteToken;
|
|
|
48
49
|
const Hex = require("ox/Hex");
|
|
49
50
|
const tempo_1 = require("ox/tempo");
|
|
50
51
|
const parseAccount_js_1 = require("../../accounts/utils/parseAccount.js");
|
|
52
|
+
const estimateContractGas_js_1 = require("../../actions/public/estimateContractGas.js");
|
|
51
53
|
const multicall_js_1 = require("../../actions/public/multicall.js");
|
|
52
54
|
const readContract_js_1 = require("../../actions/public/readContract.js");
|
|
55
|
+
const simulateContract_js_1 = require("../../actions/public/simulateContract.js");
|
|
53
56
|
const watchContractEvent_js_1 = require("../../actions/public/watchContractEvent.js");
|
|
57
|
+
const internal_Token = require("../../actions/token/internal.js");
|
|
54
58
|
const sendTransaction_js_1 = require("../../actions/wallet/sendTransaction.js");
|
|
55
59
|
const sendTransactionSync_js_1 = require("../../actions/wallet/sendTransactionSync.js");
|
|
56
60
|
const writeContract_js_1 = require("../../actions/wallet/writeContract.js");
|
|
57
61
|
const writeContractSync_js_1 = require("../../actions/wallet/writeContractSync.js");
|
|
62
|
+
const account_js_1 = require("../../errors/account.js");
|
|
58
63
|
const encodeFunctionData_js_1 = require("../../utils/abi/encodeFunctionData.js");
|
|
59
64
|
const parseEventLogs_js_1 = require("../../utils/abi/parseEventLogs.js");
|
|
65
|
+
const formatUnits_js_1 = require("../../utils/unit/formatUnits.js");
|
|
60
66
|
const Abis = require("../Abis.js");
|
|
61
67
|
const Addresses = require("../Addresses.js");
|
|
62
68
|
const utils_js_1 = require("../internal/utils.js");
|
|
63
69
|
async function approve(client, parameters) {
|
|
64
|
-
|
|
65
|
-
return approve.inner(writeContract_js_1.writeContract, client, parameters, { ...rest, token });
|
|
70
|
+
return approve.inner(writeContract_js_1.writeContract, client, parameters);
|
|
66
71
|
}
|
|
67
72
|
(function (approve) {
|
|
68
|
-
async function inner(action, client, parameters
|
|
69
|
-
const call = approve.call(args);
|
|
73
|
+
async function inner(action, client, parameters) {
|
|
70
74
|
return (await action(client, {
|
|
71
75
|
...parameters,
|
|
72
|
-
...call,
|
|
76
|
+
...approve.call(client, parameters),
|
|
73
77
|
}));
|
|
74
78
|
}
|
|
75
79
|
approve.inner = inner;
|
|
76
|
-
function call(
|
|
77
|
-
const {
|
|
80
|
+
function call(client, parameters) {
|
|
81
|
+
const { amount, spender, token } = parameters;
|
|
82
|
+
const { address, decimals } = (0, utils_js_1.resolveToken)(client, { token });
|
|
78
83
|
return (0, utils_js_1.defineCall)({
|
|
79
|
-
address
|
|
84
|
+
address,
|
|
80
85
|
abi: Abis.tip20,
|
|
81
86
|
functionName: 'approve',
|
|
82
|
-
args: [spender, amount],
|
|
87
|
+
args: [spender, internal_Token.toBaseUnits(amount, decimals)],
|
|
83
88
|
});
|
|
84
89
|
}
|
|
85
90
|
approve.call = call;
|
|
91
|
+
async function estimateGas(client, parameters) {
|
|
92
|
+
return (0, estimateContractGas_js_1.estimateContractGas)(client, {
|
|
93
|
+
...(0, utils_js_1.pickWriteParameters)(parameters),
|
|
94
|
+
...approve.call(client, parameters),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
approve.estimateGas = estimateGas;
|
|
98
|
+
async function simulate(client, parameters) {
|
|
99
|
+
return (0, simulateContract_js_1.simulateContract)(client, {
|
|
100
|
+
...(0, utils_js_1.pickWriteParameters)(parameters),
|
|
101
|
+
...approve.call(client, parameters),
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
approve.simulate = simulate;
|
|
86
105
|
function extractEvent(logs) {
|
|
87
106
|
const [log] = (0, parseEventLogs_js_1.parseEventLogs)({
|
|
88
107
|
abi: Abis.tip20,
|
|
@@ -96,11 +115,19 @@ async function approve(client, parameters) {
|
|
|
96
115
|
approve.extractEvent = extractEvent;
|
|
97
116
|
})(approve || (exports.approve = approve = {}));
|
|
98
117
|
async function approveSync(client, parameters) {
|
|
99
|
-
const { throwOnReceiptRevert = true
|
|
100
|
-
const
|
|
118
|
+
const { amount, token, throwOnReceiptRevert = true } = parameters;
|
|
119
|
+
const { decimals } = (0, utils_js_1.resolveToken)(client, { token });
|
|
120
|
+
const resolved = internal_Token.resolveAmountDecimals(amount, decimals);
|
|
121
|
+
const receipt = await approve.inner(writeContractSync_js_1.writeContractSync, client, {
|
|
122
|
+
...parameters,
|
|
123
|
+
throwOnReceiptRevert,
|
|
124
|
+
});
|
|
101
125
|
const { args } = approve.extractEvent(receipt.logs);
|
|
102
126
|
return {
|
|
103
127
|
...args,
|
|
128
|
+
...(resolved === undefined
|
|
129
|
+
? {}
|
|
130
|
+
: { decimals: resolved, formatted: (0, formatUnits_js_1.formatUnits)(args.amount, resolved) }),
|
|
104
131
|
receipt,
|
|
105
132
|
};
|
|
106
133
|
}
|
|
@@ -110,20 +137,21 @@ async function burnBlocked(client, parameters) {
|
|
|
110
137
|
(function (burnBlocked) {
|
|
111
138
|
async function inner(action, client, parameters) {
|
|
112
139
|
const { amount, from, token, ...rest } = parameters;
|
|
113
|
-
const call = burnBlocked.call({ amount, from, token });
|
|
140
|
+
const call = burnBlocked.call(client, { amount, from, token });
|
|
114
141
|
return (await action(client, {
|
|
115
142
|
...rest,
|
|
116
143
|
...call,
|
|
117
144
|
}));
|
|
118
145
|
}
|
|
119
146
|
burnBlocked.inner = inner;
|
|
120
|
-
function call(args) {
|
|
147
|
+
function call(client, args) {
|
|
121
148
|
const { from, amount, token } = args;
|
|
149
|
+
const { address, decimals } = (0, utils_js_1.resolveToken)(client, { token });
|
|
122
150
|
return (0, utils_js_1.defineCall)({
|
|
123
|
-
address
|
|
151
|
+
address,
|
|
124
152
|
abi: Abis.tip20,
|
|
125
153
|
functionName: 'burnBlocked',
|
|
126
|
-
args: [from, amount],
|
|
154
|
+
args: [from, internal_Token.toBaseUnits(amount, decimals)],
|
|
127
155
|
});
|
|
128
156
|
}
|
|
129
157
|
burnBlocked.call = call;
|
|
@@ -157,26 +185,28 @@ async function burn(client, parameters) {
|
|
|
157
185
|
(function (burn) {
|
|
158
186
|
async function inner(action, client, parameters) {
|
|
159
187
|
const { amount, memo, token, ...rest } = parameters;
|
|
160
|
-
const call = burn.call({ amount, memo, token });
|
|
188
|
+
const call = burn.call(client, { amount, memo, token });
|
|
161
189
|
return (await action(client, {
|
|
162
190
|
...rest,
|
|
163
191
|
...call,
|
|
164
192
|
}));
|
|
165
193
|
}
|
|
166
194
|
burn.inner = inner;
|
|
167
|
-
function call(args) {
|
|
195
|
+
function call(client, args) {
|
|
168
196
|
const { amount, memo, token } = args;
|
|
197
|
+
const { address, decimals } = (0, utils_js_1.resolveToken)(client, { token });
|
|
198
|
+
const value = internal_Token.toBaseUnits(amount, decimals);
|
|
169
199
|
const callArgs = memo
|
|
170
200
|
? {
|
|
171
201
|
functionName: 'burnWithMemo',
|
|
172
|
-
args: [
|
|
202
|
+
args: [value, Hex.padLeft(memo, 32)],
|
|
173
203
|
}
|
|
174
204
|
: {
|
|
175
205
|
functionName: 'burn',
|
|
176
|
-
args: [
|
|
206
|
+
args: [value],
|
|
177
207
|
};
|
|
178
208
|
return (0, utils_js_1.defineCall)({
|
|
179
|
-
address
|
|
209
|
+
address,
|
|
180
210
|
abi: Abis.tip20,
|
|
181
211
|
...callArgs,
|
|
182
212
|
});
|
|
@@ -212,17 +242,17 @@ async function changeTransferPolicy(client, parameters) {
|
|
|
212
242
|
(function (changeTransferPolicy) {
|
|
213
243
|
async function inner(action, client, parameters) {
|
|
214
244
|
const { policyId, token, ...rest } = parameters;
|
|
215
|
-
const call = changeTransferPolicy.call({ policyId, token });
|
|
245
|
+
const call = changeTransferPolicy.call(client, { policyId, token });
|
|
216
246
|
return (await action(client, {
|
|
217
247
|
...rest,
|
|
218
248
|
...call,
|
|
219
249
|
}));
|
|
220
250
|
}
|
|
221
251
|
changeTransferPolicy.inner = inner;
|
|
222
|
-
function call(args) {
|
|
252
|
+
function call(client, args) {
|
|
223
253
|
const { token, policyId } = args;
|
|
224
254
|
return (0, utils_js_1.defineCall)({
|
|
225
|
-
address:
|
|
255
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
226
256
|
abi: Abis.tip20,
|
|
227
257
|
functionName: 'changeTransferPolicyId',
|
|
228
258
|
args: [policyId],
|
|
@@ -262,7 +292,7 @@ async function create(client, parameters) {
|
|
|
262
292
|
const admin = admin_ ? (0, parseAccount_js_1.parseAccount)(admin_) : undefined;
|
|
263
293
|
if (!admin)
|
|
264
294
|
throw new Error('admin is required.');
|
|
265
|
-
const call = create.call({ ...rest, admin: admin.address });
|
|
295
|
+
const call = create.call(client, { ...rest, admin: admin.address });
|
|
266
296
|
return (await action(client, {
|
|
267
297
|
...parameters,
|
|
268
298
|
account,
|
|
@@ -271,7 +301,7 @@ async function create(client, parameters) {
|
|
|
271
301
|
}));
|
|
272
302
|
}
|
|
273
303
|
create.inner = inner;
|
|
274
|
-
function call(args) {
|
|
304
|
+
function call(client, args) {
|
|
275
305
|
const { name, symbol, currency, logoURI, quoteToken = Addresses.pathUsd, admin, salt = Hex.random(32), } = args;
|
|
276
306
|
return (0, utils_js_1.defineCall)({
|
|
277
307
|
address: Addresses.tip20Factory,
|
|
@@ -281,7 +311,7 @@ async function create(client, parameters) {
|
|
|
281
311
|
name,
|
|
282
312
|
symbol,
|
|
283
313
|
currency,
|
|
284
|
-
|
|
314
|
+
(0, utils_js_1.resolveToken)(client, { token: quoteToken }).address,
|
|
285
315
|
admin,
|
|
286
316
|
salt,
|
|
287
317
|
logoURI,
|
|
@@ -290,7 +320,7 @@ async function create(client, parameters) {
|
|
|
290
320
|
name,
|
|
291
321
|
symbol,
|
|
292
322
|
currency,
|
|
293
|
-
|
|
323
|
+
(0, utils_js_1.resolveToken)(client, { token: quoteToken }).address,
|
|
294
324
|
admin,
|
|
295
325
|
salt,
|
|
296
326
|
],
|
|
@@ -326,42 +356,55 @@ async function createSync(client, parameters) {
|
|
|
326
356
|
};
|
|
327
357
|
}
|
|
328
358
|
async function getAllowance(client, parameters) {
|
|
329
|
-
const { account
|
|
330
|
-
const
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
359
|
+
const { account, decimals, spender, token, ...rest } = parameters;
|
|
360
|
+
const [amount, { decimals: resolved }] = await Promise.all([
|
|
361
|
+
(0, readContract_js_1.readContract)(client, {
|
|
362
|
+
...rest,
|
|
363
|
+
...getAllowance.call(client, { account, spender, token }),
|
|
364
|
+
}),
|
|
365
|
+
(0, utils_js_1.resolveTokenWithDecimals)(client, {
|
|
366
|
+
decimals,
|
|
367
|
+
token,
|
|
368
|
+
}),
|
|
369
|
+
]);
|
|
370
|
+
return internal_Token.toAmount(amount, resolved);
|
|
337
371
|
}
|
|
338
372
|
(function (getAllowance) {
|
|
339
|
-
function call(args) {
|
|
340
|
-
const { account, spender, token } = args;
|
|
373
|
+
function call(client, args) {
|
|
341
374
|
return (0, utils_js_1.defineCall)({
|
|
342
|
-
address:
|
|
375
|
+
address: (0, utils_js_1.resolveToken)(client, args).address,
|
|
343
376
|
abi: Abis.tip20,
|
|
344
377
|
functionName: 'allowance',
|
|
345
|
-
args: [account, spender],
|
|
378
|
+
args: [args.account, args.spender],
|
|
346
379
|
});
|
|
347
380
|
}
|
|
348
381
|
getAllowance.call = call;
|
|
349
382
|
})(getAllowance || (exports.getAllowance = getAllowance = {}));
|
|
350
383
|
async function getBalance(client, parameters) {
|
|
351
|
-
const { account = client.account, ...rest } = parameters;
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
384
|
+
const { account: account_ = client.account, decimals, token, ...rest } = parameters;
|
|
385
|
+
if (!account_)
|
|
386
|
+
throw new account_js_1.AccountNotFoundError();
|
|
387
|
+
const account = (0, parseAccount_js_1.parseAccount)(account_).address;
|
|
388
|
+
const [amount, { decimals: resolved }] = await Promise.all([
|
|
389
|
+
(0, readContract_js_1.readContract)(client, {
|
|
390
|
+
...rest,
|
|
391
|
+
...getBalance.call(client, { account, token }),
|
|
392
|
+
}),
|
|
393
|
+
(0, utils_js_1.resolveTokenWithDecimals)(client, {
|
|
394
|
+
decimals,
|
|
395
|
+
token,
|
|
396
|
+
}),
|
|
397
|
+
]);
|
|
398
|
+
return internal_Token.toAmount(amount, resolved);
|
|
359
399
|
}
|
|
360
400
|
(function (getBalance) {
|
|
361
|
-
function call(args) {
|
|
362
|
-
const
|
|
401
|
+
function call(client, args) {
|
|
402
|
+
const account_ = args.account ?? client.account;
|
|
403
|
+
if (!account_)
|
|
404
|
+
throw new account_js_1.AccountNotFoundError();
|
|
405
|
+
const account = (0, parseAccount_js_1.parseAccount)(account_).address;
|
|
363
406
|
return (0, utils_js_1.defineCall)({
|
|
364
|
-
address:
|
|
407
|
+
address: (0, utils_js_1.resolveToken)(client, args).address,
|
|
365
408
|
abi: Abis.tip20,
|
|
366
409
|
functionName: 'balanceOf',
|
|
367
410
|
args: [account],
|
|
@@ -371,9 +414,15 @@ async function getBalance(client, parameters) {
|
|
|
371
414
|
})(getBalance || (exports.getBalance = getBalance = {}));
|
|
372
415
|
async function getMetadata(client, parameters) {
|
|
373
416
|
const { token, ...rest } = parameters;
|
|
374
|
-
const address =
|
|
417
|
+
const { address } = (0, utils_js_1.resolveToken)(client, { token });
|
|
375
418
|
const abi = Abis.tip20;
|
|
376
|
-
|
|
419
|
+
const declared = (0, utils_js_1.findDeclaredToken)(client, token);
|
|
420
|
+
const overrides = {
|
|
421
|
+
...(declared?.decimals != null ? { decimals: declared.decimals } : {}),
|
|
422
|
+
...(declared?.name != null ? { name: declared.name } : {}),
|
|
423
|
+
...(declared?.symbol != null ? { symbol: declared.symbol } : {}),
|
|
424
|
+
};
|
|
425
|
+
if (tempo_1.TokenId.fromAddress(address) === tempo_1.TokenId.fromAddress(Addresses.pathUsd))
|
|
377
426
|
return (0, multicall_js_1.multicall)(client, {
|
|
378
427
|
...rest,
|
|
379
428
|
contracts: [
|
|
@@ -417,6 +466,7 @@ async function getMetadata(client, parameters) {
|
|
|
417
466
|
decimals: unwrapMulticallResult(decimals),
|
|
418
467
|
logoURI: unwrapMulticallResult(logoURI, ''),
|
|
419
468
|
totalSupply: unwrapMulticallResult(totalSupply),
|
|
469
|
+
...overrides,
|
|
420
470
|
}));
|
|
421
471
|
return (0, multicall_js_1.multicall)(client, {
|
|
422
472
|
...rest,
|
|
@@ -485,6 +535,7 @@ async function getMetadata(client, parameters) {
|
|
|
485
535
|
paused: unwrapMulticallResult(paused),
|
|
486
536
|
supplyCap: unwrapMulticallResult(supplyCap),
|
|
487
537
|
transferPolicyId: unwrapMulticallResult(transferPolicyId),
|
|
538
|
+
...overrides,
|
|
488
539
|
}));
|
|
489
540
|
}
|
|
490
541
|
function unwrapMulticallResult(response, ...fallback) {
|
|
@@ -495,17 +546,42 @@ function unwrapMulticallResult(response, ...fallback) {
|
|
|
495
546
|
}
|
|
496
547
|
return response.result;
|
|
497
548
|
}
|
|
549
|
+
async function getTotalSupply(client, parameters) {
|
|
550
|
+
const { decimals, token, ...rest } = parameters;
|
|
551
|
+
const [amount, { decimals: resolved }] = await Promise.all([
|
|
552
|
+
(0, readContract_js_1.readContract)(client, {
|
|
553
|
+
...rest,
|
|
554
|
+
...getTotalSupply.call(client, { token }),
|
|
555
|
+
}),
|
|
556
|
+
(0, utils_js_1.resolveTokenWithDecimals)(client, {
|
|
557
|
+
decimals,
|
|
558
|
+
token,
|
|
559
|
+
}),
|
|
560
|
+
]);
|
|
561
|
+
return internal_Token.toAmount(amount, resolved);
|
|
562
|
+
}
|
|
563
|
+
(function (getTotalSupply) {
|
|
564
|
+
function call(client, args) {
|
|
565
|
+
return (0, utils_js_1.defineCall)({
|
|
566
|
+
address: (0, utils_js_1.resolveToken)(client, args).address,
|
|
567
|
+
abi: Abis.tip20,
|
|
568
|
+
args: [],
|
|
569
|
+
functionName: 'totalSupply',
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
getTotalSupply.call = call;
|
|
573
|
+
})(getTotalSupply || (exports.getTotalSupply = getTotalSupply = {}));
|
|
498
574
|
async function getRoleAdmin(client, parameters) {
|
|
499
575
|
return (0, readContract_js_1.readContract)(client, {
|
|
500
576
|
...parameters,
|
|
501
|
-
...getRoleAdmin.call(parameters),
|
|
577
|
+
...getRoleAdmin.call(client, parameters),
|
|
502
578
|
});
|
|
503
579
|
}
|
|
504
580
|
(function (getRoleAdmin) {
|
|
505
|
-
function call(args) {
|
|
581
|
+
function call(client, args) {
|
|
506
582
|
const { role, token } = args;
|
|
507
583
|
return (0, utils_js_1.defineCall)({
|
|
508
|
-
address:
|
|
584
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
509
585
|
abi: Abis.tip20,
|
|
510
586
|
functionName: 'getRoleAdmin',
|
|
511
587
|
args: [tempo_1.TokenRole.serialize(role)],
|
|
@@ -520,14 +596,14 @@ async function hasRole(client, parameters) {
|
|
|
520
596
|
throw new Error('account is required.');
|
|
521
597
|
return (0, readContract_js_1.readContract)(client, {
|
|
522
598
|
...parameters,
|
|
523
|
-
...hasRole.call({ ...parameters, account: address }),
|
|
599
|
+
...hasRole.call(client, { ...parameters, account: address }),
|
|
524
600
|
});
|
|
525
601
|
}
|
|
526
602
|
(function (hasRole) {
|
|
527
|
-
function call(args) {
|
|
603
|
+
function call(client, args) {
|
|
528
604
|
const { account, role, token } = args;
|
|
529
605
|
return (0, utils_js_1.defineCall)({
|
|
530
|
-
address:
|
|
606
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
531
607
|
abi: Abis.tip20,
|
|
532
608
|
functionName: 'hasRole',
|
|
533
609
|
args: [account, tempo_1.TokenRole.serialize(role)],
|
|
@@ -543,7 +619,7 @@ async function grantRoles(client, parameters) {
|
|
|
543
619
|
return (await action(client, {
|
|
544
620
|
...parameters,
|
|
545
621
|
calls: parameters.roles.map((role) => {
|
|
546
|
-
const call = grantRoles.call({ ...parameters, role });
|
|
622
|
+
const call = grantRoles.call(client, { ...parameters, role });
|
|
547
623
|
return {
|
|
548
624
|
...call,
|
|
549
625
|
data: (0, encodeFunctionData_js_1.encodeFunctionData)(call),
|
|
@@ -552,11 +628,11 @@ async function grantRoles(client, parameters) {
|
|
|
552
628
|
}));
|
|
553
629
|
}
|
|
554
630
|
grantRoles.inner = inner;
|
|
555
|
-
function call(args) {
|
|
631
|
+
function call(client, args) {
|
|
556
632
|
const { token, to, role } = args;
|
|
557
633
|
const roleHash = tempo_1.TokenRole.serialize(role);
|
|
558
634
|
return (0, utils_js_1.defineCall)({
|
|
559
|
-
address:
|
|
635
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
560
636
|
abi: Abis.tip20,
|
|
561
637
|
functionName: 'grantRole',
|
|
562
638
|
args: [roleHash, to],
|
|
@@ -593,26 +669,29 @@ async function mint(client, parameters) {
|
|
|
593
669
|
}
|
|
594
670
|
(function (mint) {
|
|
595
671
|
async function inner(action, client, parameters) {
|
|
596
|
-
const
|
|
672
|
+
const { amount, memo, to, token, ...rest } = parameters;
|
|
673
|
+
const call = mint.call(client, { amount, memo, to, token });
|
|
597
674
|
return (await action(client, {
|
|
598
|
-
...
|
|
675
|
+
...rest,
|
|
599
676
|
...call,
|
|
600
677
|
}));
|
|
601
678
|
}
|
|
602
679
|
mint.inner = inner;
|
|
603
|
-
function call(args) {
|
|
680
|
+
function call(client, args) {
|
|
604
681
|
const { to, amount, memo, token } = args;
|
|
682
|
+
const { address, decimals } = (0, utils_js_1.resolveToken)(client, { token });
|
|
683
|
+
const value = internal_Token.toBaseUnits(amount, decimals);
|
|
605
684
|
const callArgs = memo
|
|
606
685
|
? {
|
|
607
686
|
functionName: 'mintWithMemo',
|
|
608
|
-
args: [to,
|
|
687
|
+
args: [to, value, Hex.padLeft(memo, 32)],
|
|
609
688
|
}
|
|
610
689
|
: {
|
|
611
690
|
functionName: 'mint',
|
|
612
|
-
args: [to,
|
|
691
|
+
args: [to, value],
|
|
613
692
|
};
|
|
614
693
|
return (0, utils_js_1.defineCall)({
|
|
615
|
-
address
|
|
694
|
+
address,
|
|
616
695
|
abi: Abis.tip20,
|
|
617
696
|
...callArgs,
|
|
618
697
|
});
|
|
@@ -648,17 +727,17 @@ async function pause(client, parameters) {
|
|
|
648
727
|
(function (pause) {
|
|
649
728
|
async function inner(action, client, parameters) {
|
|
650
729
|
const { token, ...rest } = parameters;
|
|
651
|
-
const call = pause.call({ token });
|
|
730
|
+
const call = pause.call(client, { token });
|
|
652
731
|
return (await action(client, {
|
|
653
732
|
...rest,
|
|
654
733
|
...call,
|
|
655
734
|
}));
|
|
656
735
|
}
|
|
657
736
|
pause.inner = inner;
|
|
658
|
-
function call(args) {
|
|
737
|
+
function call(client, args) {
|
|
659
738
|
const { token } = args;
|
|
660
739
|
return (0, utils_js_1.defineCall)({
|
|
661
|
-
address:
|
|
740
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
662
741
|
abi: Abis.tip20,
|
|
663
742
|
functionName: 'pause',
|
|
664
743
|
args: [],
|
|
@@ -697,7 +776,7 @@ async function renounceRoles(client, parameters) {
|
|
|
697
776
|
return (await action(client, {
|
|
698
777
|
...parameters,
|
|
699
778
|
calls: parameters.roles.map((role) => {
|
|
700
|
-
const call = renounceRoles.call({ ...parameters, role });
|
|
779
|
+
const call = renounceRoles.call(client, { ...parameters, role });
|
|
701
780
|
return {
|
|
702
781
|
...call,
|
|
703
782
|
data: (0, encodeFunctionData_js_1.encodeFunctionData)(call),
|
|
@@ -706,11 +785,11 @@ async function renounceRoles(client, parameters) {
|
|
|
706
785
|
}));
|
|
707
786
|
}
|
|
708
787
|
renounceRoles.inner = inner;
|
|
709
|
-
function call(args) {
|
|
788
|
+
function call(client, args) {
|
|
710
789
|
const { token, role } = args;
|
|
711
790
|
const roleHash = tempo_1.TokenRole.serialize(role);
|
|
712
791
|
return (0, utils_js_1.defineCall)({
|
|
713
|
-
address:
|
|
792
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
714
793
|
abi: Abis.tip20,
|
|
715
794
|
functionName: 'renounceRole',
|
|
716
795
|
args: [roleHash],
|
|
@@ -751,7 +830,7 @@ async function revokeRoles(client, parameters) {
|
|
|
751
830
|
return (await action(client, {
|
|
752
831
|
...rest,
|
|
753
832
|
calls: parameters.roles.map((role) => {
|
|
754
|
-
const call = revokeRoles.call({ ...parameters, role });
|
|
833
|
+
const call = revokeRoles.call(client, { ...parameters, role });
|
|
755
834
|
return {
|
|
756
835
|
...call,
|
|
757
836
|
data: (0, encodeFunctionData_js_1.encodeFunctionData)(call),
|
|
@@ -760,11 +839,11 @@ async function revokeRoles(client, parameters) {
|
|
|
760
839
|
}));
|
|
761
840
|
}
|
|
762
841
|
revokeRoles.inner = inner;
|
|
763
|
-
function call(args) {
|
|
842
|
+
function call(client, args) {
|
|
764
843
|
const { token, from, role } = args;
|
|
765
844
|
const roleHash = tempo_1.TokenRole.serialize(role);
|
|
766
845
|
return (0, utils_js_1.defineCall)({
|
|
767
|
-
address:
|
|
846
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
768
847
|
abi: Abis.tip20,
|
|
769
848
|
functionName: 'revokeRole',
|
|
770
849
|
args: [roleHash, from],
|
|
@@ -802,17 +881,17 @@ async function setSupplyCap(client, parameters) {
|
|
|
802
881
|
(function (setSupplyCap) {
|
|
803
882
|
async function inner(action, client, parameters) {
|
|
804
883
|
const { supplyCap, token, ...rest } = parameters;
|
|
805
|
-
const call = setSupplyCap.call({ supplyCap, token });
|
|
884
|
+
const call = setSupplyCap.call(client, { supplyCap, token });
|
|
806
885
|
return (await action(client, {
|
|
807
886
|
...rest,
|
|
808
887
|
...call,
|
|
809
888
|
}));
|
|
810
889
|
}
|
|
811
890
|
setSupplyCap.inner = inner;
|
|
812
|
-
function call(args) {
|
|
891
|
+
function call(client, args) {
|
|
813
892
|
const { token, supplyCap } = args;
|
|
814
893
|
return (0, utils_js_1.defineCall)({
|
|
815
|
-
address:
|
|
894
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
816
895
|
abi: Abis.tip20,
|
|
817
896
|
functionName: 'setSupplyCap',
|
|
818
897
|
args: [supplyCap],
|
|
@@ -849,19 +928,19 @@ async function setRoleAdmin(client, parameters) {
|
|
|
849
928
|
(function (setRoleAdmin) {
|
|
850
929
|
async function inner(action, client, parameters) {
|
|
851
930
|
const { adminRole, role, token, ...rest } = parameters;
|
|
852
|
-
const call = setRoleAdmin.call({ adminRole, role, token });
|
|
931
|
+
const call = setRoleAdmin.call(client, { adminRole, role, token });
|
|
853
932
|
return (await action(client, {
|
|
854
933
|
...rest,
|
|
855
934
|
...call,
|
|
856
935
|
}));
|
|
857
936
|
}
|
|
858
937
|
setRoleAdmin.inner = inner;
|
|
859
|
-
function call(args) {
|
|
938
|
+
function call(client, args) {
|
|
860
939
|
const { token, role, adminRole } = args;
|
|
861
940
|
const roleHash = tempo_1.TokenRole.serialize(role);
|
|
862
941
|
const adminRoleHash = tempo_1.TokenRole.serialize(adminRole);
|
|
863
942
|
return (0, utils_js_1.defineCall)({
|
|
864
|
-
address:
|
|
943
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
865
944
|
abi: Abis.tip20,
|
|
866
945
|
functionName: 'setRoleAdmin',
|
|
867
946
|
args: [roleHash, adminRoleHash],
|
|
@@ -897,44 +976,58 @@ async function transfer(client, parameters) {
|
|
|
897
976
|
}
|
|
898
977
|
(function (transfer) {
|
|
899
978
|
async function inner(action, client, parameters) {
|
|
900
|
-
const { amount, from, memo, token, to, ...rest } = parameters;
|
|
901
|
-
const call = transfer.call({ amount, from, memo, token, to });
|
|
902
979
|
return (await action(client, {
|
|
903
|
-
...
|
|
904
|
-
...call,
|
|
980
|
+
...parameters,
|
|
981
|
+
...transfer.call(client, parameters),
|
|
905
982
|
}));
|
|
906
983
|
}
|
|
907
984
|
transfer.inner = inner;
|
|
908
|
-
function call(
|
|
909
|
-
const {
|
|
985
|
+
function call(client, parameters) {
|
|
986
|
+
const { from, memo, to, token } = parameters;
|
|
987
|
+
const { address, decimals } = (0, utils_js_1.resolveToken)(client, { token });
|
|
988
|
+
const value = internal_Token.toBaseUnits(parameters.amount, decimals);
|
|
910
989
|
const callArgs = (() => {
|
|
911
990
|
if (memo && from)
|
|
912
991
|
return {
|
|
913
992
|
functionName: 'transferFromWithMemo',
|
|
914
|
-
args: [from, to,
|
|
993
|
+
args: [from, to, value, Hex.padLeft(memo, 32)],
|
|
915
994
|
};
|
|
916
995
|
if (memo)
|
|
917
996
|
return {
|
|
918
997
|
functionName: 'transferWithMemo',
|
|
919
|
-
args: [to,
|
|
998
|
+
args: [to, value, Hex.padLeft(memo, 32)],
|
|
920
999
|
};
|
|
921
1000
|
if (from)
|
|
922
1001
|
return {
|
|
923
1002
|
functionName: 'transferFrom',
|
|
924
|
-
args: [from, to,
|
|
1003
|
+
args: [from, to, value],
|
|
925
1004
|
};
|
|
926
1005
|
return {
|
|
927
1006
|
functionName: 'transfer',
|
|
928
|
-
args: [to,
|
|
1007
|
+
args: [to, value],
|
|
929
1008
|
};
|
|
930
1009
|
})();
|
|
931
1010
|
return (0, utils_js_1.defineCall)({
|
|
932
|
-
address
|
|
1011
|
+
address,
|
|
933
1012
|
abi: Abis.tip20,
|
|
934
1013
|
...callArgs,
|
|
935
1014
|
});
|
|
936
1015
|
}
|
|
937
1016
|
transfer.call = call;
|
|
1017
|
+
async function estimateGas(client, parameters) {
|
|
1018
|
+
return (0, estimateContractGas_js_1.estimateContractGas)(client, {
|
|
1019
|
+
...(0, utils_js_1.pickWriteParameters)(parameters),
|
|
1020
|
+
...transfer.call(client, parameters),
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
transfer.estimateGas = estimateGas;
|
|
1024
|
+
async function simulate(client, parameters) {
|
|
1025
|
+
return (0, simulateContract_js_1.simulateContract)(client, {
|
|
1026
|
+
...(0, utils_js_1.pickWriteParameters)(parameters),
|
|
1027
|
+
...transfer.call(client, parameters),
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
transfer.simulate = simulate;
|
|
938
1031
|
function extractEvent(logs) {
|
|
939
1032
|
const [log] = (0, parseEventLogs_js_1.parseEventLogs)({
|
|
940
1033
|
abi: Abis.tip20,
|
|
@@ -948,14 +1041,19 @@ async function transfer(client, parameters) {
|
|
|
948
1041
|
transfer.extractEvent = extractEvent;
|
|
949
1042
|
})(transfer || (exports.transfer = transfer = {}));
|
|
950
1043
|
async function transferSync(client, parameters) {
|
|
951
|
-
const { throwOnReceiptRevert = true
|
|
1044
|
+
const { amount, token, throwOnReceiptRevert = true } = parameters;
|
|
1045
|
+
const { decimals } = (0, utils_js_1.resolveToken)(client, { token });
|
|
1046
|
+
const resolved = internal_Token.resolveAmountDecimals(amount, decimals);
|
|
952
1047
|
const receipt = await transfer.inner(writeContractSync_js_1.writeContractSync, client, {
|
|
953
|
-
...
|
|
1048
|
+
...parameters,
|
|
954
1049
|
throwOnReceiptRevert,
|
|
955
1050
|
});
|
|
956
1051
|
const { args } = transfer.extractEvent(receipt.logs);
|
|
957
1052
|
return {
|
|
958
1053
|
...args,
|
|
1054
|
+
...(resolved === undefined
|
|
1055
|
+
? {}
|
|
1056
|
+
: { decimals: resolved, formatted: (0, formatUnits_js_1.formatUnits)(args.amount, resolved) }),
|
|
959
1057
|
receipt,
|
|
960
1058
|
};
|
|
961
1059
|
}
|
|
@@ -965,17 +1063,17 @@ async function unpause(client, parameters) {
|
|
|
965
1063
|
(function (unpause) {
|
|
966
1064
|
async function inner(action, client, parameters) {
|
|
967
1065
|
const { token, ...rest } = parameters;
|
|
968
|
-
const call = unpause.call({ token });
|
|
1066
|
+
const call = unpause.call(client, { token });
|
|
969
1067
|
return (await action(client, {
|
|
970
1068
|
...rest,
|
|
971
1069
|
...call,
|
|
972
1070
|
}));
|
|
973
1071
|
}
|
|
974
1072
|
unpause.inner = inner;
|
|
975
|
-
function call(args) {
|
|
1073
|
+
function call(client, args) {
|
|
976
1074
|
const { token } = args;
|
|
977
1075
|
return (0, utils_js_1.defineCall)({
|
|
978
|
-
address:
|
|
1076
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
979
1077
|
abi: Abis.tip20,
|
|
980
1078
|
functionName: 'unpause',
|
|
981
1079
|
args: [],
|
|
@@ -1012,20 +1110,20 @@ async function prepareUpdateQuoteToken(client, parameters) {
|
|
|
1012
1110
|
(function (prepareUpdateQuoteToken) {
|
|
1013
1111
|
async function inner(action, client, parameters) {
|
|
1014
1112
|
const { quoteToken, token, ...rest } = parameters;
|
|
1015
|
-
const call = prepareUpdateQuoteToken.call({ quoteToken, token });
|
|
1113
|
+
const call = prepareUpdateQuoteToken.call(client, { quoteToken, token });
|
|
1016
1114
|
return (await action(client, {
|
|
1017
1115
|
...rest,
|
|
1018
1116
|
...call,
|
|
1019
1117
|
}));
|
|
1020
1118
|
}
|
|
1021
1119
|
prepareUpdateQuoteToken.inner = inner;
|
|
1022
|
-
function call(args) {
|
|
1120
|
+
function call(client, args) {
|
|
1023
1121
|
const { token, quoteToken } = args;
|
|
1024
1122
|
return (0, utils_js_1.defineCall)({
|
|
1025
|
-
address:
|
|
1123
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
1026
1124
|
abi: Abis.tip20,
|
|
1027
1125
|
functionName: 'setNextQuoteToken',
|
|
1028
|
-
args: [
|
|
1126
|
+
args: [(0, utils_js_1.resolveToken)(client, { token: quoteToken }).address],
|
|
1029
1127
|
});
|
|
1030
1128
|
}
|
|
1031
1129
|
prepareUpdateQuoteToken.call = call;
|
|
@@ -1055,17 +1153,17 @@ async function updateQuoteToken(client, parameters) {
|
|
|
1055
1153
|
(function (updateQuoteToken) {
|
|
1056
1154
|
async function inner(action, client, parameters) {
|
|
1057
1155
|
const { token, ...rest } = parameters;
|
|
1058
|
-
const call = updateQuoteToken.call({ token });
|
|
1156
|
+
const call = updateQuoteToken.call(client, { token });
|
|
1059
1157
|
return (await action(client, {
|
|
1060
1158
|
...rest,
|
|
1061
1159
|
...call,
|
|
1062
1160
|
}));
|
|
1063
1161
|
}
|
|
1064
1162
|
updateQuoteToken.inner = inner;
|
|
1065
|
-
function call(args) {
|
|
1163
|
+
function call(client, args) {
|
|
1066
1164
|
const { token } = args;
|
|
1067
1165
|
return (0, utils_js_1.defineCall)({
|
|
1068
|
-
address:
|
|
1166
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
1069
1167
|
abi: Abis.tip20,
|
|
1070
1168
|
functionName: 'completeQuoteTokenUpdate',
|
|
1071
1169
|
args: [],
|
|
@@ -1096,7 +1194,7 @@ function watchApprove(client, parameters) {
|
|
|
1096
1194
|
const { onApproval, token, ...rest } = parameters;
|
|
1097
1195
|
return (0, watchContractEvent_js_1.watchContractEvent)(client, {
|
|
1098
1196
|
...rest,
|
|
1099
|
-
address:
|
|
1197
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
1100
1198
|
abi: Abis.tip20,
|
|
1101
1199
|
eventName: 'Approval',
|
|
1102
1200
|
onLogs: (logs) => {
|
|
@@ -1110,7 +1208,7 @@ function watchBurn(client, parameters) {
|
|
|
1110
1208
|
const { onBurn, token, ...rest } = parameters;
|
|
1111
1209
|
return (0, watchContractEvent_js_1.watchContractEvent)(client, {
|
|
1112
1210
|
...rest,
|
|
1113
|
-
address:
|
|
1211
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
1114
1212
|
abi: Abis.tip20,
|
|
1115
1213
|
eventName: 'Burn',
|
|
1116
1214
|
onLogs: (logs) => {
|
|
@@ -1138,7 +1236,7 @@ function watchMint(client, parameters) {
|
|
|
1138
1236
|
const { onMint, token, ...rest } = parameters;
|
|
1139
1237
|
return (0, watchContractEvent_js_1.watchContractEvent)(client, {
|
|
1140
1238
|
...rest,
|
|
1141
|
-
address:
|
|
1239
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
1142
1240
|
abi: Abis.tip20,
|
|
1143
1241
|
eventName: 'Mint',
|
|
1144
1242
|
onLogs: (logs) => {
|
|
@@ -1152,7 +1250,7 @@ function watchAdminRole(client, parameters) {
|
|
|
1152
1250
|
const { onRoleAdminUpdated, token, ...rest } = parameters;
|
|
1153
1251
|
return (0, watchContractEvent_js_1.watchContractEvent)(client, {
|
|
1154
1252
|
...rest,
|
|
1155
|
-
address:
|
|
1253
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
1156
1254
|
abi: Abis.tip20,
|
|
1157
1255
|
eventName: 'RoleAdminUpdated',
|
|
1158
1256
|
onLogs: (logs) => {
|
|
@@ -1166,7 +1264,7 @@ function watchRole(client, parameters) {
|
|
|
1166
1264
|
const { onRoleUpdated, token, ...rest } = parameters;
|
|
1167
1265
|
return (0, watchContractEvent_js_1.watchContractEvent)(client, {
|
|
1168
1266
|
...rest,
|
|
1169
|
-
address:
|
|
1267
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
1170
1268
|
abi: Abis.tip20,
|
|
1171
1269
|
eventName: 'RoleMembershipUpdated',
|
|
1172
1270
|
onLogs: (logs) => {
|
|
@@ -1182,7 +1280,7 @@ function watchTransfer(client, parameters) {
|
|
|
1182
1280
|
const { onTransfer, token, ...rest } = parameters;
|
|
1183
1281
|
return (0, watchContractEvent_js_1.watchContractEvent)(client, {
|
|
1184
1282
|
...rest,
|
|
1185
|
-
address:
|
|
1283
|
+
address: (0, utils_js_1.resolveToken)(client, { token }).address,
|
|
1186
1284
|
abi: Abis.tip20,
|
|
1187
1285
|
eventName: 'Transfer',
|
|
1188
1286
|
onLogs: (logs) => {
|
|
@@ -1194,7 +1292,7 @@ function watchTransfer(client, parameters) {
|
|
|
1194
1292
|
}
|
|
1195
1293
|
function watchUpdateQuoteToken(client, parameters) {
|
|
1196
1294
|
const { onUpdateQuoteToken, token, ...rest } = parameters;
|
|
1197
|
-
const address =
|
|
1295
|
+
const address = (0, utils_js_1.resolveToken)(client, { token }).address;
|
|
1198
1296
|
return (0, watchContractEvent_js_1.watchContractEvent)(client, {
|
|
1199
1297
|
...rest,
|
|
1200
1298
|
address,
|