@wormhole-foundation/wormhole-connect 2.5.0-beta.0-development → 2.5.0-beta.1-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.
- package/dist/assets/{aptos-DvAOSqnD.js → aptos-Cepohe0c.js} +1 -1
- package/dist/assets/{aptos-t5JANz4b.js → aptos-DLxgkT5W.js} +3 -3
- package/dist/assets/{blake2b-CzqSqyTv.js → blake2b-BwI-z5NJ.js} +1 -1
- package/dist/assets/{ccip-4EBcfi6P.js → ccip-Bs93R44a.js} +1 -1
- package/dist/assets/{chunk-IMTC3J2M-Cms0K4gx.js → chunk-IMTC3J2M-CWE1FuDc.js} +1 -1
- package/dist/assets/{evm-8e-eySdo.js → evm-CuAzYJaD.js} +2 -2
- package/dist/assets/{evm-CYjbe4kH.js → evm-CxlqE7UV.js} +4 -4
- package/dist/assets/index-4BxLiF2M.js +1 -0
- package/dist/assets/{index-BcX-2q-J.js → index-4bNkfrlF.js} +1 -1
- package/dist/assets/{index-BKj7Inys.js → index-55oWJrMY.js} +1 -1
- package/dist/assets/{index-Ced_GF9G.js → index-6z4IDTS8.js} +1 -1
- package/dist/assets/{index-Dl17aI3S.js → index-8LfOenBd.js} +1 -1
- package/dist/assets/{index-DALVDBZq.js → index-BP8gdgNH.js} +1 -1
- package/dist/assets/{index-CSHmWPOV.js → index-C1f05Vbe.js} +1 -1
- package/dist/assets/{index-CwGBYrGm.js → index-CR4K0-mn.js} +1 -1
- package/dist/assets/index-CR_EuCZh.js +1 -0
- package/dist/assets/{index-CqA1lXp5.js → index-CZTnhsmR.js} +1 -1
- package/dist/assets/{index-C0rvraea.js → index-Cc4sWidw.js} +1 -1
- package/dist/assets/{index-D9U4BOHM.js → index-Cn7Zb7-T.js} +1 -1
- package/dist/assets/{index-DmaqQuhH.js → index-CyxmcHOs.js} +1 -1
- package/dist/assets/{index-Chd_bwGM.js → index-DizukMyh.js} +1 -1
- package/dist/assets/index-DyI3oKqt.js +1 -0
- package/dist/assets/{index-BgVVAYar.js → index-IzL7XNn3.js} +1 -1
- package/dist/assets/{index-SO_H3W5I.js → index-QjsZkUzh.js} +1 -1
- package/dist/assets/{index-CcMXeWAX.js → index-YqzS8F8M.js} +2 -2
- package/dist/assets/{index-M2j4uONF.js → index-e6M9UpWM.js} +1 -1
- package/dist/assets/{index-JtvUouOr.js → index-m0NseVbx.js} +1 -1
- package/dist/assets/{index.es-Bzsluoyw.js → index.es-BSz0aeDf.js} +1 -1
- package/dist/assets/{solana-BHeUantu.js → solana-Cl8jthtC.js} +2 -2
- package/dist/assets/solana-D2ghQqy6.js +2 -0
- package/dist/assets/{solanaEmbed.esm-B7A7qKmk.js → solanaEmbed.esm-LTv0oYB9.js} +1 -1
- package/dist/assets/{sui-CLrvrAHM.js → sui-Ck-FZzH_.js} +1 -1
- package/dist/assets/sui-Ko5G1-gz.js +2 -0
- package/dist/assets/unsignedTransaction-arVvzoJx.js +1 -0
- package/dist/main.js +62 -62
- package/dist/src/AppRouter.d.ts.map +1 -1
- package/dist/src/utils/coingecko.d.ts.map +1 -1
- package/lib/{aptos-D7X5GMcO.js → aptos-8KMeJE-o.js} +2 -2
- package/lib/{aptos-C3Ph4uY9.mjs → aptos-BbifmBP0.mjs} +5 -5
- package/lib/{aptos-Cs46Nns5.mjs → aptos-CKydVwjD.mjs} +2 -2
- package/lib/{aptos-By3qLiAP.js → aptos-DSqOSKNb.js} +1 -1
- package/lib/{base64-B-n8C-1n.js → base64-CpFecuyA.js} +1 -1
- package/lib/{base64-DxqKuhqD.mjs → base64-qaCqMb_l.mjs} +1 -1
- package/lib/{ccip-DgwbitdX.mjs → ccip-CVtTRfyn.mjs} +1 -1
- package/lib/{ccip-BoG9ZHRV.js → ccip-D51RTC0u.js} +1 -1
- package/lib/{chunk-IMTC3J2M-DfLEkM5Z.js → chunk-IMTC3J2M-BxB1b0q0.js} +1 -1
- package/lib/{chunk-IMTC3J2M-w136PyXJ.mjs → chunk-IMTC3J2M-CKg3oVWr.mjs} +3 -3
- package/lib/{evm-BwXOj4Er.js → evm-BLoyv9Lm.js} +3 -3
- package/lib/{evm--NPB9x1d.mjs → evm-CHVaneje.mjs} +5 -5
- package/lib/{evm-OXQXmbRf.mjs → evm-CQZ0vIa8.mjs} +6 -6
- package/lib/{evm-Bta1KBsb.js → evm-RNshiiFP.js} +2 -2
- package/lib/{index-Bpx_Rf1J.js → index-2z8NsIQ8.js} +1 -1
- package/lib/{index-1WX3nZoM.mjs → index-B2bLjM93.mjs} +3 -3
- package/lib/{index-BEHglvs0.js → index-B43BfOtT.js} +1 -1
- package/lib/{index-CKtZvS3X.mjs → index-BBanb5ap.mjs} +2 -2
- package/lib/{index-B3smMSuW.js → index-BKVRZX9z.js} +1 -1
- package/lib/{index-ByicGRKs.mjs → index-BK_P-oYC.mjs} +2 -2
- package/lib/{index-0m16n7L7.js → index-BOiSCkY4.js} +1 -1
- package/lib/{index-C2jvFfvC.js → index-BS2i3Ksw.js} +1 -1
- package/lib/index-BU-5OQwh.js +1 -0
- package/lib/{index-CksJcNrV.mjs → index-B_YK6ETC.mjs} +3 -3
- package/lib/{index-BXc3l4Br.mjs → index-BfTnUr7T.mjs} +2 -2
- package/lib/{index-m0543tB2.mjs → index-BoceUAkG.mjs} +20959 -32801
- package/lib/{index-CDwpyfnd.mjs → index-BuqYv7Vr.mjs} +2 -2
- package/lib/index-Bz1QpdKk.mjs +75 -0
- package/lib/{index-Bi6PAFR8.mjs → index-C1e-lwCm.mjs} +2 -2
- package/lib/{index-wsfzS6PN.js → index-C41PgJpW.js} +120 -120
- package/lib/{index-Cslbrg97.js → index-C4r2UzcB.js} +1 -1
- package/lib/{index-CWffCIQl.js → index-CO4tNP9_.js} +1 -1
- package/lib/{index-BLxoZ8qT.js → index-COs1joOZ.js} +1 -1
- package/lib/index-CbZQJETK.mjs +654 -0
- package/lib/{index-BGqNMVpQ.js → index-CkBBICIC.js} +1 -1
- package/lib/{index-C5tynAhb.mjs → index-Cnb3Fj6a.mjs} +1 -1
- package/lib/{index-NTAse-vE.js → index-CtC0u7hr.js} +1 -1
- package/lib/{index-cyTUScMF.js → index-CxoYsIft.js} +1 -1
- package/lib/index-D-0atbSn.js +1 -0
- package/lib/{index-bDliG7yg.mjs → index-D3vUo86P.mjs} +4 -4
- package/lib/index-D7jGbtAx.js +1 -0
- package/lib/{index-CoEGiDGu.js → index-D9urvMDV.js} +1 -1
- package/lib/{index-50mhIuON.mjs → index-DFk1H3Sj.mjs} +2 -2
- package/lib/{index-DPM7TGSv.mjs → index-DSsxt-9e.mjs} +11 -2
- package/lib/{index-CANn2DFq.mjs → index-DVVD_hZm.mjs} +1 -1
- package/lib/{index-CGbtcED2.mjs → index-Dep8pAGA.mjs} +2 -2
- package/lib/{index-PnMJX4OC.mjs → index-DlqDGm7R.mjs} +1 -1
- package/lib/{index-hFtbBndd.js → index-DrarHdDr.js} +1 -1
- package/lib/{index-FGc8swXY.mjs → index-DsN7YSP1.mjs} +1 -1
- package/lib/{index-CoX_24Ky.mjs → index-DszDWeYi.mjs} +1 -1
- package/lib/{index-MytorfyK.mjs → index-Dv60e2W9.mjs} +2 -2
- package/lib/index-Dwhn5PEn.mjs +191 -0
- package/lib/{index-zMaT9P4V.mjs → index-GVu1wMwM.mjs} +1 -1
- package/lib/{index-B5z5oFY1.js → index-MHSosKrJ.js} +1 -1
- package/lib/{index-DLiQpgMj.js → index-Y_57HCqM.js} +1 -1
- package/lib/{index-Dt0J9sau.js → index-j1N8J-Fe.js} +1 -1
- package/lib/{index-DSejRtdA.js → index-l9KU7K7P.js} +1 -1
- package/lib/{index-ILKgpNXM.js → index-myqdl1wW.js} +1 -1
- package/lib/{index-C86P0A0Y.mjs → index-xYxy17zb.mjs} +1 -1
- package/lib/{index-DlW1-aGm.js → index-zBPInGXF.js} +1 -1
- package/lib/{index.es-Bh1QXm67.mjs → index.es-Ba4xhwJc.mjs} +5 -5
- package/lib/{index.es-DIL345_I.js → index.es-W0q91zRy.js} +2 -2
- package/lib/index.js +1 -1
- package/lib/index.mjs +19 -19
- package/lib/{signer-Br2-fgMa.js → signer-BbJbZn8Y.js} +1 -1
- package/lib/{signer-CeNONJjb.mjs → signer-D0QgWaj3.mjs} +1 -1
- package/lib/solana-B4XQWl46.js +1 -0
- package/lib/solana-Dc2NjQX4.mjs +17 -0
- package/lib/{solana-C5lAA_Eh.mjs → solana-h6jJreZX.mjs} +4 -4
- package/lib/{solana-Bwwk-8HE.js → solana-vP3qaiqp.js} +1 -1
- package/lib/{solanaEmbed.esm-BMTrlSVI.js → solanaEmbed.esm-CQIYNDBD.js} +1 -1
- package/lib/{solanaEmbed.esm-_NPc8tZC.mjs → solanaEmbed.esm-auVokEYr.mjs} +1 -1
- package/lib/src/AppRouter.d.ts.map +1 -1
- package/lib/src/utils/coingecko.d.ts.map +1 -1
- package/lib/{sui-zLYQBpSC.js → sui-BCWyy1OH.js} +1 -1
- package/lib/sui-CCReavtD.mjs +585 -0
- package/lib/{sui-X62i5q3_.mjs → sui-CxwKTlzx.mjs} +1 -1
- package/lib/sui-EheQCqu3.js +1 -0
- package/package.json +17 -17
- package/dist/assets/index-BRtMY3at.js +0 -1
- package/dist/assets/index-BUlVFUMr.js +0 -1
- package/dist/assets/index-RBS_ALc7.js +0 -1
- package/dist/assets/solana-BEFCVrXa.js +0 -2
- package/dist/assets/sui-C1wbtvIC.js +0 -2
- package/lib/index-CNkTJOH_.js +0 -1
- package/lib/index-DN6dWOSB.js +0 -1
- package/lib/index-DUOnxuE_.mjs +0 -252
- package/lib/index-DqFY4i5u.js +0 -1
- package/lib/index-Eomc9IwB.mjs +0 -936
- package/lib/index-fkzogQYE.mjs +0 -376
- package/lib/solana-4Qcfxe9o.js +0 -1
- package/lib/solana-DM9nG3cQ.mjs +0 -17
- package/lib/sui-BvJu9wTN.mjs +0 -701
- package/lib/sui-pGBefbTJ.js +0 -1
package/lib/sui-pGBefbTJ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var z=Object.defineProperty;var V=(n,e,t)=>e in n?z(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var y=(n,e,t)=>V(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-wsfzS6PN.js"),j=require("./index-Dt0J9sau.js");var S={};Object.defineProperty(S,"__esModule",{value:!0});S.bech32m=E=S.bech32=void 0;const x="qpzry9x8gf2tvdw0s3jn54khce6mua7l",U={};for(let n=0;n<x.length;n++){const e=x.charAt(n);U[e]=n}function p(n){const e=n>>25;return(n&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function T(n){let e=1;for(let t=0;t<n.length;++t){const r=n.charCodeAt(t);if(r<33||r>126)return"Invalid prefix ("+n+")";e=p(e)^r>>5}e=p(e);for(let t=0;t<n.length;++t){const r=n.charCodeAt(t);e=p(e)^r&31}return e}function k(n,e,t,r){let i=0,a=0;const s=(1<<t)-1,c=[];for(let u=0;u<n.length;++u)for(i=i<<e|n[u],a+=e;a>=t;)a-=t,c.push(i>>a&s);if(r)a>0&&c.push(i<<t-a&s);else{if(a>=e)return"Excess padding";if(i<<t-a&s)return"Non-zero padding"}return c}function G(n){return k(n,8,5,!0)}function Z(n){const e=k(n,5,8,!1);if(Array.isArray(e))return e}function Y(n){const e=k(n,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}function L(n){let e;n==="bech32"?e=1:e=734539939;function t(s,c,u){if(u=u||90,s.length+7+c.length>u)throw new TypeError("Exceeds length limit");s=s.toLowerCase();let d=T(s);if(typeof d=="string")throw new Error(d);let g=s+"1";for(let l=0;l<c.length;++l){const h=c[l];if(h>>5)throw new Error("Non 5-bit word");d=p(d)^h,g+=x.charAt(h)}for(let l=0;l<6;++l)d=p(d);d^=e;for(let l=0;l<6;++l){const h=d>>(5-l)*5&31;g+=x.charAt(h)}return g}function r(s,c){if(c=c||90,s.length<8)return s+" too short";if(s.length>c)return"Exceeds length limit";const u=s.toLowerCase(),d=s.toUpperCase();if(s!==u&&s!==d)return"Mixed-case string "+s;s=u;const g=s.lastIndexOf("1");if(g===-1)return"No separator character for "+s;if(g===0)return"Missing prefix for "+s;const l=s.slice(0,g),h=s.slice(g+1);if(h.length<6)return"Data too short";let m=T(l);if(typeof m=="string")return m;const P=[];for(let b=0;b<h.length;++b){const _=h.charAt(b),C=U[_];if(C===void 0)return"Unknown character "+_;m=p(m)^C,!(b+6>=h.length)&&P.push(C)}return m!==e?"Invalid checksum for "+s:{prefix:l,words:P}}function i(s,c){const u=r(s,c);if(typeof u=="object")return u}function a(s,c){const u=r(s,c);if(typeof u=="object")return u;throw new Error(u)}return{decodeUnsafe:i,decode:a,encode:t,toWords:G,fromWordsUnsafe:Z,fromWords:Y}}var E=S.bech32=L("bech32");S.bech32m=L("bech32m");function F(n,e){return o.suiBcs.IntentMessage(o.suiBcs.fixedArray(e.length,o.suiBcs.u8())).serialize({intent:{scope:{[n]:!0},version:{V0:!0},appId:{Sui:!0}},value:e}).toBytes()}const I={ED25519:0,Secp256k1:1,Secp256r1:2,MultiSig:3,ZkLogin:5,Passkey:6},X={ED25519:32,Secp256k1:33,Secp256r1:33},O={0:"ED25519",1:"Secp256k1",2:"Secp256r1",3:"MultiSig",5:"ZkLogin",6:"Passkey"};function W(n,e){if(n===e)return!0;if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}class J{equals(e){return W(this.toRawBytes(),e.toRawBytes())}toBase64(){return o.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 o.toBase64(e)}verifyWithIntent(e,t,r){const i=F(r,e),a=o.blake2b(i,{dkLen:32});return this.verify(a,t)}verifyPersonalMessage(e,t){return this.verifyWithIntent(o.suiBcs.vector(o.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 o.normalizeSuiAddress(o.bytesToHex(o.blake2b(this.toSuiBytes(),{dkLen:32})).slice(0,o.SUI_ADDRESS_LENGTH*2))}}function Q(n){const e=o.fromBase64(n),t=O[e[0]];switch(t){case"ED25519":case"Secp256k1":case"Secp256r1":const r=X[t],i=e.slice(1,e.length-r),a=e.slice(1+i.length);return{serializedSignature:n,signatureScheme:t,signature:i,publicKey:a,bytes:e};default:throw new Error("Unsupported signature scheme")}}function ee({signature:n,signatureScheme:e,publicKey:t}){if(!t)throw new Error("`publicKey` is required");const r=t.toRawBytes(),i=new Uint8Array(1+n.length+r.length);return i.set([I[e]]),i.set(n,1),i.set(r,1+n.length),o.toBase64(i)}const A=32,M="suiprivkey";class te{async signWithIntent(e,t){const r=F(t,e),i=o.blake2b(r,{dkLen:32});return{signature:ee({signature:await this.sign(i),signatureScheme:this.getKeyScheme(),publicKey:this.getPublicKey()}),bytes:o.toBase64(e)}}async signTransaction(e){return this.signWithIntent(e,"TransactionData")}async signPersonalMessage(e){const{signature:t}=await this.signWithIntent(o.bcs.vector(o.bcs.u8()).serialize(e).toBytes(),"PersonalMessage");return{bytes:o.toBase64(e),signature:t}}toSuiAddress(){return this.getPublicKey().toSuiAddress()}}class ne extends te{}function re(n){const{prefix:e,words:t}=E.decode(n);if(e!==M)throw new Error("invalid private key prefix");const r=new Uint8Array(E.fromWords(t)),i=r.slice(1);return{schema:O[r[0]],secretKey:i}}function se(n,e){if(n.length!==A)throw new Error("Invalid bytes length");const t=I[e],r=new Uint8Array(n.length+1);return r.set([t]),r.set(n,1),E.encode(M,E.toWords(r))}function D(n){return!!new RegExp("^m\\/44'\\/784'\\/[0-9]+'\\/[0-9]+'\\/[0-9]+'+$").test(n)}function ie(n){return j.mnemonicToSeedSync(n,"")}function oe(n){return o.toHex(ie(n))}const ae="ed25519 seed",ce=2147483648,ue=new RegExp("^m(\\/[0-9]+')+$"),$=n=>n.replace("'",""),le=n=>{const t=o.hmac.create(o.sha512,ae).update(o.fromHex(n)).digest(),r=t.slice(0,32),i=t.slice(32);return{key:r,chainCode:i}},de=({key:n,chainCode:e},t)=>{const r=new ArrayBuffer(4);new DataView(r).setUint32(0,t);const a=new Uint8Array(1+n.length+r.byteLength);a.set(new Uint8Array(1).fill(0)),a.set(n,1),a.set(new Uint8Array(r,0,r.byteLength),n.length+1);const s=o.hmac.create(o.sha512,e).update(a).digest(),c=s.slice(0,32),u=s.slice(32);return{key:c,chainCode:u}},he=n=>ue.test(n)?!n.split("/").slice(1).map($).some(isNaN):!1,R=(n,e,t=ce)=>{if(!he(n))throw new Error("Invalid derivation path");const{key:r,chainCode:i}=le(e);return n.split("/").slice(1).map($).map(s=>parseInt(s,10)).reduce((s,c)=>de(s,c+t),{key:r,chainCode:i})},K=32;class H extends J{constructor(e){if(super(),typeof e=="string"?this.data=o.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 I.ED25519}async verify(e,t){let r;if(typeof t=="string"){const i=Q(t);if(i.signatureScheme!=="ED25519")throw new Error("Invalid signature scheme");if(!W(this.toRawBytes(),i.publicKey))throw new Error("Signature does not match public key");r=i.signature}else r=t;return o.ed25519.verify(r,e,this.toRawBytes())}}H.SIZE=K;const N="m/44'/784'/0'/0'/0'";class w extends ne{constructor(e){if(super(),e)this.keypair={publicKey:e.publicKey,secretKey:e.secretKey.slice(0,32)};else{const t=o.ed25519.utils.randomPrivateKey();this.keypair={publicKey:o.ed25519.getPublicKey(t),secretKey:t}}}getKeyScheme(){return"ED25519"}static generate(){const e=o.ed25519.utils.randomPrivateKey();return new w({publicKey:o.ed25519.getPublicKey(e),secretKey:e})}static fromSecretKey(e,t){if(typeof e=="string"){const a=re(e);if(a.schema!=="ED25519")throw new Error(`Expected a ED25519 keypair, got ${a.schema}`);return this.fromSecretKey(a.secretKey,t)}const r=e.length;if(r!==A)throw new Error(`Wrong secretKey size. Expected ${A} bytes, got ${r}.`);const i={publicKey:o.ed25519.getPublicKey(e),secretKey:e};if(!t||!t.skipValidation){const s=new TextEncoder().encode("sui validation"),c=o.ed25519.sign(s,e);if(!o.ed25519.verify(c,s,i.publicKey))throw new Error("provided secretKey is invalid")}return new w(i)}getPublicKey(){return new H(this.keypair.publicKey)}getSecretKey(){return se(this.keypair.secretKey.slice(0,A),this.getKeyScheme())}async sign(e){return o.ed25519.sign(e,this.keypair.secretKey)}static deriveKeypair(e,t){if(t==null&&(t=N),!D(t))throw new Error("Invalid derivation path");const{key:r}=R(t,oe(e));return w.fromSecretKey(r)}static deriveKeypairFromSeed(e,t){if(t==null&&(t=N),!D(t))throw new Error("Invalid derivation path");const{key:r}=R(t,e);return w.fromSecretKey(r)}}class q extends o.ChainContext{}const B="Sui",fe=n=>{var t;const e=(t=n.data)==null?void 0:t.content;return e&&e.dataType==="moveObject"?e.fields:null},ge=async(n,e)=>{if(!o.isValidSuiAddress(e))throw new Error(`Invalid object ID: ${e}`);const t=await n.getObject({id:e,options:{showContent:!0}});return fe(t)},f=class f extends o.PlatformContext{constructor(e,t){super(e,t??o.networkPlatformConfigs(e,f._platform))}getRpc(e){if(e in this.config)return new o.SuiClient({url:this.config[e].rpc});throw new Error("No configuration available for chain: "+e)}getChain(e){if(e in this.config)return new q(e,this);throw new Error("No configuration available for chain: "+e)}static nativeTokenId(e,t){if(!f.isSupportedChain(t))throw new Error(`invalid chain for ${B}: ${t}`);return o.Wormhole.tokenId(t,o.SUI_COIN)}static isNativeTokenId(e,t,r){return!f.isSupportedChain(t)||r.chain!==t?!1:this.nativeTokenId(e,t)===r}static isSupportedChain(e){return o.chainToPlatform(e)===f._platform}static async getDecimals(e,t,r){if(o.isNative(r))return o.nativeDecimals(f._platform);const i=new o.SuiAddress(r);try{const s=await ge(t,i.toString());if(s&&"decimals"in s)return s.decimals}catch{}const a=await t.getCoinMetadata({coinType:i.toString()});if(a===null)throw new Error(`Can't fetch decimals for token ${i.toString()}`);return a.decimals}static async getCoins(e,t,r){let i=[],a=null;const s=new o.SuiAddress(t).toString();do{const c=await e.getCoins({owner:s,coinType:r,cursor:a});i=[...i,...c.data],a=c.hasNextPage?c.nextCursor:null}while(a);return i}static async getBalance(e,t,r,i){if(o.isNative(i)){const{totalBalance:s}=await t.getBalance({owner:r});return BigInt(s)}const{totalBalance:a}=await t.getBalance({owner:r,coinType:i.toString()});return BigInt(a)}static async getBalances(e,t,r,i){return(await Promise.all(i.map(async s=>{const c=await this.getBalance(e,t,r,s);return{[o.isNative(s)?"native":new o.SuiAddress(s).toString()]:c}}))).reduce((s,c)=>Object.assign(s,c),{})}static async sendWait(e,t,r){const i=[];for(const a of r){const s=await t.executeTransactionBlock(a);await t.waitForTransaction({digest:s.digest}),i.push(s.digest)}return i}static async getLatestBlock(e){return Number(await e.getLatestCheckpointSequenceNumber())}static async getLatestFinalizedBlock(e){return this.getLatestBlock(e)}static chainFromChainId(e){const t=o.platformNativeChainIdToNetworkChain(f._platform,e);if(t===void 0)throw new Error(`Unknown native chain id ${e}`);const[r,i]=t;return[r,i]}static async chainFromRpc(e){const t=await e.call("sui_getChainIdentifier",[]);return this.chainFromChainId(t)}};y(f,"_platform",B);let v=f;async function ye(n,e){const[,t]=await v.chainFromRpc(n);return new we(t,n,w.deriveKeypair(e,"m/44'/784'/0'/0'/0'"))}class we{constructor(e,t,r,i){y(this,"_chain");y(this,"_client");y(this,"_signer");y(this,"_debug");this._chain=e,this._client=t,this._signer=r,this._debug=i}chain(){return this._chain}address(){return this._signer.toSuiAddress()}async signAndSend(e){const t=[];for(const r of e){const{description:i,transaction:a}=r;this._debug&&console.log(`Signing ${i} for ${this.address()}`);try{const s=await this._client.signAndExecuteTransaction({transaction:a,signer:this._signer});t.push(s.digest)}catch(s){throw s}}return t}}const pe={Address:o.SuiAddress,Platform:v,getSigner:ye,protocols:{WormholeCore:()=>Promise.resolve().then(()=>require("./index-DN6dWOSB.js")),TokenBridge:()=>Promise.resolve().then(()=>require("./index-DqFY4i5u.js")),CircleBridge:()=>Promise.resolve().then(()=>require("./index-CNkTJOH_.js"))},getChain:(n,e,t)=>new q(e,new v(n,o.applyChainsConfigConfigOverrides(n,B,{[e]:t})))};exports.default=pe;
|