@wormhole-foundation/wormhole-connect 1.1.0-beta.0-development → 1.1.1-beta.0-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 (131) hide show
  1. package/dist/assets/{ccip-D0q_x6uj.js → ccip-BkpH7yCW.js} +1 -1
  2. package/dist/assets/{evm-CBRXZjwX.js → evm-MVDbvxEl.js} +4 -4
  3. package/dist/assets/{index-j3bl82OW.js → index-CFvZsCU4.js} +2 -2
  4. package/dist/assets/{index-mj4gbpEj.js → index-DXG0dh04.js} +1 -1
  5. package/dist/assets/{index-CuBhgBKM.js → index-_JgB1Og4.js} +1 -1
  6. package/dist/assets/{index.es-BfQxkozN.js → index.es-CiUGjTEK.js} +2 -2
  7. package/dist/main.js +67 -67
  8. package/dist/src/config/ui.d.ts +2 -0
  9. package/dist/src/config/ui.d.ts.map +1 -1
  10. package/dist/src/hooks/useRoutesQuotesBulk.d.ts.map +1 -1
  11. package/dist/src/hooks/useSortedRoutesWithQuotes.d.ts.map +1 -1
  12. package/dist/src/hooks/useTransactionHistoryWHScan.d.ts.map +1 -1
  13. package/dist/src/store/transferInput.d.ts +1 -0
  14. package/dist/src/store/transferInput.d.ts.map +1 -1
  15. package/dist/src/utils/index.d.ts +2 -2
  16. package/dist/src/utils/index.d.ts.map +1 -1
  17. package/dist/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
  18. package/dist/src/views/v2/Bridge/Routes/index.d.ts +1 -1
  19. package/dist/src/views/v2/Bridge/Routes/index.d.ts.map +1 -1
  20. package/dist/src/views/v2/Bridge/index.d.ts.map +1 -1
  21. package/dist/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
  22. package/dist/src/views/v2/TxHistory/Item/index.d.ts.map +1 -1
  23. package/lib/{algorand-DXqQky21.mjs → algorand-CfK3wyd4.mjs} +3 -3
  24. package/lib/{algorand-Bo1Wzw1j.js → algorand-CnbWXjpX.js} +1 -1
  25. package/lib/{aptos-bWcuejOT.js → aptos-BLwtiagQ.js} +2 -2
  26. package/lib/{aptos-1gBf1NMO.js → aptos-D_1OVFdu.js} +1 -1
  27. package/lib/{aptos-AWFGcwma.mjs → aptos-DncaFJ3t.mjs} +1 -1
  28. package/lib/{aptos-mnV81rFb.mjs → aptos-rdiGlquE.mjs} +3 -3
  29. package/lib/{ccip-DFC1Pt35.mjs → ccip-CrmcE1XH.mjs} +1 -1
  30. package/lib/{ccip-_C27iFCl.js → ccip-Y0Tc4c5d.js} +1 -1
  31. package/lib/{cosmos-ArQ3Vif_.mjs → cosmos-CH4qgTYB.mjs} +5 -5
  32. package/lib/{cosmos-ByIagKd0.js → cosmos-DeqsjkmP.js} +1 -1
  33. package/lib/{cosmwasm-CF3HCYqh.js → cosmwasm-CqdzIbir.js} +2 -2
  34. package/lib/{cosmwasm-BSveG_uf.mjs → cosmwasm-D-Fs0qZO.mjs} +6 -6
  35. package/lib/{events--A4xpY5I.mjs → events-BFC6cV3p.mjs} +1 -1
  36. package/lib/{events-CzY6Lgd8.js → events-GfeIoDNX.js} +1 -1
  37. package/lib/{evm-BQKI6uoQ.js → evm-BNuV155j.js} +1 -1
  38. package/lib/{evm-Dx7MGmIO.mjs → evm-BfL8mkZ3.mjs} +7 -7
  39. package/lib/{evm-6cjoh9PK.js → evm-CWKi4eeg.js} +4 -4
  40. package/lib/{evm-BrO3cLoN.mjs → evm-D1yZejha.mjs} +5 -5
  41. package/lib/{index-qCTaoAzd.mjs → index-0-blYIqw.mjs} +1 -1
  42. package/lib/{index-BOF8mDgA.mjs → index-1dBQshzW.mjs} +2 -2
  43. package/lib/{index-BhiYy0fK.js → index-5oGCqPO0.js} +1 -1
  44. package/lib/{index-BwiobmcY.js → index-B19sqf2D.js} +1 -1
  45. package/lib/{index-C_N4GN_v.js → index-B816YiMI.js} +1 -1
  46. package/lib/{index-DYVb5TJI.js → index-B9Xx9lrD.js} +1 -1
  47. package/lib/{index-jC72glxT.js → index-BDFw8K4J.js} +1 -1
  48. package/lib/{index-BD4hsXhG.mjs → index-BI80827m.mjs} +2 -2
  49. package/lib/{index-B0FpKipX.mjs → index-BRK0TY9H.mjs} +2 -2
  50. package/lib/{index-DeO1id3t.mjs → index-BTAoerwa.mjs} +2 -2
  51. package/lib/{index-DEDY9GTS.js → index-BUsbrVLa.js} +1 -1
  52. package/lib/{index-BpNZWhHz.mjs → index-Bc66UG0_.mjs} +3 -3
  53. package/lib/{index-BjlHYohu.js → index-BpvPFrw7.js} +1 -1
  54. package/lib/{index-BLQzMoHs.mjs → index-BuH5Ka4b.mjs} +2 -2
  55. package/lib/{index-DoXX-MgV.js → index-CEtUx4D0.js} +1 -1
  56. package/lib/{index-BfFmswTJ.mjs → index-CI_8FDgP.mjs} +1 -1
  57. package/lib/{index-H8_i0qPH.js → index-CKv8w47m.js} +1 -1
  58. package/lib/{index-BzVCujln.mjs → index-CLlQTM5r.mjs} +1 -1
  59. package/lib/{index-C2pKUlW4.mjs → index-CQfbVN85.mjs} +2 -2
  60. package/lib/{index-CKESQGhz.mjs → index-CRQ1enra.mjs} +3 -3
  61. package/lib/{index-CgCgHSjT.mjs → index-CgHlaaaL.mjs} +2 -2
  62. package/lib/{index-Cq68SHFu.js → index-ChUNBvSk.js} +74 -74
  63. package/lib/{index-CUR9AjOz.js → index-Colq0bZb.js} +1 -1
  64. package/lib/{index-DHuBMVw_.js → index-CrQGt8cA.js} +1 -1
  65. package/lib/{index-jLH-khC5.mjs → index-CsCUgEVp.mjs} +4 -4
  66. package/lib/{index-B2MzRdNC.mjs → index-Ctvr3o5h.mjs} +2 -2
  67. package/lib/{index-B46Vqj_Y.js → index-CxXhB_IO.js} +1 -1
  68. package/lib/{index-CEwygDUh.js → index-D1tBZyWp.js} +1 -1
  69. package/lib/{index-DDILUKSZ.js → index-DI_A5HgD.js} +1 -1
  70. package/lib/{index-BLfA652L.js → index-DJ6RpSM-.js} +1 -1
  71. package/lib/{index-BUJJwfi4.mjs → index-DK2ZMVt-.mjs} +1 -1
  72. package/lib/{index-Qm595S4g.mjs → index-DPX2kk8h.mjs} +4 -4
  73. package/lib/{index-DyH90u45.mjs → index-DQOC8HqW.mjs} +6 -6
  74. package/lib/{index-pztK0B-X.js → index-DZxGkigC.js} +1 -1
  75. package/lib/{index-DZpJnWIo.js → index-Dc5vilsi.js} +1 -1
  76. package/lib/{index-DZAtcSDA.mjs → index-DpN7Ts5N.mjs} +2 -2
  77. package/lib/{index-DWaRTjKn.js → index-Du9NZrsJ.js} +1 -1
  78. package/lib/{index-Cs489TN4.js → index-FTjiNlQG.js} +1 -1
  79. package/lib/{index-BlzswgOT.mjs → index-ORTr3BFG.mjs} +3 -3
  80. package/lib/{index-CmrE4DzE.js → index-QdyQYFJz.js} +1 -1
  81. package/lib/{index-BOFG4FVv.mjs → index-Sjla7uX6.mjs} +2 -2
  82. package/lib/{index-C2r9hE9T.js → index-Zl4pQbEK.js} +1 -1
  83. package/lib/{index-CYiBltZ3.js → index-bRAAH_OE.js} +1 -1
  84. package/lib/{index--RwaJpN3.mjs → index-mGMBsP7I.mjs} +3 -3
  85. package/lib/{index-BBqz1eAt.mjs → index-mtayp81Z.mjs} +1 -1
  86. package/lib/{index-TKKveJMB.mjs → index-yFXKGWGb.mjs} +5616 -5575
  87. package/lib/{index.es-9qG0TB-x.js → index.es-DP23krM9.js} +2 -2
  88. package/lib/{index.es-CfSEyyyS.mjs → index.es-DP3q4uXq.mjs} +5 -5
  89. package/lib/index.js +1 -1
  90. package/lib/index.mjs +1 -1
  91. package/lib/{keccak-DJ3bbFXb.mjs → keccak-DIHcv7nm.mjs} +1 -1
  92. package/lib/{keccak-BzHVXxqy.js → keccak-DJF5LbyE.js} +1 -1
  93. package/lib/{libsodium-wrappers-7-Bi6p7P.mjs → libsodium-wrappers-Bm4e3yYH.mjs} +1 -1
  94. package/lib/{libsodium-wrappers-l6lPCUBq.js → libsodium-wrappers-gmFmVCyZ.js} +1 -1
  95. package/lib/{pako.esm-xpSJQvNu.js → pako.esm-Df04NWOs.js} +1 -1
  96. package/lib/{pako.esm-CQZEJYSU.mjs → pako.esm-njW9D9ox.mjs} +2 -2
  97. package/lib/{pbkdf2-rmCVC4ql.mjs → pbkdf2-B6rDHXDb.mjs} +1 -1
  98. package/lib/{pbkdf2-7mpiLJy4.js → pbkdf2-CW5dgeoG.js} +1 -1
  99. package/lib/{sei-BLcoNaev.mjs → sei-BgB_5llP.mjs} +3 -3
  100. package/lib/{sei-Dnzto4Im.js → sei-CemCdBaI.js} +1 -1
  101. package/lib/{signer-DcADyPV5.mjs → signer-CR5gbx9W.mjs} +1 -1
  102. package/lib/{signer-C6hSmvFp.js → signer-DU7VPpE4.js} +1 -1
  103. package/lib/{solana-DJ0IixjN.js → solana-4WQ4QxmB.js} +1 -1
  104. package/lib/solana-B9DvMN_q.js +1 -0
  105. package/lib/{solana-CpMS2ux7.mjs → solana-BDl70G8N.mjs} +4 -4
  106. package/lib/{solana-CBZN4FnN.mjs → solana-zs7OdN89.mjs} +5 -5
  107. package/lib/{solanaEmbed.esm-4jfCYoMy.mjs → solanaEmbed.esm-B01u6r1J.mjs} +3 -3
  108. package/lib/{solanaEmbed.esm-0cd-1P5h.js → solanaEmbed.esm-BsvNR_56.js} +1 -1
  109. package/lib/src/config/ui.d.ts +2 -0
  110. package/lib/src/config/ui.d.ts.map +1 -1
  111. package/lib/src/hooks/useRoutesQuotesBulk.d.ts.map +1 -1
  112. package/lib/src/hooks/useSortedRoutesWithQuotes.d.ts.map +1 -1
  113. package/lib/src/hooks/useTransactionHistoryWHScan.d.ts.map +1 -1
  114. package/lib/src/store/transferInput.d.ts +1 -0
  115. package/lib/src/store/transferInput.d.ts.map +1 -1
  116. package/lib/src/utils/index.d.ts +2 -2
  117. package/lib/src/utils/index.d.ts.map +1 -1
  118. package/lib/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
  119. package/lib/src/views/v2/Bridge/Routes/index.d.ts +1 -1
  120. package/lib/src/views/v2/Bridge/Routes/index.d.ts.map +1 -1
  121. package/lib/src/views/v2/Bridge/index.d.ts.map +1 -1
  122. package/lib/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
  123. package/lib/src/views/v2/TxHistory/Item/index.d.ts.map +1 -1
  124. package/lib/{sui-CFFF_mQa.js → sui-Bd_GYY3P.js} +1 -1
  125. package/lib/{sui-_M1jRKNY.js → sui-CBeJssO1.js} +2 -2
  126. package/lib/{sui-Bx3P3eJQ.mjs → sui-W14dz0Zr.mjs} +4 -4
  127. package/lib/{sui-CiUnXi5Q.mjs → sui-qTzkXNO_.mjs} +1 -1
  128. package/lib/{unsignedTransaction-tIiy-iAs.mjs → unsignedTransaction-C3mwZKyJ.mjs} +2 -2
  129. package/lib/{unsignedTransaction--bD8fDwb.js → unsignedTransaction-qWP3jM25.js} +1 -1
  130. package/package.json +1 -1
  131. package/lib/solana-vC_lji5o.js +0 -1
