@wormhole-foundation/wormhole-connect 1.0.0-beta.3-development → 1.0.0-beta.5-development

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 (154) hide show
  1. package/dist/assets/{ccip-YN27M9dL.js → ccip-B-OK94pJ.js} +1 -1
  2. package/dist/assets/{evm-wKiUiV3-.js → evm-CPj7oFVL.js} +4 -4
  3. package/dist/assets/{index-B9_Snb-C.js → index-BWMdho2w.js} +2 -2
  4. package/dist/assets/{index-8fbGA94c.js → index-DGFWhjyA.js} +1 -1
  5. package/dist/assets/{index-BBy_QGBB.js → index-Ddso83Ti.js} +1 -1
  6. package/dist/assets/{index.es-BY7lrdO_.js → index.es-VchQxXD4.js} +2 -2
  7. package/dist/main.js +115 -62
  8. package/dist/src/components/v2/Button.d.ts +1 -1
  9. package/dist/src/components/v2/Button.d.ts.map +1 -1
  10. package/dist/src/config/types.d.ts +17 -3
  11. package/dist/src/config/types.d.ts.map +1 -1
  12. package/dist/src/hooks/useTransactionHistory.d.ts +1 -1
  13. package/dist/src/hooks/useTransactionHistory.d.ts.map +1 -1
  14. package/dist/src/hooks/useTransactionHistoryMayan.d.ts.map +1 -1
  15. package/dist/src/hooks/useTransactionHistoryWHScan.d.ts.map +1 -1
  16. package/dist/src/icons/TxReadyForClaim.d.ts +2 -2
  17. package/dist/src/icons/TxReadyForClaim.d.ts.map +1 -1
  18. package/dist/src/utils/inProgressTxCache.d.ts +5 -0
  19. package/dist/src/utils/inProgressTxCache.d.ts.map +1 -0
  20. package/dist/src/utils/polling.d.ts +5 -0
  21. package/dist/src/utils/polling.d.ts.map +1 -0
  22. package/dist/src/utils/sdkv2.d.ts +3 -2
  23. package/dist/src/utils/sdkv2.d.ts.map +1 -1
  24. package/dist/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
  25. package/dist/src/views/v2/Bridge/ReviewTransaction/index.d.ts.map +1 -1
  26. package/dist/src/views/v2/Bridge/index.d.ts.map +1 -1
  27. package/dist/src/views/v2/Redeem/index.d.ts.map +1 -1
  28. package/dist/src/views/v2/TxHistory/Widget/Item.d.ts +8 -0
  29. package/dist/src/views/v2/TxHistory/Widget/Item.d.ts.map +1 -0
  30. package/dist/src/views/v2/TxHistory/Widget/index.d.ts +4 -0
  31. package/dist/src/views/v2/TxHistory/Widget/index.d.ts.map +1 -0
  32. package/dist/src/views/v2/TxHistory/index.d.ts.map +1 -1
  33. package/lib/{algorand-DIrI8hux.js → algorand-DFJZIdnH.js} +1 -1
  34. package/lib/{algorand-BZLSulqp.mjs → algorand-qEY4HHOc.mjs} +3 -3
  35. package/lib/{aptos-ClFQX748.mjs → aptos-BCuZuiBG.mjs} +1 -1
  36. package/lib/{aptos-B61S9Mku.js → aptos-BHw0JlTE.js} +1 -1
  37. package/lib/{aptos-poOCeL-e.js → aptos-D-S8DXGs.js} +2 -2
  38. package/lib/{aptos-BXyptrTk.mjs → aptos-DoqExVYR.mjs} +3 -3
  39. package/lib/{ccip-CROSeCCn.js → ccip-CXJ3nCk_.js} +1 -1
  40. package/lib/{ccip-BcLqF-ov.mjs → ccip-_0LmpQds.mjs} +1 -1
  41. package/lib/{cosmos-B7IowZE9.mjs → cosmos-0un-E2-0.mjs} +6 -6
  42. package/lib/{cosmos-D-fRtzTz.js → cosmos-DCgWSBll.js} +1 -1
  43. package/lib/{cosmwasm-BU28GqyN.js → cosmwasm-BsEhYnuw.js} +2 -2
  44. package/lib/{cosmwasm-i8-2LBd4.mjs → cosmwasm-DvwgrLe6.mjs} +7 -7
  45. package/lib/{events-BIfEV615.mjs → events-BL2eUG60.mjs} +1 -1
  46. package/lib/{events-CG085uVS.js → events-wpqGOay9.js} +1 -1
  47. package/lib/{evm-z72BQwjo.js → evm-B46tP5Ah.js} +1 -1
  48. package/lib/{evm-DSo1klm4.js → evm-BOrFw20j.js} +4 -4
  49. package/lib/{evm-BG4p6wWc.mjs → evm-CkxKsuQ-.mjs} +7 -7
  50. package/lib/{evm-DqVh4NBz.mjs → evm-kynWl8-i.mjs} +5 -5
  51. package/lib/{index-Coqx-ZYc.js → index-6gwCyfQU.js} +1 -1
  52. package/lib/{index-B-bMfv9J.mjs → index-BHOu1oLq.mjs} +3 -3
  53. package/lib/{index-9Ifk_2V6.js → index-BNWJG0G4.js} +1 -1
  54. package/lib/{index-Xxsx46yX.mjs → index-BOppeFAI.mjs} +1 -1
  55. package/lib/{index-l3VuXtv4.mjs → index-BTBmklHJ.mjs} +2 -2
  56. package/lib/{index-CQ_e_FtW.js → index-BVz1aMw3.js} +1 -1
  57. package/lib/{index--kQS0wX-.js → index-BWNh4wvK.js} +1 -1
  58. package/lib/{index-x3yNXPc-.js → index-BwCIDEBK.js} +1 -1
  59. package/lib/{index-DkmEXbbA.js → index-C4ri6eMC.js} +1 -1
  60. package/lib/{index-CytdQ1id.js → index-C7amSMG9.js} +1 -1
  61. package/lib/{index-CdnXAZl6.js → index-CAkX47d8.js} +1 -1
  62. package/lib/{index-ByG9EJHX.js → index-CDGktAjP.js} +137 -84
  63. package/lib/{index-CkrE6mmF.js → index-CFVm1KSi.js} +1 -1
  64. package/lib/{index-Cfu2mlWW.mjs → index-CLH7U4rp.mjs} +2 -2
  65. package/lib/{index-BhfoV5RZ.js → index-CNIDBiCc.js} +1 -1
  66. package/lib/{index-xrevpHY6.js → index-CPgdgK8L.js} +1 -1
  67. package/lib/{index-DjSK9SdK.mjs → index-CTwzW64I.mjs} +2 -2
  68. package/lib/{index-Cf-xLfst.js → index-CUInBQd6.js} +1 -1
  69. package/lib/{index-CGmv-GLf.js → index-CaFGZvKm.js} +1 -1
  70. package/lib/{index-DTLOaiZ5.mjs → index-Cb47usqO.mjs} +2 -2
  71. package/lib/{index-BDhzG0Bz.mjs → index-CjwA7HmM.mjs} +5313 -4809
  72. package/lib/{index--orPBbEs.mjs → index-CkPaHAgJ.mjs} +3 -3
  73. package/lib/{index-C1XMdJFH.js → index-ClLbfY74.js} +1 -1
  74. package/lib/{index-CJJaUncM.js → index-ClRkhvNK.js} +1 -1
  75. package/lib/{index-DGI2tbSC.mjs → index-Cm3iq-IJ.mjs} +1 -1
  76. package/lib/{index-DEfagu36.js → index-CtJdy4GW.js} +1 -1
  77. package/lib/{index-BUcxdUpo.mjs → index-D0W1ZmqN.mjs} +2 -2
  78. package/lib/{index-Bn9MsO0e.mjs → index-D5SPCl8N.mjs} +2 -2
  79. package/lib/{index-C8UyzBg3.mjs → index-D6Sqxs9J.mjs} +4 -4
  80. package/lib/{index-BM3TrHYu.mjs → index-DC65dQZI.mjs} +7 -7
  81. package/lib/{index-2u6Q9y32.js → index-DICIR39L.js} +1 -1
  82. package/lib/{index-C8tIBuyM.mjs → index-DIddLRbN.mjs} +1 -1
  83. package/lib/{index-C1t8_dYP.mjs → index-DSSXLwpv.mjs} +1 -1
  84. package/lib/{index-eY_q88kc.js → index-DVKptZW_.js} +1 -1
  85. package/lib/{index-CLiemfL3.js → index-DcbhKZoU.js} +1 -1
  86. package/lib/{index-B51snNHX.mjs → index-DojwGTf0.mjs} +1 -1
  87. package/lib/{index-3CEBQmCn.mjs → index-DrQrqu4U.mjs} +2 -2
  88. package/lib/{index-C262JAz4.mjs → index-DvQkOUhD.mjs} +4 -4
  89. package/lib/{index-C1fq1xT0.mjs → index-Dw4gUoPq.mjs} +2 -2
  90. package/lib/{index-DTtBAHqC.mjs → index-IypSUdxl.mjs} +2 -2
  91. package/lib/{index-GyFHGs5Z.js → index-QfqpopxL.js} +1 -1
  92. package/lib/{index-C2ZrCXVv.mjs → index-SiA6wvOM.mjs} +2 -2
  93. package/lib/{index-D1GFc9u_.js → index-dZuWNqUJ.js} +1 -1
  94. package/lib/{index-DTj0BYI6.mjs → index-fzN-meRd.mjs} +1 -1
  95. package/lib/{index-CYfEuKEC.js → index-hWgZ0Dfs.js} +1 -1
  96. package/lib/{index-BrFyHtHO.js → index-tKKMDrTV.js} +1 -1
  97. package/lib/{index-B3uNul6-.mjs → index-tKooq_Tx.mjs} +3 -3
  98. package/lib/{index-C3Ztf7te.mjs → index-yd8RiLQo.mjs} +4 -4
  99. package/lib/{index.es-CTYy3A6V.js → index.es-BfpZO8dT.js} +2 -2
  100. package/lib/{index.es-zlUSra_a.mjs → index.es-P5wvRtJq.mjs} +5 -5
  101. package/lib/index.js +1 -1
  102. package/lib/index.mjs +1 -1
  103. package/lib/{libsodium-wrappers-BL6m46dv.mjs → libsodium-wrappers-BB6-Iffd.mjs} +1 -1
  104. package/lib/{libsodium-wrappers-_Sv3nUjE.js → libsodium-wrappers-BvMpC4vD.js} +1 -1
  105. package/lib/{pako.esm-Bf33_673.mjs → pako.esm-C7QrkxRd.mjs} +3 -3
  106. package/lib/{pako.esm-CEjOh_1P.js → pako.esm-DlDLS2rv.js} +1 -1
  107. package/lib/{pbkdf2-C3vdgkb4.mjs → pbkdf2-DMV4l9Li.mjs} +1 -1
  108. package/lib/{pbkdf2-BJ3CFykt.js → pbkdf2-Di1EjoiV.js} +1 -1
  109. package/lib/{sei-BXWrZef6.mjs → sei-CnR3Aw9g.mjs} +4 -4
  110. package/lib/{sei-LGYYUG8M.js → sei-RTyi_UJs.js} +1 -1
  111. package/lib/{signer-DaJj3hCp.mjs → signer-BAztlcE7.mjs} +1 -1
  112. package/lib/{signer-BQ4T60Nz.js → signer-CbhSUdvo.js} +1 -1
  113. package/lib/solana-Bkh_veaR.mjs +16 -0
  114. package/lib/solana-CKipdoh2.js +1 -0
  115. package/lib/{solana-Cl4jwD2F.mjs → solana-CP3uz3z9.mjs} +4 -4
  116. package/lib/{solana-AQlZomQ6.js → solana-Cglhypga.js} +1 -1
  117. package/lib/{solanaEmbed.esm-B_5axZif.js → solanaEmbed.esm-8VvaQIYa.js} +1 -1
  118. package/lib/{solanaEmbed.esm-DEMxZG02.mjs → solanaEmbed.esm-DfSXcnar.mjs} +4 -4
  119. package/lib/src/components/v2/Button.d.ts +1 -1
  120. package/lib/src/components/v2/Button.d.ts.map +1 -1
  121. package/lib/src/config/types.d.ts +17 -3
  122. package/lib/src/config/types.d.ts.map +1 -1
  123. package/lib/src/hooks/useTransactionHistory.d.ts +1 -1
  124. package/lib/src/hooks/useTransactionHistory.d.ts.map +1 -1
  125. package/lib/src/hooks/useTransactionHistoryMayan.d.ts.map +1 -1
  126. package/lib/src/hooks/useTransactionHistoryWHScan.d.ts.map +1 -1
  127. package/lib/src/icons/TxReadyForClaim.d.ts +2 -2
  128. package/lib/src/icons/TxReadyForClaim.d.ts.map +1 -1
  129. package/lib/src/utils/inProgressTxCache.d.ts +5 -0
  130. package/lib/src/utils/inProgressTxCache.d.ts.map +1 -0
  131. package/lib/src/utils/polling.d.ts +5 -0
  132. package/lib/src/utils/polling.d.ts.map +1 -0
  133. package/lib/src/utils/sdkv2.d.ts +3 -2
  134. package/lib/src/utils/sdkv2.d.ts.map +1 -1
  135. package/lib/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
  136. package/lib/src/views/v2/Bridge/ReviewTransaction/index.d.ts.map +1 -1
  137. package/lib/src/views/v2/Bridge/index.d.ts.map +1 -1
  138. package/lib/src/views/v2/Redeem/index.d.ts.map +1 -1
  139. package/lib/src/views/v2/TxHistory/Widget/Item.d.ts +8 -0
  140. package/lib/src/views/v2/TxHistory/Widget/Item.d.ts.map +1 -0
  141. package/lib/src/views/v2/TxHistory/Widget/index.d.ts +4 -0
  142. package/lib/src/views/v2/TxHistory/Widget/index.d.ts.map +1 -0
  143. package/lib/src/views/v2/TxHistory/index.d.ts.map +1 -1
  144. package/lib/{sui-IAt2YxVB.js → sui-BLA0P5P1.js} +2 -2
  145. package/lib/{sui-tX-807Bw.js → sui-BMLSVXBy.js} +1 -1
  146. package/lib/{sui-DfdFzATl.mjs → sui-C73zQuHR.mjs} +1 -1
  147. package/lib/{sui-BpKCqOiX.mjs → sui-WPdV6u03.mjs} +4 -4
  148. package/lib/{unsignedTransaction-B1rzGa0o.mjs → unsignedTransaction-BWLDqwPd.mjs} +2 -2
  149. package/lib/{unsignedTransaction-BzNQ2WFS.js → unsignedTransaction-Cl0WbHFW.js} +1 -1
  150. package/lib/{utils-DZZcQv7V.js → utils-CA5brb9u.js} +1 -1
  151. package/lib/{utils-Xa6ErDQY.mjs → utils-Cd5O9nI7.mjs} +2 -2
  152. package/package.json +1 -1
  153. package/lib/solana-6EZacoKb.js +0 -1
  154. package/lib/solana-CbB3tRah.mjs +0 -16
