@wormhole-foundation/wormhole-connect 1.2.0-beta.0-development → 1.3.0-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 (127) hide show
  1. package/dist/assets/aptos-DZ2rfUfg.js +3 -0
  2. package/dist/assets/{aptos-fvUGRJ4h.js → aptos-g3DaQf0b.js} +61 -61
  3. package/dist/assets/{ccip-DLVsVRZh.js → ccip-CTWg50DB.js} +1 -1
  4. package/dist/assets/{chunk-U2PRGW4O-BklU2g_V.js → chunk-U2PRGW4O-_uqZ791P.js} +1 -1
  5. package/dist/assets/evm-CUAh52pb.js +2 -0
  6. package/dist/assets/{evm-D7r3Ne49.js → evm-Dpe6bb4m.js} +4 -4
  7. package/dist/assets/index-B169l5cS.js +1 -0
  8. package/dist/assets/{index-BINzPDaS.js → index-B2zKde8M.js} +1 -1
  9. package/dist/assets/{index-BmcqXpQd.js → index-B85n1wgg.js} +1 -1
  10. package/dist/assets/{index-BOsp0gGs.js → index-BGPIDyz6.js} +1 -1
  11. package/dist/assets/index-BT5QH3hv.js +1 -0
  12. package/dist/assets/{index-5UpuI6jk.js → index-BbXYZkyr.js} +1 -1
  13. package/dist/assets/{index-C_VIzW7c.js → index-Bwgv1Ind.js} +1 -1
  14. package/dist/assets/{index-P4tasYP-.js → index-CFWDbus8.js} +1 -1
  15. package/dist/assets/{index-BKYhAEpg.js → index-CJV78alS.js} +1 -1
  16. package/dist/assets/{index-DAS-UCcB.js → index-Ck17eoCG.js} +1 -1
  17. package/dist/assets/{index-C0ho2skw.js → index-CpdwiPRU.js} +2 -2
  18. package/dist/assets/{index-C02sy3fv.js → index-DVtwRIfn.js} +1 -1
  19. package/dist/assets/{index-D3TIHxII.js → index-jE0RsYBN.js} +1 -1
  20. package/dist/assets/{index.es-wOiA40sy.js → index.es-CEXOl433.js} +2 -2
  21. package/dist/assets/{signer-BzqNQC8X.js → signer-D8BxqoWW.js} +1 -1
  22. package/dist/assets/{solana--aMZfCgL.js → solana-Cu2aa7vE.js} +1 -1
  23. package/dist/assets/solana-Ddk7It-E.js +2 -0
  24. package/dist/assets/{sui-C76oYlao.js → sui-BXAKH3nv.js} +3 -3
  25. package/dist/assets/unsignedTransaction-DsxtoHjl.js +1 -0
  26. package/dist/main.js +28 -28
  27. package/dist/src/config/mainnet/tokens.d.ts.map +1 -1
  28. package/dist/src/config/testnet/tokens.d.ts.map +1 -1
  29. package/dist/src/hooks/useWalletCompatibility.d.ts +14 -0
  30. package/dist/src/hooks/useWalletCompatibility.d.ts.map +1 -0
  31. package/dist/src/utils/index.d.ts +1 -1
  32. package/dist/src/utils/index.d.ts.map +1 -1
  33. package/dist/src/utils/wallet/aptos.d.ts.map +1 -1
  34. package/dist/src/views/v2/Bridge/index.d.ts.map +1 -1
  35. package/lib/{aptos-BZuWMk3D.mjs → aptos-BADK10fB.mjs} +871 -870
  36. package/lib/{aptos-2J8A-FZO.mjs → aptos-CNLtQdwF.mjs} +59 -57
  37. package/lib/{aptos-DL1Hgg15.js → aptos-DeODB5kZ.js} +4 -4
  38. package/lib/aptos-DhXgHrnl.js +2 -0
  39. package/lib/{base64-Bit1A1if.js → base64-CEPDNsRw.js} +1 -1
  40. package/lib/{base64-BdSgqiJl.mjs → base64-w49IrkvT.mjs} +1 -1
  41. package/lib/{ccip-CMkUITDS.js → ccip-PRIyWWAN.js} +1 -1
  42. package/lib/{ccip-Cw8-T0j-.mjs → ccip-VK5volw3.mjs} +1 -1
  43. package/lib/{chunk-U2PRGW4O-CMIP41vB.mjs → chunk-U2PRGW4O-Ch5UM-YX.mjs} +6 -3
  44. package/lib/{chunk-U2PRGW4O-CuEEOygo.js → chunk-U2PRGW4O-D9odrfIU.js} +5 -5
  45. package/lib/{events-Bs7CEKn9.js → events-Bu0pqh5u.js} +1 -1
  46. package/lib/{events-CpDIhB3C.mjs → events-jOp8E97m.mjs} +1 -1
  47. package/lib/{evm-CK7UNFtq.js → evm-3jPN9QHX.js} +1 -1
  48. package/lib/{evm-DfX7cWQI.mjs → evm-B13HZSOG.mjs} +6 -6
  49. package/lib/{evm-1S_EvV1A.mjs → evm-CZgBqG6_.mjs} +7 -7
  50. package/lib/{evm-D5NO24dh.js → evm-Y4sMK_A1.js} +4 -4
  51. package/lib/index-1qQOAFE2.mjs +102 -0
  52. package/lib/{index-C6iaLaJq.mjs → index-BAhBSTHO.mjs} +18418 -18338
  53. package/lib/{index-wW7H3ciQ.mjs → index-BDForJp0.mjs} +2 -2
  54. package/lib/{index-CqSLXgKG.js → index-BFbkaHZM.js} +1 -1
  55. package/lib/{index-CqfWDHV0.mjs → index-BHdCskLu.mjs} +2 -2
  56. package/lib/{index-DKZeU-Xf.js → index-BRf1dmcD.js} +1 -1
  57. package/lib/{index-BPtbGGHy.mjs → index-BVuV_rfV.mjs} +3 -3
  58. package/lib/{index-CXWWVJUC.js → index-BX2v7vz2.js} +1 -1
  59. package/lib/{index-Q-iWWETw.mjs → index-BZknHaxy.mjs} +70 -70
  60. package/lib/{index-CwNerYWM.js → index-Brzu_xNS.js} +1 -1
  61. package/lib/{index-D_BTWvYp.mjs → index-BuWkXqNE.mjs} +2 -2
  62. package/lib/{index-BXPqhxjc.js → index-C2Rk8dJm.js} +1 -1
  63. package/lib/{index-C8__BuqK.mjs → index-CKnJa2J4.mjs} +1 -1
  64. package/lib/{index-DhxGcoTC.mjs → index-CdUjuPf9.mjs} +5 -5
  65. package/lib/{index-D5xkWCZ3.mjs → index-CkQ2SX_N.mjs} +48 -57
  66. package/lib/{index-o0AEhklr.mjs → index-CpOpT2eM.mjs} +2 -2
  67. package/lib/{index-hk3iRhUd.mjs → index-CtVdS94F.mjs} +4 -4
  68. package/lib/{index-8nlb2LGX.js → index-CzRLTmkg.js} +1 -1
  69. package/lib/{index-DbiW1-3L.mjs → index-D4DQMA-o.mjs} +1 -1
  70. package/lib/{index-hIJ0h_GZ.js → index-D5ta6SAe.js} +91 -91
  71. package/lib/{index-v3UQ6KEC.js → index-D9KxVP2I.js} +1 -1
  72. package/lib/index-DBmgmviv.js +1 -0
  73. package/lib/{index-S1YybQMR.js → index-DFS9XfYE.js} +1 -1
  74. package/lib/{index-7_XTrYay.js → index-DL5itoYd.js} +1 -1
  75. package/lib/index-DOqilxLu.js +1 -0
  76. package/lib/{index-C42d1PS9.js → index-DT5QhFiG.js} +1 -1
  77. package/lib/{index-CbJWXG7l.mjs → index-DcL6du1P.mjs} +2 -2
  78. package/lib/{index-7Jgokx3S.js → index-DfRhe8kL.js} +1 -1
  79. package/lib/{index-B96enquk.js → index-DjDJigyM.js} +1 -1
  80. package/lib/{index-BNn38QYa.mjs → index-DkNDirHr.mjs} +2 -2
  81. package/lib/{index-BfBNSTY8.js → index-Dr6Wkn1g.js} +1 -1
  82. package/lib/{index-D2Bw_LRJ.js → index-Dw4_1FXq.js} +1 -1
  83. package/lib/{index-Cqiy61ub.mjs → index-DzeE34W2.mjs} +1 -1
  84. package/lib/{index-TVlE0v9D.js → index-EVkJCI6W.js} +1 -1
  85. package/lib/{index-vWXFBAHR.js → index-OdUgDqqR.js} +1 -1
  86. package/lib/{index-B-ZKCWaX.js → index-dYeh9TN5.js} +1 -1
  87. package/lib/{index-BDbrAqgW.mjs → index-hnhyQbEN.mjs} +5 -5
  88. package/lib/{index-Bm1zXhFz.mjs → index-ieIOqnbv.mjs} +1 -1
  89. package/lib/{index-B-UHVwW1.mjs → index-v8vynoP2.mjs} +2 -2
  90. package/lib/{index-BzHjroj_.mjs → index-yIiSwVLU.mjs} +2 -2
  91. package/lib/{index.es-DN28d137.js → index.es-D9Co2OZW.js} +2 -2
  92. package/lib/{index.es-BnuWmVuS.mjs → index.es-jvUS3_-Z.mjs} +5 -5
  93. package/lib/index.js +1 -1
  94. package/lib/index.mjs +1 -1
  95. package/lib/{signer-YETmMcF8.js → signer-BvZ7J3Rl.js} +1 -1
  96. package/lib/{signer-D5i4Nnyi.mjs → signer-CsfCFMWy.mjs} +1 -1
  97. package/lib/solana-BD_xWaS3.js +1 -0
  98. package/lib/{solana-C7qBFXj3.js → solana-BfiZpxkP.js} +1 -1
  99. package/lib/solana-ChpC_WNg.mjs +16 -0
  100. package/lib/{solana-DtBRFbad.mjs → solana-Dh_0HpA8.mjs} +4 -4
  101. package/lib/{solanaEmbed.esm-BER_HE9G.js → solanaEmbed.esm-B3b-A7RS.js} +1 -1
  102. package/lib/{solanaEmbed.esm-Bb5iLp3o.mjs → solanaEmbed.esm-BCE4UL9u.mjs} +2 -2
  103. package/lib/src/config/mainnet/tokens.d.ts.map +1 -1
  104. package/lib/src/config/testnet/tokens.d.ts.map +1 -1
  105. package/lib/src/hooks/useWalletCompatibility.d.ts +14 -0
  106. package/lib/src/hooks/useWalletCompatibility.d.ts.map +1 -0
  107. package/lib/src/utils/index.d.ts +1 -1
  108. package/lib/src/utils/index.d.ts.map +1 -1
  109. package/lib/src/utils/wallet/aptos.d.ts.map +1 -1
  110. package/lib/src/views/v2/Bridge/index.d.ts.map +1 -1
  111. package/lib/{sui-De3Fl_fo.js → sui-BhOuuPtT.js} +1 -1
  112. package/lib/{sui-1QFb30Ta.mjs → sui-Cc0SlN9d.mjs} +1 -1
  113. package/lib/{sui-DAyysPh2.mjs → sui-DmasAl1E.mjs} +5 -5
  114. package/lib/{sui-c1d9xieM.js → sui-RIp5yjOC.js} +2 -2
  115. package/lib/unsignedTransaction-BDOQhqcZ.mjs +16 -0
  116. package/lib/unsignedTransaction-C1YeEl4G.js +1 -0
  117. package/lib/{utf8-BxTDE5Vo.mjs → utf8-V9eCtEDc.mjs} +1 -1
  118. package/lib/{utf8-B-nUZvyF.js → utf8-lSE3VJ2A.js} +1 -1
  119. package/package.json +17 -17
  120. package/dist/assets/aptos-De-iCK2S.js +0 -3
  121. package/dist/assets/evm-BBq1KqPa.js +0 -2
  122. package/dist/assets/index-LPMvkG3A.js +0 -1
  123. package/dist/assets/solana-DTptRMWs.js +0 -2
  124. package/lib/aptos-DcCwQMe7.js +0 -2
  125. package/lib/index-Bq2G38s-.js +0 -1
  126. package/lib/solana-B9GQ_Umb.js +0 -1
  127. package/lib/solana-tevnHUxv.mjs +0 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wormhole-foundation/wormhole-connect",
