@wormhole-foundation/wormhole-connect 2.0.0-beta.1-development → 2.0.0

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 (122) hide show
  1. package/dist/assets/{aptos-gRn0txr9.js → aptos-CvRULtpx.js} +61 -61
  2. package/dist/assets/aptos-D4y7Fo3S.js +3 -0
  3. package/dist/assets/{chunk-OR6GFWLG-Ci0TYwIQ.js → chunk-OR6GFWLG-BZrmB1_W.js} +1 -1
  4. package/dist/assets/evm-K2ASlzX-.js +2 -0
  5. package/dist/assets/{index-CTtLxavV.js → index-AaqmNOLf.js} +1 -1
  6. package/dist/assets/index-BLpnEfNA.js +1 -0
  7. package/dist/assets/{index-DtASoatx.js → index-BTnVHgr_.js} +1 -1
  8. package/dist/assets/{index-Cf10mHc-.js → index-BpWlJX3r.js} +1 -1
  9. package/dist/assets/{index-DTCth0iO.js → index-C1mpuWJz.js} +1 -1
  10. package/dist/assets/{index-cfzEp_CP.js → index-C1yBHw3e.js} +1 -1
  11. package/dist/assets/{index-Dwk61kXP.js → index-CEjbqPmT.js} +1 -1
  12. package/dist/assets/{index-BZKNZDak.js → index-CZHHMApS.js} +1 -1
  13. package/dist/assets/{index-Cm_KjDDY.js → index-QLnl5sO1.js} +1 -1
  14. package/dist/assets/{index-D7CrUmY0.js → index-_NuAK6zi.js} +1 -1
  15. package/dist/assets/index-rryJGGTI.js +1 -0
  16. package/dist/assets/{signer-BaParnK7.js → signer-dWGaM-mu.js} +1 -1
  17. package/dist/assets/{solana-5w7FFw9J.js → solana-D2tTKYdq.js} +1 -1
  18. package/dist/assets/solana-UIzLk1Ne.js +2 -0
  19. package/dist/assets/{sui-DaosOePU.js → sui-DVNvuW-l.js} +4 -4
  20. package/dist/assets/unsignedTransaction-DsxtoHjl.js +1 -0
  21. package/dist/main.js +100 -100
  22. package/dist/src/config/mainnet/tokens.d.ts.map +1 -1
  23. package/dist/src/config/testnet/tokens.d.ts.map +1 -1
  24. package/dist/src/hooks/useWalletCompatibility.d.ts +14 -0
  25. package/dist/src/hooks/useWalletCompatibility.d.ts.map +1 -0
  26. package/dist/src/utils/index.d.ts +1 -1
  27. package/dist/src/utils/index.d.ts.map +1 -1
  28. package/dist/src/utils/wallet/aptos.d.ts.map +1 -1
  29. package/dist/src/views/v2/Bridge/index.d.ts.map +1 -1
  30. package/lib/aptos-CH5PkH0s.js +2 -0
  31. package/lib/{aptos-szFJdwGu.mjs → aptos-DQLx8hgI.mjs} +59 -57
  32. package/lib/{aptos-ZmgQfu2i.mjs → aptos-Ma7G2qxg.mjs} +1229 -1228
  33. package/lib/{aptos-DBP3jmW7.js → aptos-b8R7xC2M.js} +9 -9
  34. package/lib/{base64-BFA_udDL.js → base64-BoCuDrAB.js} +1 -1
  35. package/lib/{base64-DJKqMaey.mjs → base64-mN6OGBib.mjs} +1 -1
  36. package/lib/{ccip-DA2Nx1SC.js → ccip-B9dsdqqe.js} +1 -1
  37. package/lib/{ccip-urjf2Ohy.mjs → ccip-D9a8gGDP.mjs} +1 -1
  38. package/lib/{chunk-OR6GFWLG-DMRHoX5e.js → chunk-OR6GFWLG-D0VxCcX2.js} +5 -5
  39. package/lib/{chunk-OR6GFWLG-BxTMqzEc.mjs → chunk-OR6GFWLG-DVAlj5GC.mjs} +6 -3
  40. package/lib/{events-CeUTM3JY.js → events-BiLMWAJd.js} +1 -1
  41. package/lib/{events-VkSlTRL0.mjs → events-exed8Lkm.mjs} +1 -1
  42. package/lib/{evm-CVR26OSW.mjs → evm-Bn4_N0e_.mjs} +6 -6
  43. package/lib/{evm-rBfvNQnC.js → evm-D5JyNa99.js} +1 -1
  44. package/lib/{evm-DR1h6onf.js → evm-DOSrblQ4.js} +3 -3
  45. package/lib/{evm-DSWmFw3D.mjs → evm-DbuXa17H.mjs} +5 -5
  46. package/lib/{index-y6JzKy7h.js → index-B14q08ea.js} +1 -1
  47. package/lib/{index-D2ZFuAXe.mjs → index-B4hte2VB.mjs} +1 -1
  48. package/lib/{index-CUD_KSHh.mjs → index-B5Deg2Mr.mjs} +4 -4
  49. package/lib/{index-CtzDS4Ek.js → index-B7xiGLlo.js} +1 -1
  50. package/lib/{index-BD-n4Jda.js → index-BEg_FhHj.js} +1 -1
  51. package/lib/{index-CP1YtvQl.mjs → index-BEjIjDI_.mjs} +2 -2
  52. package/lib/{index-DdleqS-C.js → index-BL3U9o8r.js} +1 -1
  53. package/lib/{index-B54uaK5S.mjs → index-BQmtmaUN.mjs} +3 -3
  54. package/lib/{index-Ccg2yYsG.mjs → index-BVa8vX0X.mjs} +2 -2
  55. package/lib/index-BWwLFE0K.mjs +102 -0
  56. package/lib/{index-Bb6FMstR.js → index-Ba2rdKMd.js} +1 -1
  57. package/lib/{index-BVdejQdc.js → index-BaF9FXkh.js} +1 -1
  58. package/lib/{index-C92Lbp7R.js → index-BdbY6Nvl.js} +1 -1
  59. package/lib/{index-Ds36ZJFd.js → index-BsRDGZ_9.js} +1 -1
  60. package/lib/{index-DbFTlikk.js → index-Bt41X2O-.js} +1 -1
  61. package/lib/{index-fTMcBh-E.js → index-BtBZ1mGN.js} +1 -1
  62. package/lib/{index-BdgBgC9M.mjs → index-ByaJFPk7.mjs} +2 -2
  63. package/lib/{index-Gq0crvhx.js → index-CMcnZ-nu.js} +1 -1
  64. package/lib/{index-Cm2DqtOc.mjs → index-CT8zJiLG.mjs} +48 -57
  65. package/lib/{index-BN7FfORx.mjs → index-CTdUTRp6.mjs} +25133 -25060
  66. package/lib/index-CTywhroc.js +1 -0
  67. package/lib/{index-COMVJ9EC.js → index-CeiDJddc.js} +1 -1
  68. package/lib/{index-2Hoo-RF7.mjs → index-CjC_JXyt.mjs} +1 -1
  69. package/lib/{index-Bh_VUH6w.js → index-CoYZ1p1j.js} +154 -154
  70. package/lib/{index-BGMRuYE4.mjs → index-CyZSCH1P.mjs} +22 -22
  71. package/lib/{index-C23ZcDqk.mjs → index-CztHxO-n.mjs} +2 -2
  72. package/lib/{index-Coap6PLP.mjs → index-D-8Ng1L-.mjs} +8 -8
  73. package/lib/{index-DGzYkbea.mjs → index-D08eoAwY.mjs} +7 -7
  74. package/lib/{index-CMS03ogd.js → index-D5i-Hwy3.js} +1 -1
  75. package/lib/{index-42eVh0Hb.mjs → index-D6uakBm-.mjs} +2 -2
  76. package/lib/{index-CCwF2yAJ.mjs → index-DKvD1ciD.mjs} +5 -5
  77. package/lib/{index-BZWHrS5h.mjs → index-DNQTwT9U.mjs} +2 -2
  78. package/lib/{index-DaebrvyB.js → index-DuaKRUyC.js} +1 -1
  79. package/lib/index-DudwgIzb.js +1 -0
  80. package/lib/{index-KKiy1Hrx.mjs → index-DzFW4H-c.mjs} +1 -1
  81. package/lib/{index-BXHKeAv4.mjs → index-_f9fa-SF.mjs} +2 -2
  82. package/lib/{index-sGgOiMAb.js → index-dmXJ0lij.js} +1 -1
  83. package/lib/{index-pf1Hd87D.js → index-t_N-kr6F.js} +1 -1
  84. package/lib/{index-Fsd-hYv7.mjs → index-yHv6yF_6.mjs} +38 -38
  85. package/lib/{index-B6Cq1iZ2.js → index-zkkhgyCt.js} +1 -1
  86. package/lib/{index.es-BwVfbE63.mjs → index.es-BU6v666-.mjs} +6 -6
  87. package/lib/{index.es-Bb3szEaY.js → index.es-HUYc3ygi.js} +2 -2
  88. package/lib/index.js +1 -1
  89. package/lib/index.mjs +1 -1
  90. package/lib/{signer-DOhyF9G-.mjs → signer-B5bRCRbp.mjs} +19 -19
  91. package/lib/{signer-BYquDVs4.js → signer-_8JGUZ18.js} +1 -1
  92. package/lib/{solana-C7zGAW8V.mjs → solana-C5maMKhK.mjs} +4 -4
  93. package/lib/solana-C8ERuccx.mjs +16 -0
  94. package/lib/solana-CFT736gU.js +1 -0
  95. package/lib/{solana-cxRzZXbi.js → solana-Vkj_NP_7.js} +1 -1
  96. package/lib/{solanaEmbed.esm-DYuDmeOj.mjs → solanaEmbed.esm-CeLkcZUT.mjs} +959 -959
  97. package/lib/{solanaEmbed.esm-Bw4WVPNb.js → solanaEmbed.esm-GokLVSoz.js} +1 -1
  98. package/lib/src/config/mainnet/tokens.d.ts.map +1 -1
  99. package/lib/src/config/testnet/tokens.d.ts.map +1 -1
  100. package/lib/src/hooks/useWalletCompatibility.d.ts +14 -0
  101. package/lib/src/hooks/useWalletCompatibility.d.ts.map +1 -0
  102. package/lib/src/utils/index.d.ts +1 -1
  103. package/lib/src/utils/index.d.ts.map +1 -1
  104. package/lib/src/utils/wallet/aptos.d.ts.map +1 -1
  105. package/lib/src/views/v2/Bridge/index.d.ts.map +1 -1
  106. package/lib/{sui-BAj9wCLR.mjs → sui-BgpwzAcZ.mjs} +1 -1
  107. package/lib/{sui-D2Lx7sNr.js → sui-CFB02A_e.js} +1 -1
  108. package/lib/{sui--QzlscdW.mjs → sui-CXLpQ4w9.mjs} +5 -5
  109. package/lib/{sui-DFYvs2lh.js → sui-DwGUL_nC.js} +2 -2
  110. package/lib/unsignedTransaction-BDOQhqcZ.mjs +16 -0
  111. package/lib/unsignedTransaction-C1YeEl4G.js +1 -0
  112. package/lib/{utf8-C9mhtl0f.js → utf8-BBrW0GUg.js} +1 -1
  113. package/lib/{utf8-D8MD86af.mjs → utf8-Dg51R0Wb.mjs} +1 -1
  114. package/package.json +18 -18
  115. package/dist/assets/aptos-Ycl2eNjD.js +0 -3
  116. package/dist/assets/evm-ETvgEF-D.js +0 -2
  117. package/dist/assets/index-_2IpGxfE.js +0 -1
  118. package/dist/assets/solana-u2eYUt3V.js +0 -2
  119. package/lib/aptos-C698CxDU.js +0 -2
  120. package/lib/index-DVxKNFdQ.js +0 -1
  121. package/lib/solana-B0yxLYge.mjs +0 -16
  122. package/lib/solana-i-1aVGyQ.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wormhole-foundation/wormhole-connect",
