@swapkit/toolboxes 4.3.10 → 4.13.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.
Files changed (266) hide show
  1. package/dist/LICENSE +246 -0
  2. package/dist/src/aptos/index.cjs +1 -0
  3. package/dist/src/aptos/index.js +1 -0
  4. package/dist/src/cardano/index.cjs +1 -4
  5. package/dist/src/cardano/index.js +1 -4
  6. package/dist/src/cosmos/index.cjs +1 -4
  7. package/dist/src/cosmos/index.js +1 -4
  8. package/dist/src/evm/index.cjs +1 -4
  9. package/dist/src/evm/index.js +1 -4
  10. package/dist/src/index.cjs +1 -5
  11. package/dist/src/index.js +1 -5
  12. package/dist/src/near/index.cjs +1 -4
  13. package/dist/src/near/index.js +1 -4
  14. package/dist/src/radix/index.cjs +1 -4
  15. package/dist/src/radix/index.js +1 -4
  16. package/dist/src/ripple/index.cjs +1 -4
  17. package/dist/src/ripple/index.js +1 -4
  18. package/dist/src/solana/index.cjs +1 -4
  19. package/dist/src/solana/index.js +1 -4
  20. package/dist/src/starknet/index.cjs +1 -0
  21. package/dist/src/starknet/index.js +1 -0
  22. package/dist/src/stellar/index.cjs +1 -0
  23. package/dist/src/stellar/index.js +1 -0
  24. package/dist/src/substrate/index.cjs +1 -4
  25. package/dist/src/substrate/index.js +1 -4
  26. package/dist/src/sui/index.cjs +1 -4
  27. package/dist/src/sui/index.js +1 -4
  28. package/dist/src/ton/index.cjs +1 -4
  29. package/dist/src/ton/index.js +1 -4
  30. package/dist/src/tron/index.cjs +1 -4
  31. package/dist/src/tron/index.js +1 -4
  32. package/dist/src/utxo/index.cjs +1 -5
  33. package/dist/src/utxo/index.js +1 -5
  34. package/dist/types/aptos/index.d.ts +3 -0
  35. package/dist/types/aptos/index.d.ts.map +1 -0
  36. package/dist/types/aptos/toolbox.d.ts +21 -0
  37. package/dist/types/aptos/toolbox.d.ts.map +1 -0
  38. package/dist/types/aptos/types.d.ts +27 -0
  39. package/dist/types/aptos/types.d.ts.map +1 -0
  40. package/dist/types/cardano/toolbox.d.ts +19 -22
  41. package/dist/types/cardano/toolbox.d.ts.map +1 -1
  42. package/dist/types/cardano/types.d.ts +8 -3
  43. package/dist/types/cardano/types.d.ts.map +1 -1
  44. package/dist/types/cosmos/thorchainUtils/addressFormat.d.ts.map +1 -1
  45. package/dist/types/cosmos/thorchainUtils/messages.d.ts +3 -3
  46. package/dist/types/cosmos/thorchainUtils/messages.d.ts.map +1 -1
  47. package/dist/types/cosmos/toolbox/cosmos.d.ts +11 -9
  48. package/dist/types/cosmos/toolbox/cosmos.d.ts.map +1 -1
  49. package/dist/types/cosmos/toolbox/thorchain.d.ts +6 -51
  50. package/dist/types/cosmos/toolbox/thorchain.d.ts.map +1 -1
  51. package/dist/types/cosmos/types.d.ts +2 -2
  52. package/dist/types/cosmos/types.d.ts.map +1 -1
  53. package/dist/types/evm/helpers.d.ts +34 -1
  54. package/dist/types/evm/helpers.d.ts.map +1 -1
  55. package/dist/types/evm/toolbox/baseEVMToolbox.d.ts +14 -7
  56. package/dist/types/evm/toolbox/baseEVMToolbox.d.ts.map +1 -1
  57. package/dist/types/evm/toolbox/evm.d.ts +236 -96
  58. package/dist/types/evm/toolbox/evm.d.ts.map +1 -1
  59. package/dist/types/evm/toolbox/index.d.ts +3 -2
  60. package/dist/types/evm/toolbox/index.d.ts.map +1 -1
  61. package/dist/types/evm/toolbox/op.d.ts +13 -8
  62. package/dist/types/evm/toolbox/op.d.ts.map +1 -1
  63. package/dist/types/evm/types.d.ts +49 -27
  64. package/dist/types/evm/types.d.ts.map +1 -1
  65. package/dist/types/index.d.ts +31 -25
  66. package/dist/types/index.d.ts.map +1 -1
  67. package/dist/types/near/helpers/core.d.ts +1 -1
  68. package/dist/types/near/helpers/core.d.ts.map +1 -1
  69. package/dist/types/near/index.d.ts +1 -1
  70. package/dist/types/near/index.d.ts.map +1 -1
  71. package/dist/types/near/toolbox.d.ts +13 -10
  72. package/dist/types/near/toolbox.d.ts.map +1 -1
  73. package/dist/types/near/types/index.d.ts +4 -0
  74. package/dist/types/near/types/index.d.ts.map +1 -0
  75. package/dist/types/near/types/toolbox.d.ts +2 -0
  76. package/dist/types/near/types/toolbox.d.ts.map +1 -1
  77. package/dist/types/radix/index.d.ts +7 -7
  78. package/dist/types/radix/index.d.ts.map +1 -1
  79. package/dist/types/ripple/currency.d.ts +5 -0
  80. package/dist/types/ripple/currency.d.ts.map +1 -0
  81. package/dist/types/ripple/index.d.ts +60 -17
  82. package/dist/types/ripple/index.d.ts.map +1 -1
  83. package/dist/types/ripple/tokens.d.ts +15 -0
  84. package/dist/types/ripple/tokens.d.ts.map +1 -0
  85. package/dist/types/solana/index.d.ts +1 -1
  86. package/dist/types/solana/index.d.ts.map +1 -1
  87. package/dist/types/solana/toolbox.d.ts +12 -10
  88. package/dist/types/solana/toolbox.d.ts.map +1 -1
  89. package/dist/types/starknet/index.d.ts +5 -0
  90. package/dist/types/starknet/index.d.ts.map +1 -0
  91. package/dist/types/starknet/toolbox.d.ts +34 -0
  92. package/dist/types/starknet/toolbox.d.ts.map +1 -0
  93. package/dist/types/starknet/types.d.ts +26 -0
  94. package/dist/types/starknet/types.d.ts.map +1 -0
  95. package/dist/types/stellar/index.d.ts +3 -0
  96. package/dist/types/stellar/index.d.ts.map +1 -0
  97. package/dist/types/stellar/toolbox.d.ts +21 -0
  98. package/dist/types/stellar/toolbox.d.ts.map +1 -0
  99. package/dist/types/stellar/types.d.ts +10 -0
  100. package/dist/types/stellar/types.d.ts.map +1 -0
  101. package/dist/types/substrate/balance.d.ts +3 -3
  102. package/dist/types/substrate/balance.d.ts.map +1 -1
  103. package/dist/types/substrate/substrate.d.ts +22 -97
  104. package/dist/types/substrate/substrate.d.ts.map +1 -1
  105. package/dist/types/substrate/types.d.ts +2 -2
  106. package/dist/types/substrate/types.d.ts.map +1 -1
  107. package/dist/types/sui/toolbox.d.ts +17 -8
  108. package/dist/types/sui/toolbox.d.ts.map +1 -1
  109. package/dist/types/sui/types.d.ts +11 -3
  110. package/dist/types/sui/types.d.ts.map +1 -1
  111. package/dist/types/ton/toolbox.d.ts +23 -13
  112. package/dist/types/ton/toolbox.d.ts.map +1 -1
  113. package/dist/types/ton/types.d.ts +9 -8
  114. package/dist/types/ton/types.d.ts.map +1 -1
  115. package/dist/types/tron/helpers/proto.d.ts +9 -0
  116. package/dist/types/tron/helpers/proto.d.ts.map +1 -0
  117. package/dist/types/tron/helpers/trongrid.d.ts +43 -3
  118. package/dist/types/tron/helpers/trongrid.d.ts.map +1 -1
  119. package/dist/types/tron/helpers/utils.d.ts +17 -0
  120. package/dist/types/tron/helpers/utils.d.ts.map +1 -0
  121. package/dist/types/tron/index.d.ts +4 -5
  122. package/dist/types/tron/index.d.ts.map +1 -1
  123. package/dist/types/tron/toolbox.d.ts +20 -18
  124. package/dist/types/tron/toolbox.d.ts.map +1 -1
  125. package/dist/types/tron/types.d.ts +31 -57
  126. package/dist/types/tron/types.d.ts.map +1 -1
  127. package/dist/types/types.d.ts +6 -0
  128. package/dist/types/types.d.ts.map +1 -1
  129. package/dist/types/utxo/hdWallet.d.ts +33 -0
  130. package/dist/types/utxo/hdWallet.d.ts.map +1 -0
  131. package/dist/types/utxo/helpers/api.d.ts +49 -1
  132. package/dist/types/utxo/helpers/api.d.ts.map +1 -1
  133. package/dist/types/utxo/helpers/bchaddrjs.d.ts.map +1 -1
  134. package/dist/types/utxo/helpers/cashaddr.d.ts +13 -0
  135. package/dist/types/utxo/helpers/cashaddr.d.ts.map +1 -0
  136. package/dist/types/utxo/helpers/coinselect.d.ts +9 -5
  137. package/dist/types/utxo/helpers/coinselect.d.ts.map +1 -1
  138. package/dist/types/utxo/helpers/txSize.d.ts +4 -3
  139. package/dist/types/utxo/helpers/txSize.d.ts.map +1 -1
  140. package/dist/types/utxo/index.d.ts +2 -1
  141. package/dist/types/utxo/index.d.ts.map +1 -1
  142. package/dist/types/utxo/toolbox/bitcoinCash.d.ts +75 -15
  143. package/dist/types/utxo/toolbox/bitcoinCash.d.ts.map +1 -1
  144. package/dist/types/utxo/toolbox/index.d.ts +6 -5
  145. package/dist/types/utxo/toolbox/index.d.ts.map +1 -1
  146. package/dist/types/utxo/toolbox/params.d.ts +8 -16
  147. package/dist/types/utxo/toolbox/params.d.ts.map +1 -1
  148. package/dist/types/utxo/toolbox/utxo.d.ts +135 -46
  149. package/dist/types/utxo/toolbox/utxo.d.ts.map +1 -1
  150. package/dist/types/utxo/toolbox/validators.d.ts +1 -1
  151. package/dist/types/utxo/toolbox/validators.d.ts.map +1 -1
  152. package/dist/types/utxo/toolbox/zcash.d.ts +63 -10
  153. package/dist/types/utxo/toolbox/zcash.d.ts.map +1 -1
  154. package/dist/types/utxo/types.d.ts +78 -15
  155. package/dist/types/utxo/types.d.ts.map +1 -1
  156. package/package.json +43 -53
  157. package/dist/src/cardano/index.cjs.map +0 -11
  158. package/dist/src/cardano/index.js.map +0 -11
  159. package/dist/src/cosmos/index.cjs.map +0 -20
  160. package/dist/src/cosmos/index.js.map +0 -20
  161. package/dist/src/evm/index.cjs.map +0 -20
  162. package/dist/src/evm/index.js.map +0 -20
  163. package/dist/src/index.cjs.map +0 -67
  164. package/dist/src/index.js.map +0 -67
  165. package/dist/src/near/index.cjs.map +0 -16
  166. package/dist/src/near/index.js.map +0 -16
  167. package/dist/src/radix/index.cjs.map +0 -10
  168. package/dist/src/radix/index.js.map +0 -10
  169. package/dist/src/ripple/index.cjs.map +0 -10
  170. package/dist/src/ripple/index.js.map +0 -10
  171. package/dist/src/solana/index.cjs.map +0 -11
  172. package/dist/src/solana/index.js.map +0 -11
  173. package/dist/src/substrate/index.cjs.map +0 -13
  174. package/dist/src/substrate/index.js.map +0 -13
  175. package/dist/src/sui/index.cjs.map +0 -11
  176. package/dist/src/sui/index.js.map +0 -11
  177. package/dist/src/ton/index.cjs.map +0 -11
  178. package/dist/src/ton/index.js.map +0 -11
  179. package/dist/src/tron/index.cjs.map +0 -13
  180. package/dist/src/tron/index.js.map +0 -13
  181. package/dist/src/utxo/index.cjs.map +0 -21
  182. package/dist/src/utxo/index.js.map +0 -21
  183. package/dist/types/tron/helpers/trc20.abi.d.ts +0 -156
  184. package/dist/types/tron/helpers/trc20.abi.d.ts.map +0 -1
  185. package/src/__tests__/address-validation-all-chains.test.ts +0 -162
  186. package/src/__tests__/addressValidator.test.ts +0 -162
  187. package/src/cardano/__tests__/toolbox.test.ts +0 -48
  188. package/src/cardano/index.ts +0 -2
  189. package/src/cardano/toolbox.ts +0 -168
  190. package/src/cardano/types.ts +0 -10
  191. package/src/cosmos/__tests__/toolbox.test.ts +0 -95
  192. package/src/cosmos/index.ts +0 -4
  193. package/src/cosmos/thorchainUtils/addressFormat.ts +0 -22
  194. package/src/cosmos/thorchainUtils/index.ts +0 -4
  195. package/src/cosmos/thorchainUtils/messages.ts +0 -212
  196. package/src/cosmos/thorchainUtils/registry.ts +0 -43
  197. package/src/cosmos/thorchainUtils/types/MsgCompiled.ts +0 -2800
  198. package/src/cosmos/thorchainUtils/types/client-types.ts +0 -54
  199. package/src/cosmos/thorchainUtils/types/index.ts +0 -1
  200. package/src/cosmos/toolbox/cosmos.ts +0 -350
  201. package/src/cosmos/toolbox/index.ts +0 -35
  202. package/src/cosmos/toolbox/thorchain.ts +0 -249
  203. package/src/cosmos/types.ts +0 -48
  204. package/src/cosmos/util.ts +0 -214
  205. package/src/evm/__tests__/address-validation.test.ts +0 -84
  206. package/src/evm/__tests__/ethereum.test.ts +0 -137
  207. package/src/evm/__tests__/signMessage.test.ts +0 -60
  208. package/src/evm/api.ts +0 -10
  209. package/src/evm/contracts/eth/multicall.ts +0 -165
  210. package/src/evm/contracts/op/gasOracle.ts +0 -145
  211. package/src/evm/helpers.ts +0 -71
  212. package/src/evm/index.ts +0 -4
  213. package/src/evm/toolbox/baseEVMToolbox.ts +0 -698
  214. package/src/evm/toolbox/evm.ts +0 -66
  215. package/src/evm/toolbox/index.ts +0 -44
  216. package/src/evm/toolbox/op.ts +0 -143
  217. package/src/evm/types.ts +0 -146
  218. package/src/index.ts +0 -260
  219. package/src/near/__tests__/core.test.ts +0 -70
  220. package/src/near/helpers/core.ts +0 -85
  221. package/src/near/helpers/gasEstimation.ts +0 -96
  222. package/src/near/helpers/nep141.ts +0 -50
  223. package/src/near/index.ts +0 -21
  224. package/src/near/toolbox.ts +0 -421
  225. package/src/near/types/contract.ts +0 -32
  226. package/src/near/types/nep141.ts +0 -34
  227. package/src/near/types/toolbox.ts +0 -55
  228. package/src/near/types.ts +0 -44
  229. package/src/radix/index.ts +0 -138
  230. package/src/ripple/index.ts +0 -179
  231. package/src/solana/index.ts +0 -36
  232. package/src/solana/toolbox.ts +0 -409
  233. package/src/substrate/balance.ts +0 -88
  234. package/src/substrate/index.ts +0 -2
  235. package/src/substrate/substrate.ts +0 -281
  236. package/src/substrate/types.ts +0 -115
  237. package/src/sui/__tests__/toolbox.test.ts +0 -86
  238. package/src/sui/index.ts +0 -2
  239. package/src/sui/toolbox.ts +0 -166
  240. package/src/sui/types.ts +0 -11
  241. package/src/ton/__tests__/toolbox.test.ts +0 -67
  242. package/src/ton/index.ts +0 -2
  243. package/src/ton/toolbox.ts +0 -136
  244. package/src/ton/types.ts +0 -13
  245. package/src/tron/__tests__/toolbox.test.ts +0 -221
  246. package/src/tron/helpers/trc20.abi.ts +0 -107
  247. package/src/tron/helpers/trongrid.ts +0 -53
  248. package/src/tron/index.ts +0 -21
  249. package/src/tron/toolbox.ts +0 -585
  250. package/src/tron/types.ts +0 -83
  251. package/src/types.ts +0 -28
  252. package/src/utils.ts +0 -34
  253. package/src/utxo/__tests__/zcash-integration.test.ts +0 -97
  254. package/src/utxo/helpers/api.ts +0 -471
  255. package/src/utxo/helpers/bchaddrjs.ts +0 -166
  256. package/src/utxo/helpers/coinselect.ts +0 -92
  257. package/src/utxo/helpers/index.ts +0 -4
  258. package/src/utxo/helpers/txSize.ts +0 -137
  259. package/src/utxo/index.ts +0 -6
  260. package/src/utxo/toolbox/bitcoinCash.ts +0 -243
  261. package/src/utxo/toolbox/index.ts +0 -59
  262. package/src/utxo/toolbox/params.ts +0 -18
  263. package/src/utxo/toolbox/utxo.ts +0 -439
  264. package/src/utxo/toolbox/validators.ts +0 -36
  265. package/src/utxo/toolbox/zcash.ts +0 -242
  266. package/src/utxo/types.ts +0 -39