3
- "version": "1.2.0-beta.0-development",
3
+ "version": "1.3.0-beta.0-development",
4
4
  "repository": "github:wormhole-foundation/wormhole-connect",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.mjs",
@@ -36,8 +36,8 @@
36
36
  "@solana/spl-token": "^0.3.9",
37
37
  "@solana/wallet-adapter-wallets": "^0.19.25",
38
38
  "@solana/web3.js": "^1.95.8",
39
- "@wormhole-foundation/sdk": "1.4.0",
40
- "@wormhole-foundation/sdk-definitions": "1.4.0",
39
+ "@wormhole-foundation/sdk": "1.5.0-beta.0",
40
+ "@wormhole-foundation/sdk-definitions": "1.5.0-beta.0",
41
41
  "@wormhole-foundation/sdk-definitions-ntt": "^0.6.1",
42
42
  "@wormhole-foundation/sdk-evm-ntt": "^0.6.1",
43
43
  "@wormhole-foundation/sdk-icons": "^1.0.0",
@@ -163,28 +163,28 @@
163
163
  "axios": "1.4.0"
164
164
  },
165
165
  "@mayanfinance/wormhole-sdk-route": {
166
- "@wormhole-foundation/sdk-connect": "1.4.0",
167
- "@wormhole-foundation/sdk-evm": "1.4.0",
168
- "@wormhole-foundation/sdk-solana": "1.4.0"
166
+ "@wormhole-foundation/sdk-connect": "1.5.0-beta.0",
167
+ "@wormhole-foundation/sdk-evm": "1.5.0-beta.0",
168
+ "@wormhole-foundation/sdk-solana": "1.5.0-beta.0"
169
169
  },