3
- "version": "2.0.0-beta.1-development",
3
+ "version": "2.0.0",
4
4
  "repository": "github:wormhole-foundation/wormhole-connect",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.mjs",
@@ -39,8 +39,8 @@
39
39
  "@solana/spl-token": "^0.3.9",
40
40
  "@solana/wallet-adapter-wallets": "^0.19.25",
41
41
  "@solana/web3.js": "^1.95.8",
42
- "@wormhole-foundation/sdk": "1.5.0",
43
- "@wormhole-foundation/sdk-definitions": "1.5.0",
42
+ "@wormhole-foundation/sdk": "1.5.2",
43
+ "@wormhole-foundation/sdk-definitions": "1.5.2",
44
44
  "@wormhole-foundation/sdk-definitions-ntt": "^0.6.1",
45
45
  "@wormhole-foundation/sdk-evm-ntt": "^0.6.1",
46
46
  "@wormhole-foundation/sdk-icons": "^1.0.0",
@@ -167,31 +167,31 @@
167
167
  "axios": "1.4.0"
168
168
  },
169
169
  "@mayanfinance/wormhole-sdk-route": {
170
- "@wormhole-foundation/sdk-connect": "1.5.0",
171
- "@wormhole-foundation/sdk-evm": "1.5.0",
172
- "@wormhole-foundation/sdk-solana": "1.5.0"
170
+ "@wormhole-foundation/sdk-connect": "1.5.2",
171
+ "@wormhole-foundation/sdk-evm": "1.5.2",
172
+ "@wormhole-foundation/sdk-solana": "1.5.2"
173
173
  },