@@ -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-Cq68SHFu.js"),H=require("./algorand-Bo1Wzw1j.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-ChUNBvSk.js"),H=require("./algorand-CnbWXjpX.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 se = Object.defineProperty;
2
2
  var oe = (s, e, t) => e in s ? se(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
3
  var d = (s, e, t) => oe(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { di as l, dl as T, de as y, ct as _, a8 as V, a5 as f, p as re, u as M, dq as J, dr as ae, N as S, dg as ie, h as ce, an as X, dh as N, dj as P, ds as de, dt as Q, cP as pe, dk as ge, du as ue, dv as Z, cf as fe, bQ as le, bV as he } from "./index-TKKveJMB.mjs";
5
- import { A as Ae } from "./algorand-DXqQky21.mjs";
4
+ import { di as l, dl as T, de as y, ct as _, a8 as V, a5 as f, p as re, u as M, dq as J, dr as ae, N as S, dg as ie, h as ce, an as X, dh as N, dj as P, ds as de, dt as Q, cP as pe, dk as ge, du as ue, dv as Z, cf as fe, bQ as le, bV as he } from "./index-yFXKGWGb.mjs";
5
+ import { A as Ae } from "./algorand-CfK3wyd4.mjs";
6
6
  class ye {
7
7
  constructor(e, t, o, n, r = !1) {
8
8
  d(this, "transaction");