170
170
  "@wormhole-foundation/sdk-definitions-ntt": {
171
- "@wormhole-foundation/sdk-base": "1.4.0",
172
- "@wormhole-foundation/sdk-definitions": "1.4.0"
171
+ "@wormhole-foundation/sdk-base": "1.5.0-beta.0",
172
+ "@wormhole-foundation/sdk-definitions": "1.5.0-beta.0"
173
173
  },
174
174
  "@wormhole-foundation/sdk-evm-ntt": {
175
- "@wormhole-foundation/sdk-base": "1.4.0",
176
- "@wormhole-foundation/sdk-definitions": "1.4.0",
177
- "@wormhole-foundation/sdk-evm": "1.4.0",
178
- "@wormhole-foundation/sdk-evm-core": "1.4.0"
175
+ "@wormhole-foundation/sdk-base": "1.5.0-beta.0",
176
+ "@wormhole-foundation/sdk-definitions": "1.5.0-beta.0",
177
+ "@wormhole-foundation/sdk-evm": "1.5.0-beta.0",
178
+ "@wormhole-foundation/sdk-evm-core": "1.5.0-beta.0"
179
179
  },
180
180
  "@wormhole-foundation/sdk-route-ntt": {
181
- "@wormhole-foundation/sdk-connect": "1.4.0"
181
+ "@wormhole-foundation/sdk-connect": "1.5.0-beta.0"
182
182
  },