174
174
  "@wormhole-foundation/sdk-definitions-ntt": {
175
- "@wormhole-foundation/sdk-base": "1.5.0",
176
- "@wormhole-foundation/sdk-definitions": "1.5.0"
175
+ "@wormhole-foundation/sdk-base": "1.5.2",
176
+ "@wormhole-foundation/sdk-definitions": "1.5.2"
177
177
  },
178
178
  "@wormhole-foundation/sdk-evm-ntt": {
179
- "@wormhole-foundation/sdk-base": "1.5.0",
180
- "@wormhole-foundation/sdk-definitions": "1.5.0",
181
- "@wormhole-foundation/sdk-evm": "1.5.0",
182
- "@wormhole-foundation/sdk-evm-core": "1.5.0"
179
+ "@wormhole-foundation/sdk-base": "1.5.2",
180
+ "@wormhole-foundation/sdk-definitions": "1.5.2",
181
+ "@wormhole-foundation/sdk-evm": "1.5.2",
182
+ "@wormhole-foundation/sdk-evm-core": "1.5.2"
183
183
  },
184
184
  "@wormhole-foundation/sdk-route-ntt": {
185
- "@wormhole-foundation/sdk-connect": "1.5.0"
185
+ "@wormhole-foundation/sdk-connect": "1.5.2"
186
186
  },
187
187
  "@wormhole-foundation/sdk-solana-ntt": {
188
- "@wormhole-foundation/sdk-base": "1.5.0",
189
- "@wormhole-foundation/sdk-definitions": "1.5.0",
190
- "@wormhole-foundation/sdk-solana": "1.5.0",
191
- "@wormhole-foundation/sdk-solana-core": "1.5.0"
188
+ "@wormhole-foundation/sdk-base": "1.5.2",
189
+ "@wormhole-foundation/sdk-definitions": "1.5.2",
190
+ "@wormhole-foundation/sdk-solana": "1.5.2",
191
+ "@wormhole-foundation/sdk-solana-core": "1.5.2"
192
192
  },
193
193
  "@wormhole-foundation/wormhole-connect": {
194
- "aptos": "1.5.0"
194
+ "aptos": "1.5.2"
195
195
  },
