@wormhole-foundation/wormhole-connect 2.4.0-beta.2-development → 2.4.0-beta.4-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 (82) hide show
  1. package/dist/main.js +107 -107
  2. package/dist/src/views/v2/Redeem/index.d.ts.map +1 -1
  3. package/lib/{aptos-BPPKNPmY.mjs → aptos-CkWuq_27.mjs} +2 -2
  4. package/lib/{aptos-DnLzj1Pw.js → aptos-DU1D2bsY.js} +1 -1
  5. package/lib/{aptos-BFg97d8i.js → aptos-TTV2w234.js} +2 -2
  6. package/lib/{aptos-UMYBfX-e.mjs → aptos-qwmh1AJp.mjs} +5 -5
  7. package/lib/{base64-dhNbNdy2.js → base64-CkebPGW0.js} +1 -1
  8. package/lib/{base64-BxOseFtQ.mjs → base64-r6lIUfD-.mjs} +1 -1
  9. package/lib/{ccip-Cc7zIRbR.mjs → ccip-D869mIiq.mjs} +1 -1
  10. package/lib/{ccip-DnuA-mnD.js → ccip-DdUs_h_I.js} +1 -1
  11. package/lib/{chunk-IMTC3J2M-C3XVaTOx.mjs → chunk-IMTC3J2M-CSrenBj8.mjs} +3 -3
  12. package/lib/{chunk-IMTC3J2M-DmAiw2IO.js → chunk-IMTC3J2M-rihZh7hM.js} +1 -1
  13. package/lib/{evm-BPMdXFY7.mjs → evm-BCvj1OtP.mjs} +6 -6
  14. package/lib/{evm-jazxlq_v.js → evm-Bj5TkyBv.js} +3 -3
  15. package/lib/{evm-2u0XA9Kv.mjs → evm-BtEIk2Ro.mjs} +5 -5
  16. package/lib/{evm-DBg_gIux.js → evm-Df4WZQgF.js} +1 -1
  17. package/lib/{index-BudY-hBZ.js → index-20yIH7p6.js} +1 -1
  18. package/lib/{index-DxHy5H3l.mjs → index-B3Lgw0sO.mjs} +1 -1
  19. package/lib/{index-BH5x8knT.mjs → index-BL_uPuTy.mjs} +1 -1
  20. package/lib/{index-CvO9BKU8.js → index-BOtebTDA.js} +1 -1
  21. package/lib/{index-D6PJJHPq.mjs → index-BXHY_Wc_.mjs} +2 -2
  22. package/lib/{index-CSWNAyvZ.mjs → index-BfQHVxEi.mjs} +2 -2
  23. package/lib/{index-DqPgH3Y4.js → index-BnQbapb-.js} +1 -1
  24. package/lib/{index-_Tjd635F.js → index-BnvAiffX.js} +1 -1
  25. package/lib/{index-B71D5i2u.js → index-C-9QGhXS.js} +1 -1
  26. package/lib/{index-gsKAo8iZ.js → index-C0UDZaND.js} +1 -1
  27. package/lib/{index-INXKBIVC.mjs → index-C2w2yYzm.mjs} +3 -3
  28. package/lib/{index-cibSzunr.mjs → index-C54QUs8N.mjs} +2 -2
  29. package/lib/{index-BZO8YmLX.js → index-C6Oecme5.js} +1 -1
  30. package/lib/{index-CLSG0-PT.mjs → index-CBM9cmhA.mjs} +2 -2
  31. package/lib/{index-DbgMQX1m.mjs → index-CCJUXjWs.mjs} +1 -1
  32. package/lib/{index-Dw6DmujE.mjs → index-CIWjtrm4.mjs} +1 -1
  33. package/lib/{index-CwnW1iXz.js → index-CZi3G6c5.js} +1 -1
  34. package/lib/{index-DYo59dOt.mjs → index-Cf6wneHs.mjs} +2 -2
  35. package/lib/{index-DSVsrZrI.js → index-ChLwWlxD.js} +1 -1
  36. package/lib/{index-3LktUEbt.js → index-Cn5RoB2l.js} +1 -1
  37. package/lib/{index-DS1ZxkfX.js → index-CskmLcFl.js} +1 -1
  38. package/lib/{index-DpL4G1gV.js → index-Cv_SfKSZ.js} +1 -1
  39. package/lib/{index-B9gGuUKR.js → index-CxOOdI6c.js} +1 -1
  40. package/lib/{index-C7SwBJ74.mjs → index-CxnykIim.mjs} +1 -1
  41. package/lib/{index-B6Sz2PUf.mjs → index-D5jQOGNt.mjs} +2 -2
  42. package/lib/{index-geFlOFCr.js → index-D8mnxtTR.js} +1 -1
  43. package/lib/{index-C_8uENxB.js → index-DG9DA23c.js} +1 -1
  44. package/lib/{index-DCXyETk0.mjs → index-DIdfi9U5.mjs} +1 -1
  45. package/lib/{index-BEqeue2k.js → index-DNGByy1S.js} +1 -1
  46. package/lib/{index-DrYmbAqE.mjs → index-DOLtniOC.mjs} +2 -2
  47. package/lib/{index-BbuYs0Vv.mjs → index-DS1lD1iG.mjs} +2 -2
  48. package/lib/{index-C0mg2EaP.js → index-DU1he9Nx.js} +120 -120
  49. package/lib/{index-DBF3Orza.mjs → index-Dfo3bBnl.mjs} +2 -2
  50. package/lib/{index-CrDmkPiL.mjs → index-Dgohn547.mjs} +3 -3
  51. package/lib/{index-CVVdam36.mjs → index-DjHz-TGq.mjs} +1 -1
  52. package/lib/{index-Ce7gKFw8.js → index-DnIR5ghZ.js} +1 -1
  53. package/lib/{index-CLqF0DXs.mjs → index-DqfeHeDN.mjs} +1 -1
  54. package/lib/{index-BZijFWem.js → index-JY_vmjxX.js} +1 -1
  55. package/lib/{index-BH-QrHNF.mjs → index-LaHWWgzV.mjs} +1 -1
  56. package/lib/{index-ndWybTXw.mjs → index-ObRYlj1l.mjs} +10178 -9472
  57. package/lib/{index-C2ecpt8K.mjs → index-ZuBMF5ZM.mjs} +4 -4
  58. package/lib/{index-BhZP5awL.js → index-l0_fPapQ.js} +1 -1
  59. package/lib/{index-Cleh-XCA.mjs → index-tsZGjIYB.mjs} +1 -1
  60. package/lib/{index-CyPQH2yv.js → index-v9fEg88t.js} +1 -1
  61. package/lib/{index-CiFOveV0.js → index-vPc_VIRu.js} +1 -1
  62. package/lib/{index-C7jR2tws.js → index-yU0Hsqz_.js} +1 -1
  63. package/lib/{index.es-D-KoMtU-.js → index.es-Bqw6r4nv.js} +2 -2
  64. package/lib/{index.es-DaqXRV0H.mjs → index.es-DFa1opYl.mjs} +5 -5
  65. package/lib/index.js +1 -1
  66. package/lib/index.mjs +1 -1
  67. package/lib/{signer-Cr8jlyL3.js → signer-DEoUkKh3.js} +1 -1
  68. package/lib/{signer-CGCrqc_x.mjs → signer-_KpSCeJr.mjs} +1 -1
  69. package/lib/{solana-YmPJnJBl.mjs → solana-CeI-x62u.mjs} +4 -4
  70. package/lib/solana-CzIZTTUh.js +1 -0
  71. package/lib/{solana-BkE0Vobm.js → solana-Dbf-kAb8.js} +1 -1
  72. package/lib/solana-UZrOCesE.mjs +17 -0
  73. package/lib/{solanaEmbed.esm-LQoue5a0.js → solanaEmbed.esm-CM69eDrj.js} +1 -1
  74. package/lib/{solanaEmbed.esm-QawbC8eJ.mjs → solanaEmbed.esm-rMe_voKF.mjs} +1 -1
  75. package/lib/src/views/v2/Redeem/index.d.ts.map +1 -1
  76. package/lib/{sui-CIDA-hM_.js → sui-1KKOjsyu.js} +1 -1
  77. package/lib/{sui-DZg5qrE0.js → sui-BRucFXyI.js} +1 -1
  78. package/lib/{sui-BwFJqgyM.mjs → sui-CtQtzdVy.mjs} +1 -1
  79. package/lib/{sui-C88m3bWr.mjs → sui-DMYKKmcs.mjs} +5 -5
  80. package/package.json +21 -21
  81. package/lib/solana-Bq3a7vGW.mjs +0 -17
  82. package/lib/solana-Bw-7Gaje.js +0 -1