183
183
  "@wormhole-foundation/sdk-solana-ntt": {
184
- "@wormhole-foundation/sdk-base": "1.4.0",
185
- "@wormhole-foundation/sdk-definitions": "1.4.0",
186
- "@wormhole-foundation/sdk-solana": "1.4.0",
187
- "@wormhole-foundation/sdk-solana-core": "1.4.0"
184
+ "@wormhole-foundation/sdk-base": "1.5.0-beta.0",
185
+ "@wormhole-foundation/sdk-definitions": "1.5.0-beta.0",
186
+ "@wormhole-foundation/sdk-solana": "1.5.0-beta.0",
187
+ "@wormhole-foundation/sdk-solana-core": "1.5.0-beta.0"
188
188
  },
189
189
  "@wormhole-foundation/wormhole-connect": {
190
190
  "aptos": "1.5.0"
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BINzPDaS.js","main.js","main.css","assets/chunk-U2PRGW4O-BklU2g_V.js","assets/base64-IWuz5NCL.js","assets/index-iG_7aUsO.js","assets/index-LPMvkG3A.js"])))=>i.map(i=>d[i]);
2
- var w=Object.defineProperty;var A=(e,t,a)=>t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var h=(e,t,a)=>A(e,typeof t!="symbol"?t+"":t,a);import{ab as S,ac as b,ad as p,ae as y,af as C,ag as d,ah as T,ai as l,aj as v,ak as I,al as m,am as E,aa as N,_ as g,a0 as P}from"../main.js";import{e as f,o as k,x,M as O,z as B}from"./chunk-U2PRGW4O-BklU2g_V.js";class _ extends S{}const c=class c extends b{constructor(t,a){super(t,a??y(t,c._platform))}getRpc(t){if(t in this.config){const a=this.network==="Mainnet"?f.MAINNET:f.TESTNET,n=new k({fullnode:this.config[t].rpc,network:a});return new x(n)}throw new Error("No configuration available for chain: "+t)}getChain(t,a){if(t in this.config)return new _(t,this);throw new Error("No configuration available for chain: "+t)}static nativeTokenId(t,a){if(!this.isSupportedChain(a))throw new Error(`invalid chain: ${a}`);return C.tokenId(a,d)}static isNativeTokenId(t,a,n){return!this.isSupportedChain(a)||n.chain!==a?!1:this.nativeTokenId(t,a)==n}static isSupportedChain(t){return T(t)===c._platform}static async getDecimals(t,a,n){if(l(n)||n===d)return v(c._platform);const s=n.toString();return(await a.getAccountResource({accountAddress:s.split(I)[0],resourceType:`0x1::coin::CoinInfo<${s}>`})).decimals}static async getBalance(t,a,n,s){const r=l(s)?d:s.toString();try{const i=await a.getAccountCoinAmount({accountAddress:n,coinType:r});return BigInt(i)}catch(i){if(i.status===404)return null;throw i}}static async getBalances(t,a,n,s){return(await Promise.all(s.map(async i=>{const o=await this.getBalance(t,a,n,i);return{[l(i)?"native":new m(i).toString()]:o}}))).reduce((i,o)=>Object.assign(i,o),{})}static async sendWait(t,a,n){const s=[];for(const r of n){const i=await a.transaction.submit.simple(r.transaction),o=await a.waitForTransaction({transactionHash:i.hash});s.push(o.hash)}return s}static async getLatestBlock(t){const a=await t.getLedgerInfo();return Number(a.block_height)}static async getLatestFinalizedBlock(t){const a=await t.getLedgerInfo();return Number(a.block_height)}static chainFromChainId(t){const a=E(c._platform,BigInt(t));if(!a)throw new Error(`No matching chainId to determine network and chain: ${t}`);const[n,s]=a;return[n,s]}static async chainFromRpc(t){const a=await t.getLedgerInfo();return this.chainFromChainId(a.chain_id.toString())}};h(c,"_platform",p);let u=c;async function R(e,t){const[a,n]=await u.chainFromRpc(e),s=O.fromPrivateKey({privateKey:new B(N.decode(t))});return new $(n,s,e)}class ${constructor(t,a,n,s){h(this,"_chain");h(this,"_account");h(this,"_rpc");h(this,"_debug");this._chain=t,this._account=a,this._rpc=n,this._debug=s}chain(){return this._chain}address(){return this._account.accountAddress.toString()}async signAndSend(t){const a=[];for(const n of t){const{description:s,transaction:r}=n;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);a.push(o)}return a}async _simSignSend(t){return await this._rpc.transaction.simulate.simple({signerPublicKey:this._account.publicKey,transaction:t}).then(a=>a.forEach(n=>{if(!n.success)throw new Error(`Transaction failed: ${n.vm_status}
3
- ${JSON.stringify(n,null,2)}`)})),this._rpc.signAndSubmitTransaction({signer:this._account,transaction:t}).then(a=>this._rpc.waitForTransaction({transactionHash:a.hash}))}}const F={Address:m,Platform:u,getSigner:R,protocols:{WormholeCore:()=>g(()=>import("./index-BINzPDaS.js"),__vite__mapDeps([0,1,2,3,4,5])),TokenBridge:()=>g(()=>import("./index-LPMvkG3A.js"),__vite__mapDeps([6,1,2,3,4,5]))},getChain:(e,t,a)=>new _(t,new u(e,P(e,p,{[t]:a})))},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-P4tasYP-.js","assets/index-C_VIzW7c.js","assets/index-BKYhAEpg.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 l=(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)),f=(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,i)=>(D(s,t,"write to private field"),i?i.call(s,e):t.set(s,e),e);var S=(s,t,e,i)=>({set _(r){o(s,t,r,e)},get _(){return h(s,t,i)}});import{S as V,d as B,U as $,X as _,Y as M,Z as W,_ as m,$ 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);l(this,"signer");f(this,a);f(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 i=h(this,c);return await h(this,a)+i}return super.getNonce(e)}increment(){S(this,c)._++}reset(){o(this,c,0),o(this,a,null)}async sendTransaction(e){const i=this.getNonce("pending");return this.increment(),e=await this.signer.populateTransaction(e),e.nonce=await i,await this.signer.sendTransaction(e)}signTransaction(e){return this.signer.signTransaction(e)}signMessage(e){return this.signer.signMessage(e)}signTypedData(e,i,r){return this.signer.signTypedData(e,i,r)}};a=new WeakMap,c=new WeakMap;let P=v;async function Y(s,t,e){const i=typeof t=="string"?new $(t,s):t,r=(e==null?void 0:e.chain)??(await _.chainFromRpc(s))[1],n=new P(i);if(n.provider===null)try{n.connect(s)}catch(g){console.error("Cannot connect to network for signer",g)}return new Z(r,await i.getAddress(),n,e)}class Z extends M{constructor(e,i,r,n){super(e,i,r);l(this,"opts");this.opts=n}chain(){return this._chain}address(){return this._address}async sign(e){var w,E,T,y,A,L,C;const i=this.chain(),r=[];let n=500000n,g=100000000000n,p=1500000000n,u=100000000n;if(((w=this.opts)==null?void 0:w.overrides)===void 0&&i!=="Celo"){const d=await this._signer.provider.getFeeData();g=d.gasPrice??g,p=d.maxFeePerGas??p,u=d.maxPriorityFeePerGas??u}((E=this.opts)==null?void 0:E.gasLimit)!==void 0&&(n=this.opts.gasLimit),((T=this.opts)==null?void 0:T.maxGasLimit)!==void 0&&(n=n>((y=this.opts)==null?void 0:y.maxGasLimit)?(A=this.opts)==null?void 0:A.maxGasLimit:n);const G=i==="Oasis"?{gasLimit:n,gasPrice:g,type:0}:{gasLimit:n,maxFeePerGas:p,maxPriorityFeePerGas:u};for(const d of e){const{transaction:O,description:F}=d;(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:()=>m(()=>import("../main.js").then(s=>s.cM),__vite__mapDeps([0,1])),TokenBridge:()=>m(()=>import("./index-P4tasYP-.js"),__vite__mapDeps([2,0,1])),PorticoBridge:()=>m(()=>import("./index-C_VIzW7c.js"),__vite__mapDeps([3,0,1,2])),CircleBridge:()=>m(()=>import("./index-BKYhAEpg.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,ak as p,cD as I,bw as w,bZ as E,bD as F,b_ as m,aa as o,O as k,al as c,ai as h,cE as U,c3 as T,i as $,c0 as C,ag as _,bE as u,cF as O,bJ as W}from"../main.js";import{A as N}from"./aptos-De-iCK2S.js";import"./chunk-U2PRGW4O-BklU2g_V.js";import"./base64-IWuz5NCL.js";import"./index-iG_7aUsO.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-DAS-UCcB.js","assets/index-C02sy3fv.js"])))=>i.map(i=>d[i]);
2
- import{a2 as t,a3 as e,_ as o,a4 as _,a0 as n,a5 as s}from"../main.js";import{g as d}from"./signer-BzqNQC8X.js";const m={Address:t,Platform:e,getSigner:d,protocols:{WormholeCore:()=>o(()=>import("../main.js").then(a=>a.cN),__vite__mapDeps([0,1])),TokenBridge:()=>o(()=>import("./index-DAS-UCcB.js"),__vite__mapDeps([2,0,1])),CircleBridge:()=>o(()=>import("./index-C02sy3fv.js"),__vite__mapDeps([3,0,1]))},getChain:(a,r,i)=>new _(r,new e(a,n(a,s,{[r]:i})))};export{m 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 i=require("./index-hIJ0h_GZ.js"),l=require("./chunk-U2PRGW4O-CuEEOygo.js");class g extends i.ChainContext{}const h=class h extends i.PlatformContext{constructor(t,n){super(t,n??i.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.l({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 i.Wormhole.tokenId(n,i.APTOS_COIN)}static isNativeTokenId(t,n,e){return!this.isSupportedChain(n)||e.chain!==n?!1:this.nativeTokenId(t,n)==e}static isSupportedChain(t){return i.chainToPlatform(t)===h._platform}static async getDecimals(t,n,e){if(i.isNative(e)||e===i.APTOS_COIN)return i.nativeDecimals(h._platform);const s=e.toString();return(await n.getAccountResource({accountAddress:s.split(i.APTOS_SEPARATOR)[0],resourceType:`0x1::coin::CoinInfo<${s}>`})).decimals}static async getBalance(t,n,e,s){const o=i.isNative(s)?i.APTOS_COIN:s.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,s){return(await Promise.all(s.map(async a=>{const c=await this.getBalance(t,n,e,a);return{[i.isNative(a)?"native":new i.AptosAddress(a).toString()]:c}}))).reduce((a,c)=>Object.assign(a,c),{})}static async sendWait(t,n,e){const s=[];for(const o of e){const a=await n.transaction.submit.simple(o.transaction),c=await n.waitForTransaction({transactionHash:a.hash});s.push(c.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=i.platformNativeChainIdToNetworkChain(h._platform,BigInt(t));if(!n)throw new Error(`No matching chainId to determine network and chain: ${t}`);const[e,s]=n;return[e,s]}static async chainFromRpc(t){const n=await t.getLedgerInfo();return this.chainFromChainId(n.chain_id.toString())}};u(h,"_platform",i._platform$2);let d=h;async function m(r,t){const[n,e]=await d.chainFromRpc(r),s=l.o.fromPrivateKey({privateKey:new l.z(i.hex.decode(t))});return new w(e,s,r)}class w{constructor(t,n,e,s){u(this,"_chain");u(this,"_account");u(this,"_rpc");u(this,"_debug");this._chain=t,this._account=n,this._rpc=e,this._debug=s}chain(){return this._chain}address(){return this._account.accountAddress.toString()}async signAndSend(t){const n=[];for(const e of t){const{description:s,transaction:o}=e;this._debug&&console.log(`Signing: ${s} 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:i.AptosAddress,Platform:d,getSigner:m,protocols:{WormholeCore:()=>Promise.resolve().then(()=>require("./index-v3UQ6KEC.js")),TokenBridge:()=>Promise.resolve().then(()=>require("./index-Bq2G38s-.js"))},getChain:(r,t,n)=>new g(t,new d(r,i.applyChainsConfigConfigOverrides(r,i._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-hIJ0h_GZ.js"),g=require("./aptos-DcCwQMe7.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 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-hIJ0h_GZ.js"),i=require("./signer-YETmMcF8.js"),a={Address:e.SolanaAddress,Platform:e.SolanaPlatform,getSigner:i.getSolanaSignAndSendSigner,protocols:{WormholeCore:()=>Promise.resolve().then(()=>require("./index-hIJ0h_GZ.js")).then(r=>r.index$2),TokenBridge:()=>Promise.resolve().then(()=>require("./index-TVlE0v9D.js")),CircleBridge:()=>Promise.resolve().then(()=>require("./index-8nlb2LGX.js"))},getChain:(r,o,n)=>new e.SolanaChain(o,new e.SolanaPlatform(r,e.applyChainsConfigConfigOverrides(r,e._platform$1,{[o]:n})))};exports.default=a;
@@ -1,16 +0,0 @@
1
- import { S as n, e as r, f as i, c as s, g as t } from "./index-C6iaLaJq.mjs";
2
- import { g as l } from "./signer-D5i4Nnyi.mjs";
3
- const d = {
4
- Address: n,
5
- Platform: r,
6
- getSigner: l,
7
- protocols: {
8
- WormholeCore: () => import("./index-C6iaLaJq.mjs").then((o) => o.cZ),
9
- TokenBridge: () => import("./index-DbiW1-3L.mjs"),
10
- CircleBridge: () => import("./index-Cqiy61ub.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
- };