@@ -1,5 +1,5 @@
1
- import { Z as $, cF as J5, ds as Y5, ac as V1, dt as K4, h as X5 } from "./index-BDhzG0Bz.mjs";
2
- import { h as e7, e as t7 } from "./evm-BG4p6wWc.mjs";
1
+ import { Z as $, cF as J5, ds as Y5, ac as V1, dt as K4, h as X5 } from "./index-CjwA7HmM.mjs";
2
+ import { h as e7, e as t7 } from "./evm-CkxKsuQ-.mjs";
3
3
  import * as C3 from "react";
4
4
  import w, { createContext as n7, useState as o3, useEffect as j0, useCallback as r7, useContext as i7 } from "react";
5
5
  import o7 from "react-dom";
@@ -1 +1 @@
1
- "use strict";var T=Object.defineProperty;var C=(m,e,t)=>e in m?T(m,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):m[e]=t;var d=(m,e,t)=>C(m,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-CYfEuKEC.js");const c=require("./cosmwasm-BU28GqyN.js"),i=require("./unsignedTransaction-BzNQ2WFS.js"),s=require("./index-ByG9EJHX.js");class l{constructor(e,t,r,n){d(this,"network");d(this,"chain");d(this,"rpc");d(this,"contracts");d(this,"tokenBridge");d(this,"translator");this.network=e,this.chain=t,this.rpc=r,this.contracts=n;const a=this.contracts.tokenBridge;if(!a)throw new Error(`Wormhole Token Bridge contract for domain ${t} not found`);if(this.tokenBridge=a,this.translator=this.contracts.translator,this.translator!==void 0&&this.translator==="")throw new Error("Translator address may be undefined but not empty string")}static async fromRpc(e,t){const[r,n]=await c.CosmwasmPlatform.chainFromRpc(e),a=t[n];if(a.network!==r)throw new Error(`Network mismatch: ${a.network} != ${r}`);return new l(r,n,e,t[n].contracts)}async isWrappedAsset(e){try{return await this.getOriginalAsset(e),!0}catch{}return!1}async hasWrappedAsset(e){try{return await this.getWrappedAsset(e),!0}catch{}return!1}async getWrappedAsset(e){if(e.chain===this.chain)throw new Error(`Expected foreign chain, got ${e.chain}`);if(s.isNative(e.address))throw new Error("Native asset cannot be a wrapped asset");const t=s.b64.encode(e.address.toUniversalAddress().toUint8Array()),{address:r}=await this.rpc.queryContractSmart(this.tokenBridge,{wrapped_registry:{chain:s.toChainId(e.chain),address:t}});return s.toNative(this.chain,r)}async getOriginalAsset(e){let t=new s.CosmwasmAddress(e);t.denomType==="factory"&&(t=c.Gateway.factoryToCw20(t));const r=await this.rpc.queryContractSmart(t.toString(),{wrapped_asset_info:{}}),n=s.toChain(r.asset_chain),a=s.b64.decode(r.asset_address);return{chain:n,address:new s.UniversalAddress(new Uint8Array(a))}}async getTokenUniversalAddress(e){return new s.CosmwasmAddress(e).toUniversalAddress()}async getTokenNativeAddress(e,t){return new s.CosmwasmAddress(t).toNative()}async isTransferCompleted(e){const t=s.b64.encode(s.serialize(e));return(await this.rpc.queryContractSmart(this.tokenBridge,{is_vaa_redeemed:{vaa:t}})).is_redeemed}async*createAttestation(e,t){if(!t)throw new Error("Payer required to create attestation");const r=new s.CosmwasmAddress(e).toString(),n=new s.CosmwasmAddress(t).toString(),a=0,w=s.isNative(e)?{native_token:{denom:c.CosmwasmPlatform.getNativeDenom(this.network,this.chain)}}:{token:{contract_addr:r}};yield this.createUnsignedTx({msgs:[i.buildExecuteMsg(n,this.tokenBridge,{create_asset_meta:{asset_info:w,nonce:a}})],fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Create Attestation"},"TokenBridge.createAttestation")}async*submitAttestation(e,t){if(!t)throw new Error("Payer required to submit attestation");const r=new s.CosmwasmAddress(t).toString();yield this.createUnsignedTx({msgs:[i.buildExecuteMsg(r,this.tokenBridge,{submit_vaa:{data:s.serialize(e)}})],fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Submit Attestation"},"TokenBridge.submitAttestation")}async*transfer(e,t,r,n,a){const w=Math.round(Math.random()*1e5),u="0",k=s.toChainId(t.chain),A=s.b64.encode(t.address.toUniversalAddress().toUint8Array()),v=c.CosmwasmPlatform.getNativeDenom(this.network,this.chain),f=s.isNative(r);let o=f?v:r.toString();o.startsWith("factory")&&(o=c.Gateway.factoryToCw20(new s.CosmwasmAddress(o)).toString());const g=new s.CosmwasmAddress(e).toString(),p=h=>{const y={asset:{amount:n.toString(),info:h},recipient_chain:k,recipient:A,fee:u,nonce:w};return a?{initiate_transfer_with_payload:{...y,payload:s.b64.encode(a)}}:{initiate_transfer:y}};if(f){const h=[i.buildExecuteMsg(g,this.tokenBridge,{deposit_tokens:{}},[{amount:n.toString(),denom:o}]),i.buildExecuteMsg(g,this.tokenBridge,p({native_token:{denom:o}}))];yield this.createUnsignedTx({msgs:h,fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Initiate Native Transfer"},"TokenBridge.transferNative")}else{const h=[i.buildExecuteMsg(g,o,{increase_allowance:{spender:this.tokenBridge,amount:n.toString(),expires:{never:{}}}}),i.buildExecuteMsg(g,this.tokenBridge,p({token:{contract_addr:o}}),[{amount:n.toString(),denom:o}])];yield this.createUnsignedTx({msgs:h,fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Initiate Transfer"},"TokenBridge.transfer")}}async*redeem(e,t,r=!0){const n=s.b64.encode(s.serialize(t)),a=new s.CosmwasmAddress(e).toString(),u=this.translator&&new s.CosmwasmAddress(this.translator).toUniversalAddress().equals(t.payload.to.address)?i.buildExecuteMsg(a,this.translator,{complete_transfer_and_convert:{vaa:n}}):i.buildExecuteMsg(a,this.tokenBridge,{submit_vaa:{data:n}});yield this.createUnsignedTx({msgs:[u],fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Complete Transfer"},"TokenBridge.redeem")}async parseTransactionDetails(e){throw new Error("Not implemented")}async getWrappedNative(){return s.toNative(this.chain,c.CosmwasmPlatform.getNativeDenom(this.network,this.chain))}createUnsignedTx(e,t,r=!1){return new i.CosmwasmUnsignedTransaction(e,this.network,this.chain,t,r)}}s.registerProtocol(s._platform$3,"TokenBridge",l);exports.CosmwasmTokenBridge=l;
1
+ "use strict";var T=Object.defineProperty;var C=(m,e,t)=>e in m?T(m,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):m[e]=t;var d=(m,e,t)=>C(m,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-hWgZ0Dfs.js");const c=require("./cosmwasm-BsEhYnuw.js"),i=require("./unsignedTransaction-Cl0WbHFW.js"),s=require("./index-CDGktAjP.js");class l{constructor(e,t,r,n){d(this,"network");d(this,"chain");d(this,"rpc");d(this,"contracts");d(this,"tokenBridge");d(this,"translator");this.network=e,this.chain=t,this.rpc=r,this.contracts=n;const a=this.contracts.tokenBridge;if(!a)throw new Error(`Wormhole Token Bridge contract for domain ${t} not found`);if(this.tokenBridge=a,this.translator=this.contracts.translator,this.translator!==void 0&&this.translator==="")throw new Error("Translator address may be undefined but not empty string")}static async fromRpc(e,t){const[r,n]=await c.CosmwasmPlatform.chainFromRpc(e),a=t[n];if(a.network!==r)throw new Error(`Network mismatch: ${a.network} != ${r}`);return new l(r,n,e,t[n].contracts)}async isWrappedAsset(e){try{return await this.getOriginalAsset(e),!0}catch{}return!1}async hasWrappedAsset(e){try{return await this.getWrappedAsset(e),!0}catch{}return!1}async getWrappedAsset(e){if(e.chain===this.chain)throw new Error(`Expected foreign chain, got ${e.chain}`);if(s.isNative(e.address))throw new Error("Native asset cannot be a wrapped asset");const t=s.b64.encode(e.address.toUniversalAddress().toUint8Array()),{address:r}=await this.rpc.queryContractSmart(this.tokenBridge,{wrapped_registry:{chain:s.toChainId(e.chain),address:t}});return s.toNative(this.chain,r)}async getOriginalAsset(e){let t=new s.CosmwasmAddress(e);t.denomType==="factory"&&(t=c.Gateway.factoryToCw20(t));const r=await this.rpc.queryContractSmart(t.toString(),{wrapped_asset_info:{}}),n=s.toChain(r.asset_chain),a=s.b64.decode(r.asset_address);return{chain:n,address:new s.UniversalAddress(new Uint8Array(a))}}async getTokenUniversalAddress(e){return new s.CosmwasmAddress(e).toUniversalAddress()}async getTokenNativeAddress(e,t){return new s.CosmwasmAddress(t).toNative()}async isTransferCompleted(e){const t=s.b64.encode(s.serialize(e));return(await this.rpc.queryContractSmart(this.tokenBridge,{is_vaa_redeemed:{vaa:t}})).is_redeemed}async*createAttestation(e,t){if(!t)throw new Error("Payer required to create attestation");const r=new s.CosmwasmAddress(e).toString(),n=new s.CosmwasmAddress(t).toString(),a=0,w=s.isNative(e)?{native_token:{denom:c.CosmwasmPlatform.getNativeDenom(this.network,this.chain)}}:{token:{contract_addr:r}};yield this.createUnsignedTx({msgs:[i.buildExecuteMsg(n,this.tokenBridge,{create_asset_meta:{asset_info:w,nonce:a}})],fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Create Attestation"},"TokenBridge.createAttestation")}async*submitAttestation(e,t){if(!t)throw new Error("Payer required to submit attestation");const r=new s.CosmwasmAddress(t).toString();yield this.createUnsignedTx({msgs:[i.buildExecuteMsg(r,this.tokenBridge,{submit_vaa:{data:s.serialize(e)}})],fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Submit Attestation"},"TokenBridge.submitAttestation")}async*transfer(e,t,r,n,a){const w=Math.round(Math.random()*1e5),u="0",k=s.toChainId(t.chain),A=s.b64.encode(t.address.toUniversalAddress().toUint8Array()),v=c.CosmwasmPlatform.getNativeDenom(this.network,this.chain),f=s.isNative(r);let o=f?v:r.toString();o.startsWith("factory")&&(o=c.Gateway.factoryToCw20(new s.CosmwasmAddress(o)).toString());const g=new s.CosmwasmAddress(e).toString(),p=h=>{const y={asset:{amount:n.toString(),info:h},recipient_chain:k,recipient:A,fee:u,nonce:w};return a?{initiate_transfer_with_payload:{...y,payload:s.b64.encode(a)}}:{initiate_transfer:y}};if(f){const h=[i.buildExecuteMsg(g,this.tokenBridge,{deposit_tokens:{}},[{amount:n.toString(),denom:o}]),i.buildExecuteMsg(g,this.tokenBridge,p({native_token:{denom:o}}))];yield this.createUnsignedTx({msgs:h,fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Initiate Native Transfer"},"TokenBridge.transferNative")}else{const h=[i.buildExecuteMsg(g,o,{increase_allowance:{spender:this.tokenBridge,amount:n.toString(),expires:{never:{}}}}),i.buildExecuteMsg(g,this.tokenBridge,p({token:{contract_addr:o}}),[{amount:n.toString(),denom:o}])];yield this.createUnsignedTx({msgs:h,fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Initiate Transfer"},"TokenBridge.transfer")}}async*redeem(e,t,r=!0){const n=s.b64.encode(s.serialize(t)),a=new s.CosmwasmAddress(e).toString(),u=this.translator&&new s.CosmwasmAddress(this.translator).toUniversalAddress().equals(t.payload.to.address)?i.buildExecuteMsg(a,this.translator,{complete_transfer_and_convert:{vaa:n}}):i.buildExecuteMsg(a,this.tokenBridge,{submit_vaa:{data:n}});yield this.createUnsignedTx({msgs:[u],fee:i.computeFee(this.network,this.chain),memo:"Wormhole - Complete Transfer"},"TokenBridge.redeem")}async parseTransactionDetails(e){throw new Error("Not implemented")}async getWrappedNative(){return s.toNative(this.chain,c.CosmwasmPlatform.getNativeDenom(this.network,this.chain))}createUnsignedTx(e,t,r=!1){return new i.CosmwasmUnsignedTransaction(e,this.network,this.chain,t,r)}}s.registerProtocol(s._platform$3,"TokenBridge",l);exports.CosmwasmTokenBridge=l;
@@ -1 +1 @@
1
- "use strict";var m=Object.defineProperty;var w=(i,e,t)=>e in i?m(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var s=(i,e,t)=>w(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-ByG9EJHX.js"),g=require("./aptos-poOCeL-e.js");class d{constructor(e,t,r,o){s(this,"network");s(this,"chain");s(this,"connection");s(this,"contracts");s(this,"chainId");s(this,"coreBridge");this.network=e,this.chain=t,this.connection=r,this.contracts=o,this.chainId=c.toChainId(t);const n=o.coreBridge;if(!n)throw new Error(`CoreBridge contract Address for chain ${t} not found`);this.coreBridge=n}getGuardianSet(e){throw new Error("Method not implemented.")}getGuardianSetIndex(){throw new Error("Method not implemented.")}getMessageFee(){throw new Error("Method not implemented.")}static async fromRpc(e,t){const[r,o]=await g.AptosPlatform.chainFromRpc(e),n=t[o];if(n.network!==r)throw new Error(`Network mismatch: ${n.network} !== ${r}`);return new d(r,o,e,n.contracts)}async*publishMessage(e,t){throw new Error("Method not implemented.")}async*verifyMessage(e,t){throw new Error("Not implemented.")}async parseTransaction(e){return(await this.parseMessages(e)).map(r=>({chain:r.emitterChain,emitter:r.emitterAddress,sequence:r.sequence}))}async parseMessages(e){const t=await this.connection.getTransactionByHash(e);if(t.type!=="user_transaction")throw new Error(`${e} is not a user_transaction`);const o=t.events.filter(n=>n.type.endsWith("WormholeMessage"));if(!o||o.length===0)throw new Error(`WormholeMessage not found for ${e}`);return o.map(n=>{const a=n.data,h=new c.UniversalAddress(BigInt(a.sender).toString(16).padStart(64,"0"));return c.createVAA("Uint8Array",{guardianSet:0,emitterChain:this.chain,emitterAddress:h,sequence:BigInt(a.sequence),timestamp:Number(a.timestamp),consistencyLevel:a.consistency_level,nonce:Number(a.nonce),signatures:[],payload:c.hex.decode(a.payload)})})}}c.registerProtocol("Aptos","WormholeCore",d);exports.AptosWormholeCore=d;
1
+ "use strict";var m=Object.defineProperty;var w=(i,e,t)=>e in i?m(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var s=(i,e,t)=>w(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-CDGktAjP.js"),g=require("./aptos-D-S8DXGs.js");class d{constructor(e,t,r,o){s(this,"network");s(this,"chain");s(this,"connection");s(this,"contracts");s(this,"chainId");s(this,"coreBridge");this.network=e,this.chain=t,this.connection=r,this.contracts=o,this.chainId=c.toChainId(t);const n=o.coreBridge;if(!n)throw new Error(`CoreBridge contract Address for chain ${t} not found`);this.coreBridge=n}getGuardianSet(e){throw new Error("Method not implemented.")}getGuardianSetIndex(){throw new Error("Method not implemented.")}getMessageFee(){throw new Error("Method not implemented.")}static async fromRpc(e,t){const[r,o]=await g.AptosPlatform.chainFromRpc(e),n=t[o];if(n.network!==r)throw new Error(`Network mismatch: ${n.network} !== ${r}`);return new d(r,o,e,n.contracts)}async*publishMessage(e,t){throw new Error("Method not implemented.")}async*verifyMessage(e,t){throw new Error("Not implemented.")}async parseTransaction(e){return(await this.parseMessages(e)).map(r=>({chain:r.emitterChain,emitter:r.emitterAddress,sequence:r.sequence}))}async parseMessages(e){const t=await this.connection.getTransactionByHash(e);if(t.type!=="user_transaction")throw new Error(`${e} is not a user_transaction`);const o=t.events.filter(n=>n.type.endsWith("WormholeMessage"));if(!o||o.length===0)throw new Error(`WormholeMessage not found for ${e}`);return o.map(n=>{const a=n.data,h=new c.UniversalAddress(BigInt(a.sender).toString(16).padStart(64,"0"));return c.createVAA("Uint8Array",{guardianSet:0,emitterChain:this.chain,emitterAddress:h,sequence:BigInt(a.sequence),timestamp:Number(a.timestamp),consistencyLevel:a.consistency_level,nonce:Number(a.nonce),signatures:[],payload:c.hex.decode(a.payload)})})}}c.registerProtocol("Aptos","WormholeCore",d);exports.AptosWormholeCore=d;
@@ -1,8 +1,8 @@
1
1
  var m = Object.defineProperty;
2
2
  var w = (i, e, t) => e in i ? m(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
3
  var a = (i, e, t) => w(i, typeof e != "symbol" ? e + "" : e, t);
4
- import { C as u } from "./cosmwasm-i8-2LBd4.mjs";
5
- import { cL as g, c9 as l, u as h, bR as p, a9 as f } from "./index-BDhzG0Bz.mjs";
4
+ import { C as u } from "./cosmwasm-DvwgrLe6.mjs";
5
+ import { cL as g, c9 as l, u as h, bR as p, a9 as f } from "./index-CjwA7HmM.mjs";
6
6
  class c {
7
7
  constructor(e, t, s, r) {
8
8
  a(this, "network");
@@ -1 +1 @@
1
- "use strict";var h=Object.defineProperty;var m=(a,e,r)=>e in a?h(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r;var o=(a,e,r)=>m(a,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-ByG9EJHX.js"),u=require("./sui-IAt2YxVB.js");class d{constructor(e,r,t,n){o(this,"network");o(this,"chain");o(this,"provider");o(this,"contracts");o(this,"chainId");o(this,"coreBridgePackageId");this.network=e,this.chain=r,this.provider=t,this.contracts=n,this.chainId=c.toChainId(r);const s=n.coreBridge;if(!s)throw new Error(`CoreBridge contract Address for chain ${r} not found`);this.coreBridgePackageId=s}getGuardianSet(e){throw new Error("Method not implemented.")}getMessageFee(){throw new Error("Method not implemented.")}static async fromRpc(e,r){const[t,n]=await u.SuiPlatform.chainFromRpc(e),s=r[n];if(s.network!==t)throw new Error(`Network mismatch: ${s.network} !== ${t}`);return new d(t,n,e,s.contracts)}async*verifyMessage(e,r){throw new Error("Method not implemented.")}async*publishMessage(e,r){throw new Error("Method not implemented.")}async parseTransaction(e){return(await this.parseMessages(e)).map(t=>({emitter:t.emitterAddress,sequence:t.sequence,chain:this.chain}))}async getGuardianSetIndex(){throw new Error("Method not implemented.")}async parseMessages(e){var n;const t=(n=(await this.provider.getTransactionBlock({digest:e,options:{showEvents:!0,showEffects:!0,showInput:!0}})).events)==null?void 0:n.filter(s=>s.type.endsWith("WormholeMessage"));if(!t||t.length==0)throw new Error("WormholeMessage not found");return t.map(s=>{const i=s.parsedJson;return c.createVAA("Uint8Array",{emitterChain:this.chain,emitterAddress:new c.SuiAddress(i.sender).toUniversalAddress(),sequence:BigInt(i.sequence),guardianSet:0,timestamp:Number(i.timestamp),consistencyLevel:i.consistency_level,nonce:i.nonce,signatures:[],payload:new Uint8Array(i.payload)})})}}c.registerProtocol("Sui","WormholeCore",d);exports.SuiWormholeCore=d;
1
+ "use strict";var h=Object.defineProperty;var m=(a,e,r)=>e in a?h(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r;var o=(a,e,r)=>m(a,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-CDGktAjP.js"),u=require("./sui-BLA0P5P1.js");class d{constructor(e,r,t,n){o(this,"network");o(this,"chain");o(this,"provider");o(this,"contracts");o(this,"chainId");o(this,"coreBridgePackageId");this.network=e,this.chain=r,this.provider=t,this.contracts=n,this.chainId=c.toChainId(r);const s=n.coreBridge;if(!s)throw new Error(`CoreBridge contract Address for chain ${r} not found`);this.coreBridgePackageId=s}getGuardianSet(e){throw new Error("Method not implemented.")}getMessageFee(){throw new Error("Method not implemented.")}static async fromRpc(e,r){const[t,n]=await u.SuiPlatform.chainFromRpc(e),s=r[n];if(s.network!==t)throw new Error(`Network mismatch: ${s.network} !== ${t}`);return new d(t,n,e,s.contracts)}async*verifyMessage(e,r){throw new Error("Method not implemented.")}async*publishMessage(e,r){throw new Error("Method not implemented.")}async parseTransaction(e){return(await this.parseMessages(e)).map(t=>({emitter:t.emitterAddress,sequence:t.sequence,chain:this.chain}))}async getGuardianSetIndex(){throw new Error("Method not implemented.")}async parseMessages(e){var n;const t=(n=(await this.provider.getTransactionBlock({digest:e,options:{showEvents:!0,showEffects:!0,showInput:!0}})).events)==null?void 0:n.filter(s=>s.type.endsWith("WormholeMessage"));if(!t||t.length==0)throw new Error("WormholeMessage not found");return t.map(s=>{const i=s.parsedJson;return c.createVAA("Uint8Array",{emitterChain:this.chain,emitterAddress:new c.SuiAddress(i.sender).toUniversalAddress(),sequence:BigInt(i.sequence),guardianSet:0,timestamp:Number(i.timestamp),consistencyLevel:i.consistency_level,nonce:i.nonce,signatures:[],payload:new Uint8Array(i.payload)})})}}c.registerProtocol("Sui","WormholeCore",d);exports.SuiWormholeCore=d;
@@ -1 +1 @@
1
- "use strict";var D=Object.defineProperty;var q=(o,e,n)=>e in o?D(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n;var p=(o,e,n)=>q(o,typeof e!="symbol"?e+"":e,n);const t=require("./index-ByG9EJHX.js"),H=require("./algorand-DIrI8hux.js");class j{constructor(e,n,r,s,i=!1){p(this,"transaction");p(this,"network");p(this,"chain");p(this,"description");p(this,"parallelizable");this.transaction=e,this.network=n,this.chain=r,this.description=s,this.parallelizable=i}}const K=1002e3,O=15,U=127,L=8,R=U*L,V=U*O,N=L*V,m={_limit:127,encodingLength:o=>{let e=0;for(;o>=128;e++)o>>=7;return e+1},encode:(o,e,n)=>{if(typeof o=="bigint"&&(o=t.safeBigIntToNumber(o)),o<0)throw new RangeError("value must be unsigned");const r=m.encodingLength(o);if(e=e||new ArrayBuffer(r),n=n||0,e.byteLength<n+r)throw new RangeError("the buffer is too small to encode the number at the offset");const s=new Uint8Array(e,n);let i=0;for(;m._limit<o;)s[i++]=o&m._limit|128,o>>=7;return s[i]=Number(o),s},decode:(o,e=0)=>{let n=0,r=0,s;do{if(s=o[e+r],s===void 0)throw new RangeError("offset out of range");n+=(s&m._limit)<<r*7,r++}while(128<=s);return n}},u={forMessageId:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey,r=e.emitter.toUniversalAddress().toUint8Array(),s=t.bignum.toBytes(BigInt(t.toChainId(e.chain)),2),i=t.bytes.concat(s,r);return u.fromData({appId:o,appAddress:n,idx:e.sequence/BigInt(N),address:i})},forWrappedAsset:(o,e)=>{if(t.isNative(e.address))throw new Error("native asset cannot be a wrapped asset");const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:BigInt(t.toChainId(e.chain)),address:e.address.toUniversalAddress().toUint8Array()})},forNativeAsset:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:e,address:t.bytes.encode("native")})},forGuardianSet:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:BigInt(e),address:t.bytes.encode("guardian")})},forEmitter:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:0n,address:e})},_encode:o=>typeof o=="bigint"?[t.hex.encode(m.encode(o))]:[t.hex.encode(m.encode(o.length)),t.hex.encode(o)],fromData:o=>{const e=["0620010181",...u._encode(o.idx),"4880",...u._encode(o.address),"483110810612443119221244311881",...u._encode(o.appId),"1244312080",...u._encode(o.appAddress),"124431018100124431093203124431153203124422"],n=t.hex.decode(e.join(""));return new t.LogicSigAccount(n)},decodeLocalState:async(o,e,n)=>{let r;try{const a=await o.accountApplicationInformation(n,t.safeBigIntToNumber(e)).do();r=t.AccountApplicationResponse.from_obj_for_encoding(a).appLocalState}catch{return new Uint8Array}const s=t.b64.encode("meta");let i=new Map;for(const a of r.keyValue){if(a.key===s)continue;const g=t.b64.decode(a.key)[0],l=t.b64.decode(a.value.bytes);i.set(g,l)}const d=[];for(let a=0;a<O;a++)i.has(a)&&d.push(i.get(a));return t.bytes.concat(...d)},checkBitsSet:async(o,e,n,r)=>{let s=!1,i;const d=await o.accountInformation(n).do(),g=t.Account.from_obj_for_encoding(d).appsLocalState;if(g&&g.forEach(h=>{BigInt(h.id)===e&&(i=h.keyValue)}),(i==null?void 0:i.length)===0)return s;const l=BigInt(N),f=BigInt(8),y=r/l*l,b=t.safeBigIntToNumber(r-y),T=Math.floor(b/R),x=Math.floor((b-T*R)/8),B=t.b64.encode(t.bignum.toBytes(T,1));return i==null||i.forEach(h=>{if(h.key===B){const _=t.dist.Buffer.from(h.value.bytes,"base64"),w=1<<t.safeBigIntToNumber(r%f);s=(_[x]&w)!=0;return}}),s},storageAccountExists:async(o,e,n)=>{try{const r=await o.accountApplicationInformation(e,t.safeBigIntToNumber(n)).do();return Object.keys(r).length>0}catch{}return!1}},c=class c{constructor(e,n,r,s){p(this,"network");p(this,"chain");p(this,"connection");p(this,"contracts");p(this,"chainId");p(this,"coreAppId");p(this,"coreAppAddress");p(this,"tokenBridgeAppId");p(this,"tokenBridgeAppAddress");if(this.network=e,this.chain=n,this.connection=r,this.contracts=s,this.chainId=t.toChainId(n),!s.coreBridge)throw new Error(`Core contract address for chain ${n} not found`);const i=BigInt(s.coreBridge);if(this.coreAppId=i,this.coreAppAddress=t.getApplicationAddress(i),!s.tokenBridge)throw new Error(`TokenBridge contract address for chain ${n} not found`);const d=BigInt(s.tokenBridge);this.tokenBridgeAppId=d,this.tokenBridgeAppAddress=t.getApplicationAddress(d)}getGuardianSet(e){throw new Error("Method not implemented.")}async*verifyMessage(e,n,r){const s=new t.AlgorandAddress(e).toString(),i=await c.submitVAAHeader(this.connection,this.coreAppId,r??this.coreAppId,n,s);for(const d of i.txs)yield this.createUnsignedTx(d,"Core.verifyMessage")}static async fromRpc(e,n){const[r,s]=await H.AlgorandPlatform.chainFromRpc(e),i=n[s];if(i.network!==r)throw new Error(`Network mismatch: ${i.network} !== ${r}`);return new c(r,s,e,i.contracts)}async*publishMessage(e,n){const r=new t.AlgorandAddress(e),s=r.toString(),i=await this.connection.getTransactionParams().do(),d=u.forEmitter(this.coreAppId,r.toUint8Array()),{accounts:a,txs:g}=await c.maybeCreateStorageTx(this.connection,s,this.coreAppId,d,i);for(const f of g)yield this.createUnsignedTx(f,"Core.publishMessage",!0);const l=t.makeApplicationCallTxnFromObject({from:s,appIndex:t.safeBigIntToNumber(this.coreAppId),appArgs:[c.publishMessage,n,t.bignum.toBytes(0n,8)],accounts:a,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:i});yield this.createUnsignedTx({tx:l},"Core.publishMessage",!0)}async getMessageFee(){var s;const e=await this.connection.getApplicationByID(t.safeBigIntToNumber(this.coreAppId)).do(),r=(s=t.Application.from_obj_for_encoding(e).params.globalState)==null?void 0:s.find(i=>i.key===c.feeKey);return r?BigInt(r.value.uint):0n}async getGuardianSetIndex(){throw new Error("Not implemented")}async parseTransaction(e){const n=await this.connection.pendingTransactionInformation(e).do(),r=t.PendingTransactionResponse.from_obj_for_encoding(n);return this.parseTx(r).map(s=>({chain:s.emitterChain,emitter:s.emitterAddress,sequence:s.sequence}))}async parseMessages(e){const n=await this.connection.pendingTransactionInformation(e).do(),r=t.PendingTransactionResponse.from_obj_for_encoding(n);return this.parseTx(r)}parseTx(e){const n=[];if(e.innerTxns&&e.innerTxns.length>0&&n.push(...e.innerTxns.flatMap(g=>this.parseTx(g))),BigInt(e.txn.txn.apid??0)!==this.coreAppId||!e.logs||e.logs.length===0)return n;const r=e.txn.txn.apaa??[];if(r.length!==3||!t.bytes.equals(new Uint8Array(r[0]),c.publishMessage))return n;const s=t.bignum.decode(e.logs[0]),i=new t.AlgorandAddress(e.txn.txn.snd).toUniversalAddress(),d=new Uint8Array(r[1]),a=t.bignum.decode(r[2]);return n.push(t.createVAA("Uint8Array",{emitterChain:this.chain,emitterAddress:i,sequence:s,guardianSet:0,timestamp:0,consistencyLevel:0,nonce:Number(a),payload:d,signatures:[]})),n}static async maybeCreateStorageTx(e,n,r,s,i){const d=t.getApplicationAddress(r),a=s.address(),g=[];if(await u.storageAccountExists(e,a,r))return{accounts:[a],txs:g};i=i??await e.getTransactionParams().do();const l=t.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:a,amount:K,suggestedParams:i});l.fee=l.fee*2,g.push({tx:l});const f=t.makeApplicationOptInTxnFromObject({from:a,appIndex:t.safeBigIntToNumber(r),rekeyTo:d,suggestedParams:i});return f.fee=0,g.push({tx:f,signer:{address:s.address(),signTxn:y=>Promise.resolve(t.signLogicSigTransaction(y,s).blob)}}),{accounts:[a],txs:g}}static async submitVAAHeader(e,n,r,s,i,d){d=d??await e.getTransactionParams().do();let a=[];const g=u.forMessageId(r,{chain:s.emitterChain,sequence:s.sequence,emitter:s.emitterAddress}),{accounts:l,txs:f}=await c.maybeCreateStorageTx(e,i,r,g,d);a.push(...f);const y=u.forGuardianSet(n,s.guardianSet),{accounts:[b],txs:T}=await c.maybeCreateStorageTx(e,i,n,y,d);a.push(...T);let x=[...l,b];const B=await u.decodeLocalState(e,n,b),h=t.keccak_256(s.hash),_=s.signatures.length,w=Math.ceil(_/c.MAX_SIGS_PER_TXN),k=20,C=new t.LogicSigAccount(c.ALGO_VERIFY);for(let M=0;M<w;M++){const v=M*c.MAX_SIGS_PER_TXN,S=s.signatures.slice(v,v+c.MAX_SIGS_PER_TXN),F=S.length*k,G=new Uint8Array(F);for(let A=0;A<S.length;A++){const P=S[A],Y=B.slice(P.guardianIndex*k+1,(P.guardianIndex+1)*k+1);G.set(Y,A*20)}const X=t.makeApplicationCallTxnFromObject({appArgs:[c.verifySigs,t.bytes.concat(...S.map(A=>t.bytes.concat(new Uint8Array([A.guardianIndex]),A.signature.encode()))),G,h],accounts:x,appIndex:t.safeBigIntToNumber(n),from:c.ALGO_VERIFY_HASH,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:d});X.fee=0,a.push({tx:X,signer:{address:C.address(),signTxn:A=>Promise.resolve(t.signLogicSigTransaction(A,C).blob)}})}const E=t.makeApplicationCallTxnFromObject({appArgs:[c.verifyVaa,t.serialize(s)],accounts:x,appIndex:t.safeBigIntToNumber(n),from:i,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:d});return E.fee=E.fee*(2+w),a.push({tx:E}),{accounts:x,txs:a}}createUnsignedTx(e,n,r=!0){return new j(e,this.network,this.chain,n,r)}};p(c,"MAX_SIGS_PER_TXN",6),p(c,"ALGO_VERIFY_HASH","EZATROXX2HISIRZDRGXW4LRQ46Z6IUJYYIHU3PJGP7P5IQDPKVX42N767A"),p(c,"ALGO_VERIFY",new Uint8Array([6,32,4,1,0,32,20,38,1,0,49,32,50,3,18,68,49,1,35,18,68,49,16,129,6,18,68,54,26,1,54,26,3,54,26,2,136,0,3,68,34,67,53,2,53,1,53,0,40,53,240,40,53,241,52,0,21,53,5,35,53,3,35,53,4,52,3,52,5,12,65,0,68,52,1,52,0,52,3,129,65,8,34,88,23,52,0,52,3,34,8,36,88,52,0,52,3,129,33,8,36,88,7,0,53,241,53,240,52,2,52,4,37,88,52,240,52,241,80,2,87,12,20,18,68,52,3,129,66,8,53,3,52,4,37,8,53,4,66,255,180,34,137])),p(c,"feeKey",t.b64.encode("MessageFee")),p(c,"verifyVaa",t.bytes.encode("verifyVAA")),p(c,"verifySigs",t.bytes.encode("verifySigs")),p(c,"publishMessage",t.bytes.encode("publishMessage"));let I=c;t.registerProtocol("Algorand","WormholeCore",I);const z=Object.freeze(Object.defineProperty({__proto__:null,AlgorandWormholeCore:I,BITS_PER_BYTE:L,BITS_PER_KEY:R,MAX_BITS:N,MAX_BYTES:V,MAX_BYTES_PER_KEY:U,MAX_KEYS:O,SEED_AMT:K,StorageLogicSig:u,varint:m},Symbol.toStringTag,{value:"Module"}));exports.AlgorandUnsignedTransaction=j;exports.AlgorandWormholeCore=I;exports.StorageLogicSig=u;exports.index=z;
1
+ "use strict";var D=Object.defineProperty;var q=(o,e,n)=>e in o?D(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n;var p=(o,e,n)=>q(o,typeof e!="symbol"?e+"":e,n);const t=require("./index-CDGktAjP.js"),H=require("./algorand-DFJZIdnH.js");class j{constructor(e,n,r,s,i=!1){p(this,"transaction");p(this,"network");p(this,"chain");p(this,"description");p(this,"parallelizable");this.transaction=e,this.network=n,this.chain=r,this.description=s,this.parallelizable=i}}const K=1002e3,O=15,U=127,L=8,R=U*L,V=U*O,N=L*V,m={_limit:127,encodingLength:o=>{let e=0;for(;o>=128;e++)o>>=7;return e+1},encode:(o,e,n)=>{if(typeof o=="bigint"&&(o=t.safeBigIntToNumber(o)),o<0)throw new RangeError("value must be unsigned");const r=m.encodingLength(o);if(e=e||new ArrayBuffer(r),n=n||0,e.byteLength<n+r)throw new RangeError("the buffer is too small to encode the number at the offset");const s=new Uint8Array(e,n);let i=0;for(;m._limit<o;)s[i++]=o&m._limit|128,o>>=7;return s[i]=Number(o),s},decode:(o,e=0)=>{let n=0,r=0,s;do{if(s=o[e+r],s===void 0)throw new RangeError("offset out of range");n+=(s&m._limit)<<r*7,r++}while(128<=s);return n}},u={forMessageId:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey,r=e.emitter.toUniversalAddress().toUint8Array(),s=t.bignum.toBytes(BigInt(t.toChainId(e.chain)),2),i=t.bytes.concat(s,r);return u.fromData({appId:o,appAddress:n,idx:e.sequence/BigInt(N),address:i})},forWrappedAsset:(o,e)=>{if(t.isNative(e.address))throw new Error("native asset cannot be a wrapped asset");const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:BigInt(t.toChainId(e.chain)),address:e.address.toUniversalAddress().toUint8Array()})},forNativeAsset:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:e,address:t.bytes.encode("native")})},forGuardianSet:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:BigInt(e),address:t.bytes.encode("guardian")})},forEmitter:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:0n,address:e})},_encode:o=>typeof o=="bigint"?[t.hex.encode(m.encode(o))]:[t.hex.encode(m.encode(o.length)),t.hex.encode(o)],fromData:o=>{const e=["0620010181",...u._encode(o.idx),"4880",...u._encode(o.address),"483110810612443119221244311881",...u._encode(o.appId),"1244312080",...u._encode(o.appAddress),"124431018100124431093203124431153203124422"],n=t.hex.decode(e.join(""));return new t.LogicSigAccount(n)},decodeLocalState:async(o,e,n)=>{let r;try{const a=await o.accountApplicationInformation(n,t.safeBigIntToNumber(e)).do();r=t.AccountApplicationResponse.from_obj_for_encoding(a).appLocalState}catch{return new Uint8Array}const s=t.b64.encode("meta");let i=new Map;for(const a of r.keyValue){if(a.key===s)continue;const g=t.b64.decode(a.key)[0],l=t.b64.decode(a.value.bytes);i.set(g,l)}const d=[];for(let a=0;a<O;a++)i.has(a)&&d.push(i.get(a));return t.bytes.concat(...d)},checkBitsSet:async(o,e,n,r)=>{let s=!1,i;const d=await o.accountInformation(n).do(),g=t.Account.from_obj_for_encoding(d).appsLocalState;if(g&&g.forEach(h=>{BigInt(h.id)===e&&(i=h.keyValue)}),(i==null?void 0:i.length)===0)return s;const l=BigInt(N),f=BigInt(8),y=r/l*l,b=t.safeBigIntToNumber(r-y),T=Math.floor(b/R),x=Math.floor((b-T*R)/8),B=t.b64.encode(t.bignum.toBytes(T,1));return i==null||i.forEach(h=>{if(h.key===B){const _=t.dist.Buffer.from(h.value.bytes,"base64"),w=1<<t.safeBigIntToNumber(r%f);s=(_[x]&w)!=0;return}}),s},storageAccountExists:async(o,e,n)=>{try{const r=await o.accountApplicationInformation(e,t.safeBigIntToNumber(n)).do();return Object.keys(r).length>0}catch{}return!1}},c=class c{constructor(e,n,r,s){p(this,"network");p(this,"chain");p(this,"connection");p(this,"contracts");p(this,"chainId");p(this,"coreAppId");p(this,"coreAppAddress");p(this,"tokenBridgeAppId");p(this,"tokenBridgeAppAddress");if(this.network=e,this.chain=n,this.connection=r,this.contracts=s,this.chainId=t.toChainId(n),!s.coreBridge)throw new Error(`Core contract address for chain ${n} not found`);const i=BigInt(s.coreBridge);if(this.coreAppId=i,this.coreAppAddress=t.getApplicationAddress(i),!s.tokenBridge)throw new Error(`TokenBridge contract address for chain ${n} not found`);const d=BigInt(s.tokenBridge);this.tokenBridgeAppId=d,this.tokenBridgeAppAddress=t.getApplicationAddress(d)}getGuardianSet(e){throw new Error("Method not implemented.")}async*verifyMessage(e,n,r){const s=new t.AlgorandAddress(e).toString(),i=await c.submitVAAHeader(this.connection,this.coreAppId,r??this.coreAppId,n,s);for(const d of i.txs)yield this.createUnsignedTx(d,"Core.verifyMessage")}static async fromRpc(e,n){const[r,s]=await H.AlgorandPlatform.chainFromRpc(e),i=n[s];if(i.network!==r)throw new Error(`Network mismatch: ${i.network} !== ${r}`);return new c(r,s,e,i.contracts)}async*publishMessage(e,n){const r=new t.AlgorandAddress(e),s=r.toString(),i=await this.connection.getTransactionParams().do(),d=u.forEmitter(this.coreAppId,r.toUint8Array()),{accounts:a,txs:g}=await c.maybeCreateStorageTx(this.connection,s,this.coreAppId,d,i);for(const f of g)yield this.createUnsignedTx(f,"Core.publishMessage",!0);const l=t.makeApplicationCallTxnFromObject({from:s,appIndex:t.safeBigIntToNumber(this.coreAppId),appArgs:[c.publishMessage,n,t.bignum.toBytes(0n,8)],accounts:a,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:i});yield this.createUnsignedTx({tx:l},"Core.publishMessage",!0)}async getMessageFee(){var s;const e=await this.connection.getApplicationByID(t.safeBigIntToNumber(this.coreAppId)).do(),r=(s=t.Application.from_obj_for_encoding(e).params.globalState)==null?void 0:s.find(i=>i.key===c.feeKey);return r?BigInt(r.value.uint):0n}async getGuardianSetIndex(){throw new Error("Not implemented")}async parseTransaction(e){const n=await this.connection.pendingTransactionInformation(e).do(),r=t.PendingTransactionResponse.from_obj_for_encoding(n);return this.parseTx(r).map(s=>({chain:s.emitterChain,emitter:s.emitterAddress,sequence:s.sequence}))}async parseMessages(e){const n=await this.connection.pendingTransactionInformation(e).do(),r=t.PendingTransactionResponse.from_obj_for_encoding(n);return this.parseTx(r)}parseTx(e){const n=[];if(e.innerTxns&&e.innerTxns.length>0&&n.push(...e.innerTxns.flatMap(g=>this.parseTx(g))),BigInt(e.txn.txn.apid??0)!==this.coreAppId||!e.logs||e.logs.length===0)return n;const r=e.txn.txn.apaa??[];if(r.length!==3||!t.bytes.equals(new Uint8Array(r[0]),c.publishMessage))return n;const s=t.bignum.decode(e.logs[0]),i=new t.AlgorandAddress(e.txn.txn.snd).toUniversalAddress(),d=new Uint8Array(r[1]),a=t.bignum.decode(r[2]);return n.push(t.createVAA("Uint8Array",{emitterChain:this.chain,emitterAddress:i,sequence:s,guardianSet:0,timestamp:0,consistencyLevel:0,nonce:Number(a),payload:d,signatures:[]})),n}static async maybeCreateStorageTx(e,n,r,s,i){const d=t.getApplicationAddress(r),a=s.address(),g=[];if(await u.storageAccountExists(e,a,r))return{accounts:[a],txs:g};i=i??await e.getTransactionParams().do();const l=t.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:a,amount:K,suggestedParams:i});l.fee=l.fee*2,g.push({tx:l});const f=t.makeApplicationOptInTxnFromObject({from:a,appIndex:t.safeBigIntToNumber(r),rekeyTo:d,suggestedParams:i});return f.fee=0,g.push({tx:f,signer:{address:s.address(),signTxn:y=>Promise.resolve(t.signLogicSigTransaction(y,s).blob)}}),{accounts:[a],txs:g}}static async submitVAAHeader(e,n,r,s,i,d){d=d??await e.getTransactionParams().do();let a=[];const g=u.forMessageId(r,{chain:s.emitterChain,sequence:s.sequence,emitter:s.emitterAddress}),{accounts:l,txs:f}=await c.maybeCreateStorageTx(e,i,r,g,d);a.push(...f);const y=u.forGuardianSet(n,s.guardianSet),{accounts:[b],txs:T}=await c.maybeCreateStorageTx(e,i,n,y,d);a.push(...T);let x=[...l,b];const B=await u.decodeLocalState(e,n,b),h=t.keccak_256(s.hash),_=s.signatures.length,w=Math.ceil(_/c.MAX_SIGS_PER_TXN),k=20,C=new t.LogicSigAccount(c.ALGO_VERIFY);for(let M=0;M<w;M++){const v=M*c.MAX_SIGS_PER_TXN,S=s.signatures.slice(v,v+c.MAX_SIGS_PER_TXN),F=S.length*k,G=new Uint8Array(F);for(let A=0;A<S.length;A++){const P=S[A],Y=B.slice(P.guardianIndex*k+1,(P.guardianIndex+1)*k+1);G.set(Y,A*20)}const X=t.makeApplicationCallTxnFromObject({appArgs:[c.verifySigs,t.bytes.concat(...S.map(A=>t.bytes.concat(new Uint8Array([A.guardianIndex]),A.signature.encode()))),G,h],accounts:x,appIndex:t.safeBigIntToNumber(n),from:c.ALGO_VERIFY_HASH,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:d});X.fee=0,a.push({tx:X,signer:{address:C.address(),signTxn:A=>Promise.resolve(t.signLogicSigTransaction(A,C).blob)}})}const E=t.makeApplicationCallTxnFromObject({appArgs:[c.verifyVaa,t.serialize(s)],accounts:x,appIndex:t.safeBigIntToNumber(n),from:i,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:d});return E.fee=E.fee*(2+w),a.push({tx:E}),{accounts:x,txs:a}}createUnsignedTx(e,n,r=!0){return new j(e,this.network,this.chain,n,r)}};p(c,"MAX_SIGS_PER_TXN",6),p(c,"ALGO_VERIFY_HASH","EZATROXX2HISIRZDRGXW4LRQ46Z6IUJYYIHU3PJGP7P5IQDPKVX42N767A"),p(c,"ALGO_VERIFY",new Uint8Array([6,32,4,1,0,32,20,38,1,0,49,32,50,3,18,68,49,1,35,18,68,49,16,129,6,18,68,54,26,1,54,26,3,54,26,2,136,0,3,68,34,67,53,2,53,1,53,0,40,53,240,40,53,241,52,0,21,53,5,35,53,3,35,53,4,52,3,52,5,12,65,0,68,52,1,52,0,52,3,129,65,8,34,88,23,52,0,52,3,34,8,36,88,52,0,52,3,129,33,8,36,88,7,0,53,241,53,240,52,2,52,4,37,88,52,240,52,241,80,2,87,12,20,18,68,52,3,129,66,8,53,3,52,4,37,8,53,4,66,255,180,34,137])),p(c,"feeKey",t.b64.encode("MessageFee")),p(c,"verifyVaa",t.bytes.encode("verifyVAA")),p(c,"verifySigs",t.bytes.encode("verifySigs")),p(c,"publishMessage",t.bytes.encode("publishMessage"));let I=c;t.registerProtocol("Algorand","WormholeCore",I);const z=Object.freeze(Object.defineProperty({__proto__:null,AlgorandWormholeCore:I,BITS_PER_BYTE:L,BITS_PER_KEY:R,MAX_BITS:N,MAX_BYTES:V,MAX_BYTES_PER_KEY:U,MAX_KEYS:O,SEED_AMT:K,StorageLogicSig:u,varint:m},Symbol.toStringTag,{value:"Module"}));exports.AlgorandUnsignedTransaction=j;exports.AlgorandWormholeCore=I;exports.StorageLogicSig=u;exports.index=z;
@@ -1,8 +1,8 @@
1
1
  var d = Object.defineProperty;
2
2
  var h = (i, e, r) => e in i ? d(i, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[e] = r;
3
3
  var o = (i, e, r) => h(i, typeof e != "symbol" ? e + "" : e, r);
4
- import { a8 as m, cL as w, Q as g, bR as p } from "./index-BDhzG0Bz.mjs";
5
- import { S as u } from "./sui-BpKCqOiX.mjs";
4
+ import { a8 as m, cL as w, Q as g, bR as p } from "./index-CjwA7HmM.mjs";
5
+ import { S as u } from "./sui-WPdV6u03.mjs";
6
6
  class c {
7
7
  constructor(e, r, t, n) {
8
8
  o(this, "network");