196
196
  "@json-rpc-tools/provider": {
197
197
  "axios": "0.27.2"
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CTtLxavV.js","main.js","main.css","assets/chunk-OR6GFWLG-Ci0TYwIQ.js","assets/index-BFMIYSUy.js","assets/base64-IWuz5NCL.js","assets/index-_2IpGxfE.js"])))=>i.map(i=>d[i]);
2
- var w=Object.defineProperty;var A=(e,t,n)=>t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var h=(e,t,n)=>A(e,typeof t!="symbol"?t+"":t,n);import{ad as S,ae as b,af as p,ag as y,ah as C,ai as d,aj as T,ak as l,al as v,am as I,an as m,ao as E,aa as N,_ as g,a0 as P}from"../main.js";import{e as f,q as k,A as O,M as x,z as B}from"./chunk-OR6GFWLG-Ci0TYwIQ.js";class _ extends S{}const c=class c extends b{constructor(t,n){super(t,n??y(t,c._platform))}getRpc(t){if(t in this.config){const n=this.network==="Mainnet"?f.MAINNET:f.TESTNET,a=new k({fullnode:this.config[t].rpc,network:n});return new O(a)}throw new Error("No configuration available for chain: "+t)}getChain(t,n){if(t in this.config)return new _(t,this);throw new Error("No configuration available for chain: "+t)}static nativeTokenId(t,n){if(!this.isSupportedChain(n))throw new Error(`invalid chain: ${n}`);return C.tokenId(n,d)}static isNativeTokenId(t,n,a){return!this.isSupportedChain(n)||a.chain!==n?!1:this.nativeTokenId(t,n)==a}static isSupportedChain(t){return T(t)===c._platform}static async getDecimals(t,n,a){if(l(a)||a===d)return v(c._platform);const s=a.toString();return(await n.getAccountResource({accountAddress:s.split(I)[0],resourceType:`0x1::coin::CoinInfo<${s}>`})).decimals}static async getBalance(t,n,a,s){const r=l(s)?d:s.toString();try{const i=await n.getAccountCoinAmount({accountAddress:a,coinType:r});return BigInt(i)}catch(i){if(i.status===404)return null;throw i}}static async getBalances(t,n,a,s){return(await Promise.all(s.map(async i=>{const o=await this.getBalance(t,n,a,i);return{[l(i)?"native":new m(i).toString()]:o}}))).reduce((i,o)=>Object.assign(i,o),{})}static async sendWait(t,n,a){const s=[];for(const r of a){const i=await n.transaction.submit.simple(r.transaction),o=await n.waitForTransaction({transactionHash:i.hash});s.push(o.hash)}return s}static async getLatestBlock(t){const n=await t.getLedgerInfo();return Number(n.block_height)}static async getLatestFinalizedBlock(t){const n=await t.getLedgerInfo();return Number(n.block_height)}static chainFromChainId(t){const n=E(c._platform,BigInt(t));if(!n)throw new Error(`No matching chainId to determine network and chain: ${t}`);const[a,s]=n;return[a,s]}static async chainFromRpc(t){const n=await t.getLedgerInfo();return this.chainFromChainId(n.chain_id.toString())}};h(c,"_platform",p);let u=c;async function R(e,t){const[n,a]=await u.chainFromRpc(e),s=x.fromPrivateKey({privateKey:new B(N.decode(t))});return new $(a,s,e)}class ${constructor(t,n,a,s){h(this,"_chain");h(this,"_account");h(this,"_rpc");h(this,"_debug");this._chain=t,this._account=n,this._rpc=a,this._debug=s}chain(){return this._chain}address(){return this._account.accountAddress.toString()}async signAndSend(t){const n=[];for(const a of t){const{description:s,transaction:r}=a;this._debug&&console.log(`Signing: ${s} for ${this.address()}`);const i=await this._rpc.transaction.build.simple({sender:this._account.accountAddress,data:r}),{hash:o}=await this._simSignSend(i);n.push(o)}return n}async _simSignSend(t){return await this._rpc.transaction.simulate.simple({signerPublicKey:this._account.publicKey,transaction:t}).then(n=>n.forEach(a=>{if(!a.success)throw new Error(`Transaction failed: ${a.vm_status}
3
- ${JSON.stringify(a,null,2)}`)})),this._rpc.signAndSubmitTransaction({signer:this._account,transaction:t}).then(n=>this._rpc.waitForTransaction({transactionHash:n.hash}))}}const F={Address:m,Platform:u,getSigner:R,protocols:{WormholeCore:()=>g(()=>import("./index-CTtLxavV.js"),__vite__mapDeps([0,1,2,3,4,5])),TokenBridge:()=>g(()=>import("./index-_2IpGxfE.js"),__vite__mapDeps([6,1,2,3,4,5]))},getChain:(e,t,n)=>new _(t,new u(e,P(e,p,{[t]:n})))},M=Object.freeze(Object.defineProperty({__proto__:null,default:F},Symbol.toStringTag,{value:"Module"}));export{u as A,M as a};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["main.js","main.css","assets/index-Cm_KjDDY.js","assets/index-BZKNZDak.js","assets/index-DTCth0iO.js"])))=>i.map(i=>d[i]);
2
- var R=Object.defineProperty;var x=s=>{throw TypeError(s)};var I=(s,t,e)=>t in s?R(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var f=(s,t,e)=>I(s,typeof t!="symbol"?t+"":t,e),D=(s,t,e)=>t.has(s)||x("Cannot "+e);var h=(s,t,e)=>(D(s,t,"read from private field"),e?e.call(s):t.get(s)),l=(s,t,e)=>t.has(s)?x("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),o=(s,t,e,n)=>(D(s,t,"write to private field"),n?n.call(s,e):t.set(s,e),e);var S=(s,t,e,n)=>({set _(r){o(s,t,r,e)},get _(){return h(s,t,n)}});import{S as V,d as B,U as $,X as _,Y as M,Z as W,_ as u,$ as b,a0 as U,a1 as X}from"../main.js";var a,c;const v=class v extends V{constructor(e){super(e.provider);f(this,"signer");l(this,a);l(this,c);B(this,{signer:e}),o(this,a,null),o(this,c,0)}async getAddress(){return this.signer.getAddress()}connect(e){return new v(this.signer.connect(e))}async getNonce(e){if(e==="pending"){h(this,a)==null&&o(this,a,super.getNonce("pending"));const n=h(this,c);return await h(this,a)+n}return super.getNonce(e)}increment(){S(this,c)._++}reset(){o(this,c,0),o(this,a,null)}async sendTransaction(e){const n=this.getNonce("pending");return this.increment(),e=await this.signer.populateTransaction(e),e.nonce=await n,await this.signer.sendTransaction(e)}signTransaction(e){return this.signer.signTransaction(e)}signMessage(e){return this.signer.signMessage(e)}signTypedData(e,n,r){return this.signer.signTypedData(e,n,r)}};a=new WeakMap,c=new WeakMap;let P=v;async function Y(s,t,e){const n=typeof t=="string"?new $(t,s):t,r=(e==null?void 0:e.chain)??(await _.chainFromRpc(s))[1],i=new P(n);if(i.provider===null)try{i.connect(s)}catch(d){console.error("Cannot connect to network for signer",d)}return new Z(r,await n.getAddress(),i,e)}class Z extends M{constructor(e,n,r,i){super(e,n,r);f(this,"opts");this.opts=i}chain(){return this._chain}address(){return this._address}async sign(e){var w,E,T,y,A,L,C;const n=this.chain(),r=[];let i=500000n,d=100000000000n,m=1500000000n,p=100000000n;if(((w=this.opts)==null?void 0:w.overrides)===void 0&&n!=="Celo"){const g=await this._signer.provider.getFeeData();d=g.gasPrice??d,m=g.maxFeePerGas??m,p=g.maxPriorityFeePerGas??p}((E=this.opts)==null?void 0:E.gasLimit)!==void 0&&(i=this.opts.gasLimit),((T=this.opts)==null?void 0:T.maxGasLimit)!==void 0&&(i=i>((y=this.opts)==null?void 0:y.maxGasLimit)?(A=this.opts)==null?void 0:A.maxGasLimit:i);const G=n==="Oasis"?{gasLimit:i,gasPrice:d,type:0}:{gasLimit:i,maxFeePerGas:m,maxPriorityFeePerGas:p};for(const g of e){const{transaction:O,description:F}=g;(L=this.opts)!=null&&L.debug&&console.log(`Signing: ${F} for ${this.address()}`);const N={...O,...G,from:this.address(),nonce:await this._signer.getNonce(),...(C=this.opts)==null?void 0:C.overrides};r.push(await this._signer.signTransaction(N))}return r}}const z={Address:W,Platform:_,getSigner:Y,protocols:{WormholeCore:()=>u(()=>import("../main.js").then(s=>s.cM),__vite__mapDeps([0,1])),TokenBridge:()=>u(()=>import("./index-Cm_KjDDY.js"),__vite__mapDeps([2,0,1])),PorticoBridge:()=>u(()=>import("./index-BZKNZDak.js"),__vite__mapDeps([3,0,1,2])),CircleBridge:()=>u(()=>import("./index-DTCth0iO.js"),__vite__mapDeps([4,0,1,2]))},getChain:(s,t,e)=>new b(t,new _(s,U(s,X,{[t]:e})))};export{z as default};
@@ -1 +0,0 @@
1
- var S=Object.defineProperty;var b=(i,e,t)=>e in i?S(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var a=(i,e,t)=>b(i,typeof e!="symbol"?e+"":e,t);import{cB as f,cC as v,cx as x,am as p,cD as I,bw as w,bZ as E,bD as F,b_ as m,aa as o,O as k,an as c,ak as h,cE as U,c3 as T,i as $,c0 as C,ai as _,bE as u,cF as O,bJ as W}from"../main.js";import{A as N}from"./aptos-Ycl2eNjD.js";import"./chunk-OR6GFWLG-Ci0TYwIQ.js";import"./index-BFMIYSUy.js";import"./base64-IWuz5NCL.js";class Q{constructor(e,t,s,n,r=!1){a(this,"transaction");a(this,"network");a(this,"chain");a(this,"description");a(this,"parallelizable");this.transaction=e,this.network=t,this.chain=s,this.description=n,this.parallelizable=r}}const R=[{name:"tokenBridgeAddress",...f},{name:"chain",...v()},{name:"domainSeparator",binary:"bytes",custom:x.encode(p),omit:!0},{name:"tokenId",...f},{name:"domainSeparator",binary:"bytes",custom:new Uint8Array([255]),omit:!0}],P=i=>I(R,i);class d{constructor(e,t,s,n){a(this,"network");a(this,"chain");a(this,"connection");a(this,"contracts");a(this,"chainId");a(this,"tokenBridgeAddress");this.network=e,this.chain=t,this.connection=s,this.contracts=n,this.chainId=w(t);const r=n.tokenBridge;if(!r)throw new Error(`TokenBridge contract Address for chain ${t} not found`);this.tokenBridgeAddress=r}static async fromRpc(e,t){const[s,n]=await N.chainFromRpc(e),r=t[n];if(r.network!==s)throw new Error("Network mismatch "+r.network+" !== "+s);return new d(s,n,e,r.contracts)}async isWrappedAsset(e){try{return await this.getOriginalAsset(e),!0}catch{return!1}}async getOriginalAsset(e){const t=e.toString().split(p),s=await this.connection.getAccountResource({accountAddress:t[0],resourceType:`${this.tokenBridgeAddress}::state::OriginInfo`});if(!s)throw E(e.toString());const n=F(parseInt(s.token_chain.number)),r=new m(s.token_address.external_address);return{chain:n,address:r}}async getTokenUniversalAddress(e){return new m(o.encode(k(e.toString()),!0))}async getTokenNativeAddress(e,t){const s=e===this.chain?await this.getTypeFromExternalAddress(t.toString()):await this.getAssetFullyQualifiedType({chain:e,address:t});if(!s)throw new Error("Invalid asset address.");return new c(s)}async hasWrappedAsset(e){try{return await this.getWrappedAsset(e),!0}catch{}return!1}async getWrappedAsset(e){if(h(e.address))throw new Error("native asset cannot be a wrapped asset");const t=await this.getAssetFullyQualifiedType(e);if(!t)throw new Error("Invalid asset address.");return await this.connection.getAccountResource({accountAddress:U(t),resourceType:`${this.tokenBridgeAddress}::state::OriginInfo`}),T(this.chain,t)}async isTransferCompleted(e){const s=(await this.connection.getAccountResource({accountAddress:this.tokenBridgeAddress,resourceType:`${this.tokenBridgeAddress}::state::State`})).consumed_vaas.elems.handle;try{return await this.connection.getTableItem({handle:s,data:{key_type:"vector<u8>",value_type:"u8",key:`0x${$.Buffer.from(C(e.hash)).toString("hex")}`}}),!0}catch{return!1}}async getWrappedNative(){return T(this.chain,_)}async*createAttestation(e,t){const s={chain:this.chain,address:new c(e)},n=await this.getAssetFullyQualifiedType(s);if(!n)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::attest_token::attest_token_entry`,typeArguments:[n],functionArguments:[]},"Aptos.AttestToken")}async*submitAttestation(e,t){yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin_type`,typeArguments:[],functionArguments:[u(e)]},"Aptos.CreateWrappedCoinType");const s=await this.getAssetFullyQualifiedType(e.payload.token);if(!s)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin`,typeArguments:[s],functionArguments:[u(e)]},"Aptos.CreateWrappedCoin")}async*transfer(e,t,s,n,r){const B=0n,l=0n,A=h(s)?_:s.toString(),y=t.address.toUniversalAddress().toUint8Array(),g=w(t.chain);r?yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_with_payload_entry`,typeArguments:[A],functionArguments:[n,g,y,l,r]},"Aptos.TransferTokensWithPayload"):yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_entry`,typeArguments:[A],functionArguments:[n,g,y,B,l]},"Aptos.TransferTokens")}async*redeem(e,t,s=!0){const n=t.payload.token.chain===this.chain?await this.getTypeFromExternalAddress(t.payload.token.address.toString()):await this.getAssetFullyQualifiedType(t.payload.token);if(!n)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::complete_transfer::submit_vaa_and_register_entry`,typeArguments:[n],functionArguments:[u(t)]},"Aptos.CompleteTransfer")}async getAssetFullyQualifiedType(e){return e.chain===this.chain?O(e.address.toString())?e.address.toString():null:`${d.getForeignAssetAddress(this.chain,this.tokenBridgeAddress,e)}::coin::T`}async getTypeFromExternalAddress(e){try{const t=await this.connection.getAccountResource({accountAddress:this.tokenBridgeAddress,resourceType:`${this.tokenBridgeAddress}::state::State`}),{handle:s}=t.native_infos,n=await this.connection.getTableItem({handle:s,data:{key_type:`${this.tokenBridgeAddress}::token_hash::TokenHash`,value_type:"0x1::type_info::TypeInfo",key:{hash:e}}});return n?[n.account_address,String.fromCharCode(...o.decode(n.module_name)),String.fromCharCode(...o.decode(n.struct_name))].join(p):null}catch{return null}}static getForeignAssetAddress(e,t,s){if(h(s.address))throw new Error("Invalid token address");const n=P({chain:s.chain,tokenBridgeAddress:new c(t).toUniversalAddress(),tokenId:s.address.toUniversalAddress()});return o.encode(k(n),!0)}createUnsignedTx(e,t,s=!1){return new Q(e,this.network,this.chain,t,s)}}W("Aptos","TokenBridge",d);export{d as AptosTokenBridge};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["main.js","main.css","assets/index-cfzEp_CP.js","assets/index-Cf10mHc-.js"])))=>i.map(i=>d[i]);
2
- import{a2 as i,a3 as r,_ as e,a4 as t,a0 as _,a5 as d}from"../main.js";import{g as s}from"./signer-BaParnK7.js";const g={Address:i,Platform:r,getSigner:s,protocols:{WormholeCore:()=>e(()=>import("../main.js").then(a=>a.cN),__vite__mapDeps([0,1])),TokenBridge:()=>e(()=>import("./index-cfzEp_CP.js"),__vite__mapDeps([2,0,1])),CircleBridge:()=>e(()=>import("./index-Cf10mHc-.js"),__vite__mapDeps([3,0,1]))},getChain:(a,o,n)=>new t(o,new r(a,_(a,d,{[o]:n})))};export{g as default};
@@ -1,2 +0,0 @@
1
- "use strict";var f=Object.defineProperty;var p=(r,t,n)=>t in r?f(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n;var u=(r,t,n)=>p(r,typeof t!="symbol"?t+"":t,n);const s=require("./index-Bh_VUH6w.js"),l=require("./chunk-OR6GFWLG-DMRHoX5e.js");class g extends s.ChainContext{}const h=class h extends s.PlatformContext{constructor(t,n){super(t,n??s.networkPlatformConfigs(t,h._platform))}getRpc(t){if(t in this.config){const n=this.network==="Mainnet"?l.e.MAINNET:l.e.TESTNET,e=new l.s({fullnode:this.config[t].rpc,network:n});return new l.t(e)}throw new Error("No configuration available for chain: "+t)}getChain(t,n){if(t in this.config)return new g(t,this);throw new Error("No configuration available for chain: "+t)}static nativeTokenId(t,n){if(!this.isSupportedChain(n))throw new Error(`invalid chain: ${n}`);return s.Wormhole.tokenId(n,s.APTOS_COIN)}static isNativeTokenId(t,n,e){return!this.isSupportedChain(n)||e.chain!==n?!1:this.nativeTokenId(t,n)==e}static isSupportedChain(t){return s.chainToPlatform(t)===h._platform}static async getDecimals(t,n,e){if(s.isNative(e)||e===s.APTOS_COIN)return s.nativeDecimals(h._platform);const i=e.toString();return(await n.getAccountResource({accountAddress:i.split(s.APTOS_SEPARATOR)[0],resourceType:`0x1::coin::CoinInfo<${i}>`})).decimals}static async getBalance(t,n,e,i){const o=s.isNative(i)?s.APTOS_COIN:i.toString();try{const a=await n.getAccountCoinAmount({accountAddress:e,coinType:o});return BigInt(a)}catch(a){if(a.status===404)return null;throw a}}static async getBalances(t,n,e,i){return(await Promise.all(i.map(async a=>{const c=await this.getBalance(t,n,e,a);return{[s.isNative(a)?"native":new s.AptosAddress(a).toString()]:c}}))).reduce((a,c)=>Object.assign(a,c),{})}static async sendWait(t,n,e){const i=[];for(const o of e){const a=await n.transaction.submit.simple(o.transaction),c=await n.waitForTransaction({transactionHash:a.hash});i.push(c.hash)}return i}static async getLatestBlock(t){const n=await t.getLedgerInfo();return Number(n.block_height)}static async getLatestFinalizedBlock(t){const n=await t.getLedgerInfo();return Number(n.block_height)}static chainFromChainId(t){const n=s.platformNativeChainIdToNetworkChain(h._platform,BigInt(t));if(!n)throw new Error(`No matching chainId to determine network and chain: ${t}`);const[e,i]=n;return[e,i]}static async chainFromRpc(t){const n=await t.getLedgerInfo();return this.chainFromChainId(n.chain_id.toString())}};u(h,"_platform",s._platform$2);let d=h;async function m(r,t){const[n,e]=await d.chainFromRpc(r),i=l.o.fromPrivateKey({privateKey:new l.z(s.hex.decode(t))});return new w(e,i,r)}class w{constructor(t,n,e,i){u(this,"_chain");u(this,"_account");u(this,"_rpc");u(this,"_debug");this._chain=t,this._account=n,this._rpc=e,this._debug=i}chain(){return this._chain}address(){return this._account.accountAddress.toString()}async signAndSend(t){const n=[];for(const e of t){const{description:i,transaction:o}=e;this._debug&&console.log(`Signing: ${i} for ${this.address()}`);const a=await this._rpc.transaction.build.simple({sender:this._account.accountAddress,data:o}),{hash:c}=await this._simSignSend(a);n.push(c)}return n}async _simSignSend(t){return await this._rpc.transaction.simulate.simple({signerPublicKey:this._account.publicKey,transaction:t}).then(n=>n.forEach(e=>{if(!e.success)throw new Error(`Transaction failed: ${e.vm_status}
2
- ${JSON.stringify(e,null,2)}`)})),this._rpc.signAndSubmitTransaction({signer:this._account,transaction:t}).then(n=>this._rpc.waitForTransaction({transactionHash:n.hash}))}}const _={Address:s.AptosAddress,Platform:d,getSigner:m,protocols:{WormholeCore:()=>Promise.resolve().then(()=>require("./index-BD-n4Jda.js")),TokenBridge:()=>Promise.resolve().then(()=>require("./index-DVxKNFdQ.js"))},getChain:(r,t,n)=>new g(t,new d(r,s.applyChainsConfigConfigOverrides(r,s._platform$2,{[t]:n})))},A=Object.freeze(Object.defineProperty({__proto__:null,default:_},Symbol.toStringTag,{value:"Module"}));exports.AptosPlatform=d;exports.aptos=A;
@@ -1 +0,0 @@
1
- "use strict";var p=Object.defineProperty;var y=(o,e,t)=>e in o?p(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var i=(o,e,t)=>y(o,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-Bh_VUH6w.js"),g=require("./aptos-C698CxDU.js");class f{constructor(e,t,n,r,a=!1){i(this,"transaction");i(this,"network");i(this,"chain");i(this,"description");i(this,"parallelizable");this.transaction=e,this.network=t,this.chain=n,this.description=r,this.parallelizable=a}}const w=[{name:"tokenBridgeAddress",...s.universalAddressItem},{name:"chain",...s.chainItem()},{name:"domainSeparator",binary:"bytes",custom:s.bytes.encode(s.APTOS_SEPARATOR),omit:!0},{name:"tokenId",...s.universalAddressItem},{name:"domainSeparator",binary:"bytes",custom:new Uint8Array([255]),omit:!0}],T=o=>s.serialize$1(w,o);class d{constructor(e,t,n,r){i(this,"network");i(this,"chain");i(this,"connection");i(this,"contracts");i(this,"chainId");i(this,"tokenBridgeAddress");this.network=e,this.chain=t,this.connection=n,this.contracts=r,this.chainId=s.toChainId(t);const a=r.tokenBridge;if(!a)throw new Error(`TokenBridge contract Address for chain ${t} not found`);this.tokenBridgeAddress=a}static async fromRpc(e,t){const[n,r]=await g.AptosPlatform.chainFromRpc(e),a=t[r];if(a.network!==n)throw new Error("Network mismatch "+a.network+" !== "+n);return new d(n,r,e,a.contracts)}async isWrappedAsset(e){try{return await this.getOriginalAsset(e),!0}catch{return!1}}async getOriginalAsset(e){const t=e.toString().split(s.APTOS_SEPARATOR),n=await this.connection.getAccountResource({accountAddress:t[0],resourceType:`${this.tokenBridgeAddress}::state::OriginInfo`});if(!n)throw s.ErrNotWrapped(e.toString());const r=s.toChain(parseInt(n.token_chain.number)),a=new s.UniversalAddress(n.token_address.external_address);return{chain:r,address:a}}async getTokenUniversalAddress(e){return new s.UniversalAddress(s.hex.encode(s.sha3_256(e.toString()),!0))}async getTokenNativeAddress(e,t){const n=e===this.chain?await this.getTypeFromExternalAddress(t.toString()):await this.getAssetFullyQualifiedType({chain:e,address:t});if(!n)throw new Error("Invalid asset address.");return new s.AptosAddress(n)}async hasWrappedAsset(e){try{return await this.getWrappedAsset(e),!0}catch{}return!1}async getWrappedAsset(e){if(s.isNative(e.address))throw new Error("native asset cannot be a wrapped asset");const t=await this.getAssetFullyQualifiedType(e);if(!t)throw new Error("Invalid asset address.");return await this.connection.getAccountResource({accountAddress:s.coalesceModuleAddress(t),resourceType:`${this.tokenBridgeAddress}::state::OriginInfo`}),s.toNative(this.chain,t)}async isTransferCompleted(e){const n=(await this.connection.getAccountResource({accountAddress:this.tokenBridgeAddress,resourceType:`${this.tokenBridgeAddress}::state::State`})).consumed_vaas.elems.handle;try{return await this.connection.getTableItem({handle:n,data:{key_type:"vector<u8>",value_type:"u8",key:`0x${s.dist.Buffer.from(s.keccak_256(e.hash)).toString("hex")}`}}),!0}catch{return!1}}async getWrappedNative(){return s.toNative(this.chain,s.APTOS_COIN)}async*createAttestation(e,t){const n={chain:this.chain,address:new s.AptosAddress(e)},r=await this.getAssetFullyQualifiedType(n);if(!r)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::attest_token::attest_token_entry`,typeArguments:[r],functionArguments:[]},"Aptos.AttestToken")}async*submitAttestation(e,t){yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin_type`,typeArguments:[],functionArguments:[s.serialize(e)]},"Aptos.CreateWrappedCoinType");const n=await this.getAssetFullyQualifiedType(e.payload.token);if(!n)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin`,typeArguments:[n],functionArguments:[s.serialize(e)]},"Aptos.CreateWrappedCoin")}async*transfer(e,t,n,r,a){const l=0n,c=0n,h=s.isNative(n)?s.APTOS_COIN:n.toString(),u=t.address.toUniversalAddress().toUint8Array(),A=s.toChainId(t.chain);a?yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_with_payload_entry`,typeArguments:[h],functionArguments:[r,A,u,c,a]},"Aptos.TransferTokensWithPayload"):yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_entry`,typeArguments:[h],functionArguments:[r,A,u,l,c]},"Aptos.TransferTokens")}async*redeem(e,t,n=!0){const r=t.payload.token.chain===this.chain?await this.getTypeFromExternalAddress(t.payload.token.address.toString()):await this.getAssetFullyQualifiedType(t.payload.token);if(!r)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::complete_transfer::submit_vaa_and_register_entry`,typeArguments:[r],functionArguments:[s.serialize(t)]},"Aptos.CompleteTransfer")}async getAssetFullyQualifiedType(e){return e.chain===this.chain?s.isValidAptosType(e.address.toString())?e.address.toString():null:`${d.getForeignAssetAddress(this.chain,this.tokenBridgeAddress,e)}::coin::T`}async getTypeFromExternalAddress(e){try{const t=await this.connection.getAccountResource({accountAddress:this.tokenBridgeAddress,resourceType:`${this.tokenBridgeAddress}::state::State`}),{handle:n}=t.native_infos,r=await this.connection.getTableItem({handle:n,data:{key_type:`${this.tokenBridgeAddress}::token_hash::TokenHash`,value_type:"0x1::type_info::TypeInfo",key:{hash:e}}});return r?[r.account_address,String.fromCharCode(...s.hex.decode(r.module_name)),String.fromCharCode(...s.hex.decode(r.struct_name))].join(s.APTOS_SEPARATOR):null}catch{return null}}static getForeignAssetAddress(e,t,n){if(s.isNative(n.address))throw new Error("Invalid token address");const r=T({chain:n.chain,tokenBridgeAddress:new s.AptosAddress(t).toUniversalAddress(),tokenId:n.address.toUniversalAddress()});return s.hex.encode(s.sha3_256(r),!0)}createUnsignedTx(e,t,n=!1){return new f(e,this.network,this.chain,t,n)}}s.registerProtocol("Aptos","TokenBridge",d);exports.AptosTokenBridge=d;
@@ -1,16 +0,0 @@
1
- import { S as n, e as r, f as i, c as s, g as t } from "./index-BN7FfORx.mjs";
2
- import { g as l } from "./signer-DOhyF9G-.mjs";
3
- const d = {
4
- Address: n,
5
- Platform: r,
6
- getSigner: l,
7
- protocols: {
8
- WormholeCore: () => import("./index-BN7FfORx.mjs").then((o) => o.cZ),
9
- TokenBridge: () => import("./index-BGMRuYE4.mjs"),
10
- CircleBridge: () => import("./index-DGzYkbea.mjs")
11
- },
12
- getChain: (o, a, e) => new i(a, new r(o, s(o, t, { [a]: e })))
13
- };
14
- export {
15
- d as default
16
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-Bh_VUH6w.js"),i=require("./signer-BYquDVs4.js"),a={Address:e.SolanaAddress,Platform:e.SolanaPlatform,getSigner:i.getSolanaSignAndSendSigner,protocols:{WormholeCore:()=>Promise.resolve().then(()=>require("./index-Bh_VUH6w.js")).then(r=>r.index$2),TokenBridge:()=>Promise.resolve().then(()=>require("./index-Bb6FMstR.js")),CircleBridge:()=>Promise.resolve().then(()=>require("./index-Ds36ZJFd.js"))},getChain:(r,o,n)=>new e.SolanaChain(o,new e.SolanaPlatform(r,e.applyChainsConfigConfigOverrides(r,e._platform$1,{[o]:n})))};exports.default=a;