@@ -1,4 +1,4 @@
1
- import { cT as Pn, az as _r, cY as ks, O as le, cZ as Zb, as as Ye, c_ as Bn, c$ as Ls, Q as Oi, d0 as Xi, cS as q1, a5 as Gg, d1 as V1, d2 as G1, d3 as z1, d4 as K1, d5 as J1, d6 as Y1, a9 as zg } from "./index-ndWybTXw.mjs";
1
+ import { cT as Pn, az as _r, cY as ks, O as le, cZ as Zb, as as Ye, c_ as Bn, c$ as Ls, Q as Oi, d0 as Xi, cS as q1, a5 as Gg, d1 as V1, d2 as G1, d3 as z1, d4 as K1, d5 as J1, d6 as Y1, a9 as zg } from "./index-ObRYlj1l.mjs";
2
2
  function Ps(e) {
3
3
  "@babel/helpers - typeof";
4
4
  return Ps = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/views/v2/Redeem/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAgIf,QAAA,MAAM,MAAM,yBAiyBX,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/views/v2/Redeem/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAiIf,QAAA,MAAM,MAAM,yBAqyBX,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1 +1 @@
1
- "use strict";var q=Object.defineProperty;var z=(r,e,t)=>e in r?q(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var S=(r,e,t)=>z(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-C0mg2EaP.js"),O=require("./index-CyPQH2yv.js");var w={};Object.defineProperty(w,"__esModule",{value:!0});w.bech32m=m=w.bech32=void 0;const v="qpzry9x8gf2tvdw0s3jn54khce6mua7l",R={};for(let r=0;r<v.length;r++){const e=v.charAt(r);R[e]=r}function y(r){const e=r>>25;return(r&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function B(r){let e=1;for(let t=0;t<r.length;++t){const n=r.charCodeAt(t);if(n<33||n>126)return"Invalid prefix ("+r+")";e=y(e)^n>>5}e=y(e);for(let t=0;t<r.length;++t){const n=r.charCodeAt(t);e=y(e)^n&31}return e}function P(r,e,t,n){let o=0,c=0;const s=(1<<t)-1,a=[];for(let u=0;u<r.length;++u)for(o=o<<e|r[u],c+=e;c>=t;)c-=t,a.push(o>>c&s);if(n)c>0&&a.push(o<<t-c&s);else{if(c>=e)return"Excess padding";if(o<<t-c&s)return"Non-zero padding"}return a}function $(r){return P(r,8,5,!0)}function F(r){const e=P(r,5,8,!1);if(Array.isArray(e))return e}function V(r){const e=P(r,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}function T(r){let e;r==="bech32"?e=1:e=734539939;function t(s,a,u){if(u=u||90,s.length+7+a.length>u)throw new TypeError("Exceeds length limit");s=s.toLowerCase();let d=B(s);if(typeof d=="string")throw new Error(d);let f=s+"1";for(let l=0;l<a.length;++l){const h=a[l];if(h>>5)throw new Error("Non 5-bit word");d=y(d)^h,f+=v.charAt(h)}for(let l=0;l<6;++l)d=y(d);d^=e;for(let l=0;l<6;++l){const h=d>>(5-l)*5&31;f+=v.charAt(h)}return f}function n(s,a){if(a=a||90,s.length<8)return s+" too short";if(s.length>a)return"Exceeds length limit";const u=s.toLowerCase(),d=s.toUpperCase();if(s!==u&&s!==d)return"Mixed-case string "+s;s=u;const f=s.lastIndexOf("1");if(f===-1)return"No separator character for "+s;if(f===0)return"Missing prefix for "+s;const l=s.slice(0,f),h=s.slice(f+1);if(h.length<6)return"Data too short";let p=B(l);if(typeof p=="string")return p;const x=[];for(let E=0;E<h.length;++E){const k=h.charAt(E),A=R[k];if(A===void 0)return"Unknown character "+k;p=y(p)^A,!(E+6>=h.length)&&x.push(A)}return p!==e?"Invalid checksum for "+s:{prefix:l,words:x}}function o(s,a){const u=n(s,a);if(typeof u=="object")return u}function c(s,a){const u=n(s,a);if(typeof u=="object")return u;throw new Error(u)}return{decodeUnsafe:o,decode:c,encode:t,toWords:$,fromWordsUnsafe:F,fromWords:V}}var m=w.bech32=T("bech32");w.bech32m=T("bech32m");function U(r,e){return i.suiBcs.IntentMessage(i.suiBcs.fixedArray(e.length,i.suiBcs.u8())).serialize({intent:{scope:{[r]:!0},version:{V0:!0},appId:{Sui:!0}},value:e}).toBytes()}const _={ED25519:0,Secp256k1:1,Secp256r1:2,MultiSig:3,ZkLogin:5,Passkey:6},G={ED25519:32,Secp256k1:33,Secp256r1:33},L={0:"ED25519",1:"Secp256k1",2:"Secp256r1",3:"MultiSig",5:"ZkLogin",6:"Passkey"};function M(r,e){if(r===e)return!0;if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}class Z{equals(e){return M(this.toRawBytes(),e.toRawBytes())}toBase64(){return i.toBase64(this.toRawBytes())}toString(){throw new Error("`toString` is not implemented on public keys. Use `toBase64()` or `toRawBytes()` instead.")}toSuiPublicKey(){const e=this.toSuiBytes();return i.toBase64(e)}verifyWithIntent(e,t,n){const o=U(n,e),c=i.blake2b(o,{dkLen:32});return this.verify(c,t)}verifyPersonalMessage(e,t){return this.verifyWithIntent(i.suiBcs.vector(i.suiBcs.u8()).serialize(e).toBytes(),t,"PersonalMessage")}verifyTransaction(e,t){return this.verifyWithIntent(e,t,"TransactionData")}verifyAddress(e){return this.toSuiAddress()===e}toSuiBytes(){const e=this.toRawBytes(),t=new Uint8Array(e.length+1);return t.set([this.flag()]),t.set(e,1),t}toSuiAddress(){return i.normalizeSuiAddress(i.bytesToHex(i.blake2b(this.toSuiBytes(),{dkLen:32})).slice(0,i.SUI_ADDRESS_LENGTH*2))}}function j(r){const e=i.fromBase64(r),t=L[e[0]];switch(t){case"ED25519":case"Secp256k1":case"Secp256r1":const n=G[t],o=e.slice(1,e.length-n),c=e.slice(1+o.length);return{serializedSignature:r,signatureScheme:t,signature:o,publicKey:c,bytes:e};default:throw new Error("Unsupported signature scheme")}}function Y({signature:r,signatureScheme:e,publicKey:t}){if(!t)throw new Error("`publicKey` is required");const n=t.toRawBytes(),o=new Uint8Array(1+r.length+n.length);return o.set([_[e]]),o.set(r,1),o.set(n,1+r.length),i.toBase64(o)}const b=32,N="suiprivkey";class X{async signWithIntent(e,t){const n=U(t,e),o=i.blake2b(n,{dkLen:32});return{signature:Y({signature:await this.sign(o),signatureScheme:this.getKeyScheme(),publicKey:this.getPublicKey()}),bytes:i.toBase64(e)}}async signTransaction(e){return this.signWithIntent(e,"TransactionData")}async signPersonalMessage(e){const{signature:t}=await this.signWithIntent(i.bcs.vector(i.bcs.u8()).serialize(e).toBytes(),"PersonalMessage");return{bytes:i.toBase64(e),signature:t}}toSuiAddress(){return this.getPublicKey().toSuiAddress()}}class J extends X{}function Q(r){const{prefix:e,words:t}=m.decode(r);if(e!==N)throw new Error("invalid private key prefix");const n=new Uint8Array(m.fromWords(t)),o=n.slice(1);return{schema:L[n[0]],secretKey:o}}function ee(r,e){if(r.length!==b)throw new Error("Invalid bytes length");const t=_[e],n=new Uint8Array(r.length+1);return n.set([t]),n.set(r,1),m.encode(N,m.toWords(n))}function I(r){return!!new RegExp("^m\\/44'\\/784'\\/[0-9]+'\\/[0-9]+'\\/[0-9]+'+$").test(r)}function te(r){return O.mnemonicToSeedSync(r,"")}function re(r){return i.toHex(te(r))}const ne="ed25519 seed",se=2147483648,ie=new RegExp("^m(\\/[0-9]+')+$"),W=r=>r.replace("'",""),oe=r=>{const t=i.hmac.create(i.sha512,ne).update(i.fromHex(r)).digest(),n=t.slice(0,32),o=t.slice(32);return{key:n,chainCode:o}},ce=({key:r,chainCode:e},t)=>{const n=new ArrayBuffer(4);new DataView(n).setUint32(0,t);const c=new Uint8Array(1+r.length+n.byteLength);c.set(new Uint8Array(1).fill(0)),c.set(r,1),c.set(new Uint8Array(n,0,n.byteLength),r.length+1);const s=i.hmac.create(i.sha512,e).update(c).digest(),a=s.slice(0,32),u=s.slice(32);return{key:a,chainCode:u}},ae=r=>ie.test(r)?!r.split("/").slice(1).map(W).some(isNaN):!1,C=(r,e,t=se)=>{if(!ae(r))throw new Error("Invalid derivation path");const{key:n,chainCode:o}=oe(e);return r.split("/").slice(1).map(W).map(s=>parseInt(s,10)).reduce((s,a)=>ce(s,a+t),{key:n,chainCode:o})},K=32;class H extends Z{constructor(e){if(super(),typeof e=="string"?this.data=i.fromBase64(e):e instanceof Uint8Array?this.data=e:this.data=Uint8Array.from(e),this.data.length!==K)throw new Error(`Invalid public key input. Expected ${K} bytes, got ${this.data.length}`)}equals(e){return super.equals(e)}toRawBytes(){return this.data}flag(){return _.ED25519}async verify(e,t){let n;if(typeof t=="string"){const o=j(t);if(o.signatureScheme!=="ED25519")throw new Error("Invalid signature scheme");if(!M(this.toRawBytes(),o.publicKey))throw new Error("Signature does not match public key");n=o.signature}else n=t;return i.ed25519.verify(n,e,this.toRawBytes())}}H.SIZE=K;const D="m/44'/784'/0'/0'/0'";class g extends J{constructor(e){if(super(),e)this.keypair={publicKey:e.publicKey,secretKey:e.secretKey.slice(0,32)};else{const t=i.ed25519.utils.randomPrivateKey();this.keypair={publicKey:i.ed25519.getPublicKey(t),secretKey:t}}}getKeyScheme(){return"ED25519"}static generate(){const e=i.ed25519.utils.randomPrivateKey();return new g({publicKey:i.ed25519.getPublicKey(e),secretKey:e})}static fromSecretKey(e,t){if(typeof e=="string"){const c=Q(e);if(c.schema!=="ED25519")throw new Error(`Expected a ED25519 keypair, got ${c.schema}`);return this.fromSecretKey(c.secretKey,t)}const n=e.length;if(n!==b)throw new Error(`Wrong secretKey size. Expected ${b} bytes, got ${n}.`);const o={publicKey:i.ed25519.getPublicKey(e),secretKey:e};if(!t||!t.skipValidation){const s=new TextEncoder().encode("sui validation"),a=i.ed25519.sign(s,e);if(!i.ed25519.verify(a,s,o.publicKey))throw new Error("provided secretKey is invalid")}return new g(o)}getPublicKey(){return new H(this.keypair.publicKey)}getSecretKey(){return ee(this.keypair.secretKey.slice(0,b),this.getKeyScheme())}async sign(e){return i.ed25519.sign(e,this.keypair.secretKey)}static deriveKeypair(e,t){if(t==null&&(t=D),!I(t))throw new Error("Invalid derivation path");const{key:n}=C(t,re(e));return g.fromSecretKey(n)}static deriveKeypairFromSeed(e,t){if(t==null&&(t=D),!I(t))throw new Error("Invalid derivation path");const{key:n}=C(t,e);return g.fromSecretKey(n)}}async function ue(r,e){const[,t]=await i.SuiPlatform.chainFromRpc(r);return new le(t,r,g.deriveKeypair(e,"m/44'/784'/0'/0'/0'"))}class le{constructor(e,t,n,o){S(this,"_chain");S(this,"_client");S(this,"_signer");S(this,"_debug");this._chain=e,this._client=t,this._signer=n,this._debug=o}chain(){return this._chain}address(){return this._signer.toSuiAddress()}async signAndSend(e){const t=[];for(const n of e){const{description:o,transaction:c}=n;this._debug&&console.log(`Signing ${o} for ${this.address()}`);try{const s=await this._client.signAndExecuteTransaction({transaction:c,signer:this._signer});t.push(s.digest)}catch(s){throw s}}return t}}const de={Address:i.SuiAddress,Platform:i.SuiPlatform,getSigner:ue,protocols:{WormholeCore:()=>Promise.resolve().then(()=>require("./index-DpL4G1gV.js")),TokenBridge:()=>Promise.resolve().then(()=>require("./index-DqPgH3Y4.js")),CircleBridge:()=>Promise.resolve().then(()=>require("./index-C7jR2tws.js"))},getChain:(r,e,t)=>new i.SuiChain(e,new i.SuiPlatform(r,i.applyChainsConfigConfigOverrides(r,i._platform$3,{[e]:t})))};exports.default=de;
1
+ "use strict";var q=Object.defineProperty;var z=(r,e,t)=>e in r?q(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var S=(r,e,t)=>z(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-DU1he9Nx.js"),O=require("./index-v9fEg88t.js");var w={};Object.defineProperty(w,"__esModule",{value:!0});w.bech32m=m=w.bech32=void 0;const v="qpzry9x8gf2tvdw0s3jn54khce6mua7l",R={};for(let r=0;r<v.length;r++){const e=v.charAt(r);R[e]=r}function y(r){const e=r>>25;return(r&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function B(r){let e=1;for(let t=0;t<r.length;++t){const n=r.charCodeAt(t);if(n<33||n>126)return"Invalid prefix ("+r+")";e=y(e)^n>>5}e=y(e);for(let t=0;t<r.length;++t){const n=r.charCodeAt(t);e=y(e)^n&31}return e}function P(r,e,t,n){let o=0,c=0;const s=(1<<t)-1,a=[];for(let u=0;u<r.length;++u)for(o=o<<e|r[u],c+=e;c>=t;)c-=t,a.push(o>>c&s);if(n)c>0&&a.push(o<<t-c&s);else{if(c>=e)return"Excess padding";if(o<<t-c&s)return"Non-zero padding"}return a}function $(r){return P(r,8,5,!0)}function F(r){const e=P(r,5,8,!1);if(Array.isArray(e))return e}function V(r){const e=P(r,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}function T(r){let e;r==="bech32"?e=1:e=734539939;function t(s,a,u){if(u=u||90,s.length+7+a.length>u)throw new TypeError("Exceeds length limit");s=s.toLowerCase();let d=B(s);if(typeof d=="string")throw new Error(d);let f=s+"1";for(let l=0;l<a.length;++l){const h=a[l];if(h>>5)throw new Error("Non 5-bit word");d=y(d)^h,f+=v.charAt(h)}for(let l=0;l<6;++l)d=y(d);d^=e;for(let l=0;l<6;++l){const h=d>>(5-l)*5&31;f+=v.charAt(h)}return f}function n(s,a){if(a=a||90,s.length<8)return s+" too short";if(s.length>a)return"Exceeds length limit";const u=s.toLowerCase(),d=s.toUpperCase();if(s!==u&&s!==d)return"Mixed-case string "+s;s=u;const f=s.lastIndexOf("1");if(f===-1)return"No separator character for "+s;if(f===0)return"Missing prefix for "+s;const l=s.slice(0,f),h=s.slice(f+1);if(h.length<6)return"Data too short";let p=B(l);if(typeof p=="string")return p;const x=[];for(let E=0;E<h.length;++E){const k=h.charAt(E),A=R[k];if(A===void 0)return"Unknown character "+k;p=y(p)^A,!(E+6>=h.length)&&x.push(A)}return p!==e?"Invalid checksum for "+s:{prefix:l,words:x}}function o(s,a){const u=n(s,a);if(typeof u=="object")return u}function c(s,a){const u=n(s,a);if(typeof u=="object")return u;throw new Error(u)}return{decodeUnsafe:o,decode:c,encode:t,toWords:$,fromWordsUnsafe:F,fromWords:V}}var m=w.bech32=T("bech32");w.bech32m=T("bech32m");function U(r,e){return i.suiBcs.IntentMessage(i.suiBcs.fixedArray(e.length,i.suiBcs.u8())).serialize({intent:{scope:{[r]:!0},version:{V0:!0},appId:{Sui:!0}},value:e}).toBytes()}const _={ED25519:0,Secp256k1:1,Secp256r1:2,MultiSig:3,ZkLogin:5,Passkey:6},G={ED25519:32,Secp256k1:33,Secp256r1:33},L={0:"ED25519",1:"Secp256k1",2:"Secp256r1",3:"MultiSig",5:"ZkLogin",6:"Passkey"};function M(r,e){if(r===e)return!0;if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}class Z{equals(e){return M(this.toRawBytes(),e.toRawBytes())}toBase64(){return i.toBase64(this.toRawBytes())}toString(){throw new Error("`toString` is not implemented on public keys. Use `toBase64()` or `toRawBytes()` instead.")}toSuiPublicKey(){const e=this.toSuiBytes();return i.toBase64(e)}verifyWithIntent(e,t,n){const o=U(n,e),c=i.blake2b(o,{dkLen:32});return this.verify(c,t)}verifyPersonalMessage(e,t){return this.verifyWithIntent(i.suiBcs.vector(i.suiBcs.u8()).serialize(e).toBytes(),t,"PersonalMessage")}verifyTransaction(e,t){return this.verifyWithIntent(e,t,"TransactionData")}verifyAddress(e){return this.toSuiAddress()===e}toSuiBytes(){const e=this.toRawBytes(),t=new Uint8Array(e.length+1);return t.set([this.flag()]),t.set(e,1),t}toSuiAddress(){return i.normalizeSuiAddress(i.bytesToHex(i.blake2b(this.toSuiBytes(),{dkLen:32})).slice(0,i.SUI_ADDRESS_LENGTH*2))}}function j(r){const e=i.fromBase64(r),t=L[e[0]];switch(t){case"ED25519":case"Secp256k1":case"Secp256r1":const n=G[t],o=e.slice(1,e.length-n),c=e.slice(1+o.length);return{serializedSignature:r,signatureScheme:t,signature:o,publicKey:c,bytes:e};default:throw new Error("Unsupported signature scheme")}}function Y({signature:r,signatureScheme:e,publicKey:t}){if(!t)throw new Error("`publicKey` is required");const n=t.toRawBytes(),o=new Uint8Array(1+r.length+n.length);return o.set([_[e]]),o.set(r,1),o.set(n,1+r.length),i.toBase64(o)}const b=32,N="suiprivkey";class X{async signWithIntent(e,t){const n=U(t,e),o=i.blake2b(n,{dkLen:32});return{signature:Y({signature:await this.sign(o),signatureScheme:this.getKeyScheme(),publicKey:this.getPublicKey()}),bytes:i.toBase64(e)}}async signTransaction(e){return this.signWithIntent(e,"TransactionData")}async signPersonalMessage(e){const{signature:t}=await this.signWithIntent(i.bcs.vector(i.bcs.u8()).serialize(e).toBytes(),"PersonalMessage");return{bytes:i.toBase64(e),signature:t}}toSuiAddress(){return this.getPublicKey().toSuiAddress()}}class J extends X{}function Q(r){const{prefix:e,words:t}=m.decode(r);if(e!==N)throw new Error("invalid private key prefix");const n=new Uint8Array(m.fromWords(t)),o=n.slice(1);return{schema:L[n[0]],secretKey:o}}function ee(r,e){if(r.length!==b)throw new Error("Invalid bytes length");const t=_[e],n=new Uint8Array(r.length+1);return n.set([t]),n.set(r,1),m.encode(N,m.toWords(n))}function I(r){return!!new RegExp("^m\\/44'\\/784'\\/[0-9]+'\\/[0-9]+'\\/[0-9]+'+$").test(r)}function te(r){return O.mnemonicToSeedSync(r,"")}function re(r){return i.toHex(te(r))}const ne="ed25519 seed",se=2147483648,ie=new RegExp("^m(\\/[0-9]+')+$"),W=r=>r.replace("'",""),oe=r=>{const t=i.hmac.create(i.sha512,ne).update(i.fromHex(r)).digest(),n=t.slice(0,32),o=t.slice(32);return{key:n,chainCode:o}},ce=({key:r,chainCode:e},t)=>{const n=new ArrayBuffer(4);new DataView(n).setUint32(0,t);const c=new Uint8Array(1+r.length+n.byteLength);c.set(new Uint8Array(1).fill(0)),c.set(r,1),c.set(new Uint8Array(n,0,n.byteLength),r.length+1);const s=i.hmac.create(i.sha512,e).update(c).digest(),a=s.slice(0,32),u=s.slice(32);return{key:a,chainCode:u}},ae=r=>ie.test(r)?!r.split("/").slice(1).map(W).some(isNaN):!1,C=(r,e,t=se)=>{if(!ae(r))throw new Error("Invalid derivation path");const{key:n,chainCode:o}=oe(e);return r.split("/").slice(1).map(W).map(s=>parseInt(s,10)).reduce((s,a)=>ce(s,a+t),{key:n,chainCode:o})},K=32;class H extends Z{constructor(e){if(super(),typeof e=="string"?this.data=i.fromBase64(e):e instanceof Uint8Array?this.data=e:this.data=Uint8Array.from(e),this.data.length!==K)throw new Error(`Invalid public key input. Expected ${K} bytes, got ${this.data.length}`)}equals(e){return super.equals(e)}toRawBytes(){return this.data}flag(){return _.ED25519}async verify(e,t){let n;if(typeof t=="string"){const o=j(t);if(o.signatureScheme!=="ED25519")throw new Error("Invalid signature scheme");if(!M(this.toRawBytes(),o.publicKey))throw new Error("Signature does not match public key");n=o.signature}else n=t;return i.ed25519.verify(n,e,this.toRawBytes())}}H.SIZE=K;const D="m/44'/784'/0'/0'/0'";class g extends J{constructor(e){if(super(),e)this.keypair={publicKey:e.publicKey,secretKey:e.secretKey.slice(0,32)};else{const t=i.ed25519.utils.randomPrivateKey();this.keypair={publicKey:i.ed25519.getPublicKey(t),secretKey:t}}}getKeyScheme(){return"ED25519"}static generate(){const e=i.ed25519.utils.randomPrivateKey();return new g({publicKey:i.ed25519.getPublicKey(e),secretKey:e})}static fromSecretKey(e,t){if(typeof e=="string"){const c=Q(e);if(c.schema!=="ED25519")throw new Error(`Expected a ED25519 keypair, got ${c.schema}`);return this.fromSecretKey(c.secretKey,t)}const n=e.length;if(n!==b)throw new Error(`Wrong secretKey size. Expected ${b} bytes, got ${n}.`);const o={publicKey:i.ed25519.getPublicKey(e),secretKey:e};if(!t||!t.skipValidation){const s=new TextEncoder().encode("sui validation"),a=i.ed25519.sign(s,e);if(!i.ed25519.verify(a,s,o.publicKey))throw new Error("provided secretKey is invalid")}return new g(o)}getPublicKey(){return new H(this.keypair.publicKey)}getSecretKey(){return ee(this.keypair.secretKey.slice(0,b),this.getKeyScheme())}async sign(e){return i.ed25519.sign(e,this.keypair.secretKey)}static deriveKeypair(e,t){if(t==null&&(t=D),!I(t))throw new Error("Invalid derivation path");const{key:n}=C(t,re(e));return g.fromSecretKey(n)}static deriveKeypairFromSeed(e,t){if(t==null&&(t=D),!I(t))throw new Error("Invalid derivation path");const{key:n}=C(t,e);return g.fromSecretKey(n)}}async function ue(r,e){const[,t]=await i.SuiPlatform.chainFromRpc(r);return new le(t,r,g.deriveKeypair(e,"m/44'/784'/0'/0'/0'"))}class le{constructor(e,t,n,o){S(this,"_chain");S(this,"_client");S(this,"_signer");S(this,"_debug");this._chain=e,this._client=t,this._signer=n,this._debug=o}chain(){return this._chain}address(){return this._signer.toSuiAddress()}async signAndSend(e){const t=[];for(const n of e){const{description:o,transaction:c}=n;this._debug&&console.log(`Signing ${o} for ${this.address()}`);try{const s=await this._client.signAndExecuteTransaction({transaction:c,signer:this._signer});t.push(s.digest)}catch(s){throw s}}return t}}const de={Address:i.SuiAddress,Platform:i.SuiPlatform,getSigner:ue,protocols:{WormholeCore:()=>Promise.resolve().then(()=>require("./index-Cv_SfKSZ.js")),TokenBridge:()=>Promise.resolve().then(()=>require("./index-BnQbapb-.js")),CircleBridge:()=>Promise.resolve().then(()=>require("./index-yU0Hsqz_.js"))},getChain:(r,e,t)=>new i.SuiChain(e,new i.SuiPlatform(r,i.applyChainsConfigConfigOverrides(r,i._platform$3,{[e]:t})))};exports.default=de;
@@ -1,4 +1,4 @@
1
- "use strict";var vn=Object.defineProperty;var xn=(e,t,r)=>t in e?vn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var k=(e,t,r)=>xn(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Sr=require("./wallets-5qGJd8Hk.js"),kn=require("./util-G2vxTeU2.js"),B=require("./index-C0mg2EaP.js");function zn(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const dt=8192;function Dr(e){if(e.length<dt)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=dt){const n=e.slice(r,r+dt);t+=String.fromCharCode(...n)}return btoa(t)}const On=32;function Bn(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(On*2,"0")}`}function Er(e,t=!1){return Bn(e,t)}BigInt(1e9);Er("0x6");Er("0x5");let Pn=class extends TypeError{constructor(t,r){let n;const{message:i,explanation:o,...a}=t,{path:l}=t,c=l.length===0?i:`At path: ${l.join(".")} -- ${i}`;super(o??c),o!=null&&(this.cause=c),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}};function Rn(e){return be(e)&&typeof e[Symbol.iterator]=="function"}function be(e){return typeof e=="object"&&e!=null}function Le(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function Un(e){const{done:t,value:r}=e.next();return t?void 0:r}function Gn(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:o}=t,{type:a}=r,{refinement:l,message:c=`Expected a value of type \`${a}\`${l?` with refinement \`${l}\``:""}, but received: \`${Le(n)}\``}=e;return{value:n,type:a,refinement:l,key:i[i.length-1],path:i,branch:o,...e,message:c}}function*tr(e,t,r,n){Rn(e)||(e=[e]);for(const i of e){const o=Gn(i,t,r,n);o&&(yield o)}}function*xt(e,t,r={}){const{path:n=[],branch:i=[e],coerce:o=!1,mask:a=!1}=r,l={path:n,branch:i};if(o&&(e=t.coercer(e,l),a&&t.type!=="type"&&be(t.schema)&&be(e)&&!Array.isArray(e)))for(const g in e)t.schema[g]===void 0&&delete e[g];let c="valid";for(const g of t.validator(e,l))g.explanation=r.message,c="not_valid",yield[g,void 0];for(let[g,d,A]of t.entries(e,l)){const j=xt(d,A,{path:g===void 0?n:[...n,g],branch:g===void 0?i:[...i,d],coerce:o,mask:a,message:r.message});for(const h of j)h[0]?(c=h[0].refinement!=null?"not_refined":"not_valid",yield[h[0],void 0]):o&&(d=h[1],g===void 0?e=d:e instanceof Map?e.set(g,d):e instanceof Set?e.add(d):be(e)&&(d!==void 0||g in e)&&(e[g]=d))}if(c!=="not_valid")for(const g of t.refiner(e,l))g.explanation=r.message,c="not_refined",yield[g,void 0];c==="valid"&&(yield[void 0,e])}let Ue=class{constructor(t){const{type:r,schema:n,validator:i,refiner:o,coercer:a=c=>c,entries:l=function*(){}}=t;this.type=r,this.schema=n,this.entries=l,this.coercer=a,i?this.validator=(c,g)=>{const d=i(c,g);return tr(d,g,this,c)}:this.validator=()=>[],o?this.refiner=(c,g)=>{const d=o(c,g);return tr(d,g,this,c)}:this.refiner=()=>[]}assert(t,r){return Qn(t,this,r)}create(t,r){return Yn(t,this,r)}is(t){return Zn(t,this)}mask(t,r){return Wn(t,this,r)}validate(t,r={}){return qe(t,this,r)}};function Qn(e,t,r){const n=qe(e,t,{message:r});if(n[0])throw n[0]}function Yn(e,t,r){const n=qe(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Wn(e,t,r){const n=qe(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function Zn(e,t){return!qe(e,t)[0]}function qe(e,t,r={}){const n=xt(e,t,r),i=Un(n);return i[0]?[new Pn(i[0],function*(){for(const a of n)a[0]&&(yield a[0])}),void 0]:[void 0,i[1]]}function kt(e,t){return new Ue({type:e,schema:null,validator:t})}function rr(e){return new Ue({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${Le(t)}`}})}function ze(){return kt("boolean",e=>typeof e=="boolean")}function $e(e){const t=Le(e),r=typeof e;return new Ue({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${Le(n)}`}})}function Vn(){return kt("never",()=>!1)}function Ge(e){const t=e?Object.keys(e):[],r=Vn();return new Ue({type:"object",schema:e||null,*entries(n){if(e&&be(n)){const i=new Set(Object.keys(n));for(const o of t)i.delete(o),yield[o,n[o],e[o]];for(const o of i)yield[o,n[o],r]}},validator(n){return be(n)||`Expected an object, but received: ${Le(n)}`},coercer(n){return be(n)?{...n}:n}})}function ne(e){return new Ue({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function W(){return kt("string",e=>typeof e=="string"||`Expected a string, but received: ${Le(e)}`)}function Fn(e){const t=e.map(r=>r.type).join(" | ");return new Ue({type:"union",schema:null,coercer(r){for(const n of e){const[i,o]=n.validate(r,{coerce:!0});if(!i)return o}return r},validator(r,n){const i=[];for(const o of e){const[...a]=xt(r,o,n),[l]=a;if(l[0])for(const[c]of a)c&&i.push(c);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${Le(r)}`,...i]}})}var Jn=Object.defineProperty,Hn=(e,t,r)=>t in e?Jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$=(e,t,r)=>(Hn(e,typeof t!="symbol"?t+"":t,r),r),br=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},K=(e,t,r)=>(br(e,t,"read from private field"),r?r.call(e):t.get(e)),ae=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},J=(e,t,r,n)=>(br(e,t,"write to private field"),t.set(e,r),r),zt=Ge({address:W(),publicKey:W(),chains:rr(W()),features:rr(W()),label:ne(W()),icon:ne(W())});function Ot(e){return{address:e.address,publicKey:Dr(e.publicKey),features:[...e.features],chains:[...e.chains],label:e.label,icon:e.icon}}function Xn(e){return{address:e.address,publicKey:zn(e.publicKey),chains:e.chains.map(t=>t),features:e.features.map(t=>t),label:e.label,icon:e.icon}}Ge({message:W(),account:zt});function qn(e){return{message:Dr(e.message),account:Ot(e.account)}}Ge({transactionBlock:W(),account:zt,chain:W()});function Kn(e){return{transactionBlock:e.transactionBlock.serialize(),account:Ot(e.account),chain:e.chain}}var _n=Ge({showBalanceChanges:ne(ze()),showEffects:ne(ze()),showEvents:ne(ze()),showInput:ne(ze()),showObjectChanges:ne(ze()),showRawInput:ne(ze())});Ge({transactionBlock:W(),account:zt,chain:W(),requestType:ne(W()),options:ne(_n)});function $n(e){return{transactionBlock:e.transactionBlock.serialize(),account:Ot(e.account),chain:e.chain,requestType:e.requestType,options:e.options}}Ge({network:Fn([$e("mainnet"),$e("testnet"),$e("devnet"),$e("localnet")]),url:W()});const ei="sui:devnet",ti="sui:testnet",ri="sui:localnet",ni="sui:mainnet",ii=[ei,ti,ri,ni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MuMy01Ny43IDE1LjItNDEuMWgtNjcuNWwxNSA0MS4xIDMuNSA1Ny43IDEuMiAxOC4yLjEgNDQuOGgyNy43bC4yLTQ0Ljh6IiBjbGFzcz0ic3Q2Ii8+Cjwvc3ZnPg==",Lr=class Te extends Error{constructor(t){super(`${Te.type}: ${t}}`),$(this,"type",Te.type)}static asSimpleError(t){return new Error(`${Te.type}: ${t}`)}static isSimpleErrorMessage(t){return t.startsWith(Te.type+": ")}static fromSimpleErrorMessage(t){return new Te(t.slice(Te.type.length+2))}};$(Lr,"type","INVALID_REQUEST_PARAMS");var nr=Lr,Cr=class Ye extends Error{constructor(){super(Ye.type),$(this,"type",Ye.type)}static asSimpleError(){return new Error(Ye.type)}static isSimpleErrorMessage(t){return t===Ye.type}};$(Cr,"type","USER_REJECTION");var ht=Cr,vr=class me extends Error{constructor(t){super(`${me.type}: ${t}`),$(this,"type",me.type)}static asSimpleError(t){return new Error(`${me.type}: ${t}`)}static isSimpleErrorMessage(t){return t.startsWith(me.type+": ")}static fromSimpleErrorMessage(t){return new me(t.slice(me.type.length+2))}};$(vr,"type","INVALID_REQUEST_METHOD");var ir=vr,xr=class we extends Error{constructor(t){let r=we.type;t&&(r+=": "+t),super(r),$(this,"type",we.type)}static asSimpleError(t){let r=we.type;return t&&(r+=": "+t),new Error(r)}static isSimpleErrorMessage(t){return t.startsWith(we.type)}static fromSimpleErrorMessage(t){return new we(t.slice(we.type.length+2))}};$(xr,"type","DRY_RUN_FAILED");var sr=xr,kr=class st extends Error{constructor(){super(st.type),$(this,"type",ht.type)}static asSimpleError(){return new Error(st.type)}static isSimpleErrorMessage(t){return t===st.type}};$(kr,"type","NON_ADMIN_ORIGIN");var or=kr;function oi(e){return typeof e=="object"&&e!==null&&"message"in e}function Bt(e){return oi(e)?nr.isSimpleErrorMessage(e.message)?nr.fromSimpleErrorMessage(e.message):ht.isSimpleErrorMessage(e.message)?new ht:ir.isSimpleErrorMessage(e.message)?ir.fromSimpleErrorMessage(e.message):sr.isSimpleErrorMessage(e.message)?sr.fromSimpleErrorMessage(e.message):or.isSimpleErrorMessage(e.message)?new or:e:e}var Ke="npm:@kunalabs-io/sui-metamask-snap",ai="^1.0.0";function ci(){const e=Sr.getWallets();for(const r of e.get())if(r.name===ar.NAME)return console.warn("SuiSnapWallet already registered"),r;const t=new ar;return e.register(t),t}async function ui(e){return(await e.request({method:"wallet_invokeSnap",params:{snapId:Ke,request:{method:"getAccounts"}}})).map(r=>new kn.ReadonlyWalletAccount(Xn(r)))}async function zr(e,t){const r=qn(t);try{return await e.request({method:"wallet_invokeSnap",params:{snapId:Ke,request:{method:"signPersonalMessage",params:JSON.parse(JSON.stringify(r))}}})}catch(n){throw Bt(n)}}async function li(e,t){const r=await zr(e,t);return{messageBytes:r.bytes,signature:r.signature}}async function gi(e,t){const r=Kn(t);try{return await e.request({method:"wallet_invokeSnap",params:{snapId:Ke,request:{method:"signTransactionBlock",params:JSON.parse(JSON.stringify(r))}}})}catch(n){throw Bt(n)}}async function di(e,t){const r=$n(t);try{return await e.request({method:"wallet_invokeSnap",params:{snapId:Ke,request:{method:"signAndExecuteTransactionBlock",params:JSON.parse(JSON.stringify(r))}}})}catch(n){throw Bt(n)}}async function Mi(){const e=window.ethereum;if(!e)return{available:!1,supportsSnaps:!1,suiSnapInstalled:!1};if(!e.isMetaMask)return{available:!1,suiSnapInstalled:!1,supportsSnaps:!1};try{const t=await e.request({method:"web3_clientVersion"}),r=await e.request({method:"wallet_getSnaps"}),n=!!r&&"npm:@kunalabs-io/sui-metamask-snap"in r;return{available:!0,version:t,supportsSnaps:!0,suiSnapInstalled:n}}catch(t){return console.warn(t),{available:!0,supportsSnaps:!1,suiSnapInstalled:!1}}}var ue,fe,Be,It,ft,yt,pt,jt,Nt,Or=class Br{constructor(){ae(this,ue,void 0),ae(this,fe,void 0),ae(this,Be,null),ae(this,It,async()=>{if(K(this,ue))throw new Error("Already connecting");J(this,ue,!0),J(this,fe,!1);try{const t=window.ethereum;if(!(await Mi()).available)throw new Error("MetaMask not detected!");return await t.request({method:"wallet_requestSnaps",params:{[Ke]:{version:ai}}}),J(this,Be,await ui(t)),J(this,ue,!1),J(this,fe,!0),{accounts:this.accounts}}catch(t){throw J(this,ue,!1),J(this,fe,!1),t}}),ae(this,ft,async()=>{J(this,ue,!1),J(this,fe,!1),J(this,Be,null)}),ae(this,yt,async t=>zr(window.ethereum,t)),ae(this,pt,async t=>li(window.ethereum,t)),ae(this,jt,async t=>gi(window.ethereum,t)),ae(this,Nt,async t=>di(window.ethereum,t)),J(this,ue,!1),J(this,fe,!1)}get version(){return"1.0.0"}get name(){return Br.NAME}get icon(){return si}get chains(){return ii}get connecting(){return K(this,ue)}get accounts(){return K(this,fe)&&K(this,Be)?K(this,Be):[]}get features(){return{"standard:connect":{version:"1.0.0",connect:K(this,It)},"standard:disconnect":{version:"1.0.0",disconnect:K(this,ft)},"sui:signPersonalMessage":{version:"1.0.0",signPersonalMessage:K(this,yt)},"sui:signMessage":{version:"1.0.0",signMessage:K(this,pt)},"sui:signTransactionBlock":{version:"1.0.0",signTransactionBlock:K(this,jt)},"sui:signAndExecuteTransactionBlock":{version:"1.0.0",signAndExecuteTransactionBlock:K(this,Nt)},"standard:events":{version:"1.0.0",on:()=>()=>{}}}}};ue=new WeakMap;fe=new WeakMap;Be=new WeakMap;It=new WeakMap;ft=new WeakMap;yt=new WeakMap;pt=new WeakMap;jt=new WeakMap;Nt=new WeakMap;$(Or,"NAME","Sui MetaMask Snap");var ar=Or;function Ai(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var i=e.charAt(n),o=i.charCodeAt(0);if(t[o]!==255)throw new TypeError(i+" is ambiguous");t[o]=n}var a=e.length,l=e.charAt(0),c=Math.log(a)/Math.log(256),g=Math.log(256)/Math.log(a);function d(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var y=0,T=0,f=0,S=h.length;f!==S&&h[f]===0;)f++,y++;for(var C=(S-f)*g+1>>>0,w=new Uint8Array(C);f!==S;){for(var F=h[f],R=0,q=C-1;(F!==0||R<T)&&q!==-1;q--,R++)F+=256*w[q]>>>0,w[q]=F%a>>>0,F=F/a>>>0;if(F!==0)throw new Error("Non-zero carry");T=R,f++}for(var oe=C-T;oe!==C&&w[oe]===0;)oe++;for(var _e=l.repeat(y);oe<C;++oe)_e+=e.charAt(w[oe]);return _e}function A(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;for(var y=0,T=0,f=0;h[y]===l;)T++,y++;for(var S=(h.length-y)*c+1>>>0,C=new Uint8Array(S);h[y];){var w=t[h.charCodeAt(y)];if(w===255)return;for(var F=0,R=S-1;(w!==0||F<f)&&R!==-1;R--,F++)w+=a*C[R]>>>0,C[R]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");f=F,y++}for(var q=S-f;q!==S&&C[q]===0;)q++;for(var oe=new Uint8Array(T+(S-q)),_e=T;q!==S;)oe[_e++]=C[q++];return oe}function j(h){var y=A(h);if(y)return y;throw new Error("Non-base"+a+" character")}return{encode:d,decodeUnsafe:A,decode:j}}var hi=Ai;const Ii=hi,fi="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var yi=Ii(fi);const Pr=B.getDefaultExportFromCjs(yi);function pi(e){return e>64&&e<91?e-65:e>96&&e<123?e-71:e>47&&e<58?e+4:e===43?62:e===47?63:0}function Ce(e,t){for(var r=e.replace(/[^A-Za-z0-9+/]/g,""),n=r.length,i=n*3+1>>2,o=new Uint8Array(i),a,l,c=0,g=0,d=0;d<n;d++)if(l=d&3,c|=pi(r.charCodeAt(d))<<6*(3-l),l===3||n-d===1){for(a=0;a<3&&g<i;a++,g++)o[g]=c>>>(16>>>a&24)&255;c=0}return o}function et(e){return e<26?e+65:e<52?e+71:e<62?e-4:e===62?43:e===63?47:65}function Ee(e){for(var t=2,r="",n=e.length,i=0,o=0;o<n;o++)t=o%3,o>0&&o*4/3%76===0&&(r+=""),i|=e[o]<<(16>>>t&24),(t===2||e.length-o===1)&&(r+=String.fromCodePoint(et(i>>>18&63),et(i>>>12&63),et(i>>>6&63),et(i&63)),i=0);return r.slice(0,r.length-2+t)+(t===2?"":t===1?"=":"==")}function Pt(e){let t=e.replace("0x","").match(/.{1,2}/g).map(r=>parseInt(r,16));if(t===null)throw new Error(`Unable to parse HEX: ${e}`);return Uint8Array.from(t)}function Rt(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}var ji=32;function Mt(e,t){let r=new Uint8Array(t),n=0;for(;e>0;)r[n]=Number(e%BigInt(256)),e=e/BigInt(256),n+=1;return r}var Ut=e=>Pr.encode(e),Gt=e=>Pr.decode(e),Ni=class{constructor(e){this.bytePosition=0,this.dataView=new DataView(e.buffer)}shift(e){return this.bytePosition+=e,this}read8(){let e=this.dataView.getUint8(this.bytePosition);return this.shift(1),e}read16(){let e=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),e}read32(){let e=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),e}read64(){let e=this.read32(),r=this.read32().toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+r).toString(10)}read128(){let e=BigInt(this.read64()),r=BigInt(this.read64()).toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+r).toString(10)}read256(){let e=BigInt(this.read128()),r=BigInt(this.read128()).toString(16)+e.toString(16).padStart(16,"0");return BigInt("0x"+r).toString(10)}readBytes(e){let t=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,t,e);return this.shift(e),r}readULEB(){let e=this.bytePosition+this.dataView.byteOffset,t=new Uint8Array(this.dataView.buffer,e),{value:r,length:n}=wi(t);return this.shift(n),r}readVec(e){let t=this.readULEB(),r=[];for(let n=0;n<t;n++)r.push(e(this,n,t));return r}},Ti=class{constructor({size:e=1024,maxSize:t,allocateSize:r=1024}={}){this.bytePosition=0,this.size=e,this.maxSize=t||e,this.allocateSize=r,this.dataView=new DataView(new ArrayBuffer(e))}ensureSizeOrGrow(e){const t=this.bytePosition+e;if(t>this.size){const r=Math.min(this.maxSize,this.size+this.allocateSize);if(t>r)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${t}`);this.size=r;const n=new ArrayBuffer(this.size);new Uint8Array(n).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(n)}}shift(e){return this.bytePosition+=e,this}write8(e){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(e)),this.shift(1)}write16(e){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(e),!0),this.shift(2)}write32(e){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(e),!0),this.shift(4)}write64(e){return Mt(BigInt(e),8).forEach(t=>this.write8(t)),this}write128(e){return Mt(BigInt(e),16).forEach(t=>this.write8(t)),this}write256(e){return Mt(BigInt(e),32).forEach(t=>this.write8(t)),this}writeULEB(e){return mi(e).forEach(t=>this.write8(t)),this}writeVec(e,t){return this.writeULEB(e.length),Array.from(e).forEach((r,n)=>t(this,r,n,e.length)),this}*[Symbol.iterator](){for(let e=0;e<this.bytePosition;e++)yield this.dataView.getUint8(e);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(e){return Si(this.toBytes(),e)}};function mi(e){let t=[],r=0;if(e===0)return[0];for(;e>0;)t[r]=e&127,(e>>=7)&&(t[r]|=128),r+=1;return t}function wi(e){let t=0,r=0,n=0;for(;;){let i=e[n];if(n+=1,t|=(i&127)<<r,!(i&128))break;r+=7}return{value:t,length:n}}var We=class{constructor(e){if(this.types=new Map,this.counter=0,e instanceof We){this.schema=e.schema,this.types=new Map(e.types);return}if(this.schema=e,this.registerAddressType(We.ADDRESS,e.addressLength,e.addressEncoding),this.registerVectorType(e.vectorType),e.types&&e.types.structs)for(let t of Object.keys(e.types.structs))this.registerStructType(t,e.types.structs[t]);if(e.types&&e.types.enums)for(let t of Object.keys(e.types.enums))this.registerEnumType(t,e.types.enums[t]);if(e.types&&e.types.aliases)for(let t of Object.keys(e.types.aliases))this.registerAlias(t,e.types.aliases[t]);e.withPrimitives!==!1&&Ei(this)}tempKey(){return`bcs-struct-${++this.counter}`}ser(e,t,r){if(typeof e=="string"||Array.isArray(e)){const{name:n,params:i}=this.parseTypeName(e);return this.getTypeInterface(n).encode(this,t,r,i)}if(typeof e=="object"){const n=this.tempKey();return new We(this).registerStructType(n,e).ser(n,t,r)}throw new Error(`Incorrect type passed into the '.ser()' function.
1
+ "use strict";var vn=Object.defineProperty;var xn=(e,t,r)=>t in e?vn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var k=(e,t,r)=>xn(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Sr=require("./wallets-5qGJd8Hk.js"),kn=require("./util-G2vxTeU2.js"),B=require("./index-DU1he9Nx.js");function zn(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0))}const dt=8192;function Dr(e){if(e.length<dt)return btoa(String.fromCharCode(...e));let t="";for(var r=0;r<e.length;r+=dt){const n=e.slice(r,r+dt);t+=String.fromCharCode(...n)}return btoa(t)}const On=32;function Bn(e,t=!1){let r=e.toLowerCase();return!t&&r.startsWith("0x")&&(r=r.slice(2)),`0x${r.padStart(On*2,"0")}`}function Er(e,t=!1){return Bn(e,t)}BigInt(1e9);Er("0x6");Er("0x5");let Pn=class extends TypeError{constructor(t,r){let n;const{message:i,explanation:o,...a}=t,{path:l}=t,c=l.length===0?i:`At path: ${l.join(".")} -- ${i}`;super(o??c),o!=null&&(this.cause=c),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}};function Rn(e){return be(e)&&typeof e[Symbol.iterator]=="function"}function be(e){return typeof e=="object"&&e!=null}function Le(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function Un(e){const{done:t,value:r}=e.next();return t?void 0:r}function Gn(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:o}=t,{type:a}=r,{refinement:l,message:c=`Expected a value of type \`${a}\`${l?` with refinement \`${l}\``:""}, but received: \`${Le(n)}\``}=e;return{value:n,type:a,refinement:l,key:i[i.length-1],path:i,branch:o,...e,message:c}}function*tr(e,t,r,n){Rn(e)||(e=[e]);for(const i of e){const o=Gn(i,t,r,n);o&&(yield o)}}function*xt(e,t,r={}){const{path:n=[],branch:i=[e],coerce:o=!1,mask:a=!1}=r,l={path:n,branch:i};if(o&&(e=t.coercer(e,l),a&&t.type!=="type"&&be(t.schema)&&be(e)&&!Array.isArray(e)))for(const g in e)t.schema[g]===void 0&&delete e[g];let c="valid";for(const g of t.validator(e,l))g.explanation=r.message,c="not_valid",yield[g,void 0];for(let[g,d,A]of t.entries(e,l)){const j=xt(d,A,{path:g===void 0?n:[...n,g],branch:g===void 0?i:[...i,d],coerce:o,mask:a,message:r.message});for(const h of j)h[0]?(c=h[0].refinement!=null?"not_refined":"not_valid",yield[h[0],void 0]):o&&(d=h[1],g===void 0?e=d:e instanceof Map?e.set(g,d):e instanceof Set?e.add(d):be(e)&&(d!==void 0||g in e)&&(e[g]=d))}if(c!=="not_valid")for(const g of t.refiner(e,l))g.explanation=r.message,c="not_refined",yield[g,void 0];c==="valid"&&(yield[void 0,e])}let Ue=class{constructor(t){const{type:r,schema:n,validator:i,refiner:o,coercer:a=c=>c,entries:l=function*(){}}=t;this.type=r,this.schema=n,this.entries=l,this.coercer=a,i?this.validator=(c,g)=>{const d=i(c,g);return tr(d,g,this,c)}:this.validator=()=>[],o?this.refiner=(c,g)=>{const d=o(c,g);return tr(d,g,this,c)}:this.refiner=()=>[]}assert(t,r){return Qn(t,this,r)}create(t,r){return Yn(t,this,r)}is(t){return Zn(t,this)}mask(t,r){return Wn(t,this,r)}validate(t,r={}){return qe(t,this,r)}};function Qn(e,t,r){const n=qe(e,t,{message:r});if(n[0])throw n[0]}function Yn(e,t,r){const n=qe(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Wn(e,t,r){const n=qe(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function Zn(e,t){return!qe(e,t)[0]}function qe(e,t,r={}){const n=xt(e,t,r),i=Un(n);return i[0]?[new Pn(i[0],function*(){for(const a of n)a[0]&&(yield a[0])}),void 0]:[void 0,i[1]]}function kt(e,t){return new Ue({type:e,schema:null,validator:t})}function rr(e){return new Ue({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${Le(t)}`}})}function ze(){return kt("boolean",e=>typeof e=="boolean")}function $e(e){const t=Le(e),r=typeof e;return new Ue({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${Le(n)}`}})}function Vn(){return kt("never",()=>!1)}function Ge(e){const t=e?Object.keys(e):[],r=Vn();return new Ue({type:"object",schema:e||null,*entries(n){if(e&&be(n)){const i=new Set(Object.keys(n));for(const o of t)i.delete(o),yield[o,n[o],e[o]];for(const o of i)yield[o,n[o],r]}},validator(n){return be(n)||`Expected an object, but received: ${Le(n)}`},coercer(n){return be(n)?{...n}:n}})}function ne(e){return new Ue({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function W(){return kt("string",e=>typeof e=="string"||`Expected a string, but received: ${Le(e)}`)}function Fn(e){const t=e.map(r=>r.type).join(" | ");return new Ue({type:"union",schema:null,coercer(r){for(const n of e){const[i,o]=n.validate(r,{coerce:!0});if(!i)return o}return r},validator(r,n){const i=[];for(const o of e){const[...a]=xt(r,o,n),[l]=a;if(l[0])for(const[c]of a)c&&i.push(c);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${Le(r)}`,...i]}})}var Jn=Object.defineProperty,Hn=(e,t,r)=>t in e?Jn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$=(e,t,r)=>(Hn(e,typeof t!="symbol"?t+"":t,r),r),br=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},K=(e,t,r)=>(br(e,t,"read from private field"),r?r.call(e):t.get(e)),ae=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},J=(e,t,r,n)=>(br(e,t,"write to private field"),t.set(e,r),r),zt=Ge({address:W(),publicKey:W(),chains:rr(W()),features:rr(W()),label:ne(W()),icon:ne(W())});function Ot(e){return{address:e.address,publicKey:Dr(e.publicKey),features:[...e.features],chains:[...e.chains],label:e.label,icon:e.icon}}function Xn(e){return{address:e.address,publicKey:zn(e.publicKey),chains:e.chains.map(t=>t),features:e.features.map(t=>t),label:e.label,icon:e.icon}}Ge({message:W(),account:zt});function qn(e){return{message:Dr(e.message),account:Ot(e.account)}}Ge({transactionBlock:W(),account:zt,chain:W()});function Kn(e){return{transactionBlock:e.transactionBlock.serialize(),account:Ot(e.account),chain:e.chain}}var _n=Ge({showBalanceChanges:ne(ze()),showEffects:ne(ze()),showEvents:ne(ze()),showInput:ne(ze()),showObjectChanges:ne(ze()),showRawInput:ne(ze())});Ge({transactionBlock:W(),account:zt,chain:W(),requestType:ne(W()),options:ne(_n)});function $n(e){return{transactionBlock:e.transactionBlock.serialize(),account:Ot(e.account),chain:e.chain,requestType:e.requestType,options:e.options}}Ge({network:Fn([$e("mainnet"),$e("testnet"),$e("devnet"),$e("localnet")]),url:W()});const ei="sui:devnet",ti="sui:testnet",ri="sui:localnet",ni="sui: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yMy42LTQ2em03MSAyNi40IDMuMy01Ny43IDE1LjItNDEuMWgtNjcuNWwxNSA0MS4xIDMuNSA1Ny43IDEuMiAxOC4yLjEgNDQuOGgyNy43bC4yLTQ0Ljh6IiBjbGFzcz0ic3Q2Ii8+Cjwvc3ZnPg==",Lr=class Te extends Error{constructor(t){super(`${Te.type}: ${t}}`),$(this,"type",Te.type)}static asSimpleError(t){return new Error(`${Te.type}: ${t}`)}static isSimpleErrorMessage(t){return t.startsWith(Te.type+": ")}static fromSimpleErrorMessage(t){return new Te(t.slice(Te.type.length+2))}};$(Lr,"type","INVALID_REQUEST_PARAMS");var nr=Lr,Cr=class Ye extends Error{constructor(){super(Ye.type),$(this,"type",Ye.type)}static asSimpleError(){return new Error(Ye.type)}static isSimpleErrorMessage(t){return t===Ye.type}};$(Cr,"type","USER_REJECTION");var ht=Cr,vr=class me extends Error{constructor(t){super(`${me.type}: ${t}`),$(this,"type",me.type)}static asSimpleError(t){return new Error(`${me.type}: ${t}`)}static isSimpleErrorMessage(t){return t.startsWith(me.type+": ")}static fromSimpleErrorMessage(t){return new me(t.slice(me.type.length+2))}};$(vr,"type","INVALID_REQUEST_METHOD");var ir=vr,xr=class we extends Error{constructor(t){let r=we.type;t&&(r+=": "+t),super(r),$(this,"type",we.type)}static asSimpleError(t){let r=we.type;return t&&(r+=": "+t),new Error(r)}static isSimpleErrorMessage(t){return t.startsWith(we.type)}static fromSimpleErrorMessage(t){return new we(t.slice(we.type.length+2))}};$(xr,"type","DRY_RUN_FAILED");var sr=xr,kr=class st extends Error{constructor(){super(st.type),$(this,"type",ht.type)}static asSimpleError(){return new Error(st.type)}static isSimpleErrorMessage(t){return t===st.type}};$(kr,"type","NON_ADMIN_ORIGIN");var or=kr;function oi(e){return typeof e=="object"&&e!==null&&"message"in e}function Bt(e){return oi(e)?nr.isSimpleErrorMessage(e.message)?nr.fromSimpleErrorMessage(e.message):ht.isSimpleErrorMessage(e.message)?new ht:ir.isSimpleErrorMessage(e.message)?ir.fromSimpleErrorMessage(e.message):sr.isSimpleErrorMessage(e.message)?sr.fromSimpleErrorMessage(e.message):or.isSimpleErrorMessage(e.message)?new or:e:e}var Ke="npm:@kunalabs-io/sui-metamask-snap",ai="^1.0.0";function ci(){const e=Sr.getWallets();for(const r of e.get())if(r.name===ar.NAME)return console.warn("SuiSnapWallet already registered"),r;const t=new ar;return e.register(t),t}async function ui(e){return(await e.request({method:"wallet_invokeSnap",params:{snapId:Ke,request:{method:"getAccounts"}}})).map(r=>new kn.ReadonlyWalletAccount(Xn(r)))}async function zr(e,t){const r=qn(t);try{return await e.request({method:"wallet_invokeSnap",params:{snapId:Ke,request:{method:"signPersonalMessage",params:JSON.parse(JSON.stringify(r))}}})}catch(n){throw Bt(n)}}async function li(e,t){const r=await zr(e,t);return{messageBytes:r.bytes,signature:r.signature}}async function gi(e,t){const r=Kn(t);try{return await e.request({method:"wallet_invokeSnap",params:{snapId:Ke,request:{method:"signTransactionBlock",params:JSON.parse(JSON.stringify(r))}}})}catch(n){throw Bt(n)}}async function di(e,t){const r=$n(t);try{return await e.request({method:"wallet_invokeSnap",params:{snapId:Ke,request:{method:"signAndExecuteTransactionBlock",params:JSON.parse(JSON.stringify(r))}}})}catch(n){throw Bt(n)}}async function Mi(){const e=window.ethereum;if(!e)return{available:!1,supportsSnaps:!1,suiSnapInstalled:!1};if(!e.isMetaMask)return{available:!1,suiSnapInstalled:!1,supportsSnaps:!1};try{const t=await e.request({method:"web3_clientVersion"}),r=await e.request({method:"wallet_getSnaps"}),n=!!r&&"npm:@kunalabs-io/sui-metamask-snap"in r;return{available:!0,version:t,supportsSnaps:!0,suiSnapInstalled:n}}catch(t){return console.warn(t),{available:!0,supportsSnaps:!1,suiSnapInstalled:!1}}}var ue,fe,Be,It,ft,yt,pt,jt,Nt,Or=class Br{constructor(){ae(this,ue,void 0),ae(this,fe,void 0),ae(this,Be,null),ae(this,It,async()=>{if(K(this,ue))throw new Error("Already connecting");J(this,ue,!0),J(this,fe,!1);try{const t=window.ethereum;if(!(await Mi()).available)throw new Error("MetaMask not detected!");return await t.request({method:"wallet_requestSnaps",params:{[Ke]:{version:ai}}}),J(this,Be,await ui(t)),J(this,ue,!1),J(this,fe,!0),{accounts:this.accounts}}catch(t){throw J(this,ue,!1),J(this,fe,!1),t}}),ae(this,ft,async()=>{J(this,ue,!1),J(this,fe,!1),J(this,Be,null)}),ae(this,yt,async t=>zr(window.ethereum,t)),ae(this,pt,async t=>li(window.ethereum,t)),ae(this,jt,async t=>gi(window.ethereum,t)),ae(this,Nt,async t=>di(window.ethereum,t)),J(this,ue,!1),J(this,fe,!1)}get version(){return"1.0.0"}get name(){return Br.NAME}get icon(){return si}get chains(){return ii}get connecting(){return K(this,ue)}get accounts(){return K(this,fe)&&K(this,Be)?K(this,Be):[]}get features(){return{"standard:connect":{version:"1.0.0",connect:K(this,It)},"standard:disconnect":{version:"1.0.0",disconnect:K(this,ft)},"sui:signPersonalMessage":{version:"1.0.0",signPersonalMessage:K(this,yt)},"sui:signMessage":{version:"1.0.0",signMessage:K(this,pt)},"sui:signTransactionBlock":{version:"1.0.0",signTransactionBlock:K(this,jt)},"sui:signAndExecuteTransactionBlock":{version:"1.0.0",signAndExecuteTransactionBlock:K(this,Nt)},"standard:events":{version:"1.0.0",on:()=>()=>{}}}}};ue=new WeakMap;fe=new WeakMap;Be=new WeakMap;It=new WeakMap;ft=new WeakMap;yt=new WeakMap;pt=new WeakMap;jt=new WeakMap;Nt=new WeakMap;$(Or,"NAME","Sui MetaMask Snap");var ar=Or;function Ai(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var n=0;n<e.length;n++){var i=e.charAt(n),o=i.charCodeAt(0);if(t[o]!==255)throw new TypeError(i+" is ambiguous");t[o]=n}var a=e.length,l=e.charAt(0),c=Math.log(a)/Math.log(256),g=Math.log(256)/Math.log(a);function d(h){if(h instanceof Uint8Array||(ArrayBuffer.isView(h)?h=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):Array.isArray(h)&&(h=Uint8Array.from(h))),!(h instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(h.length===0)return"";for(var y=0,T=0,f=0,S=h.length;f!==S&&h[f]===0;)f++,y++;for(var C=(S-f)*g+1>>>0,w=new Uint8Array(C);f!==S;){for(var F=h[f],R=0,q=C-1;(F!==0||R<T)&&q!==-1;q--,R++)F+=256*w[q]>>>0,w[q]=F%a>>>0,F=F/a>>>0;if(F!==0)throw new Error("Non-zero carry");T=R,f++}for(var oe=C-T;oe!==C&&w[oe]===0;)oe++;for(var _e=l.repeat(y);oe<C;++oe)_e+=e.charAt(w[oe]);return _e}function A(h){if(typeof h!="string")throw new TypeError("Expected String");if(h.length===0)return new Uint8Array;for(var y=0,T=0,f=0;h[y]===l;)T++,y++;for(var S=(h.length-y)*c+1>>>0,C=new Uint8Array(S);h[y];){var w=t[h.charCodeAt(y)];if(w===255)return;for(var F=0,R=S-1;(w!==0||F<f)&&R!==-1;R--,F++)w+=a*C[R]>>>0,C[R]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");f=F,y++}for(var q=S-f;q!==S&&C[q]===0;)q++;for(var oe=new Uint8Array(T+(S-q)),_e=T;q!==S;)oe[_e++]=C[q++];return oe}function j(h){var y=A(h);if(y)return y;throw new Error("Non-base"+a+" character")}return{encode:d,decodeUnsafe:A,decode:j}}var hi=Ai;const Ii=hi,fi="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var yi=Ii(fi);const Pr=B.getDefaultExportFromCjs(yi);function pi(e){return e>64&&e<91?e-65:e>96&&e<123?e-71:e>47&&e<58?e+4:e===43?62:e===47?63:0}function Ce(e,t){for(var r=e.replace(/[^A-Za-z0-9+/]/g,""),n=r.length,i=n*3+1>>2,o=new Uint8Array(i),a,l,c=0,g=0,d=0;d<n;d++)if(l=d&3,c|=pi(r.charCodeAt(d))<<6*(3-l),l===3||n-d===1){for(a=0;a<3&&g<i;a++,g++)o[g]=c>>>(16>>>a&24)&255;c=0}return o}function et(e){return e<26?e+65:e<52?e+71:e<62?e-4:e===62?43:e===63?47:65}function Ee(e){for(var t=2,r="",n=e.length,i=0,o=0;o<n;o++)t=o%3,o>0&&o*4/3%76===0&&(r+=""),i|=e[o]<<(16>>>t&24),(t===2||e.length-o===1)&&(r+=String.fromCodePoint(et(i>>>18&63),et(i>>>12&63),et(i>>>6&63),et(i&63)),i=0);return r.slice(0,r.length-2+t)+(t===2?"":t===1?"=":"==")}function Pt(e){let t=e.replace("0x","").match(/.{1,2}/g).map(r=>parseInt(r,16));if(t===null)throw new Error(`Unable to parse HEX: ${e}`);return Uint8Array.from(t)}function Rt(e){return e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}var ji=32;function Mt(e,t){let r=new Uint8Array(t),n=0;for(;e>0;)r[n]=Number(e%BigInt(256)),e=e/BigInt(256),n+=1;return r}var Ut=e=>Pr.encode(e),Gt=e=>Pr.decode(e),Ni=class{constructor(e){this.bytePosition=0,this.dataView=new DataView(e.buffer)}shift(e){return this.bytePosition+=e,this}read8(){let e=this.dataView.getUint8(this.bytePosition);return this.shift(1),e}read16(){let e=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),e}read32(){let e=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),e}read64(){let e=this.read32(),r=this.read32().toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+r).toString(10)}read128(){let e=BigInt(this.read64()),r=BigInt(this.read64()).toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+r).toString(10)}read256(){let e=BigInt(this.read128()),r=BigInt(this.read128()).toString(16)+e.toString(16).padStart(16,"0");return BigInt("0x"+r).toString(10)}readBytes(e){let t=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,t,e);return this.shift(e),r}readULEB(){let e=this.bytePosition+this.dataView.byteOffset,t=new Uint8Array(this.dataView.buffer,e),{value:r,length:n}=wi(t);return this.shift(n),r}readVec(e){let t=this.readULEB(),r=[];for(let n=0;n<t;n++)r.push(e(this,n,t));return r}},Ti=class{constructor({size:e=1024,maxSize:t,allocateSize:r=1024}={}){this.bytePosition=0,this.size=e,this.maxSize=t||e,this.allocateSize=r,this.dataView=new DataView(new ArrayBuffer(e))}ensureSizeOrGrow(e){const t=this.bytePosition+e;if(t>this.size){const r=Math.min(this.maxSize,this.size+this.allocateSize);if(t>r)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${t}`);this.size=r;const n=new ArrayBuffer(this.size);new Uint8Array(n).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(n)}}shift(e){return this.bytePosition+=e,this}write8(e){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(e)),this.shift(1)}write16(e){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(e),!0),this.shift(2)}write32(e){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(e),!0),this.shift(4)}write64(e){return Mt(BigInt(e),8).forEach(t=>this.write8(t)),this}write128(e){return Mt(BigInt(e),16).forEach(t=>this.write8(t)),this}write256(e){return Mt(BigInt(e),32).forEach(t=>this.write8(t)),this}writeULEB(e){return mi(e).forEach(t=>this.write8(t)),this}writeVec(e,t){return this.writeULEB(e.length),Array.from(e).forEach((r,n)=>t(this,r,n,e.length)),this}*[Symbol.iterator](){for(let e=0;e<this.bytePosition;e++)yield this.dataView.getUint8(e);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(e){return Si(this.toBytes(),e)}};function mi(e){let t=[],r=0;if(e===0)return[0];for(;e>0;)t[r]=e&127,(e>>=7)&&(t[r]|=128),r+=1;return t}function wi(e){let t=0,r=0,n=0;for(;;){let i=e[n];if(n+=1,t|=(i&127)<<r,!(i&128))break;r+=7}return{value:t,length:n}}var We=class{constructor(e){if(this.types=new Map,this.counter=0,e instanceof We){this.schema=e.schema,this.types=new Map(e.types);return}if(this.schema=e,this.registerAddressType(We.ADDRESS,e.addressLength,e.addressEncoding),this.registerVectorType(e.vectorType),e.types&&e.types.structs)for(let t of Object.keys(e.types.structs))this.registerStructType(t,e.types.structs[t]);if(e.types&&e.types.enums)for(let t of Object.keys(e.types.enums))this.registerEnumType(t,e.types.enums[t]);if(e.types&&e.types.aliases)for(let t of Object.keys(e.types.aliases))this.registerAlias(t,e.types.aliases[t]);e.withPrimitives!==!1&&Ei(this)}tempKey(){return`bcs-struct-${++this.counter}`}ser(e,t,r){if(typeof e=="string"||Array.isArray(e)){const{name:n,params:i}=this.parseTypeName(e);return this.getTypeInterface(n).encode(this,t,r,i)}if(typeof e=="object"){const n=this.tempKey();return new We(this).registerStructType(n,e).ser(n,t,r)}throw new Error(`Incorrect type passed into the '.ser()' function.
2
2
  ${JSON.stringify(e)}`)}de(e,t,r){if(typeof t=="string")if(r)t=Di(t,r);else throw new Error("To pass a string to `bcs.de`, specify encoding");if(typeof e=="string"||Array.isArray(e)){const{name:n,params:i}=this.parseTypeName(e);return this.getTypeInterface(n).decode(this,t,i)}if(typeof e=="object"){const n=new We(this),i=this.tempKey();return n.registerStructType(i,e).de(i,t,r)}throw new Error(`Incorrect type passed into the '.de()' function.
3
3
  ${JSON.stringify(e)}`)}hasType(e){return this.types.has(e)}registerAlias(e,t){return this.types.set(e,t),this}registerType(e,t,r,n=()=>!0){const{name:i,params:o}=this.parseTypeName(e);return this.types.set(i,{encode(a,l,c,g){const d=o.reduce((A,j,h)=>Object.assign(A,{[j]:g[h]}),{});return this._encodeRaw.call(a,new Ti(c),l,g,d)},decode(a,l,c){const g=o.reduce((d,A,j)=>Object.assign(d,{[A]:c[j]}),{});return this._decodeRaw.call(a,new Ni(l),c,g)},_encodeRaw(a,l,c,g){if(n(l))return t.call(this,a,l,c,g);throw new Error(`Validation failed for type ${i}, data: ${l}`)},_decodeRaw(a,l,c){return r.call(this,a,l,c)}}),this}registerAddressType(e,t,r="hex"){switch(r){case"base64":return this.registerType(e,function(i,o){return Ce(o).reduce((a,l)=>a.write8(l),i)},function(i){return Ee(i.readBytes(t))});case"hex":return this.registerType(e,function(i,o){return Pt(o).reduce((a,l)=>a.write8(l),i)},function(i){return Rt(i.readBytes(t))});default:throw new Error("Unsupported encoding! Use either hex or base64")}}registerVectorType(e){let{name:t,params:r}=this.parseTypeName(e);if(r.length>1)throw new Error("Vector can have only one type parameter; got "+t);return this.registerType(e,function(i,o,a,l){return i.writeVec(o,(c,g)=>{let d=a[0];if(!d)throw new Error(`Incorrect number of type parameters passed a to vector '${e}'`);let{name:A,params:j}=this.parseTypeName(d);if(this.hasType(A))return this.getTypeInterface(A)._encodeRaw.call(this,c,g,j,l);if(!(A in l))throw new Error(`Unable to find a matching type definition for ${A} in vector; make sure you passed a generic`);let{name:h,params:y}=this.parseTypeName(l[A]);return this.getTypeInterface(h)._encodeRaw.call(this,c,g,y,l)})},function(i,o,a){return i.readVec(l=>{let c=o[0];if(!c)throw new Error(`Incorrect number of type parameters passed to a vector '${e}'`);let{name:g,params:d}=this.parseTypeName(c);if(this.hasType(g))return this.getTypeInterface(g)._decodeRaw.call(this,l,d,a);if(!(g in a))throw new Error(`Unable to find a matching type definition for ${g} in vector; make sure you passed a generic`);let{name:A,params:j}=this.parseTypeName(a[g]);this.getTypeInterface(A)._decodeRaw.call(this,l,j,a)})})}registerStructType(e,t){for(let a in t){let l=this.tempKey(),c=t[a];!Array.isArray(c)&&typeof c!="string"&&(t[a]=l,this.registerStructType(l,c))}let r=Object.freeze(t),n=Object.keys(r),{name:i,params:o}=this.parseTypeName(e);return this.registerType(e,function(l,c,g,d){if(!c||c.constructor!==Object)throw new Error(`Expected ${i} to be an Object, got: ${c}`);if(g.length!==o.length)throw new Error(`Incorrect number of generic parameters passed; expected: ${o.length}, got: ${g.length}`);for(let A of n){if(!(A in c))throw new Error(`Struct ${i} requires field ${A}:${r[A]}`);const{name:j,params:h}=this.parseTypeName(r[A]);if(!o.includes(j))this.getTypeInterface(j)._encodeRaw.call(this,l,c[A],h,d);else{const y=o.indexOf(j);let{name:T,params:f}=this.parseTypeName(g[y]);if(this.hasType(T)){this.getTypeInterface(T)._encodeRaw.call(this,l,c[A],f,d);continue}if(!(T in d))throw new Error(`Unable to find a matching type definition for ${T} in ${i}; make sure you passed a generic`);let{name:S,params:C}=this.parseTypeName(d[T]);this.getTypeInterface(S)._encodeRaw.call(this,l,c[A],C,d)}}return l},function(l,c,g){if(c.length!==o.length)throw new Error(`Incorrect number of generic parameters passed; expected: ${o.length}, got: ${c.length}`);let d={};for(let A of n){const{name:j,params:h}=this.parseTypeName(r[A]);if(!o.includes(j))d[A]=this.getTypeInterface(j)._decodeRaw.call(this,l,h,g);else{const y=o.indexOf(j);let{name:T,params:f}=this.parseTypeName(c[y]);if(this.hasType(T)){d[A]=this.getTypeInterface(T)._decodeRaw.call(this,l,f,g);continue}if(!(T in g))throw new Error(`Unable to find a matching type definition for ${T} in ${i}; make sure you passed a generic`);let{name:S,params:C}=this.parseTypeName(g[T]);d[A]=this.getTypeInterface(S)._decodeRaw.call(this,l,C,g)}}return d})}registerEnumType(e,t){for(let a in t){let l=this.tempKey(),c=t[a];c!==null&&!Array.isArray(c)&&typeof c!="string"&&(t[a]=l,this.registerStructType(l,c))}let r=Object.freeze(t),n=Object.keys(r),{name:i,params:o}=this.parseTypeName(e);return this.registerType(e,function(l,c,g,d){if(!c)throw new Error(`Unable to write enum "${i}", missing data.
4
4
  Received: "${c}"`);if(typeof c!="object")throw new Error(`Incorrect data passed into enum "${i}", expected object with properties: "${n.join(" | ")}".
@@ -3,7 +3,7 @@ var On = (e, t, r) => t in e ? zn(e, t, { enumerable: !0, configurable: !0, writ
3
3
  var k = (e, t, r) => On(e, typeof t != "symbol" ? t + "" : t, r);
4
4
  import { g as br } from "./wallets-B2tqS5lZ.mjs";
5
5
  import { R as Bn } from "./util--bw7gFPs.mjs";
6
- import { Q as Pn, O as Rn, as as tr, at as Un, u as Gn, T as Qn, X as rr, au as nr, U as Yn, a3 as _e } from "./index-ndWybTXw.mjs";
6
+ import { Q as Pn, O as Rn, as as tr, at as Un, u as Gn, T as Qn, X as rr, au as nr, U as Yn, a3 as _e } from "./index-ObRYlj1l.mjs";
7
7
  function Wn(e) {
8
8
  return Uint8Array.from(atob(e), (t) => t.charCodeAt(0));
9
9
  }
@@ -1,8 +1,8 @@
1
1
  var j = Object.defineProperty;
2
2
  var Y = (r, e, t) => e in r ? j(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
3
  var w = (r, e, t) => Y(r, typeof e != "symbol" ? e + "" : e, t);
4
- import { s as S, t as m, u as x, v as J, w as X, x as Q, y as N, z as R, B as ee, D as W, F as M, G as te, H as d, I, J as re, K as ne, c as se, L as ie } from "./index-ndWybTXw.mjs";
5
- import { m as oe } from "./index-DCXyETk0.mjs";
4
+ import { s as S, t as m, u as x, v as J, w as X, x as Q, y as N, z as R, B as ee, D as W, F as M, G as te, H as d, I, J as re, K as ne, c as se, L as ie } from "./index-ObRYlj1l.mjs";
5
+ import { m as oe } from "./index-DIdfi9U5.mjs";
6
6
  var E = {};
7
7
  Object.defineProperty(E, "__esModule", { value: !0 });
8
8
  E.bech32m = b = E.bech32 = void 0;
@@ -574,9 +574,9 @@ const De = {
574
574
  Platform: I,
575
575
  getSigner: xe,
576
576
  protocols: {
577
- WormholeCore: () => import("./index-BH5x8knT.mjs"),
578
- TokenBridge: () => import("./index-DrYmbAqE.mjs"),
579
- CircleBridge: () => import("./index-CVVdam36.mjs")
577
+ WormholeCore: () => import("./index-BL_uPuTy.mjs"),
578
+ TokenBridge: () => import("./index-DOLtniOC.mjs"),
579
+ CircleBridge: () => import("./index-DjHz-TGq.mjs")
580
580
  },
581
581
  getChain: (r, e, t) => new re(e, new I(r, se(r, ie, { [e]: t })))
582
582
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wormhole-foundation/wormhole-connect",
3
- "version": "2.4.0-beta.2-development",
3
+ "version": "2.4.0-beta.4-development",
4
4
  "repository": "github:wormhole-foundation/wormhole-connect",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.mjs",
@@ -39,13 +39,13 @@
39
39
  "@solana/spl-token": "0.4.0",
40
40
  "@solana/wallet-adapter-wallets": "0.19.32",
41
41
  "@solana/web3.js": "1.98.0",
42
- "@wormhole-foundation/sdk": "1.14.0",
43
- "@wormhole-foundation/sdk-definitions": "1.14.0",
44
- "@wormhole-foundation/sdk-definitions-ntt": "^0.6.1",
45
- "@wormhole-foundation/sdk-evm-ntt": "^0.6.1",
42
+ "@wormhole-foundation/sdk": "1.14.1",
43
+ "@wormhole-foundation/sdk-definitions": "1.14.1",
44
+ "@wormhole-foundation/sdk-definitions-ntt": "^0.7.1",
45
+ "@wormhole-foundation/sdk-evm-ntt": "^0.7.1",
46
46
  "@wormhole-foundation/sdk-icons": "^1.0.0",
47
- "@wormhole-foundation/sdk-route-ntt": "^0.6.1",
48
- "@wormhole-foundation/sdk-solana-ntt": "^0.6.1",
47
+ "@wormhole-foundation/sdk-route-ntt": "^0.7.1",
48
+ "@wormhole-foundation/sdk-solana-ntt": "^0.7.1",
49
49
  "@xlabs-libs/wallet-aggregator-aptos": "1.0.0-alpha.2",
50
50
  "@xlabs-libs/wallet-aggregator-core": "0.0.1-alpha.23",
51
51
  "@xlabs-libs/wallet-aggregator-evm": "0.0.2-alpha.6",
@@ -169,28 +169,28 @@
169
169
  "axios": "1.4.0"
170
170
  },
171
171
  "@mayanfinance/wormhole-sdk-route": {
172
- "@wormhole-foundation/sdk-connect": "1.14.0",
173
- "@wormhole-foundation/sdk-evm": "1.14.0",
174
- "@wormhole-foundation/sdk-solana": "1.14.0"
172
+ "@wormhole-foundation/sdk-connect": "1.14.1",
173
+ "@wormhole-foundation/sdk-evm": "1.14.1",
174
+ "@wormhole-foundation/sdk-solana": "1.14.1"
175
175
  },
176
176
  "@wormhole-foundation/sdk-definitions-ntt": {
177
- "@wormhole-foundation/sdk-base": "1.14.0",
178
- "@wormhole-foundation/sdk-definitions": "1.14.0"
177
+ "@wormhole-foundation/sdk-base": "1.14.1",
178
+ "@wormhole-foundation/sdk-definitions": "1.14.1"
179
179
  },
180
180
  "@wormhole-foundation/sdk-evm-ntt": {
181
- "@wormhole-foundation/sdk-base": "1.14.0",
182
- "@wormhole-foundation/sdk-definitions": "1.14.0",
183
- "@wormhole-foundation/sdk-evm": "1.14.0",
184
- "@wormhole-foundation/sdk-evm-core": "1.14.0"
181
+ "@wormhole-foundation/sdk-base": "1.14.1",
182
+ "@wormhole-foundation/sdk-definitions": "1.14.1",
183
+ "@wormhole-foundation/sdk-evm": "1.14.1",
184
+ "@wormhole-foundation/sdk-evm-core": "1.14.1"
185
185
  },
186
186
  "@wormhole-foundation/sdk-route-ntt": {
187
- "@wormhole-foundation/sdk-connect": "1.14.0"
187
+ "@wormhole-foundation/sdk-connect": "1.14.1"
188
188
  },
189
189
  "@wormhole-foundation/sdk-solana-ntt": {
190
- "@wormhole-foundation/sdk-base": "1.14.0",
191
- "@wormhole-foundation/sdk-definitions": "1.14.0",
192
- "@wormhole-foundation/sdk-solana": "1.14.0",
193
- "@wormhole-foundation/sdk-solana-core": "1.14.0"
190
+ "@wormhole-foundation/sdk-base": "1.14.1",
191
+ "@wormhole-foundation/sdk-definitions": "1.14.1",
192
+ "@wormhole-foundation/sdk-solana": "1.14.1",
193
+ "@wormhole-foundation/sdk-solana-core": "1.14.1"
194
194
  },
195
195
  "@wormhole-foundation/wormhole-connect": {
196
196
  "aptos": "1.5.2"
@@ -1,17 +0,0 @@
1
- import { S as i, e as r, f as n, c as s, g as t } from "./index-ndWybTXw.mjs";
2
- import { g } from "./signer-CGCrqc_x.mjs";
3
- const m = {
4
- Address: n,
5
- Platform: r,
6
- getSigner: g,
7
- protocols: {
8
- WormholeCore: () => import("./index-ndWybTXw.mjs").then((o) => o.dG),
9
- TokenBridge: () => import("./index-CLqF0DXs.mjs"),
10
- CircleBridge: () => import("./index-BH-QrHNF.mjs"),
11
- TBTCBridge: () => import("./index-B6Sz2PUf.mjs")
12
- },
13
- getChain: (o, a, e) => new i(a, new r(o, s(o, t, { [a]: e })))
14
- };
15
- export {
16
- m as default
17
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-C0mg2EaP.js"),i=require("./signer-Cr8jlyL3.js"),a={Address:e.SolanaAddress,Platform:e.SolanaPlatform,getSigner:i.getSolanaSignAndSendSigner,protocols:{WormholeCore:()=>Promise.resolve().then(()=>require("./index-C0mg2EaP.js")).then(r=>r.index$2),TokenBridge:()=>Promise.resolve().then(()=>require("./index-3LktUEbt.js")),CircleBridge:()=>Promise.resolve().then(()=>require("./index-CvO9BKU8.js")),TBTCBridge:()=>Promise.resolve().then(()=>require("./index-B9gGuUKR.js"))},getChain:(r,o,n)=>new e.SolanaChain(o,new e.SolanaPlatform(r,e.applyChainsConfigConfigOverrides(r,e._platform$1,{[o]:n})))};exports.default=a;