@initia/initia.js 1.0.21 → 2.0.0-rc.1
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/README.md +231 -163
- package/dist/abi-helpers-DdwdqhMQ.mjs +51 -0
- package/dist/abi-helpers-DdwdqhMQ.mjs.map +1 -0
- package/dist/address-DwAkzgJk.mjs +156 -0
- package/dist/address-DwAkzgJk.mjs.map +1 -0
- package/dist/address-profile-DjdaEBxo.d.mts +112 -0
- package/dist/address-profile-DlAFvgdg.mjs +241 -0
- package/dist/address-profile-DlAFvgdg.mjs.map +1 -0
- package/dist/amino-CMQN7Frn.mjs +220 -0
- package/dist/amino-CMQN7Frn.mjs.map +1 -0
- package/dist/amino_pb-Bi6YDY_U.mjs +88 -0
- package/dist/amino_pb-Bi6YDY_U.mjs.map +1 -0
- package/dist/amount-B0J9TTNF.mjs +90 -0
- package/dist/amount-B0J9TTNF.mjs.map +1 -0
- package/dist/any-DElm7qF7.mjs +19 -0
- package/dist/any-DElm7qF7.mjs.map +1 -0
- package/dist/auth_pb-DN4URGLh.mjs +26 -0
- package/dist/auth_pb-DN4URGLh.mjs.map +1 -0
- package/dist/auth_pb-DfXfdvrY.mjs +16 -0
- package/dist/auth_pb-DfXfdvrY.mjs.map +1 -0
- package/dist/base-provider-CLnd7kte.d.mts +68 -0
- package/dist/base-provider-LNp6K7Mt.mjs +96 -0
- package/dist/base-provider-LNp6K7Mt.mjs.map +1 -0
- package/dist/bcs-DiRcL4n9.mjs +533 -0
- package/dist/bcs-DiRcL4n9.mjs.map +1 -0
- package/dist/bridge-DL-q-7P7.mjs +1222 -0
- package/dist/bridge-DL-q-7P7.mjs.map +1 -0
- package/dist/bridge-cQoOjppA.d.mts +606 -0
- package/dist/broadcast-De8MdmYa.mjs +974 -0
- package/dist/broadcast-De8MdmYa.mjs.map +1 -0
- package/dist/chain-utils-C61cU5nd.mjs +139 -0
- package/dist/chain-utils-C61cU5nd.mjs.map +1 -0
- package/dist/codegen/cli.d.mts +1 -0
- package/dist/codegen/cli.mjs +274 -0
- package/dist/codegen/cli.mjs.map +1 -0
- package/dist/coin-DPWbtAFA.mjs +543 -0
- package/dist/coin-DPWbtAFA.mjs.map +1 -0
- package/dist/coin_pb--WuIu4sX.mjs +25 -0
- package/dist/coin_pb--WuIu4sX.mjs.map +1 -0
- package/dist/composite-provider-DbxNrdny.mjs +203 -0
- package/dist/composite-provider-DbxNrdny.mjs.map +1 -0
- package/dist/constants-W6V0E-3W.mjs +42 -0
- package/dist/constants-W6V0E-3W.mjs.map +1 -0
- package/dist/contract-Dpvu4wLO.mjs +657 -0
- package/dist/contract-Dpvu4wLO.mjs.map +1 -0
- package/dist/cosmos-Bqh8qNfP.mjs +540 -0
- package/dist/cosmos-Bqh8qNfP.mjs.map +1 -0
- package/dist/cosmos-registry-provider-DCrEEhJ-.d.mts +123 -0
- package/dist/cw20-BTpdgMXC.mjs +63 -0
- package/dist/cw20-BTpdgMXC.mjs.map +1 -0
- package/dist/decode-CXGawqIZ.mjs +29 -0
- package/dist/decode-CXGawqIZ.mjs.map +1 -0
- package/dist/entry.bridge.browser.d.mts +21 -0
- package/dist/entry.bridge.browser.mjs +25 -0
- package/dist/entry.bridge.browser.mjs.map +1 -0
- package/dist/entry.bridge.node.d.mts +21 -0
- package/dist/entry.bridge.node.mjs +25 -0
- package/dist/entry.bridge.node.mjs.map +1 -0
- package/dist/entry.browser.d.mts +49 -0
- package/dist/entry.browser.mjs +46 -0
- package/dist/entry.browser.mjs.map +1 -0
- package/dist/entry.chain.initia.browser.d.mts +8 -0
- package/dist/entry.chain.initia.browser.mjs +17 -0
- package/dist/entry.chain.initia.browser.mjs.map +1 -0
- package/dist/entry.chain.initia.node.d.mts +8 -0
- package/dist/entry.chain.initia.node.mjs +17 -0
- package/dist/entry.chain.initia.node.mjs.map +1 -0
- package/dist/entry.chain.minievm.browser.d.mts +8 -0
- package/dist/entry.chain.minievm.browser.mjs +17 -0
- package/dist/entry.chain.minievm.browser.mjs.map +1 -0
- package/dist/entry.chain.minievm.node.d.mts +8 -0
- package/dist/entry.chain.minievm.node.mjs +17 -0
- package/dist/entry.chain.minievm.node.mjs.map +1 -0
- package/dist/entry.chain.minimove.browser.d.mts +8 -0
- package/dist/entry.chain.minimove.browser.mjs +17 -0
- package/dist/entry.chain.minimove.browser.mjs.map +1 -0
- package/dist/entry.chain.minimove.node.d.mts +8 -0
- package/dist/entry.chain.minimove.node.mjs +17 -0
- package/dist/entry.chain.minimove.node.mjs.map +1 -0
- package/dist/entry.chain.miniwasm.browser.d.mts +8 -0
- package/dist/entry.chain.miniwasm.browser.mjs +17 -0
- package/dist/entry.chain.miniwasm.browser.mjs.map +1 -0
- package/dist/entry.chain.miniwasm.node.d.mts +8 -0
- package/dist/entry.chain.miniwasm.node.mjs +17 -0
- package/dist/entry.chain.miniwasm.node.mjs.map +1 -0
- package/dist/entry.client.browser.d.mts +3 -0
- package/dist/entry.client.browser.mjs +6 -0
- package/dist/entry.client.node-clFi8rmF.d.mts +1 -0
- package/dist/entry.client.node.d.mts +3 -0
- package/dist/entry.client.node.mjs +6 -0
- package/dist/entry.codegen.d.mts +251 -0
- package/dist/entry.codegen.mjs +2 -0
- package/dist/entry.cosmos.d.mts +2 -0
- package/dist/entry.cosmos.mjs +355 -0
- package/dist/entry.cosmos.mjs.map +1 -0
- package/dist/entry.events.d.mts +338 -0
- package/dist/entry.events.mjs +383 -0
- package/dist/entry.events.mjs.map +1 -0
- package/dist/entry.evm.d.mts +544 -0
- package/dist/entry.evm.mjs +761 -0
- package/dist/entry.evm.mjs.map +1 -0
- package/dist/entry.modules.d.mts +2 -0
- package/dist/entry.modules.mjs +7 -0
- package/dist/entry.move.d.mts +523 -0
- package/dist/entry.move.mjs +7 -0
- package/dist/entry.msgs.d.mts +2 -0
- package/dist/entry.msgs.mjs +3 -0
- package/dist/entry.node.d.mts +118 -0
- package/dist/entry.node.mjs +278 -0
- package/dist/entry.node.mjs.map +1 -0
- package/dist/entry.provider.d.mts +355 -0
- package/dist/entry.provider.mjs +416 -0
- package/dist/entry.provider.mjs.map +1 -0
- package/dist/entry.signer.d.mts +2 -0
- package/dist/entry.signer.mjs +674 -0
- package/dist/entry.signer.mjs.map +1 -0
- package/dist/entry.tx.d.mts +2 -0
- package/dist/entry.tx.mjs +6 -0
- package/dist/entry.usernames.d.mts +42 -0
- package/dist/entry.usernames.mjs +2 -0
- package/dist/entry.util.d.mts +103 -0
- package/dist/entry.util.mjs +70 -0
- package/dist/entry.util.mjs.map +1 -0
- package/dist/entry.vip.d.mts +1917 -0
- package/dist/entry.vip.mjs +3793 -0
- package/dist/entry.vip.mjs.map +1 -0
- package/dist/entry.wasm.d.mts +447 -0
- package/dist/entry.wasm.mjs +600 -0
- package/dist/entry.wasm.mjs.map +1 -0
- package/dist/erc20-CDs3j7vt.mjs +168 -0
- package/dist/erc20-CDs3j7vt.mjs.map +1 -0
- package/dist/errors-CN1MFOLv.mjs +253 -0
- package/dist/errors-CN1MFOLv.mjs.map +1 -0
- package/dist/evm-rpc-BxpgXIAF.mjs +338 -0
- package/dist/evm-rpc-BxpgXIAF.mjs.map +1 -0
- package/dist/fetch-Bq_aay6V.mjs +55 -0
- package/dist/fetch-Bq_aay6V.mjs.map +1 -0
- package/dist/fungible-asset-aHBTYpoT.mjs +64 -0
- package/dist/fungible-asset-aHBTYpoT.mjs.map +1 -0
- package/dist/get-tx-0P40z_A4.mjs +99 -0
- package/dist/get-tx-0P40z_A4.mjs.map +1 -0
- package/dist/grpc-client-DGyZjGcT.mjs +254 -0
- package/dist/grpc-client-DGyZjGcT.mjs.map +1 -0
- package/dist/hash-D40mxOlF.mjs +14 -0
- package/dist/hash-D40mxOlF.mjs.map +1 -0
- package/dist/hash-Doo89wm3.d.mts +31 -0
- package/dist/headers-CMO7ia_D.mjs +83 -0
- package/dist/headers-CMO7ia_D.mjs.map +1 -0
- package/dist/http-client-BrdVurTg.mjs +40 -0
- package/dist/http-client-BrdVurTg.mjs.map +1 -0
- package/dist/initia-B8l_x6sT.mjs +426 -0
- package/dist/initia-B8l_x6sT.mjs.map +1 -0
- package/dist/initia-Cj4bZ1dR.mjs +26 -0
- package/dist/initia-Cj4bZ1dR.mjs.map +1 -0
- package/dist/json-CGak0DqP.mjs +41 -0
- package/dist/json-CGak0DqP.mjs.map +1 -0
- package/dist/minievm-BAnGHa00.mjs +39 -0
- package/dist/minievm-BAnGHa00.mjs.map +1 -0
- package/dist/minievm-DZ8AhnD8.mjs +61 -0
- package/dist/minievm-DZ8AhnD8.mjs.map +1 -0
- package/dist/minimove-B8U85g-_.mjs +23 -0
- package/dist/minimove-B8U85g-_.mjs.map +1 -0
- package/dist/minimove-BBXTyhIv.mjs +24 -0
- package/dist/minimove-BBXTyhIv.mjs.map +1 -0
- package/dist/miniwasm-CB0XfStg.mjs +50 -0
- package/dist/miniwasm-CB0XfStg.mjs.map +1 -0
- package/dist/miniwasm-QdyYzmQ1.mjs +139 -0
- package/dist/miniwasm-QdyYzmQ1.mjs.map +1 -0
- package/dist/move-BaCv0oRX.mjs +64 -0
- package/dist/move-BaCv0oRX.mjs.map +1 -0
- package/dist/msg_pb-DxYxctLM.mjs +11 -0
- package/dist/msg_pb-DxYxctLM.mjs.map +1 -0
- package/dist/pagination_pb-DlkDYAcN.mjs +18 -0
- package/dist/pagination_pb-DlkDYAcN.mjs.map +1 -0
- package/dist/public-key-DV-uGaUC.mjs +550 -0
- package/dist/public-key-DV-uGaUC.mjs.map +1 -0
- package/dist/query_pb-cZ3szo3y.mjs +20 -0
- package/dist/query_pb-cZ3szo3y.mjs.map +1 -0
- package/dist/registry-provider-NzblVZQr.mjs +368 -0
- package/dist/registry-provider-NzblVZQr.mjs.map +1 -0
- package/dist/resolve-DdtY7KDz.mjs +50 -0
- package/dist/resolve-DdtY7KDz.mjs.map +1 -0
- package/dist/rolldown-runtime-wcPFST8Q.mjs +13 -0
- package/dist/service-BaMjxPNo.mjs +412 -0
- package/dist/service-BaMjxPNo.mjs.map +1 -0
- package/dist/service-CVFxsMp_.d.mts +151 -0
- package/dist/service_pb-Be-O-2-c.mjs +121 -0
- package/dist/service_pb-Be-O-2-c.mjs.map +1 -0
- package/dist/sign-DqagxLcg.mjs +212 -0
- package/dist/sign-DqagxLcg.mjs.map +1 -0
- package/dist/transport-common-BsPYcFQl.mjs +182 -0
- package/dist/transport-common-BsPYcFQl.mjs.map +1 -0
- package/dist/transport.browser-CCUWv3ta.mjs +31 -0
- package/dist/transport.browser-CCUWv3ta.mjs.map +1 -0
- package/dist/transport.node-DXcJtCnx.mjs +33 -0
- package/dist/transport.node-DXcJtCnx.mjs.map +1 -0
- package/dist/tx_pb-BJzY8SXE.mjs +38 -0
- package/dist/tx_pb-BJzY8SXE.mjs.map +1 -0
- package/dist/tx_pb-BVCXH992.mjs +39 -0
- package/dist/tx_pb-BVCXH992.mjs.map +1 -0
- package/dist/tx_pb-CnFNMLIq.mjs +107 -0
- package/dist/tx_pb-CnFNMLIq.mjs.map +1 -0
- package/dist/tx_pb-DYspoJTt.mjs +50 -0
- package/dist/tx_pb-DYspoJTt.mjs.map +1 -0
- package/dist/tx_pb-u3CoQYge.mjs +79 -0
- package/dist/tx_pb-u3CoQYge.mjs.map +1 -0
- package/dist/typed-context-Cg0If0M9.mjs +118 -0
- package/dist/typed-context-Cg0If0M9.mjs.map +1 -0
- package/dist/types-CLfdsa48.mjs +41 -0
- package/dist/types-CLfdsa48.mjs.map +1 -0
- package/dist/types-CSS5rfW1.mjs +303 -0
- package/dist/types-CSS5rfW1.mjs.map +1 -0
- package/dist/types-DGrP9Ro_.d.mts +39609 -0
- package/dist/types_pb-CrjtO9sB.mjs +21 -0
- package/dist/types_pb-CrjtO9sB.mjs.map +1 -0
- package/dist/types_pb-K7pKBvcg.mjs +1433 -0
- package/dist/types_pb-K7pKBvcg.mjs.map +1 -0
- package/dist/utils-B2carKSi.mjs +2 -0
- package/dist/waiting-BigHYRNN.mjs +1081 -0
- package/dist/waiting-BigHYRNN.mjs.map +1 -0
- package/dist/wasm-DdunGtLM.mjs +396 -0
- package/dist/wasm-DdunGtLM.mjs.map +1 -0
- package/package.json +195 -66
- package/dist/client/WebSocketClient.d.ts +0 -30
- package/dist/client/index.d.ts +0 -5
- package/dist/client/rest/APIRequester.d.ts +0 -27
- package/dist/client/rest/RESTClient.d.ts +0 -48
- package/dist/client/rest/Wallet.d.ts +0 -26
- package/dist/client/rest/api/AuctionAPI.d.ts +0 -6
- package/dist/client/rest/api/AuthAPI.d.ts +0 -8
- package/dist/client/rest/api/AuthzAPI.d.ts +0 -8
- package/dist/client/rest/api/BankAPI.d.ts +0 -10
- package/dist/client/rest/api/BaseAPI.d.ts +0 -5
- package/dist/client/rest/api/DistributionAPI.d.ts +0 -35
- package/dist/client/rest/api/EvidenceAPI.d.ts +0 -7
- package/dist/client/rest/api/EvmAPI.d.ts +0 -45
- package/dist/client/rest/api/FeeGrantAPI.d.ts +0 -22
- package/dist/client/rest/api/ForwardingAPI.d.ts +0 -20
- package/dist/client/rest/api/GovAPI.d.ts +0 -12
- package/dist/client/rest/api/GroupAPI.d.ts +0 -19
- package/dist/client/rest/api/IbcAPI.d.ts +0 -48
- package/dist/client/rest/api/IbcHooksAPI.d.ts +0 -8
- package/dist/client/rest/api/IbcNftAPI.d.ts +0 -11
- package/dist/client/rest/api/IbcPermAPI.d.ts +0 -12
- package/dist/client/rest/api/IbcTransferAPI.d.ts +0 -10
- package/dist/client/rest/api/InterTxAPI.d.ts +0 -6
- package/dist/client/rest/api/MarketmapAPI.d.ts +0 -18
- package/dist/client/rest/api/MoveAPI.d.ts +0 -62
- package/dist/client/rest/api/MstakingAPI.d.ts +0 -28
- package/dist/client/rest/api/OpchildAPI.d.ts +0 -23
- package/dist/client/rest/api/OphostAPI.d.ts +0 -34
- package/dist/client/rest/api/OracleAPI.d.ts +0 -22
- package/dist/client/rest/api/RewardAPI.d.ts +0 -8
- package/dist/client/rest/api/SlashingAPI.d.ts +0 -8
- package/dist/client/rest/api/TendermintAPI.d.ts +0 -16
- package/dist/client/rest/api/TokenfactoryAPI.d.ts +0 -12
- package/dist/client/rest/api/TxAPI.d.ts +0 -190
- package/dist/client/rest/api/UpgradeAPI.d.ts +0 -18
- package/dist/client/rest/api/WasmAPI.d.ts +0 -78
- package/dist/client/rest/api/index.d.ts +0 -30
- package/dist/core/Block.d.ts +0 -55
- package/dist/core/Coin.d.ts +0 -42
- package/dist/core/Coins.d.ts +0 -45
- package/dist/core/Denom.d.ts +0 -1
- package/dist/core/Duration.d.ts +0 -19
- package/dist/core/Msg.d.ts +0 -45
- package/dist/core/PublicKey.d.ts +0 -122
- package/dist/core/auction/AuctionParams.d.ts +0 -41
- package/dist/core/auction/index.d.ts +0 -2
- package/dist/core/auction/msgs/MsgAuctionBid.d.ts +0 -36
- package/dist/core/auction/msgs/MsgUpdateAuctionParams.d.ts +0 -33
- package/dist/core/auction/msgs/index.d.ts +0 -10
- package/dist/core/auth/Account.d.ts +0 -12
- package/dist/core/auth/AuthParams.d.ts +0 -37
- package/dist/core/auth/BaseAccount.d.ts +0 -45
- package/dist/core/auth/ModuleAccount.d.ts +0 -39
- package/dist/core/auth/index.d.ts +0 -5
- package/dist/core/auth/msgs/MsgUpdateAuthParams.d.ts +0 -33
- package/dist/core/auth/msgs/index.d.ts +0 -8
- package/dist/core/authz/authorizations/Authorization.d.ts +0 -42
- package/dist/core/authz/authorizations/CallAuthorization.d.ts +0 -28
- package/dist/core/authz/authorizations/ExecuteAuthorization.d.ts +0 -54
- package/dist/core/authz/authorizations/GenericAuthorization.d.ts +0 -28
- package/dist/core/authz/authorizations/PublishAuthorization.d.ts +0 -28
- package/dist/core/authz/authorizations/SendAuthorization.d.ts +0 -33
- package/dist/core/authz/authorizations/StakeAuthorization.d.ts +0 -60
- package/dist/core/authz/authorizations/index.d.ts +0 -7
- package/dist/core/authz/index.d.ts +0 -2
- package/dist/core/authz/msgs/MsgExecAuthorized.d.ts +0 -33
- package/dist/core/authz/msgs/MsgGrantAuthorization.d.ts +0 -36
- package/dist/core/authz/msgs/MsgRevokeAuthorization.d.ts +0 -35
- package/dist/core/authz/msgs/index.d.ts +0 -12
- package/dist/core/bank/BankParams.d.ts +0 -29
- package/dist/core/bank/DenomMetadata.d.ts +0 -43
- package/dist/core/bank/DenomUnit.d.ts +0 -28
- package/dist/core/bank/SendEnabled.d.ts +0 -25
- package/dist/core/bank/index.d.ts +0 -5
- package/dist/core/bank/msgs/MsgMultiSend.d.ts +0 -78
- package/dist/core/bank/msgs/MsgSend.d.ts +0 -36
- package/dist/core/bank/msgs/MsgSetDenomMetadata.d.ts +0 -33
- package/dist/core/bank/msgs/MsgSetSendEnabled.d.ts +0 -37
- package/dist/core/bank/msgs/MsgUpdateBankParams.d.ts +0 -33
- package/dist/core/bank/msgs/index.d.ts +0 -16
- package/dist/core/bech32.d.ts +0 -27
- package/dist/core/celestia/Blob.d.ts +0 -24
- package/dist/core/celestia/BlobTx.d.ts +0 -25
- package/dist/core/celestia/index.d.ts +0 -3
- package/dist/core/celestia/msgs/MsgPayForBlobs.d.ts +0 -31
- package/dist/core/celestia/msgs/index.d.ts +0 -7
- package/dist/core/consensus/ABCIParams.d.ts +0 -21
- package/dist/core/consensus/BlockParams.d.ts +0 -24
- package/dist/core/consensus/EvidenceParams.d.ts +0 -28
- package/dist/core/consensus/ValidatorParams.d.ts +0 -21
- package/dist/core/consensus/index.d.ts +0 -5
- package/dist/core/consensus/msgs/MsgUpdateConsensusParams.d.ts +0 -45
- package/dist/core/consensus/msgs/index.d.ts +0 -8
- package/dist/core/crisis/index.d.ts +0 -1
- package/dist/core/crisis/msgs/MsgUpdateCrisisParams.d.ts +0 -33
- package/dist/core/crisis/msgs/MsgVerifyInvariant.d.ts +0 -35
- package/dist/core/crisis/msgs/index.d.ts +0 -10
- package/dist/core/distribution/DistributionParams.d.ts +0 -32
- package/dist/core/distribution/RewardWeight.d.ts +0 -25
- package/dist/core/distribution/index.d.ts +0 -3
- package/dist/core/distribution/msgs/MsgCommunityPoolSpend.d.ts +0 -36
- package/dist/core/distribution/msgs/MsgDepositValidatorRewardsPool.d.ts +0 -40
- package/dist/core/distribution/msgs/MsgFundCommunityPool.d.ts +0 -33
- package/dist/core/distribution/msgs/MsgSetWithdrawAddress.d.ts +0 -32
- package/dist/core/distribution/msgs/MsgUpdateDistrParams.d.ts +0 -33
- package/dist/core/distribution/msgs/MsgWithdrawDelegatorReward.d.ts +0 -32
- package/dist/core/distribution/msgs/MsgWithdrawValidatorCommission.d.ts +0 -29
- package/dist/core/distribution/msgs/index.d.ts +0 -20
- package/dist/core/evidence/Equivocation.d.ts +0 -38
- package/dist/core/evidence/Evidence.d.ts +0 -11
- package/dist/core/evidence/index.d.ts +0 -3
- package/dist/core/evidence/msgs/MsgSubmitEvidence.d.ts +0 -33
- package/dist/core/evidence/msgs/index.d.ts +0 -8
- package/dist/core/evm/AccessTuple.d.ts +0 -25
- package/dist/core/evm/EvmParams.d.ts +0 -43
- package/dist/core/evm/GasEnforcement.d.ts +0 -27
- package/dist/core/evm/SetCodeAuthorization.d.ts +0 -30
- package/dist/core/evm/index.d.ts +0 -5
- package/dist/core/evm/msgs/MsgCall.d.ts +0 -46
- package/dist/core/evm/msgs/MsgCreate.d.ts +0 -39
- package/dist/core/evm/msgs/MsgCreate2.d.ts +0 -42
- package/dist/core/evm/msgs/MsgUpdateEvmParams.d.ts +0 -33
- package/dist/core/evm/msgs/index.d.ts +0 -14
- package/dist/core/feegrant/allowances/AllowedMsgAllowance.d.ts +0 -33
- package/dist/core/feegrant/allowances/BasicAllowance.d.ts +0 -32
- package/dist/core/feegrant/allowances/PeriodicAllowance.d.ts +0 -43
- package/dist/core/feegrant/allowances/index.d.ts +0 -16
- package/dist/core/feegrant/index.d.ts +0 -2
- package/dist/core/feegrant/msgs/MsgGrantAllowance.d.ts +0 -36
- package/dist/core/feegrant/msgs/MsgRevokeAllowance.d.ts +0 -32
- package/dist/core/feegrant/msgs/index.d.ts +0 -10
- package/dist/core/forwarding/index.d.ts +0 -1
- package/dist/core/forwarding/msgs/MsgClearForwardingAccount.d.ts +0 -32
- package/dist/core/forwarding/msgs/MsgRegisterForwardingAccount.d.ts +0 -38
- package/dist/core/forwarding/msgs/MsgSetAllowedDenoms.d.ts +0 -32
- package/dist/core/forwarding/msgs/MsgSetMemo.d.ts +0 -44
- package/dist/core/forwarding/msgs/index.d.ts +0 -14
- package/dist/core/gov/Deposit.d.ts +0 -29
- package/dist/core/gov/GovParams.d.ts +0 -85
- package/dist/core/gov/TallyResult.d.ts +0 -36
- package/dist/core/gov/Vesting.d.ts +0 -28
- package/dist/core/gov/Vote.d.ts +0 -55
- package/dist/core/gov/index.d.ts +0 -6
- package/dist/core/gov/msgs/MsgActivateEmergencyProposal.d.ts +0 -32
- package/dist/core/gov/msgs/MsgAddEmergencySubmitters.d.ts +0 -32
- package/dist/core/gov/msgs/MsgCancelProposal.d.ts +0 -32
- package/dist/core/gov/msgs/MsgDeposit.d.ts +0 -36
- package/dist/core/gov/msgs/MsgDepositLegacy.d.ts +0 -36
- package/dist/core/gov/msgs/MsgRemoveEmergencySubmitters.d.ts +0 -32
- package/dist/core/gov/msgs/MsgSubmitProposal.d.ts +0 -49
- package/dist/core/gov/msgs/MsgSubmitProposalLegacy.d.ts +0 -37
- package/dist/core/gov/msgs/MsgUpdateGovParams.d.ts +0 -33
- package/dist/core/gov/msgs/MsgVote.d.ts +0 -41
- package/dist/core/gov/msgs/MsgVoteLegacy.d.ts +0 -38
- package/dist/core/gov/msgs/MsgVoteWeighted.d.ts +0 -39
- package/dist/core/gov/msgs/MsgVoteWeightedLegacy.d.ts +0 -36
- package/dist/core/gov/msgs/index.d.ts +0 -32
- package/dist/core/gov/proposals/Content.d.ts +0 -12
- package/dist/core/gov/proposals/Proposal.d.ts +0 -79
- package/dist/core/gov/proposals/TextProposal.d.ts +0 -31
- package/dist/core/gov/proposals/index.d.ts +0 -3
- package/dist/core/group/GroupInfo.d.ts +0 -37
- package/dist/core/group/GroupMember.d.ts +0 -78
- package/dist/core/group/GroupPolicyInfo.d.ts +0 -41
- package/dist/core/group/GroupProposal.d.ts +0 -82
- package/dist/core/group/GroupVote.d.ts +0 -36
- package/dist/core/group/index.d.ts +0 -7
- package/dist/core/group/msgs/MsgCreateGroup.d.ts +0 -36
- package/dist/core/group/msgs/MsgCreateGroupPolicy.d.ts +0 -39
- package/dist/core/group/msgs/MsgCreateGroupWithPolicy.d.ts +0 -46
- package/dist/core/group/msgs/MsgGroupExec.d.ts +0 -32
- package/dist/core/group/msgs/MsgGroupVote.d.ts +0 -46
- package/dist/core/group/msgs/MsgLeaveGroup.d.ts +0 -32
- package/dist/core/group/msgs/MsgSubmitGroupProposal.d.ts +0 -50
- package/dist/core/group/msgs/MsgUpdateGroupAdmin.d.ts +0 -35
- package/dist/core/group/msgs/MsgUpdateGroupDecisionPolicy.d.ts +0 -36
- package/dist/core/group/msgs/MsgUpdateGroupMembers.d.ts +0 -36
- package/dist/core/group/msgs/MsgUpdateGroupMetadata.d.ts +0 -35
- package/dist/core/group/msgs/MsgUpdateGroupPolicyAdmin.d.ts +0 -35
- package/dist/core/group/msgs/MsgUpdateGroupPolicyMetadata.d.ts +0 -35
- package/dist/core/group/msgs/MsgWithdrawProposal.d.ts +0 -32
- package/dist/core/group/msgs/index.d.ts +0 -32
- package/dist/core/group/policies/DecisionPolicyWindows.d.ts +0 -25
- package/dist/core/group/policies/PercentageDecisionPolicy.d.ts +0 -32
- package/dist/core/group/policies/ThresholdDecisionPolicy.d.ts +0 -32
- package/dist/core/group/policies/index.d.ts +0 -15
- package/dist/core/ibc/applications/fee/IbcFee.d.ts +0 -28
- package/dist/core/ibc/applications/fee/IdentifiedPacketFee.d.ts +0 -26
- package/dist/core/ibc/applications/fee/Metadata.d.ts +0 -24
- package/dist/core/ibc/applications/fee/PacketFee.d.ts +0 -29
- package/dist/core/ibc/applications/fee/index.d.ts +0 -5
- package/dist/core/ibc/applications/fee/msgs/MsgPayPacketFee.d.ts +0 -31
- package/dist/core/ibc/applications/fee/msgs/MsgPayPacketFeeAsync.d.ts +0 -26
- package/dist/core/ibc/applications/fee/msgs/MsgRegisterCounterpartyPayee.d.ts +0 -28
- package/dist/core/ibc/applications/fee/msgs/MsgRegisterPayee.d.ts +0 -28
- package/dist/core/ibc/applications/fee/msgs/index.d.ts +0 -13
- package/dist/core/ibc/applications/index.d.ts +0 -4
- package/dist/core/ibc/applications/interchain-account/Account.d.ts +0 -25
- package/dist/core/ibc/applications/interchain-account/Metadata.d.ts +0 -36
- package/dist/core/ibc/applications/interchain-account/controller/Params.d.ts +0 -21
- package/dist/core/ibc/applications/interchain-account/host/Params.d.ts +0 -24
- package/dist/core/ibc/applications/interchain-account/index.d.ts +0 -4
- package/dist/core/ibc/applications/nft-transfer/IbcNftParams.d.ts +0 -28
- package/dist/core/ibc/applications/nft-transfer/NftClassTrace.d.ts +0 -24
- package/dist/core/ibc/applications/nft-transfer/NonFungibleTokenPacketData.d.ts +0 -45
- package/dist/core/ibc/applications/nft-transfer/index.d.ts +0 -4
- package/dist/core/ibc/applications/nft-transfer/msgs/MsgNftTransfer.d.ts +0 -54
- package/dist/core/ibc/applications/nft-transfer/msgs/MsgUpdateIbcNftParams.d.ts +0 -33
- package/dist/core/ibc/applications/nft-transfer/msgs/index.d.ts +0 -10
- package/dist/core/ibc/applications/perm/index.d.ts +0 -1
- package/dist/core/ibc/applications/perm/msgs/MsgUpdateIbcPermAdmin.d.ts +0 -38
- package/dist/core/ibc/applications/perm/msgs/MsgUpdatePermissionedRelayers.d.ts +0 -38
- package/dist/core/ibc/applications/perm/msgs/index.d.ts +0 -10
- package/dist/core/ibc/applications/transfer/DenomTrace.d.ts +0 -24
- package/dist/core/ibc/applications/transfer/FungibleTokenPacketData.d.ts +0 -33
- package/dist/core/ibc/applications/transfer/IbcTransferParams.d.ts +0 -24
- package/dist/core/ibc/applications/transfer/authorizations/Allocation.d.ts +0 -34
- package/dist/core/ibc/applications/transfer/authorizations/TransferAuthorization.d.ts +0 -23
- package/dist/core/ibc/applications/transfer/authorizations/index.d.ts +0 -2
- package/dist/core/ibc/applications/transfer/index.d.ts +0 -5
- package/dist/core/ibc/applications/transfer/msgs/MsgTransfer.d.ts +0 -52
- package/dist/core/ibc/applications/transfer/msgs/MsgUpdateIbcTransferParams.d.ts +0 -26
- package/dist/core/ibc/applications/transfer/msgs/index.d.ts +0 -10
- package/dist/core/ibc/core/channel/Channel.d.ts +0 -39
- package/dist/core/ibc/core/channel/ChannelCounterparty.d.ts +0 -24
- package/dist/core/ibc/core/channel/ChannelOrder.d.ts +0 -3
- package/dist/core/ibc/core/channel/ChannelState.d.ts +0 -3
- package/dist/core/ibc/core/channel/ErrorReceipt.d.ts +0 -20
- package/dist/core/ibc/core/channel/IbcChannelParams.d.ts +0 -22
- package/dist/core/ibc/core/channel/IdentifiedChannel.d.ts +0 -45
- package/dist/core/ibc/core/channel/Packet.d.ts +0 -43
- package/dist/core/ibc/core/channel/PacketId.d.ts +0 -27
- package/dist/core/ibc/core/channel/Timeout.d.ts +0 -25
- package/dist/core/ibc/core/channel/Upgrade.d.ts +0 -24
- package/dist/core/ibc/core/channel/UpgradeFields.d.ts +0 -23
- package/dist/core/ibc/core/channel/index.d.ts +0 -13
- package/dist/core/ibc/core/channel/msgs/MsgChannelCloseConfirm.d.ts +0 -32
- package/dist/core/ibc/core/channel/msgs/MsgChannelCloseInit.d.ts +0 -27
- package/dist/core/ibc/core/channel/msgs/MsgChannelOpenAck.d.ts +0 -36
- package/dist/core/ibc/core/channel/msgs/MsgChannelOpenConfirm.d.ts +0 -32
- package/dist/core/ibc/core/channel/msgs/MsgChannelOpenInit.d.ts +0 -28
- package/dist/core/ibc/core/channel/msgs/MsgChannelOpenTry.d.ts +0 -36
- package/dist/core/ibc/core/channel/msgs/MsgChannelUpgradeAck.d.ts +0 -37
- package/dist/core/ibc/core/channel/msgs/MsgChannelUpgradeCancel.d.ts +0 -35
- package/dist/core/ibc/core/channel/msgs/MsgChannelUpgradeConfirm.d.ts +0 -40
- package/dist/core/ibc/core/channel/msgs/MsgChannelUpgradeInit.d.ts +0 -30
- package/dist/core/ibc/core/channel/msgs/MsgChannelUpgradeOpen.d.ts +0 -37
- package/dist/core/ibc/core/channel/msgs/MsgChannelUpgradeTimeout.d.ts +0 -35
- package/dist/core/ibc/core/channel/msgs/MsgChannelUpgradeTry.d.ts +0 -41
- package/dist/core/ibc/core/channel/msgs/MsgRecvAcknowledgement.d.ts +0 -32
- package/dist/core/ibc/core/channel/msgs/MsgRecvPacket.d.ts +0 -30
- package/dist/core/ibc/core/channel/msgs/MsgTimeout.d.ts +0 -32
- package/dist/core/ibc/core/channel/msgs/MsgTimeoutClose.d.ts +0 -34
- package/dist/core/ibc/core/channel/msgs/MsgUpdateIbcChannelParams.d.ts +0 -26
- package/dist/core/ibc/core/channel/msgs/index.d.ts +0 -41
- package/dist/core/ibc/core/client/ClientConsensusStates.d.ts +0 -25
- package/dist/core/ibc/core/client/ConsensusStateWithHeight.d.ts +0 -25
- package/dist/core/ibc/core/client/Height.d.ts +0 -24
- package/dist/core/ibc/core/client/IbcClientParams.d.ts +0 -21
- package/dist/core/ibc/core/client/IdentifiedClient.d.ts +0 -24
- package/dist/core/ibc/core/client/index.d.ts +0 -6
- package/dist/core/ibc/core/client/msgs/MsgCreateClient.d.ts +0 -27
- package/dist/core/ibc/core/client/msgs/MsgIBCSoftwareUpgrade.d.ts +0 -28
- package/dist/core/ibc/core/client/msgs/MsgRecoverClient.d.ts +0 -27
- package/dist/core/ibc/core/client/msgs/MsgSubmitMisbehaviour.d.ts +0 -27
- package/dist/core/ibc/core/client/msgs/MsgUpdateClient.d.ts +0 -27
- package/dist/core/ibc/core/client/msgs/MsgUpdateIbcClientParams.d.ts +0 -26
- package/dist/core/ibc/core/client/msgs/MsgUpgradeClient.d.ts +0 -33
- package/dist/core/ibc/core/client/msgs/index.d.ts +0 -19
- package/dist/core/ibc/core/client/msgs/tendermint/crypto.d.ts +0 -43
- package/dist/core/ibc/core/client/msgs/tendermint/types.d.ts +0 -187
- package/dist/core/ibc/core/client/msgs/tendermint/version.d.ts +0 -38
- package/dist/core/ibc/core/commitment/MerklePrefix.d.ts +0 -21
- package/dist/core/ibc/core/commitment/MerkleRoot.d.ts +0 -21
- package/dist/core/ibc/core/commitment/index.d.ts +0 -2
- package/dist/core/ibc/core/connection/ConnectionCounterparty.d.ts +0 -28
- package/dist/core/ibc/core/connection/ConnectionState.d.ts +0 -3
- package/dist/core/ibc/core/connection/IbcConnectionParams.d.ts +0 -21
- package/dist/core/ibc/core/connection/IbcVersion.d.ts +0 -24
- package/dist/core/ibc/core/connection/IdentifiedConnection.d.ts +0 -39
- package/dist/core/ibc/core/connection/index.d.ts +0 -5
- package/dist/core/ibc/core/connection/msgs/MsgConnectionOpenAck.d.ts +0 -42
- package/dist/core/ibc/core/connection/msgs/MsgConnectionOpenConfirm.d.ts +0 -30
- package/dist/core/ibc/core/connection/msgs/MsgConnectionOpenInit.d.ts +0 -33
- package/dist/core/ibc/core/connection/msgs/MsgConnectionOpenTry.d.ts +0 -46
- package/dist/core/ibc/core/connection/msgs/MsgUpdateIbcConnectionParams.d.ts +0 -26
- package/dist/core/ibc/core/connection/msgs/index.d.ts +0 -15
- package/dist/core/ibc/core/index.d.ts +0 -4
- package/dist/core/ibc/index.d.ts +0 -2
- package/dist/core/ibc/lightclient/index.d.ts +0 -1
- package/dist/core/ibc/lightclient/tendermint/Header.d.ts +0 -29
- package/dist/core/ibchooks/ACL.d.ts +0 -25
- package/dist/core/ibchooks/IbcHooksParams.d.ts +0 -25
- package/dist/core/ibchooks/index.d.ts +0 -3
- package/dist/core/ibchooks/msgs/MsgUpdateACL.d.ts +0 -35
- package/dist/core/ibchooks/msgs/MsgUpdateIbcHooksParams.d.ts +0 -33
- package/dist/core/ibchooks/msgs/index.d.ts +0 -10
- package/dist/core/index.d.ts +0 -40
- package/dist/core/intertx/index.d.ts +0 -1
- package/dist/core/intertx/msgs/MsgRegisterAccount.d.ts +0 -39
- package/dist/core/intertx/msgs/MsgSubmitTx.d.ts +0 -36
- package/dist/core/intertx/msgs/index.d.ts +0 -10
- package/dist/core/marketmap/Market.d.ts +0 -26
- package/dist/core/marketmap/MarketmapParams.d.ts +0 -25
- package/dist/core/marketmap/ProviderConfig.d.ts +0 -34
- package/dist/core/marketmap/Ticker.d.ts +0 -34
- package/dist/core/marketmap/index.d.ts +0 -5
- package/dist/core/marketmap/msgs/MsgCreateMarkets.d.ts +0 -33
- package/dist/core/marketmap/msgs/MsgRemoveMarketAuthorities.d.ts +0 -32
- package/dist/core/marketmap/msgs/MsgRemoveMarkets.d.ts +0 -32
- package/dist/core/marketmap/msgs/MsgUpdateMarketmapParams.d.ts +0 -33
- package/dist/core/marketmap/msgs/MsgUpdateMarkets.d.ts +0 -33
- package/dist/core/marketmap/msgs/MsgUpsertMarkets.d.ts +0 -33
- package/dist/core/marketmap/msgs/index.d.ts +0 -18
- package/dist/core/move/Module.d.ts +0 -36
- package/dist/core/move/MoveParams.d.ts +0 -37
- package/dist/core/move/index.d.ts +0 -3
- package/dist/core/move/msgs/MsgDelist.d.ts +0 -32
- package/dist/core/move/msgs/MsgExecute.d.ts +0 -44
- package/dist/core/move/msgs/MsgExecuteJSON.d.ts +0 -44
- package/dist/core/move/msgs/MsgGovExecute.d.ts +0 -47
- package/dist/core/move/msgs/MsgGovExecuteJSON.d.ts +0 -47
- package/dist/core/move/msgs/MsgGovPublish.d.ts +0 -41
- package/dist/core/move/msgs/MsgGovScript.d.ts +0 -41
- package/dist/core/move/msgs/MsgGovScriptJSON.d.ts +0 -41
- package/dist/core/move/msgs/MsgPublish.d.ts +0 -38
- package/dist/core/move/msgs/MsgScript.d.ts +0 -38
- package/dist/core/move/msgs/MsgScriptJSON.d.ts +0 -38
- package/dist/core/move/msgs/MsgUpdateMoveParams.d.ts +0 -33
- package/dist/core/move/msgs/MsgWhitelist.d.ts +0 -35
- package/dist/core/move/msgs/index.d.ts +0 -32
- package/dist/core/mstaking/Delegation.d.ts +0 -36
- package/dist/core/mstaking/MstakingParams.d.ts +0 -44
- package/dist/core/mstaking/Redelegation.d.ts +0 -71
- package/dist/core/mstaking/UnbondingDelegation.d.ts +0 -57
- package/dist/core/mstaking/Validator.d.ts +0 -137
- package/dist/core/mstaking/index.d.ts +0 -6
- package/dist/core/mstaking/msgs/MsgBeginRedelegate.d.ts +0 -39
- package/dist/core/mstaking/msgs/MsgCancelUnbondingDelegation.d.ts +0 -39
- package/dist/core/mstaking/msgs/MsgCreateValidator.d.ts +0 -44
- package/dist/core/mstaking/msgs/MsgDelegate.d.ts +0 -36
- package/dist/core/mstaking/msgs/MsgEditValidator.d.ts +0 -37
- package/dist/core/mstaking/msgs/MsgUndelegate.d.ts +0 -36
- package/dist/core/mstaking/msgs/MsgUpdateMstakingParams.d.ts +0 -33
- package/dist/core/mstaking/msgs/index.d.ts +0 -20
- package/dist/core/num.d.ts +0 -2
- package/dist/core/opchild/BridgeInfo.d.ts +0 -34
- package/dist/core/opchild/L2MigrationInfo.d.ts +0 -27
- package/dist/core/opchild/OpValidator.d.ts +0 -32
- package/dist/core/opchild/OpchildParams.d.ts +0 -45
- package/dist/core/opchild/index.d.ts +0 -5
- package/dist/core/opchild/msgs/MsgAddAttestor.d.ts +0 -39
- package/dist/core/opchild/msgs/MsgAddBridgeExecutor.d.ts +0 -32
- package/dist/core/opchild/msgs/MsgAddFeeWhitelistAddresses.d.ts +0 -32
- package/dist/core/opchild/msgs/MsgExecuteMessages.d.ts +0 -33
- package/dist/core/opchild/msgs/MsgFinalizeTokenDeposit.d.ts +0 -52
- package/dist/core/opchild/msgs/MsgInitiateTokenWithdrawal.d.ts +0 -36
- package/dist/core/opchild/msgs/MsgMigrateToken.d.ts +0 -33
- package/dist/core/opchild/msgs/MsgRegisterL2MigrationInfo.d.ts +0 -33
- package/dist/core/opchild/msgs/MsgRemoveAttestor.d.ts +0 -32
- package/dist/core/opchild/msgs/MsgRemoveBridgeExecutor.d.ts +0 -32
- package/dist/core/opchild/msgs/MsgRemoveFeeWhitelistAddresses.d.ts +0 -32
- package/dist/core/opchild/msgs/MsgSetBridgeInfo.d.ts +0 -33
- package/dist/core/opchild/msgs/MsgSpendFeePool.d.ts +0 -36
- package/dist/core/opchild/msgs/MsgUpdateMinGasPrices.d.ts +0 -33
- package/dist/core/opchild/msgs/MsgUpdateOpchildAdmin.d.ts +0 -32
- package/dist/core/opchild/msgs/MsgUpdateOpchildParams.d.ts +0 -33
- package/dist/core/opchild/msgs/MsgUpdateOracle.d.ts +0 -35
- package/dist/core/opchild/msgs/MsgUpdateSequencer.d.ts +0 -39
- package/dist/core/opchild/msgs/index.d.ts +0 -42
- package/dist/core/ophost/BatchInfo.d.ts +0 -25
- package/dist/core/ophost/BatchInfoWithOutput.d.ts +0 -26
- package/dist/core/ophost/BridgeConfig.d.ts +0 -51
- package/dist/core/ophost/L1MigrationInfo.d.ts +0 -30
- package/dist/core/ophost/OphostParams.d.ts +0 -26
- package/dist/core/ophost/Output.d.ts +0 -30
- package/dist/core/ophost/index.d.ts +0 -7
- package/dist/core/ophost/msgs/MsgCreateBridge.d.ts +0 -33
- package/dist/core/ophost/msgs/MsgDeleteOutput.d.ts +0 -35
- package/dist/core/ophost/msgs/MsgDisableBridge.d.ts +0 -32
- package/dist/core/ophost/msgs/MsgFinalizeTokenWithdrawal.d.ts +0 -60
- package/dist/core/ophost/msgs/MsgInitiateTokenDeposit.d.ts +0 -42
- package/dist/core/ophost/msgs/MsgProposeOutput.d.ts +0 -41
- package/dist/core/ophost/msgs/MsgRecordBatch.d.ts +0 -35
- package/dist/core/ophost/msgs/MsgRegisterL1MigrationInfo.d.ts +0 -33
- package/dist/core/ophost/msgs/MsgUpdateBatchInfo.d.ts +0 -36
- package/dist/core/ophost/msgs/MsgUpdateChallenger.d.ts +0 -35
- package/dist/core/ophost/msgs/MsgUpdateFinalizationPeriod.d.ts +0 -36
- package/dist/core/ophost/msgs/MsgUpdateMetadata.d.ts +0 -35
- package/dist/core/ophost/msgs/MsgUpdateOphostParams.d.ts +0 -33
- package/dist/core/ophost/msgs/MsgUpdateOracleConfig.d.ts +0 -35
- package/dist/core/ophost/msgs/MsgUpdateProposer.d.ts +0 -35
- package/dist/core/ophost/msgs/index.d.ts +0 -36
- package/dist/core/oracle/CurrencyPair.d.ts +0 -25
- package/dist/core/oracle/QuotePrice.d.ts +0 -27
- package/dist/core/oracle/index.d.ts +0 -3
- package/dist/core/oracle/msgs/MsgAddCurrencyPairs.d.ts +0 -33
- package/dist/core/oracle/msgs/MsgRemoveCurrencyPairs.d.ts +0 -32
- package/dist/core/oracle/msgs/index.d.ts +0 -10
- package/dist/core/params/ParamChange.d.ts +0 -42
- package/dist/core/params/index.d.ts +0 -2
- package/dist/core/params/proposals/ParameterChangeProposal.d.ts +0 -35
- package/dist/core/params/proposals/index.d.ts +0 -1
- package/dist/core/reward/RewardParams.d.ts +0 -38
- package/dist/core/reward/index.d.ts +0 -2
- package/dist/core/reward/msgs/MsgFundCommunityPoolReward.d.ts +0 -33
- package/dist/core/reward/msgs/MsgUpdateRewardParams.d.ts +0 -33
- package/dist/core/reward/msgs/index.d.ts +0 -10
- package/dist/core/slashing/SlashingParams.d.ts +0 -38
- package/dist/core/slashing/ValidatorSigningInfo.d.ts +0 -37
- package/dist/core/slashing/index.d.ts +0 -3
- package/dist/core/slashing/msgs/MsgUnjail.d.ts +0 -29
- package/dist/core/slashing/msgs/MsgUpdateSlashingParams.d.ts +0 -33
- package/dist/core/slashing/msgs/index.d.ts +0 -10
- package/dist/core/tokenfactory/TokenfactoryParams.d.ts +0 -25
- package/dist/core/tokenfactory/index.d.ts +0 -2
- package/dist/core/tokenfactory/msgs/MsgBurn.d.ts +0 -33
- package/dist/core/tokenfactory/msgs/MsgChangeAdmin.d.ts +0 -35
- package/dist/core/tokenfactory/msgs/MsgCreateDenom.d.ts +0 -32
- package/dist/core/tokenfactory/msgs/MsgMint.d.ts +0 -36
- package/dist/core/tokenfactory/msgs/MsgSetBeforeSendHook.d.ts +0 -35
- package/dist/core/tokenfactory/msgs/MsgSetDenomMetadataWasm.d.ts +0 -33
- package/dist/core/tokenfactory/msgs/MsgUpdateTokenfactoryParams.d.ts +0 -33
- package/dist/core/tokenfactory/msgs/index.d.ts +0 -20
- package/dist/core/tx/CompactBitArray.d.ts +0 -22
- package/dist/core/tx/Fee.d.ts +0 -31
- package/dist/core/tx/MultiSignature.d.ts +0 -13
- package/dist/core/tx/SignDoc.d.ts +0 -36
- package/dist/core/tx/SignMode.d.ts +0 -3
- package/dist/core/tx/SignatureV2.d.ts +0 -66
- package/dist/core/tx/Tx.d.ts +0 -146
- package/dist/core/tx/TxInfo.d.ts +0 -74
- package/dist/core/tx/index.d.ts +0 -7
- package/dist/core/upgrade/Plan.d.ts +0 -27
- package/dist/core/upgrade/index.d.ts +0 -2
- package/dist/core/upgrade/msgs/MsgCancelUpgrade.d.ts +0 -29
- package/dist/core/upgrade/msgs/MsgSoftwareUpgrade.d.ts +0 -33
- package/dist/core/upgrade/msgs/index.d.ts +0 -10
- package/dist/core/wasm/AbsoluteTxPosition.d.ts +0 -24
- package/dist/core/wasm/AccessConfig.d.ts +0 -27
- package/dist/core/wasm/WasmParams.d.ts +0 -32
- package/dist/core/wasm/authorizations/AcceptedMessageKeysFilter.d.ts +0 -28
- package/dist/core/wasm/authorizations/AcceptedMessagesFilter.d.ts +0 -28
- package/dist/core/wasm/authorizations/AllowAllMessagesFilter.d.ts +0 -24
- package/dist/core/wasm/authorizations/CodeGrant.d.ts +0 -25
- package/dist/core/wasm/authorizations/CombinedLimit.d.ts +0 -32
- package/dist/core/wasm/authorizations/ContractExecutionAuthorization.d.ts +0 -29
- package/dist/core/wasm/authorizations/ContractFilter.d.ts +0 -13
- package/dist/core/wasm/authorizations/ContractGrant.d.ts +0 -30
- package/dist/core/wasm/authorizations/ContractLimit.d.ts +0 -13
- package/dist/core/wasm/authorizations/ContractMigrationAuthorization.d.ts +0 -29
- package/dist/core/wasm/authorizations/MaxCallsLimit.d.ts +0 -28
- package/dist/core/wasm/authorizations/MaxFundsLimit.d.ts +0 -29
- package/dist/core/wasm/authorizations/StoreCodeAuthorization.d.ts +0 -29
- package/dist/core/wasm/authorizations/index.d.ts +0 -11
- package/dist/core/wasm/index.d.ts +0 -5
- package/dist/core/wasm/msgs/MsgAddCodeUploadParamsAddresses.d.ts +0 -32
- package/dist/core/wasm/msgs/MsgClearAdmin.d.ts +0 -32
- package/dist/core/wasm/msgs/MsgExecuteContract.d.ts +0 -39
- package/dist/core/wasm/msgs/MsgInstantiateContract.d.ts +0 -45
- package/dist/core/wasm/msgs/MsgInstantiateContractV2.d.ts +0 -51
- package/dist/core/wasm/msgs/MsgMigrateContract.d.ts +0 -38
- package/dist/core/wasm/msgs/MsgPinCodes.d.ts +0 -32
- package/dist/core/wasm/msgs/MsgRemoveCodeUploadParamsAddresses.d.ts +0 -32
- package/dist/core/wasm/msgs/MsgStoreAndInstantiateContract.d.ts +0 -61
- package/dist/core/wasm/msgs/MsgStoreAndMigrateContract.d.ts +0 -42
- package/dist/core/wasm/msgs/MsgStoreCode.d.ts +0 -36
- package/dist/core/wasm/msgs/MsgSudoContract.d.ts +0 -35
- package/dist/core/wasm/msgs/MsgUnpinCodes.d.ts +0 -32
- package/dist/core/wasm/msgs/MsgUpdateAdmin.d.ts +0 -35
- package/dist/core/wasm/msgs/MsgUpdateContractLabel.d.ts +0 -35
- package/dist/core/wasm/msgs/MsgUpdateInstantiateConfig.d.ts +0 -36
- package/dist/core/wasm/msgs/MsgUpdateMaxWasmSize.d.ts +0 -32
- package/dist/core/wasm/msgs/MsgUpdateWasmParams.d.ts +0 -33
- package/dist/core/wasm/msgs/index.d.ts +0 -42
- package/dist/core/wasmextension/AccessConfigExt.d.ts +0 -28
- package/dist/core/wasmextension/index.d.ts +0 -2
- package/dist/core/wasmextension/msgs/MsgStoreCodeAdmin.d.ts +0 -39
- package/dist/core/wasmextension/msgs/index.d.ts +0 -8
- package/dist/index.cjs +0 -6
- package/dist/index.d.ts +0 -4
- package/dist/index.mjs +0 -103590
- package/dist/key/Key.d.ts +0 -20
- package/dist/key/MnemonicKey.d.ts +0 -14
- package/dist/key/RawKey.d.ts +0 -9
- package/dist/key/index.d.ts +0 -3
- package/dist/util/bcs.d.ts +0 -44
- package/dist/util/hash.d.ts +0 -4
- package/dist/util/index.d.ts +0 -3
- package/dist/util/json.d.ts +0 -9
|
@@ -0,0 +1,1222 @@
|
|
|
1
|
+
import { t as CoinSchema } from "./coin_pb--WuIu4sX.mjs";
|
|
2
|
+
import { c as InitiaError, g as isNotFoundError, h as WebSocketNotAvailableError, p as TimeoutError } from "./errors-CN1MFOLv.mjs";
|
|
3
|
+
import { s as parseCoin, t as Coin } from "./coin-DPWbtAFA.mjs";
|
|
4
|
+
import { o as UnsignedTx } from "./broadcast-De8MdmYa.mjs";
|
|
5
|
+
import { t as Message$1 } from "./types-CSS5rfW1.mjs";
|
|
6
|
+
import { t as base64ToUint8Array } from "./amino-CMQN7Frn.mjs";
|
|
7
|
+
import { n as isDirectSigner, r as isEIP191Signer, t as isAminoSigner } from "./types-CLfdsa48.mjs";
|
|
8
|
+
import { n as fetchWithTimeout, t as fetchJson } from "./fetch-Bq_aay6V.mjs";
|
|
9
|
+
import { t as createGrpcClient } from "./grpc-client-DGyZjGcT.mjs";
|
|
10
|
+
import { a as file_cosmos_bank_v1beta1_tx, r as file_ibc_applications_transfer_v1_tx, v as buildChainContextFactory, y as wrapClientWithCache } from "./types_pb-K7pKBvcg.mjs";
|
|
11
|
+
import { o as createSession } from "./waiting-BigHYRNN.mjs";
|
|
12
|
+
import { r as file_minievm_evm_v1_tx } from "./tx_pb-BVCXH992.mjs";
|
|
13
|
+
import { s as file_initia_move_v1_tx } from "./tx_pb-DYspoJTt.mjs";
|
|
14
|
+
import { i as file_opinit_ophost_v1_tx, n as MsgFinalizeTokenWithdrawalSchema, r as MsgInitiateTokenDepositSchema, t as initiaChain } from "./initia-B8l_x6sT.mjs";
|
|
15
|
+
import { a as file_opinit_opchild_v1_tx, i as MsgInitiateTokenWithdrawalSchema } from "./tx_pb-CnFNMLIq.mjs";
|
|
16
|
+
import { n as resolveRegistry, r as resolveServices, t as resolveMsgs } from "./resolve-DdtY7KDz.mjs";
|
|
17
|
+
import { create, createRegistry, fromJson, toBinary } from "@bufbuild/protobuf";
|
|
18
|
+
import { AnySchema } from "@bufbuild/protobuf/wkt";
|
|
19
|
+
import { base64 } from "@scure/base";
|
|
20
|
+
import { sha3_256 } from "@noble/hashes/sha3.js";
|
|
21
|
+
import { bytesToHex, hexToBytes } from "@noble/hashes/utils.js";
|
|
22
|
+
//#region src/bridge/executor.ts
|
|
23
|
+
/**
|
|
24
|
+
* Decode base64 string to hex string.
|
|
25
|
+
*/
|
|
26
|
+
function base64ToHex(b64) {
|
|
27
|
+
return bytesToHex(base64.decode(b64));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Convert Executor API response to WithdrawalInfo.
|
|
31
|
+
* Status is set to { status: 'pending' } as a placeholder — actual status
|
|
32
|
+
* is determined by L1 queries in the status determination logic.
|
|
33
|
+
*/
|
|
34
|
+
function toWithdrawalInfo(raw) {
|
|
35
|
+
return {
|
|
36
|
+
sequence: BigInt(raw.sequence),
|
|
37
|
+
from: raw.from,
|
|
38
|
+
to: raw.to,
|
|
39
|
+
amount: new Coin(raw.amount.denom, raw.amount.amount),
|
|
40
|
+
outputIndex: BigInt(raw.output_index),
|
|
41
|
+
bridgeId: BigInt(raw.bridge_id),
|
|
42
|
+
txHash: raw.tx_hash,
|
|
43
|
+
withdrawalProofs: raw.withdrawal_proofs.map(base64ToHex),
|
|
44
|
+
version: base64ToHex(raw.version),
|
|
45
|
+
storageRoot: base64ToHex(raw.storage_root),
|
|
46
|
+
lastBlockHash: base64ToHex(raw.last_block_hash)
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Fetch paginated withdrawal list from Executor API.
|
|
51
|
+
*
|
|
52
|
+
* @param executorUri - Executor API base URL (e.g., 'https://executor.minimove-2.initia.xyz')
|
|
53
|
+
* @param address - L2 sender address to query withdrawals for
|
|
54
|
+
* @param options - Pagination options
|
|
55
|
+
* @returns Array of WithdrawalInfo without status (status determined separately by L1 queries)
|
|
56
|
+
*/
|
|
57
|
+
async function fetchWithdrawals(executorUri, address, options) {
|
|
58
|
+
const params = new URLSearchParams();
|
|
59
|
+
if (options?.limit != null) params.set("limit", String(options.limit));
|
|
60
|
+
if (options?.offset != null) params.set("offset", String(options.offset));
|
|
61
|
+
const query = params.toString();
|
|
62
|
+
return (await fetchJson(`${executorUri}/withdrawals/${address}${query ? `?${query}` : ""}`)).withdrawals.map(toWithdrawalInfo);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Fetch a single withdrawal by sequence from Executor API.
|
|
66
|
+
*
|
|
67
|
+
* @param executorUri - Executor API base URL
|
|
68
|
+
* @param sequence - Withdrawal sequence number
|
|
69
|
+
* @returns WithdrawalInfo without status (status determined separately by L1 queries)
|
|
70
|
+
*/
|
|
71
|
+
async function fetchWithdrawal(executorUri, sequence) {
|
|
72
|
+
return toWithdrawalInfo(await fetchJson(`${executorUri}/withdrawal/${sequence.toString()}`));
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/bridge/hash.ts
|
|
76
|
+
/**
|
|
77
|
+
* Withdrawal hash calculation for OPInit bridge.
|
|
78
|
+
*
|
|
79
|
+
* Computes the SHA3-256 double hash used as Merkle leaf for withdrawal verification.
|
|
80
|
+
*/
|
|
81
|
+
const textEncoder = new TextEncoder();
|
|
82
|
+
/**
|
|
83
|
+
* Encode a bigint as big-endian 8 bytes.
|
|
84
|
+
*/
|
|
85
|
+
function bigintToBeBytes(value) {
|
|
86
|
+
const buf = new Uint8Array(8);
|
|
87
|
+
for (let i = 7; i >= 0; i--) {
|
|
88
|
+
buf[i] = Number(value & 255n);
|
|
89
|
+
value >>= 8n;
|
|
90
|
+
}
|
|
91
|
+
return buf;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Calculate the withdrawal hash for OPInit bridge verification.
|
|
95
|
+
*
|
|
96
|
+
* This is a SHA3-256 double hash (Merkle leaf node format) computed from:
|
|
97
|
+
* - bridgeId (8 bytes big-endian)
|
|
98
|
+
* - l2Sequence (8 bytes big-endian)
|
|
99
|
+
* - sha3_256(sender UTF-8) (32 bytes)
|
|
100
|
+
* - sha3_256(receiver UTF-8) (32 bytes)
|
|
101
|
+
* - sha3_256(denom UTF-8) (32 bytes)
|
|
102
|
+
* - amount (8 bytes big-endian)
|
|
103
|
+
*
|
|
104
|
+
* Result = sha3_256(sha3_256(concatenation))
|
|
105
|
+
*
|
|
106
|
+
* @param bridgeId - Bridge ID
|
|
107
|
+
* @param l2Sequence - L2 withdrawal sequence number
|
|
108
|
+
* @param sender - L2 sender address
|
|
109
|
+
* @param receiver - L1 receiver address
|
|
110
|
+
* @param denom - Token denomination
|
|
111
|
+
* @param amount - Token amount
|
|
112
|
+
* @returns 32-byte withdrawal hash
|
|
113
|
+
*/
|
|
114
|
+
function calculateWithdrawalHash(bridgeId, l2Sequence, sender, receiver, denom, amount) {
|
|
115
|
+
const parts = [
|
|
116
|
+
bigintToBeBytes(bridgeId),
|
|
117
|
+
bigintToBeBytes(l2Sequence),
|
|
118
|
+
sha3_256(textEncoder.encode(sender)),
|
|
119
|
+
sha3_256(textEncoder.encode(receiver)),
|
|
120
|
+
sha3_256(textEncoder.encode(denom)),
|
|
121
|
+
bigintToBeBytes(amount)
|
|
122
|
+
];
|
|
123
|
+
const totalLength = parts.reduce((sum, p) => sum + p.length, 0);
|
|
124
|
+
const concat = new Uint8Array(totalLength);
|
|
125
|
+
let offset = 0;
|
|
126
|
+
for (const part of parts) {
|
|
127
|
+
concat.set(part, offset);
|
|
128
|
+
offset += part.length;
|
|
129
|
+
}
|
|
130
|
+
return sha3_256(sha3_256(concat));
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/bridge/utils.ts
|
|
134
|
+
/**
|
|
135
|
+
* Convert protobuf Duration to milliseconds.
|
|
136
|
+
*/
|
|
137
|
+
function durationToMs(d) {
|
|
138
|
+
return Number(d.seconds) * 1e3 + Math.floor(d.nanos / 1e6);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Convert protobuf Timestamp to milliseconds since epoch.
|
|
142
|
+
*/
|
|
143
|
+
function timestampToMs(t) {
|
|
144
|
+
return Number(t.seconds) * 1e3 + Math.floor(t.nanos / 1e6);
|
|
145
|
+
}
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/bridge/op-bridge.ts
|
|
148
|
+
/**
|
|
149
|
+
* Internal OP bridge implementation.
|
|
150
|
+
* Use `provider.bridge` instead of instantiating directly.
|
|
151
|
+
*/
|
|
152
|
+
var OpBridgeInternal = class {
|
|
153
|
+
_l1Client;
|
|
154
|
+
constructor(provider, createTransport) {
|
|
155
|
+
this.provider = provider;
|
|
156
|
+
this.createTransport = createTransport;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Lazily create and cache the L1 ophost gRPC client.
|
|
160
|
+
* Finds L1 chain from provider automatically.
|
|
161
|
+
*/
|
|
162
|
+
getL1Client() {
|
|
163
|
+
if (this._l1Client) return this._l1Client;
|
|
164
|
+
const l1Chain = this.provider.listChains().find((c) => c.chainType === "initia");
|
|
165
|
+
if (!l1Chain) throw new Error("L1 (initia) chain not found in provider. Ensure the provider includes L1 chain info for withdrawal status queries.");
|
|
166
|
+
const config = initiaChain.build();
|
|
167
|
+
this._l1Client = wrapClientWithCache(createGrpcClient(this.createTransport(l1Chain), config.services, void 0, void 0, config.registry), l1Chain.chainId);
|
|
168
|
+
return this._l1Client;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Resolve bridgeId for a given L2 chain.
|
|
172
|
+
*
|
|
173
|
+
* @param l2ChainId - The L2 chain ID (e.g., 'minimove-1')
|
|
174
|
+
* @returns The bridge ID for the L2 chain
|
|
175
|
+
* @throws Error if chain is not found or has no opBridgeId
|
|
176
|
+
*/
|
|
177
|
+
getBridgeId(l2ChainId) {
|
|
178
|
+
const chainInfo = this.provider.getChainInfo(l2ChainId);
|
|
179
|
+
if (!chainInfo) throw new Error(`Chain not found: ${l2ChainId}`);
|
|
180
|
+
if (chainInfo.opBridgeId == null) throw new Error(`Chain ${l2ChainId} does not have an opBridgeId. Only L2 (minitia) chains support bridging.`);
|
|
181
|
+
return chainInfo.opBridgeId;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Create a MsgInitiateTokenDeposit for L1 → L2 transfer.
|
|
185
|
+
*
|
|
186
|
+
* @param options - Deposit options (use toChain for auto bridgeId resolve, or bridgeId directly)
|
|
187
|
+
* @returns Packed Message ready for signAndBroadcast
|
|
188
|
+
*/
|
|
189
|
+
deposit(options) {
|
|
190
|
+
const { sender, to, amount, data } = options;
|
|
191
|
+
const bridgeId = "toChain" in options && options.toChain ? this.getBridgeId(options.toChain) : options.bridgeId;
|
|
192
|
+
const resolvedCoin = typeof amount === "string" ? parseCoin(amount) : amount;
|
|
193
|
+
return new Message$1(MsgInitiateTokenDepositSchema, {
|
|
194
|
+
sender,
|
|
195
|
+
bridgeId: BigInt(bridgeId),
|
|
196
|
+
to: to ?? sender,
|
|
197
|
+
amount: create(CoinSchema, {
|
|
198
|
+
denom: resolvedCoin.denom,
|
|
199
|
+
amount: resolvedCoin.amount
|
|
200
|
+
}),
|
|
201
|
+
data: data ?? new Uint8Array()
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Create a MsgInitiateTokenWithdrawal for L2 → L1 transfer.
|
|
206
|
+
*
|
|
207
|
+
* @param options - Withdrawal options
|
|
208
|
+
* @returns Packed Message ready for signAndBroadcast
|
|
209
|
+
*/
|
|
210
|
+
withdraw(options) {
|
|
211
|
+
const { sender, to, amount } = options;
|
|
212
|
+
const resolvedCoin = typeof amount === "string" ? parseCoin(amount) : amount;
|
|
213
|
+
return new Message$1(MsgInitiateTokenWithdrawalSchema, {
|
|
214
|
+
sender,
|
|
215
|
+
to: to ?? sender,
|
|
216
|
+
amount: create(CoinSchema, {
|
|
217
|
+
denom: resolvedCoin.denom,
|
|
218
|
+
amount: resolvedCoin.amount
|
|
219
|
+
})
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Create a MsgFinalizeTokenWithdrawal to claim a withdrawal on L1.
|
|
224
|
+
*
|
|
225
|
+
* @param options - Claim options with sender and withdrawal info (must be 'claimable')
|
|
226
|
+
* @returns Packed Message ready for signAndBroadcast
|
|
227
|
+
* @throws Error if withdrawal status is not 'claimable'
|
|
228
|
+
*/
|
|
229
|
+
claim(options) {
|
|
230
|
+
const { sender, withdrawal } = options;
|
|
231
|
+
if (withdrawal.status.status !== "claimable") throw new Error(`Withdrawal is not claimable (current status: ${withdrawal.status.status})`);
|
|
232
|
+
return new Message$1(MsgFinalizeTokenWithdrawalSchema, {
|
|
233
|
+
sender,
|
|
234
|
+
bridgeId: withdrawal.bridgeId,
|
|
235
|
+
outputIndex: withdrawal.outputIndex,
|
|
236
|
+
withdrawalProofs: withdrawal.withdrawalProofs.map((p) => hexToBytes(p)),
|
|
237
|
+
from: withdrawal.from,
|
|
238
|
+
to: withdrawal.to,
|
|
239
|
+
sequence: withdrawal.sequence,
|
|
240
|
+
amount: create(CoinSchema, {
|
|
241
|
+
denom: withdrawal.amount.denom,
|
|
242
|
+
amount: withdrawal.amount.amount
|
|
243
|
+
}),
|
|
244
|
+
version: hexToBytes(withdrawal.version),
|
|
245
|
+
storageRoot: hexToBytes(withdrawal.storageRoot),
|
|
246
|
+
lastBlockHash: hexToBytes(withdrawal.lastBlockHash)
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* List all chains that support OPInit bridging.
|
|
251
|
+
*
|
|
252
|
+
* @returns Array of ChainInfo with opBridgeId defined
|
|
253
|
+
*/
|
|
254
|
+
listBridgeableChains() {
|
|
255
|
+
return this.provider.listChains().filter((c) => c.opBridgeId != null);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Fetch withdrawals for an address and determine their statuses via L1 queries.
|
|
259
|
+
*
|
|
260
|
+
* @param l2ChainId - The L2 chain ID (e.g., 'minimove-1')
|
|
261
|
+
* @param address - L2 sender address
|
|
262
|
+
* @param options - Pagination options for Executor API
|
|
263
|
+
* @returns Array of WithdrawalInfo with status determined
|
|
264
|
+
*/
|
|
265
|
+
async getWithdrawals(l2ChainId, address, options) {
|
|
266
|
+
const l2Info = this.provider.getChainInfo(l2ChainId);
|
|
267
|
+
if (!l2Info) throw new Error(`Chain not found: ${l2ChainId}`);
|
|
268
|
+
if (!l2Info.executorUri) throw new Error(`Chain ${l2ChainId} does not have an executorUri. Cannot fetch withdrawals.`);
|
|
269
|
+
if (l2Info.opBridgeId == null) throw new Error(`Chain ${l2ChainId} does not have an opBridgeId`);
|
|
270
|
+
const rawWithdrawals = await fetchWithdrawals(l2Info.executorUri, address, options);
|
|
271
|
+
if (rawWithdrawals.length === 0) return [];
|
|
272
|
+
const ophost = this.getL1Client().ophost;
|
|
273
|
+
const finalizationPeriod = (await ophost.bridge({ bridgeId: l2Info.opBridgeId })).bridgeConfig?.finalizationPeriod;
|
|
274
|
+
if (!finalizationPeriod) throw new Error("Bridge config missing finalizationPeriod");
|
|
275
|
+
const finalizationMs = durationToMs(finalizationPeriod);
|
|
276
|
+
let latestProposedIndex = 0n;
|
|
277
|
+
try {
|
|
278
|
+
const proposalsResponse = await ophost.outputProposals({
|
|
279
|
+
bridgeId: l2Info.opBridgeId,
|
|
280
|
+
pagination: {
|
|
281
|
+
reverse: true,
|
|
282
|
+
limit: 1n
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
if (proposalsResponse.outputProposals.length > 0) latestProposedIndex = proposalsResponse.outputProposals[0].outputIndex;
|
|
286
|
+
} catch (err) {
|
|
287
|
+
if (!isNotFoundError(err)) throw err;
|
|
288
|
+
}
|
|
289
|
+
const nonPendingIndices = [...new Set(rawWithdrawals.map((w) => w.outputIndex).filter((i) => i > 0n && i <= latestProposedIndex))];
|
|
290
|
+
const outputTimestamps = /* @__PURE__ */ new Map();
|
|
291
|
+
await Promise.all(nonPendingIndices.map(async (outputIndex) => {
|
|
292
|
+
try {
|
|
293
|
+
const response = await ophost.outputProposal({
|
|
294
|
+
bridgeId: l2Info.opBridgeId,
|
|
295
|
+
outputIndex
|
|
296
|
+
});
|
|
297
|
+
if (response.outputProposal?.l1BlockTime) outputTimestamps.set(outputIndex, timestampToMs(response.outputProposal.l1BlockTime));
|
|
298
|
+
} catch (err) {
|
|
299
|
+
if (!isNotFoundError(err)) throw err;
|
|
300
|
+
}
|
|
301
|
+
}));
|
|
302
|
+
const now = Date.now();
|
|
303
|
+
return Promise.all(rawWithdrawals.map(async (raw) => {
|
|
304
|
+
const status = await this.determineWithdrawalStatus(raw, outputTimestamps, latestProposedIndex, finalizationMs, now, ophost);
|
|
305
|
+
return {
|
|
306
|
+
...raw,
|
|
307
|
+
status
|
|
308
|
+
};
|
|
309
|
+
}));
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Fetch a single withdrawal and determine its status.
|
|
313
|
+
*
|
|
314
|
+
* @param l2ChainId - The L2 chain ID
|
|
315
|
+
* @param sequence - Withdrawal sequence number
|
|
316
|
+
* @returns WithdrawalInfo with status determined
|
|
317
|
+
*/
|
|
318
|
+
async getWithdrawalStatus(l2ChainId, sequence) {
|
|
319
|
+
const l2Info = this.provider.getChainInfo(l2ChainId);
|
|
320
|
+
if (!l2Info) throw new Error(`Chain not found: ${l2ChainId}`);
|
|
321
|
+
if (!l2Info.executorUri) throw new Error(`Chain ${l2ChainId} does not have an executorUri. Cannot fetch withdrawal.`);
|
|
322
|
+
if (l2Info.opBridgeId == null) throw new Error(`Chain ${l2ChainId} does not have an opBridgeId`);
|
|
323
|
+
const raw = await fetchWithdrawal(l2Info.executorUri, sequence);
|
|
324
|
+
const ophost = this.getL1Client().ophost;
|
|
325
|
+
const finalizationPeriod = (await ophost.bridge({ bridgeId: l2Info.opBridgeId })).bridgeConfig?.finalizationPeriod;
|
|
326
|
+
if (!finalizationPeriod) throw new Error("Bridge config missing finalizationPeriod");
|
|
327
|
+
const finalizationMs = durationToMs(finalizationPeriod);
|
|
328
|
+
const outputTimestamps = /* @__PURE__ */ new Map();
|
|
329
|
+
let latestProposedIndex = 0n;
|
|
330
|
+
if (raw.outputIndex > 0n) try {
|
|
331
|
+
const response = await ophost.outputProposal({
|
|
332
|
+
bridgeId: l2Info.opBridgeId,
|
|
333
|
+
outputIndex: raw.outputIndex
|
|
334
|
+
});
|
|
335
|
+
if (response.outputProposal?.l1BlockTime) {
|
|
336
|
+
outputTimestamps.set(raw.outputIndex, timestampToMs(response.outputProposal.l1BlockTime));
|
|
337
|
+
latestProposedIndex = raw.outputIndex;
|
|
338
|
+
}
|
|
339
|
+
} catch (err) {
|
|
340
|
+
if (!isNotFoundError(err)) throw err;
|
|
341
|
+
}
|
|
342
|
+
const status = await this.determineWithdrawalStatus(raw, outputTimestamps, latestProposedIndex, finalizationMs, Date.now(), ophost);
|
|
343
|
+
return {
|
|
344
|
+
...raw,
|
|
345
|
+
status
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Determine withdrawal status based on output proposals and finalization period.
|
|
350
|
+
*/
|
|
351
|
+
async determineWithdrawalStatus(raw, outputTimestamps, latestProposedIndex, finalizationMs, now, ophost) {
|
|
352
|
+
if (raw.outputIndex === 0n || raw.outputIndex > latestProposedIndex) return { status: "pending" };
|
|
353
|
+
const l1BlockTimeMs = outputTimestamps.get(raw.outputIndex);
|
|
354
|
+
if (l1BlockTimeMs == null) return { status: "pending" };
|
|
355
|
+
const claimableAt = new Date(l1BlockTimeMs + finalizationMs);
|
|
356
|
+
if (claimableAt.getTime() > now) return {
|
|
357
|
+
status: "waiting",
|
|
358
|
+
claimableAt
|
|
359
|
+
};
|
|
360
|
+
const hash = calculateWithdrawalHash(raw.bridgeId, raw.sequence, raw.from, raw.to, raw.amount.denom, BigInt(raw.amount.amount));
|
|
361
|
+
try {
|
|
362
|
+
if ((await ophost.claimed({
|
|
363
|
+
bridgeId: raw.bridgeId,
|
|
364
|
+
withdrawalHash: hash
|
|
365
|
+
})).claimed) return { status: "claimed" };
|
|
366
|
+
} catch (err) {
|
|
367
|
+
if (!isNotFoundError(err)) throw err;
|
|
368
|
+
}
|
|
369
|
+
return { status: "claimable" };
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/bridge/router-client.ts
|
|
374
|
+
const INTERWOVENKIT_VERSION = "2.4.6";
|
|
375
|
+
const routerRegistry = createRegistry(file_cosmos_bank_v1beta1_tx, file_ibc_applications_transfer_v1_tx, file_opinit_ophost_v1_tx, file_opinit_opchild_v1_tx, file_minievm_evm_v1_tx, file_initia_move_v1_tx);
|
|
376
|
+
var RouterClient = class {
|
|
377
|
+
constructor(baseUrl) {
|
|
378
|
+
this.baseUrl = baseUrl;
|
|
379
|
+
}
|
|
380
|
+
async route(opts) {
|
|
381
|
+
const body = {
|
|
382
|
+
amount_in: opts.amount,
|
|
383
|
+
source_asset_chain_id: opts.source.chainId,
|
|
384
|
+
source_asset_denom: opts.source.denom,
|
|
385
|
+
dest_asset_chain_id: opts.dest.chainId,
|
|
386
|
+
dest_asset_denom: opts.dest.denom,
|
|
387
|
+
allow_unsafe: opts.allowUnsafe,
|
|
388
|
+
go_fast: opts.goFast,
|
|
389
|
+
is_op_withdraw: opts.isOpWithdraw
|
|
390
|
+
};
|
|
391
|
+
return normalizeRouteResponse(await (await this.post("/v2/fungible/route", body)).json());
|
|
392
|
+
}
|
|
393
|
+
async msgs(opts) {
|
|
394
|
+
const raw = opts.route._raw;
|
|
395
|
+
const body = {
|
|
396
|
+
amount_in: raw.amount_in,
|
|
397
|
+
amount_out: raw.amount_out,
|
|
398
|
+
source_asset_chain_id: raw.source_asset_chain_id,
|
|
399
|
+
source_asset_denom: raw.source_asset_denom,
|
|
400
|
+
dest_asset_chain_id: raw.dest_asset_chain_id,
|
|
401
|
+
dest_asset_denom: raw.dest_asset_denom,
|
|
402
|
+
address_list: opts.addresses,
|
|
403
|
+
operations: raw.operations,
|
|
404
|
+
slippage_tolerance_percent: opts.slippageTolerance ?? "1",
|
|
405
|
+
signed_op_hook: opts.signedOpHook,
|
|
406
|
+
ignore_blacklist: opts.ignoreBlacklist
|
|
407
|
+
};
|
|
408
|
+
return normalizeTransferTxs(await (await this.post("/v2/fungible/msgs", body)).json());
|
|
409
|
+
}
|
|
410
|
+
async opHook(opts) {
|
|
411
|
+
const body = {
|
|
412
|
+
source_address: opts.sourceAddress,
|
|
413
|
+
source_asset_chain_id: opts.sourceChainId,
|
|
414
|
+
source_asset_denom: opts.sourceDenom,
|
|
415
|
+
dest_address: opts.destAddress,
|
|
416
|
+
dest_asset_chain_id: opts.destChainId,
|
|
417
|
+
dest_asset_denom: opts.destDenom
|
|
418
|
+
};
|
|
419
|
+
return normalizeOpHookResponse(await (await this.post("/op-hook", body)).json());
|
|
420
|
+
}
|
|
421
|
+
async track(txHash, chainId) {
|
|
422
|
+
await this.post("/v2/tx/track", {
|
|
423
|
+
tx_hash: txHash,
|
|
424
|
+
chain_id: chainId
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
async assets(chainIds) {
|
|
428
|
+
const query = chainIds?.length ? `?chain_ids=${chainIds.join(",")}` : "";
|
|
429
|
+
return normalizeAssetsResponse(await (await this.get(`/v2/fungible/assets${query}`)).json());
|
|
430
|
+
}
|
|
431
|
+
async chains(chainIds) {
|
|
432
|
+
const query = chainIds?.length ? `?chain_ids=${chainIds.join(",")}` : "";
|
|
433
|
+
return normalizeChainsResponse(await (await this.get(`/v2/info/chains${query}`)).json());
|
|
434
|
+
}
|
|
435
|
+
async balances(queries) {
|
|
436
|
+
return normalizeBalancesResponse(await (await this.post("/v2/info/balances", { chains: queries })).json());
|
|
437
|
+
}
|
|
438
|
+
async nftTransfer(opts) {
|
|
439
|
+
const body = {
|
|
440
|
+
from_address: opts.fromAddress,
|
|
441
|
+
from_chain_id: opts.fromChainId,
|
|
442
|
+
to_address: opts.toAddress,
|
|
443
|
+
to_chain_id: opts.toChainId,
|
|
444
|
+
token_ids: opts.tokenIds,
|
|
445
|
+
collection_address: opts.collectionAddress
|
|
446
|
+
};
|
|
447
|
+
if (opts.classId) body.class_id = opts.classId;
|
|
448
|
+
if (opts.classTrace) body.class_trace = {
|
|
449
|
+
path: opts.classTrace.path,
|
|
450
|
+
base_class_id: opts.classTrace.baseClassId
|
|
451
|
+
};
|
|
452
|
+
if (opts.objectAddresses) body.object_addresses = opts.objectAddresses;
|
|
453
|
+
if (opts.l1RecoverAddress) body.l1_recover_address = opts.l1RecoverAddress;
|
|
454
|
+
if (opts.outgoingProxy) body.outgoing_proxy = opts.outgoingProxy;
|
|
455
|
+
if (opts.timeout !== void 0) body.timeout = opts.timeout;
|
|
456
|
+
if (opts.ignoreBlacklist) body.ignore_blacklist = opts.ignoreBlacklist;
|
|
457
|
+
return await (await this.post("/nft", body)).json();
|
|
458
|
+
}
|
|
459
|
+
async status(txHash, chainId) {
|
|
460
|
+
const params = new URLSearchParams({
|
|
461
|
+
tx_hash: txHash,
|
|
462
|
+
chain_id: chainId
|
|
463
|
+
});
|
|
464
|
+
return normalizeStatus(await (await this.get(`/v2/tx/status?${params.toString()}`)).json());
|
|
465
|
+
}
|
|
466
|
+
headers() {
|
|
467
|
+
return { "InterwovenKit-Version": INTERWOVENKIT_VERSION };
|
|
468
|
+
}
|
|
469
|
+
async throwIfNotOk(res, path) {
|
|
470
|
+
if (res.ok) return;
|
|
471
|
+
let detail = "";
|
|
472
|
+
try {
|
|
473
|
+
const body = await res.json();
|
|
474
|
+
if (body.message) detail = `: ${body.message}`;
|
|
475
|
+
} catch {}
|
|
476
|
+
throw new InitiaError(`Router API ${path} failed (${res.status})${detail}`);
|
|
477
|
+
}
|
|
478
|
+
async get(path) {
|
|
479
|
+
const res = await fetchWithTimeout(`${this.baseUrl}${path}`, { headers: this.headers() });
|
|
480
|
+
await this.throwIfNotOk(res, path);
|
|
481
|
+
return res;
|
|
482
|
+
}
|
|
483
|
+
async post(path, body) {
|
|
484
|
+
const res = await fetchWithTimeout(`${this.baseUrl}${path}`, {
|
|
485
|
+
method: "POST",
|
|
486
|
+
headers: {
|
|
487
|
+
...this.headers(),
|
|
488
|
+
"Content-Type": "application/json"
|
|
489
|
+
},
|
|
490
|
+
body: JSON.stringify(body)
|
|
491
|
+
});
|
|
492
|
+
await this.throwIfNotOk(res, path);
|
|
493
|
+
return res;
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
/**
|
|
497
|
+
* Normalize route response. Preserves the entire raw response in `_raw`
|
|
498
|
+
* so that buildTransferMsgs() can pass server-original data without loss.
|
|
499
|
+
*/
|
|
500
|
+
function normalizeRouteResponse(raw) {
|
|
501
|
+
return {
|
|
502
|
+
amountIn: raw.amount_in,
|
|
503
|
+
amountOut: raw.amount_out,
|
|
504
|
+
source: {
|
|
505
|
+
chainId: raw.source_asset_chain_id,
|
|
506
|
+
denom: raw.source_asset_denom,
|
|
507
|
+
symbol: raw.source_asset_symbol
|
|
508
|
+
},
|
|
509
|
+
dest: {
|
|
510
|
+
chainId: raw.dest_asset_chain_id,
|
|
511
|
+
denom: raw.dest_asset_denom,
|
|
512
|
+
symbol: raw.dest_asset_symbol
|
|
513
|
+
},
|
|
514
|
+
operations: normalizeOperations(raw.operations),
|
|
515
|
+
estimatedDurationSeconds: raw.estimated_duration_seconds,
|
|
516
|
+
usdAmountIn: raw.usd_amount_in,
|
|
517
|
+
usdAmountOut: raw.usd_amount_out,
|
|
518
|
+
warnings: raw.warnings,
|
|
519
|
+
extraInfos: raw.extra_infos,
|
|
520
|
+
extraWarnings: raw.extra_warnings,
|
|
521
|
+
requiresOpHook: raw.required_op_hook,
|
|
522
|
+
_raw: raw
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Normalize operations array (display-only; originals preserved in _raw).
|
|
527
|
+
*/
|
|
528
|
+
function normalizeOperations(raw) {
|
|
529
|
+
return raw.map((op) => {
|
|
530
|
+
const type = op.type ?? op.op_type;
|
|
531
|
+
switch (type) {
|
|
532
|
+
case "transfer": return {
|
|
533
|
+
type: "transfer",
|
|
534
|
+
chainId: op.chain_id ?? "",
|
|
535
|
+
channel: op.channel ?? "",
|
|
536
|
+
denomIn: op.denom_in ?? "",
|
|
537
|
+
denomOut: op.denom_out ?? ""
|
|
538
|
+
};
|
|
539
|
+
case "swap": return {
|
|
540
|
+
type: "swap",
|
|
541
|
+
poolId: op.pool_id ?? "",
|
|
542
|
+
denomIn: op.denom_in ?? "",
|
|
543
|
+
denomOut: op.denom_out ?? ""
|
|
544
|
+
};
|
|
545
|
+
default: return {
|
|
546
|
+
type,
|
|
547
|
+
denomIn: op.denom_in ?? "",
|
|
548
|
+
denomOut: op.denom_out ?? ""
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Normalize transfer transactions response.
|
|
555
|
+
* Converts base64-encoded proto messages to SDK Message format.
|
|
556
|
+
*/
|
|
557
|
+
function normalizeTransferTxs(raw) {
|
|
558
|
+
return raw.txs.map((tx) => ({
|
|
559
|
+
chainId: tx.chain_id ?? tx.cosmos_tx?.chain_id ?? tx.evm_tx?.chain_id ?? "",
|
|
560
|
+
cosmosMsgs: normalizeCosmosMsgs(tx.cosmos_tx?.msgs),
|
|
561
|
+
evmTx: tx.evm_tx ? {
|
|
562
|
+
to: tx.evm_tx.to,
|
|
563
|
+
data: tx.evm_tx.data,
|
|
564
|
+
value: tx.evm_tx.value
|
|
565
|
+
} : void 0,
|
|
566
|
+
signerAddress: tx.signer_address ?? tx.cosmos_tx?.signer_address ?? tx.evm_tx?.signer_address ?? ""
|
|
567
|
+
}));
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Convert router API message format to SDK Message format.
|
|
571
|
+
*
|
|
572
|
+
* The Router API returns `msg` as a JSON string (snake_case),
|
|
573
|
+
* not base64-encoded proto bytes. We use the routerRegistry to
|
|
574
|
+
* resolve the schema, then `fromJson` → `toBinary` → `Any`.
|
|
575
|
+
*/
|
|
576
|
+
function normalizeCosmosMsgs(msgs) {
|
|
577
|
+
if (!msgs?.length) return void 0;
|
|
578
|
+
return msgs.map((m) => {
|
|
579
|
+
let value;
|
|
580
|
+
if (m.msg.startsWith("{")) {
|
|
581
|
+
const typeName = m.msg_type_url.replace(/^\//, "");
|
|
582
|
+
const desc = routerRegistry.getMessage(typeName);
|
|
583
|
+
if (!desc) throw new InitiaError(`Unknown router msg type: ${m.msg_type_url}`);
|
|
584
|
+
value = toBinary(desc, fromJson(desc, JSON.parse(m.msg)));
|
|
585
|
+
} else value = base64ToUint8Array(m.msg);
|
|
586
|
+
return Message$1.fromAny(create(AnySchema, {
|
|
587
|
+
typeUrl: m.msg_type_url,
|
|
588
|
+
value
|
|
589
|
+
}));
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
function normalizeOpHookResponse(raw) {
|
|
593
|
+
return {
|
|
594
|
+
chainId: raw.chain_id,
|
|
595
|
+
hook: raw.hook
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
function normalizeAssetsResponse(raw) {
|
|
599
|
+
const result = {};
|
|
600
|
+
for (const [chainId, { assets }] of Object.entries(raw.chain_to_assets_map)) result[chainId] = assets.map((a) => ({
|
|
601
|
+
denom: a.denom,
|
|
602
|
+
chainId: a.chain_id,
|
|
603
|
+
originDenom: a.origin_denom,
|
|
604
|
+
originChainId: a.origin_chain_id,
|
|
605
|
+
symbol: a.symbol,
|
|
606
|
+
name: a.name,
|
|
607
|
+
decimals: a.decimals,
|
|
608
|
+
logoUri: a.logo_uri,
|
|
609
|
+
recommendedSymbol: a.recommended_symbol,
|
|
610
|
+
description: a.description,
|
|
611
|
+
coingeckoId: a.coingecko_id,
|
|
612
|
+
trace: a.trace,
|
|
613
|
+
isCw20: a.is_cw20,
|
|
614
|
+
isEvm: a.is_evm,
|
|
615
|
+
isSvm: a.is_svm,
|
|
616
|
+
tokenContract: a.token_contract,
|
|
617
|
+
hidden: a.hidden,
|
|
618
|
+
forwardContract: a.forwardContract,
|
|
619
|
+
oftOwner: a.oftOwner
|
|
620
|
+
}));
|
|
621
|
+
return result;
|
|
622
|
+
}
|
|
623
|
+
function normalizeStatus(raw) {
|
|
624
|
+
return {
|
|
625
|
+
state: raw.state,
|
|
626
|
+
transfers: raw.transfers ?? [],
|
|
627
|
+
transferSequence: (raw.transfer_sequence ?? []).map((h) => ({
|
|
628
|
+
srcChainId: h.src_chain_id,
|
|
629
|
+
dstChainId: h.dst_chain_id,
|
|
630
|
+
state: h.state
|
|
631
|
+
})),
|
|
632
|
+
nextBlockingTransfer: raw.next_blocking_transfer ? { transferSequenceIndex: raw.next_blocking_transfer.transfer_sequence_index } : void 0,
|
|
633
|
+
transferAssetRelease: raw.transfer_asset_release ? {
|
|
634
|
+
chainId: raw.transfer_asset_release.chain_id,
|
|
635
|
+
denom: raw.transfer_asset_release.denom,
|
|
636
|
+
amount: raw.transfer_asset_release.amount ?? void 0,
|
|
637
|
+
released: raw.transfer_asset_release.released
|
|
638
|
+
} : void 0,
|
|
639
|
+
error: raw.error ?? void 0
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
function normalizeBalancesResponse(raw) {
|
|
643
|
+
const result = {};
|
|
644
|
+
for (const [chainId, chainData] of Object.entries(raw.chains ?? {})) {
|
|
645
|
+
result[chainId] = {};
|
|
646
|
+
for (const [denom, info] of Object.entries(chainData.denoms ?? {})) result[chainId][denom] = {
|
|
647
|
+
amount: info.amount,
|
|
648
|
+
priceUsd: info.price_usd,
|
|
649
|
+
valueUsd: info.value_usd
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
return result;
|
|
653
|
+
}
|
|
654
|
+
function normalizeChainsResponse(raw) {
|
|
655
|
+
return (raw.chains ?? []).map((c) => ({
|
|
656
|
+
chainId: c.chain_id,
|
|
657
|
+
chainName: c.chain_name,
|
|
658
|
+
chainType: c.chain_type,
|
|
659
|
+
pfmEnabled: c.pfm_enabled,
|
|
660
|
+
supportsMemo: c.supports_memo,
|
|
661
|
+
logoUri: c.logo_uri,
|
|
662
|
+
bech32Prefix: c.bech32_prefix,
|
|
663
|
+
rest: c.rest,
|
|
664
|
+
rpc: c.rpc,
|
|
665
|
+
evmFeeAsset: c.evm_fee_asset
|
|
666
|
+
}));
|
|
667
|
+
}
|
|
668
|
+
//#endregion
|
|
669
|
+
//#region src/bridge/watch.ts
|
|
670
|
+
/**
|
|
671
|
+
* Extract events of a specific type from a WebSocket TxResult.
|
|
672
|
+
* Returns an array of attribute maps for each matching event.
|
|
673
|
+
*/
|
|
674
|
+
function parseTxEvents(tx, eventType) {
|
|
675
|
+
const results = [];
|
|
676
|
+
const events = tx.result?.events ?? [];
|
|
677
|
+
for (const event of events) {
|
|
678
|
+
if (event.type !== eventType) continue;
|
|
679
|
+
const attrs = {};
|
|
680
|
+
for (const attr of event.attributes ?? []) if (attr.key && attr.value !== void 0) attrs[attr.key] = attr.value;
|
|
681
|
+
results.push(attrs);
|
|
682
|
+
}
|
|
683
|
+
return results;
|
|
684
|
+
}
|
|
685
|
+
function buildDepositFilter(eventType, opts, bridgeId) {
|
|
686
|
+
const conditions = [];
|
|
687
|
+
if (eventType === "initiate_token_deposit") {
|
|
688
|
+
if (bridgeId !== void 0) conditions.push(`initiate_token_deposit.bridge_id='${bridgeId}'`);
|
|
689
|
+
if (opts.l1Sequence !== void 0) conditions.push(`initiate_token_deposit.l1_sequence='${opts.l1Sequence}'`);
|
|
690
|
+
if (opts.sender) conditions.push(`initiate_token_deposit.from='${opts.sender}'`);
|
|
691
|
+
if (opts.recipient) conditions.push(`initiate_token_deposit.to='${opts.recipient}'`);
|
|
692
|
+
} else if (eventType === "finalize_token_deposit") {
|
|
693
|
+
if (opts.l1Sequence !== void 0) conditions.push(`finalize_token_deposit.l1_sequence='${opts.l1Sequence}'`);
|
|
694
|
+
if (opts.sender) conditions.push(`finalize_token_deposit.sender='${opts.sender}'`);
|
|
695
|
+
if (opts.recipient) conditions.push(`finalize_token_deposit.recipient='${opts.recipient}'`);
|
|
696
|
+
}
|
|
697
|
+
return conditions.length > 0 ? conditions.join(" AND ") : void 0;
|
|
698
|
+
}
|
|
699
|
+
function buildWithdrawalFilter(eventType, opts, bridgeId) {
|
|
700
|
+
const conditions = [];
|
|
701
|
+
if (eventType === "initiate_token_withdrawal") {
|
|
702
|
+
if (opts.l2Sequence !== void 0) conditions.push(`initiate_token_withdrawal.l2_sequence='${opts.l2Sequence}'`);
|
|
703
|
+
if (opts.sender) conditions.push(`initiate_token_withdrawal.from='${opts.sender}'`);
|
|
704
|
+
} else if (eventType === "propose_output") {
|
|
705
|
+
if (bridgeId !== void 0) conditions.push(`propose_output.bridge_id='${bridgeId}'`);
|
|
706
|
+
} else if (eventType === "finalize_token_withdrawal") {
|
|
707
|
+
if (bridgeId !== void 0) conditions.push(`finalize_token_withdrawal.bridge_id='${bridgeId}'`);
|
|
708
|
+
if (opts.l2Sequence !== void 0) conditions.push(`finalize_token_withdrawal.l2_sequence='${opts.l2Sequence}'`);
|
|
709
|
+
}
|
|
710
|
+
return conditions.length > 0 ? conditions.join(" AND ") : void 0;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Watch deposit events in real-time via WebSocket.
|
|
714
|
+
*
|
|
715
|
+
* Subscribes to L1 initiate_token_deposit and L2 finalize_token_deposit events.
|
|
716
|
+
* Call `handle.unsubscribe()` to stop watching and close connections.
|
|
717
|
+
*/
|
|
718
|
+
function watchDeposit(provider, options, callback) {
|
|
719
|
+
const l2Info = provider.getChainInfo(options.l2ChainId);
|
|
720
|
+
if (!l2Info) throw new Error(`Chain not found: ${options.l2ChainId}`);
|
|
721
|
+
const l1Info = provider.listChains().find((c) => c.chainType === "initia");
|
|
722
|
+
if (!l1Info) throw new Error("L1 (initia) chain not found in provider");
|
|
723
|
+
if (!l1Info.wss) throw new WebSocketNotAvailableError(l1Info.chainId);
|
|
724
|
+
if (!l2Info.wss) throw new WebSocketNotAvailableError(l2Info.chainId);
|
|
725
|
+
const bridgeId = l2Info.opBridgeId;
|
|
726
|
+
const sessions = [];
|
|
727
|
+
const subs = [];
|
|
728
|
+
let cleaned = false;
|
|
729
|
+
const cleanup = () => {
|
|
730
|
+
if (cleaned) return;
|
|
731
|
+
cleaned = true;
|
|
732
|
+
for (const sub of subs) sub.unsubscribe();
|
|
733
|
+
for (const session of sessions) session.close();
|
|
734
|
+
subs.length = 0;
|
|
735
|
+
sessions.length = 0;
|
|
736
|
+
};
|
|
737
|
+
const handleError = options.onError ?? ((err) => {
|
|
738
|
+
console.error("[initia.js] watchDeposit failed — watcher terminated. Provide onError to handle:", err);
|
|
739
|
+
cleanup();
|
|
740
|
+
});
|
|
741
|
+
const l1Session = createSession(l1Info);
|
|
742
|
+
sessions.push(l1Session);
|
|
743
|
+
const l1Filter = buildDepositFilter("initiate_token_deposit", options, bridgeId);
|
|
744
|
+
l1Session.subscribe({
|
|
745
|
+
event: "tx",
|
|
746
|
+
filter: l1Filter
|
|
747
|
+
}, (tx) => {
|
|
748
|
+
const events = parseTxEvents(tx, "initiate_token_deposit");
|
|
749
|
+
for (const attrs of events) {
|
|
750
|
+
if (options.l1Sequence !== void 0 && attrs.l1_sequence !== String(options.l1Sequence)) continue;
|
|
751
|
+
callback({
|
|
752
|
+
status: "initiated",
|
|
753
|
+
l1Sequence: BigInt(attrs.l1_sequence ?? "0"),
|
|
754
|
+
from: attrs.from ?? "",
|
|
755
|
+
to: attrs.to ?? "",
|
|
756
|
+
amount: attrs.amount ?? "0",
|
|
757
|
+
bridgeId: BigInt(attrs.bridge_id ?? "0")
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
}).then((sub) => {
|
|
761
|
+
if (!cleaned) subs.push(sub);
|
|
762
|
+
else sub.unsubscribe();
|
|
763
|
+
}).catch(handleError);
|
|
764
|
+
const l2Session = createSession(l2Info);
|
|
765
|
+
sessions.push(l2Session);
|
|
766
|
+
const l2Filter = buildDepositFilter("finalize_token_deposit", options);
|
|
767
|
+
l2Session.subscribe({
|
|
768
|
+
event: "tx",
|
|
769
|
+
filter: l2Filter
|
|
770
|
+
}, (tx) => {
|
|
771
|
+
const events = parseTxEvents(tx, "finalize_token_deposit");
|
|
772
|
+
for (const attrs of events) {
|
|
773
|
+
if (options.l1Sequence !== void 0 && attrs.l1_sequence !== String(options.l1Sequence)) continue;
|
|
774
|
+
callback({
|
|
775
|
+
status: "finalized",
|
|
776
|
+
l1Sequence: BigInt(attrs.l1_sequence ?? "0"),
|
|
777
|
+
recipient: attrs.recipient ?? "",
|
|
778
|
+
amount: attrs.amount ?? "0",
|
|
779
|
+
success: attrs.success === "true",
|
|
780
|
+
reason: attrs.reason || void 0
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
}).then((sub) => {
|
|
784
|
+
if (!cleaned) subs.push(sub);
|
|
785
|
+
else sub.unsubscribe();
|
|
786
|
+
}).catch(handleError);
|
|
787
|
+
return { unsubscribe: cleanup };
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Watch withdrawal events in real-time via WebSocket.
|
|
791
|
+
*
|
|
792
|
+
* Subscribes to L2 initiate_token_withdrawal, L1 propose_output, and
|
|
793
|
+
* L1 finalize_token_withdrawal events. Emits 'waiting' and 'claimable'
|
|
794
|
+
* events based on the finalization period.
|
|
795
|
+
*
|
|
796
|
+
* Call `handle.unsubscribe()` to stop watching and close connections.
|
|
797
|
+
*/
|
|
798
|
+
function watchWithdrawal(provider, options, callback, createTransport) {
|
|
799
|
+
const l2Info = provider.getChainInfo(options.l2ChainId);
|
|
800
|
+
if (!l2Info) throw new Error(`Chain not found: ${options.l2ChainId}`);
|
|
801
|
+
if (l2Info.opBridgeId == null) throw new Error(`Chain ${options.l2ChainId} has no opBridgeId`);
|
|
802
|
+
const l1Info = provider.listChains().find((c) => c.chainType === "initia");
|
|
803
|
+
if (!l1Info) throw new Error("L1 (initia) chain not found in provider");
|
|
804
|
+
if (!l1Info.wss) throw new WebSocketNotAvailableError(l1Info.chainId);
|
|
805
|
+
if (!l2Info.wss) throw new WebSocketNotAvailableError(l2Info.chainId);
|
|
806
|
+
const bridgeId = l2Info.opBridgeId;
|
|
807
|
+
const sessions = [];
|
|
808
|
+
const subs = [];
|
|
809
|
+
const timers = [];
|
|
810
|
+
let timeoutTimer = null;
|
|
811
|
+
let cleaned = false;
|
|
812
|
+
const cleanup = () => {
|
|
813
|
+
if (cleaned) return;
|
|
814
|
+
cleaned = true;
|
|
815
|
+
for (const sub of subs) sub.unsubscribe();
|
|
816
|
+
for (const session of sessions) session.close();
|
|
817
|
+
for (const timer of timers) clearTimeout(timer);
|
|
818
|
+
if (timeoutTimer) clearTimeout(timeoutTimer);
|
|
819
|
+
subs.length = 0;
|
|
820
|
+
sessions.length = 0;
|
|
821
|
+
timers.length = 0;
|
|
822
|
+
};
|
|
823
|
+
const handleError = options.onError ?? ((err) => {
|
|
824
|
+
console.error("[initia.js] watchWithdrawal failed — watcher terminated. Provide onError to handle:", err);
|
|
825
|
+
cleanup();
|
|
826
|
+
});
|
|
827
|
+
if (options.timeout) timeoutTimer = setTimeout(() => {
|
|
828
|
+
cleanup();
|
|
829
|
+
handleError(new TimeoutError("watchWithdrawal", options.timeout));
|
|
830
|
+
}, options.timeout);
|
|
831
|
+
const finalizationMsPromise = (async () => {
|
|
832
|
+
const config = initiaChain.build();
|
|
833
|
+
const fp = (await wrapClientWithCache(createGrpcClient(createTransport(l1Info), config.services, void 0, void 0, config.registry), l1Info.chainId).ophost.bridge({ bridgeId })).bridgeConfig?.finalizationPeriod;
|
|
834
|
+
if (!fp) throw new Error("Bridge config missing finalizationPeriod — cannot determine claimable timing");
|
|
835
|
+
return durationToMs(fp);
|
|
836
|
+
})();
|
|
837
|
+
finalizationMsPromise.catch((err) => {
|
|
838
|
+
cleanup();
|
|
839
|
+
handleError(err);
|
|
840
|
+
});
|
|
841
|
+
const l2Session = createSession(l2Info);
|
|
842
|
+
sessions.push(l2Session);
|
|
843
|
+
const l2Filter = buildWithdrawalFilter("initiate_token_withdrawal", options);
|
|
844
|
+
l2Session.subscribe({
|
|
845
|
+
event: "tx",
|
|
846
|
+
filter: l2Filter
|
|
847
|
+
}, (tx) => {
|
|
848
|
+
const events = parseTxEvents(tx, "initiate_token_withdrawal");
|
|
849
|
+
for (const attrs of events) {
|
|
850
|
+
if (options.l2Sequence !== void 0 && attrs.l2_sequence !== String(options.l2Sequence)) continue;
|
|
851
|
+
callback({
|
|
852
|
+
status: "initiated",
|
|
853
|
+
l2Sequence: BigInt(attrs.l2_sequence ?? "0"),
|
|
854
|
+
from: attrs.from ?? "",
|
|
855
|
+
to: attrs.to ?? "",
|
|
856
|
+
amount: attrs.amount ?? "0"
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
}).then((sub) => {
|
|
860
|
+
if (!cleaned) subs.push(sub);
|
|
861
|
+
else sub.unsubscribe();
|
|
862
|
+
}).catch(handleError);
|
|
863
|
+
const l1Session = createSession(l1Info);
|
|
864
|
+
sessions.push(l1Session);
|
|
865
|
+
const proposeFilter = buildWithdrawalFilter("propose_output", options, bridgeId);
|
|
866
|
+
l1Session.subscribe({
|
|
867
|
+
event: "tx",
|
|
868
|
+
filter: proposeFilter
|
|
869
|
+
}, (tx) => {
|
|
870
|
+
const events = parseTxEvents(tx, "propose_output");
|
|
871
|
+
for (const attrs of events) {
|
|
872
|
+
if (attrs.bridge_id !== String(bridgeId)) continue;
|
|
873
|
+
callback({
|
|
874
|
+
status: "proposed",
|
|
875
|
+
outputIndex: BigInt(attrs.output_index ?? "0"),
|
|
876
|
+
l2BlockNumber: BigInt(attrs.l2_block_number ?? "0")
|
|
877
|
+
});
|
|
878
|
+
finalizationMsPromise.then((ms) => {
|
|
879
|
+
if (cleaned) return;
|
|
880
|
+
callback({
|
|
881
|
+
status: "waiting",
|
|
882
|
+
claimableAt: new Date(Date.now() + ms)
|
|
883
|
+
});
|
|
884
|
+
const timer = setTimeout(() => {
|
|
885
|
+
if (!cleaned) callback({ status: "claimable" });
|
|
886
|
+
}, ms);
|
|
887
|
+
timers.push(timer);
|
|
888
|
+
}).catch((err) => {
|
|
889
|
+
if (!cleaned) handleError(err);
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
}).then((sub) => {
|
|
893
|
+
if (!cleaned) subs.push(sub);
|
|
894
|
+
else sub.unsubscribe();
|
|
895
|
+
}).catch(handleError);
|
|
896
|
+
const claimFilter = buildWithdrawalFilter("finalize_token_withdrawal", options, bridgeId);
|
|
897
|
+
l1Session.subscribe({
|
|
898
|
+
event: "tx",
|
|
899
|
+
filter: claimFilter
|
|
900
|
+
}, (tx) => {
|
|
901
|
+
const events = parseTxEvents(tx, "finalize_token_withdrawal");
|
|
902
|
+
for (const attrs of events) {
|
|
903
|
+
if (options.l2Sequence !== void 0 && attrs.l2_sequence !== String(options.l2Sequence)) continue;
|
|
904
|
+
callback({
|
|
905
|
+
status: "claimed",
|
|
906
|
+
l2Sequence: BigInt(attrs.l2_sequence ?? "0"),
|
|
907
|
+
from: attrs.from ?? "",
|
|
908
|
+
to: attrs.to ?? "",
|
|
909
|
+
amount: attrs.amount ?? "0"
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
}).then((sub) => {
|
|
913
|
+
if (!cleaned) subs.push(sub);
|
|
914
|
+
else sub.unsubscribe();
|
|
915
|
+
}).catch(handleError);
|
|
916
|
+
return { unsubscribe: cleanup };
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Generic helper: watch for a specific event status and wrap in a Promise.
|
|
920
|
+
* Resolves on matching event, rejects on error or timeout.
|
|
921
|
+
*/
|
|
922
|
+
function waitForEvent(watchFn, provider, options, targetStatus, defaultTimeout, label) {
|
|
923
|
+
return new Promise((resolve, reject) => {
|
|
924
|
+
const timeout = options.timeout ?? defaultTimeout;
|
|
925
|
+
let settled = false;
|
|
926
|
+
const settle = () => {
|
|
927
|
+
if (settled) return false;
|
|
928
|
+
settled = true;
|
|
929
|
+
handle.unsubscribe();
|
|
930
|
+
if (timer) clearTimeout(timer);
|
|
931
|
+
return true;
|
|
932
|
+
};
|
|
933
|
+
const handle = watchFn(provider, {
|
|
934
|
+
...options,
|
|
935
|
+
timeout: void 0,
|
|
936
|
+
onError: (err) => {
|
|
937
|
+
options.onError?.(err);
|
|
938
|
+
if (settle()) reject(err instanceof Error ? err : new Error(String(err)));
|
|
939
|
+
}
|
|
940
|
+
}, (event) => {
|
|
941
|
+
if (event.status === targetStatus && settle()) resolve(event);
|
|
942
|
+
});
|
|
943
|
+
const timer = setTimeout(() => {
|
|
944
|
+
if (settle()) reject(new TimeoutError(label, timeout));
|
|
945
|
+
}, timeout);
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Wait for a deposit to be finalized on L2.
|
|
950
|
+
*
|
|
951
|
+
* Returns a Promise that resolves when the finalize_token_deposit event
|
|
952
|
+
* is observed on L2. Rejects on timeout (default: 5 minutes).
|
|
953
|
+
*/
|
|
954
|
+
function waitForDeposit(provider, options) {
|
|
955
|
+
return waitForEvent(watchDeposit, provider, options, "finalized", 3e5, "waitForDeposit");
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Wait for a withdrawal to become claimable on L1.
|
|
959
|
+
*
|
|
960
|
+
* Returns a Promise that resolves when the finalization period passes
|
|
961
|
+
* after an output proposal. Rejects on timeout (default: 2 hours).
|
|
962
|
+
*/
|
|
963
|
+
function waitForClaimable(provider, options, createTransport) {
|
|
964
|
+
const watchFn = (p, opts, cb) => watchWithdrawal(p, opts, cb, createTransport);
|
|
965
|
+
return waitForEvent(watchFn, provider, options, "claimable", 72e5, "waitForClaimable");
|
|
966
|
+
}
|
|
967
|
+
//#endregion
|
|
968
|
+
//#region src/bridge/bridge.ts
|
|
969
|
+
var Bridge = class {
|
|
970
|
+
opBridge;
|
|
971
|
+
router;
|
|
972
|
+
constructor(provider, createTransport, routerUrl) {
|
|
973
|
+
this.provider = provider;
|
|
974
|
+
this.createTransport = createTransport;
|
|
975
|
+
this.opBridge = new OpBridgeInternal(provider, createTransport);
|
|
976
|
+
if (routerUrl) this.router = new RouterClient(routerUrl);
|
|
977
|
+
}
|
|
978
|
+
deposit(options) {
|
|
979
|
+
return this.opBridge.deposit(options);
|
|
980
|
+
}
|
|
981
|
+
withdraw(options) {
|
|
982
|
+
return this.opBridge.withdraw(options);
|
|
983
|
+
}
|
|
984
|
+
claim(options) {
|
|
985
|
+
return this.opBridge.claim(options);
|
|
986
|
+
}
|
|
987
|
+
getWithdrawals(l2ChainId, address, options) {
|
|
988
|
+
return this.opBridge.getWithdrawals(l2ChainId, address, options);
|
|
989
|
+
}
|
|
990
|
+
getWithdrawalStatus(l2ChainId, sequence) {
|
|
991
|
+
return this.opBridge.getWithdrawalStatus(l2ChainId, sequence);
|
|
992
|
+
}
|
|
993
|
+
listBridgeableChains() {
|
|
994
|
+
return this.opBridge.listBridgeableChains();
|
|
995
|
+
}
|
|
996
|
+
getBridgeId(l2ChainId) {
|
|
997
|
+
return this.opBridge.getBridgeId(l2ChainId);
|
|
998
|
+
}
|
|
999
|
+
requireRouter() {
|
|
1000
|
+
if (!this.router) throw new InitiaError("Router API not available for this network");
|
|
1001
|
+
return this.router;
|
|
1002
|
+
}
|
|
1003
|
+
route(options) {
|
|
1004
|
+
return this.requireRouter().route(options);
|
|
1005
|
+
}
|
|
1006
|
+
getRoutableAssets(chainIds) {
|
|
1007
|
+
return this.requireRouter().assets(chainIds);
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Resolve an asset by symbol on a specific chain.
|
|
1011
|
+
*
|
|
1012
|
+
* @returns The matching asset with denom, decimals, symbol, etc.
|
|
1013
|
+
* @throws If the symbol is not found or ambiguous (multiple matches).
|
|
1014
|
+
*
|
|
1015
|
+
* @example
|
|
1016
|
+
* ```typescript
|
|
1017
|
+
* const asset = await provider.bridge.resolveAsset('evm-1', 'INIT')
|
|
1018
|
+
* // → { denom: 'evm/2eE7...', decimals: 18, symbol: 'INIT', ... }
|
|
1019
|
+
* ```
|
|
1020
|
+
*/
|
|
1021
|
+
async resolveAsset(chainId, symbol) {
|
|
1022
|
+
const matches = (await this.getRoutableAssets([chainId]))[chainId]?.filter((a) => a.symbol === symbol) ?? [];
|
|
1023
|
+
if (matches.length === 0) throw new InitiaError(`No asset with symbol '${symbol}' found on chain '${chainId}'`);
|
|
1024
|
+
if (matches.length > 1) {
|
|
1025
|
+
const denoms = matches.map((a) => a.denom).join(", ");
|
|
1026
|
+
throw new InitiaError(`Ambiguous symbol '${symbol}' on chain '${chainId}': ${matches.length} matches (${denoms}). Use getRoutableAssets() and specify denom directly.`);
|
|
1027
|
+
}
|
|
1028
|
+
return matches[0];
|
|
1029
|
+
}
|
|
1030
|
+
getRoutableChains(chainIds) {
|
|
1031
|
+
return this.requireRouter().chains(chainIds);
|
|
1032
|
+
}
|
|
1033
|
+
getBalances(queries) {
|
|
1034
|
+
return this.requireRouter().balances(queries);
|
|
1035
|
+
}
|
|
1036
|
+
nftTransfer(options) {
|
|
1037
|
+
return this.requireRouter().nftTransfer(options);
|
|
1038
|
+
}
|
|
1039
|
+
buildTransferMsgs(options) {
|
|
1040
|
+
return this.requireRouter().msgs(options);
|
|
1041
|
+
}
|
|
1042
|
+
getOpHook(options) {
|
|
1043
|
+
return this.requireRouter().opHook(options);
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Build and sign a Cosmos transaction from OP Hook messages.
|
|
1047
|
+
*
|
|
1048
|
+
* The hook messages (from getOpHook) are assembled into a Cosmos TxRaw,
|
|
1049
|
+
* signed with the appropriate sign mode, and returned as base64.
|
|
1050
|
+
* The L2's handleBridgeHook decodes and executes this transaction.
|
|
1051
|
+
*
|
|
1052
|
+
* opHook is minievm-only (ERC-20 6d↔18d wrapping). Default sign mode
|
|
1053
|
+
* is eip191 if the signer supports it, otherwise direct, then amino.
|
|
1054
|
+
*
|
|
1055
|
+
* @param hookResult - OP Hook data from getOpHook()
|
|
1056
|
+
* @param signer - Any Signer (Key, Keplr, WalletConnect, etc.)
|
|
1057
|
+
* @param options - Optional sign mode override and source chain ID
|
|
1058
|
+
*/
|
|
1059
|
+
async signOpHook(hookResult, signer, options) {
|
|
1060
|
+
const chainInfo = this.provider.getChainInfo(hookResult.chainId);
|
|
1061
|
+
if (!chainInfo) throw new InitiaError(`Chain not found: ${hookResult.chainId}`);
|
|
1062
|
+
const registry = resolveRegistry(chainInfo);
|
|
1063
|
+
const messages = hookResult.hook.map((hookMsg) => {
|
|
1064
|
+
const typeUrl = hookMsg.msg_type_url;
|
|
1065
|
+
const typeName = typeUrl.startsWith("/") ? typeUrl.slice(1) : typeUrl;
|
|
1066
|
+
const schema = registry.getMessage(typeName);
|
|
1067
|
+
if (!schema) throw new InitiaError(`Unknown message type in opHook: ${typeUrl}. Ensure the chain config includes this message schema.`);
|
|
1068
|
+
let parsed;
|
|
1069
|
+
try {
|
|
1070
|
+
parsed = JSON.parse(hookMsg.msg);
|
|
1071
|
+
} catch (err) {
|
|
1072
|
+
throw new InitiaError(`Failed to parse opHook message JSON (type: ${typeUrl}): ` + (err instanceof Error ? err.message : String(err)));
|
|
1073
|
+
}
|
|
1074
|
+
let msg;
|
|
1075
|
+
try {
|
|
1076
|
+
msg = fromJson(schema, parsed, { registry });
|
|
1077
|
+
} catch (err) {
|
|
1078
|
+
throw new InitiaError(`Failed to deserialize opHook message (type: ${typeUrl}): ` + (err instanceof Error ? err.message : String(err)));
|
|
1079
|
+
}
|
|
1080
|
+
return new Message$1(schema, msg);
|
|
1081
|
+
});
|
|
1082
|
+
let signMode;
|
|
1083
|
+
if (options?.signMode) signMode = options.signMode;
|
|
1084
|
+
else switch (true) {
|
|
1085
|
+
case isEIP191Signer(signer):
|
|
1086
|
+
signMode = "eip191";
|
|
1087
|
+
break;
|
|
1088
|
+
case isDirectSigner(signer):
|
|
1089
|
+
signMode = "direct";
|
|
1090
|
+
break;
|
|
1091
|
+
case isAminoSigner(signer):
|
|
1092
|
+
signMode = "amino";
|
|
1093
|
+
break;
|
|
1094
|
+
default: throw new InitiaError("Signer must support signDirect, signAmino, or signPersonal");
|
|
1095
|
+
}
|
|
1096
|
+
if (signMode === "direct" && !isDirectSigner(signer)) throw new InitiaError("signMode \"direct\" requires a signer that implements signDirect");
|
|
1097
|
+
if (signMode === "amino" && !isAminoSigner(signer)) throw new InitiaError("signMode \"amino\" requires a signer that implements signAmino");
|
|
1098
|
+
if (signMode === "eip191" && !isEIP191Signer(signer)) throw new InitiaError("signMode \"eip191\" requires a signer that implements signPersonal");
|
|
1099
|
+
const ctx = buildChainContextFactory(this.createTransport, resolveServices, resolveMsgs)(chainInfo, { signer });
|
|
1100
|
+
const prefix = chainInfo.bech32Prefix ?? "init";
|
|
1101
|
+
const address = await signer.getAddress(prefix);
|
|
1102
|
+
let accountNumber = 0n;
|
|
1103
|
+
let sequence = 0n;
|
|
1104
|
+
try {
|
|
1105
|
+
const account = await ctx.getAccount({ address });
|
|
1106
|
+
accountNumber = account.number;
|
|
1107
|
+
sequence = account.sequence;
|
|
1108
|
+
} catch (err) {
|
|
1109
|
+
if (!isNotFoundError(err)) throw err;
|
|
1110
|
+
}
|
|
1111
|
+
if (options?.sourceChainId === hookResult.chainId) sequence += 2n;
|
|
1112
|
+
const unsignedTx = new UnsignedTx({
|
|
1113
|
+
msgs: messages,
|
|
1114
|
+
signMode,
|
|
1115
|
+
chainId: hookResult.chainId,
|
|
1116
|
+
accountNumber,
|
|
1117
|
+
sequence,
|
|
1118
|
+
fee: [],
|
|
1119
|
+
gasLimit: 0n,
|
|
1120
|
+
memo: "",
|
|
1121
|
+
timeoutHeight: 0n
|
|
1122
|
+
});
|
|
1123
|
+
const signed = await ctx.sign(unsignedTx);
|
|
1124
|
+
return {
|
|
1125
|
+
hook: base64.encode(signed.txBytes),
|
|
1126
|
+
signer: address
|
|
1127
|
+
};
|
|
1128
|
+
}
|
|
1129
|
+
trackTransfer(txHash, chainId) {
|
|
1130
|
+
return this.requireRouter().track(txHash, chainId);
|
|
1131
|
+
}
|
|
1132
|
+
getTransferStatus(txHash, chainId) {
|
|
1133
|
+
return this.requireRouter().status(txHash, chainId);
|
|
1134
|
+
}
|
|
1135
|
+
watchDeposit(options, callback) {
|
|
1136
|
+
return watchDeposit(this.provider, options, callback);
|
|
1137
|
+
}
|
|
1138
|
+
watchWithdrawal(options, callback) {
|
|
1139
|
+
return watchWithdrawal(this.provider, options, callback, this.createTransport);
|
|
1140
|
+
}
|
|
1141
|
+
waitForDeposit(options) {
|
|
1142
|
+
return waitForDeposit(this.provider, options);
|
|
1143
|
+
}
|
|
1144
|
+
waitForClaimable(options) {
|
|
1145
|
+
return waitForClaimable(this.provider, options, this.createTransport);
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* Deposit L1 → L2 and wait for finalization on L2.
|
|
1149
|
+
*
|
|
1150
|
+
* Combines `deposit()` + `signAndBroadcast()` + `waitForDeposit()` into one call.
|
|
1151
|
+
*
|
|
1152
|
+
* @example
|
|
1153
|
+
* ```typescript
|
|
1154
|
+
* const event = await bridge.depositAndWait({
|
|
1155
|
+
* sender: key.address,
|
|
1156
|
+
* toChain: 'rollup-1',
|
|
1157
|
+
* amount: coin('uinit', 1_000_000),
|
|
1158
|
+
* signAndBroadcast: (msgs) => l1.signAndBroadcast(msgs),
|
|
1159
|
+
* })
|
|
1160
|
+
* console.log(event.status) // 'finalized'
|
|
1161
|
+
* ```
|
|
1162
|
+
*/
|
|
1163
|
+
async depositAndWait(options) {
|
|
1164
|
+
const msg = this.deposit({
|
|
1165
|
+
sender: options.sender,
|
|
1166
|
+
to: options.to,
|
|
1167
|
+
toChain: options.toChain,
|
|
1168
|
+
amount: options.amount,
|
|
1169
|
+
data: options.data
|
|
1170
|
+
});
|
|
1171
|
+
await options.signAndBroadcast([msg]);
|
|
1172
|
+
return this.waitForDeposit({
|
|
1173
|
+
l2ChainId: options.toChain,
|
|
1174
|
+
sender: options.sender,
|
|
1175
|
+
recipient: options.to ?? options.sender,
|
|
1176
|
+
timeout: options.timeout
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Withdraw L2 → L1, wait for finalization, and auto-claim on L1.
|
|
1181
|
+
*
|
|
1182
|
+
* Combines `withdraw()` + `signAndBroadcastL2()` + `waitForClaimable()` +
|
|
1183
|
+
* `getWithdrawals()` + `claim()` + `signAndBroadcastL1()`.
|
|
1184
|
+
*
|
|
1185
|
+
* @example
|
|
1186
|
+
* ```typescript
|
|
1187
|
+
* const withdrawal = await bridge.withdrawAndClaim({
|
|
1188
|
+
* sender: key.address,
|
|
1189
|
+
* amount: coin('uinit', 1_000_000),
|
|
1190
|
+
* l2ChainId: 'rollup-1',
|
|
1191
|
+
* signAndBroadcastL2: (msgs) => l2.signAndBroadcast(msgs),
|
|
1192
|
+
* signAndBroadcastL1: (msgs) => l1.signAndBroadcast(msgs),
|
|
1193
|
+
* })
|
|
1194
|
+
* ```
|
|
1195
|
+
*/
|
|
1196
|
+
async withdrawAndClaim(options) {
|
|
1197
|
+
const withdrawMsg = this.withdraw({
|
|
1198
|
+
sender: options.sender,
|
|
1199
|
+
to: options.to,
|
|
1200
|
+
amount: options.amount
|
|
1201
|
+
});
|
|
1202
|
+
await options.signAndBroadcastL2([withdrawMsg]);
|
|
1203
|
+
await this.waitForClaimable({
|
|
1204
|
+
l2ChainId: options.l2ChainId,
|
|
1205
|
+
sender: options.sender,
|
|
1206
|
+
timeout: options.timeout
|
|
1207
|
+
});
|
|
1208
|
+
const recipient = options.to ?? options.sender;
|
|
1209
|
+
const claimable = (await this.getWithdrawals(options.l2ChainId, recipient)).find((w) => w.status.status === "claimable");
|
|
1210
|
+
if (!claimable) throw new InitiaError("No claimable withdrawal found after finalization");
|
|
1211
|
+
const claimMsg = this.claim({
|
|
1212
|
+
sender: recipient,
|
|
1213
|
+
withdrawal: claimable
|
|
1214
|
+
});
|
|
1215
|
+
await options.signAndBroadcastL1([claimMsg]);
|
|
1216
|
+
return claimable;
|
|
1217
|
+
}
|
|
1218
|
+
};
|
|
1219
|
+
//#endregion
|
|
1220
|
+
export { watchWithdrawal as a, fetchWithdrawals as c, watchDeposit as i, waitForClaimable as n, calculateWithdrawalHash as o, waitForDeposit as r, fetchWithdrawal as s, Bridge as t };
|
|
1221
|
+
|
|
1222
|
+
//# sourceMappingURL=bridge-DL-q-7P7.mjs.map
|