@@ -1,4 +1 @@
1
- var e6=Object.create;var{getPrototypeOf:L4,defineProperty:r,getOwnPropertyNames:F6,getOwnPropertyDescriptor:z4}=Object,f6=Object.prototype.hasOwnProperty;var K=(Y,H,X)=>{X=Y!=null?e6(L4(Y)):{};let L=H||!Y||!Y.__esModule?r(X,"default",{value:Y,enumerable:!0}):X;for(let Z of F6(Y))if(!f6.call(L,Z))r(L,Z,{get:()=>Y[Z],enumerable:!0});return L},M6=new WeakMap,Z4=(Y)=>{var H=M6.get(Y),X;if(H)return H;if(H=r({},"__esModule",{value:!0}),Y&&typeof Y==="object"||typeof Y==="function")F6(Y).map((L)=>!f6.call(H,L)&&r(H,L,{get:()=>Y[L],enumerable:!(X=z4(Y,L))||X.enumerable}));return M6.set(Y,H),H};var y6=(Y,H)=>{for(var X in H)r(Y,X,{get:H[X],enumerable:!0,configurable:!0,set:(L)=>H[X]=()=>L})};var F=(Y,H)=>()=>(Y&&(H=Y(Y=0)),H);function a(Y){return C.base64.encode(Uint8Array.from(C.bech32.fromWords(C.bech32.decode(Y).words)))}function s(Y,H="thor"){return C.bech32.encode(H,C.bech32.toWords(C.base64.decode(Y)))}function H4(Y){return Q6.fromByteArray(Y)}function Q4(Y){if(!Y.match(/^[a-zA-Z0-9+/]*={0,2}$/))throw new D6.SwapKitError("toolbox_cosmos_invalid_params",{error:"Invalid base64 string format"});return Q6.toByteArray(Y)}var C,D6,Q6;var q6=F(()=>{C=require("@scure/base"),D6=require("@swapkit/helpers"),Q6=require("base64-js")});function S(Y){switch(Y){case B.Chain.Maya:return{amount:[],gas:"10000000000"};case B.Chain.THORChain:return{amount:[],gas:"500000000"};case B.Chain.Kujira:return C6;case B.Chain.Noble:return w6;default:return P6}}async function P(Y){let H=await import("@cosmjs/stargate"),X=H.StargateClient??H.default?.StargateClient,L=typeof window<"u"?{}:{referer:"https://sdk.swapkit.dev",referrer:"https://sdk.swapkit.dev"};return X.connect({headers:L,url:Y})}async function n(Y,H,X={}){let L=await import("@cosmjs/stargate"),Z=L.SigningStargateClient??L.default?.SigningStargateClient,z=L.GasPrice??L.default?.GasPrice,Q=typeof X==="string"?X:"0.0003uatom",J=typeof X==="string"?{}:X;return Z.connectWithSigner(Y,H,{gasPrice:z.fromString(Q),...J})}async function B6(Y,H){let X=await import("@cosmjs/stargate");return(X.SigningStargateClient??X.default?.SigningStargateClient).offline(Y,H)}async function G6({sender:Y,recipient:H,assetValue:X,memo:L="",feeRate:Z,sequence:z,accountNumber:Q}){let{chain:J,chainId:_}=X,E=await B.getRPCUrl(J),k=await(await P(E)).getAccount(Y);if(!k)throw new B.SwapKitError("toolbox_cosmos_account_not_found",{sender:Y});let I=B.AssetValue.from({chain:J}),x=D(I.symbol),N=S(J),v=x&&Z?{amount:[{amount:Z.toString(),denom:x}],gas:N.gas}:N,U={amount:[{amount:X.getBaseValue("string"),denom:D(X.symbol)}],fromAddress:Y,toAddress:H};return{accountNumber:Q??k.accountNumber,chainId:_,fee:v,memo:L,msgs:[{typeUrl:X4(J),value:U}],sequence:z??k.sequence}}var B,W6="FACTORY/KUJIRA1QK00H5ATUTPSV900X202PXX42NPJR9THG58DNQPA72F2P7M2LUASE444A7/UUSK",S6="FACTORY/KUJIRA1YGFXN0ER40KLCNCK8THLTUPRDXLCK6WVNPKF2K/UYUM",P6,C6,w6,D=(Y,H=!1)=>{if(H)return Y.toLowerCase();switch(Y){case"uUSK":case"USK":return W6;case"uYUM":case"YUM":return S6;case"uKUJI":case"KUJI":return"ukuji";case"ATOM":case"uATOM":return"uatom";case"uUSDC":case"USDC":return"uusdc";default:return Y}},d=({symbol:Y,chain:H})=>{if(H===B.Chain.Maya)return(Y.toUpperCase()!=="CACAO"?Y:`${B.Chain.Maya}.${Y}`).toUpperCase();if(H===B.Chain.THORChain)return(["RUNE","TCY","RUJI"].includes(Y.toUpperCase())?`${B.Chain.THORChain}.${Y}`:Y).toUpperCase();return D(Y,!1)},X4=(Y)=>{switch(Y){case B.Chain.Maya:case B.Chain.THORChain:return"/types.MsgSend";case B.Chain.Cosmos:case B.Chain.Kujira:case B.Chain.Noble:return"/cosmos.bank.v1beta1.MsgSend";default:throw new B.SwapKitError("toolbox_cosmos_not_supported",{chain:Y})}},Y4,T6=(Y,H)=>{let X=Y4[Y.toLowerCase()];if(!X)return B.AssetValue.from({asset:Y,fromBaseDecimal:8,value:H});let{chain:L,asset:Z,decimals:z}=X,Q=L?{chain:L}:{asset:Z};return B.AssetValue.from({...Q,fromBaseDecimal:z,value:H})};var e=F(()=>{B=require("@swapkit/helpers"),P6={amount:[{amount:"500",denom:"uatom"}],gas:"200000"},C6={amount:[{amount:"1000",denom:"ukuji"}],gas:"200000"},w6={amount:[{amount:"1000",denom:"uusdc"}],gas:"200000"};Y4={atom:{chain:B.Chain.Cosmos,decimals:B.getChainConfig(B.Chain.Cosmos).baseDecimal},cacao:{chain:B.Chain.Maya,decimals:10},kuji:{chain:B.Chain.Kujira,decimals:B.getChainConfig(B.Chain.Kujira).baseDecimal},maya:{asset:`${B.Chain.Maya}.${B.Chain.Maya}`,decimals:4},rune:{chain:B.Chain.THORChain,decimals:B.getChainConfig(B.Chain.THORChain).baseDecimal},tcy:{asset:"THOR.TCY",decimals:B.getChainConfig(B.Chain.THORChain).baseDecimal},uatom:{chain:B.Chain.Cosmos,decimals:B.getChainConfig(B.Chain.Cosmos).baseDecimal},ukuji:{chain:B.Chain.Kujira,decimals:B.getChainConfig(B.Chain.Kujira).baseDecimal},usdc:{chain:B.Chain.Noble,decimals:B.getChainConfig(B.Chain.Noble).baseDecimal},uusdc:{chain:B.Chain.Noble,decimals:B.getChainConfig(B.Chain.Noble).baseDecimal},"x/kuji":{asset:"THOR.KUJI",decimals:B.getChainConfig(B.Chain.THORChain).baseDecimal},[W6.toLowerCase()]:{asset:`${B.Chain.Kujira}.USK`,decimals:B.getChainConfig(B.Chain.Kujira).baseDecimal}}});var $6={};y6($6,{$root:()=>q});var R,T,f,W,q;var u6=F(()=>{R=K(require("protobufjs/minimal.js")),T=R.default.Reader,f=R.default.Writer,W=R.default.util,q=R.default.roots.default||(R.default.roots.default={});q.common=(()=>{let Y={};return Y.Asset=(()=>{function H(X){if(X){for(let L=Object.keys(X),Z=0;Z<L.length;++Z)if(X[L[Z]]!=null)this[L[Z]]=X[L[Z]]}}return H.prototype.chain="",H.prototype.symbol="",H.prototype.ticker="",H.prototype.synth=!1,H.create=function(L){return new H(L)},H.encode=function(L,Z){if(!Z)Z=f.create();if(L.chain!=null&&Object.hasOwnProperty.call(L,"chain"))Z.uint32(10).string(L.chain);if(L.symbol!=null&&Object.hasOwnProperty.call(L,"symbol"))Z.uint32(18).string(L.symbol);if(L.ticker!=null&&Object.hasOwnProperty.call(L,"ticker"))Z.uint32(26).string(L.ticker);if(L.synth!=null&&Object.hasOwnProperty.call(L,"synth"))Z.uint32(32).bool(L.synth);return Z},H.encodeDelimited=function(L,Z){return this.encode(L,Z).ldelim()},H.decode=function(L,Z){if(!(L instanceof T))L=T.create(L);let z=Z===void 0?L.len:L.pos+Z,Q=new q.common.Asset;while(L.pos<z){let J=L.uint32();switch(J>>>3){case 1:Q.chain=L.string();break;case 2:Q.symbol=L.string();break;case 3:Q.ticker=L.string();break;case 4:Q.synth=L.bool();break;default:L.skipType(J&7);break}}return Q},H.decodeDelimited=function(L){if(!(L instanceof T))L=new T(L);return this.decode(L,L.uint32())},H.verify=function(L){if(typeof L!=="object"||L===null)return"object expected";if(L.chain!=null&&L.hasOwnProperty("chain")){if(!W.isString(L.chain))return"chain: string expected"}if(L.symbol!=null&&L.hasOwnProperty("symbol")){if(!W.isString(L.symbol))return"symbol: string expected"}if(L.ticker!=null&&L.hasOwnProperty("ticker")){if(!W.isString(L.ticker))return"ticker: string expected"}if(L.synth!=null&&L.hasOwnProperty("synth")){if(typeof L.synth!=="boolean")return"synth: boolean expected"}return null},H.fromObject=function(L){if(L instanceof q.common.Asset)return L;let Z=new q.common.Asset;if(L.chain!=null)Z.chain=String(L.chain);if(L.symbol!=null)Z.symbol=String(L.symbol);if(L.ticker!=null)Z.ticker=String(L.ticker);if(L.synth!=null)Z.synth=Boolean(L.synth);return Z},H.toObject=function(L,Z){if(!Z)Z={};let z={};if(Z.defaults)z.chain="",z.symbol="",z.ticker="",z.synth=!1;if(L.chain!=null&&L.hasOwnProperty("chain"))z.chain=L.chain;if(L.symbol!=null&&L.hasOwnProperty("symbol"))z.symbol=L.symbol;if(L.ticker!=null&&L.hasOwnProperty("ticker"))z.ticker=L.ticker;if(L.synth!=null&&L.hasOwnProperty("synth"))z.synth=L.synth;return z},H.prototype.toJSON=function(){return this.constructor.toObject(this,R.default.util.toJSONOptions)},H})(),Y.Coin=(()=>{function H(X){if(X){for(let L=Object.keys(X),Z=0;Z<L.length;++Z)if(X[L[Z]]!=null)this[L[Z]]=X[L[Z]]}}return H.prototype.asset=null,H.prototype.amount="",H.prototype.decimals=W.Long?W.Long.fromBits(0,0,!1):0,H.create=function(L){return new H(L)},H.encode=function(L,Z){if(!Z)Z=f.create();if(L.asset!=null&&Object.hasOwnProperty.call(L,"asset"))q.common.Asset.encode(L.asset,Z.uint32(10).fork()).ldelim();if(L.amount!=null&&Object.hasOwnProperty.call(L,"amount"))Z.uint32(18).string(L.amount);if(L.decimals!=null&&Object.hasOwnProperty.call(L,"decimals"))Z.uint32(24).int64(L.decimals);return Z},H.encodeDelimited=function(L,Z){return this.encode(L,Z).ldelim()},H.decode=function(L,Z){if(!(L instanceof T))L=T.create(L);let z=Z===void 0?L.len:L.pos+Z,Q=new q.common.Coin;while(L.pos<z){let J=L.uint32();switch(J>>>3){case 1:Q.asset=q.common.Asset.decode(L,L.uint32());break;case 2:Q.amount=L.string();break;case 3:Q.decimals=L.int64();break;default:L.skipType(J&7);break}}return Q},H.decodeDelimited=function(L){if(!(L instanceof T))L=new T(L);return this.decode(L,L.uint32())},H.verify=function(L){if(typeof L!=="object"||L===null)return"object expected";if(L.asset!=null&&L.hasOwnProperty("asset")){let Z=q.common.Asset.verify(L.asset);if(Z)return"asset."+Z}if(L.amount!=null&&L.hasOwnProperty("amount")){if(!W.isString(L.amount))return"amount: string expected"}if(L.decimals!=null&&L.hasOwnProperty("decimals")){if(!W.isInteger(L.decimals)&&!(L.decimals&&W.isInteger(L.decimals.low)&&W.isInteger(L.decimals.high)))return"decimals: integer|Long expected"}return null},H.fromObject=function(L){if(L instanceof q.common.Coin)return L;let Z=new q.common.Coin;if(L.asset!=null){if(typeof L.asset!=="object")throw TypeError(".common.Coin.asset: object expected");Z.asset=q.common.Asset.fromObject(L.asset)}if(L.amount!=null)Z.amount=String(L.amount);if(L.decimals!=null){if(W.Long)(Z.decimals=W.Long.fromValue(L.decimals)).unsigned=!1;else if(typeof L.decimals==="string")Z.decimals=Number.parseInt(L.decimals,10);else if(typeof L.decimals==="number")Z.decimals=L.decimals;else if(typeof L.decimals==="object")Z.decimals=new W.LongBits(L.decimals.low>>>0,L.decimals.high>>>0).toNumber()}return Z},H.toObject=function(L,Z){if(!Z)Z={};let z={};if(Z.defaults)if(z.asset=null,z.amount="",W.Long){let Q=new W.Long(0,0,!1);z.decimals=Z.longs===String?Q.toString():Z.longs===Number?Q.toNumber():Q}else z.decimals=Z.longs===String?"0":0;if(L.asset!=null&&L.hasOwnProperty("asset"))z.asset=q.common.Asset.toObject(L.asset,Z);if(L.amount!=null&&L.hasOwnProperty("amount"))z.amount=L.amount;if(L.decimals!=null&&L.hasOwnProperty("decimals"))if(typeof L.decimals==="number")z.decimals=Z.longs===String?String(L.decimals):L.decimals;else z.decimals=Z.longs===String?W.Long.prototype.toString.call(L.decimals):Z.longs===Number?new W.LongBits(L.decimals.low>>>0,L.decimals.high>>>0).toNumber():L.decimals;return z},H.prototype.toJSON=function(){return this.constructor.toObject(this,R.default.util.toJSONOptions)},H})(),Y.PubKeySet=(()=>{function H(X){if(X){for(let L=Object.keys(X),Z=0;Z<L.length;++Z)if(X[L[Z]]!=null)this[L[Z]]=X[L[Z]]}}return H.prototype.secp256k1="",H.prototype.ed25519="",H.create=function(L){return new H(L)},H.encode=function(L,Z){if(!Z)Z=f.create();if(L.secp256k1!=null&&Object.hasOwnProperty.call(L,"secp256k1"))Z.uint32(10).string(L.secp256k1);if(L.ed25519!=null&&Object.hasOwnProperty.call(L,"ed25519"))Z.uint32(18).string(L.ed25519);return Z},H.encodeDelimited=function(L,Z){return this.encode(L,Z).ldelim()},H.decode=function(L,Z){if(!(L instanceof T))L=T.create(L);let z=Z===void 0?L.len:L.pos+Z,Q=new q.common.PubKeySet;while(L.pos<z){let J=L.uint32();switch(J>>>3){case 1:Q.secp256k1=L.string();break;case 2:Q.ed25519=L.string();break;default:L.skipType(J&7);break}}return Q},H.decodeDelimited=function(L){if(!(L instanceof T))L=new T(L);return this.decode(L,L.uint32())},H.verify=function(L){if(typeof L!=="object"||L===null)return"object expected";if(L.secp256k1!=null&&L.hasOwnProperty("secp256k1")){if(!W.isString(L.secp256k1))return"secp256k1: string expected"}if(L.ed25519!=null&&L.hasOwnProperty("ed25519")){if(!W.isString(L.ed25519))return"ed25519: string expected"}return null},H.fromObject=function(L){if(L instanceof q.common.PubKeySet)return L;let Z=new q.common.PubKeySet;if(L.secp256k1!=null)Z.secp256k1=String(L.secp256k1);if(L.ed25519!=null)Z.ed25519=String(L.ed25519);return Z},H.toObject=function(L,Z){if(!Z)Z={};let z={};if(Z.defaults)z.secp256k1="",z.ed25519="";if(L.secp256k1!=null&&L.hasOwnProperty("secp256k1"))z.secp256k1=L.secp256k1;if(L.ed25519!=null&&L.hasOwnProperty("ed25519"))z.ed25519=L.ed25519;return z},H.prototype.toJSON=function(){return this.constructor.toObject(this,R.default.util.toJSONOptions)},H})(),Y.Tx=(()=>{function H(X){if(this.coins=[],this.gas=[],X){for(let L=Object.keys(X),Z=0;Z<L.length;++Z)if(X[L[Z]]!=null)this[L[Z]]=X[L[Z]]}}return H.prototype.id="",H.prototype.chain="",H.prototype.fromAddress="",H.prototype.toAddress="",H.prototype.coins=W.emptyArray,H.prototype.gas=W.emptyArray,H.prototype.memo="",H.create=function(L){return new H(L)},H.encode=function(L,Z){if(!Z)Z=f.create();if(L.id!=null&&Object.hasOwnProperty.call(L,"id"))Z.uint32(10).string(L.id);if(L.chain!=null&&Object.hasOwnProperty.call(L,"chain"))Z.uint32(18).string(L.chain);if(L.fromAddress!=null&&Object.hasOwnProperty.call(L,"fromAddress"))Z.uint32(26).string(L.fromAddress);if(L.toAddress!=null&&Object.hasOwnProperty.call(L,"toAddress"))Z.uint32(34).string(L.toAddress);if(L.coins?.length)for(let z=0;z<L.coins.length;++z)q.common.Coin.encode(L.coins[z],Z.uint32(42).fork()).ldelim();if(L.gas?.length)for(let z=0;z<L.gas.length;++z)q.common.Coin.encode(L.gas[z],Z.uint32(50).fork()).ldelim();if(L.memo!=null&&Object.hasOwnProperty.call(L,"memo"))Z.uint32(58).string(L.memo);return Z},H.encodeDelimited=function(L,Z){return this.encode(L,Z).ldelim()},H.decode=function(L,Z){if(!(L instanceof T))L=T.create(L);let z=Z===void 0?L.len:L.pos+Z,Q=new q.common.Tx;while(L.pos<z){let J=L.uint32();switch(J>>>3){case 1:Q.id=L.string();break;case 2:Q.chain=L.string();break;case 3:Q.fromAddress=L.string();break;case 4:Q.toAddress=L.string();break;case 5:if(!Q.coins?.length)Q.coins=[];Q.coins.push(q.common.Coin.decode(L,L.uint32()));break;case 6:if(!Q.gas?.length)Q.gas=[];Q.gas.push(q.common.Coin.decode(L,L.uint32()));break;case 7:Q.memo=L.string();break;default:L.skipType(J&7);break}}return Q},H.decodeDelimited=function(L){if(!(L instanceof T))L=new T(L);return this.decode(L,L.uint32())},H.verify=function(L){if(typeof L!=="object"||L===null)return"object expected";if(L.id!=null&&L.hasOwnProperty("id")){if(!W.isString(L.id))return"id: string expected"}if(L.chain!=null&&L.hasOwnProperty("chain")){if(!W.isString(L.chain))return"chain: string expected"}if(L.fromAddress!=null&&L.hasOwnProperty("fromAddress")){if(!W.isString(L.fromAddress))return"fromAddress: string expected"}if(L.toAddress!=null&&L.hasOwnProperty("toAddress")){if(!W.isString(L.toAddress))return"toAddress: string expected"}if(L.coins!=null&&L.hasOwnProperty("coins")){if(!Array.isArray(L.coins))return"coins: array expected";for(let Z=0;Z<L.coins.length;++Z){let z=q.common.Coin.verify(L.coins[Z]);if(z)return"coins."+z}}if(L.gas!=null&&L.hasOwnProperty("gas")){if(!Array.isArray(L.gas))return"gas: array expected";for(let Z=0;Z<L.gas.length;++Z){let z=q.common.Coin.verify(L.gas[Z]);if(z)return"gas."+z}}if(L.memo!=null&&L.hasOwnProperty("memo")){if(!W.isString(L.memo))return"memo: string expected"}return null},H.fromObject=function(L){if(L instanceof q.common.Tx)return L;let Z=new q.common.Tx;if(L.id!=null)Z.id=String(L.id);if(L.chain!=null)Z.chain=String(L.chain);if(L.fromAddress!=null)Z.fromAddress=String(L.fromAddress);if(L.toAddress!=null)Z.toAddress=String(L.toAddress);if(L.coins){if(!Array.isArray(L.coins))throw TypeError(".common.Tx.coins: array expected");Z.coins=[];for(let z=0;z<L.coins.length;++z){if(typeof L.coins[z]!=="object")throw TypeError(".common.Tx.coins: object expected");Z.coins[z]=q.common.Coin.fromObject(L.coins[z])}}if(L.gas){if(!Array.isArray(L.gas))throw TypeError(".common.Tx.gas: array expected");Z.gas=[];for(let z=0;z<L.gas.length;++z){if(typeof L.gas[z]!=="object")throw TypeError(".common.Tx.gas: object expected");Z.gas[z]=q.common.Coin.fromObject(L.gas[z])}}if(L.memo!=null)Z.memo=String(L.memo);return Z},H.toObject=function(L,Z){if(!Z)Z={};let z={};if(Z.arrays||Z.defaults)z.coins=[],z.gas=[];if(Z.defaults)z.id="",z.chain="",z.fromAddress="",z.toAddress="",z.memo="";if(L.id!=null&&L.hasOwnProperty("id"))z.id=L.id;if(L.chain!=null&&L.hasOwnProperty("chain"))z.chain=L.chain;if(L.fromAddress!=null&&L.hasOwnProperty("fromAddress"))z.fromAddress=L.fromAddress;if(L.toAddress!=null&&L.hasOwnProperty("toAddress"))z.toAddress=L.toAddress;if(L.coins?.length){z.coins=[];for(let Q=0;Q<L.coins.length;++Q)z.coins[Q]=q.common.Coin.toObject(L.coins[Q],Z)}if(L.gas?.length){z.gas=[];for(let Q=0;Q<L.gas.length;++Q)z.gas[Q]=q.common.Coin.toObject(L.gas[Q],Z)}if(L.memo!=null&&L.hasOwnProperty("memo"))z.memo=L.memo;return z},H.prototype.toJSON=function(){return this.constructor.toObject(this,R.default.util.toJSONOptions)},H})(),Y.Fee=(()=>{function H(X){if(this.coins=[],X){for(let L=Object.keys(X),Z=0;Z<L.length;++Z)if(X[L[Z]]!=null)this[L[Z]]=X[L[Z]]}}return H.prototype.coins=W.emptyArray,H.prototype.poolDeduct="",H.create=function(L){return new H(L)},H.encode=function(L,Z){if(!Z)Z=f.create();if(L.coins?.length)for(let z=0;z<L.coins.length;++z)q.common.Coin.encode(L.coins[z],Z.uint32(10).fork()).ldelim();if(L.poolDeduct!=null&&Object.hasOwnProperty.call(L,"poolDeduct"))Z.uint32(18).string(L.poolDeduct);return Z},H.encodeDelimited=function(L,Z){return this.encode(L,Z).ldelim()},H.decode=function(L,Z){if(!(L instanceof T))L=T.create(L);let z=Z===void 0?L.len:L.pos+Z,Q=new q.common.Fee;while(L.pos<z){let J=L.uint32();switch(J>>>3){case 1:if(!Q.coins?.length)Q.coins=[];Q.coins.push(q.common.Coin.decode(L,L.uint32()));break;case 2:Q.poolDeduct=L.string();break;default:L.skipType(J&7);break}}return Q},H.decodeDelimited=function(L){if(!(L instanceof T))L=new T(L);return this.decode(L,L.uint32())},H.verify=function(L){if(typeof L!=="object"||L===null)return"object expected";if(L.coins!=null&&L.hasOwnProperty("coins")){if(!Array.isArray(L.coins))return"coins: array expected";for(let Z=0;Z<L.coins.length;++Z){let z=q.common.Coin.verify(L.coins[Z]);if(z)return"coins."+z}}if(L.poolDeduct!=null&&L.hasOwnProperty("poolDeduct")){if(!W.isString(L.poolDeduct))return"poolDeduct: string expected"}return null},H.fromObject=function(L){if(L instanceof q.common.Fee)return L;let Z=new q.common.Fee;if(L.coins){if(!Array.isArray(L.coins))throw TypeError(".common.Fee.coins: array expected");Z.coins=[];for(let z=0;z<L.coins.length;++z){if(typeof L.coins[z]!=="object")throw TypeError(".common.Fee.coins: object expected");Z.coins[z]=q.common.Coin.fromObject(L.coins[z])}}if(L.poolDeduct!=null)Z.poolDeduct=String(L.poolDeduct);return Z},H.toObject=function(L,Z){if(!Z)Z={};let z={};if(Z.arrays||Z.defaults)z.coins=[];if(Z.defaults)z.poolDeduct="";if(L.coins?.length){z.coins=[];for(let Q=0;Q<L.coins.length;++Q)z.coins[Q]=q.common.Coin.toObject(L.coins[Q],Z)}if(L.poolDeduct!=null&&L.hasOwnProperty("poolDeduct"))z.poolDeduct=L.poolDeduct;return z},H.prototype.toJSON=function(){return this.constructor.toObject(this,R.default.util.toJSONOptions)},H})(),Y.ProtoUint=(()=>{function H(X){if(X){for(let L=Object.keys(X),Z=0;Z<L.length;++Z)if(X[L[Z]]!=null)this[L[Z]]=X[L[Z]]}}return H.prototype.value="",H.create=function(L){return new H(L)},H.encode=function(L,Z){if(!Z)Z=f.create();if(L.value!=null&&Object.hasOwnProperty.call(L,"value"))Z.uint32(10).string(L.value);return Z},H.encodeDelimited=function(L,Z){return this.encode(L,Z).ldelim()},H.decode=function(L,Z){if(!(L instanceof T))L=T.create(L);let z=Z===void 0?L.len:L.pos+Z,Q=new q.common.ProtoUint;while(L.pos<z){let J=L.uint32();switch(J>>>3){case 1:Q.value=L.string();break;default:L.skipType(J&7);break}}return Q},H.decodeDelimited=function(L){if(!(L instanceof T))L=new T(L);return this.decode(L,L.uint32())},H.verify=function(L){if(typeof L!=="object"||L===null)return"object expected";if(L.value!=null&&L.hasOwnProperty("value")){if(!W.isString(L.value))return"value: string expected"}return null},H.fromObject=function(L){if(L instanceof q.common.ProtoUint)return L;let Z=new q.common.ProtoUint;if(L.value!=null)Z.value=String(L.value);return Z},H.toObject=function(L,Z){if(!Z)Z={};let z={};if(Z.defaults)z.value="";if(L.value!=null&&L.hasOwnProperty("value"))z.value=L.value;return z},H.prototype.toJSON=function(){return this.constructor.toObject(this,R.default.util.toJSONOptions)},H})(),Y})();q.types=(()=>{let Y={};return Y.MsgDeposit=(()=>{function H(X){if(this.coins=[],X){for(let L=Object.keys(X),Z=0;Z<L.length;++Z)if(X[L[Z]]!=null)this[L[Z]]=X[L[Z]]}}return H.prototype.coins=W.emptyArray,H.prototype.memo="",H.prototype.signer=W.newBuffer([]),H.create=function(L){return new H(L)},H.encode=function(L,Z){if(!Z)Z=f.create();if(L.coins?.length)for(let z=0;z<L.coins.length;++z)q.common.Coin.encode(L.coins[z],Z.uint32(10).fork()).ldelim();if(L.memo!=null&&Object.hasOwnProperty.call(L,"memo"))Z.uint32(18).string(L.memo);if(L.signer!=null&&Object.hasOwnProperty.call(L,"signer"))Z.uint32(26).bytes(L.signer);return Z},H.encodeDelimited=function(L,Z){return this.encode(L,Z).ldelim()},H.decode=function(L,Z){if(!(L instanceof T))L=T.create(L);let z=Z===void 0?L.len:L.pos+Z,Q=new q.types.MsgDeposit;while(L.pos<z){let J=L.uint32();switch(J>>>3){case 1:if(!Q.coins?.length)Q.coins=[];Q.coins.push(q.common.Coin.decode(L,L.uint32()));break;case 2:Q.memo=L.string();break;case 3:Q.signer=L.bytes();break;default:L.skipType(J&7);break}}return Q},H.decodeDelimited=function(L){if(!(L instanceof T))L=new T(L);return this.decode(L,L.uint32())},H.verify=function(L){if(typeof L!=="object"||L===null)return"object expected";if(L.coins!=null&&L.hasOwnProperty("coins")){if(!Array.isArray(L.coins))return"coins: array expected";for(let Z=0;Z<L.coins.length;++Z){let z=q.common.Coin.verify(L.coins[Z]);if(z)return"coins."+z}}if(L.memo!=null&&L.hasOwnProperty("memo")){if(!W.isString(L.memo))return"memo: string expected"}if(L.signer!=null&&L.hasOwnProperty("signer")){if(!(L.signer&&typeof L.signer.length==="number"||W.isString(L.signer)))return"signer: buffer expected"}return null},H.fromObject=function(L){if(L instanceof q.types.MsgDeposit)return L;let Z=new q.types.MsgDeposit;if(L.coins){if(!Array.isArray(L.coins))throw TypeError(".types.MsgDeposit.coins: array expected");Z.coins=[];for(let z=0;z<L.coins.length;++z){if(typeof L.coins[z]!=="object")throw TypeError(".types.MsgDeposit.coins: object expected");Z.coins[z]=q.common.Coin.fromObject(L.coins[z])}}if(L.memo!=null)Z.memo=String(L.memo);if(L.signer!=null){if(typeof L.signer==="string")W.base64.decode(L.signer,Z.signer=W.newBuffer(W.base64.length(L.signer)),0);else if(L.signer.length)Z.signer=L.signer}return Z},H.toObject=function(L,Z){if(!Z)Z={};let z={};if(Z.arrays||Z.defaults)z.coins=[];if(Z.defaults){if(z.memo="",Z.bytes===String)z.signer="";else if(z.signer=[],Z.bytes!==Array)z.signer=W.newBuffer(z.signer)}if(L.coins?.length){z.coins=[];for(let Q=0;Q<L.coins.length;++Q)z.coins[Q]=q.common.Coin.toObject(L.coins[Q],Z)}if(L.memo!=null&&L.hasOwnProperty("memo"))z.memo=L.memo;if(L.signer!=null&&L.hasOwnProperty("signer"))z.signer=Z.bytes===String?W.base64.encode(L.signer,0,L.signer.length):Z.bytes===Array?Array.prototype.slice.call(L.signer):L.signer;return z},H.prototype.toJSON=function(){return this.constructor.toObject(this,R.default.util.toJSONOptions)},H})(),Y.MsgSend=(()=>{function H(X){if(this.amount=[],X){for(let L=Object.keys(X),Z=0;Z<L.length;++Z)if(X[L[Z]]!=null)this[L[Z]]=X[L[Z]]}}return H.prototype.fromAddress=W.newBuffer([]),H.prototype.toAddress=W.newBuffer([]),H.prototype.amount=W.emptyArray,H.create=function(L){return new H(L)},H.encode=function(L,Z){if(!Z)Z=f.create();if(L.fromAddress!=null&&Object.hasOwnProperty.call(L,"fromAddress"))Z.uint32(10).bytes(L.fromAddress);if(L.toAddress!=null&&Object.hasOwnProperty.call(L,"toAddress"))Z.uint32(18).bytes(L.toAddress);if(L.amount?.length)for(let z=0;z<L.amount.length;++z)q.cosmos.base.v1beta1.Coin.encode(L.amount[z],Z.uint32(26).fork()).ldelim();return Z},H.encodeDelimited=function(L,Z){return this.encode(L,Z).ldelim()},H.decode=function(L,Z){if(!(L instanceof T))L=T.create(L);let z=Z===void 0?L.len:L.pos+Z,Q=new q.types.MsgSend;while(L.pos<z){let J=L.uint32();switch(J>>>3){case 1:Q.fromAddress=L.bytes();break;case 2:Q.toAddress=L.bytes();break;case 3:if(!Q.amount?.length)Q.amount=[];Q.amount.push(q.cosmos.base.v1beta1.Coin.decode(L,L.uint32()));break;default:L.skipType(J&7);break}}return Q},H.decodeDelimited=function(L){if(!(L instanceof T))L=new T(L);return this.decode(L,L.uint32())},H.verify=function(L){if(typeof L!=="object"||L===null)return"object expected";if(L.fromAddress!=null&&L.hasOwnProperty("fromAddress")){if(!(L.fromAddress&&typeof L.fromAddress.length==="number"||W.isString(L.fromAddress)))return"fromAddress: buffer expected"}if(L.toAddress!=null&&L.hasOwnProperty("toAddress")){if(!(L.toAddress&&typeof L.toAddress.length==="number"||W.isString(L.toAddress)))return"toAddress: buffer expected"}if(L.amount!=null&&L.hasOwnProperty("amount")){if(!Array.isArray(L.amount))return"amount: array expected";for(let Z=0;Z<L.amount.length;++Z){let z=q.cosmos.base.v1beta1.Coin.verify(L.amount[Z]);if(z)return"amount."+z}}return null},H.fromObject=function(L){if(L instanceof q.types.MsgSend)return L;let Z=new q.types.MsgSend;if(L.fromAddress!=null){if(typeof L.fromAddress==="string")W.base64.decode(L.fromAddress,Z.fromAddress=W.newBuffer(W.base64.length(L.fromAddress)),0);else if(L.fromAddress.length)Z.fromAddress=L.fromAddress}if(L.toAddress!=null){if(typeof L.toAddress==="string")W.base64.decode(L.toAddress,Z.toAddress=W.newBuffer(W.base64.length(L.toAddress)),0);else if(L.toAddress.length)Z.toAddress=L.toAddress}if(L.amount){if(!Array.isArray(L.amount))throw TypeError(".types.MsgSend.amount: array expected");Z.amount=[];for(let z=0;z<L.amount.length;++z){if(typeof L.amount[z]!=="object")throw TypeError(".types.MsgSend.amount: object expected");Z.amount[z]=q.cosmos.base.v1beta1.Coin.fromObject(L.amount[z])}}return Z},H.toObject=function(L,Z){if(!Z)Z={};let z={};if(Z.arrays||Z.defaults)z.amount=[];if(Z.defaults){if(Z.bytes===String)z.fromAddress="";else if(z.fromAddress=[],Z.bytes!==Array)z.fromAddress=W.newBuffer(z.fromAddress);if(Z.bytes===String)z.toAddress="";else if(z.toAddress=[],Z.bytes!==Array)z.toAddress=W.newBuffer(z.toAddress)}if(L.fromAddress!=null&&L.hasOwnProperty("fromAddress"))z.fromAddress=Z.bytes===String?W.base64.encode(L.fromAddress,0,L.fromAddress.length):Z.bytes===Array?Array.prototype.slice.call(L.fromAddress):L.fromAddress;if(L.toAddress!=null&&L.hasOwnProperty("toAddress"))z.toAddress=Z.bytes===String?W.base64.encode(L.toAddress,0,L.toAddress.length):Z.bytes===Array?Array.prototype.slice.call(L.toAddress):L.toAddress;if(L.amount?.length){z.amount=[];for(let Q=0;Q<L.amount.length;++Q)z.amount[Q]=q.cosmos.base.v1beta1.Coin.toObject(L.amount[Q],Z)}return z},H.prototype.toJSON=function(){return this.constructor.toObject(this,R.default.util.toJSONOptions)},H})(),Y})();q.cosmos=(()=>{let Y={};return Y.base=(()=>{let H={};return H.v1beta1=(()=>{let X={};return X.Coin=(()=>{function L(Z){if(Z){for(let z=Object.keys(Z),Q=0;Q<z.length;++Q)if(Z[z[Q]]!=null)this[z[Q]]=Z[z[Q]]}}return L.prototype.denom="",L.prototype.amount="",L.create=function(z){return new L(z)},L.encode=function(z,Q){if(!Q)Q=f.create();if(z.denom!=null&&Object.hasOwnProperty.call(z,"denom"))Q.uint32(10).string(z.denom);if(z.amount!=null&&Object.hasOwnProperty.call(z,"amount"))Q.uint32(18).string(z.amount);return Q},L.encodeDelimited=function(z,Q){return this.encode(z,Q).ldelim()},L.decode=function(z,Q){if(!(z instanceof T))z=T.create(z);let J=Q===void 0?z.len:z.pos+Q,_=new q.cosmos.base.v1beta1.Coin;while(z.pos<J){let E=z.uint32();switch(E>>>3){case 1:_.denom=z.string();break;case 2:_.amount=z.string();break;default:z.skipType(E&7);break}}return _},L.decodeDelimited=function(z){if(!(z instanceof T))z=new T(z);return this.decode(z,z.uint32())},L.verify=function(z){if(typeof z!=="object"||z===null)return"object expected";if(z.denom!=null&&z.hasOwnProperty("denom")){if(!W.isString(z.denom))return"denom: string expected"}if(z.amount!=null&&z.hasOwnProperty("amount")){if(!W.isString(z.amount))return"amount: string expected"}return null},L.fromObject=function(z){if(z instanceof q.cosmos.base.v1beta1.Coin)return z;let Q=new q.cosmos.base.v1beta1.Coin;if(z.denom!=null)Q.denom=String(z.denom);if(z.amount!=null)Q.amount=String(z.amount);return Q},L.toObject=function(z,Q){if(!Q)Q={};let J={};if(Q.defaults)J.denom="",J.amount="";if(z.denom!=null&&z.hasOwnProperty("denom"))J.denom=z.denom;if(z.amount!=null&&z.hasOwnProperty("amount"))J.amount=z.amount;return J},L.prototype.toJSON=function(){return this.constructor.toObject(this,R.default.util.toJSONOptions)},L})(),X.DecCoin=(()=>{function L(Z){if(Z){for(let z=Object.keys(Z),Q=0;Q<z.length;++Q)if(Z[z[Q]]!=null)this[z[Q]]=Z[z[Q]]}}return L.prototype.denom="",L.prototype.amount="",L.create=function(z){return new L(z)},L.encode=function(z,Q){if(!Q)Q=f.create();if(z.denom!=null&&Object.hasOwnProperty.call(z,"denom"))Q.uint32(10).string(z.denom);if(z.amount!=null&&Object.hasOwnProperty.call(z,"amount"))Q.uint32(18).string(z.amount);return Q},L.encodeDelimited=function(z,Q){return this.encode(z,Q).ldelim()},L.decode=function(z,Q){if(!(z instanceof T))z=T.create(z);let J=Q===void 0?z.len:z.pos+Q,_=new q.cosmos.base.v1beta1.DecCoin;while(z.pos<J){let E=z.uint32();switch(E>>>3){case 1:_.denom=z.string();break;case 2:_.amount=z.string();break;default:z.skipType(E&7);break}}return _},L.decodeDelimited=function(z){if(!(z instanceof T))z=new T(z);return this.decode(z,z.uint32())},L.verify=function(z){if(typeof z!=="object"||z===null)return"object expected";if(z.denom!=null&&z.hasOwnProperty("denom")){if(!W.isString(z.denom))return"denom: string expected"}if(z.amount!=null&&z.hasOwnProperty("amount")){if(!W.isString(z.amount))return"amount: string expected"}return null},L.fromObject=function(z){if(z instanceof q.cosmos.base.v1beta1.DecCoin)return z;let Q=new q.cosmos.base.v1beta1.DecCoin;if(z.denom!=null)Q.denom=String(z.denom);if(z.amount!=null)Q.amount=String(z.amount);return Q},L.toObject=function(z,Q){if(!Q)Q={};let J={};if(Q.defaults)J.denom="",J.amount="";if(z.denom!=null&&z.hasOwnProperty("denom"))J.denom=z.denom;if(z.amount!=null&&z.hasOwnProperty("amount"))J.amount=z.amount;return J},L.prototype.toJSON=function(){return this.constructor.toObject(this,R.default.util.toJSONOptions)},L})(),X.IntProto=(()=>{function L(Z){if(Z){for(let z=Object.keys(Z),Q=0;Q<z.length;++Q)if(Z[z[Q]]!=null)this[z[Q]]=Z[z[Q]]}}return L.prototype.int="",L.create=function(z){return new L(z)},L.encode=function(z,Q){if(!Q)Q=f.create();if(z.int!=null&&Object.hasOwnProperty.call(z,"int"))Q.uint32(10).string(z.int);return Q},L.encodeDelimited=function(z,Q){return this.encode(z,Q).ldelim()},L.decode=function(z,Q){if(!(z instanceof T))z=T.create(z);let J=Q===void 0?z.len:z.pos+Q,_=new q.cosmos.base.v1beta1.IntProto;while(z.pos<J){let E=z.uint32();switch(E>>>3){case 1:_.int=z.string();break;default:z.skipType(E&7);break}}return _},L.decodeDelimited=function(z){if(!(z instanceof T))z=new T(z);return this.decode(z,z.uint32())},L.verify=function(z){if(typeof z!=="object"||z===null)return"object expected";if(z.int!=null&&z.hasOwnProperty("int")){if(!W.isString(z.int))return"int: string expected"}return null},L.fromObject=function(z){if(z instanceof q.cosmos.base.v1beta1.IntProto)return z;let Q=new q.cosmos.base.v1beta1.IntProto;if(z.int!=null)Q.int=String(z.int);return Q},L.toObject=function(z,Q){if(!Q)Q={};let J={};if(Q.defaults)J.int="";if(z.int!=null&&z.hasOwnProperty("int"))J.int=z.int;return J},L.prototype.toJSON=function(){return this.constructor.toObject(this,R.default.util.toJSONOptions)},L})(),X.DecProto=(()=>{function L(Z){if(Z){for(let z=Object.keys(Z),Q=0;Q<z.length;++Q)if(Z[z[Q]]!=null)this[z[Q]]=Z[z[Q]]}}return L.prototype.dec="",L.create=function(z){return new L(z)},L.encode=function(z,Q){if(!Q)Q=f.create();if(z.dec!=null&&Object.hasOwnProperty.call(z,"dec"))Q.uint32(10).string(z.dec);return Q},L.encodeDelimited=function(z,Q){return this.encode(z,Q).ldelim()},L.decode=function(z,Q){if(!(z instanceof T))z=T.create(z);let J=Q===void 0?z.len:z.pos+Q,_=new q.cosmos.base.v1beta1.DecProto;while(z.pos<J){let E=z.uint32();switch(E>>>3){case 1:_.dec=z.string();break;default:z.skipType(E&7);break}}return _},L.decodeDelimited=function(z){if(!(z instanceof T))z=new T(z);return this.decode(z,z.uint32())},L.verify=function(z){if(typeof z!=="object"||z===null)return"object expected";if(z.dec!=null&&z.hasOwnProperty("dec")){if(!W.isString(z.dec))return"dec: string expected"}return null},L.fromObject=function(z){if(z instanceof q.cosmos.base.v1beta1.DecProto)return z;let Q=new q.cosmos.base.v1beta1.DecProto;if(z.dec!=null)Q.dec=String(z.dec);return Q},L.toObject=function(z,Q){if(!Q)Q={};let J={};if(Q.defaults)J.dec="";if(z.dec!=null&&z.hasOwnProperty("dec"))J.dec=z.dec;return J},L.prototype.toJSON=function(){return this.constructor.toObject(this,R.default.util.toJSONOptions)},L})(),X})(),H})(),Y})()});async function c(){let{$root:Y}=await Promise.resolve().then(() => (u6(),$6)),H=await import("@cosmjs/proto-signing"),X=H.Registry??H.default?.Registry,L=await import("@cosmjs/stargate"),Z=L.defaultRegistryTypes??L.default?.defaultRegistryTypes;return new X([...Z,["/types.MsgSend",Y.types.MsgSend],["/types.MsgDeposit",Y.types.MsgDeposit]])}async function w(Y){let H=await import("@cosmjs/stargate"),X=H.AminoTypes??H.default?.AminoTypes,L=Y===h6.Chain.THORChain?"thorchain":"mayachain";return new X({"/types.MsgDeposit":{aminoType:`${L}/MsgDeposit`,fromAmino:({signer:Z,...z})=>({...z,signer:a(Z)}),toAmino:({signer:Z,...z})=>({...z,signer:s(Z)})},"/types.MsgSend":{aminoType:`${L}/MsgSend`,fromAmino:({from_address:Z,to_address:z,...Q})=>({...Q,fromAddress:a(Z),toAddress:a(z)}),toAmino:({fromAddress:Z,toAddress:z,...Q})=>({...Q,from_address:s(Z),to_address:s(z)})}})}var h6;var _6=F(()=>{q6();h6=require("@swapkit/helpers")});function N6(Y){return function(X){let{assetValue:L,recipient:Z,memo:z,sender:Q,asSignable:J,asAminoMessage:_}=X;if(Z)return j6(Y)({asAminoMessage:_,asSignable:J,assetValue:L,memo:z,recipient:Z,sender:Q});return b6(Y)({asAminoMessage:_,asSignable:J,assetValue:L,memo:z,sender:Q})}}function u(Y){if(Y.type==="thorchain/MsgSend"||Y.type==="mayachain/MsgSend")return Y;return{...Y,value:{...Y.value,coins:Y.value.coins.map((H)=>{let X=y.AssetValue.from({asset:H.asset}),L=(X.isSynthetic?X.symbol.split("/")?.[1]:X.symbol)?.toUpperCase(),Z=(X.isSynthetic?X.symbol.split("/")?.[0]:X.chain)?.toUpperCase();return{...H,asset:{chain:Z,symbol:L,synth:X.isSynthetic,ticker:X.ticker}}})}}}async function L6({chain:Y,memo:H,msgs:X}){let L=await c(),Z=await w(Y),z={typeUrl:"/cosmos.tx.v1beta1.TxBody",value:{memo:H,messages:X.map((Q)=>Z.fromAmino(Q))}};return L.encode(z)}var y,J4,q4,I6=({sender:Y,recipient:H,assetValue:X})=>{return{type:`${X.chain===y.Chain.Maya?"mayachain":"thorchain"}/MsgSend`,value:{amount:[{amount:X.getBaseValue("string"),denom:D(X.symbol,!0)}],from_address:Y,to_address:H}}},E6=({sender:Y,assetValue:H,memo:X=""})=>{return{type:`${H.chain===y.Chain.Maya?"mayachain":"thorchain"}/MsgDeposit`,value:{coins:[{amount:H.getBaseValue("string"),asset:d(H)}],memo:X,signer:Y}}},X6=({sender:Y,recipient:H,assetValue:X,memo:L})=>{return!H?E6({assetValue:X,memo:L,sender:Y}):I6({assetValue:X,recipient:H,sender:Y})},$=async(Y,H)=>{return(await w(H)).fromAmino(Y)},l6=async({rpcUrl:Y,sender:H})=>{let L=await(await P(Y)).getAccount(H);if(!L)throw new y.SwapKitError("toolbox_cosmos_account_not_found",{sender:H});return L},j6=(Y)=>async({sender:H,recipient:X,assetValue:L,memo:Z="",asSignable:z=!0,asAminoMessage:Q=!1,sequence:J,accountNumber:_})=>{let E=await l6({rpcUrl:Y,sender:H}),A=L.chain,{chainId:k}=y.getChainConfig(A),I=I6({assetValue:L,recipient:X,sender:H}),x=z?await $(Q?I:u(I),A):I;return{accountNumber:_||E.accountNumber,chainId:k,fee:S(A),memo:Z,msgs:[x],sequence:J||E.sequence}},b6=(Y)=>async({sender:H,assetValue:X,memo:L="",asSignable:Z=!0,asAminoMessage:z=!1,sequence:Q,accountNumber:J})=>{let _=await l6({rpcUrl:Y,sender:H}),E=X.chain,{chainId:A}=y.getChainConfig(E),k=E6({assetValue:X,memo:L,sender:H}),I=Z?await $(z?k:u(k),E):k;return{accountNumber:J||_.accountNumber,chainId:A,fee:S(E),memo:L,msgs:[I],sequence:Q||_.sequence}};var p6=F(()=>{e();_6();y=require("@swapkit/helpers"),J4=S(y.Chain.THORChain).gas,q4=S(y.Chain.Maya).gas});var c6=()=>{};var d6=F(()=>{c6()});var O6=F(()=>{q6();p6();_6();d6()});async function A6(Y,H){try{let L=(await K6.SwapKitApi.getGasRate()).find((Z)=>Z.chainId===Y)?.value;return L?Number.parseFloat(L):H}catch{return H}}async function v6({phrase:Y,prefix:H,...X}){let L=await import("@cosmjs/proto-signing"),Z=L.DirectSecp256k1HdWallet??L.default?.DirectSecp256k1HdWallet,z=await import("@cosmjs/crypto"),Q=z.stringToPath??z.default?.stringToPath,J="derivationPath"in X?X.derivationPath:`${G.DerivationPath[X.chain]}/${X.index}`;return Z.fromMnemonic(Y,{hdPaths:[Q(J)],prefix:H})}async function W4({privateKey:Y,prefix:H}){let X=await import("@cosmjs/proto-signing");return(X.DirectSecp256k1Wallet??X.default?.DirectSecp256k1Wallet).fromKey(Y,H)}function g6(Y){return async function({signature:X,message:L,address:Z}){let z=await Y(Z);if(!z?.pubkey)throw new G.SwapKitError("toolbox_cosmos_verify_signature_no_pubkey");let Q=await import("@cosmjs/crypto"),J=Q.Secp256k1Signature??Q.default?.Secp256k1Signature,_=Q.Secp256k1??Q.default?.Secp256k1,E=J.fromFixedLength(h.base64.decode(X));return _.verifySignature(E,h.base64.decode(L),z.pubkey.value)}}async function Z6({chain:Y,...H}){let X=await G.getRPCUrl(Y),L=G.CosmosChainPrefixes[Y],Z="index"in H?H.index||0:0,z=G.derivationPathToString("derivationPath"in H&&H.derivationPath?H.derivationPath:G.updateDerivationPath(G.NetworkDerivationPath[Y],{index:Z})),Q=await z6.match(H).with({phrase:z6.P.string},({phrase:I})=>v6({derivationPath:z,phrase:I,prefix:L})).with({signer:z6.P.any},({signer:I})=>I).otherwise(()=>{return});async function J(I){return(await P(X)).getAccount(I)}async function _(){let[I]=await Q?.getAccounts()||[];return I?.address}async function E(){let[I]=await Q?.getAccounts()||[];if(!I?.pubkey)throw new G.SwapKitError("toolbox_cosmos_signer_not_defined");return h.base64.encode(I?.pubkey)}async function A({recipient:I,assetValue:x,memo:N="",feeRate:v,feeOptionKey:U=G.FeeOption.Fast}){let V=await _();if(!(Q&&V))throw new G.SwapKitError("toolbox_cosmos_signer_not_defined");let M=G.AssetValue.from({chain:Y}),m=d(M),g=v||n6((await U6(Y,x6[Y]))[U],m),i=await n(X,Q),b=D(x.symbol),p=x.getBaseValue("string"),{TxRaw:o}=await import("cosmjs-types/cosmos/tx/v1beta1/tx"),t={amount:[{amount:p,denom:b}],fromAddress:V,toAddress:I},V6=await i.sign(V,[{typeUrl:"/cosmos.bank.v1beta1.MsgSend",value:t}],g,N),J6=o.encode(V6).finish();return Buffer.from(J6).toString("hex")}async function k({recipient:I,assetValue:x,memo:N="",feeRate:v,feeOptionKey:U=G.FeeOption.Fast,dryRun:V=!1}){if(V)return A({assetValue:x,feeOptionKey:U,feeRate:v,memo:N,recipient:I});let M=await _();if(!(Q&&M))throw new G.SwapKitError("toolbox_cosmos_signer_not_defined");let m=G.AssetValue.from({chain:Y}),g=d(m),i=v||n6((await U6(Y,x6[Y]))[U],g),b=await n(X,Q),p=D(x.symbol),o=[{amount:x.getBaseValue("string"),denom:p}],{transactionHash:t}=await b.sendTokens(M,I,o,i,N);return t}return{createPrivateKeyFromPhrase:_4(z),createTransaction:G6,fetchFeeRateFromSwapKit:A6,getAccount:J,getAddress:_,getBalance:async(I,x)=>{let N=await m6(X)(I),v=await Promise.all(N.filter(({denom:U})=>U&&!U.includes("IBC/")&&!([G.Chain.THORChain,G.Chain.Maya].includes(Y)&&U.split("-").length>2)).map(({denom:U,amount:V})=>{let M=[G.Chain.THORChain,G.Chain.Maya].includes(Y)&&(U.includes("/")||U.includes("˜"))?`${Y}.${U}`:U;return T6(M,V)}));if(v.length===0)return[G.AssetValue.from({chain:Y})];return v},getBalanceAsDenoms:m6(X),getFees:()=>U6(Y,x6[Y]),getPubKey:E,getSignerFromPhrase:async({phrase:I,derivationPath:x})=>v6({derivationPath:G.derivationPathToString(x),index:Z,phrase:I,prefix:L}),getSignerFromPrivateKey:async(I)=>{let x=await import("@cosmjs/proto-signing");return(x.DirectSecp256k1Wallet??x.default?.DirectSecp256k1Wallet).fromKey(I,L)},signTransaction:A,transfer:k,validateAddress:i6(Y),verifySignature:g6(J)}}async function B4(Y,H){try{let L=(await K6.SwapKitApi.getGasRate()).find((Z)=>Z.chainId===Y)?.value;return L?Number.parseFloat(L):H}catch{return H}}function G4({assetValue:{chain:Y}}){return G.AssetValue.from({chain:Y,value:T4(Y)})}async function U6(Y,H){let{chainId:X,baseDecimal:L}=G.getChainConfig(Y),Z=await A6(X,H);return{average:G.SwapKitNumber.fromBigInt(BigInt(Z),L),fast:G.SwapKitNumber.fromBigInt(BigInt(G.applyFeeMultiplier(Z,G.FeeOption.Fast,!0)),L),fastest:G.SwapKitNumber.fromBigInt(BigInt(G.applyFeeMultiplier(Z,G.FeeOption.Fastest,!0)),L)}}function n6(Y,H){return{amount:[{amount:Y.getBaseValue("string"),denom:H}],gas:"200000"}}function T4(Y){return{[G.Chain.Cosmos]:0.007,[G.Chain.Kujira]:0.02,[G.Chain.Noble]:0.01,[G.Chain.THORChain]:0.02,[G.Chain.Maya]:0.02,[G.Chain.Harbor]:0.02}[Y]||0}function i6(Y){let H=G.CosmosChainPrefixes[Y];return function(L){if(!L.startsWith(H))return!1;try{let{prefix:Z,words:z}=h.bech32.decode(L);return h.bech32.encode(Z,z)===L.toLocaleLowerCase()}catch{return!1}}}function m6(Y){return async function(X){return(await(await P(Y)).getAllBalances(X)).map((Q)=>({...Q,denom:Q.denom.includes("/")?Q.denom.toUpperCase():Q.denom}))}}function _4(Y){return async function(X){let L=await import("@cosmjs/crypto"),Z=L.stringToPath??L.default?.stringToPath,z=L.Slip10Curve??L.default?.Slip10Curve,Q=L.Slip10??L.default?.Slip10,J=L.EnglishMnemonic??L.default?.EnglishMnemonic,_=L.Bip39??L.default?.Bip39,E=new J(X),A=await _.mnemonicToSeed(E),{privkey:k}=Q.derivePath(z.Secp256k1,A,Z(Y));return k}}var h,G,K6,z6,x6;var Y6=F(()=>{e();h=require("@scure/base"),G=require("@swapkit/helpers"),K6=require("@swapkit/helpers/api"),z6=require("ts-pattern");x6={[G.Chain.Cosmos]:1000,[G.Chain.Kujira]:1000,[G.Chain.Noble]:1000,[G.Chain.THORChain]:5000000,[G.Chain.Maya]:5000000,[G.Chain.Harbor]:5000000}});function I4({prefix:Y,derivationPath:H}){return async function(L,Z=0){let z=await import("@cosmjs/amino"),Q=z.Secp256k1HdWallet??z.default?.Secp256k1HdWallet,J=await import("@cosmjs/crypto"),_=J.stringToPath??J.default?.stringToPath;return Q.fromMnemonic(L,{hdPaths:[_(`${H}/${Z}`)],prefix:Y})}}function E4(Y){return l.base64.encode(Y)}function N4(Y){return async function({wallet:X,tx:L}){let{msgs:Z,accountNumber:z,sequence:Q,chainId:J,fee:_,memo:E}=typeof L==="string"?JSON.parse(L):L,A=(await X.getAccounts())?.[0]?.address||"",k=await w(Y),I=await c(),x=await B6(X,{aminoTypes:k,registry:I}),N=[];for(let V of Z){let M=await $(V,Y);N.push(M)}let{signatures:[v]}=await x.sign(A,N,_,E,{accountNumber:z,chainId:J,sequence:Q});return{bodyBytes:await L6({chain:Y,memo:E,msgs:Z.map(u)}),signature:E4(v)}}}function O4({prefix:Y,rpcUrl:H}){return async function(L,Z,z,Q,J){let{encodeSecp256k1Pubkey:_,pubkeyToAddress:E}=(await import("@cosmjs/amino")).default,{makeMultisignedTxBytes:A}=(await import("@cosmjs/stargate")).default,{sequence:k,fee:I}=JSON.parse(L),x=await o6(z,Q),N=Z.map((V)=>[E(_(l.base64.decode(V.pubKey)),Y),l.base64.decode(V.signature)]),v=await P(H),{transactionHash:U}=await v.broadcastTx(A(x,k,I,J,new Map(N)));return U}}async function o6(Y,H,X=!0){let{createMultisigThresholdPubkey:L,encodeSecp256k1Pubkey:Z}=(await import("@cosmjs/amino")).default;return L(Y.map((z)=>Z(l.base64.decode(z))),H,X)}function x4(Y){return l.base64.decode(Y)}async function U4({privateKey:Y,message:H}){let{Secp256k1:X}=(await import("@cosmjs/crypto")).default,L=await X.createSignature(l.base64.decode(H),Y);return l.base64.encode(Buffer.concat([L.r(32),L.s(32)]))}async function k6({chain:Y,...H}){let X=await O.getRPCUrl(Y),{nodeUrl:L}=O.getChainConfig(Y),{isStagenet:Z}=O.SKConfig.get("envs"),z=Y===O.Chain.THORChain,Q=`${Z?"s":""}${O.CosmosChainPrefixes[Y]}`,J="index"in H?H.index||0:0,_="derivationPath"in H&&H.derivationPath?H.derivationPath:O.updateDerivationPath(O.NetworkDerivationPath[Y],{index:J}),E=await Z6({chain:Y,...H}),A=await H6.match(H).with({phrase:H6.P.string},({phrase:N})=>E.getSignerFromPhrase({derivationPath:_,phrase:N})).with({signer:H6.P.any},({signer:N})=>N).otherwise(()=>{return}),k=S(Y);async function I(){let N,v=`${L}/${z?"thorchain":"mayachain"}/constants`;try{let{int_64_values:{NativeTransactionFee:U}}=await O.RequestClient.get(v);if(!U||Number.isNaN(U)||U<0)throw new O.SwapKitError("toolbox_cosmos_invalid_fee",{nativeFee:U.toString()});N=new O.SwapKitNumber(U)}catch{N=new O.SwapKitNumber({decimal:O.getChainConfig(Y).baseDecimal,value:z?0.02:1})}return{[O.FeeOption.Average]:N,[O.FeeOption.Fast]:N,[O.FeeOption.Fastest]:N}}async function x({assetValue:N,memo:v="",recipient:U}){let{TxRaw:V}=await import("cosmjs-types/cosmos/tx/v1beta1/tx"),M=(await A?.getAccounts())?.[0]?.address;if(!(M&&A))throw new O.SwapKitError("toolbox_cosmos_no_signer");let m="signAmino"in A,g=await c(),i=await w(Y),b=await n(X,A,{aminoTypes:i,registry:g}),p=X6({assetValue:N,memo:v,recipient:U,sender:M});if(m){let J6=await $(p,Y),{signatures:r6,authInfoBytes:a6}=await b.sign(M,[J6],k,v),s6=V.encode({authInfoBytes:a6,bodyBytes:await L6({chain:Y,memo:v,msgs:[p].map(u)}),signatures:r6}).finish();return(await b.broadcastTx(s6)).transactionHash}let o=u(p),t=await $(o,Y);return(await b.signAndBroadcast(M,[t],k,v)).transactionHash}return{...E,broadcastMultisigTx:O4({prefix:Q,rpcUrl:X}),buildAminoMsg:X6,buildEncodedTxBody:L6,convertToSignable:$,createDefaultAminoTypes:()=>w(Y),createDefaultRegistry:c,createMultisig:o6,createTransaction:N6(X),deposit:x,getFees:I,importSignature:x4,parseAminoMessageForDirectSigning:u,pubkeyToAddress:async(N)=>{let{pubkeyToAddress:v}=(await import("@cosmjs/amino")).default;return v(N,Q)},secp256k1HdWalletFromMnemonic:I4({derivationPath:O.derivationPathToString(_),prefix:Q}),signMultisigTx:N4(Y),signWithPrivateKey:U4,transfer:x}}var l,O,H6;var R6=F(()=>{O6();e();Y6();l=require("@scure/base"),O=require("@swapkit/helpers"),H6=require("ts-pattern")});var j,v4=(Y,H)=>{switch(Y){case j.Chain.Cosmos:case j.Chain.Kujira:case j.Chain.Noble:return Z6({chain:Y,...H});case j.Chain.Maya:case j.Chain.THORChain:return k6({chain:Y,...H});default:throw new j.SwapKitError("toolbox_cosmos_not_supported",{chain:Y})}};var t6=F(()=>{Y6();R6();j=require("@swapkit/helpers");Y6();R6()});var A4={};y6(A4,{verifySignature:()=>g6,transferMsgAmino:()=>I6,toBase64:()=>H4,parseAminoMessageForDirectSigning:()=>u,getSignerFromPrivateKey:()=>W4,getSignerFromPhrase:()=>v6,getMsgSendDenom:()=>D,getFeeRateFromSwapKit:()=>B4,getDenomWithChain:()=>d,getDefaultChainFee:()=>S,getCreateTransaction:()=>N6,getCosmosValidateAddress:()=>i6,getCosmosToolbox:()=>v4,getAssetFromDenom:()=>T6,fromBase64:()=>Q4,fetchFeeRateFromSwapKit:()=>A6,estimateTransactionFee:()=>G4,depositMsgAmino:()=>E6,createThorchainToolbox:()=>k6,createStargateClient:()=>P,createSigningStargateClient:()=>n,createOfflineStargateClient:()=>B6,createDefaultRegistry:()=>c,createDefaultAminoTypes:()=>w,createCosmosToolbox:()=>Z6,cosmosCreateTransaction:()=>G6,convertToSignable:()=>$,buildTransferTx:()=>j6,buildEncodedTxBody:()=>L6,buildDepositTx:()=>b6,buildAminoMsg:()=>X6,bech32ToBase64:()=>a,base64ToBech32:()=>s,YUM_KUJIRA_FACTORY_DENOM:()=>S6,USK_KUJIRA_FACTORY_DENOM:()=>W6,THORCHAIN_GAS_VALUE:()=>J4,MAYA_GAS_VALUE:()=>q4,DEFAULT_NOBLE_FEE_MAINNET:()=>w6,DEFAULT_KUJI_FEE_MAINNET:()=>C6,DEFAULT_COSMOS_FEE_MAINNET:()=>P6});module.exports=Z4(A4);var k4=F(()=>{O6();t6();e()});k4();
2
-
3
- //# debugId=BA6951F2C300CEC964756E2164756E21
4
- //# sourceMappingURL=index.cjs.map
1
+ var f0=Object.create;var{getPrototypeOf:T0,defineProperty:i,getOwnPropertyNames:Ef,getOwnPropertyDescriptor:x0}=Object,Ff=Object.prototype.hasOwnProperty;function Af(H){return this[H]}var B0,v0,_0=(H,B,_)=>{var f=H!=null&&typeof H==="object";if(f){var x=B?B0??=new WeakMap:v0??=new WeakMap,T=x.get(H);if(T)return T}_=H!=null?f0(T0(H)):{};let v=B||!H||!H.__esModule?i(_,"default",{value:H,enumerable:!0}):_;for(let L of Ef(H))if(!Ff.call(v,L))i(v,L,{get:Af.bind(H,L),enumerable:!0});if(f)x.set(H,v);return v},H0=(H)=>{var B=(Of??=new WeakMap).get(H),_;if(B)return B;if(B=i({},"__esModule",{value:!0}),H&&typeof H==="object"||typeof H==="function"){for(var f of Ef(H))if(!Ff.call(B,f))i(B,f,{get:Af.bind(H,f),enumerable:!(_=x0(H,f))||_.enumerable})}return Of.set(H,B),B},Of;var L0=(H)=>H;function y0(H,B){this[H]=L0.bind(null,B)}var Uf=(H,B)=>{for(var _ in B)i(H,_,{get:B[_],enumerable:!0,configurable:!0,set:y0.bind(B,_)})};var k=(H,B)=>()=>(H&&(B=H(H=0)),B);function o(H){return R.base64.encode(Uint8Array.from(R.bech32.fromWords(R.bech32.decode(H).words)))}function t(H,B="thor"){return R.bech32.encode(B,R.bech32.toWords(R.base64.decode(H)))}function W0(H){return R.base64.encode(H)}function z0(H){if(!H.match(/^[a-zA-Z0-9+/]*={0,2}$/))throw new kf.SwapKitError("toolbox_cosmos_invalid_params",{error:"Invalid base64 string format"});return R.base64.decode(H)}var R,kf;var Hf=k(()=>{R=require("@scure/base"),kf=require("@swapkit/helpers")});function V(H){switch(H){case G.Chain.Maya:return{amount:[],gas:"10000000000"};case G.Chain.THORChain:return{amount:[],gas:"500000000"};case G.Chain.Kujira:return Vf;case G.Chain.Noble:return Df;default:return Rf}}async function D(H){let B=await import("@cosmjs/stargate"),_=B.StargateClient??B.default?.StargateClient,f=typeof window<"u"?{}:{referer:"https://sdk.swapkit.dev",referrer:"https://sdk.swapkit.dev"};return _.connect({headers:f,url:H})}async function c(H,B,_={}){let f=await import("@cosmjs/stargate"),x=f.SigningStargateClient??f.default?.SigningStargateClient,T=f.GasPrice??f.default?.GasPrice,v=typeof _==="string"?_:"0.0003uatom",L=typeof _==="string"?{}:_;return x.connectWithSigner(H,B,{gasPrice:T.fromString(v),...L})}async function yf(H,B){let _=await import("@cosmjs/stargate");return(_.SigningStargateClient??_.default?.SigningStargateClient).offline(H,B)}async function Wf({sender:H,recipient:B,assetValue:_,memo:f="",feeRate:x,sequence:T,accountNumber:v}){let{chain:L,chainId:X}=_,Y=await G.getRPCUrl(L),N=await(await D(Y)).getAccount(H);if(!N)throw new G.SwapKitError("toolbox_cosmos_account_not_found",{sender:H});let J=G.AssetValue.from({chain:L}),Q=P(J.symbol),I=V(L),K=Q&&x?{amount:[{amount:x.toString(),denom:Q}],gas:I.gas}:I,O={amount:[{amount:_.getBaseValue("string"),denom:P(_.symbol)}],fromAddress:H,toAddress:B};return{accountNumber:v??N.accountNumber,chainId:X,fee:K,memo:f,msgs:[{typeUrl:G0(L),value:O}],sequence:T??N.sequence}}var G,Lf="FACTORY/KUJIRA1QK00H5ATUTPSV900X202PXX42NPJR9THG58DNQPA72F2P7M2LUASE444A7/UUSK",Cf="FACTORY/KUJIRA1YGFXN0ER40KLCNCK8THLTUPRDXLCK6WVNPKF2K/UYUM",Rf,Vf,Df,P=(H,B=!1)=>{if(B)return H.toLowerCase();switch(H){case"uUSK":case"USK":return Lf;case"uYUM":case"YUM":return Cf;case"uKUJI":case"KUJI":return"ukuji";case"ATOM":case"uATOM":return"uatom";case"uUSDC":case"USDC":return"uusdc";default:return H}},m=({symbol:H,chain:B})=>{if(B===G.Chain.Maya)return(H.toUpperCase()!=="CACAO"?H:`${G.Chain.Maya}.${H}`).toUpperCase();if(B===G.Chain.THORChain)return(["RUNE","TCY","RUJI"].includes(H.toUpperCase())?`${G.Chain.THORChain}.${H}`:H).toUpperCase();return P(H,!1)},G0=(H)=>{switch(H){case G.Chain.Maya:case G.Chain.THORChain:return"/types.MsgSend";case G.Chain.Cosmos:case G.Chain.Kujira:case G.Chain.Noble:return"/cosmos.bank.v1beta1.MsgSend";default:throw new G.SwapKitError("toolbox_cosmos_not_supported",{chain:H})}},Z0,zf=(H,B)=>{let _=Z0[H.toLowerCase()];if(!_)return G.AssetValue.from({asset:H,fromBaseDecimal:8,value:B});let{chain:f,asset:x,decimals:T}=_,v=f?{chain:f}:{asset:x};return G.AssetValue.from({...v,fromBaseDecimal:T,value:B})};var g=k(()=>{G=require("@swapkit/helpers"),Rf={amount:[{amount:"500",denom:"uatom"}],gas:"200000"},Vf={amount:[{amount:"1000",denom:"ukuji"}],gas:"200000"},Df={amount:[{amount:"1000",denom:"uusdc"}],gas:"200000"};Z0={atom:{chain:G.Chain.Cosmos,decimals:G.getChainConfig(G.Chain.Cosmos).baseDecimal},cacao:{chain:G.Chain.Maya,decimals:10},kuji:{chain:G.Chain.Kujira,decimals:G.getChainConfig(G.Chain.Kujira).baseDecimal},maya:{asset:`${G.Chain.Maya}.${G.Chain.Maya}`,decimals:4},rune:{chain:G.Chain.THORChain,decimals:G.getChainConfig(G.Chain.THORChain).baseDecimal},tcy:{asset:"THOR.TCY",decimals:G.getChainConfig(G.Chain.THORChain).baseDecimal},uatom:{chain:G.Chain.Cosmos,decimals:G.getChainConfig(G.Chain.Cosmos).baseDecimal},ukuji:{chain:G.Chain.Kujira,decimals:G.getChainConfig(G.Chain.Kujira).baseDecimal},usdc:{chain:G.Chain.Noble,decimals:G.getChainConfig(G.Chain.Noble).baseDecimal},uusdc:{chain:G.Chain.Noble,decimals:G.getChainConfig(G.Chain.Noble).baseDecimal},"x/kuji":{asset:"THOR.KUJI",decimals:G.getChainConfig(G.Chain.THORChain).baseDecimal},[Lf.toLowerCase()]:{asset:`${G.Chain.Kujira}.USK`,decimals:G.getChainConfig(G.Chain.Kujira).baseDecimal}}});var Pf={};Uf(Pf,{$root:()=>y});var F,Z,C,z,y;var uf=k(()=>{F=_0(require("protobufjs/minimal.js")),Z=F.default.Reader,C=F.default.Writer,z=F.default.util,y=F.default.roots.default||(F.default.roots.default={});y.common=(()=>{let H={};return H.Asset=(()=>{function B(_){if(_){for(let f=Object.keys(_),x=0;x<f.length;++x)if(_[f[x]]!=null)this[f[x]]=_[f[x]]}}return B.prototype.chain="",B.prototype.symbol="",B.prototype.ticker="",B.prototype.synth=!1,B.create=function(f){return new B(f)},B.encode=function(f,x){if(!x)x=C.create();if(f.chain!=null&&Object.hasOwnProperty.call(f,"chain"))x.uint32(10).string(f.chain);if(f.symbol!=null&&Object.hasOwnProperty.call(f,"symbol"))x.uint32(18).string(f.symbol);if(f.ticker!=null&&Object.hasOwnProperty.call(f,"ticker"))x.uint32(26).string(f.ticker);if(f.synth!=null&&Object.hasOwnProperty.call(f,"synth"))x.uint32(32).bool(f.synth);return x},B.encodeDelimited=function(f,x){return this.encode(f,x).ldelim()},B.decode=function(f,x){if(!(f instanceof Z))f=Z.create(f);let T=x===void 0?f.len:f.pos+x,v=new y.common.Asset;while(f.pos<T){let L=f.uint32();switch(L>>>3){case 1:v.chain=f.string();break;case 2:v.symbol=f.string();break;case 3:v.ticker=f.string();break;case 4:v.synth=f.bool();break;default:f.skipType(L&7);break}}return v},B.decodeDelimited=function(f){if(!(f instanceof Z))f=new Z(f);return this.decode(f,f.uint32())},B.verify=function(f){if(typeof f!=="object"||f===null)return"object expected";if(f.chain!=null&&f.hasOwnProperty("chain")){if(!z.isString(f.chain))return"chain: string expected"}if(f.symbol!=null&&f.hasOwnProperty("symbol")){if(!z.isString(f.symbol))return"symbol: string expected"}if(f.ticker!=null&&f.hasOwnProperty("ticker")){if(!z.isString(f.ticker))return"ticker: string expected"}if(f.synth!=null&&f.hasOwnProperty("synth")){if(typeof f.synth!=="boolean")return"synth: boolean expected"}return null},B.fromObject=function(f){if(f instanceof y.common.Asset)return f;let x=new y.common.Asset;if(f.chain!=null)x.chain=String(f.chain);if(f.symbol!=null)x.symbol=String(f.symbol);if(f.ticker!=null)x.ticker=String(f.ticker);if(f.synth!=null)x.synth=Boolean(f.synth);return x},B.toObject=function(f,x){if(!x)x={};let T={};if(x.defaults)T.chain="",T.symbol="",T.ticker="",T.synth=!1;if(f.chain!=null&&f.hasOwnProperty("chain"))T.chain=f.chain;if(f.symbol!=null&&f.hasOwnProperty("symbol"))T.symbol=f.symbol;if(f.ticker!=null&&f.hasOwnProperty("ticker"))T.ticker=f.ticker;if(f.synth!=null&&f.hasOwnProperty("synth"))T.synth=f.synth;return T},B.prototype.toJSON=function(){return this.constructor.toObject(this,F.default.util.toJSONOptions)},B})(),H.Coin=(()=>{function B(_){if(_){for(let f=Object.keys(_),x=0;x<f.length;++x)if(_[f[x]]!=null)this[f[x]]=_[f[x]]}}return B.prototype.asset=null,B.prototype.amount="",B.prototype.decimals=z.Long?z.Long.fromBits(0,0,!1):0,B.create=function(f){return new B(f)},B.encode=function(f,x){if(!x)x=C.create();if(f.asset!=null&&Object.hasOwnProperty.call(f,"asset"))y.common.Asset.encode(f.asset,x.uint32(10).fork()).ldelim();if(f.amount!=null&&Object.hasOwnProperty.call(f,"amount"))x.uint32(18).string(f.amount);if(f.decimals!=null&&Object.hasOwnProperty.call(f,"decimals"))x.uint32(24).int64(f.decimals);return x},B.encodeDelimited=function(f,x){return this.encode(f,x).ldelim()},B.decode=function(f,x){if(!(f instanceof Z))f=Z.create(f);let T=x===void 0?f.len:f.pos+x,v=new y.common.Coin;while(f.pos<T){let L=f.uint32();switch(L>>>3){case 1:v.asset=y.common.Asset.decode(f,f.uint32());break;case 2:v.amount=f.string();break;case 3:v.decimals=f.int64();break;default:f.skipType(L&7);break}}return v},B.decodeDelimited=function(f){if(!(f instanceof Z))f=new Z(f);return this.decode(f,f.uint32())},B.verify=function(f){if(typeof f!=="object"||f===null)return"object expected";if(f.asset!=null&&f.hasOwnProperty("asset")){let x=y.common.Asset.verify(f.asset);if(x)return"asset."+x}if(f.amount!=null&&f.hasOwnProperty("amount")){if(!z.isString(f.amount))return"amount: string expected"}if(f.decimals!=null&&f.hasOwnProperty("decimals")){if(!z.isInteger(f.decimals)&&!(f.decimals&&z.isInteger(f.decimals.low)&&z.isInteger(f.decimals.high)))return"decimals: integer|Long expected"}return null},B.fromObject=function(f){if(f instanceof y.common.Coin)return f;let x=new y.common.Coin;if(f.asset!=null){if(typeof f.asset!=="object")throw TypeError(".common.Coin.asset: object expected");x.asset=y.common.Asset.fromObject(f.asset)}if(f.amount!=null)x.amount=String(f.amount);if(f.decimals!=null){if(z.Long)(x.decimals=z.Long.fromValue(f.decimals)).unsigned=!1;else if(typeof f.decimals==="string")x.decimals=Number.parseInt(f.decimals,10);else if(typeof f.decimals==="number")x.decimals=f.decimals;else if(typeof f.decimals==="object")x.decimals=new z.LongBits(f.decimals.low>>>0,f.decimals.high>>>0).toNumber()}return x},B.toObject=function(f,x){if(!x)x={};let T={};if(x.defaults)if(T.asset=null,T.amount="",z.Long){let v=new z.Long(0,0,!1);T.decimals=x.longs===String?v.toString():x.longs===Number?v.toNumber():v}else T.decimals=x.longs===String?"0":0;if(f.asset!=null&&f.hasOwnProperty("asset"))T.asset=y.common.Asset.toObject(f.asset,x);if(f.amount!=null&&f.hasOwnProperty("amount"))T.amount=f.amount;if(f.decimals!=null&&f.hasOwnProperty("decimals"))if(typeof f.decimals==="number")T.decimals=x.longs===String?String(f.decimals):f.decimals;else T.decimals=x.longs===String?z.Long.prototype.toString.call(f.decimals):x.longs===Number?new z.LongBits(f.decimals.low>>>0,f.decimals.high>>>0).toNumber():f.decimals;return T},B.prototype.toJSON=function(){return this.constructor.toObject(this,F.default.util.toJSONOptions)},B})(),H.PubKeySet=(()=>{function B(_){if(_){for(let f=Object.keys(_),x=0;x<f.length;++x)if(_[f[x]]!=null)this[f[x]]=_[f[x]]}}return B.prototype.secp256k1="",B.prototype.ed25519="",B.create=function(f){return new B(f)},B.encode=function(f,x){if(!x)x=C.create();if(f.secp256k1!=null&&Object.hasOwnProperty.call(f,"secp256k1"))x.uint32(10).string(f.secp256k1);if(f.ed25519!=null&&Object.hasOwnProperty.call(f,"ed25519"))x.uint32(18).string(f.ed25519);return x},B.encodeDelimited=function(f,x){return this.encode(f,x).ldelim()},B.decode=function(f,x){if(!(f instanceof Z))f=Z.create(f);let T=x===void 0?f.len:f.pos+x,v=new y.common.PubKeySet;while(f.pos<T){let L=f.uint32();switch(L>>>3){case 1:v.secp256k1=f.string();break;case 2:v.ed25519=f.string();break;default:f.skipType(L&7);break}}return v},B.decodeDelimited=function(f){if(!(f instanceof Z))f=new Z(f);return this.decode(f,f.uint32())},B.verify=function(f){if(typeof f!=="object"||f===null)return"object expected";if(f.secp256k1!=null&&f.hasOwnProperty("secp256k1")){if(!z.isString(f.secp256k1))return"secp256k1: string expected"}if(f.ed25519!=null&&f.hasOwnProperty("ed25519")){if(!z.isString(f.ed25519))return"ed25519: string expected"}return null},B.fromObject=function(f){if(f instanceof y.common.PubKeySet)return f;let x=new y.common.PubKeySet;if(f.secp256k1!=null)x.secp256k1=String(f.secp256k1);if(f.ed25519!=null)x.ed25519=String(f.ed25519);return x},B.toObject=function(f,x){if(!x)x={};let T={};if(x.defaults)T.secp256k1="",T.ed25519="";if(f.secp256k1!=null&&f.hasOwnProperty("secp256k1"))T.secp256k1=f.secp256k1;if(f.ed25519!=null&&f.hasOwnProperty("ed25519"))T.ed25519=f.ed25519;return T},B.prototype.toJSON=function(){return this.constructor.toObject(this,F.default.util.toJSONOptions)},B})(),H.Tx=(()=>{function B(_){if(this.coins=[],this.gas=[],_){for(let f=Object.keys(_),x=0;x<f.length;++x)if(_[f[x]]!=null)this[f[x]]=_[f[x]]}}return B.prototype.id="",B.prototype.chain="",B.prototype.fromAddress="",B.prototype.toAddress="",B.prototype.coins=z.emptyArray,B.prototype.gas=z.emptyArray,B.prototype.memo="",B.create=function(f){return new B(f)},B.encode=function(f,x){if(!x)x=C.create();if(f.id!=null&&Object.hasOwnProperty.call(f,"id"))x.uint32(10).string(f.id);if(f.chain!=null&&Object.hasOwnProperty.call(f,"chain"))x.uint32(18).string(f.chain);if(f.fromAddress!=null&&Object.hasOwnProperty.call(f,"fromAddress"))x.uint32(26).string(f.fromAddress);if(f.toAddress!=null&&Object.hasOwnProperty.call(f,"toAddress"))x.uint32(34).string(f.toAddress);if(f.coins?.length)for(let T=0;T<f.coins.length;++T)y.common.Coin.encode(f.coins[T],x.uint32(42).fork()).ldelim();if(f.gas?.length)for(let T=0;T<f.gas.length;++T)y.common.Coin.encode(f.gas[T],x.uint32(50).fork()).ldelim();if(f.memo!=null&&Object.hasOwnProperty.call(f,"memo"))x.uint32(58).string(f.memo);return x},B.encodeDelimited=function(f,x){return this.encode(f,x).ldelim()},B.decode=function(f,x){if(!(f instanceof Z))f=Z.create(f);let T=x===void 0?f.len:f.pos+x,v=new y.common.Tx;while(f.pos<T){let L=f.uint32();switch(L>>>3){case 1:v.id=f.string();break;case 2:v.chain=f.string();break;case 3:v.fromAddress=f.string();break;case 4:v.toAddress=f.string();break;case 5:if(!v.coins?.length)v.coins=[];v.coins.push(y.common.Coin.decode(f,f.uint32()));break;case 6:if(!v.gas?.length)v.gas=[];v.gas.push(y.common.Coin.decode(f,f.uint32()));break;case 7:v.memo=f.string();break;default:f.skipType(L&7);break}}return v},B.decodeDelimited=function(f){if(!(f instanceof Z))f=new Z(f);return this.decode(f,f.uint32())},B.verify=function(f){if(typeof f!=="object"||f===null)return"object expected";if(f.id!=null&&f.hasOwnProperty("id")){if(!z.isString(f.id))return"id: string expected"}if(f.chain!=null&&f.hasOwnProperty("chain")){if(!z.isString(f.chain))return"chain: string expected"}if(f.fromAddress!=null&&f.hasOwnProperty("fromAddress")){if(!z.isString(f.fromAddress))return"fromAddress: string expected"}if(f.toAddress!=null&&f.hasOwnProperty("toAddress")){if(!z.isString(f.toAddress))return"toAddress: string expected"}if(f.coins!=null&&f.hasOwnProperty("coins")){if(!Array.isArray(f.coins))return"coins: array expected";for(let x=0;x<f.coins.length;++x){let T=y.common.Coin.verify(f.coins[x]);if(T)return"coins."+T}}if(f.gas!=null&&f.hasOwnProperty("gas")){if(!Array.isArray(f.gas))return"gas: array expected";for(let x=0;x<f.gas.length;++x){let T=y.common.Coin.verify(f.gas[x]);if(T)return"gas."+T}}if(f.memo!=null&&f.hasOwnProperty("memo")){if(!z.isString(f.memo))return"memo: string expected"}return null},B.fromObject=function(f){if(f instanceof y.common.Tx)return f;let x=new y.common.Tx;if(f.id!=null)x.id=String(f.id);if(f.chain!=null)x.chain=String(f.chain);if(f.fromAddress!=null)x.fromAddress=String(f.fromAddress);if(f.toAddress!=null)x.toAddress=String(f.toAddress);if(f.coins){if(!Array.isArray(f.coins))throw TypeError(".common.Tx.coins: array expected");x.coins=[];for(let T=0;T<f.coins.length;++T){if(typeof f.coins[T]!=="object")throw TypeError(".common.Tx.coins: object expected");x.coins[T]=y.common.Coin.fromObject(f.coins[T])}}if(f.gas){if(!Array.isArray(f.gas))throw TypeError(".common.Tx.gas: array expected");x.gas=[];for(let T=0;T<f.gas.length;++T){if(typeof f.gas[T]!=="object")throw TypeError(".common.Tx.gas: object expected");x.gas[T]=y.common.Coin.fromObject(f.gas[T])}}if(f.memo!=null)x.memo=String(f.memo);return x},B.toObject=function(f,x){if(!x)x={};let T={};if(x.arrays||x.defaults)T.coins=[],T.gas=[];if(x.defaults)T.id="",T.chain="",T.fromAddress="",T.toAddress="",T.memo="";if(f.id!=null&&f.hasOwnProperty("id"))T.id=f.id;if(f.chain!=null&&f.hasOwnProperty("chain"))T.chain=f.chain;if(f.fromAddress!=null&&f.hasOwnProperty("fromAddress"))T.fromAddress=f.fromAddress;if(f.toAddress!=null&&f.hasOwnProperty("toAddress"))T.toAddress=f.toAddress;if(f.coins?.length){T.coins=[];for(let v=0;v<f.coins.length;++v)T.coins[v]=y.common.Coin.toObject(f.coins[v],x)}if(f.gas?.length){T.gas=[];for(let v=0;v<f.gas.length;++v)T.gas[v]=y.common.Coin.toObject(f.gas[v],x)}if(f.memo!=null&&f.hasOwnProperty("memo"))T.memo=f.memo;return T},B.prototype.toJSON=function(){return this.constructor.toObject(this,F.default.util.toJSONOptions)},B})(),H.Fee=(()=>{function B(_){if(this.coins=[],_){for(let f=Object.keys(_),x=0;x<f.length;++x)if(_[f[x]]!=null)this[f[x]]=_[f[x]]}}return B.prototype.coins=z.emptyArray,B.prototype.poolDeduct="",B.create=function(f){return new B(f)},B.encode=function(f,x){if(!x)x=C.create();if(f.coins?.length)for(let T=0;T<f.coins.length;++T)y.common.Coin.encode(f.coins[T],x.uint32(10).fork()).ldelim();if(f.poolDeduct!=null&&Object.hasOwnProperty.call(f,"poolDeduct"))x.uint32(18).string(f.poolDeduct);return x},B.encodeDelimited=function(f,x){return this.encode(f,x).ldelim()},B.decode=function(f,x){if(!(f instanceof Z))f=Z.create(f);let T=x===void 0?f.len:f.pos+x,v=new y.common.Fee;while(f.pos<T){let L=f.uint32();switch(L>>>3){case 1:if(!v.coins?.length)v.coins=[];v.coins.push(y.common.Coin.decode(f,f.uint32()));break;case 2:v.poolDeduct=f.string();break;default:f.skipType(L&7);break}}return v},B.decodeDelimited=function(f){if(!(f instanceof Z))f=new Z(f);return this.decode(f,f.uint32())},B.verify=function(f){if(typeof f!=="object"||f===null)return"object expected";if(f.coins!=null&&f.hasOwnProperty("coins")){if(!Array.isArray(f.coins))return"coins: array expected";for(let x=0;x<f.coins.length;++x){let T=y.common.Coin.verify(f.coins[x]);if(T)return"coins."+T}}if(f.poolDeduct!=null&&f.hasOwnProperty("poolDeduct")){if(!z.isString(f.poolDeduct))return"poolDeduct: string expected"}return null},B.fromObject=function(f){if(f instanceof y.common.Fee)return f;let x=new y.common.Fee;if(f.coins){if(!Array.isArray(f.coins))throw TypeError(".common.Fee.coins: array expected");x.coins=[];for(let T=0;T<f.coins.length;++T){if(typeof f.coins[T]!=="object")throw TypeError(".common.Fee.coins: object expected");x.coins[T]=y.common.Coin.fromObject(f.coins[T])}}if(f.poolDeduct!=null)x.poolDeduct=String(f.poolDeduct);return x},B.toObject=function(f,x){if(!x)x={};let T={};if(x.arrays||x.defaults)T.coins=[];if(x.defaults)T.poolDeduct="";if(f.coins?.length){T.coins=[];for(let v=0;v<f.coins.length;++v)T.coins[v]=y.common.Coin.toObject(f.coins[v],x)}if(f.poolDeduct!=null&&f.hasOwnProperty("poolDeduct"))T.poolDeduct=f.poolDeduct;return T},B.prototype.toJSON=function(){return this.constructor.toObject(this,F.default.util.toJSONOptions)},B})(),H.ProtoUint=(()=>{function B(_){if(_){for(let f=Object.keys(_),x=0;x<f.length;++x)if(_[f[x]]!=null)this[f[x]]=_[f[x]]}}return B.prototype.value="",B.create=function(f){return new B(f)},B.encode=function(f,x){if(!x)x=C.create();if(f.value!=null&&Object.hasOwnProperty.call(f,"value"))x.uint32(10).string(f.value);return x},B.encodeDelimited=function(f,x){return this.encode(f,x).ldelim()},B.decode=function(f,x){if(!(f instanceof Z))f=Z.create(f);let T=x===void 0?f.len:f.pos+x,v=new y.common.ProtoUint;while(f.pos<T){let L=f.uint32();switch(L>>>3){case 1:v.value=f.string();break;default:f.skipType(L&7);break}}return v},B.decodeDelimited=function(f){if(!(f instanceof Z))f=new Z(f);return this.decode(f,f.uint32())},B.verify=function(f){if(typeof f!=="object"||f===null)return"object expected";if(f.value!=null&&f.hasOwnProperty("value")){if(!z.isString(f.value))return"value: string expected"}return null},B.fromObject=function(f){if(f instanceof y.common.ProtoUint)return f;let x=new y.common.ProtoUint;if(f.value!=null)x.value=String(f.value);return x},B.toObject=function(f,x){if(!x)x={};let T={};if(x.defaults)T.value="";if(f.value!=null&&f.hasOwnProperty("value"))T.value=f.value;return T},B.prototype.toJSON=function(){return this.constructor.toObject(this,F.default.util.toJSONOptions)},B})(),H})();y.types=(()=>{let H={};return H.MsgDeposit=(()=>{function B(_){if(this.coins=[],_){for(let f=Object.keys(_),x=0;x<f.length;++x)if(_[f[x]]!=null)this[f[x]]=_[f[x]]}}return B.prototype.coins=z.emptyArray,B.prototype.memo="",B.prototype.signer=z.newBuffer([]),B.create=function(f){return new B(f)},B.encode=function(f,x){if(!x)x=C.create();if(f.coins?.length)for(let T=0;T<f.coins.length;++T)y.common.Coin.encode(f.coins[T],x.uint32(10).fork()).ldelim();if(f.memo!=null&&Object.hasOwnProperty.call(f,"memo"))x.uint32(18).string(f.memo);if(f.signer!=null&&Object.hasOwnProperty.call(f,"signer"))x.uint32(26).bytes(f.signer);return x},B.encodeDelimited=function(f,x){return this.encode(f,x).ldelim()},B.decode=function(f,x){if(!(f instanceof Z))f=Z.create(f);let T=x===void 0?f.len:f.pos+x,v=new y.types.MsgDeposit;while(f.pos<T){let L=f.uint32();switch(L>>>3){case 1:if(!v.coins?.length)v.coins=[];v.coins.push(y.common.Coin.decode(f,f.uint32()));break;case 2:v.memo=f.string();break;case 3:v.signer=f.bytes();break;default:f.skipType(L&7);break}}return v},B.decodeDelimited=function(f){if(!(f instanceof Z))f=new Z(f);return this.decode(f,f.uint32())},B.verify=function(f){if(typeof f!=="object"||f===null)return"object expected";if(f.coins!=null&&f.hasOwnProperty("coins")){if(!Array.isArray(f.coins))return"coins: array expected";for(let x=0;x<f.coins.length;++x){let T=y.common.Coin.verify(f.coins[x]);if(T)return"coins."+T}}if(f.memo!=null&&f.hasOwnProperty("memo")){if(!z.isString(f.memo))return"memo: string expected"}if(f.signer!=null&&f.hasOwnProperty("signer")){if(!(f.signer&&typeof f.signer.length==="number"||z.isString(f.signer)))return"signer: buffer expected"}return null},B.fromObject=function(f){if(f instanceof y.types.MsgDeposit)return f;let x=new y.types.MsgDeposit;if(f.coins){if(!Array.isArray(f.coins))throw TypeError(".types.MsgDeposit.coins: array expected");x.coins=[];for(let T=0;T<f.coins.length;++T){if(typeof f.coins[T]!=="object")throw TypeError(".types.MsgDeposit.coins: object expected");x.coins[T]=y.common.Coin.fromObject(f.coins[T])}}if(f.memo!=null)x.memo=String(f.memo);if(f.signer!=null){if(typeof f.signer==="string")z.base64.decode(f.signer,x.signer=z.newBuffer(z.base64.length(f.signer)),0);else if(f.signer.length)x.signer=f.signer}return x},B.toObject=function(f,x){if(!x)x={};let T={};if(x.arrays||x.defaults)T.coins=[];if(x.defaults){if(T.memo="",x.bytes===String)T.signer="";else if(T.signer=[],x.bytes!==Array)T.signer=z.newBuffer(T.signer)}if(f.coins?.length){T.coins=[];for(let v=0;v<f.coins.length;++v)T.coins[v]=y.common.Coin.toObject(f.coins[v],x)}if(f.memo!=null&&f.hasOwnProperty("memo"))T.memo=f.memo;if(f.signer!=null&&f.hasOwnProperty("signer"))T.signer=x.bytes===String?z.base64.encode(f.signer,0,f.signer.length):x.bytes===Array?Array.prototype.slice.call(f.signer):f.signer;return T},B.prototype.toJSON=function(){return this.constructor.toObject(this,F.default.util.toJSONOptions)},B})(),H.MsgSend=(()=>{function B(_){if(this.amount=[],_){for(let f=Object.keys(_),x=0;x<f.length;++x)if(_[f[x]]!=null)this[f[x]]=_[f[x]]}}return B.prototype.fromAddress=z.newBuffer([]),B.prototype.toAddress=z.newBuffer([]),B.prototype.amount=z.emptyArray,B.create=function(f){return new B(f)},B.encode=function(f,x){if(!x)x=C.create();if(f.fromAddress!=null&&Object.hasOwnProperty.call(f,"fromAddress"))x.uint32(10).bytes(f.fromAddress);if(f.toAddress!=null&&Object.hasOwnProperty.call(f,"toAddress"))x.uint32(18).bytes(f.toAddress);if(f.amount?.length)for(let T=0;T<f.amount.length;++T)y.cosmos.base.v1beta1.Coin.encode(f.amount[T],x.uint32(26).fork()).ldelim();return x},B.encodeDelimited=function(f,x){return this.encode(f,x).ldelim()},B.decode=function(f,x){if(!(f instanceof Z))f=Z.create(f);let T=x===void 0?f.len:f.pos+x,v=new y.types.MsgSend;while(f.pos<T){let L=f.uint32();switch(L>>>3){case 1:v.fromAddress=f.bytes();break;case 2:v.toAddress=f.bytes();break;case 3:if(!v.amount?.length)v.amount=[];v.amount.push(y.cosmos.base.v1beta1.Coin.decode(f,f.uint32()));break;default:f.skipType(L&7);break}}return v},B.decodeDelimited=function(f){if(!(f instanceof Z))f=new Z(f);return this.decode(f,f.uint32())},B.verify=function(f){if(typeof f!=="object"||f===null)return"object expected";if(f.fromAddress!=null&&f.hasOwnProperty("fromAddress")){if(!(f.fromAddress&&typeof f.fromAddress.length==="number"||z.isString(f.fromAddress)))return"fromAddress: buffer expected"}if(f.toAddress!=null&&f.hasOwnProperty("toAddress")){if(!(f.toAddress&&typeof f.toAddress.length==="number"||z.isString(f.toAddress)))return"toAddress: buffer expected"}if(f.amount!=null&&f.hasOwnProperty("amount")){if(!Array.isArray(f.amount))return"amount: array expected";for(let x=0;x<f.amount.length;++x){let T=y.cosmos.base.v1beta1.Coin.verify(f.amount[x]);if(T)return"amount."+T}}return null},B.fromObject=function(f){if(f instanceof y.types.MsgSend)return f;let x=new y.types.MsgSend;if(f.fromAddress!=null){if(typeof f.fromAddress==="string")z.base64.decode(f.fromAddress,x.fromAddress=z.newBuffer(z.base64.length(f.fromAddress)),0);else if(f.fromAddress.length)x.fromAddress=f.fromAddress}if(f.toAddress!=null){if(typeof f.toAddress==="string")z.base64.decode(f.toAddress,x.toAddress=z.newBuffer(z.base64.length(f.toAddress)),0);else if(f.toAddress.length)x.toAddress=f.toAddress}if(f.amount){if(!Array.isArray(f.amount))throw TypeError(".types.MsgSend.amount: array expected");x.amount=[];for(let T=0;T<f.amount.length;++T){if(typeof f.amount[T]!=="object")throw TypeError(".types.MsgSend.amount: object expected");x.amount[T]=y.cosmos.base.v1beta1.Coin.fromObject(f.amount[T])}}return x},B.toObject=function(f,x){if(!x)x={};let T={};if(x.arrays||x.defaults)T.amount=[];if(x.defaults){if(x.bytes===String)T.fromAddress="";else if(T.fromAddress=[],x.bytes!==Array)T.fromAddress=z.newBuffer(T.fromAddress);if(x.bytes===String)T.toAddress="";else if(T.toAddress=[],x.bytes!==Array)T.toAddress=z.newBuffer(T.toAddress)}if(f.fromAddress!=null&&f.hasOwnProperty("fromAddress"))T.fromAddress=x.bytes===String?z.base64.encode(f.fromAddress,0,f.fromAddress.length):x.bytes===Array?Array.prototype.slice.call(f.fromAddress):f.fromAddress;if(f.toAddress!=null&&f.hasOwnProperty("toAddress"))T.toAddress=x.bytes===String?z.base64.encode(f.toAddress,0,f.toAddress.length):x.bytes===Array?Array.prototype.slice.call(f.toAddress):f.toAddress;if(f.amount?.length){T.amount=[];for(let v=0;v<f.amount.length;++v)T.amount[v]=y.cosmos.base.v1beta1.Coin.toObject(f.amount[v],x)}return T},B.prototype.toJSON=function(){return this.constructor.toObject(this,F.default.util.toJSONOptions)},B})(),H})();y.cosmos=(()=>{let H={};return H.base=(()=>{let B={};return B.v1beta1=(()=>{let _={};return _.Coin=(()=>{function f(x){if(x){for(let T=Object.keys(x),v=0;v<T.length;++v)if(x[T[v]]!=null)this[T[v]]=x[T[v]]}}return f.prototype.denom="",f.prototype.amount="",f.create=function(T){return new f(T)},f.encode=function(T,v){if(!v)v=C.create();if(T.denom!=null&&Object.hasOwnProperty.call(T,"denom"))v.uint32(10).string(T.denom);if(T.amount!=null&&Object.hasOwnProperty.call(T,"amount"))v.uint32(18).string(T.amount);return v},f.encodeDelimited=function(T,v){return this.encode(T,v).ldelim()},f.decode=function(T,v){if(!(T instanceof Z))T=Z.create(T);let L=v===void 0?T.len:T.pos+v,X=new y.cosmos.base.v1beta1.Coin;while(T.pos<L){let Y=T.uint32();switch(Y>>>3){case 1:X.denom=T.string();break;case 2:X.amount=T.string();break;default:T.skipType(Y&7);break}}return X},f.decodeDelimited=function(T){if(!(T instanceof Z))T=new Z(T);return this.decode(T,T.uint32())},f.verify=function(T){if(typeof T!=="object"||T===null)return"object expected";if(T.denom!=null&&T.hasOwnProperty("denom")){if(!z.isString(T.denom))return"denom: string expected"}if(T.amount!=null&&T.hasOwnProperty("amount")){if(!z.isString(T.amount))return"amount: string expected"}return null},f.fromObject=function(T){if(T instanceof y.cosmos.base.v1beta1.Coin)return T;let v=new y.cosmos.base.v1beta1.Coin;if(T.denom!=null)v.denom=String(T.denom);if(T.amount!=null)v.amount=String(T.amount);return v},f.toObject=function(T,v){if(!v)v={};let L={};if(v.defaults)L.denom="",L.amount="";if(T.denom!=null&&T.hasOwnProperty("denom"))L.denom=T.denom;if(T.amount!=null&&T.hasOwnProperty("amount"))L.amount=T.amount;return L},f.prototype.toJSON=function(){return this.constructor.toObject(this,F.default.util.toJSONOptions)},f})(),_.DecCoin=(()=>{function f(x){if(x){for(let T=Object.keys(x),v=0;v<T.length;++v)if(x[T[v]]!=null)this[T[v]]=x[T[v]]}}return f.prototype.denom="",f.prototype.amount="",f.create=function(T){return new f(T)},f.encode=function(T,v){if(!v)v=C.create();if(T.denom!=null&&Object.hasOwnProperty.call(T,"denom"))v.uint32(10).string(T.denom);if(T.amount!=null&&Object.hasOwnProperty.call(T,"amount"))v.uint32(18).string(T.amount);return v},f.encodeDelimited=function(T,v){return this.encode(T,v).ldelim()},f.decode=function(T,v){if(!(T instanceof Z))T=Z.create(T);let L=v===void 0?T.len:T.pos+v,X=new y.cosmos.base.v1beta1.DecCoin;while(T.pos<L){let Y=T.uint32();switch(Y>>>3){case 1:X.denom=T.string();break;case 2:X.amount=T.string();break;default:T.skipType(Y&7);break}}return X},f.decodeDelimited=function(T){if(!(T instanceof Z))T=new Z(T);return this.decode(T,T.uint32())},f.verify=function(T){if(typeof T!=="object"||T===null)return"object expected";if(T.denom!=null&&T.hasOwnProperty("denom")){if(!z.isString(T.denom))return"denom: string expected"}if(T.amount!=null&&T.hasOwnProperty("amount")){if(!z.isString(T.amount))return"amount: string expected"}return null},f.fromObject=function(T){if(T instanceof y.cosmos.base.v1beta1.DecCoin)return T;let v=new y.cosmos.base.v1beta1.DecCoin;if(T.denom!=null)v.denom=String(T.denom);if(T.amount!=null)v.amount=String(T.amount);return v},f.toObject=function(T,v){if(!v)v={};let L={};if(v.defaults)L.denom="",L.amount="";if(T.denom!=null&&T.hasOwnProperty("denom"))L.denom=T.denom;if(T.amount!=null&&T.hasOwnProperty("amount"))L.amount=T.amount;return L},f.prototype.toJSON=function(){return this.constructor.toObject(this,F.default.util.toJSONOptions)},f})(),_.IntProto=(()=>{function f(x){if(x){for(let T=Object.keys(x),v=0;v<T.length;++v)if(x[T[v]]!=null)this[T[v]]=x[T[v]]}}return f.prototype.int="",f.create=function(T){return new f(T)},f.encode=function(T,v){if(!v)v=C.create();if(T.int!=null&&Object.hasOwnProperty.call(T,"int"))v.uint32(10).string(T.int);return v},f.encodeDelimited=function(T,v){return this.encode(T,v).ldelim()},f.decode=function(T,v){if(!(T instanceof Z))T=Z.create(T);let L=v===void 0?T.len:T.pos+v,X=new y.cosmos.base.v1beta1.IntProto;while(T.pos<L){let Y=T.uint32();switch(Y>>>3){case 1:X.int=T.string();break;default:T.skipType(Y&7);break}}return X},f.decodeDelimited=function(T){if(!(T instanceof Z))T=new Z(T);return this.decode(T,T.uint32())},f.verify=function(T){if(typeof T!=="object"||T===null)return"object expected";if(T.int!=null&&T.hasOwnProperty("int")){if(!z.isString(T.int))return"int: string expected"}return null},f.fromObject=function(T){if(T instanceof y.cosmos.base.v1beta1.IntProto)return T;let v=new y.cosmos.base.v1beta1.IntProto;if(T.int!=null)v.int=String(T.int);return v},f.toObject=function(T,v){if(!v)v={};let L={};if(v.defaults)L.int="";if(T.int!=null&&T.hasOwnProperty("int"))L.int=T.int;return L},f.prototype.toJSON=function(){return this.constructor.toObject(this,F.default.util.toJSONOptions)},f})(),_.DecProto=(()=>{function f(x){if(x){for(let T=Object.keys(x),v=0;v<T.length;++v)if(x[T[v]]!=null)this[T[v]]=x[T[v]]}}return f.prototype.dec="",f.create=function(T){return new f(T)},f.encode=function(T,v){if(!v)v=C.create();if(T.dec!=null&&Object.hasOwnProperty.call(T,"dec"))v.uint32(10).string(T.dec);return v},f.encodeDelimited=function(T,v){return this.encode(T,v).ldelim()},f.decode=function(T,v){if(!(T instanceof Z))T=Z.create(T);let L=v===void 0?T.len:T.pos+v,X=new y.cosmos.base.v1beta1.DecProto;while(T.pos<L){let Y=T.uint32();switch(Y>>>3){case 1:X.dec=T.string();break;default:T.skipType(Y&7);break}}return X},f.decodeDelimited=function(T){if(!(T instanceof Z))T=new Z(T);return this.decode(T,T.uint32())},f.verify=function(T){if(typeof T!=="object"||T===null)return"object expected";if(T.dec!=null&&T.hasOwnProperty("dec")){if(!z.isString(T.dec))return"dec: string expected"}return null},f.fromObject=function(T){if(T instanceof y.cosmos.base.v1beta1.DecProto)return T;let v=new y.cosmos.base.v1beta1.DecProto;if(T.dec!=null)v.dec=String(T.dec);return v},f.toObject=function(T,v){if(!v)v={};let L={};if(v.defaults)L.dec="";if(T.dec!=null&&T.hasOwnProperty("dec"))L.dec=T.dec;return L},f.prototype.toJSON=function(){return this.constructor.toObject(this,F.default.util.toJSONOptions)},f})(),_})(),B})(),H})()});async function p(){let{$root:H}=await Promise.resolve().then(() => (uf(),Pf)),B=await import("@cosmjs/proto-signing"),_=B.Registry??B.default?.Registry,f=await import("@cosmjs/stargate"),x=f.defaultRegistryTypes??f.default?.defaultRegistryTypes;return new _([...x,["/types.MsgSend",H.types.MsgSend],["/types.MsgDeposit",H.types.MsgDeposit]])}async function u(H){let B=await import("@cosmjs/stargate"),_=B.AminoTypes??B.default?.AminoTypes,f=H===Mf.Chain.THORChain?"thorchain":"mayachain";return new _({"/types.MsgDeposit":{aminoType:`${f}/MsgDeposit`,fromAmino:({signer:x,...T})=>({...T,signer:o(x)}),toAmino:({signer:x,...T})=>({...T,signer:t(x)})},"/types.MsgSend":{aminoType:`${f}/MsgSend`,fromAmino:({from_address:x,to_address:T,...v})=>({...v,fromAddress:o(x),toAddress:o(T)}),toAmino:({fromAddress:x,toAddress:T,...v})=>({...v,from_address:t(x),to_address:t(T)})}})}var Mf;var Gf=k(()=>{Hf();Mf=require("@swapkit/helpers")});function Xf(H){let{assetValue:B,recipient:_,memo:f,sender:x,asSignable:T,asAminoMessage:v}=H;if(_)return hf({asAminoMessage:v,asSignable:T,assetValue:B,memo:f,recipient:_,sender:x});return lf({asAminoMessage:v,asSignable:T,assetValue:B,memo:f,sender:x})}async function hf({sender:H,recipient:B,assetValue:_,memo:f="",asSignable:x=!0,asAminoMessage:T=!1,sequence:v,accountNumber:L}){let X=_.chain,Y=await U.getRPCUrl(X),A=await wf({rpcUrl:Y,sender:H}),{chainId:N}=U.getChainConfig(X),J=Zf({assetValue:_,recipient:B,sender:H}),Q=x?await M(T?J:w(J),X):J;return{accountNumber:L||A.accountNumber,chainId:N,fee:V(X),memo:f,msgs:[Q],sequence:v||A.sequence}}async function lf({sender:H,assetValue:B,memo:_="",asSignable:f=!0,asAminoMessage:x=!1,sequence:T,accountNumber:v}){let L=B.chain,X=await U.getRPCUrl(L),Y=await wf({rpcUrl:X,sender:H}),{chainId:A}=U.getChainConfig(L),N=Qf({assetValue:B,memo:_,sender:H}),J=f?await M(x?N:w(N),L):N;return{accountNumber:v||Y.accountNumber,chainId:A,fee:V(L),memo:_,msgs:[J],sequence:T||Y.sequence}}function w(H){if(H.type==="thorchain/MsgSend"||H.type==="mayachain/MsgSend")return H;return{...H,value:{...H.value,coins:H.value.coins.map((B)=>{let _=U.AssetValue.from({asset:B.asset}),f=(_.isSynthetic?_.symbol.split("/")?.[1]:_.symbol)?.toUpperCase(),x=(_.isSynthetic?_.symbol.split("/")?.[0]:_.chain)?.toUpperCase();return{...B,asset:{chain:x,symbol:f,synth:_.isSynthetic,ticker:_.ticker}}})}}}async function a({chain:H,memo:B,msgs:_}){let f=await p(),x=await u(H),T={typeUrl:"/cosmos.tx.v1beta1.TxBody",value:{memo:B,messages:_.map((v)=>x.fromAmino(v))}};return f.encode(T)}var U,Q0,X0,Zf=({sender:H,recipient:B,assetValue:_})=>{return{type:`${_.chain===U.Chain.Maya?"mayachain":"thorchain"}/MsgSend`,value:{amount:[{amount:_.getBaseValue("string"),denom:P(_.symbol,!0)}],from_address:H,to_address:B}}},Qf=({sender:H,assetValue:B,memo:_=""})=>{return{type:`${B.chain===U.Chain.Maya?"mayachain":"thorchain"}/MsgDeposit`,value:{coins:[{amount:B.getBaseValue("string"),asset:m(B)}],memo:_,signer:H}}},ff=({sender:H,recipient:B,assetValue:_,memo:f})=>{return!B?Qf({assetValue:_,memo:f,sender:H}):Zf({assetValue:_,recipient:B,sender:H})},M=async(H,B)=>{return(await u(B)).fromAmino(H)},wf=async({rpcUrl:H,sender:B})=>{let f=await(await D(H)).getAccount(B);if(!f)throw new U.SwapKitError("toolbox_cosmos_account_not_found",{sender:B});return f};var nf=k(()=>{g();Gf();U=require("@swapkit/helpers"),Q0=V(U.Chain.THORChain).gas,X0=V(U.Chain.Maya).gas});var $f=()=>{};var cf=k(()=>{$f()});var If=k(()=>{Hf();nf();Gf();cf()});async function Jf(H,B){try{let f=(await qf.SwapKitApi.getGasRate()).find((x)=>x.chainId===H)?.value;return f?Number.parseFloat(f):B}catch{return B}}async function Yf({phrase:H,prefix:B,..._}){let f="derivationPath"in _?_.derivationPath:`${W.DerivationPath[_.chain]}/${_.index}`;return await of.DirectSecp256k1HdWallet.fromMnemonic(H,{hdPaths:[df.stringToPath(f)],prefix:B})}async function I0({privateKey:H,prefix:B}){let _=await import("@cosmjs/proto-signing");return(_.DirectSecp256k1Wallet??_.default?.DirectSecp256k1Wallet).fromKey(H,B)}function tf(H){return async function({signature:_,message:f,address:x}){let T=await H(x);if(!T?.pubkey)throw new W.SwapKitError("toolbox_cosmos_verify_signature_no_pubkey");let v=await import("@cosmjs/crypto"),L=v.Secp256k1Signature??v.default?.Secp256k1Signature,X=v.Secp256k1??v.default?.Secp256k1,Y=L.fromFixedLength(h.base64.decode(_));return X.verifySignature(Y,h.base64.decode(f),T.pubkey.value)}}function s({chain:H,...B}){let _=W.CosmosChainPrefixes[H],f="index"in B?B.index||0:0,x=W.derivationPathToString("derivationPath"in B&&B.derivationPath?B.derivationPath:W.updateDerivationPath(W.NetworkDerivationPath[H],{index:f})),T;async function v(){if(T)return T;return T=await r.match(B).with({phrase:r.P.string},({phrase:Q})=>Yf({derivationPath:x,phrase:Q,prefix:_})).with({signer:r.P.any},({signer:Q})=>Q).otherwise(()=>{return}),T}async function L(Q){let I=await W.getRPCUrl(H);return(await D(I)).getAccount(Q)}async function X(){let Q=await v(),[I]=await Q?.getAccounts()||[];return I?.address}async function Y(){let Q=await v(),[I]=await Q?.getAccounts()||[];if(!I?.pubkey)throw new W.SwapKitError("toolbox_cosmos_signer_not_defined");return h.base64.encode(I?.pubkey)}async function A(Q){let I=await v(),K=await X(),O=await W.getRPCUrl(H);if(!(I&&K))throw new W.SwapKitError("toolbox_cosmos_signer_not_defined");return await(await c(O,I)).sign(K,Q.msgs,Q.fee,Q.memo,{accountNumber:Q.accountNumber,chainId:Q.chainId,sequence:Q.sequence})}async function N(Q){let I=await v(),K=await X(),O=await W.getRPCUrl(H);if(!(I&&K))throw new W.SwapKitError("toolbox_cosmos_signer_not_defined");let S=await(await c(O,I)).signAndBroadcast(K,Q.msgs,Q.fee,Q.memo);if(S.code!==0)throw new W.SwapKitError("core_swap_transaction_error",{code:S.code,message:S.rawLog});return S.transactionHash}async function J({recipient:Q,assetValue:I,memo:K="",feeRate:O,feeOptionKey:E=W.FeeOption.Fast}){let S=await v(),j=await X();if(!(S&&j))throw new W.SwapKitError("toolbox_cosmos_signer_not_defined");let xf=await W.getRPCUrl(H),Bf=W.AssetValue.from({chain:H}),b=m(Bf),d=O||J0((await jf(H,pf[H]))[E],b),vf=await c(xf,S),_f=P(I.symbol),Kf=[{amount:I.getBaseValue("string"),denom:_f}],{transactionHash:$}=await vf.sendTokens(j,Q,Kf,d,K);return $}return{createPrivateKeyFromPhrase:S0(x),createTransaction:Wf,fetchFeeRateFromSwapKit:Jf,getAccount:L,getAddress:X,getBalance:async(Q,I)=>{let K=await bf(H)(Q),O=await Promise.all(K.filter(({denom:E})=>E&&!E.includes("IBC/")&&!([W.Chain.THORChain,W.Chain.Maya].includes(H)&&E.split("-").length>2)).map(({denom:E,amount:S})=>{let j=[W.Chain.THORChain,W.Chain.Maya].includes(H)&&(E.includes("/")||E.includes("˜"))?`${H}.${E}`:E;return zf(j,S)}));if(O.length===0)return[W.AssetValue.from({chain:H})];return O},getBalanceAsDenoms:bf(H),getFees:()=>jf(H,pf[H]),getPubKey:Y,getSignerFromPhrase:({phrase:Q,derivationPath:I})=>Yf({derivationPath:W.derivationPathToString(I),index:f,phrase:Q,prefix:_}),getSignerFromPrivateKey:async(Q)=>{let I=await import("@cosmjs/proto-signing");return(I.DirectSecp256k1Wallet??I.default?.DirectSecp256k1Wallet).fromKey(Q,_)},signAndBroadcastTransaction:N,signTransaction:A,transfer:J,validateAddress:mf(H),verifySignature:tf(L)}}async function Y0(H,B){try{let f=(await qf.SwapKitApi.getGasRate()).find((x)=>x.chainId===H)?.value;return f?Number.parseFloat(f):B}catch{return B}}function q0({assetValue:{chain:H}}){return W.AssetValue.from({chain:H,value:N0(H)})}async function jf(H,B){let{chainId:_,baseDecimal:f}=W.getChainConfig(H),x=await Jf(_,B);return{average:W.SwapKitNumber.fromBigInt(BigInt(x),f),fast:W.SwapKitNumber.fromBigInt(BigInt(W.applyFeeMultiplier(x,W.FeeOption.Fast,!0)),f),fastest:W.SwapKitNumber.fromBigInt(BigInt(W.applyFeeMultiplier(x,W.FeeOption.Fastest,!0)),f)}}function J0(H,B){return{amount:[{amount:H.getBaseValue("string"),denom:B}],gas:"200000"}}function N0(H){return{[W.Chain.Cosmos]:0.007,[W.Chain.Kujira]:0.02,[W.Chain.Noble]:0.01,[W.Chain.THORChain]:0.02,[W.Chain.Maya]:0.02,[W.Chain.Harbor]:0.02}[H]||0}function mf(H){let B=W.CosmosChainPrefixes[H];return function(f){if(!f.startsWith(B))return!1;try{let{prefix:x,words:T}=h.bech32.decode(f);return h.bech32.encode(x,T)===f.toLocaleLowerCase()}catch{return!1}}}function bf(H){return async function(_){let f=await W.getRPCUrl(H);return(await(await D(f)).getAllBalances(_)).map((L)=>({...L,denom:L.denom.includes("/")?L.denom.toUpperCase():L.denom}))}}function S0(H){return async function(_){let f=await import("@cosmjs/crypto"),x=f.stringToPath??f.default?.stringToPath,T=f.Slip10Curve??f.default?.Slip10Curve,v=f.Slip10??f.default?.Slip10,L=f.EnglishMnemonic??f.default?.EnglishMnemonic,X=f.Bip39??f.default?.Bip39,Y=new L(_),A=await X.mnemonicToSeed(Y),{privkey:N}=v.derivePath(T.Secp256k1,A,x(H));return N}}var df,of,h,W,qf,r,pf;var Tf=k(()=>{g();df=require("@cosmjs/crypto"),of=require("@cosmjs/proto-signing"),h=require("@scure/base"),W=require("@swapkit/helpers"),qf=require("@swapkit/helpers/api"),r=require("ts-pattern");pf={[W.Chain.Cosmos]:1000,[W.Chain.Kujira]:1000,[W.Chain.Noble]:1000,[W.Chain.THORChain]:5000000,[W.Chain.Maya]:5000000,[W.Chain.Harbor]:5000000}});function K0({prefix:H,derivationPath:B}){return async function(f,x=0){let T=await import("@cosmjs/amino"),v=T.Secp256k1HdWallet??T.default?.Secp256k1HdWallet,L=await import("@cosmjs/crypto"),X=L.stringToPath??L.default?.stringToPath;return v.fromMnemonic(f,{hdPaths:[X(`${B}/${x}`)],prefix:H})}}function O0(H){return l.base64.encode(H)}function E0(H){return async function({wallet:_,tx:f}){let{msgs:x,accountNumber:T,sequence:v,chainId:L,fee:X,memo:Y}=typeof f==="string"?JSON.parse(f):f,A=(await _.getAccounts())?.[0]?.address||"",N=await u(H),J=await p(),Q=await yf(_,{aminoTypes:N,registry:J}),I=[];for(let E of x){let S=await M(E,H);I.push(S)}let{signatures:[K]}=await Q.sign(A,I,X,Y,{accountNumber:T,chainId:L,sequence:v});return{bodyBytes:await a({chain:H,memo:Y,msgs:x.map(w)}),signature:O0(K)}}}function F0({prefix:H,chain:B}){return async function(f,x,T,v,L){let X=await q.getRPCUrl(B),{encodeSecp256k1Pubkey:Y,pubkeyToAddress:A}=(await import("@cosmjs/amino")).default,{makeMultisignedTxBytes:N}=(await import("@cosmjs/stargate")).default,{sequence:J,fee:Q}=JSON.parse(f),I=await gf(T,v),K=x.map((S)=>[A(Y(l.base64.decode(S.pubKey)),H),l.base64.decode(S.signature)]),O=await D(X),{transactionHash:E}=await O.broadcastTx(N(I,J,Q,L,new Map(K)));return E}}async function gf(H,B,_=!0){let{createMultisigThresholdPubkey:f,encodeSecp256k1Pubkey:x}=(await import("@cosmjs/amino")).default;return f(H.map((T)=>x(l.base64.decode(T))),B,_)}function A0(H){return l.base64.decode(H)}async function U0({privateKey:H,message:B}){let{Secp256k1:_}=(await import("@cosmjs/crypto")).default,f=await _.createSignature(l.base64.decode(B),H);return l.base64.encode(Buffer.concat([f.r(32),f.s(32)]))}function Nf({chain:H,...B}){let{nodeUrl:_}=q.getChainConfig(H),{isStagenet:f}=q.SKConfig.get("envs"),x=H===q.Chain.THORChain,T=`${f?"s":""}${q.CosmosChainPrefixes[H]}`,v="index"in B?B.index||0:0,L="derivationPath"in B&&B.derivationPath?B.derivationPath:q.updateDerivationPath(q.NetworkDerivationPath[H],{index:v}),X=s({chain:H,...B}),Y=V(H);async function A(){let J,Q=`${_}/${x?"thorchain":"mayachain"}/constants`;try{let{int_64_values:{NativeTransactionFee:I}}=await q.RequestClient.get(Q);if(!I||Number.isNaN(I)||I<0)throw new q.SwapKitError("toolbox_cosmos_invalid_fee",{nativeFee:I.toString()});J=new q.SwapKitNumber(I)}catch{J=new q.SwapKitNumber({decimal:q.getChainConfig(H).baseDecimal,value:x?0.02:1})}return{[q.FeeOption.Average]:J,[q.FeeOption.Fast]:J,[q.FeeOption.Fastest]:J}}async function N({assetValue:J,memo:Q="",recipient:I}){let K=await q.getRPCUrl(H),O=await e.match(B).with({phrase:e.P.string},({phrase:$})=>X.getSignerFromPhrase({derivationPath:L,phrase:$})).with({signer:e.P.any},({signer:$})=>$).otherwise(()=>{return}),{TxRaw:E}=await import("cosmjs-types/cosmos/tx/v1beta1/tx"),S=(await O?.getAccounts())?.[0]?.address;if(!(S&&O))throw new q.SwapKitError("toolbox_cosmos_no_signer");let j="signAmino"in O,xf=await p(),Bf=await u(H),b=await c(K,O,{aminoTypes:Bf,registry:xf}),d=ff({assetValue:J,memo:Q,recipient:I,sender:S});if(j){let $=await M(d,H),{signatures:rf,authInfoBytes:sf}=await b.sign(S,[$],Y,Q),ef=E.encode({authInfoBytes:sf,bodyBytes:await a({chain:H,memo:Q,msgs:[d].map(w)}),signatures:rf}).finish();return(await b.broadcastTx(ef)).transactionHash}let vf=w(d),_f=await M(vf,H);return(await b.signAndBroadcast(S,[_f],Y,Q)).transactionHash}return{...X,broadcastMultisigTx:F0({chain:H,prefix:T}),buildAminoMsg:ff,buildEncodedTxBody:a,convertToSignable:M,createDefaultAminoTypes:()=>u(H),createDefaultRegistry:p,createMultisig:gf,createTransaction:Xf,deposit:N,getFees:A,importSignature:A0,parseAminoMessageForDirectSigning:w,pubkeyToAddress:async(J)=>{let{pubkeyToAddress:Q}=(await import("@cosmjs/amino")).default;return Q(J,T)},secp256k1HdWalletFromMnemonic:K0({derivationPath:q.derivationPathToString(L),prefix:T}),signMultisigTx:E0(H),signWithPrivateKey:U0,transfer:N}}var l,q,e;var Sf=k(()=>{If();g();Tf();l=require("@scure/base"),q=require("@swapkit/helpers"),e=require("ts-pattern")});var n,k0=(H,B)=>{switch(H){case n.Chain.Cosmos:case n.Chain.Kujira:case n.Chain.Noble:return s({chain:H,...B});case n.Chain.Maya:case n.Chain.THORChain:return Nf({chain:H,...B});default:throw new n.SwapKitError("toolbox_cosmos_not_supported",{chain:H})}};var af=k(()=>{Tf();Sf();n=require("@swapkit/helpers");Tf();Sf()});var R0={};Uf(R0,{verifySignature:()=>tf,transferMsgAmino:()=>Zf,toBase64:()=>W0,parseAminoMessageForDirectSigning:()=>w,getSignerFromPrivateKey:()=>I0,getSignerFromPhrase:()=>Yf,getMsgSendDenom:()=>P,getFeeRateFromSwapKit:()=>Y0,getDenomWithChain:()=>m,getDefaultChainFee:()=>V,getCosmosToolbox:()=>k0,getCosmosAddressValidator:()=>mf,getAssetFromDenom:()=>zf,fromBase64:()=>z0,fetchFeeRateFromSwapKit:()=>Jf,estimateTransactionFee:()=>q0,depositMsgAmino:()=>Qf,createTransaction:()=>Xf,createThorchainToolbox:()=>Nf,createStargateClient:()=>D,createSigningStargateClient:()=>c,createOfflineStargateClient:()=>yf,createDefaultRegistry:()=>p,createDefaultAminoTypes:()=>u,createCosmosToolbox:()=>s,cosmosCreateTransaction:()=>Wf,convertToSignable:()=>M,buildTransferTx:()=>hf,buildEncodedTxBody:()=>a,buildDepositTx:()=>lf,buildAminoMsg:()=>ff,bech32ToBase64:()=>o,base64ToBech32:()=>t,YUM_KUJIRA_FACTORY_DENOM:()=>Cf,USK_KUJIRA_FACTORY_DENOM:()=>Lf,THORCHAIN_GAS_VALUE:()=>Q0,MAYA_GAS_VALUE:()=>X0,DEFAULT_NOBLE_FEE_MAINNET:()=>Df,DEFAULT_KUJI_FEE_MAINNET:()=>Vf,DEFAULT_COSMOS_FEE_MAINNET:()=>Rf});module.exports=H0(R0);var V0=k(()=>{If();af();g()});V0();
@@ -1,4 +1 @@
1
- var B4=Object.create;var{getPrototypeOf:G4,defineProperty:J6,getOwnPropertyNames:T4}=Object;var _4=Object.prototype.hasOwnProperty;var U=(Y,H,X)=>{X=Y!=null?B4(G4(Y)):{};let L=H||!Y||!Y.__esModule?J6(X,"default",{value:Y,enumerable:!0}):X;for(let Z of T4(Y))if(!_4.call(L,Z))J6(L,Z,{get:()=>Y[Z],enumerable:!0});return L};var D6=(Y,H)=>{for(var X in H)J6(Y,X,{get:H[X],enumerable:!0,configurable:!0,set:(L)=>H[X]=()=>L})};var F=(Y,H)=>()=>(Y&&(H=Y(Y=0)),H);var v=((Y)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(Y,{get:(H,X)=>(typeof require<"u"?require:H)[X]}):Y)(function(Y){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+Y+'" is not supported')});import{base64 as S6,bech32 as e}from"@scure/base";import{SwapKitError as I4}from"@swapkit/helpers";import{fromByteArray as E4,toByteArray as N4}from"base64-js";function i(Y){return S6.encode(Uint8Array.from(e.fromWords(e.decode(Y).words)))}function o(Y,H="thor"){return e.encode(H,e.toWords(S6.decode(Y)))}function O4(Y){return E4(Y)}function x4(Y){if(!Y.match(/^[a-zA-Z0-9+/]*={0,2}$/))throw new I4("toolbox_cosmos_invalid_params",{error:"Invalid base64 string format"});return N4(Y)}var q6=()=>{};import{AssetValue as W6,Chain as I,getChainConfig as y,getRPCUrl as U4,SwapKitError as P6}from"@swapkit/helpers";function S(Y){switch(Y){case I.Maya:return{amount:[],gas:"10000000000"};case I.THORChain:return{amount:[],gas:"500000000"};case I.Kujira:return $6;case I.Noble:return u6;default:return w6}}async function P(Y){let H=await import("@cosmjs/stargate"),X=H.StargateClient??H.default?.StargateClient,L=typeof window<"u"?{}:{referer:"https://sdk.swapkit.dev",referrer:"https://sdk.swapkit.dev"};return X.connect({headers:L,url:Y})}async function p(Y,H,X={}){let L=await import("@cosmjs/stargate"),Z=L.SigningStargateClient??L.default?.SigningStargateClient,z=L.GasPrice??L.default?.GasPrice,Q=typeof X==="string"?X:"0.0003uatom",J=typeof X==="string"?{}:X;return Z.connectWithSigner(Y,H,{gasPrice:z.fromString(Q),...J})}async function G6(Y,H){let X=await import("@cosmjs/stargate");return(X.SigningStargateClient??X.default?.SigningStargateClient).offline(Y,H)}async function T6({sender:Y,recipient:H,assetValue:X,memo:L="",feeRate:Z,sequence:z,accountNumber:Q}){let{chain:J,chainId:G}=X,_=await U4(J),A=await(await P(_)).getAccount(Y);if(!A)throw new P6("toolbox_cosmos_account_not_found",{sender:Y});let T=W6.from({chain:J}),N=D(T.symbol),E=S(J),x=N&&Z?{amount:[{amount:Z.toString(),denom:N}],gas:E.gas}:E,O={amount:[{amount:X.getBaseValue("string"),denom:D(X.symbol)}],fromAddress:Y,toAddress:H};return{accountNumber:Q??A.accountNumber,chainId:G,fee:x,memo:L,msgs:[{typeUrl:v4(J),value:O}],sequence:z??A.sequence}}var B6="FACTORY/KUJIRA1QK00H5ATUTPSV900X202PXX42NPJR9THG58DNQPA72F2P7M2LUASE444A7/UUSK",C6="FACTORY/KUJIRA1YGFXN0ER40KLCNCK8THLTUPRDXLCK6WVNPKF2K/UYUM",w6,$6,u6,D=(Y,H=!1)=>{if(H)return Y.toLowerCase();switch(Y){case"uUSK":case"USK":return B6;case"uYUM":case"YUM":return C6;case"uKUJI":case"KUJI":return"ukuji";case"ATOM":case"uATOM":return"uatom";case"uUSDC":case"USDC":return"uusdc";default:return Y}},b=({symbol:Y,chain:H})=>{if(H===I.Maya)return(Y.toUpperCase()!=="CACAO"?Y:`${I.Maya}.${Y}`).toUpperCase();if(H===I.THORChain)return(["RUNE","TCY","RUJI"].includes(Y.toUpperCase())?`${I.THORChain}.${Y}`:Y).toUpperCase();return D(Y,!1)},v4=(Y)=>{switch(Y){case I.Maya:case I.THORChain:return"/types.MsgSend";case I.Cosmos:case I.Kujira:case I.Noble:return"/cosmos.bank.v1beta1.MsgSend";default:throw new P6("toolbox_cosmos_not_supported",{chain:Y})}},K4,_6=(Y,H)=>{let X=K4[Y.toLowerCase()];if(!X)return W6.from({asset:Y,fromBaseDecimal:8,value:H});let{chain:L,asset:Z,decimals:z}=X,Q=L?{chain:L}:{asset:Z};return W6.from({...Q,fromBaseDecimal:z,value:H})};var t=F(()=>{w6={amount:[{amount:"500",denom:"uatom"}],gas:"200000"},$6={amount:[{amount:"1000",denom:"ukuji"}],gas:"200000"},u6={amount:[{amount:"1000",denom:"uusdc"}],gas:"200000"};K4={atom:{chain:I.Cosmos,decimals:y(I.Cosmos).baseDecimal},cacao:{chain:I.Maya,decimals:10},kuji:{chain:I.Kujira,decimals:y(I.Kujira).baseDecimal},maya:{asset:`${I.Maya}.${I.Maya}`,decimals:4},rune:{chain:I.THORChain,decimals:y(I.THORChain).baseDecimal},tcy:{asset:"THOR.TCY",decimals:y(I.THORChain).baseDecimal},uatom:{chain:I.Cosmos,decimals:y(I.Cosmos).baseDecimal},ukuji:{chain:I.Kujira,decimals:y(I.Kujira).baseDecimal},usdc:{chain:I.Noble,decimals:y(I.Noble).baseDecimal},uusdc:{chain:I.Noble,decimals:y(I.Noble).baseDecimal},"x/kuji":{asset:"THOR.KUJI",decimals:y(I.THORChain).baseDecimal},[B6.toLowerCase()]:{asset:`${I.Kujira}.USK`,decimals:y(I.Kujira).baseDecimal}}});var h6={};D6(h6,{$root:()=>q});import k from"protobufjs/minimal.js";var B,f,W,q;var l6=F(()=>{B=k.Reader,f=k.Writer,W=k.util,q=k.roots.default||(k.roots.default={});q.common=(()=>{let Y={};return Y.Asset=(()=>{function H(X){if(X){for(let L=Object.keys(X),Z=0;Z<L.length;++Z)if(X[L[Z]]!=null)this[L[Z]]=X[L[Z]]}}return H.prototype.chain="",H.prototype.symbol="",H.prototype.ticker="",H.prototype.synth=!1,H.create=function(L){return new H(L)},H.encode=function(L,Z){if(!Z)Z=f.create();if(L.chain!=null&&Object.hasOwnProperty.call(L,"chain"))Z.uint32(10).string(L.chain);if(L.symbol!=null&&Object.hasOwnProperty.call(L,"symbol"))Z.uint32(18).string(L.symbol);if(L.ticker!=null&&Object.hasOwnProperty.call(L,"ticker"))Z.uint32(26).string(L.ticker);if(L.synth!=null&&Object.hasOwnProperty.call(L,"synth"))Z.uint32(32).bool(L.synth);return Z},H.encodeDelimited=function(L,Z){return this.encode(L,Z).ldelim()},H.decode=function(L,Z){if(!(L instanceof B))L=B.create(L);let z=Z===void 0?L.len:L.pos+Z,Q=new q.common.Asset;while(L.pos<z){let J=L.uint32();switch(J>>>3){case 1:Q.chain=L.string();break;case 2:Q.symbol=L.string();break;case 3:Q.ticker=L.string();break;case 4:Q.synth=L.bool();break;default:L.skipType(J&7);break}}return Q},H.decodeDelimited=function(L){if(!(L instanceof B))L=new B(L);return this.decode(L,L.uint32())},H.verify=function(L){if(typeof L!=="object"||L===null)return"object expected";if(L.chain!=null&&L.hasOwnProperty("chain")){if(!W.isString(L.chain))return"chain: string expected"}if(L.symbol!=null&&L.hasOwnProperty("symbol")){if(!W.isString(L.symbol))return"symbol: string expected"}if(L.ticker!=null&&L.hasOwnProperty("ticker")){if(!W.isString(L.ticker))return"ticker: string expected"}if(L.synth!=null&&L.hasOwnProperty("synth")){if(typeof L.synth!=="boolean")return"synth: boolean expected"}return null},H.fromObject=function(L){if(L instanceof q.common.Asset)return L;let Z=new q.common.Asset;if(L.chain!=null)Z.chain=String(L.chain);if(L.symbol!=null)Z.symbol=String(L.symbol);if(L.ticker!=null)Z.ticker=String(L.ticker);if(L.synth!=null)Z.synth=Boolean(L.synth);return Z},H.toObject=function(L,Z){if(!Z)Z={};let z={};if(Z.defaults)z.chain="",z.symbol="",z.ticker="",z.synth=!1;if(L.chain!=null&&L.hasOwnProperty("chain"))z.chain=L.chain;if(L.symbol!=null&&L.hasOwnProperty("symbol"))z.symbol=L.symbol;if(L.ticker!=null&&L.hasOwnProperty("ticker"))z.ticker=L.ticker;if(L.synth!=null&&L.hasOwnProperty("synth"))z.synth=L.synth;return z},H.prototype.toJSON=function(){return this.constructor.toObject(this,k.util.toJSONOptions)},H})(),Y.Coin=(()=>{function H(X){if(X){for(let L=Object.keys(X),Z=0;Z<L.length;++Z)if(X[L[Z]]!=null)this[L[Z]]=X[L[Z]]}}return H.prototype.asset=null,H.prototype.amount="",H.prototype.decimals=W.Long?W.Long.fromBits(0,0,!1):0,H.create=function(L){return new H(L)},H.encode=function(L,Z){if(!Z)Z=f.create();if(L.asset!=null&&Object.hasOwnProperty.call(L,"asset"))q.common.Asset.encode(L.asset,Z.uint32(10).fork()).ldelim();if(L.amount!=null&&Object.hasOwnProperty.call(L,"amount"))Z.uint32(18).string(L.amount);if(L.decimals!=null&&Object.hasOwnProperty.call(L,"decimals"))Z.uint32(24).int64(L.decimals);return Z},H.encodeDelimited=function(L,Z){return this.encode(L,Z).ldelim()},H.decode=function(L,Z){if(!(L instanceof B))L=B.create(L);let z=Z===void 0?L.len:L.pos+Z,Q=new q.common.Coin;while(L.pos<z){let J=L.uint32();switch(J>>>3){case 1:Q.asset=q.common.Asset.decode(L,L.uint32());break;case 2:Q.amount=L.string();break;case 3:Q.decimals=L.int64();break;default:L.skipType(J&7);break}}return Q},H.decodeDelimited=function(L){if(!(L instanceof B))L=new B(L);return this.decode(L,L.uint32())},H.verify=function(L){if(typeof L!=="object"||L===null)return"object expected";if(L.asset!=null&&L.hasOwnProperty("asset")){let Z=q.common.Asset.verify(L.asset);if(Z)return"asset."+Z}if(L.amount!=null&&L.hasOwnProperty("amount")){if(!W.isString(L.amount))return"amount: string expected"}if(L.decimals!=null&&L.hasOwnProperty("decimals")){if(!W.isInteger(L.decimals)&&!(L.decimals&&W.isInteger(L.decimals.low)&&W.isInteger(L.decimals.high)))return"decimals: integer|Long expected"}return null},H.fromObject=function(L){if(L instanceof q.common.Coin)return L;let Z=new q.common.Coin;if(L.asset!=null){if(typeof L.asset!=="object")throw TypeError(".common.Coin.asset: object expected");Z.asset=q.common.Asset.fromObject(L.asset)}if(L.amount!=null)Z.amount=String(L.amount);if(L.decimals!=null){if(W.Long)(Z.decimals=W.Long.fromValue(L.decimals)).unsigned=!1;else if(typeof L.decimals==="string")Z.decimals=Number.parseInt(L.decimals,10);else if(typeof L.decimals==="number")Z.decimals=L.decimals;else if(typeof L.decimals==="object")Z.decimals=new W.LongBits(L.decimals.low>>>0,L.decimals.high>>>0).toNumber()}return Z},H.toObject=function(L,Z){if(!Z)Z={};let z={};if(Z.defaults)if(z.asset=null,z.amount="",W.Long){let Q=new W.Long(0,0,!1);z.decimals=Z.longs===String?Q.toString():Z.longs===Number?Q.toNumber():Q}else z.decimals=Z.longs===String?"0":0;if(L.asset!=null&&L.hasOwnProperty("asset"))z.asset=q.common.Asset.toObject(L.asset,Z);if(L.amount!=null&&L.hasOwnProperty("amount"))z.amount=L.amount;if(L.decimals!=null&&L.hasOwnProperty("decimals"))if(typeof L.decimals==="number")z.decimals=Z.longs===String?String(L.decimals):L.decimals;else z.decimals=Z.longs===String?W.Long.prototype.toString.call(L.decimals):Z.longs===Number?new W.LongBits(L.decimals.low>>>0,L.decimals.high>>>0).toNumber():L.decimals;return z},H.prototype.toJSON=function(){return this.constructor.toObject(this,k.util.toJSONOptions)},H})(),Y.PubKeySet=(()=>{function H(X){if(X){for(let L=Object.keys(X),Z=0;Z<L.length;++Z)if(X[L[Z]]!=null)this[L[Z]]=X[L[Z]]}}return H.prototype.secp256k1="",H.prototype.ed25519="",H.create=function(L){return new H(L)},H.encode=function(L,Z){if(!Z)Z=f.create();if(L.secp256k1!=null&&Object.hasOwnProperty.call(L,"secp256k1"))Z.uint32(10).string(L.secp256k1);if(L.ed25519!=null&&Object.hasOwnProperty.call(L,"ed25519"))Z.uint32(18).string(L.ed25519);return Z},H.encodeDelimited=function(L,Z){return this.encode(L,Z).ldelim()},H.decode=function(L,Z){if(!(L instanceof B))L=B.create(L);let z=Z===void 0?L.len:L.pos+Z,Q=new q.common.PubKeySet;while(L.pos<z){let J=L.uint32();switch(J>>>3){case 1:Q.secp256k1=L.string();break;case 2:Q.ed25519=L.string();break;default:L.skipType(J&7);break}}return Q},H.decodeDelimited=function(L){if(!(L instanceof B))L=new B(L);return this.decode(L,L.uint32())},H.verify=function(L){if(typeof L!=="object"||L===null)return"object expected";if(L.secp256k1!=null&&L.hasOwnProperty("secp256k1")){if(!W.isString(L.secp256k1))return"secp256k1: string expected"}if(L.ed25519!=null&&L.hasOwnProperty("ed25519")){if(!W.isString(L.ed25519))return"ed25519: string expected"}return null},H.fromObject=function(L){if(L instanceof q.common.PubKeySet)return L;let Z=new q.common.PubKeySet;if(L.secp256k1!=null)Z.secp256k1=String(L.secp256k1);if(L.ed25519!=null)Z.ed25519=String(L.ed25519);return Z},H.toObject=function(L,Z){if(!Z)Z={};let z={};if(Z.defaults)z.secp256k1="",z.ed25519="";if(L.secp256k1!=null&&L.hasOwnProperty("secp256k1"))z.secp256k1=L.secp256k1;if(L.ed25519!=null&&L.hasOwnProperty("ed25519"))z.ed25519=L.ed25519;return z},H.prototype.toJSON=function(){return this.constructor.toObject(this,k.util.toJSONOptions)},H})(),Y.Tx=(()=>{function H(X){if(this.coins=[],this.gas=[],X){for(let L=Object.keys(X),Z=0;Z<L.length;++Z)if(X[L[Z]]!=null)this[L[Z]]=X[L[Z]]}}return H.prototype.id="",H.prototype.chain="",H.prototype.fromAddress="",H.prototype.toAddress="",H.prototype.coins=W.emptyArray,H.prototype.gas=W.emptyArray,H.prototype.memo="",H.create=function(L){return new H(L)},H.encode=function(L,Z){if(!Z)Z=f.create();if(L.id!=null&&Object.hasOwnProperty.call(L,"id"))Z.uint32(10).string(L.id);if(L.chain!=null&&Object.hasOwnProperty.call(L,"chain"))Z.uint32(18).string(L.chain);if(L.fromAddress!=null&&Object.hasOwnProperty.call(L,"fromAddress"))Z.uint32(26).string(L.fromAddress);if(L.toAddress!=null&&Object.hasOwnProperty.call(L,"toAddress"))Z.uint32(34).string(L.toAddress);if(L.coins?.length)for(let z=0;z<L.coins.length;++z)q.common.Coin.encode(L.coins[z],Z.uint32(42).fork()).ldelim();if(L.gas?.length)for(let z=0;z<L.gas.length;++z)q.common.Coin.encode(L.gas[z],Z.uint32(50).fork()).ldelim();if(L.memo!=null&&Object.hasOwnProperty.call(L,"memo"))Z.uint32(58).string(L.memo);return Z},H.encodeDelimited=function(L,Z){return this.encode(L,Z).ldelim()},H.decode=function(L,Z){if(!(L instanceof B))L=B.create(L);let z=Z===void 0?L.len:L.pos+Z,Q=new q.common.Tx;while(L.pos<z){let J=L.uint32();switch(J>>>3){case 1:Q.id=L.string();break;case 2:Q.chain=L.string();break;case 3:Q.fromAddress=L.string();break;case 4:Q.toAddress=L.string();break;case 5:if(!Q.coins?.length)Q.coins=[];Q.coins.push(q.common.Coin.decode(L,L.uint32()));break;case 6:if(!Q.gas?.length)Q.gas=[];Q.gas.push(q.common.Coin.decode(L,L.uint32()));break;case 7:Q.memo=L.string();break;default:L.skipType(J&7);break}}return Q},H.decodeDelimited=function(L){if(!(L instanceof B))L=new B(L);return this.decode(L,L.uint32())},H.verify=function(L){if(typeof L!=="object"||L===null)return"object expected";if(L.id!=null&&L.hasOwnProperty("id")){if(!W.isString(L.id))return"id: string expected"}if(L.chain!=null&&L.hasOwnProperty("chain")){if(!W.isString(L.chain))return"chain: string expected"}if(L.fromAddress!=null&&L.hasOwnProperty("fromAddress")){if(!W.isString(L.fromAddress))return"fromAddress: string expected"}if(L.toAddress!=null&&L.hasOwnProperty("toAddress")){if(!W.isString(L.toAddress))return"toAddress: string expected"}if(L.coins!=null&&L.hasOwnProperty("coins")){if(!Array.isArray(L.coins))return"coins: array expected";for(let Z=0;Z<L.coins.length;++Z){let z=q.common.Coin.verify(L.coins[Z]);if(z)return"coins."+z}}if(L.gas!=null&&L.hasOwnProperty("gas")){if(!Array.isArray(L.gas))return"gas: array expected";for(let Z=0;Z<L.gas.length;++Z){let z=q.common.Coin.verify(L.gas[Z]);if(z)return"gas."+z}}if(L.memo!=null&&L.hasOwnProperty("memo")){if(!W.isString(L.memo))return"memo: string expected"}return null},H.fromObject=function(L){if(L instanceof q.common.Tx)return L;let Z=new q.common.Tx;if(L.id!=null)Z.id=String(L.id);if(L.chain!=null)Z.chain=String(L.chain);if(L.fromAddress!=null)Z.fromAddress=String(L.fromAddress);if(L.toAddress!=null)Z.toAddress=String(L.toAddress);if(L.coins){if(!Array.isArray(L.coins))throw TypeError(".common.Tx.coins: array expected");Z.coins=[];for(let z=0;z<L.coins.length;++z){if(typeof L.coins[z]!=="object")throw TypeError(".common.Tx.coins: object expected");Z.coins[z]=q.common.Coin.fromObject(L.coins[z])}}if(L.gas){if(!Array.isArray(L.gas))throw TypeError(".common.Tx.gas: array expected");Z.gas=[];for(let z=0;z<L.gas.length;++z){if(typeof L.gas[z]!=="object")throw TypeError(".common.Tx.gas: object expected");Z.gas[z]=q.common.Coin.fromObject(L.gas[z])}}if(L.memo!=null)Z.memo=String(L.memo);return Z},H.toObject=function(L,Z){if(!Z)Z={};let z={};if(Z.arrays||Z.defaults)z.coins=[],z.gas=[];if(Z.defaults)z.id="",z.chain="",z.fromAddress="",z.toAddress="",z.memo="";if(L.id!=null&&L.hasOwnProperty("id"))z.id=L.id;if(L.chain!=null&&L.hasOwnProperty("chain"))z.chain=L.chain;if(L.fromAddress!=null&&L.hasOwnProperty("fromAddress"))z.fromAddress=L.fromAddress;if(L.toAddress!=null&&L.hasOwnProperty("toAddress"))z.toAddress=L.toAddress;if(L.coins?.length){z.coins=[];for(let Q=0;Q<L.coins.length;++Q)z.coins[Q]=q.common.Coin.toObject(L.coins[Q],Z)}if(L.gas?.length){z.gas=[];for(let Q=0;Q<L.gas.length;++Q)z.gas[Q]=q.common.Coin.toObject(L.gas[Q],Z)}if(L.memo!=null&&L.hasOwnProperty("memo"))z.memo=L.memo;return z},H.prototype.toJSON=function(){return this.constructor.toObject(this,k.util.toJSONOptions)},H})(),Y.Fee=(()=>{function H(X){if(this.coins=[],X){for(let L=Object.keys(X),Z=0;Z<L.length;++Z)if(X[L[Z]]!=null)this[L[Z]]=X[L[Z]]}}return H.prototype.coins=W.emptyArray,H.prototype.poolDeduct="",H.create=function(L){return new H(L)},H.encode=function(L,Z){if(!Z)Z=f.create();if(L.coins?.length)for(let z=0;z<L.coins.length;++z)q.common.Coin.encode(L.coins[z],Z.uint32(10).fork()).ldelim();if(L.poolDeduct!=null&&Object.hasOwnProperty.call(L,"poolDeduct"))Z.uint32(18).string(L.poolDeduct);return Z},H.encodeDelimited=function(L,Z){return this.encode(L,Z).ldelim()},H.decode=function(L,Z){if(!(L instanceof B))L=B.create(L);let z=Z===void 0?L.len:L.pos+Z,Q=new q.common.Fee;while(L.pos<z){let J=L.uint32();switch(J>>>3){case 1:if(!Q.coins?.length)Q.coins=[];Q.coins.push(q.common.Coin.decode(L,L.uint32()));break;case 2:Q.poolDeduct=L.string();break;default:L.skipType(J&7);break}}return Q},H.decodeDelimited=function(L){if(!(L instanceof B))L=new B(L);return this.decode(L,L.uint32())},H.verify=function(L){if(typeof L!=="object"||L===null)return"object expected";if(L.coins!=null&&L.hasOwnProperty("coins")){if(!Array.isArray(L.coins))return"coins: array expected";for(let Z=0;Z<L.coins.length;++Z){let z=q.common.Coin.verify(L.coins[Z]);if(z)return"coins."+z}}if(L.poolDeduct!=null&&L.hasOwnProperty("poolDeduct")){if(!W.isString(L.poolDeduct))return"poolDeduct: string expected"}return null},H.fromObject=function(L){if(L instanceof q.common.Fee)return L;let Z=new q.common.Fee;if(L.coins){if(!Array.isArray(L.coins))throw TypeError(".common.Fee.coins: array expected");Z.coins=[];for(let z=0;z<L.coins.length;++z){if(typeof L.coins[z]!=="object")throw TypeError(".common.Fee.coins: object expected");Z.coins[z]=q.common.Coin.fromObject(L.coins[z])}}if(L.poolDeduct!=null)Z.poolDeduct=String(L.poolDeduct);return Z},H.toObject=function(L,Z){if(!Z)Z={};let z={};if(Z.arrays||Z.defaults)z.coins=[];if(Z.defaults)z.poolDeduct="";if(L.coins?.length){z.coins=[];for(let Q=0;Q<L.coins.length;++Q)z.coins[Q]=q.common.Coin.toObject(L.coins[Q],Z)}if(L.poolDeduct!=null&&L.hasOwnProperty("poolDeduct"))z.poolDeduct=L.poolDeduct;return z},H.prototype.toJSON=function(){return this.constructor.toObject(this,k.util.toJSONOptions)},H})(),Y.ProtoUint=(()=>{function H(X){if(X){for(let L=Object.keys(X),Z=0;Z<L.length;++Z)if(X[L[Z]]!=null)this[L[Z]]=X[L[Z]]}}return H.prototype.value="",H.create=function(L){return new H(L)},H.encode=function(L,Z){if(!Z)Z=f.create();if(L.value!=null&&Object.hasOwnProperty.call(L,"value"))Z.uint32(10).string(L.value);return Z},H.encodeDelimited=function(L,Z){return this.encode(L,Z).ldelim()},H.decode=function(L,Z){if(!(L instanceof B))L=B.create(L);let z=Z===void 0?L.len:L.pos+Z,Q=new q.common.ProtoUint;while(L.pos<z){let J=L.uint32();switch(J>>>3){case 1:Q.value=L.string();break;default:L.skipType(J&7);break}}return Q},H.decodeDelimited=function(L){if(!(L instanceof B))L=new B(L);return this.decode(L,L.uint32())},H.verify=function(L){if(typeof L!=="object"||L===null)return"object expected";if(L.value!=null&&L.hasOwnProperty("value")){if(!W.isString(L.value))return"value: string expected"}return null},H.fromObject=function(L){if(L instanceof q.common.ProtoUint)return L;let Z=new q.common.ProtoUint;if(L.value!=null)Z.value=String(L.value);return Z},H.toObject=function(L,Z){if(!Z)Z={};let z={};if(Z.defaults)z.value="";if(L.value!=null&&L.hasOwnProperty("value"))z.value=L.value;return z},H.prototype.toJSON=function(){return this.constructor.toObject(this,k.util.toJSONOptions)},H})(),Y})();q.types=(()=>{let Y={};return Y.MsgDeposit=(()=>{function H(X){if(this.coins=[],X){for(let L=Object.keys(X),Z=0;Z<L.length;++Z)if(X[L[Z]]!=null)this[L[Z]]=X[L[Z]]}}return H.prototype.coins=W.emptyArray,H.prototype.memo="",H.prototype.signer=W.newBuffer([]),H.create=function(L){return new H(L)},H.encode=function(L,Z){if(!Z)Z=f.create();if(L.coins?.length)for(let z=0;z<L.coins.length;++z)q.common.Coin.encode(L.coins[z],Z.uint32(10).fork()).ldelim();if(L.memo!=null&&Object.hasOwnProperty.call(L,"memo"))Z.uint32(18).string(L.memo);if(L.signer!=null&&Object.hasOwnProperty.call(L,"signer"))Z.uint32(26).bytes(L.signer);return Z},H.encodeDelimited=function(L,Z){return this.encode(L,Z).ldelim()},H.decode=function(L,Z){if(!(L instanceof B))L=B.create(L);let z=Z===void 0?L.len:L.pos+Z,Q=new q.types.MsgDeposit;while(L.pos<z){let J=L.uint32();switch(J>>>3){case 1:if(!Q.coins?.length)Q.coins=[];Q.coins.push(q.common.Coin.decode(L,L.uint32()));break;case 2:Q.memo=L.string();break;case 3:Q.signer=L.bytes();break;default:L.skipType(J&7);break}}return Q},H.decodeDelimited=function(L){if(!(L instanceof B))L=new B(L);return this.decode(L,L.uint32())},H.verify=function(L){if(typeof L!=="object"||L===null)return"object expected";if(L.coins!=null&&L.hasOwnProperty("coins")){if(!Array.isArray(L.coins))return"coins: array expected";for(let Z=0;Z<L.coins.length;++Z){let z=q.common.Coin.verify(L.coins[Z]);if(z)return"coins."+z}}if(L.memo!=null&&L.hasOwnProperty("memo")){if(!W.isString(L.memo))return"memo: string expected"}if(L.signer!=null&&L.hasOwnProperty("signer")){if(!(L.signer&&typeof L.signer.length==="number"||W.isString(L.signer)))return"signer: buffer expected"}return null},H.fromObject=function(L){if(L instanceof q.types.MsgDeposit)return L;let Z=new q.types.MsgDeposit;if(L.coins){if(!Array.isArray(L.coins))throw TypeError(".types.MsgDeposit.coins: array expected");Z.coins=[];for(let z=0;z<L.coins.length;++z){if(typeof L.coins[z]!=="object")throw TypeError(".types.MsgDeposit.coins: object expected");Z.coins[z]=q.common.Coin.fromObject(L.coins[z])}}if(L.memo!=null)Z.memo=String(L.memo);if(L.signer!=null){if(typeof L.signer==="string")W.base64.decode(L.signer,Z.signer=W.newBuffer(W.base64.length(L.signer)),0);else if(L.signer.length)Z.signer=L.signer}return Z},H.toObject=function(L,Z){if(!Z)Z={};let z={};if(Z.arrays||Z.defaults)z.coins=[];if(Z.defaults){if(z.memo="",Z.bytes===String)z.signer="";else if(z.signer=[],Z.bytes!==Array)z.signer=W.newBuffer(z.signer)}if(L.coins?.length){z.coins=[];for(let Q=0;Q<L.coins.length;++Q)z.coins[Q]=q.common.Coin.toObject(L.coins[Q],Z)}if(L.memo!=null&&L.hasOwnProperty("memo"))z.memo=L.memo;if(L.signer!=null&&L.hasOwnProperty("signer"))z.signer=Z.bytes===String?W.base64.encode(L.signer,0,L.signer.length):Z.bytes===Array?Array.prototype.slice.call(L.signer):L.signer;return z},H.prototype.toJSON=function(){return this.constructor.toObject(this,k.util.toJSONOptions)},H})(),Y.MsgSend=(()=>{function H(X){if(this.amount=[],X){for(let L=Object.keys(X),Z=0;Z<L.length;++Z)if(X[L[Z]]!=null)this[L[Z]]=X[L[Z]]}}return H.prototype.fromAddress=W.newBuffer([]),H.prototype.toAddress=W.newBuffer([]),H.prototype.amount=W.emptyArray,H.create=function(L){return new H(L)},H.encode=function(L,Z){if(!Z)Z=f.create();if(L.fromAddress!=null&&Object.hasOwnProperty.call(L,"fromAddress"))Z.uint32(10).bytes(L.fromAddress);if(L.toAddress!=null&&Object.hasOwnProperty.call(L,"toAddress"))Z.uint32(18).bytes(L.toAddress);if(L.amount?.length)for(let z=0;z<L.amount.length;++z)q.cosmos.base.v1beta1.Coin.encode(L.amount[z],Z.uint32(26).fork()).ldelim();return Z},H.encodeDelimited=function(L,Z){return this.encode(L,Z).ldelim()},H.decode=function(L,Z){if(!(L instanceof B))L=B.create(L);let z=Z===void 0?L.len:L.pos+Z,Q=new q.types.MsgSend;while(L.pos<z){let J=L.uint32();switch(J>>>3){case 1:Q.fromAddress=L.bytes();break;case 2:Q.toAddress=L.bytes();break;case 3:if(!Q.amount?.length)Q.amount=[];Q.amount.push(q.cosmos.base.v1beta1.Coin.decode(L,L.uint32()));break;default:L.skipType(J&7);break}}return Q},H.decodeDelimited=function(L){if(!(L instanceof B))L=new B(L);return this.decode(L,L.uint32())},H.verify=function(L){if(typeof L!=="object"||L===null)return"object expected";if(L.fromAddress!=null&&L.hasOwnProperty("fromAddress")){if(!(L.fromAddress&&typeof L.fromAddress.length==="number"||W.isString(L.fromAddress)))return"fromAddress: buffer expected"}if(L.toAddress!=null&&L.hasOwnProperty("toAddress")){if(!(L.toAddress&&typeof L.toAddress.length==="number"||W.isString(L.toAddress)))return"toAddress: buffer expected"}if(L.amount!=null&&L.hasOwnProperty("amount")){if(!Array.isArray(L.amount))return"amount: array expected";for(let Z=0;Z<L.amount.length;++Z){let z=q.cosmos.base.v1beta1.Coin.verify(L.amount[Z]);if(z)return"amount."+z}}return null},H.fromObject=function(L){if(L instanceof q.types.MsgSend)return L;let Z=new q.types.MsgSend;if(L.fromAddress!=null){if(typeof L.fromAddress==="string")W.base64.decode(L.fromAddress,Z.fromAddress=W.newBuffer(W.base64.length(L.fromAddress)),0);else if(L.fromAddress.length)Z.fromAddress=L.fromAddress}if(L.toAddress!=null){if(typeof L.toAddress==="string")W.base64.decode(L.toAddress,Z.toAddress=W.newBuffer(W.base64.length(L.toAddress)),0);else if(L.toAddress.length)Z.toAddress=L.toAddress}if(L.amount){if(!Array.isArray(L.amount))throw TypeError(".types.MsgSend.amount: array expected");Z.amount=[];for(let z=0;z<L.amount.length;++z){if(typeof L.amount[z]!=="object")throw TypeError(".types.MsgSend.amount: object expected");Z.amount[z]=q.cosmos.base.v1beta1.Coin.fromObject(L.amount[z])}}return Z},H.toObject=function(L,Z){if(!Z)Z={};let z={};if(Z.arrays||Z.defaults)z.amount=[];if(Z.defaults){if(Z.bytes===String)z.fromAddress="";else if(z.fromAddress=[],Z.bytes!==Array)z.fromAddress=W.newBuffer(z.fromAddress);if(Z.bytes===String)z.toAddress="";else if(z.toAddress=[],Z.bytes!==Array)z.toAddress=W.newBuffer(z.toAddress)}if(L.fromAddress!=null&&L.hasOwnProperty("fromAddress"))z.fromAddress=Z.bytes===String?W.base64.encode(L.fromAddress,0,L.fromAddress.length):Z.bytes===Array?Array.prototype.slice.call(L.fromAddress):L.fromAddress;if(L.toAddress!=null&&L.hasOwnProperty("toAddress"))z.toAddress=Z.bytes===String?W.base64.encode(L.toAddress,0,L.toAddress.length):Z.bytes===Array?Array.prototype.slice.call(L.toAddress):L.toAddress;if(L.amount?.length){z.amount=[];for(let Q=0;Q<L.amount.length;++Q)z.amount[Q]=q.cosmos.base.v1beta1.Coin.toObject(L.amount[Q],Z)}return z},H.prototype.toJSON=function(){return this.constructor.toObject(this,k.util.toJSONOptions)},H})(),Y})();q.cosmos=(()=>{let Y={};return Y.base=(()=>{let H={};return H.v1beta1=(()=>{let X={};return X.Coin=(()=>{function L(Z){if(Z){for(let z=Object.keys(Z),Q=0;Q<z.length;++Q)if(Z[z[Q]]!=null)this[z[Q]]=Z[z[Q]]}}return L.prototype.denom="",L.prototype.amount="",L.create=function(z){return new L(z)},L.encode=function(z,Q){if(!Q)Q=f.create();if(z.denom!=null&&Object.hasOwnProperty.call(z,"denom"))Q.uint32(10).string(z.denom);if(z.amount!=null&&Object.hasOwnProperty.call(z,"amount"))Q.uint32(18).string(z.amount);return Q},L.encodeDelimited=function(z,Q){return this.encode(z,Q).ldelim()},L.decode=function(z,Q){if(!(z instanceof B))z=B.create(z);let J=Q===void 0?z.len:z.pos+Q,G=new q.cosmos.base.v1beta1.Coin;while(z.pos<J){let _=z.uint32();switch(_>>>3){case 1:G.denom=z.string();break;case 2:G.amount=z.string();break;default:z.skipType(_&7);break}}return G},L.decodeDelimited=function(z){if(!(z instanceof B))z=new B(z);return this.decode(z,z.uint32())},L.verify=function(z){if(typeof z!=="object"||z===null)return"object expected";if(z.denom!=null&&z.hasOwnProperty("denom")){if(!W.isString(z.denom))return"denom: string expected"}if(z.amount!=null&&z.hasOwnProperty("amount")){if(!W.isString(z.amount))return"amount: string expected"}return null},L.fromObject=function(z){if(z instanceof q.cosmos.base.v1beta1.Coin)return z;let Q=new q.cosmos.base.v1beta1.Coin;if(z.denom!=null)Q.denom=String(z.denom);if(z.amount!=null)Q.amount=String(z.amount);return Q},L.toObject=function(z,Q){if(!Q)Q={};let J={};if(Q.defaults)J.denom="",J.amount="";if(z.denom!=null&&z.hasOwnProperty("denom"))J.denom=z.denom;if(z.amount!=null&&z.hasOwnProperty("amount"))J.amount=z.amount;return J},L.prototype.toJSON=function(){return this.constructor.toObject(this,k.util.toJSONOptions)},L})(),X.DecCoin=(()=>{function L(Z){if(Z){for(let z=Object.keys(Z),Q=0;Q<z.length;++Q)if(Z[z[Q]]!=null)this[z[Q]]=Z[z[Q]]}}return L.prototype.denom="",L.prototype.amount="",L.create=function(z){return new L(z)},L.encode=function(z,Q){if(!Q)Q=f.create();if(z.denom!=null&&Object.hasOwnProperty.call(z,"denom"))Q.uint32(10).string(z.denom);if(z.amount!=null&&Object.hasOwnProperty.call(z,"amount"))Q.uint32(18).string(z.amount);return Q},L.encodeDelimited=function(z,Q){return this.encode(z,Q).ldelim()},L.decode=function(z,Q){if(!(z instanceof B))z=B.create(z);let J=Q===void 0?z.len:z.pos+Q,G=new q.cosmos.base.v1beta1.DecCoin;while(z.pos<J){let _=z.uint32();switch(_>>>3){case 1:G.denom=z.string();break;case 2:G.amount=z.string();break;default:z.skipType(_&7);break}}return G},L.decodeDelimited=function(z){if(!(z instanceof B))z=new B(z);return this.decode(z,z.uint32())},L.verify=function(z){if(typeof z!=="object"||z===null)return"object expected";if(z.denom!=null&&z.hasOwnProperty("denom")){if(!W.isString(z.denom))return"denom: string expected"}if(z.amount!=null&&z.hasOwnProperty("amount")){if(!W.isString(z.amount))return"amount: string expected"}return null},L.fromObject=function(z){if(z instanceof q.cosmos.base.v1beta1.DecCoin)return z;let Q=new q.cosmos.base.v1beta1.DecCoin;if(z.denom!=null)Q.denom=String(z.denom);if(z.amount!=null)Q.amount=String(z.amount);return Q},L.toObject=function(z,Q){if(!Q)Q={};let J={};if(Q.defaults)J.denom="",J.amount="";if(z.denom!=null&&z.hasOwnProperty("denom"))J.denom=z.denom;if(z.amount!=null&&z.hasOwnProperty("amount"))J.amount=z.amount;return J},L.prototype.toJSON=function(){return this.constructor.toObject(this,k.util.toJSONOptions)},L})(),X.IntProto=(()=>{function L(Z){if(Z){for(let z=Object.keys(Z),Q=0;Q<z.length;++Q)if(Z[z[Q]]!=null)this[z[Q]]=Z[z[Q]]}}return L.prototype.int="",L.create=function(z){return new L(z)},L.encode=function(z,Q){if(!Q)Q=f.create();if(z.int!=null&&Object.hasOwnProperty.call(z,"int"))Q.uint32(10).string(z.int);return Q},L.encodeDelimited=function(z,Q){return this.encode(z,Q).ldelim()},L.decode=function(z,Q){if(!(z instanceof B))z=B.create(z);let J=Q===void 0?z.len:z.pos+Q,G=new q.cosmos.base.v1beta1.IntProto;while(z.pos<J){let _=z.uint32();switch(_>>>3){case 1:G.int=z.string();break;default:z.skipType(_&7);break}}return G},L.decodeDelimited=function(z){if(!(z instanceof B))z=new B(z);return this.decode(z,z.uint32())},L.verify=function(z){if(typeof z!=="object"||z===null)return"object expected";if(z.int!=null&&z.hasOwnProperty("int")){if(!W.isString(z.int))return"int: string expected"}return null},L.fromObject=function(z){if(z instanceof q.cosmos.base.v1beta1.IntProto)return z;let Q=new q.cosmos.base.v1beta1.IntProto;if(z.int!=null)Q.int=String(z.int);return Q},L.toObject=function(z,Q){if(!Q)Q={};let J={};if(Q.defaults)J.int="";if(z.int!=null&&z.hasOwnProperty("int"))J.int=z.int;return J},L.prototype.toJSON=function(){return this.constructor.toObject(this,k.util.toJSONOptions)},L})(),X.DecProto=(()=>{function L(Z){if(Z){for(let z=Object.keys(Z),Q=0;Q<z.length;++Q)if(Z[z[Q]]!=null)this[z[Q]]=Z[z[Q]]}}return L.prototype.dec="",L.create=function(z){return new L(z)},L.encode=function(z,Q){if(!Q)Q=f.create();if(z.dec!=null&&Object.hasOwnProperty.call(z,"dec"))Q.uint32(10).string(z.dec);return Q},L.encodeDelimited=function(z,Q){return this.encode(z,Q).ldelim()},L.decode=function(z,Q){if(!(z instanceof B))z=B.create(z);let J=Q===void 0?z.len:z.pos+Q,G=new q.cosmos.base.v1beta1.DecProto;while(z.pos<J){let _=z.uint32();switch(_>>>3){case 1:G.dec=z.string();break;default:z.skipType(_&7);break}}return G},L.decodeDelimited=function(z){if(!(z instanceof B))z=new B(z);return this.decode(z,z.uint32())},L.verify=function(z){if(typeof z!=="object"||z===null)return"object expected";if(z.dec!=null&&z.hasOwnProperty("dec")){if(!W.isString(z.dec))return"dec: string expected"}return null},L.fromObject=function(z){if(z instanceof q.cosmos.base.v1beta1.DecProto)return z;let Q=new q.cosmos.base.v1beta1.DecProto;if(z.dec!=null)Q.dec=String(z.dec);return Q},L.toObject=function(z,Q){if(!Q)Q={};let J={};if(Q.defaults)J.dec="";if(z.dec!=null&&z.hasOwnProperty("dec"))J.dec=z.dec;return J},L.prototype.toJSON=function(){return this.constructor.toObject(this,k.util.toJSONOptions)},L})(),X})(),H})(),Y})()});import{Chain as A4}from"@swapkit/helpers";async function l(){let{$root:Y}=await Promise.resolve().then(() => (l6(),h6)),H=await import("@cosmjs/proto-signing"),X=H.Registry??H.default?.Registry,L=await import("@cosmjs/stargate"),Z=L.defaultRegistryTypes??L.default?.defaultRegistryTypes;return new X([...Z,["/types.MsgSend",Y.types.MsgSend],["/types.MsgDeposit",Y.types.MsgDeposit]])}async function C(Y){let H=await import("@cosmjs/stargate"),X=H.AminoTypes??H.default?.AminoTypes,L=Y===A4.THORChain?"thorchain":"mayachain";return new X({"/types.MsgDeposit":{aminoType:`${L}/MsgDeposit`,fromAmino:({signer:Z,...z})=>({...z,signer:i(Z)}),toAmino:({signer:Z,...z})=>({...z,signer:o(Z)})},"/types.MsgSend":{aminoType:`${L}/MsgSend`,fromAmino:({from_address:Z,to_address:z,...Q})=>({...Q,fromAddress:i(Z),toAddress:i(z)}),toAmino:({fromAddress:Z,toAddress:z,...Q})=>({...Q,from_address:o(Z),to_address:o(z)})}})}var I6=F(()=>{q6()});import{AssetValue as k4,Chain as L6,getChainConfig as j6,SwapKitError as R4}from"@swapkit/helpers";function O6(Y){return function(X){let{assetValue:L,recipient:Z,memo:z,sender:Q,asSignable:J,asAminoMessage:G}=X;if(Z)return p6(Y)({asAminoMessage:G,asSignable:J,assetValue:L,memo:z,recipient:Z,sender:Q});return c6(Y)({asAminoMessage:G,asSignable:J,assetValue:L,memo:z,sender:Q})}}function $(Y){if(Y.type==="thorchain/MsgSend"||Y.type==="mayachain/MsgSend")return Y;return{...Y,value:{...Y.value,coins:Y.value.coins.map((H)=>{let X=k4.from({asset:H.asset}),L=(X.isSynthetic?X.symbol.split("/")?.[1]:X.symbol)?.toUpperCase(),Z=(X.isSynthetic?X.symbol.split("/")?.[0]:X.chain)?.toUpperCase();return{...H,asset:{chain:Z,symbol:L,synth:X.isSynthetic,ticker:X.ticker}}})}}}async function r({chain:Y,memo:H,msgs:X}){let L=await l(),Z=await C(Y),z={typeUrl:"/cosmos.tx.v1beta1.TxBody",value:{memo:H,messages:X.map((Q)=>Z.fromAmino(Q))}};return L.encode(z)}var V4,M4,E6=({sender:Y,recipient:H,assetValue:X})=>{return{type:`${X.chain===L6.Maya?"mayachain":"thorchain"}/MsgSend`,value:{amount:[{amount:X.getBaseValue("string"),denom:D(X.symbol,!0)}],from_address:Y,to_address:H}}},N6=({sender:Y,assetValue:H,memo:X=""})=>{return{type:`${H.chain===L6.Maya?"mayachain":"thorchain"}/MsgDeposit`,value:{coins:[{amount:H.getBaseValue("string"),asset:b(H)}],memo:X,signer:Y}}},z6=({sender:Y,recipient:H,assetValue:X,memo:L})=>{return!H?N6({assetValue:X,memo:L,sender:Y}):E6({assetValue:X,recipient:H,sender:Y})},w=async(Y,H)=>{return(await C(H)).fromAmino(Y)},b6=async({rpcUrl:Y,sender:H})=>{let L=await(await P(Y)).getAccount(H);if(!L)throw new R4("toolbox_cosmos_account_not_found",{sender:H});return L},p6=(Y)=>async({sender:H,recipient:X,assetValue:L,memo:Z="",asSignable:z=!0,asAminoMessage:Q=!1,sequence:J,accountNumber:G})=>{let _=await b6({rpcUrl:Y,sender:H}),K=L.chain,{chainId:A}=j6(K),T=E6({assetValue:L,recipient:X,sender:H}),N=z?await w(Q?T:$(T),K):T;return{accountNumber:G||_.accountNumber,chainId:A,fee:S(K),memo:Z,msgs:[N],sequence:J||_.sequence}},c6=(Y)=>async({sender:H,assetValue:X,memo:L="",asSignable:Z=!0,asAminoMessage:z=!1,sequence:Q,accountNumber:J})=>{let G=await b6({rpcUrl:Y,sender:H}),_=X.chain,{chainId:K}=j6(_),A=N6({assetValue:X,memo:L,sender:H}),T=Z?await w(z?A:$(A),_):A;return{accountNumber:J||G.accountNumber,chainId:K,fee:S(_),memo:L,msgs:[T],sequence:Q||G.sequence}};var d6=F(()=>{t();I6();V4=S(L6.THORChain).gas,M4=S(L6.Maya).gas});var n6=()=>{};var m6=F(()=>{n6()});var x6=F(()=>{q6();d6();I6();m6()});import{base64 as k6,bech32 as U6}from"@scure/base";import{AssetValue as Z6,applyFeeMultiplier as g6,Chain as R,CosmosChainPrefixes as a6,DerivationPath as F4,derivationPathToString as i6,FeeOption as Q6,getChainConfig as f4,getRPCUrl as y4,NetworkDerivationPath as D4,SwapKitError as H6,SwapKitNumber as v6,updateDerivationPath as S4}from"@swapkit/helpers";import{SwapKitApi as s6}from"@swapkit/helpers/api";import{match as P4,P as o6}from"ts-pattern";async function V6(Y,H){try{let L=(await s6.getGasRate()).find((Z)=>Z.chainId===Y)?.value;return L?Number.parseFloat(L):H}catch{return H}}async function R6({phrase:Y,prefix:H,...X}){let L=await import("@cosmjs/proto-signing"),Z=L.DirectSecp256k1HdWallet??L.default?.DirectSecp256k1HdWallet,z=await import("@cosmjs/crypto"),Q=z.stringToPath??z.default?.stringToPath,J="derivationPath"in X?X.derivationPath:`${F4[X.chain]}/${X.index}`;return Z.fromMnemonic(Y,{hdPaths:[Q(J)],prefix:H})}async function C4({privateKey:Y,prefix:H}){let X=await import("@cosmjs/proto-signing");return(X.DirectSecp256k1Wallet??X.default?.DirectSecp256k1Wallet).fromKey(Y,H)}function e6(Y){return async function({signature:X,message:L,address:Z}){let z=await Y(Z);if(!z?.pubkey)throw new H6("toolbox_cosmos_verify_signature_no_pubkey");let Q=await import("@cosmjs/crypto"),J=Q.Secp256k1Signature??Q.default?.Secp256k1Signature,G=Q.Secp256k1??Q.default?.Secp256k1,_=J.fromFixedLength(k6.decode(X));return G.verifySignature(_,k6.decode(L),z.pubkey.value)}}async function a({chain:Y,...H}){let X=await y4(Y),L=a6[Y],Z="index"in H?H.index||0:0,z=i6("derivationPath"in H&&H.derivationPath?H.derivationPath:S4(D4[Y],{index:Z})),Q=await P4(H).with({phrase:o6.string},({phrase:T})=>R6({derivationPath:z,phrase:T,prefix:L})).with({signer:o6.any},({signer:T})=>T).otherwise(()=>{return});async function J(T){return(await P(X)).getAccount(T)}async function G(){let[T]=await Q?.getAccounts()||[];return T?.address}async function _(){let[T]=await Q?.getAccounts()||[];if(!T?.pubkey)throw new H6("toolbox_cosmos_signer_not_defined");return k6.encode(T?.pubkey)}async function K({recipient:T,assetValue:N,memo:E="",feeRate:x,feeOptionKey:O=Q6.Fast}){let V=await G();if(!(Q&&V))throw new H6("toolbox_cosmos_signer_not_defined");let M=Z6.from({chain:Y}),c=b(M),d=x||t6((await A6(Y,K6[Y]))[O],c),n=await p(X,Q),u=D(N.symbol),h=N.getBaseValue("string"),{TxRaw:m}=await import("cosmjs-types/cosmos/tx/v1beta1/tx"),g={amount:[{amount:h,denom:u}],fromAddress:V,toAddress:T},y6=await n.sign(V,[{typeUrl:"/cosmos.bank.v1beta1.MsgSend",value:g}],d,E),Y6=m.encode(y6).finish();return Buffer.from(Y6).toString("hex")}async function A({recipient:T,assetValue:N,memo:E="",feeRate:x,feeOptionKey:O=Q6.Fast,dryRun:V=!1}){if(V)return K({assetValue:N,feeOptionKey:O,feeRate:x,memo:E,recipient:T});let M=await G();if(!(Q&&M))throw new H6("toolbox_cosmos_signer_not_defined");let c=Z6.from({chain:Y}),d=b(c),n=x||t6((await A6(Y,K6[Y]))[O],d),u=await p(X,Q),h=D(N.symbol),m=[{amount:N.getBaseValue("string"),denom:h}],{transactionHash:g}=await u.sendTokens(M,T,m,n,E);return g}return{createPrivateKeyFromPhrase:h4(z),createTransaction:T6,fetchFeeRateFromSwapKit:V6,getAccount:J,getAddress:G,getBalance:async(T,N)=>{let E=await r6(X)(T),x=await Promise.all(E.filter(({denom:O})=>O&&!O.includes("IBC/")&&!([R.THORChain,R.Maya].includes(Y)&&O.split("-").length>2)).map(({denom:O,amount:V})=>{let M=[R.THORChain,R.Maya].includes(Y)&&(O.includes("/")||O.includes("˜"))?`${Y}.${O}`:O;return _6(M,V)}));if(x.length===0)return[Z6.from({chain:Y})];return x},getBalanceAsDenoms:r6(X),getFees:()=>A6(Y,K6[Y]),getPubKey:_,getSignerFromPhrase:async({phrase:T,derivationPath:N})=>R6({derivationPath:i6(N),index:Z,phrase:T,prefix:L}),getSignerFromPrivateKey:async(T)=>{let N=await import("@cosmjs/proto-signing");return(N.DirectSecp256k1Wallet??N.default?.DirectSecp256k1Wallet).fromKey(T,L)},signTransaction:K,transfer:A,validateAddress:L4(Y),verifySignature:e6(J)}}async function w4(Y,H){try{let L=(await s6.getGasRate()).find((Z)=>Z.chainId===Y)?.value;return L?Number.parseFloat(L):H}catch{return H}}function $4({assetValue:{chain:Y}}){return Z6.from({chain:Y,value:u4(Y)})}async function A6(Y,H){let{chainId:X,baseDecimal:L}=f4(Y),Z=await V6(X,H);return{average:v6.fromBigInt(BigInt(Z),L),fast:v6.fromBigInt(BigInt(g6(Z,Q6.Fast,!0)),L),fastest:v6.fromBigInt(BigInt(g6(Z,Q6.Fastest,!0)),L)}}function t6(Y,H){return{amount:[{amount:Y.getBaseValue("string"),denom:H}],gas:"200000"}}function u4(Y){return{[R.Cosmos]:0.007,[R.Kujira]:0.02,[R.Noble]:0.01,[R.THORChain]:0.02,[R.Maya]:0.02,[R.Harbor]:0.02}[Y]||0}function L4(Y){let H=a6[Y];return function(L){if(!L.startsWith(H))return!1;try{let{prefix:Z,words:z}=U6.decode(L);return U6.encode(Z,z)===L.toLocaleLowerCase()}catch{return!1}}}function r6(Y){return async function(X){return(await(await P(Y)).getAllBalances(X)).map((Q)=>({...Q,denom:Q.denom.includes("/")?Q.denom.toUpperCase():Q.denom}))}}function h4(Y){return async function(X){let L=await import("@cosmjs/crypto"),Z=L.stringToPath??L.default?.stringToPath,z=L.Slip10Curve??L.default?.Slip10Curve,Q=L.Slip10??L.default?.Slip10,J=L.EnglishMnemonic??L.default?.EnglishMnemonic,G=L.Bip39??L.default?.Bip39,_=new J(X),K=await G.mnemonicToSeed(_),{privkey:A}=Q.derivePath(z.Secp256k1,K,Z(Y));return A}}var K6;var X6=F(()=>{t();K6={[R.Cosmos]:1000,[R.Kujira]:1000,[R.Noble]:1000,[R.THORChain]:5000000,[R.Maya]:5000000,[R.Harbor]:5000000}});import{base64 as j}from"@scure/base";import{Chain as l4,CosmosChainPrefixes as j4,derivationPathToString as b4,FeeOption as M6,getChainConfig as z4,getRPCUrl as p4,NetworkDerivationPath as c4,RequestClient as d4,SKConfig as n4,SwapKitError as Z4,SwapKitNumber as H4,updateDerivationPath as m4}from"@swapkit/helpers";import{match as g4,P as Q4}from"ts-pattern";function i4({prefix:Y,derivationPath:H}){return async function(L,Z=0){let z=await import("@cosmjs/amino"),Q=z.Secp256k1HdWallet??z.default?.Secp256k1HdWallet,J=await import("@cosmjs/crypto"),G=J.stringToPath??J.default?.stringToPath;return Q.fromMnemonic(L,{hdPaths:[G(`${H}/${Z}`)],prefix:Y})}}function o4(Y){return j.encode(Y)}function t4(Y){return async function({wallet:X,tx:L}){let{msgs:Z,accountNumber:z,sequence:Q,chainId:J,fee:G,memo:_}=typeof L==="string"?JSON.parse(L):L,K=(await X.getAccounts())?.[0]?.address||"",A=await C(Y),T=await l(),N=await G6(X,{aminoTypes:A,registry:T}),E=[];for(let V of Z){let M=await w(V,Y);E.push(M)}let{signatures:[x]}=await N.sign(K,E,G,_,{accountNumber:z,chainId:J,sequence:Q});return{bodyBytes:await r({chain:Y,memo:_,msgs:Z.map($)}),signature:o4(x)}}}function r4({prefix:Y,rpcUrl:H}){return async function(L,Z,z,Q,J){let{encodeSecp256k1Pubkey:G,pubkeyToAddress:_}=(await import("@cosmjs/amino")).default,{makeMultisignedTxBytes:K}=(await import("@cosmjs/stargate")).default,{sequence:A,fee:T}=JSON.parse(L),N=await X4(z,Q),E=Z.map((V)=>[_(G(j.decode(V.pubKey)),Y),j.decode(V.signature)]),x=await P(H),{transactionHash:O}=await x.broadcastTx(K(N,A,T,J,new Map(E)));return O}}async function X4(Y,H,X=!0){let{createMultisigThresholdPubkey:L,encodeSecp256k1Pubkey:Z}=(await import("@cosmjs/amino")).default;return L(Y.map((z)=>Z(j.decode(z))),H,X)}function a4(Y){return j.decode(Y)}async function s4({privateKey:Y,message:H}){let{Secp256k1:X}=(await import("@cosmjs/crypto")).default,L=await X.createSignature(j.decode(H),Y);return j.encode(Buffer.concat([L.r(32),L.s(32)]))}async function F6({chain:Y,...H}){let X=await p4(Y),{nodeUrl:L}=z4(Y),{isStagenet:Z}=n4.get("envs"),z=Y===l4.THORChain,Q=`${Z?"s":""}${j4[Y]}`,J="index"in H?H.index||0:0,G="derivationPath"in H&&H.derivationPath?H.derivationPath:m4(c4[Y],{index:J}),_=await a({chain:Y,...H}),K=await g4(H).with({phrase:Q4.string},({phrase:E})=>_.getSignerFromPhrase({derivationPath:G,phrase:E})).with({signer:Q4.any},({signer:E})=>E).otherwise(()=>{return}),A=S(Y);async function T(){let E,x=`${L}/${z?"thorchain":"mayachain"}/constants`;try{let{int_64_values:{NativeTransactionFee:O}}=await d4.get(x);if(!O||Number.isNaN(O)||O<0)throw new Z4("toolbox_cosmos_invalid_fee",{nativeFee:O.toString()});E=new H4(O)}catch{E=new H4({decimal:z4(Y).baseDecimal,value:z?0.02:1})}return{[M6.Average]:E,[M6.Fast]:E,[M6.Fastest]:E}}async function N({assetValue:E,memo:x="",recipient:O}){let{TxRaw:V}=await import("cosmjs-types/cosmos/tx/v1beta1/tx"),M=(await K?.getAccounts())?.[0]?.address;if(!(M&&K))throw new Z4("toolbox_cosmos_no_signer");let c="signAmino"in K,d=await l(),n=await C(Y),u=await p(X,K,{aminoTypes:n,registry:d}),h=z6({assetValue:E,memo:x,recipient:O,sender:M});if(c){let Y6=await w(h,Y),{signatures:J4,authInfoBytes:q4}=await u.sign(M,[Y6],A,x),W4=V.encode({authInfoBytes:q4,bodyBytes:await r({chain:Y,memo:x,msgs:[h].map($)}),signatures:J4}).finish();return(await u.broadcastTx(W4)).transactionHash}let m=$(h),g=await w(m,Y);return(await u.signAndBroadcast(M,[g],A,x)).transactionHash}return{..._,broadcastMultisigTx:r4({prefix:Q,rpcUrl:X}),buildAminoMsg:z6,buildEncodedTxBody:r,convertToSignable:w,createDefaultAminoTypes:()=>C(Y),createDefaultRegistry:l,createMultisig:X4,createTransaction:O6(X),deposit:N,getFees:T,importSignature:a4,parseAminoMessageForDirectSigning:$,pubkeyToAddress:async(E)=>{let{pubkeyToAddress:x}=(await import("@cosmjs/amino")).default;return x(E,Q)},secp256k1HdWalletFromMnemonic:i4({derivationPath:b4(G),prefix:Q}),signMultisigTx:t4(Y),signWithPrivateKey:s4,transfer:N}}var f6=F(()=>{x6();t();X6()});import{Chain as s,SwapKitError as e4}from"@swapkit/helpers";var LL=(Y,H)=>{switch(Y){case s.Cosmos:case s.Kujira:case s.Noble:return a({chain:Y,...H});case s.Maya:case s.THORChain:return F6({chain:Y,...H});default:throw new e4("toolbox_cosmos_not_supported",{chain:Y})}};var Y4=F(()=>{X6();f6();X6();f6()});var ZL={};D6(ZL,{verifySignature:()=>e6,transferMsgAmino:()=>E6,toBase64:()=>O4,parseAminoMessageForDirectSigning:()=>$,getSignerFromPrivateKey:()=>C4,getSignerFromPhrase:()=>R6,getMsgSendDenom:()=>D,getFeeRateFromSwapKit:()=>w4,getDenomWithChain:()=>b,getDefaultChainFee:()=>S,getCreateTransaction:()=>O6,getCosmosValidateAddress:()=>L4,getCosmosToolbox:()=>LL,getAssetFromDenom:()=>_6,fromBase64:()=>x4,fetchFeeRateFromSwapKit:()=>V6,estimateTransactionFee:()=>$4,depositMsgAmino:()=>N6,createThorchainToolbox:()=>F6,createStargateClient:()=>P,createSigningStargateClient:()=>p,createOfflineStargateClient:()=>G6,createDefaultRegistry:()=>l,createDefaultAminoTypes:()=>C,createCosmosToolbox:()=>a,cosmosCreateTransaction:()=>T6,convertToSignable:()=>w,buildTransferTx:()=>p6,buildEncodedTxBody:()=>r,buildDepositTx:()=>c6,buildAminoMsg:()=>z6,bech32ToBase64:()=>i,base64ToBech32:()=>o,YUM_KUJIRA_FACTORY_DENOM:()=>C6,USK_KUJIRA_FACTORY_DENOM:()=>B6,THORCHAIN_GAS_VALUE:()=>V4,MAYA_GAS_VALUE:()=>M4,DEFAULT_NOBLE_FEE_MAINNET:()=>u6,DEFAULT_KUJI_FEE_MAINNET:()=>$6,DEFAULT_COSMOS_FEE_MAINNET:()=>w6});var HL=F(()=>{x6();Y4();t()});HL();export{e6 as verifySignature,E6 as transferMsgAmino,O4 as toBase64,$ as parseAminoMessageForDirectSigning,C4 as getSignerFromPrivateKey,R6 as getSignerFromPhrase,D as getMsgSendDenom,w4 as getFeeRateFromSwapKit,b as getDenomWithChain,S as getDefaultChainFee,O6 as getCreateTransaction,L4 as getCosmosValidateAddress,LL as getCosmosToolbox,_6 as getAssetFromDenom,x4 as fromBase64,V6 as fetchFeeRateFromSwapKit,$4 as estimateTransactionFee,N6 as depositMsgAmino,F6 as createThorchainToolbox,P as createStargateClient,p as createSigningStargateClient,G6 as createOfflineStargateClient,l as createDefaultRegistry,C as createDefaultAminoTypes,a as createCosmosToolbox,T6 as cosmosCreateTransaction,w as convertToSignable,p6 as buildTransferTx,r as buildEncodedTxBody,c6 as buildDepositTx,z6 as buildAminoMsg,i as bech32ToBase64,o as base64ToBech32,C6 as YUM_KUJIRA_FACTORY_DENOM,B6 as USK_KUJIRA_FACTORY_DENOM,V4 as THORCHAIN_GAS_VALUE,M4 as MAYA_GAS_VALUE,u6 as DEFAULT_NOBLE_FEE_MAINNET,$6 as DEFAULT_KUJI_FEE_MAINNET,w6 as DEFAULT_COSMOS_FEE_MAINNET};
2
-
3
- //# debugId=3D1EBFE368C821DD64756E2164756E21
4
- //# sourceMappingURL=index.js.map
1
+ var G0=Object.defineProperty;var Z0=(H)=>H;function Q0(H,B){this[H]=Z0.bind(null,B)}var Cf=(H,B)=>{for(var _ in B)G0(H,_,{get:B[_],enumerable:!0,configurable:!0,set:Q0.bind(B,_)})};var U=(H,B)=>()=>(H&&(B=H(H=0)),B);var O=((H)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(H,{get:(B,_)=>(typeof require<"u"?require:B)[_]}):H)(function(H){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+H+'" is not supported')});import{base64 as s,bech32 as r}from"@scure/base";import{SwapKitError as X0}from"@swapkit/helpers";function b(H){return s.encode(Uint8Array.from(r.fromWords(r.decode(H).words)))}function d(H,B="thor"){return r.encode(B,r.toWords(s.decode(H)))}function I0(H){return s.encode(H)}function Y0(H){if(!H.match(/^[a-zA-Z0-9+/]*={0,2}$/))throw new X0("toolbox_cosmos_invalid_params",{error:"Invalid base64 string format"});return s.decode(H)}var Hf=()=>{};import{AssetValue as Lf,Chain as X,getChainConfig as C,getRPCUrl as q0,SwapKitError as Rf}from"@swapkit/helpers";function R(H){switch(H){case X.Maya:return{amount:[],gas:"10000000000"};case X.THORChain:return{amount:[],gas:"500000000"};case X.Kujira:return Pf;case X.Noble:return uf;default:return Df}}async function V(H){let B=await import("@cosmjs/stargate"),_=B.StargateClient??B.default?.StargateClient,f=typeof window<"u"?{}:{referer:"https://sdk.swapkit.dev",referrer:"https://sdk.swapkit.dev"};return _.connect({headers:f,url:H})}async function h(H,B,_={}){let f=await import("@cosmjs/stargate"),x=f.SigningStargateClient??f.default?.SigningStargateClient,T=f.GasPrice??f.default?.GasPrice,v=typeof _==="string"?_:"0.0003uatom",L=typeof _==="string"?{}:_;return x.connectWithSigner(H,B,{gasPrice:T.fromString(v),...L})}async function Wf(H,B){let _=await import("@cosmjs/stargate");return(_.SigningStargateClient??_.default?.SigningStargateClient).offline(H,B)}async function zf({sender:H,recipient:B,assetValue:_,memo:f="",feeRate:x,sequence:T,accountNumber:v}){let{chain:L,chainId:Z}=_,I=await q0(L),q=await(await V(I)).getAccount(H);if(!q)throw new Rf("toolbox_cosmos_account_not_found",{sender:H});let Y=Lf.from({chain:L}),G=D(Y.symbol),Q=R(L),N=G&&x?{amount:[{amount:x.toString(),denom:G}],gas:Q.gas}:Q,S={amount:[{amount:_.getBaseValue("string"),denom:D(_.symbol)}],fromAddress:H,toAddress:B};return{accountNumber:v??q.accountNumber,chainId:Z,fee:N,memo:f,msgs:[{typeUrl:J0(L),value:S}],sequence:T??q.sequence}}var yf="FACTORY/KUJIRA1QK00H5ATUTPSV900X202PXX42NPJR9THG58DNQPA72F2P7M2LUASE444A7/UUSK",Vf="FACTORY/KUJIRA1YGFXN0ER40KLCNCK8THLTUPRDXLCK6WVNPKF2K/UYUM",Df,Pf,uf,D=(H,B=!1)=>{if(B)return H.toLowerCase();switch(H){case"uUSK":case"USK":return yf;case"uYUM":case"YUM":return Vf;case"uKUJI":case"KUJI":return"ukuji";case"ATOM":case"uATOM":return"uatom";case"uUSDC":case"USDC":return"uusdc";default:return H}},i=({symbol:H,chain:B})=>{if(B===X.Maya)return(H.toUpperCase()!=="CACAO"?H:`${X.Maya}.${H}`).toUpperCase();if(B===X.THORChain)return(["RUNE","TCY","RUJI"].includes(H.toUpperCase())?`${X.THORChain}.${H}`:H).toUpperCase();return D(H,!1)},J0=(H)=>{switch(H){case X.Maya:case X.THORChain:return"/types.MsgSend";case X.Cosmos:case X.Kujira:case X.Noble:return"/cosmos.bank.v1beta1.MsgSend";default:throw new Rf("toolbox_cosmos_not_supported",{chain:H})}},N0,Gf=(H,B)=>{let _=N0[H.toLowerCase()];if(!_)return Lf.from({asset:H,fromBaseDecimal:8,value:B});let{chain:f,asset:x,decimals:T}=_,v=f?{chain:f}:{asset:x};return Lf.from({...v,fromBaseDecimal:T,value:B})};var o=U(()=>{Df={amount:[{amount:"500",denom:"uatom"}],gas:"200000"},Pf={amount:[{amount:"1000",denom:"ukuji"}],gas:"200000"},uf={amount:[{amount:"1000",denom:"uusdc"}],gas:"200000"};N0={atom:{chain:X.Cosmos,decimals:C(X.Cosmos).baseDecimal},cacao:{chain:X.Maya,decimals:10},kuji:{chain:X.Kujira,decimals:C(X.Kujira).baseDecimal},maya:{asset:`${X.Maya}.${X.Maya}`,decimals:4},rune:{chain:X.THORChain,decimals:C(X.THORChain).baseDecimal},tcy:{asset:"THOR.TCY",decimals:C(X.THORChain).baseDecimal},uatom:{chain:X.Cosmos,decimals:C(X.Cosmos).baseDecimal},ukuji:{chain:X.Kujira,decimals:C(X.Kujira).baseDecimal},usdc:{chain:X.Noble,decimals:C(X.Noble).baseDecimal},uusdc:{chain:X.Noble,decimals:C(X.Noble).baseDecimal},"x/kuji":{asset:"THOR.KUJI",decimals:C(X.THORChain).baseDecimal},[yf.toLowerCase()]:{asset:`${X.Kujira}.USK`,decimals:C(X.Kujira).baseDecimal}}});var Mf={};Cf(Mf,{$root:()=>y});import E from"protobufjs/minimal.js";var z,k,W,y;var wf=U(()=>{z=E.Reader,k=E.Writer,W=E.util,y=E.roots.default||(E.roots.default={});y.common=(()=>{let H={};return H.Asset=(()=>{function B(_){if(_){for(let f=Object.keys(_),x=0;x<f.length;++x)if(_[f[x]]!=null)this[f[x]]=_[f[x]]}}return B.prototype.chain="",B.prototype.symbol="",B.prototype.ticker="",B.prototype.synth=!1,B.create=function(f){return new B(f)},B.encode=function(f,x){if(!x)x=k.create();if(f.chain!=null&&Object.hasOwnProperty.call(f,"chain"))x.uint32(10).string(f.chain);if(f.symbol!=null&&Object.hasOwnProperty.call(f,"symbol"))x.uint32(18).string(f.symbol);if(f.ticker!=null&&Object.hasOwnProperty.call(f,"ticker"))x.uint32(26).string(f.ticker);if(f.synth!=null&&Object.hasOwnProperty.call(f,"synth"))x.uint32(32).bool(f.synth);return x},B.encodeDelimited=function(f,x){return this.encode(f,x).ldelim()},B.decode=function(f,x){if(!(f instanceof z))f=z.create(f);let T=x===void 0?f.len:f.pos+x,v=new y.common.Asset;while(f.pos<T){let L=f.uint32();switch(L>>>3){case 1:v.chain=f.string();break;case 2:v.symbol=f.string();break;case 3:v.ticker=f.string();break;case 4:v.synth=f.bool();break;default:f.skipType(L&7);break}}return v},B.decodeDelimited=function(f){if(!(f instanceof z))f=new z(f);return this.decode(f,f.uint32())},B.verify=function(f){if(typeof f!=="object"||f===null)return"object expected";if(f.chain!=null&&f.hasOwnProperty("chain")){if(!W.isString(f.chain))return"chain: string expected"}if(f.symbol!=null&&f.hasOwnProperty("symbol")){if(!W.isString(f.symbol))return"symbol: string expected"}if(f.ticker!=null&&f.hasOwnProperty("ticker")){if(!W.isString(f.ticker))return"ticker: string expected"}if(f.synth!=null&&f.hasOwnProperty("synth")){if(typeof f.synth!=="boolean")return"synth: boolean expected"}return null},B.fromObject=function(f){if(f instanceof y.common.Asset)return f;let x=new y.common.Asset;if(f.chain!=null)x.chain=String(f.chain);if(f.symbol!=null)x.symbol=String(f.symbol);if(f.ticker!=null)x.ticker=String(f.ticker);if(f.synth!=null)x.synth=Boolean(f.synth);return x},B.toObject=function(f,x){if(!x)x={};let T={};if(x.defaults)T.chain="",T.symbol="",T.ticker="",T.synth=!1;if(f.chain!=null&&f.hasOwnProperty("chain"))T.chain=f.chain;if(f.symbol!=null&&f.hasOwnProperty("symbol"))T.symbol=f.symbol;if(f.ticker!=null&&f.hasOwnProperty("ticker"))T.ticker=f.ticker;if(f.synth!=null&&f.hasOwnProperty("synth"))T.synth=f.synth;return T},B.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},B})(),H.Coin=(()=>{function B(_){if(_){for(let f=Object.keys(_),x=0;x<f.length;++x)if(_[f[x]]!=null)this[f[x]]=_[f[x]]}}return B.prototype.asset=null,B.prototype.amount="",B.prototype.decimals=W.Long?W.Long.fromBits(0,0,!1):0,B.create=function(f){return new B(f)},B.encode=function(f,x){if(!x)x=k.create();if(f.asset!=null&&Object.hasOwnProperty.call(f,"asset"))y.common.Asset.encode(f.asset,x.uint32(10).fork()).ldelim();if(f.amount!=null&&Object.hasOwnProperty.call(f,"amount"))x.uint32(18).string(f.amount);if(f.decimals!=null&&Object.hasOwnProperty.call(f,"decimals"))x.uint32(24).int64(f.decimals);return x},B.encodeDelimited=function(f,x){return this.encode(f,x).ldelim()},B.decode=function(f,x){if(!(f instanceof z))f=z.create(f);let T=x===void 0?f.len:f.pos+x,v=new y.common.Coin;while(f.pos<T){let L=f.uint32();switch(L>>>3){case 1:v.asset=y.common.Asset.decode(f,f.uint32());break;case 2:v.amount=f.string();break;case 3:v.decimals=f.int64();break;default:f.skipType(L&7);break}}return v},B.decodeDelimited=function(f){if(!(f instanceof z))f=new z(f);return this.decode(f,f.uint32())},B.verify=function(f){if(typeof f!=="object"||f===null)return"object expected";if(f.asset!=null&&f.hasOwnProperty("asset")){let x=y.common.Asset.verify(f.asset);if(x)return"asset."+x}if(f.amount!=null&&f.hasOwnProperty("amount")){if(!W.isString(f.amount))return"amount: string expected"}if(f.decimals!=null&&f.hasOwnProperty("decimals")){if(!W.isInteger(f.decimals)&&!(f.decimals&&W.isInteger(f.decimals.low)&&W.isInteger(f.decimals.high)))return"decimals: integer|Long expected"}return null},B.fromObject=function(f){if(f instanceof y.common.Coin)return f;let x=new y.common.Coin;if(f.asset!=null){if(typeof f.asset!=="object")throw TypeError(".common.Coin.asset: object expected");x.asset=y.common.Asset.fromObject(f.asset)}if(f.amount!=null)x.amount=String(f.amount);if(f.decimals!=null){if(W.Long)(x.decimals=W.Long.fromValue(f.decimals)).unsigned=!1;else if(typeof f.decimals==="string")x.decimals=Number.parseInt(f.decimals,10);else if(typeof f.decimals==="number")x.decimals=f.decimals;else if(typeof f.decimals==="object")x.decimals=new W.LongBits(f.decimals.low>>>0,f.decimals.high>>>0).toNumber()}return x},B.toObject=function(f,x){if(!x)x={};let T={};if(x.defaults)if(T.asset=null,T.amount="",W.Long){let v=new W.Long(0,0,!1);T.decimals=x.longs===String?v.toString():x.longs===Number?v.toNumber():v}else T.decimals=x.longs===String?"0":0;if(f.asset!=null&&f.hasOwnProperty("asset"))T.asset=y.common.Asset.toObject(f.asset,x);if(f.amount!=null&&f.hasOwnProperty("amount"))T.amount=f.amount;if(f.decimals!=null&&f.hasOwnProperty("decimals"))if(typeof f.decimals==="number")T.decimals=x.longs===String?String(f.decimals):f.decimals;else T.decimals=x.longs===String?W.Long.prototype.toString.call(f.decimals):x.longs===Number?new W.LongBits(f.decimals.low>>>0,f.decimals.high>>>0).toNumber():f.decimals;return T},B.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},B})(),H.PubKeySet=(()=>{function B(_){if(_){for(let f=Object.keys(_),x=0;x<f.length;++x)if(_[f[x]]!=null)this[f[x]]=_[f[x]]}}return B.prototype.secp256k1="",B.prototype.ed25519="",B.create=function(f){return new B(f)},B.encode=function(f,x){if(!x)x=k.create();if(f.secp256k1!=null&&Object.hasOwnProperty.call(f,"secp256k1"))x.uint32(10).string(f.secp256k1);if(f.ed25519!=null&&Object.hasOwnProperty.call(f,"ed25519"))x.uint32(18).string(f.ed25519);return x},B.encodeDelimited=function(f,x){return this.encode(f,x).ldelim()},B.decode=function(f,x){if(!(f instanceof z))f=z.create(f);let T=x===void 0?f.len:f.pos+x,v=new y.common.PubKeySet;while(f.pos<T){let L=f.uint32();switch(L>>>3){case 1:v.secp256k1=f.string();break;case 2:v.ed25519=f.string();break;default:f.skipType(L&7);break}}return v},B.decodeDelimited=function(f){if(!(f instanceof z))f=new z(f);return this.decode(f,f.uint32())},B.verify=function(f){if(typeof f!=="object"||f===null)return"object expected";if(f.secp256k1!=null&&f.hasOwnProperty("secp256k1")){if(!W.isString(f.secp256k1))return"secp256k1: string expected"}if(f.ed25519!=null&&f.hasOwnProperty("ed25519")){if(!W.isString(f.ed25519))return"ed25519: string expected"}return null},B.fromObject=function(f){if(f instanceof y.common.PubKeySet)return f;let x=new y.common.PubKeySet;if(f.secp256k1!=null)x.secp256k1=String(f.secp256k1);if(f.ed25519!=null)x.ed25519=String(f.ed25519);return x},B.toObject=function(f,x){if(!x)x={};let T={};if(x.defaults)T.secp256k1="",T.ed25519="";if(f.secp256k1!=null&&f.hasOwnProperty("secp256k1"))T.secp256k1=f.secp256k1;if(f.ed25519!=null&&f.hasOwnProperty("ed25519"))T.ed25519=f.ed25519;return T},B.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},B})(),H.Tx=(()=>{function B(_){if(this.coins=[],this.gas=[],_){for(let f=Object.keys(_),x=0;x<f.length;++x)if(_[f[x]]!=null)this[f[x]]=_[f[x]]}}return B.prototype.id="",B.prototype.chain="",B.prototype.fromAddress="",B.prototype.toAddress="",B.prototype.coins=W.emptyArray,B.prototype.gas=W.emptyArray,B.prototype.memo="",B.create=function(f){return new B(f)},B.encode=function(f,x){if(!x)x=k.create();if(f.id!=null&&Object.hasOwnProperty.call(f,"id"))x.uint32(10).string(f.id);if(f.chain!=null&&Object.hasOwnProperty.call(f,"chain"))x.uint32(18).string(f.chain);if(f.fromAddress!=null&&Object.hasOwnProperty.call(f,"fromAddress"))x.uint32(26).string(f.fromAddress);if(f.toAddress!=null&&Object.hasOwnProperty.call(f,"toAddress"))x.uint32(34).string(f.toAddress);if(f.coins?.length)for(let T=0;T<f.coins.length;++T)y.common.Coin.encode(f.coins[T],x.uint32(42).fork()).ldelim();if(f.gas?.length)for(let T=0;T<f.gas.length;++T)y.common.Coin.encode(f.gas[T],x.uint32(50).fork()).ldelim();if(f.memo!=null&&Object.hasOwnProperty.call(f,"memo"))x.uint32(58).string(f.memo);return x},B.encodeDelimited=function(f,x){return this.encode(f,x).ldelim()},B.decode=function(f,x){if(!(f instanceof z))f=z.create(f);let T=x===void 0?f.len:f.pos+x,v=new y.common.Tx;while(f.pos<T){let L=f.uint32();switch(L>>>3){case 1:v.id=f.string();break;case 2:v.chain=f.string();break;case 3:v.fromAddress=f.string();break;case 4:v.toAddress=f.string();break;case 5:if(!v.coins?.length)v.coins=[];v.coins.push(y.common.Coin.decode(f,f.uint32()));break;case 6:if(!v.gas?.length)v.gas=[];v.gas.push(y.common.Coin.decode(f,f.uint32()));break;case 7:v.memo=f.string();break;default:f.skipType(L&7);break}}return v},B.decodeDelimited=function(f){if(!(f instanceof z))f=new z(f);return this.decode(f,f.uint32())},B.verify=function(f){if(typeof f!=="object"||f===null)return"object expected";if(f.id!=null&&f.hasOwnProperty("id")){if(!W.isString(f.id))return"id: string expected"}if(f.chain!=null&&f.hasOwnProperty("chain")){if(!W.isString(f.chain))return"chain: string expected"}if(f.fromAddress!=null&&f.hasOwnProperty("fromAddress")){if(!W.isString(f.fromAddress))return"fromAddress: string expected"}if(f.toAddress!=null&&f.hasOwnProperty("toAddress")){if(!W.isString(f.toAddress))return"toAddress: string expected"}if(f.coins!=null&&f.hasOwnProperty("coins")){if(!Array.isArray(f.coins))return"coins: array expected";for(let x=0;x<f.coins.length;++x){let T=y.common.Coin.verify(f.coins[x]);if(T)return"coins."+T}}if(f.gas!=null&&f.hasOwnProperty("gas")){if(!Array.isArray(f.gas))return"gas: array expected";for(let x=0;x<f.gas.length;++x){let T=y.common.Coin.verify(f.gas[x]);if(T)return"gas."+T}}if(f.memo!=null&&f.hasOwnProperty("memo")){if(!W.isString(f.memo))return"memo: string expected"}return null},B.fromObject=function(f){if(f instanceof y.common.Tx)return f;let x=new y.common.Tx;if(f.id!=null)x.id=String(f.id);if(f.chain!=null)x.chain=String(f.chain);if(f.fromAddress!=null)x.fromAddress=String(f.fromAddress);if(f.toAddress!=null)x.toAddress=String(f.toAddress);if(f.coins){if(!Array.isArray(f.coins))throw TypeError(".common.Tx.coins: array expected");x.coins=[];for(let T=0;T<f.coins.length;++T){if(typeof f.coins[T]!=="object")throw TypeError(".common.Tx.coins: object expected");x.coins[T]=y.common.Coin.fromObject(f.coins[T])}}if(f.gas){if(!Array.isArray(f.gas))throw TypeError(".common.Tx.gas: array expected");x.gas=[];for(let T=0;T<f.gas.length;++T){if(typeof f.gas[T]!=="object")throw TypeError(".common.Tx.gas: object expected");x.gas[T]=y.common.Coin.fromObject(f.gas[T])}}if(f.memo!=null)x.memo=String(f.memo);return x},B.toObject=function(f,x){if(!x)x={};let T={};if(x.arrays||x.defaults)T.coins=[],T.gas=[];if(x.defaults)T.id="",T.chain="",T.fromAddress="",T.toAddress="",T.memo="";if(f.id!=null&&f.hasOwnProperty("id"))T.id=f.id;if(f.chain!=null&&f.hasOwnProperty("chain"))T.chain=f.chain;if(f.fromAddress!=null&&f.hasOwnProperty("fromAddress"))T.fromAddress=f.fromAddress;if(f.toAddress!=null&&f.hasOwnProperty("toAddress"))T.toAddress=f.toAddress;if(f.coins?.length){T.coins=[];for(let v=0;v<f.coins.length;++v)T.coins[v]=y.common.Coin.toObject(f.coins[v],x)}if(f.gas?.length){T.gas=[];for(let v=0;v<f.gas.length;++v)T.gas[v]=y.common.Coin.toObject(f.gas[v],x)}if(f.memo!=null&&f.hasOwnProperty("memo"))T.memo=f.memo;return T},B.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},B})(),H.Fee=(()=>{function B(_){if(this.coins=[],_){for(let f=Object.keys(_),x=0;x<f.length;++x)if(_[f[x]]!=null)this[f[x]]=_[f[x]]}}return B.prototype.coins=W.emptyArray,B.prototype.poolDeduct="",B.create=function(f){return new B(f)},B.encode=function(f,x){if(!x)x=k.create();if(f.coins?.length)for(let T=0;T<f.coins.length;++T)y.common.Coin.encode(f.coins[T],x.uint32(10).fork()).ldelim();if(f.poolDeduct!=null&&Object.hasOwnProperty.call(f,"poolDeduct"))x.uint32(18).string(f.poolDeduct);return x},B.encodeDelimited=function(f,x){return this.encode(f,x).ldelim()},B.decode=function(f,x){if(!(f instanceof z))f=z.create(f);let T=x===void 0?f.len:f.pos+x,v=new y.common.Fee;while(f.pos<T){let L=f.uint32();switch(L>>>3){case 1:if(!v.coins?.length)v.coins=[];v.coins.push(y.common.Coin.decode(f,f.uint32()));break;case 2:v.poolDeduct=f.string();break;default:f.skipType(L&7);break}}return v},B.decodeDelimited=function(f){if(!(f instanceof z))f=new z(f);return this.decode(f,f.uint32())},B.verify=function(f){if(typeof f!=="object"||f===null)return"object expected";if(f.coins!=null&&f.hasOwnProperty("coins")){if(!Array.isArray(f.coins))return"coins: array expected";for(let x=0;x<f.coins.length;++x){let T=y.common.Coin.verify(f.coins[x]);if(T)return"coins."+T}}if(f.poolDeduct!=null&&f.hasOwnProperty("poolDeduct")){if(!W.isString(f.poolDeduct))return"poolDeduct: string expected"}return null},B.fromObject=function(f){if(f instanceof y.common.Fee)return f;let x=new y.common.Fee;if(f.coins){if(!Array.isArray(f.coins))throw TypeError(".common.Fee.coins: array expected");x.coins=[];for(let T=0;T<f.coins.length;++T){if(typeof f.coins[T]!=="object")throw TypeError(".common.Fee.coins: object expected");x.coins[T]=y.common.Coin.fromObject(f.coins[T])}}if(f.poolDeduct!=null)x.poolDeduct=String(f.poolDeduct);return x},B.toObject=function(f,x){if(!x)x={};let T={};if(x.arrays||x.defaults)T.coins=[];if(x.defaults)T.poolDeduct="";if(f.coins?.length){T.coins=[];for(let v=0;v<f.coins.length;++v)T.coins[v]=y.common.Coin.toObject(f.coins[v],x)}if(f.poolDeduct!=null&&f.hasOwnProperty("poolDeduct"))T.poolDeduct=f.poolDeduct;return T},B.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},B})(),H.ProtoUint=(()=>{function B(_){if(_){for(let f=Object.keys(_),x=0;x<f.length;++x)if(_[f[x]]!=null)this[f[x]]=_[f[x]]}}return B.prototype.value="",B.create=function(f){return new B(f)},B.encode=function(f,x){if(!x)x=k.create();if(f.value!=null&&Object.hasOwnProperty.call(f,"value"))x.uint32(10).string(f.value);return x},B.encodeDelimited=function(f,x){return this.encode(f,x).ldelim()},B.decode=function(f,x){if(!(f instanceof z))f=z.create(f);let T=x===void 0?f.len:f.pos+x,v=new y.common.ProtoUint;while(f.pos<T){let L=f.uint32();switch(L>>>3){case 1:v.value=f.string();break;default:f.skipType(L&7);break}}return v},B.decodeDelimited=function(f){if(!(f instanceof z))f=new z(f);return this.decode(f,f.uint32())},B.verify=function(f){if(typeof f!=="object"||f===null)return"object expected";if(f.value!=null&&f.hasOwnProperty("value")){if(!W.isString(f.value))return"value: string expected"}return null},B.fromObject=function(f){if(f instanceof y.common.ProtoUint)return f;let x=new y.common.ProtoUint;if(f.value!=null)x.value=String(f.value);return x},B.toObject=function(f,x){if(!x)x={};let T={};if(x.defaults)T.value="";if(f.value!=null&&f.hasOwnProperty("value"))T.value=f.value;return T},B.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},B})(),H})();y.types=(()=>{let H={};return H.MsgDeposit=(()=>{function B(_){if(this.coins=[],_){for(let f=Object.keys(_),x=0;x<f.length;++x)if(_[f[x]]!=null)this[f[x]]=_[f[x]]}}return B.prototype.coins=W.emptyArray,B.prototype.memo="",B.prototype.signer=W.newBuffer([]),B.create=function(f){return new B(f)},B.encode=function(f,x){if(!x)x=k.create();if(f.coins?.length)for(let T=0;T<f.coins.length;++T)y.common.Coin.encode(f.coins[T],x.uint32(10).fork()).ldelim();if(f.memo!=null&&Object.hasOwnProperty.call(f,"memo"))x.uint32(18).string(f.memo);if(f.signer!=null&&Object.hasOwnProperty.call(f,"signer"))x.uint32(26).bytes(f.signer);return x},B.encodeDelimited=function(f,x){return this.encode(f,x).ldelim()},B.decode=function(f,x){if(!(f instanceof z))f=z.create(f);let T=x===void 0?f.len:f.pos+x,v=new y.types.MsgDeposit;while(f.pos<T){let L=f.uint32();switch(L>>>3){case 1:if(!v.coins?.length)v.coins=[];v.coins.push(y.common.Coin.decode(f,f.uint32()));break;case 2:v.memo=f.string();break;case 3:v.signer=f.bytes();break;default:f.skipType(L&7);break}}return v},B.decodeDelimited=function(f){if(!(f instanceof z))f=new z(f);return this.decode(f,f.uint32())},B.verify=function(f){if(typeof f!=="object"||f===null)return"object expected";if(f.coins!=null&&f.hasOwnProperty("coins")){if(!Array.isArray(f.coins))return"coins: array expected";for(let x=0;x<f.coins.length;++x){let T=y.common.Coin.verify(f.coins[x]);if(T)return"coins."+T}}if(f.memo!=null&&f.hasOwnProperty("memo")){if(!W.isString(f.memo))return"memo: string expected"}if(f.signer!=null&&f.hasOwnProperty("signer")){if(!(f.signer&&typeof f.signer.length==="number"||W.isString(f.signer)))return"signer: buffer expected"}return null},B.fromObject=function(f){if(f instanceof y.types.MsgDeposit)return f;let x=new y.types.MsgDeposit;if(f.coins){if(!Array.isArray(f.coins))throw TypeError(".types.MsgDeposit.coins: array expected");x.coins=[];for(let T=0;T<f.coins.length;++T){if(typeof f.coins[T]!=="object")throw TypeError(".types.MsgDeposit.coins: object expected");x.coins[T]=y.common.Coin.fromObject(f.coins[T])}}if(f.memo!=null)x.memo=String(f.memo);if(f.signer!=null){if(typeof f.signer==="string")W.base64.decode(f.signer,x.signer=W.newBuffer(W.base64.length(f.signer)),0);else if(f.signer.length)x.signer=f.signer}return x},B.toObject=function(f,x){if(!x)x={};let T={};if(x.arrays||x.defaults)T.coins=[];if(x.defaults){if(T.memo="",x.bytes===String)T.signer="";else if(T.signer=[],x.bytes!==Array)T.signer=W.newBuffer(T.signer)}if(f.coins?.length){T.coins=[];for(let v=0;v<f.coins.length;++v)T.coins[v]=y.common.Coin.toObject(f.coins[v],x)}if(f.memo!=null&&f.hasOwnProperty("memo"))T.memo=f.memo;if(f.signer!=null&&f.hasOwnProperty("signer"))T.signer=x.bytes===String?W.base64.encode(f.signer,0,f.signer.length):x.bytes===Array?Array.prototype.slice.call(f.signer):f.signer;return T},B.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},B})(),H.MsgSend=(()=>{function B(_){if(this.amount=[],_){for(let f=Object.keys(_),x=0;x<f.length;++x)if(_[f[x]]!=null)this[f[x]]=_[f[x]]}}return B.prototype.fromAddress=W.newBuffer([]),B.prototype.toAddress=W.newBuffer([]),B.prototype.amount=W.emptyArray,B.create=function(f){return new B(f)},B.encode=function(f,x){if(!x)x=k.create();if(f.fromAddress!=null&&Object.hasOwnProperty.call(f,"fromAddress"))x.uint32(10).bytes(f.fromAddress);if(f.toAddress!=null&&Object.hasOwnProperty.call(f,"toAddress"))x.uint32(18).bytes(f.toAddress);if(f.amount?.length)for(let T=0;T<f.amount.length;++T)y.cosmos.base.v1beta1.Coin.encode(f.amount[T],x.uint32(26).fork()).ldelim();return x},B.encodeDelimited=function(f,x){return this.encode(f,x).ldelim()},B.decode=function(f,x){if(!(f instanceof z))f=z.create(f);let T=x===void 0?f.len:f.pos+x,v=new y.types.MsgSend;while(f.pos<T){let L=f.uint32();switch(L>>>3){case 1:v.fromAddress=f.bytes();break;case 2:v.toAddress=f.bytes();break;case 3:if(!v.amount?.length)v.amount=[];v.amount.push(y.cosmos.base.v1beta1.Coin.decode(f,f.uint32()));break;default:f.skipType(L&7);break}}return v},B.decodeDelimited=function(f){if(!(f instanceof z))f=new z(f);return this.decode(f,f.uint32())},B.verify=function(f){if(typeof f!=="object"||f===null)return"object expected";if(f.fromAddress!=null&&f.hasOwnProperty("fromAddress")){if(!(f.fromAddress&&typeof f.fromAddress.length==="number"||W.isString(f.fromAddress)))return"fromAddress: buffer expected"}if(f.toAddress!=null&&f.hasOwnProperty("toAddress")){if(!(f.toAddress&&typeof f.toAddress.length==="number"||W.isString(f.toAddress)))return"toAddress: buffer expected"}if(f.amount!=null&&f.hasOwnProperty("amount")){if(!Array.isArray(f.amount))return"amount: array expected";for(let x=0;x<f.amount.length;++x){let T=y.cosmos.base.v1beta1.Coin.verify(f.amount[x]);if(T)return"amount."+T}}return null},B.fromObject=function(f){if(f instanceof y.types.MsgSend)return f;let x=new y.types.MsgSend;if(f.fromAddress!=null){if(typeof f.fromAddress==="string")W.base64.decode(f.fromAddress,x.fromAddress=W.newBuffer(W.base64.length(f.fromAddress)),0);else if(f.fromAddress.length)x.fromAddress=f.fromAddress}if(f.toAddress!=null){if(typeof f.toAddress==="string")W.base64.decode(f.toAddress,x.toAddress=W.newBuffer(W.base64.length(f.toAddress)),0);else if(f.toAddress.length)x.toAddress=f.toAddress}if(f.amount){if(!Array.isArray(f.amount))throw TypeError(".types.MsgSend.amount: array expected");x.amount=[];for(let T=0;T<f.amount.length;++T){if(typeof f.amount[T]!=="object")throw TypeError(".types.MsgSend.amount: object expected");x.amount[T]=y.cosmos.base.v1beta1.Coin.fromObject(f.amount[T])}}return x},B.toObject=function(f,x){if(!x)x={};let T={};if(x.arrays||x.defaults)T.amount=[];if(x.defaults){if(x.bytes===String)T.fromAddress="";else if(T.fromAddress=[],x.bytes!==Array)T.fromAddress=W.newBuffer(T.fromAddress);if(x.bytes===String)T.toAddress="";else if(T.toAddress=[],x.bytes!==Array)T.toAddress=W.newBuffer(T.toAddress)}if(f.fromAddress!=null&&f.hasOwnProperty("fromAddress"))T.fromAddress=x.bytes===String?W.base64.encode(f.fromAddress,0,f.fromAddress.length):x.bytes===Array?Array.prototype.slice.call(f.fromAddress):f.fromAddress;if(f.toAddress!=null&&f.hasOwnProperty("toAddress"))T.toAddress=x.bytes===String?W.base64.encode(f.toAddress,0,f.toAddress.length):x.bytes===Array?Array.prototype.slice.call(f.toAddress):f.toAddress;if(f.amount?.length){T.amount=[];for(let v=0;v<f.amount.length;++v)T.amount[v]=y.cosmos.base.v1beta1.Coin.toObject(f.amount[v],x)}return T},B.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},B})(),H})();y.cosmos=(()=>{let H={};return H.base=(()=>{let B={};return B.v1beta1=(()=>{let _={};return _.Coin=(()=>{function f(x){if(x){for(let T=Object.keys(x),v=0;v<T.length;++v)if(x[T[v]]!=null)this[T[v]]=x[T[v]]}}return f.prototype.denom="",f.prototype.amount="",f.create=function(T){return new f(T)},f.encode=function(T,v){if(!v)v=k.create();if(T.denom!=null&&Object.hasOwnProperty.call(T,"denom"))v.uint32(10).string(T.denom);if(T.amount!=null&&Object.hasOwnProperty.call(T,"amount"))v.uint32(18).string(T.amount);return v},f.encodeDelimited=function(T,v){return this.encode(T,v).ldelim()},f.decode=function(T,v){if(!(T instanceof z))T=z.create(T);let L=v===void 0?T.len:T.pos+v,Z=new y.cosmos.base.v1beta1.Coin;while(T.pos<L){let I=T.uint32();switch(I>>>3){case 1:Z.denom=T.string();break;case 2:Z.amount=T.string();break;default:T.skipType(I&7);break}}return Z},f.decodeDelimited=function(T){if(!(T instanceof z))T=new z(T);return this.decode(T,T.uint32())},f.verify=function(T){if(typeof T!=="object"||T===null)return"object expected";if(T.denom!=null&&T.hasOwnProperty("denom")){if(!W.isString(T.denom))return"denom: string expected"}if(T.amount!=null&&T.hasOwnProperty("amount")){if(!W.isString(T.amount))return"amount: string expected"}return null},f.fromObject=function(T){if(T instanceof y.cosmos.base.v1beta1.Coin)return T;let v=new y.cosmos.base.v1beta1.Coin;if(T.denom!=null)v.denom=String(T.denom);if(T.amount!=null)v.amount=String(T.amount);return v},f.toObject=function(T,v){if(!v)v={};let L={};if(v.defaults)L.denom="",L.amount="";if(T.denom!=null&&T.hasOwnProperty("denom"))L.denom=T.denom;if(T.amount!=null&&T.hasOwnProperty("amount"))L.amount=T.amount;return L},f.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},f})(),_.DecCoin=(()=>{function f(x){if(x){for(let T=Object.keys(x),v=0;v<T.length;++v)if(x[T[v]]!=null)this[T[v]]=x[T[v]]}}return f.prototype.denom="",f.prototype.amount="",f.create=function(T){return new f(T)},f.encode=function(T,v){if(!v)v=k.create();if(T.denom!=null&&Object.hasOwnProperty.call(T,"denom"))v.uint32(10).string(T.denom);if(T.amount!=null&&Object.hasOwnProperty.call(T,"amount"))v.uint32(18).string(T.amount);return v},f.encodeDelimited=function(T,v){return this.encode(T,v).ldelim()},f.decode=function(T,v){if(!(T instanceof z))T=z.create(T);let L=v===void 0?T.len:T.pos+v,Z=new y.cosmos.base.v1beta1.DecCoin;while(T.pos<L){let I=T.uint32();switch(I>>>3){case 1:Z.denom=T.string();break;case 2:Z.amount=T.string();break;default:T.skipType(I&7);break}}return Z},f.decodeDelimited=function(T){if(!(T instanceof z))T=new z(T);return this.decode(T,T.uint32())},f.verify=function(T){if(typeof T!=="object"||T===null)return"object expected";if(T.denom!=null&&T.hasOwnProperty("denom")){if(!W.isString(T.denom))return"denom: string expected"}if(T.amount!=null&&T.hasOwnProperty("amount")){if(!W.isString(T.amount))return"amount: string expected"}return null},f.fromObject=function(T){if(T instanceof y.cosmos.base.v1beta1.DecCoin)return T;let v=new y.cosmos.base.v1beta1.DecCoin;if(T.denom!=null)v.denom=String(T.denom);if(T.amount!=null)v.amount=String(T.amount);return v},f.toObject=function(T,v){if(!v)v={};let L={};if(v.defaults)L.denom="",L.amount="";if(T.denom!=null&&T.hasOwnProperty("denom"))L.denom=T.denom;if(T.amount!=null&&T.hasOwnProperty("amount"))L.amount=T.amount;return L},f.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},f})(),_.IntProto=(()=>{function f(x){if(x){for(let T=Object.keys(x),v=0;v<T.length;++v)if(x[T[v]]!=null)this[T[v]]=x[T[v]]}}return f.prototype.int="",f.create=function(T){return new f(T)},f.encode=function(T,v){if(!v)v=k.create();if(T.int!=null&&Object.hasOwnProperty.call(T,"int"))v.uint32(10).string(T.int);return v},f.encodeDelimited=function(T,v){return this.encode(T,v).ldelim()},f.decode=function(T,v){if(!(T instanceof z))T=z.create(T);let L=v===void 0?T.len:T.pos+v,Z=new y.cosmos.base.v1beta1.IntProto;while(T.pos<L){let I=T.uint32();switch(I>>>3){case 1:Z.int=T.string();break;default:T.skipType(I&7);break}}return Z},f.decodeDelimited=function(T){if(!(T instanceof z))T=new z(T);return this.decode(T,T.uint32())},f.verify=function(T){if(typeof T!=="object"||T===null)return"object expected";if(T.int!=null&&T.hasOwnProperty("int")){if(!W.isString(T.int))return"int: string expected"}return null},f.fromObject=function(T){if(T instanceof y.cosmos.base.v1beta1.IntProto)return T;let v=new y.cosmos.base.v1beta1.IntProto;if(T.int!=null)v.int=String(T.int);return v},f.toObject=function(T,v){if(!v)v={};let L={};if(v.defaults)L.int="";if(T.int!=null&&T.hasOwnProperty("int"))L.int=T.int;return L},f.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},f})(),_.DecProto=(()=>{function f(x){if(x){for(let T=Object.keys(x),v=0;v<T.length;++v)if(x[T[v]]!=null)this[T[v]]=x[T[v]]}}return f.prototype.dec="",f.create=function(T){return new f(T)},f.encode=function(T,v){if(!v)v=k.create();if(T.dec!=null&&Object.hasOwnProperty.call(T,"dec"))v.uint32(10).string(T.dec);return v},f.encodeDelimited=function(T,v){return this.encode(T,v).ldelim()},f.decode=function(T,v){if(!(T instanceof z))T=z.create(T);let L=v===void 0?T.len:T.pos+v,Z=new y.cosmos.base.v1beta1.DecProto;while(T.pos<L){let I=T.uint32();switch(I>>>3){case 1:Z.dec=T.string();break;default:T.skipType(I&7);break}}return Z},f.decodeDelimited=function(T){if(!(T instanceof z))T=new z(T);return this.decode(T,T.uint32())},f.verify=function(T){if(typeof T!=="object"||T===null)return"object expected";if(T.dec!=null&&T.hasOwnProperty("dec")){if(!W.isString(T.dec))return"dec: string expected"}return null},f.fromObject=function(T){if(T instanceof y.cosmos.base.v1beta1.DecProto)return T;let v=new y.cosmos.base.v1beta1.DecProto;if(T.dec!=null)v.dec=String(T.dec);return v},f.toObject=function(T,v){if(!v)v={};let L={};if(v.defaults)L.dec="";if(T.dec!=null&&T.hasOwnProperty("dec"))L.dec=T.dec;return L},f.prototype.toJSON=function(){return this.constructor.toObject(this,E.util.toJSONOptions)},f})(),_})(),B})(),H})()});import{Chain as S0}from"@swapkit/helpers";async function l(){let{$root:H}=await Promise.resolve().then(() => (wf(),Mf)),B=await import("@cosmjs/proto-signing"),_=B.Registry??B.default?.Registry,f=await import("@cosmjs/stargate"),x=f.defaultRegistryTypes??f.default?.defaultRegistryTypes;return new _([...x,["/types.MsgSend",H.types.MsgSend],["/types.MsgDeposit",H.types.MsgDeposit]])}async function P(H){let B=await import("@cosmjs/stargate"),_=B.AminoTypes??B.default?.AminoTypes,f=H===S0.THORChain?"thorchain":"mayachain";return new _({"/types.MsgDeposit":{aminoType:`${f}/MsgDeposit`,fromAmino:({signer:x,...T})=>({...T,signer:b(x)}),toAmino:({signer:x,...T})=>({...T,signer:d(x)})},"/types.MsgSend":{aminoType:`${f}/MsgSend`,fromAmino:({from_address:x,to_address:T,...v})=>({...v,fromAddress:b(x),toAddress:b(T)}),toAmino:({fromAddress:x,toAddress:T,...v})=>({...v,from_address:d(x),to_address:d(T)})}})}var Zf=U(()=>{Hf()});import{AssetValue as K0,Chain as e,getChainConfig as hf,getRPCUrl as lf,SwapKitError as O0}from"@swapkit/helpers";function If(H){let{assetValue:B,recipient:_,memo:f,sender:x,asSignable:T,asAminoMessage:v}=H;if(_)return $f({asAminoMessage:v,asSignable:T,assetValue:B,memo:f,recipient:_,sender:x});return cf({asAminoMessage:v,asSignable:T,assetValue:B,memo:f,sender:x})}async function $f({sender:H,recipient:B,assetValue:_,memo:f="",asSignable:x=!0,asAminoMessage:T=!1,sequence:v,accountNumber:L}){let Z=_.chain,I=await lf(Z),A=await nf({rpcUrl:I,sender:H}),{chainId:q}=hf(Z),Y=Qf({assetValue:_,recipient:B,sender:H}),G=x?await u(T?Y:M(Y),Z):Y;return{accountNumber:L||A.accountNumber,chainId:q,fee:R(Z),memo:f,msgs:[G],sequence:v||A.sequence}}async function cf({sender:H,assetValue:B,memo:_="",asSignable:f=!0,asAminoMessage:x=!1,sequence:T,accountNumber:v}){let L=B.chain,Z=await lf(L),I=await nf({rpcUrl:Z,sender:H}),{chainId:A}=hf(L),q=Xf({assetValue:B,memo:_,sender:H}),Y=f?await u(x?q:M(q),L):q;return{accountNumber:v||I.accountNumber,chainId:A,fee:R(L),memo:_,msgs:[Y],sequence:T||I.sequence}}function M(H){if(H.type==="thorchain/MsgSend"||H.type==="mayachain/MsgSend")return H;return{...H,value:{...H.value,coins:H.value.coins.map((B)=>{let _=K0.from({asset:B.asset}),f=(_.isSynthetic?_.symbol.split("/")?.[1]:_.symbol)?.toUpperCase(),x=(_.isSynthetic?_.symbol.split("/")?.[0]:_.chain)?.toUpperCase();return{...B,asset:{chain:x,symbol:f,synth:_.isSynthetic,ticker:_.ticker}}})}}}async function t({chain:H,memo:B,msgs:_}){let f=await l(),x=await P(H),T={typeUrl:"/cosmos.tx.v1beta1.TxBody",value:{memo:B,messages:_.map((v)=>x.fromAmino(v))}};return f.encode(T)}var E0,F0,Qf=({sender:H,recipient:B,assetValue:_})=>{return{type:`${_.chain===e.Maya?"mayachain":"thorchain"}/MsgSend`,value:{amount:[{amount:_.getBaseValue("string"),denom:D(_.symbol,!0)}],from_address:H,to_address:B}}},Xf=({sender:H,assetValue:B,memo:_=""})=>{return{type:`${B.chain===e.Maya?"mayachain":"thorchain"}/MsgDeposit`,value:{coins:[{amount:B.getBaseValue("string"),asset:i(B)}],memo:_,signer:H}}},ff=({sender:H,recipient:B,assetValue:_,memo:f})=>{return!B?Xf({assetValue:_,memo:f,sender:H}):Qf({assetValue:_,recipient:B,sender:H})},u=async(H,B)=>{return(await P(B)).fromAmino(H)},nf=async({rpcUrl:H,sender:B})=>{let f=await(await V(H)).getAccount(B);if(!f)throw new O0("toolbox_cosmos_account_not_found",{sender:B});return f};var pf=U(()=>{o();Zf();E0=R(e.THORChain).gas,F0=R(e.Maya).gas});var jf=()=>{};var bf=U(()=>{jf()});var Yf=U(()=>{Hf();pf();Zf();bf()});import{stringToPath as A0}from"@cosmjs/crypto";import{DirectSecp256k1HdWallet as U0}from"@cosmjs/proto-signing";import{base64 as Nf,bech32 as qf}from"@scure/base";import{AssetValue as Sf,applyFeeMultiplier as df,Chain as F,CosmosChainPrefixes as rf,DerivationPath as k0,derivationPathToString as of,FeeOption as Kf,getChainConfig as C0,getRPCUrl as m,NetworkDerivationPath as R0,SwapKitError as c,SwapKitNumber as Jf,updateDerivationPath as V0}from"@swapkit/helpers";import{SwapKitApi as sf}from"@swapkit/helpers/api";import{match as D0,P as tf}from"ts-pattern";async function Ef(H,B){try{let f=(await sf.getGasRate()).find((x)=>x.chainId===H)?.value;return f?Number.parseFloat(f):B}catch{return B}}async function Of({phrase:H,prefix:B,..._}){let f="derivationPath"in _?_.derivationPath:`${k0[_.chain]}/${_.index}`;return await U0.fromMnemonic(H,{hdPaths:[A0(f)],prefix:B})}async function P0({privateKey:H,prefix:B}){let _=await import("@cosmjs/proto-signing");return(_.DirectSecp256k1Wallet??_.default?.DirectSecp256k1Wallet).fromKey(H,B)}function ef(H){return async function({signature:_,message:f,address:x}){let T=await H(x);if(!T?.pubkey)throw new c("toolbox_cosmos_verify_signature_no_pubkey");let v=await import("@cosmjs/crypto"),L=v.Secp256k1Signature??v.default?.Secp256k1Signature,Z=v.Secp256k1??v.default?.Secp256k1,I=L.fromFixedLength(Nf.decode(_));return Z.verifySignature(I,Nf.decode(f),T.pubkey.value)}}function g({chain:H,...B}){let _=rf[H],f="index"in B?B.index||0:0,x=of("derivationPath"in B&&B.derivationPath?B.derivationPath:V0(R0[H],{index:f})),T;async function v(){if(T)return T;return T=await D0(B).with({phrase:tf.string},({phrase:G})=>Of({derivationPath:x,phrase:G,prefix:_})).with({signer:tf.any},({signer:G})=>G).otherwise(()=>{return}),T}async function L(G){let Q=await m(H);return(await V(Q)).getAccount(G)}async function Z(){let G=await v(),[Q]=await G?.getAccounts()||[];return Q?.address}async function I(){let G=await v(),[Q]=await G?.getAccounts()||[];if(!Q?.pubkey)throw new c("toolbox_cosmos_signer_not_defined");return Nf.encode(Q?.pubkey)}async function A(G){let Q=await v(),N=await Z(),S=await m(H);if(!(Q&&N))throw new c("toolbox_cosmos_signer_not_defined");return await(await h(S,Q)).sign(N,G.msgs,G.fee,G.memo,{accountNumber:G.accountNumber,chainId:G.chainId,sequence:G.sequence})}async function q(G){let Q=await v(),N=await Z(),S=await m(H);if(!(Q&&N))throw new c("toolbox_cosmos_signer_not_defined");let J=await(await h(S,Q)).signAndBroadcast(N,G.msgs,G.fee,G.memo);if(J.code!==0)throw new c("core_swap_transaction_error",{code:J.code,message:J.rawLog});return J.transactionHash}async function Y({recipient:G,assetValue:Q,memo:N="",feeRate:S,feeOptionKey:K=Kf.Fast}){let J=await v(),$=await Z();if(!(J&&$))throw new c("toolbox_cosmos_signer_not_defined");let xf=await m(H),Bf=Sf.from({chain:H}),p=i(Bf),j=S||w0((await gf(H,mf[H]))[K],p),vf=await h(xf,J),_f=D(Q.symbol),kf=[{amount:Q.getBaseValue("string"),denom:_f}],{transactionHash:w}=await vf.sendTokens($,G,kf,j,N);return w}return{createPrivateKeyFromPhrase:l0(x),createTransaction:zf,fetchFeeRateFromSwapKit:Ef,getAccount:L,getAddress:Z,getBalance:async(G,Q)=>{let N=await af(H)(G),S=await Promise.all(N.filter(({denom:K})=>K&&!K.includes("IBC/")&&!([F.THORChain,F.Maya].includes(H)&&K.split("-").length>2)).map(({denom:K,amount:J})=>{let $=[F.THORChain,F.Maya].includes(H)&&(K.includes("/")||K.includes("˜"))?`${H}.${K}`:K;return Gf($,J)}));if(S.length===0)return[Sf.from({chain:H})];return S},getBalanceAsDenoms:af(H),getFees:()=>gf(H,mf[H]),getPubKey:I,getSignerFromPhrase:({phrase:G,derivationPath:Q})=>Of({derivationPath:of(Q),index:f,phrase:G,prefix:_}),getSignerFromPrivateKey:async(G)=>{let Q=await import("@cosmjs/proto-signing");return(Q.DirectSecp256k1Wallet??Q.default?.DirectSecp256k1Wallet).fromKey(G,_)},signAndBroadcastTransaction:q,signTransaction:A,transfer:Y,validateAddress:f0(H),verifySignature:ef(L)}}async function u0(H,B){try{let f=(await sf.getGasRate()).find((x)=>x.chainId===H)?.value;return f?Number.parseFloat(f):B}catch{return B}}function M0({assetValue:{chain:H}}){return Sf.from({chain:H,value:h0(H)})}async function gf(H,B){let{chainId:_,baseDecimal:f}=C0(H),x=await Ef(_,B);return{average:Jf.fromBigInt(BigInt(x),f),fast:Jf.fromBigInt(BigInt(df(x,Kf.Fast,!0)),f),fastest:Jf.fromBigInt(BigInt(df(x,Kf.Fastest,!0)),f)}}function w0(H,B){return{amount:[{amount:H.getBaseValue("string"),denom:B}],gas:"200000"}}function h0(H){return{[F.Cosmos]:0.007,[F.Kujira]:0.02,[F.Noble]:0.01,[F.THORChain]:0.02,[F.Maya]:0.02,[F.Harbor]:0.02}[H]||0}function f0(H){let B=rf[H];return function(f){if(!f.startsWith(B))return!1;try{let{prefix:x,words:T}=qf.decode(f);return qf.encode(x,T)===f.toLocaleLowerCase()}catch{return!1}}}function af(H){return async function(_){let f=await m(H);return(await(await V(f)).getAllBalances(_)).map((L)=>({...L,denom:L.denom.includes("/")?L.denom.toUpperCase():L.denom}))}}function l0(H){return async function(_){let f=await import("@cosmjs/crypto"),x=f.stringToPath??f.default?.stringToPath,T=f.Slip10Curve??f.default?.Slip10Curve,v=f.Slip10??f.default?.Slip10,L=f.EnglishMnemonic??f.default?.EnglishMnemonic,Z=f.Bip39??f.default?.Bip39,I=new L(_),A=await Z.mnemonicToSeed(I),{privkey:q}=v.derivePath(T.Secp256k1,A,x(H));return q}}var mf;var Tf=U(()=>{o();mf={[F.Cosmos]:1000,[F.Kujira]:1000,[F.Noble]:1000,[F.THORChain]:5000000,[F.Maya]:5000000,[F.Harbor]:5000000}});import{base64 as n}from"@scure/base";import{Chain as n0,CosmosChainPrefixes as $0,derivationPathToString as c0,FeeOption as Ff,getChainConfig as T0,getRPCUrl as _0,NetworkDerivationPath as p0,RequestClient as j0,SKConfig as b0,SwapKitError as x0,SwapKitNumber as B0,updateDerivationPath as d0}from"@swapkit/helpers";import{match as i0,P as v0}from"ts-pattern";function o0({prefix:H,derivationPath:B}){return async function(f,x=0){let T=await import("@cosmjs/amino"),v=T.Secp256k1HdWallet??T.default?.Secp256k1HdWallet,L=await import("@cosmjs/crypto"),Z=L.stringToPath??L.default?.stringToPath;return v.fromMnemonic(f,{hdPaths:[Z(`${B}/${x}`)],prefix:H})}}function t0(H){return n.encode(H)}function m0(H){return async function({wallet:_,tx:f}){let{msgs:x,accountNumber:T,sequence:v,chainId:L,fee:Z,memo:I}=typeof f==="string"?JSON.parse(f):f,A=(await _.getAccounts())?.[0]?.address||"",q=await P(H),Y=await l(),G=await Wf(_,{aminoTypes:q,registry:Y}),Q=[];for(let K of x){let J=await u(K,H);Q.push(J)}let{signatures:[N]}=await G.sign(A,Q,Z,I,{accountNumber:T,chainId:L,sequence:v});return{bodyBytes:await t({chain:H,memo:I,msgs:x.map(M)}),signature:t0(N)}}}function g0({prefix:H,chain:B}){return async function(f,x,T,v,L){let Z=await _0(B),{encodeSecp256k1Pubkey:I,pubkeyToAddress:A}=(await import("@cosmjs/amino")).default,{makeMultisignedTxBytes:q}=(await import("@cosmjs/stargate")).default,{sequence:Y,fee:G}=JSON.parse(f),Q=await H0(T,v),N=x.map((J)=>[A(I(n.decode(J.pubKey)),H),n.decode(J.signature)]),S=await V(Z),{transactionHash:K}=await S.broadcastTx(q(Q,Y,G,L,new Map(N)));return K}}async function H0(H,B,_=!0){let{createMultisigThresholdPubkey:f,encodeSecp256k1Pubkey:x}=(await import("@cosmjs/amino")).default;return f(H.map((T)=>x(n.decode(T))),B,_)}function a0(H){return n.decode(H)}async function r0({privateKey:H,message:B}){let{Secp256k1:_}=(await import("@cosmjs/crypto")).default,f=await _.createSignature(n.decode(B),H);return n.encode(Buffer.concat([f.r(32),f.s(32)]))}function Af({chain:H,...B}){let{nodeUrl:_}=T0(H),{isStagenet:f}=b0.get("envs"),x=H===n0.THORChain,T=`${f?"s":""}${$0[H]}`,v="index"in B?B.index||0:0,L="derivationPath"in B&&B.derivationPath?B.derivationPath:d0(p0[H],{index:v}),Z=g({chain:H,...B}),I=R(H);async function A(){let Y,G=`${_}/${x?"thorchain":"mayachain"}/constants`;try{let{int_64_values:{NativeTransactionFee:Q}}=await j0.get(G);if(!Q||Number.isNaN(Q)||Q<0)throw new x0("toolbox_cosmos_invalid_fee",{nativeFee:Q.toString()});Y=new B0(Q)}catch{Y=new B0({decimal:T0(H).baseDecimal,value:x?0.02:1})}return{[Ff.Average]:Y,[Ff.Fast]:Y,[Ff.Fastest]:Y}}async function q({assetValue:Y,memo:G="",recipient:Q}){let N=await _0(H),S=await i0(B).with({phrase:v0.string},({phrase:w})=>Z.getSignerFromPhrase({derivationPath:L,phrase:w})).with({signer:v0.any},({signer:w})=>w).otherwise(()=>{return}),{TxRaw:K}=await import("cosmjs-types/cosmos/tx/v1beta1/tx"),J=(await S?.getAccounts())?.[0]?.address;if(!(J&&S))throw new x0("toolbox_cosmos_no_signer");let $="signAmino"in S,xf=await l(),Bf=await P(H),p=await h(N,S,{aminoTypes:Bf,registry:xf}),j=ff({assetValue:Y,memo:G,recipient:Q,sender:J});if($){let w=await u(j,H),{signatures:y0,authInfoBytes:W0}=await p.sign(J,[w],I,G),z0=K.encode({authInfoBytes:W0,bodyBytes:await t({chain:H,memo:G,msgs:[j].map(M)}),signatures:y0}).finish();return(await p.broadcastTx(z0)).transactionHash}let vf=M(j),_f=await u(vf,H);return(await p.signAndBroadcast(J,[_f],I,G)).transactionHash}return{...Z,broadcastMultisigTx:g0({chain:H,prefix:T}),buildAminoMsg:ff,buildEncodedTxBody:t,convertToSignable:u,createDefaultAminoTypes:()=>P(H),createDefaultRegistry:l,createMultisig:H0,createTransaction:If,deposit:q,getFees:A,importSignature:a0,parseAminoMessageForDirectSigning:M,pubkeyToAddress:async(Y)=>{let{pubkeyToAddress:G}=(await import("@cosmjs/amino")).default;return G(Y,T)},secp256k1HdWalletFromMnemonic:o0({derivationPath:c0(L),prefix:T}),signMultisigTx:m0(H),signWithPrivateKey:r0,transfer:q}}var Uf=U(()=>{Yf();o();Tf()});import{Chain as a,SwapKitError as s0}from"@swapkit/helpers";var e0=(H,B)=>{switch(H){case a.Cosmos:case a.Kujira:case a.Noble:return g({chain:H,...B});case a.Maya:case a.THORChain:return Af({chain:H,...B});default:throw new s0("toolbox_cosmos_not_supported",{chain:H})}};var L0=U(()=>{Tf();Uf();Tf();Uf()});var T6={};Cf(T6,{verifySignature:()=>ef,transferMsgAmino:()=>Qf,toBase64:()=>I0,parseAminoMessageForDirectSigning:()=>M,getSignerFromPrivateKey:()=>P0,getSignerFromPhrase:()=>Of,getMsgSendDenom:()=>D,getFeeRateFromSwapKit:()=>u0,getDenomWithChain:()=>i,getDefaultChainFee:()=>R,getCosmosToolbox:()=>e0,getCosmosAddressValidator:()=>f0,getAssetFromDenom:()=>Gf,fromBase64:()=>Y0,fetchFeeRateFromSwapKit:()=>Ef,estimateTransactionFee:()=>M0,depositMsgAmino:()=>Xf,createTransaction:()=>If,createThorchainToolbox:()=>Af,createStargateClient:()=>V,createSigningStargateClient:()=>h,createOfflineStargateClient:()=>Wf,createDefaultRegistry:()=>l,createDefaultAminoTypes:()=>P,createCosmosToolbox:()=>g,cosmosCreateTransaction:()=>zf,convertToSignable:()=>u,buildTransferTx:()=>$f,buildEncodedTxBody:()=>t,buildDepositTx:()=>cf,buildAminoMsg:()=>ff,bech32ToBase64:()=>b,base64ToBech32:()=>d,YUM_KUJIRA_FACTORY_DENOM:()=>Vf,USK_KUJIRA_FACTORY_DENOM:()=>yf,THORCHAIN_GAS_VALUE:()=>E0,MAYA_GAS_VALUE:()=>F0,DEFAULT_NOBLE_FEE_MAINNET:()=>uf,DEFAULT_KUJI_FEE_MAINNET:()=>Pf,DEFAULT_COSMOS_FEE_MAINNET:()=>Df});var x6=U(()=>{Yf();L0();o()});x6();export{ef as verifySignature,Qf as transferMsgAmino,I0 as toBase64,M as parseAminoMessageForDirectSigning,P0 as getSignerFromPrivateKey,Of as getSignerFromPhrase,D as getMsgSendDenom,u0 as getFeeRateFromSwapKit,i as getDenomWithChain,R as getDefaultChainFee,e0 as getCosmosToolbox,f0 as getCosmosAddressValidator,Gf as getAssetFromDenom,Y0 as fromBase64,Ef as fetchFeeRateFromSwapKit,M0 as estimateTransactionFee,Xf as depositMsgAmino,If as createTransaction,Af as createThorchainToolbox,V as createStargateClient,h as createSigningStargateClient,Wf as createOfflineStargateClient,l as createDefaultRegistry,P as createDefaultAminoTypes,g as createCosmosToolbox,zf as cosmosCreateTransaction,u as convertToSignable,$f as buildTransferTx,t as buildEncodedTxBody,cf as buildDepositTx,ff as buildAminoMsg,b as bech32ToBase64,d as base64ToBech32,Vf as YUM_KUJIRA_FACTORY_DENOM,yf as USK_KUJIRA_FACTORY_DENOM,E0 as THORCHAIN_GAS_VALUE,F0 as MAYA_GAS_VALUE,uf as DEFAULT_NOBLE_FEE_MAINNET,Pf as DEFAULT_KUJI_FEE_MAINNET,Df as DEFAULT_COSMOS_FEE_MAINNET};