@wormhole-foundation/wormhole-connect 1.1.8 → 1.1.9-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 (134) hide show
  1. package/dist/assets/{algorand-Bg-MfjsH.js → algorand-vDDEz6KP.js} +2 -2
  2. package/dist/assets/{ccip-atE20ZEL.js → ccip-B1JPJPOY.js} +1 -1
  3. package/dist/assets/{cosmwasm-xANzAboS.js → cosmwasm-DP4CIVSM.js} +2 -2
  4. package/dist/assets/{evm-B20gvxWA.js → evm-BB3755Wr.js} +1 -1
  5. package/dist/assets/{evm-DiRlPnyB.js → evm-FvO3h1wl.js} +4 -4
  6. package/dist/assets/{index-C6qclzFA.js → index-B1mp7Z63.js} +1 -1
  7. package/dist/assets/{index-eLk_b8u9.js → index-BU0ECMia.js} +1 -1
  8. package/dist/assets/{index-DyD6kblh.js → index-BbJVBTsE.js} +1 -1
  9. package/dist/assets/{index-BYxgRLLh.js → index-BhEp9mlK.js} +1 -1
  10. package/dist/assets/{index-D3WFv54i.js → index-Bvun80fl.js} +1 -1
  11. package/dist/assets/{index-jD6ZZ5Tu.js → index-Bz-32kSJ.js} +1 -1
  12. package/dist/assets/{index-CLcPjTbq.js → index-CVb8oZT5.js} +2 -2
  13. package/dist/assets/index-DP2zLB5d.js +5 -0
  14. package/dist/assets/index-Dp6gvGvL.js +2 -0
  15. package/dist/assets/{index-CxijOPcm.js → index-re-SltAL.js} +1 -1
  16. package/dist/assets/{index-DOuohql9.js → index-tGkAuFX0.js} +1 -1
  17. package/dist/assets/{index.es-BxGbRBbk.js → index.es-D8YphuI4.js} +2 -2
  18. package/dist/assets/{solana-DOaiyZir.js → solana-Bc-ePjuF.js} +1 -1
  19. package/dist/assets/{sui-mXOoFb4M.js → sui-DVNpNCUB.js} +4 -4
  20. package/dist/assets/{unsignedTransaction-0WUum9tP.js → unsignedTransaction-CPy_oMd2.js} +1 -1
  21. package/dist/assets/unsignedTransaction-arVvzoJx.js +1 -0
  22. package/dist/main.js +58 -58
  23. package/dist/src/config/mainnet/tokens.d.ts.map +1 -1
  24. package/dist/src/config/testnet/tokens.d.ts.map +1 -1
  25. package/dist/src/hooks/useTransactionHistoryWHScan.d.ts.map +1 -1
  26. package/dist/src/icons/Chains/WORLD.d.ts.map +1 -1
  27. package/dist/src/icons/TokenIcons.d.ts.map +1 -1
  28. package/dist/src/icons/Tokens/WORLD.d.ts +4 -0
  29. package/dist/src/icons/Tokens/WORLD.d.ts.map +1 -0
  30. package/dist/src/utils/sdkv2.d.ts.map +1 -1
  31. package/lib/{algorand-DUcbNcTT.mjs → algorand-CprzAHj4.mjs} +3 -3
  32. package/lib/{algorand-BvtlkYvW.js → algorand-D2kn_YCP.js} +1 -1
  33. package/lib/{aptos-B4rlOyU6.mjs → aptos-Cbdd7TGX.mjs} +3 -3
  34. package/lib/{aptos-BhgRAjHC.js → aptos-CooxpMkq.js} +2 -2
  35. package/lib/{aptos-nQowjIcb.mjs → aptos-CxfujMIg.mjs} +1 -1
  36. package/lib/{aptos-DhzeFi4o.js → aptos-D4EZf1pL.js} +1 -1
  37. package/lib/{ccip-jzRXPLFO.mjs → ccip-B7sQsroM.mjs} +1 -1
  38. package/lib/{ccip-BGUsNrsA.js → ccip-l4G3agzc.js} +1 -1
  39. package/lib/{cosmwasm-CGeqw6cI.js → cosmwasm-CzoZmAov.js} +2 -2
  40. package/lib/{cosmwasm-DrywDSkp.mjs → cosmwasm-r9Dcfq2_.mjs} +6 -6
  41. package/lib/{events-DuoZYNKO.mjs → events-BD3jHr55.mjs} +1 -1
  42. package/lib/{events-COjha8bx.js → events-DPG_k7aT.js} +1 -1
  43. package/lib/{evm-BBDClE2g.js → evm-CWPWco3x.js} +4 -4
  44. package/lib/{evm-BuIItcEA.mjs → evm-CqZH4qDI.mjs} +12 -12
  45. package/lib/{evm-CYnUn08H.js → evm-DA0UVqiZ.js} +1 -1
  46. package/lib/{evm-CEj34i-Y.mjs → evm-MLYkwdYo.mjs} +7 -7
  47. package/lib/{index-CdExxm-8.mjs → index-1P7DtP2r.mjs} +2 -2
  48. package/lib/{index-CJEjOaWr.mjs → index-5sE8OCOP.mjs} +1 -1
  49. package/lib/{index-NNKFqYq6.js → index-B2ALlGbm.js} +1 -1
  50. package/lib/{index-BJvQdk3o.js → index-B72tCThM.js} +7 -7
  51. package/lib/{index-CWM3H2LC.js → index-B9-xYyXd.js} +1 -1
  52. package/lib/{index-Bbhbkgfa.mjs → index-B9mhdAdq.mjs} +2 -2
  53. package/lib/{index-D9h0sJ3x.mjs → index-BA3kjRAK.mjs} +1 -1
  54. package/lib/{index-BIVNmWjC.js → index-BKK6e2Zn.js} +1 -1
  55. package/lib/{index-CRv6XxH6.mjs → index-BYIBymjK.mjs} +2 -2
  56. package/lib/{index-Cyjyg63s.js → index-BbDtFGWT.js} +1 -1
  57. package/lib/{index-DKptU_Hc.mjs → index-Bp9D0p75.mjs} +4 -4
  58. package/lib/{index-uAstvLd8.mjs → index-Bt79Gcg4.mjs} +2 -2
  59. package/lib/{index-Dc5wV51P.mjs → index-BwifXygO.mjs} +218 -125
  60. package/lib/{index-B6AFQ_fB.js → index-C-_dVgsh.js} +1 -1
  61. package/lib/{index-Bh9u5bZu.mjs → index-C41sqz-E.mjs} +2 -2
  62. package/lib/{index-B2JFHCjY.js → index-CGpV5u19.js} +1 -1
  63. package/lib/{index-BTncL8og.js → index-CRM9RIQm.js} +1 -1
  64. package/lib/{index-B-LwhonE.js → index-CT6UJ_EL.js} +1 -1
  65. package/lib/{index-CTHiXye2.js → index-CWJxT6vs.js} +1 -1
  66. package/lib/{index-Ds_oSleh.js → index-CgdZLNBr.js} +1 -1
  67. package/lib/{index-CjexIr7B.mjs → index-Ch4JHScc.mjs} +2 -2
  68. package/lib/{index-BJuAlURA.mjs → index-CjBfG1PD.mjs} +3 -3
  69. package/lib/index-CuMsUIvK.js +5 -0
  70. package/lib/{index-Cdpg2Kj3.mjs → index-CzSNeEZ7.mjs} +2 -2
  71. package/lib/{index-BXkKxPSN.mjs → index-D0i-3BNU.mjs} +2 -2
  72. package/lib/{index-a5wU3oUB.js → index-D2NQOwWl.js} +1 -1
  73. package/lib/{index-vjvft509.js → index-D6IvMYTY.js} +1 -1
  74. package/lib/{index-CXIAreWV.js → index-D6_pFYbp.js} +1 -1
  75. package/lib/{index-BISC0EuN.mjs → index-D7o-xpfy.mjs} +2 -2
  76. package/lib/index-DG-zySXj.js +1 -0
  77. package/lib/index-DPkB79ju.mjs +3816 -0
  78. package/lib/{index-DcurocLc.mjs → index-DTDgv8BR.mjs} +2 -2
  79. package/lib/{index-DdeuHj0J.mjs → index-D_HXrfx2.mjs} +1 -1
  80. package/lib/{index-qoWS15WJ.mjs → index-DfZldCn-.mjs} +4 -4
  81. package/lib/{index-D9fbH3oE.mjs → index-Dfq8cOSZ.mjs} +11 -11
  82. package/lib/{index-A72nDBhY.mjs → index-DgCVdoY_.mjs} +1 -1
  83. package/lib/{index-BuGRcK_Q.js → index-DsaeOVzT.js} +1 -1
  84. package/lib/{index-8IabBseN.js → index-DtJmfQmV.js} +1 -1
  85. package/lib/{index-D5tJ7kz1.js → index-HoGFMJt0.js} +1 -1
  86. package/lib/{index-BeJsTgpu.mjs → index-JEf11FIl.mjs} +4 -4
  87. package/lib/{index-D7uCV0-2.mjs → index-LhBPWv5M.mjs} +140 -149
  88. package/lib/{index-DlnKgVH2.js → index-LnwD-DoX.js} +1 -1
  89. package/lib/{index-HLOU4jOA.mjs → index-QA9dpScn.mjs} +2 -2
  90. package/lib/{index-Bi4OJr6O.js → index-ZlQhJUEX.js} +1 -1
  91. package/lib/index-qXJjecnK.js +5 -0
  92. package/lib/{index-DEi8dfu-.js → index-ruz_whBI.js} +1 -1
  93. package/lib/{index.es-tj48a6VI.mjs → index.es-DpTW5wIE.mjs} +5 -5
  94. package/lib/{index.es-ex5QzFoQ.js → index.es-Pku98btF.js} +2 -2
  95. package/lib/index.js +1 -1
  96. package/lib/index.mjs +2 -2
  97. package/lib/{keccak-CVFfUSfU.mjs → keccak-DWESGy_C.mjs} +1 -1
  98. package/lib/{keccak-CzODwJ6V.js → keccak-Rx7RS8L6.js} +1 -1
  99. package/lib/{pbkdf2-DLmVRSHA.js → pbkdf2-6hG-XBJs.js} +1 -1
  100. package/lib/{pbkdf2-GUTNazYD.mjs → pbkdf2-BVpVer9L.mjs} +1 -1
  101. package/lib/{signer-rbcgQjZj.js → signer-DhWIDOWp.js} +1 -1
  102. package/lib/{signer-Cqs1I7RB.mjs → signer-Dz4VN8ZI.mjs} +1 -1
  103. package/lib/solana-B6zAgqCg.mjs +16 -0
  104. package/lib/{solana-DoqT3pca.js → solana-BWM14UIk.js} +1 -1
  105. package/lib/solana-CKkJ-kf3.js +1 -0
  106. package/lib/{solana-7ZFkKRtX.mjs → solana-Dvddqnn3.mjs} +4 -4
  107. package/lib/{solanaEmbed.esm-Bkti_f5v.js → solanaEmbed.esm-Ghqj1fn8.js} +1 -1
  108. package/lib/{solanaEmbed.esm-LdO_IpPZ.mjs → solanaEmbed.esm-qmqvaX26.mjs} +3 -3
  109. package/lib/src/config/mainnet/tokens.d.ts.map +1 -1
  110. package/lib/src/config/testnet/tokens.d.ts.map +1 -1
  111. package/lib/src/hooks/useTransactionHistoryWHScan.d.ts.map +1 -1
  112. package/lib/src/icons/Chains/WORLD.d.ts.map +1 -1
  113. package/lib/src/icons/TokenIcons.d.ts.map +1 -1
  114. package/lib/src/icons/Tokens/WORLD.d.ts +4 -0
  115. package/lib/src/icons/Tokens/WORLD.d.ts.map +1 -0
  116. package/lib/src/utils/sdkv2.d.ts.map +1 -1
  117. package/lib/{sui-DfRirJoo.js → sui-BAoaV0fk.js} +1 -1
  118. package/lib/{sui-Df7REI6I.js → sui-COMAcPz7.js} +2 -2
  119. package/lib/{sui-Ch7mNd_P.mjs → sui-DKW6LQmE.mjs} +74 -75
  120. package/lib/{sui-BffnXOND.mjs → sui-DWDf6r1T.mjs} +1 -1
  121. package/lib/{unsignedTransaction-CvjJdjtG.js → unsignedTransaction-B9dxNqAu.js} +1 -1
  122. package/lib/unsignedTransaction-BD81leu1.mjs +16 -0
  123. package/lib/unsignedTransaction-DzSLsK-p.js +1 -0
  124. package/lib/{unsignedTransaction-CsCwFMvo.mjs → unsignedTransaction-T9pxJxVn.mjs} +4 -4
  125. package/package.json +17 -17
  126. package/dist/assets/index-CKe5Sopa.js +0 -2
  127. package/dist/src/utils/repairVaa.d.ts +0 -4
  128. package/dist/src/utils/repairVaa.d.ts.map +0 -1
  129. package/lib/index-BsHKXTKU.js +0 -1
  130. package/lib/index-DgbQ-dwi.js +0 -5
  131. package/lib/solana-BYPpXpJs.js +0 -1
  132. package/lib/solana-CcjhlsWI.mjs +0 -16
  133. package/lib/src/utils/repairVaa.d.ts +0 -4
  134. package/lib/src/utils/repairVaa.d.ts.map +0 -1
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CxijOPcm.js","main.js","main.css","assets/index-DyD6kblh.js"])))=>i.map(i=>d[i]);
2
- var A=Object.defineProperty;var x=(e,n,t)=>n in e?A(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var l=(e,n,t)=>x(e,typeof n!="symbol"?n+"":n,t);import{af as C,ag as R,bn as w,ai as S,bo as i,aj as T,bp as y,al as E,am as p,bq as h,an as j,aq as N,br as k,bs as B,_,a4 as D}from"../main.js";class I extends C{}const g=class g extends R{constructor(n,t){super(n,t??S(n,g._platform))}getRpc(n){if(n in this.config)return new i.Algodv2("",this.config[n].rpc);throw new Error("No configuration available for chain: "+n)}getChain(n){if(n in this.config)return new I(n,this);throw new Error("No configuration available for chain: "+n)}static nativeTokenId(n,t){if(!g.isSupportedChain(t))throw new Error(`invalid chain for Algorand: ${t}`);return T.chainAddress(t,y)}static isNativeTokenId(n,t,o){return!g.isSupportedChain(t)||o.chain!==t?!1:this.nativeTokenId(n,t)==o}static isSupportedChain(n){return E(n)===g._platform}static async getDecimals(n,t,o){const a=p(o)?0:new h(o).toInt();if(a===0)return j(g._platform);const d=await t.getAssetByID(a).do(),r=i.modelsv2.Asset.from_obj_for_encoding(d);if(!r.params||!r.params.decimals)throw new Error("Could not fetch token details");return Number(r.params.decimals)}static async getBalance(n,t,o,a){const d=p(a)?0:new h(a).toInt();if(d===0){const c=await t.accountInformation(o).do(),u=i.modelsv2.Account.from_obj_for_encoding(c);return BigInt(u.amount)}const r=await t.accountAssetInformation(o,d).do(),s=i.modelsv2.AssetHolding.from_obj_for_encoding(r);return BigInt(s.amount)}static async getBalances(n,t,o,a){let d;if(a.includes("native")){const s=await t.accountInformation(o).do(),c=i.modelsv2.Account.from_obj_for_encoding(s);d=BigInt(c.amount)}return a.map(async s=>{if(p(s))return{native:d};const c=new h(s).toInt(),u=await t.accountAssetInformation(o,c).do(),f=i.modelsv2.AssetHolding.from_obj_for_encoding(u);return BigInt(f.amount)}).reduce((s,c)=>Object.assign(s,c),{})}static async sendWait(n,t,o){const r=o.map((f,b)=>i.decodeSignedTransaction(f)).map((f,b)=>f.txn.txID()),{txId:s}=await t.sendRawTransaction(o).do();if(!s)throw new Error("Transaction(s) failed to send");const c=await i.waitForConfirmation(t,s,4);if(!i.modelsv2.PendingTransactionResponse.from_obj_for_encoding(c).confirmedRound)throw new Error("Transaction(s) could not be confirmed in 4 rounds");return r}static async getLatestBlock(n){const t=await n.status().do(),o=i.modelsv2.NodeStatusResponse.from_obj_for_encoding(t);if(!o.lastRound)throw new Error("Error getting status from node");return Number(o.lastRound)}static async getLatestFinalizedBlock(n){const t=await n.status().do(),o=i.modelsv2.NodeStatusResponse.from_obj_for_encoding(t);if(!o.lastRound)throw new Error("Error getting status from node");return Number(o.lastRound)}static chainFromChainId(n){const t=N(g._platform,n);if(t===void 0)throw new Error(`Unknown native chain id ${n}`);const[o,a]=t;return[o,a]}static async chainFromRpc(n){const t=await n.versionsCheck().do(),o=i.modelsv2.Version.from_obj_for_encoding(t);return this.chainFromChainId(o.genesisId)}};l(g,"_platform",w);let m=g;async function $(e,n){const[t,o]=await m.chainFromRpc(e);return new P(o,e,n)}class P{constructor(n,t,o,a=!1){l(this,"_chain");l(this,"_debug");l(this,"_account");this._chain=n,this._debug=a,this._account=k(o)}chain(){return this._chain}address(){return this._account.addr}async sign(n){const t=[],o=n.map((r,s)=>r.transaction.tx),a=B(o),d=n.map((r,s)=>(r.transaction.tx=a[s],r));for(const r of d){const{description:s,transaction:c}=r,{tx:u,signer:f}=c;this._debug&&(console.log(u._getDictForDisplay()),console.log(u.txID())),f?(this._debug&&console.log(`Signing: ${s} with signer ${f.address} for address ${this.address()}`),t.push(await f.signTxn(u))):(this._debug&&console.log(`Signing: ${s} without signer for address ${this.address()}`),t.push(u.signTxn(this._account.sk)))}return t}}const F={Address:h,Platform:m,getSigner:$,protocols:{WormholeCore:()=>_(()=>import("./index-CxijOPcm.js").then(e=>e.i),__vite__mapDeps([0,1,2])),TokenBridge:()=>_(()=>import("./index-DyD6kblh.js"),__vite__mapDeps([3,0,1,2]))},getChain:(e,n,t)=>new I(n,new m(e,D(e,w,{[n]:t})))},U=Object.freeze(Object.defineProperty({__proto__:null,default:F},Symbol.toStringTag,{value:"Module"}));export{m as A,U as a};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-re-SltAL.js","main.js","main.css","assets/index-BbJVBTsE.js"])))=>i.map(i=>d[i]);
2
+ var A=Object.defineProperty;var x=(e,n,t)=>n in e?A(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var l=(e,n,t)=>x(e,typeof n!="symbol"?n+"":n,t);import{af as C,ag as R,bn as w,ai as S,bo as i,aj as T,bp as y,al as E,am as p,bq as h,an as j,aq as N,br as k,bs as B,_,a4 as D}from"../main.js";class I extends C{}const g=class g extends R{constructor(n,t){super(n,t??S(n,g._platform))}getRpc(n){if(n in this.config)return new i.Algodv2("",this.config[n].rpc);throw new Error("No configuration available for chain: "+n)}getChain(n){if(n in this.config)return new I(n,this);throw new Error("No configuration available for chain: "+n)}static nativeTokenId(n,t){if(!g.isSupportedChain(t))throw new Error(`invalid chain for Algorand: ${t}`);return T.chainAddress(t,y)}static isNativeTokenId(n,t,o){return!g.isSupportedChain(t)||o.chain!==t?!1:this.nativeTokenId(n,t)==o}static isSupportedChain(n){return E(n)===g._platform}static async getDecimals(n,t,o){const a=p(o)?0:new h(o).toInt();if(a===0)return j(g._platform);const d=await t.getAssetByID(a).do(),r=i.modelsv2.Asset.from_obj_for_encoding(d);if(!r.params||!r.params.decimals)throw new Error("Could not fetch token details");return Number(r.params.decimals)}static async getBalance(n,t,o,a){const d=p(a)?0:new h(a).toInt();if(d===0){const c=await t.accountInformation(o).do(),u=i.modelsv2.Account.from_obj_for_encoding(c);return BigInt(u.amount)}const r=await t.accountAssetInformation(o,d).do(),s=i.modelsv2.AssetHolding.from_obj_for_encoding(r);return BigInt(s.amount)}static async getBalances(n,t,o,a){let d;if(a.includes("native")){const s=await t.accountInformation(o).do(),c=i.modelsv2.Account.from_obj_for_encoding(s);d=BigInt(c.amount)}return a.map(async s=>{if(p(s))return{native:d};const c=new h(s).toInt(),u=await t.accountAssetInformation(o,c).do(),f=i.modelsv2.AssetHolding.from_obj_for_encoding(u);return BigInt(f.amount)}).reduce((s,c)=>Object.assign(s,c),{})}static async sendWait(n,t,o){const r=o.map((f,b)=>i.decodeSignedTransaction(f)).map((f,b)=>f.txn.txID()),{txId:s}=await t.sendRawTransaction(o).do();if(!s)throw new Error("Transaction(s) failed to send");const c=await i.waitForConfirmation(t,s,4);if(!i.modelsv2.PendingTransactionResponse.from_obj_for_encoding(c).confirmedRound)throw new Error("Transaction(s) could not be confirmed in 4 rounds");return r}static async getLatestBlock(n){const t=await n.status().do(),o=i.modelsv2.NodeStatusResponse.from_obj_for_encoding(t);if(!o.lastRound)throw new Error("Error getting status from node");return Number(o.lastRound)}static async getLatestFinalizedBlock(n){const t=await n.status().do(),o=i.modelsv2.NodeStatusResponse.from_obj_for_encoding(t);if(!o.lastRound)throw new Error("Error getting status from node");return Number(o.lastRound)}static chainFromChainId(n){const t=N(g._platform,n);if(t===void 0)throw new Error(`Unknown native chain id ${n}`);const[o,a]=t;return[o,a]}static async chainFromRpc(n){const t=await n.versionsCheck().do(),o=i.modelsv2.Version.from_obj_for_encoding(t);return this.chainFromChainId(o.genesisId)}};l(g,"_platform",w);let m=g;async function $(e,n){const[t,o]=await m.chainFromRpc(e);return new P(o,e,n)}class P{constructor(n,t,o,a=!1){l(this,"_chain");l(this,"_debug");l(this,"_account");this._chain=n,this._debug=a,this._account=k(o)}chain(){return this._chain}address(){return this._account.addr}async sign(n){const t=[],o=n.map((r,s)=>r.transaction.tx),a=B(o),d=n.map((r,s)=>(r.transaction.tx=a[s],r));for(const r of d){const{description:s,transaction:c}=r,{tx:u,signer:f}=c;this._debug&&(console.log(u._getDictForDisplay()),console.log(u.txID())),f?(this._debug&&console.log(`Signing: ${s} with signer ${f.address} for address ${this.address()}`),t.push(await f.signTxn(u))):(this._debug&&console.log(`Signing: ${s} without signer for address ${this.address()}`),t.push(u.signTxn(this._account.sk)))}return t}}const F={Address:h,Platform:m,getSigner:$,protocols:{WormholeCore:()=>_(()=>import("./index-re-SltAL.js").then(e=>e.i),__vite__mapDeps([0,1,2])),TokenBridge:()=>_(()=>import("./index-BbJVBTsE.js"),__vite__mapDeps([3,0,1,2]))},getChain:(e,n,t)=>new I(n,new m(e,D(e,w,{[n]:t})))},U=Object.freeze(Object.defineProperty({__proto__:null,default:F},Symbol.toStringTag,{value:"Module"}));export{m as A,U as a};
@@ -1 +1 @@
1
- import{B as l,g as w,s as y,i as p,I as h,d as g,c as k,a as O,b as L,H as m,f as E}from"./evm-DiRlPnyB.js";import"../main.js";import"./index-wTEu0lCN.js";class x extends l{constructor({callbackSelector:e,cause:a,data:n,extraData:c,sender:d,urls:r}){var i;super(a.shortMessage||"An error occurred while fetching for an offchain result.",{cause:a,metaMessages:[...a.metaMessages||[],(i=a.metaMessages)!=null&&i.length?"":[],"Offchain Gateway Call:",r&&[" Gateway URL(s):",...r.map(u=>` ${w(u)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${e}`,` Extra data: ${c}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}}class M extends l{constructor({result:e,url:a}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(a)}`,`Response: ${y(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}}class R extends l{constructor({sender:e,to:a}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${a}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}}function $(o,e){if(!p(o))throw new h({address:o});if(!p(e))throw new h({address:e});return o.toLowerCase()===e.toLowerCase()}const j="0x556f1830",S={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function D(o,{blockNumber:e,blockTag:a,data:n,to:c}){const{args:d}=g({data:n,abi:[S]}),[r,i,u,t,s]=d;try{if(!$(c,r))throw new R({sender:r,to:c});const f=await A({data:u,sender:r,urls:i}),{data:b}=await k(o,{blockNumber:e,blockTag:a,data:O([t,L([{type:"bytes"},{type:"bytes"}],[f,s])]),to:c});return b}catch(f){throw new x({callbackSelector:t,cause:f,data:n,extraData:s,sender:r,urls:i})}}async function A({data:o,sender:e,urls:a}){var c;let n=new Error("An unknown error occurred.");for(let d=0;d<a.length;d++){const r=a[d],i=r.includes("{data}")?"GET":"POST",u=i==="POST"?{data:o,sender:e}:void 0;try{const t=await fetch(r.replace("{sender}",e).replace("{data}",o),{body:JSON.stringify(u),method:i});let s;if((c=t.headers.get("Content-Type"))!=null&&c.startsWith("application/json")?s=(await t.json()).data:s=await t.text(),!t.ok){n=new m({body:u,details:s!=null&&s.error?y(s.error):t.statusText,headers:t.headers,status:t.status,url:r});continue}if(!E(s)){n=new M({result:s,url:r});continue}return s}catch(t){n=new m({body:u,details:t.message,url:r})}}throw n}export{A as ccipFetch,D as offchainLookup,S as offchainLookupAbiItem,j as offchainLookupSignature};
1
+ import{B as l,g as w,s as y,i as p,I as h,d as g,c as k,a as O,b as L,H as m,f as E}from"./evm-FvO3h1wl.js";import"../main.js";import"./index-wTEu0lCN.js";class x extends l{constructor({callbackSelector:e,cause:a,data:n,extraData:c,sender:d,urls:r}){var i;super(a.shortMessage||"An error occurred while fetching for an offchain result.",{cause:a,metaMessages:[...a.metaMessages||[],(i=a.metaMessages)!=null&&i.length?"":[],"Offchain Gateway Call:",r&&[" Gateway URL(s):",...r.map(u=>` ${w(u)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${e}`,` Extra data: ${c}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}}class M extends l{constructor({result:e,url:a}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(a)}`,`Response: ${y(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}}class R extends l{constructor({sender:e,to:a}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${a}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}}function $(o,e){if(!p(o))throw new h({address:o});if(!p(e))throw new h({address:e});return o.toLowerCase()===e.toLowerCase()}const j="0x556f1830",S={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function D(o,{blockNumber:e,blockTag:a,data:n,to:c}){const{args:d}=g({data:n,abi:[S]}),[r,i,u,t,s]=d;try{if(!$(c,r))throw new R({sender:r,to:c});const f=await A({data:u,sender:r,urls:i}),{data:b}=await k(o,{blockNumber:e,blockTag:a,data:O([t,L([{type:"bytes"},{type:"bytes"}],[f,s])]),to:c});return b}catch(f){throw new x({callbackSelector:t,cause:f,data:n,extraData:s,sender:r,urls:i})}}async function A({data:o,sender:e,urls:a}){var c;let n=new Error("An unknown error occurred.");for(let d=0;d<a.length;d++){const r=a[d],i=r.includes("{data}")?"GET":"POST",u=i==="POST"?{data:o,sender:e}:void 0;try{const t=await fetch(r.replace("{sender}",e).replace("{data}",o),{body:JSON.stringify(u),method:i});let s;if((c=t.headers.get("Content-Type"))!=null&&c.startsWith("application/json")?s=(await t.json()).data:s=await t.text(),!t.ok){n=new m({body:u,details:s!=null&&s.error?y(s.error):t.statusText,headers:t.headers,status:t.status,url:r});continue}if(!E(s)){n=new M({result:s,url:r});continue}return s}catch(t){n=new m({body:u,details:t.message,url:r})}}throw n}export{A as ccipFetch,D as offchainLookup,S as offchainLookupAbiItem,j as offchainLookupSignature};