@wormhole-foundation/wormhole-connect 1.1.2-beta.0-development → 1.1.2-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/{ccip-CE-u3hjx.js → ccip-DG5PxfxZ.js} +1 -1
- package/dist/assets/{evm-BLq4Ynos.js → evm-CpEqLT_y.js} +4 -4
- package/dist/assets/{index-MMpK3g6r.js → index-CDRpv8fM.js} +1 -1
- package/dist/assets/{index-DMkMuW4J.js → index-CsGdgxew.js} +1 -1
- package/dist/assets/{index-DYAKGAkz.js → index-tcDQieq-.js} +2 -2
- package/dist/assets/{index.es-Bc26J4DB.js → index.es-uOIRXoHK.js} +2 -2
- package/dist/main.js +46 -46
- package/dist/src/hooks/useGetTokenBalances.d.ts.map +1 -1
- package/dist/src/store/transferInput.d.ts +0 -1
- package/dist/src/store/transferInput.d.ts.map +1 -1
- package/dist/src/utils/amount.d.ts +4 -0
- package/dist/src/utils/amount.d.ts.map +1 -0
- package/dist/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/Routes/index.d.ts.map +1 -1
- package/lib/{algorand-B5akecmo.js → algorand-DZQLtCs3.js} +1 -1
- package/lib/{algorand-DhEHguU8.mjs → algorand-Dm6TKWo1.mjs} +3 -3
- package/lib/{aptos-CpbWqXlz.js → aptos-BgGyOa6d.js} +1 -1
- package/lib/{aptos-C44Jehb8.mjs → aptos-C2XVzOAY.mjs} +1 -1
- package/lib/{aptos-CCDRMaWb.mjs → aptos-CuJuzlQ4.mjs} +3 -3
- package/lib/{aptos-CecS5KEb.js → aptos-Oi2w7M7g.js} +2 -2
- package/lib/{ccip-D1PJreY0.js → ccip-DpMplNou.js} +1 -1
- package/lib/{ccip-356EqlMD.mjs → ccip-dAqJN7S0.mjs} +1 -1
- package/lib/{cosmos-Cn2Wsc1e.js → cosmos-90bGYuhD.js} +1 -1
- package/lib/{cosmos-CqO6KI9l.mjs → cosmos-zIwOBV8H.mjs} +5 -5
- package/lib/{cosmwasm-CPLhyJUa.mjs → cosmwasm-B90CBMmk.mjs} +6 -6
- package/lib/{cosmwasm-BaxTB3uz.js → cosmwasm-CrtL_ala.js} +2 -2
- package/lib/{events--5HQ-tqg.js → events-COwefqOt.js} +1 -1
- package/lib/{events-DcVnNAVr.mjs → events-CkXgb0qh.mjs} +1 -1
- package/lib/{evm-hMhOEfQO.js → evm-BN522EMV.js} +4 -4
- package/lib/{evm-CpluUYwM.js → evm-BdVnM5pA.js} +1 -1
- package/lib/{evm-18u1yu3s.mjs → evm-DOnB2oR6.mjs} +5 -5
- package/lib/{evm-BJzw-uU0.mjs → evm-ETVyy1bF.mjs} +7 -7
- package/lib/{index-DSc8Fz4U.mjs → index-2r-kWsjk.mjs} +1 -1
- package/lib/{index-BEuF9TxN.js → index-B03mlZnU.js} +1 -1
- package/lib/{index-CexKTLA-.mjs → index-B3rePQFd.mjs} +1 -1
- package/lib/{index-BG8zY-OA.js → index-B5_WNdeb.js} +1 -1
- package/lib/{index-B3RPDMyF.mjs → index-B8U_Gr4R.mjs} +1 -1
- package/lib/{index-BwnJhXyB.mjs → index-BK5v6OjI.mjs} +2 -2
- package/lib/{index-0SReU4B0.mjs → index-BUJ1M7Ob.mjs} +2 -2
- package/lib/{index-BQYIHhaJ.mjs → index-B_6I_1KE.mjs} +6 -6
- package/lib/{index-Bisn-QG_.js → index-Be9Bg4au.js} +1 -1
- package/lib/{index-CjQXzo8p.mjs → index-BiEcDoCp.mjs} +3 -3
- package/lib/{index-CS85YWnw.js → index-C4PiSpuF.js} +1 -1
- package/lib/{index-CvjY28bX.mjs → index-CAO9VKRh.mjs} +1 -1
- package/lib/{index-CVuuC71x.js → index-CKEOPl_r.js} +1 -1
- package/lib/{index-C51caWlO.js → index-CKK14LS0.js} +1 -1
- package/lib/{index-BOD3FZpI.mjs → index-COovR23o.mjs} +2 -2
- package/lib/{index-B25ySG_F.mjs → index-CTVxLNgQ.mjs} +4 -4
- package/lib/{index-C0BuB3OV.mjs → index-CUNm43cC.mjs} +3 -3
- package/lib/{index-6E4lxCFK.js → index-CVFSCRrp.js} +1 -1
- package/lib/{index-BUlkHg7S.js → index-CcPZaBV3.js} +1 -1
- package/lib/{index-Dzv3ssXm.mjs → index-CfsjU0i8.mjs} +2 -2
- package/lib/{index-COPDbEYS.js → index-CjaaWCsQ.js} +4 -4
- package/lib/{index-BW-v5019.mjs → index-CngGxdSU.mjs} +3 -3
- package/lib/{index-9iOOmN3N.js → index-CotIM_QM.js} +1 -1
- package/lib/{index-CXHrbv72.mjs → index-CszotuUi.mjs} +3 -3
- package/lib/{index-BUDCnG5D.mjs → index-Cx4LuiA1.mjs} +2 -2
- package/lib/{index-BC8OEwi7.mjs → index-DCFAlA0r.mjs} +54 -47
- package/lib/{index-BTCXycYv.js → index-DG4r6BgI.js} +1 -1
- package/lib/{index-COwGTp3f.js → index-DUnWVA2t.js} +1 -1
- package/lib/{index-Cdz3m9zK.js → index-DXkh0tUi.js} +1 -1
- package/lib/{index-BjO12prV.mjs → index-D_IvJasJ.mjs} +2 -2
- package/lib/{index-Ck1qa_qW.js → index-DgwozKZn.js} +1 -1
- package/lib/{index-BfK1GMNg.js → index-Dnfo149P.js} +1 -1
- package/lib/{index-CEtHOyR8.mjs → index-Dv2SHpnV.mjs} +2 -2
- package/lib/{index-BAzQP8qT.js → index-Dx54Fq-M.js} +1 -1
- package/lib/{index-GUsAuwgF.js → index-DxTkOnq6.js} +1 -1
- package/lib/{index-CDvw534p.js → index-GIMIwhEX.js} +1 -1
- package/lib/{index-CSxq_OT-.mjs → index-Oa-p0V5E.mjs} +4 -4
- package/lib/{index-D6tUolUd.js → index-RBlsEf3k.js} +1 -1
- package/lib/{index-BgylOxM_.mjs → index-S-6g7te9.mjs} +2 -2
- package/lib/{index-DDg66HWP.js → index-SHXZG1qD.js} +1 -1
- package/lib/{index-CFhbh-Kj.js → index-_6ORrwJQ.js} +1 -1
- package/lib/{index-BBserHK5.js → index-kIexF0uT.js} +1 -1
- package/lib/{index-uUzikh2-.js → index-q0kjBXQA.js} +1 -1
- package/lib/{index-BZ0_iTvc.mjs → index-qCDztmW8.mjs} +1 -1
- package/lib/{index-Bg095l2M.mjs → index-t3NbnUgt.mjs} +2 -2
- package/lib/{index-DJox32A6.mjs → index-uEx_Ty6H.mjs} +2 -2
- package/lib/{index.es-DtN-n4tF.mjs → index.es-DV0FLIto.mjs} +5 -5
- package/lib/{index.es-ADRrRLZe.js → index.es-DXLvY_D0.js} +2 -2
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{keccak-DRlmJq7e.js → keccak-BIz1wVpA.js} +1 -1
- package/lib/{keccak-CUQI4Qmr.mjs → keccak-BUByz5uF.mjs} +1 -1
- package/lib/{libsodium-wrappers-CjurMXAA.mjs → libsodium-wrappers-Cor7IUex.mjs} +1 -1
- package/lib/{libsodium-wrappers-CjL0uEYl.js → libsodium-wrappers-fP6c9wsa.js} +1 -1
- package/lib/{pako.esm-B32OATTo.js → pako.esm-CYeKGWZL.js} +1 -1
- package/lib/{pako.esm-BKtKGYce.mjs → pako.esm-ZR78Kcp_.mjs} +2 -2
- package/lib/{pbkdf2-BQVU9yJ5.mjs → pbkdf2-BXETruEi.mjs} +1 -1
- package/lib/{pbkdf2-BddVwFYF.js → pbkdf2-CtnM_vol.js} +1 -1
- package/lib/{sei-D1BMoXXx.mjs → sei-83rTGsK7.mjs} +3 -3
- package/lib/{sei-Mf2fbrtH.js → sei-BVrV8RIX.js} +1 -1
- package/lib/{signer-Bn45plah.js → signer-DrIAzvo5.js} +1 -1
- package/lib/{signer-BzJfR0s9.mjs → signer-nBgWI7Cp.mjs} +1 -1
- package/lib/{solana-WevFA0nH.js → solana-BHhb_iN6.js} +1 -1
- package/lib/solana-BgoFdxcd.js +1 -0
- package/lib/{solana-XyyQsjkH.mjs → solana-CDYc5Kkf.mjs} +5 -5
- package/lib/{solana-1zE7Ke5_.mjs → solana-DfDEsqum.mjs} +4 -4
- package/lib/{solanaEmbed.esm-95hDJ3L3.js → solanaEmbed.esm-NdMQEmdv.js} +1 -1
- package/lib/{solanaEmbed.esm-1oxYiyoQ.mjs → solanaEmbed.esm-THCQirO0.mjs} +3 -3
- package/lib/src/hooks/useGetTokenBalances.d.ts.map +1 -1
- package/lib/src/store/transferInput.d.ts +0 -1
- package/lib/src/store/transferInput.d.ts.map +1 -1
- package/lib/src/utils/amount.d.ts +4 -0
- package/lib/src/utils/amount.d.ts.map +1 -0
- package/lib/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/Routes/index.d.ts.map +1 -1
- package/lib/{sui-DZX7xKra.js → sui-2OJrRkLv.js} +1 -1
- package/lib/{sui-DeYVi1EQ.mjs → sui-BCKOTjLA.mjs} +4 -4
- package/lib/{sui-DfO-5iUS.mjs → sui-DZw78j9M.mjs} +1 -1
- package/lib/{sui-HQt5WjBV.js → sui-yf1o5y4o.js} +2 -2
- package/lib/{unsignedTransaction-C9lNMe9C.js → unsignedTransaction-BOL13zs_.js} +1 -1
- package/lib/{unsignedTransaction-CDYPDQhc.mjs → unsignedTransaction-CWcOEDGs.mjs} +2 -2
- package/package.json +1 -1
- package/lib/solana-D1ZjaIA3.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var D=Object.defineProperty;var E=n=>{throw TypeError(n)};var L=(n,s,e)=>s in n?D(n,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[s]=e;var f=(n,s,e)=>L(n,typeof s!="symbol"?s+"":s,e),G=(n,s,e)=>s.has(n)||E("Cannot "+e);var l=(n,s,e)=>(G(n,s,"read from private field"),e?e.call(n):s.get(n)),p=(n,s,e)=>s.has(n)?E("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(n):s.set(n,e),c=(n,s,e,t)=>(G(n,s,"write to private field"),t?t.call(n,e):s.set(n,e),e);var A=(n,s,e,t)=>({set _(a){c(n,s,a,e)},get _(){return l(n,s,t)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-
|
|
1
|
+
"use strict";var D=Object.defineProperty;var E=n=>{throw TypeError(n)};var L=(n,s,e)=>s in n?D(n,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[s]=e;var f=(n,s,e)=>L(n,typeof s!="symbol"?s+"":s,e),G=(n,s,e)=>s.has(n)||E("Cannot "+e);var l=(n,s,e)=>(G(n,s,"read from private field"),e?e.call(n):s.get(n)),p=(n,s,e)=>s.has(n)?E("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(n):s.set(n,e),c=(n,s,e,t)=>(G(n,s,"write to private field"),t?t.call(n,e):s.set(n,e),e);var A=(n,s,e,t)=>({set _(a){c(n,s,a,e)},get _(){return l(n,s,t)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-CjaaWCsQ.js");var o,g;const v=class v extends r.AbstractSigner{constructor(e){super(e.provider);f(this,"signer");p(this,o);p(this,g);r.defineProperties(this,{signer:e}),c(this,o,null),c(this,g,0)}async getAddress(){return this.signer.getAddress()}connect(e){return new v(this.signer.connect(e))}async getNonce(e){if(e==="pending"){l(this,o)==null&&c(this,o,super.getNonce("pending"));const t=l(this,g);return await l(this,o)+t}return super.getNonce(e)}increment(){A(this,g)._++}reset(){c(this,g,0),c(this,o,null)}async sendTransaction(e){const t=this.getNonce("pending");return this.increment(),e=await this.signer.populateTransaction(e),e.nonce=await t,await this.signer.sendTransaction(e)}signTransaction(e){return this.signer.signTransaction(e)}signMessage(e){return this.signer.signMessage(e)}signTypedData(e,t,a){return this.signer.signTypedData(e,t,a)}};o=new WeakMap,g=new WeakMap;let P=v;async function O(n,s,e){const t=typeof s=="string"?new r.Wallet(s,n):s,a=(e==null?void 0:e.chain)??(await r.EvmPlatform.chainFromRpc(n))[1],i=new P(t);if(i.provider===null)try{i.connect(n)}catch(d){console.error("Cannot connect to network for signer",d)}return new b(a,await t.getAddress(),i,e)}class b extends r.PlatformNativeSigner{constructor(e,t,a,i){super(e,t,a);f(this,"opts");this.opts=i}chain(){return this._chain}address(){return this._address}async sign(e){var w,y,x,C,S,T;const t=this.chain(),a=[];let i=500000n,d=100000000000n,m=1500000000n,u=100000000n;if(((w=this.opts)==null?void 0:w.overrides)===void 0&&t!=="Celo"){const h=await this._signer.provider.getFeeData();d=h.gasPrice??d,m=h.maxFeePerGas??m,u=h.maxPriorityFeePerGas??u}((y=this.opts)==null?void 0:y.maxGasLimit)!==void 0&&(i=i>((x=this.opts)==null?void 0:x.maxGasLimit)?(C=this.opts)==null?void 0:C.maxGasLimit:i);const F=t==="Oasis"?{gasLimit:i,gasPrice:d,type:0}:{gasLimit:i,maxFeePerGas:m,maxPriorityFeePerGas:u};for(const h of e){const{transaction:N,description:q}=h;(S=this.opts)!=null&&S.debug&&console.log(`Signing: ${q} for ${this.address()}`);const _={...N,...F,from:this.address(),nonce:await this._signer.getNonce(),...(T=this.opts)==null?void 0:T.overrides};a.push(await this._signer.signTransaction(_))}return a}}const B={Address:r.EvmAddress,Platform:r.EvmPlatform,getSigner:O,protocols:{WormholeCore:()=>Promise.resolve().then(()=>require("./index-CjaaWCsQ.js")).then(n=>n.index$1),TokenBridge:()=>Promise.resolve().then(()=>require("./index-_6ORrwJQ.js")),PorticoBridge:()=>Promise.resolve().then(()=>require("./index-GIMIwhEX.js")),CircleBridge:()=>Promise.resolve().then(()=>require("./index-Dnfo149P.js"))},getChain:(n,s,e)=>new r.EvmChain(s,new r.EvmPlatform(n,r.applyChainsConfigConfigOverrides(n,r._platform,{[s]:e})))};exports.default=B;
|
|
@@ -13,7 +13,7 @@ var E = (s, n, e, t) => ({
|
|
|
13
13
|
return h(s, n, t);
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
import { A as O, d as W, W as b, E as f, P as $, a as M, b as R, c as Y, _ as j } from "./index-
|
|
16
|
+
import { A as O, d as W, W as b, E as f, P as $, a as M, b as R, c as Y, _ as j } from "./index-DCFAlA0r.mjs";
|
|
17
17
|
var a, c;
|
|
18
18
|
const w = class w extends O {
|
|
19
19
|
/**
|
|
@@ -126,10 +126,10 @@ const J = {
|
|
|
126
126
|
Platform: f,
|
|
127
127
|
getSigner: q,
|
|
128
128
|
protocols: {
|
|
129
|
-
WormholeCore: () => import("./index-
|
|
130
|
-
TokenBridge: () => import("./index-
|
|
131
|
-
PorticoBridge: () => import("./index-
|
|
132
|
-
CircleBridge: () => import("./index-
|
|
129
|
+
WormholeCore: () => import("./index-DCFAlA0r.mjs").then((s) => s.dY),
|
|
130
|
+
TokenBridge: () => import("./index-qCDztmW8.mjs"),
|
|
131
|
+
PorticoBridge: () => import("./index-Cx4LuiA1.mjs"),
|
|
132
|
+
CircleBridge: () => import("./index-BUJ1M7Ob.mjs")
|
|
133
133
|
},
|
|
134
134
|
getChain: (s, n, e) => new R(n, new f(s, Y(s, j, {
|
|
135
135
|
[n]: e
|
|
@@ -3,9 +3,9 @@ var ps = (e) => {
|
|
|
3
3
|
};
|
|
4
4
|
var hs = (e, t, n) => t.has(e) || ps("Cannot " + n);
|
|
5
5
|
var kn = (e, t, n) => (hs(e, t, "read from private field"), n ? n.call(e) : t.get(e)), ms = (e, t, n) => t.has(e) ? ps("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), gs = (e, t, n, r) => (hs(e, t, "write to private field"), r ? r.call(e, n) : t.set(e, n), n);
|
|
6
|
-
import { aq as No, ar as bs, h as Fn, as as xo, at as Do, au as Eo, av as fs, aw as jo, ax as ue, ay as Co, az as en, aA as ko, aB as To, aC as vo, aD as zo, aE as So, aF as Lo, aG as Oo, ac as Po, aH as Rn, aI as Bo } from "./index-
|
|
6
|
+
import { aq as No, ar as bs, h as Fn, as as xo, at as Do, au as Eo, av as fs, aw as jo, ax as ue, ay as Co, az as en, aA as ko, aB as To, aC as vo, aD as zo, aE as So, aF as Lo, aG as Oo, ac as Po, aH as Rn, aI as Bo } from "./index-DCFAlA0r.mjs";
|
|
7
7
|
import * as _s from "react";
|
|
8
|
-
import "./index-
|
|
8
|
+
import "./index-B8U_Gr4R.mjs";
|
|
9
9
|
function Uo(e, t) {
|
|
10
10
|
for (var n = 0; n < t.length; n++) {
|
|
11
11
|
const r = t[n];
|
|
@@ -4332,7 +4332,7 @@ async function yn(e, t) {
|
|
|
4332
4332
|
});
|
|
4333
4333
|
return Ie === "0x" ? { data: void 0 } : { data: Ie };
|
|
4334
4334
|
} catch (I) {
|
|
4335
|
-
const N = Ml(I), { offchainLookup: D, offchainLookupSignature: O } = await import("./ccip-
|
|
4335
|
+
const N = Ml(I), { offchainLookup: D, offchainLookupSignature: O } = await import("./ccip-dAqJN7S0.mjs");
|
|
4336
4336
|
if ((N == null ? void 0 : N.slice(0, 10)) === O && m)
|
|
4337
4337
|
return { data: await D(e, { data: N, to: m }) };
|
|
4338
4338
|
throw gl(I, {
|
|
@@ -11723,7 +11723,7 @@ var ts = (e, t, n) => {
|
|
|
11723
11723
|
throw TypeError("Cannot add the same private member more than once");
|
|
11724
11724
|
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
11725
11725
|
}, Ft = (e, t, n, r) => (ts(e, t, "write to private field"), t.set(e, n), n), i4 = (e, t, n) => (ts(e, t, "access private method"), n);
|
|
11726
|
-
const c4 = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, REACT_APP_CONNECT_GIT_HASH: "
|
|
11726
|
+
const c4 = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, REACT_APP_CONNECT_GIT_HASH: "a40a8d0e151502ca2bd050b2db7ef84c4a08170b", REACT_APP_CONNECT_VERSION: "1.1.2-beta.1-development", SSR: !1 }, l4 = (e) => (t, n, r) => {
|
|
11727
11727
|
const s = r.subscribe;
|
|
11728
11728
|
return r.subscribe = (o, i, c) => {
|
|
11729
11729
|
let l = o;
|
|
@@ -11990,7 +11990,7 @@ const xt = (e) => (t) => {
|
|
|
11990
11990
|
}, a.skipHydration || p(), m || h;
|
|
11991
11991
|
}, m4 = (e, t) => "getStorage" in t || "serialize" in t || "deserialize" in t ? ((c4 ? "production" : void 0) !== "production" && console.warn(
|
|
11992
11992
|
"[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."
|
|
11993
|
-
), p4(e, t)) : h4(e, t), g4 = m4, b4 = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, REACT_APP_CONNECT_GIT_HASH: "
|
|
11993
|
+
), p4(e, t)) : h4(e, t), g4 = m4, b4 = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, REACT_APP_CONNECT_GIT_HASH: "a40a8d0e151502ca2bd050b2db7ef84c4a08170b", REACT_APP_CONNECT_VERSION: "1.1.2-beta.1-development", SSR: !1 }, Us = (e) => {
|
|
11994
11994
|
let t;
|
|
11995
11995
|
const n = /* @__PURE__ */ new Set(), r = (u, d) => {
|
|
11996
11996
|
const h = typeof u == "function" ? u(t) : u;
|
|
@@ -13894,7 +13894,7 @@ var V3 = Object.defineProperty, K3 = function(e, t, n) {
|
|
|
13894
13894
|
case 0:
|
|
13895
13895
|
return !tt(i, rt) || a || o ? (u = !((c = i.options) === null || c === void 0) && c.infuraId ? {} : i.chains.reduce(function(m, p) {
|
|
13896
13896
|
return Js(Ht({}, m), go({}, p.id, p.rpcUrls.default.http[0]));
|
|
13897
|
-
}, {}), [4, import("./index-
|
|
13897
|
+
}, {}), [4, import("./index-D_IvJasJ.mjs")]) : [3, 2];
|
|
13898
13898
|
case 1:
|
|
13899
13899
|
d = h.sent().default, Gn(i, rt, new d(Js(Ht({}, i.options), { chainId: a, rpc: Ht({}, u, (l = i.options) === null || l === void 0 ? void 0 : l.rpc) }))), h.label = 2;
|
|
13900
13900
|
case 2:
|
|
@@ -14285,7 +14285,7 @@ fr = async function() {
|
|
|
14285
14285
|
};
|
|
14286
14286
|
os = /* @__PURE__ */ new WeakSet();
|
|
14287
14287
|
Ao = async function() {
|
|
14288
|
-
const { EthereumProvider: e } = await import("./index.es-
|
|
14288
|
+
const { EthereumProvider: e } = await import("./index.es-DV0FLIto.mjs"), t = this.chains.map(({ id: n }) => n);
|
|
14289
14289
|
if (t.length) {
|
|
14290
14290
|
const {
|
|
14291
14291
|
projectId: n,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Pt = Object.defineProperty;
|
|
2
2
|
var _t = (e, t, r) => t in e ? Pt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var f = (e, t, r) => _t(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { aZ as c, bA as A, bE as z, bD as U, h as l, cg as le, bF as G, bC as S, bB as V, ch as Ge, ci as Ze, cj as Wt, ck as It, cl as Ut, cm as Nt, cn as O, co as E, a8 as y, cp as T, cq as Ft, cr as ye, ca as dt, cs as xt, ct as lt, cu as zt, cv as Ot, cw as Q, cx as Lt, cy as Z, cz as H, cA as Dt, cB as qt, cC as Kt, cD as Vt, cE as Se, cF as Gt, cG as v, cH as Zt, e as oe, S as k, c9 as Ce, bO as Ht, p as j, cf as Be, cI as Yt, cJ as Qt, b8 as se, b1 as L, a5 as Xt, cK as ft, bU as mt, g as gt } from "./index-
|
|
4
|
+
import { aZ as c, bA as A, bE as z, bD as U, h as l, cg as le, bF as G, bC as S, bB as V, ch as Ge, ci as Ze, cj as Wt, ck as It, cl as Ut, cm as Nt, cn as O, co as E, a8 as y, cp as T, cq as Ft, cr as ye, ca as dt, cs as xt, ct as lt, cu as zt, cv as Ot, cw as Q, cx as Lt, cy as Z, cz as H, cA as Dt, cB as qt, cC as Kt, cD as Vt, cE as Se, cF as Gt, cG as v, cH as Zt, e as oe, S as k, c9 as Ce, bO as Ht, p as j, cf as Be, cI as Yt, cJ as Qt, b8 as se, b1 as L, a5 as Xt, cK as ft, bU as mt, g as gt } from "./index-DCFAlA0r.mjs";
|
|
5
5
|
const M = new c("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
|
|
6
6
|
new c("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");
|
|
7
7
|
const Ae = new c("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"), D = new c("So11111111111111111111111111111111111111112");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const me=Symbol(),se=Object.getPrototypeOf,G=new WeakMap,he=e=>e&&(G.has(e)?G.get(e):se(e)===Object.prototype||se(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,ne=(e,t=!0)=>{G.set(e,t)},H={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,REACT_APP_CONNECT_GIT_HASH:"9941f1b1b06626ac22d9e123b85862b02cfae274",REACT_APP_CONNECT_VERSION:"1.1.2-beta.0-development",SSR:!1},F=e=>typeof e=="object"&&e!==null,A=new WeakMap,x=new WeakSet,be=(e=Object.is,t=(n,g)=>new Proxy(n,g),s=n=>F(n)&&!x.has(n)&&(Array.isArray(n)||!(Symbol.iterator in n))&&!(n instanceof WeakMap)&&!(n instanceof WeakSet)&&!(n instanceof Error)&&!(n instanceof Number)&&!(n instanceof Date)&&!(n instanceof String)&&!(n instanceof RegExp)&&!(n instanceof ArrayBuffer),r=n=>{switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:throw n}},l=new WeakMap,c=(n,g,I=r)=>{const v=l.get(n);if((v==null?void 0:v[0])===g)return v[1];const w=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n));return ne(w,!0),l.set(n,[g,w]),Reflect.ownKeys(n).forEach(_=>{if(Object.getOwnPropertyDescriptor(w,_))return;const L=Reflect.get(n,_),M={value:L,enumerable:!0,configurable:!0};if(x.has(L))ne(L,!1);else if(L instanceof Promise)delete M.value,M.get=()=>I(L);else if(A.has(L)){const[b,q]=A.get(L);M.value=c(b,q(),I)}Object.defineProperty(w,_,M)}),Object.preventExtensions(w)},m=new WeakMap,f=[1,1],W=n=>{if(!F(n))throw new Error("object required");const g=m.get(n);if(g)return g;let I=f[0];const v=new Set,w=(a,i=++f[0])=>{I!==i&&(I=i,v.forEach(o=>o(a,i)))};let _=f[1];const L=(a=++f[1])=>(_!==a&&!v.size&&(_=a,b.forEach(([i])=>{const o=i[1](a);o>I&&(I=o)})),I),M=a=>(i,o)=>{const h=[...i];h[1]=[a,...h[1]],w(h,o)},b=new Map,q=(a,i)=>{if((H?"production":void 0)!=="production"&&b.has(a))throw new Error("prop listener already exists");if(v.size){const o=i[3](M(a));b.set(a,[i,o])}else b.set(a,[i])},te=a=>{var i;const o=b.get(a);o&&(b.delete(a),(i=o[1])==null||i.call(o))},pe=a=>(v.add(a),v.size===1&&b.forEach(([o,h],k)=>{if((H?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const T=o[3](M(k));b.set(k,[o,T])}),()=>{v.delete(a),v.size===0&&b.forEach(([o,h],k)=>{h&&(h(),b.set(k,[o]))})}),J=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),$=t(J,{deleteProperty(a,i){const o=Reflect.get(a,i);te(i);const h=Reflect.deleteProperty(a,i);return h&&w(["delete",[i],o]),h},set(a,i,o,h){const k=Reflect.has(a,i),T=Reflect.get(a,i,h);if(k&&(e(T,o)||m.has(o)&&e(T,m.get(o))))return!0;te(i),F(o)&&(o=ge(o)||o);let V=o;if(o instanceof Promise)o.then(C=>{o.status="fulfilled",o.value=C,w(["resolve",[i],C])}).catch(C=>{o.status="rejected",o.reason=C,w(["reject",[i],C])});else{!A.has(o)&&s(o)&&(V=W(o));const C=!x.has(V)&&A.get(V);C&&q(i,C)}return Reflect.set(a,i,V,h),w(["set",[i],o,T]),!0}});m.set(n,$);const fe=[J,L,c,pe];return A.set($,fe),Reflect.ownKeys(n).forEach(a=>{const i=Object.getOwnPropertyDescriptor(n,a);"value"in i&&($[a]=n[a],delete i.value,delete i.writable),Object.defineProperty(J,a,i)}),$})=>[W,A,x,e,t,s,r,l,c,m,f],[ye]=be();function j(e={}){return ye(e)}function D(e,t,s){const r=A.get(e);(H?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let l;const c=[],m=r[3];let f=!1;const n=m(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,n()}}function ve(e,t){const s=A.get(e);(H?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[r,l,c]=s;return c(r,l(),t)}const d=j({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),ee={state:d,subscribe(e){return D(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},u={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return u.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return u.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(u.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!u.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(u.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(u.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(u.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(u.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=ee.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=j({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),ue={state:p,subscribe(e){return D(p.events,()=>e(ve(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},E=j({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),y={state:E,subscribe(e){return D(E,()=>e(E))},setChains(e){E.chains=e},setWalletConnectUri(e){E.walletConnectUri=e},setIsCustomDesktop(e){E.isCustomDesktop=e},setIsCustomMobile(e){E.isCustomMobile=e},setIsDataLoaded(e){E.isDataLoaded=e},setIsUiLoaded(e){E.isUiLoaded=e},setIsAuth(e){E.isAuth=e}},B=j({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),U={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;ue.initialize(),y.setChains(e.chains),y.setIsAuth(!!e.enableAuthMode),y.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),y.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),u.setModalVersionInStorage(),Object.assign(B,e)}};var Ie=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Le=(e,t)=>{for(var s in t||(t={}))Ee.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Oe.call(t,s)&&re(e,s,t[s]);return e};const Q="https://explorer-api.walletconnect.com",X="wcm",Y="js-2.6.2";async function K(e,t){const s=Le({sdkType:X,sdkVersion:Y},t),r=new URL(e,Q);return r.searchParams.append("projectId",U.state.projectId),Object.entries(s).forEach(([l,c])=>{c&&r.searchParams.append(l,String(c))}),(await fetch(r)).json()}const P={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${Q}/w3m/v1/getWalletImage/${e}?projectId=${U.state.projectId}&sdkType=${X}&sdkVersion=${Y}`},getAssetImageUrl(e){return`${Q}/w3m/v1/getAssetImage/${e}?projectId=${U.state.projectId}&sdkType=${X}&sdkVersion=${Y}`}};var We=Object.defineProperty,ie=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,ae=(e,t,s)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&ae(e,s,t[s]);if(ie)for(var s of ie(t))Ae.call(t,s)&&ae(e,s,t[s]);return e};const le=u.isMobile(),O=j({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Me={state:O,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=U.state;if(e==="NONE"||t==="ALL"&&!e)return O.recomendedWallets;if(u.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await P.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const f=e.indexOf(c.id),W=e.indexOf(m.id);return f-W}),O.recomendedWallets=l}else{const{chains:s,isAuth:r}=y.state,l=s==null?void 0:s.join(","),c=u.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:u.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=le?await P.getMobileListings(m):await P.getDesktopListings(m);O.recomendedWallets=Object.values(f)}return O.recomendedWallets},async getWallets(e){const t=je({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=U.state,{recomendedWallets:l}=O;if(r==="ALL")return O.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):u.isArray(s)&&(t.excludedIds=s.join(",")),u.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),y.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:f,total:W}=le?await P.getMobileListings(t):await P.getDesktopListings(t),n=Object.values(f),g=m?"search":"wallets";return O[g]={listings:[...O[g].listings,...n],total:W,page:c??1},{listings:n,total:W}},getWalletImageUrl(e){return P.getWalletImageUrl(e)},getAssetImageUrl(e){return P.getAssetImageUrl(e)},resetSearch(){O.search={listings:[],total:0,page:1}}},N=j({open:!1}),z={state:N,subscribe(e){return D(N,()=>e(N))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=y.state;if(u.removeWalletConnectDeepLink(),y.setWalletConnectUri(e==null?void 0:e.uri),y.setChains(e==null?void 0:e.chains),ee.reset("ConnectWallet"),s&&r)N.open=!0,t();else{const l=setInterval(()=>{const c=y.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),N.open=!0,t())},200)}})},close(){N.open=!1}};var Pe=Object.defineProperty,ce=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable,de=(e,t,s)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,De=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&de(e,s,t[s]);if(ce)for(var s of ce(t))Ue.call(t,s)&&de(e,s,t[s]);return e};function _e(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const R=j({themeMode:_e()?"dark":"light"}),Z={state:R,subscribe(e){return D(R,()=>e(R))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(R.themeMode=t),s&&(R.themeVariables=De({},s))}},S=j({open:!1,message:"",variant:"success"}),ke={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class Ne{constructor(t){this.openModal=z.open,this.closeModal=z.close,this.subscribeModal=z.subscribe,this.setTheme=Z.setThemeConfig,Z.setThemeConfig(t),U.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(()=>require("./index-C51caWlO.js"));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),y.setIsUiLoaded(!0)}}}const Te=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Ne},Symbol.toStringTag,{value:"Module"}));exports.R=ue;exports.T=ee;exports.a=u;exports.index=Te;exports.ne=Z;exports.oe=ke;exports.p=y;exports.se=z;exports.te=Me;exports.y=U;
|
|
1
|
+
"use strict";const me=Symbol(),se=Object.getPrototypeOf,G=new WeakMap,he=e=>e&&(G.has(e)?G.get(e):se(e)===Object.prototype||se(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,ne=(e,t=!0)=>{G.set(e,t)},H={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,REACT_APP_CONNECT_GIT_HASH:"a40a8d0e151502ca2bd050b2db7ef84c4a08170b",REACT_APP_CONNECT_VERSION:"1.1.2-beta.1-development",SSR:!1},F=e=>typeof e=="object"&&e!==null,A=new WeakMap,x=new WeakSet,be=(e=Object.is,t=(n,g)=>new Proxy(n,g),s=n=>F(n)&&!x.has(n)&&(Array.isArray(n)||!(Symbol.iterator in n))&&!(n instanceof WeakMap)&&!(n instanceof WeakSet)&&!(n instanceof Error)&&!(n instanceof Number)&&!(n instanceof Date)&&!(n instanceof String)&&!(n instanceof RegExp)&&!(n instanceof ArrayBuffer),r=n=>{switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:throw n}},l=new WeakMap,c=(n,g,I=r)=>{const v=l.get(n);if((v==null?void 0:v[0])===g)return v[1];const w=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n));return ne(w,!0),l.set(n,[g,w]),Reflect.ownKeys(n).forEach(_=>{if(Object.getOwnPropertyDescriptor(w,_))return;const L=Reflect.get(n,_),M={value:L,enumerable:!0,configurable:!0};if(x.has(L))ne(L,!1);else if(L instanceof Promise)delete M.value,M.get=()=>I(L);else if(A.has(L)){const[b,q]=A.get(L);M.value=c(b,q(),I)}Object.defineProperty(w,_,M)}),Object.preventExtensions(w)},m=new WeakMap,f=[1,1],W=n=>{if(!F(n))throw new Error("object required");const g=m.get(n);if(g)return g;let I=f[0];const v=new Set,w=(a,i=++f[0])=>{I!==i&&(I=i,v.forEach(o=>o(a,i)))};let _=f[1];const L=(a=++f[1])=>(_!==a&&!v.size&&(_=a,b.forEach(([i])=>{const o=i[1](a);o>I&&(I=o)})),I),M=a=>(i,o)=>{const h=[...i];h[1]=[a,...h[1]],w(h,o)},b=new Map,q=(a,i)=>{if((H?"production":void 0)!=="production"&&b.has(a))throw new Error("prop listener already exists");if(v.size){const o=i[3](M(a));b.set(a,[i,o])}else b.set(a,[i])},te=a=>{var i;const o=b.get(a);o&&(b.delete(a),(i=o[1])==null||i.call(o))},pe=a=>(v.add(a),v.size===1&&b.forEach(([o,h],k)=>{if((H?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const T=o[3](M(k));b.set(k,[o,T])}),()=>{v.delete(a),v.size===0&&b.forEach(([o,h],k)=>{h&&(h(),b.set(k,[o]))})}),J=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),$=t(J,{deleteProperty(a,i){const o=Reflect.get(a,i);te(i);const h=Reflect.deleteProperty(a,i);return h&&w(["delete",[i],o]),h},set(a,i,o,h){const k=Reflect.has(a,i),T=Reflect.get(a,i,h);if(k&&(e(T,o)||m.has(o)&&e(T,m.get(o))))return!0;te(i),F(o)&&(o=ge(o)||o);let V=o;if(o instanceof Promise)o.then(C=>{o.status="fulfilled",o.value=C,w(["resolve",[i],C])}).catch(C=>{o.status="rejected",o.reason=C,w(["reject",[i],C])});else{!A.has(o)&&s(o)&&(V=W(o));const C=!x.has(V)&&A.get(V);C&&q(i,C)}return Reflect.set(a,i,V,h),w(["set",[i],o,T]),!0}});m.set(n,$);const fe=[J,L,c,pe];return A.set($,fe),Reflect.ownKeys(n).forEach(a=>{const i=Object.getOwnPropertyDescriptor(n,a);"value"in i&&($[a]=n[a],delete i.value,delete i.writable),Object.defineProperty(J,a,i)}),$})=>[W,A,x,e,t,s,r,l,c,m,f],[ye]=be();function j(e={}){return ye(e)}function D(e,t,s){const r=A.get(e);(H?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let l;const c=[],m=r[3];let f=!1;const n=m(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,n()}}function ve(e,t){const s=A.get(e);(H?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[r,l,c]=s;return c(r,l(),t)}const d=j({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),ee={state:d,subscribe(e){return D(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},u={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return u.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return u.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(u.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!u.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(u.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(u.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(u.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(u.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=ee.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=j({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),ue={state:p,subscribe(e){return D(p.events,()=>e(ve(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},E=j({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),y={state:E,subscribe(e){return D(E,()=>e(E))},setChains(e){E.chains=e},setWalletConnectUri(e){E.walletConnectUri=e},setIsCustomDesktop(e){E.isCustomDesktop=e},setIsCustomMobile(e){E.isCustomMobile=e},setIsDataLoaded(e){E.isDataLoaded=e},setIsUiLoaded(e){E.isUiLoaded=e},setIsAuth(e){E.isAuth=e}},B=j({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),U={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;ue.initialize(),y.setChains(e.chains),y.setIsAuth(!!e.enableAuthMode),y.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),y.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),u.setModalVersionInStorage(),Object.assign(B,e)}};var Ie=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Le=(e,t)=>{for(var s in t||(t={}))Ee.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Oe.call(t,s)&&re(e,s,t[s]);return e};const Q="https://explorer-api.walletconnect.com",X="wcm",Y="js-2.6.2";async function K(e,t){const s=Le({sdkType:X,sdkVersion:Y},t),r=new URL(e,Q);return r.searchParams.append("projectId",U.state.projectId),Object.entries(s).forEach(([l,c])=>{c&&r.searchParams.append(l,String(c))}),(await fetch(r)).json()}const P={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${Q}/w3m/v1/getWalletImage/${e}?projectId=${U.state.projectId}&sdkType=${X}&sdkVersion=${Y}`},getAssetImageUrl(e){return`${Q}/w3m/v1/getAssetImage/${e}?projectId=${U.state.projectId}&sdkType=${X}&sdkVersion=${Y}`}};var We=Object.defineProperty,ie=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,ae=(e,t,s)=>t in e?We(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&ae(e,s,t[s]);if(ie)for(var s of ie(t))Ae.call(t,s)&&ae(e,s,t[s]);return e};const le=u.isMobile(),O=j({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Me={state:O,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=U.state;if(e==="NONE"||t==="ALL"&&!e)return O.recomendedWallets;if(u.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await P.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const f=e.indexOf(c.id),W=e.indexOf(m.id);return f-W}),O.recomendedWallets=l}else{const{chains:s,isAuth:r}=y.state,l=s==null?void 0:s.join(","),c=u.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:u.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=le?await P.getMobileListings(m):await P.getDesktopListings(m);O.recomendedWallets=Object.values(f)}return O.recomendedWallets},async getWallets(e){const t=je({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=U.state,{recomendedWallets:l}=O;if(r==="ALL")return O.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):u.isArray(s)&&(t.excludedIds=s.join(",")),u.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),y.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:f,total:W}=le?await P.getMobileListings(t):await P.getDesktopListings(t),n=Object.values(f),g=m?"search":"wallets";return O[g]={listings:[...O[g].listings,...n],total:W,page:c??1},{listings:n,total:W}},getWalletImageUrl(e){return P.getWalletImageUrl(e)},getAssetImageUrl(e){return P.getAssetImageUrl(e)},resetSearch(){O.search={listings:[],total:0,page:1}}},N=j({open:!1}),z={state:N,subscribe(e){return D(N,()=>e(N))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=y.state;if(u.removeWalletConnectDeepLink(),y.setWalletConnectUri(e==null?void 0:e.uri),y.setChains(e==null?void 0:e.chains),ee.reset("ConnectWallet"),s&&r)N.open=!0,t();else{const l=setInterval(()=>{const c=y.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),N.open=!0,t())},200)}})},close(){N.open=!1}};var Pe=Object.defineProperty,ce=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable,de=(e,t,s)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,De=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&de(e,s,t[s]);if(ce)for(var s of ce(t))Ue.call(t,s)&&de(e,s,t[s]);return e};function _e(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const R=j({themeMode:_e()?"dark":"light"}),Z={state:R,subscribe(e){return D(R,()=>e(R))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(R.themeMode=t),s&&(R.themeVariables=De({},s))}},S=j({open:!1,message:"",variant:"success"}),ke={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class Ne{constructor(t){this.openModal=z.open,this.closeModal=z.close,this.subscribeModal=z.subscribe,this.setTheme=Z.setThemeConfig,Z.setThemeConfig(t),U.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await Promise.resolve().then(()=>require("./index-CKK14LS0.js"));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),y.setIsUiLoaded(!0)}}}const Te=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Ne},Symbol.toStringTag,{value:"Module"}));exports.R=ue;exports.T=ee;exports.a=u;exports.index=Te;exports.ne=Z;exports.oe=ke;exports.p=y;exports.se=z;exports.te=Me;exports.y=U;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Q = Object.defineProperty;
|
|
2
2
|
var j = (t, e, s) => e in t ? Q(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
3
|
var y = (t, e, s) => j(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
-
import { aZ as u, bA as Y, bB as I, bC as x, bD as ee, bE as ne, bF as se, h as M, co as O, cg as ae, ct as E, cu as N, cL as B, cG as U, c4 as _, u as te, S as b, e as ie, c5 as D, b1 as T, c3 as re, b8 as me, c6 as C, cK as oe, bU as ue, g as le } from "./index-
|
|
4
|
+
import { aZ as u, bA as Y, bB as I, bC as x, bD as ee, bE as ne, bF as se, h as M, co as O, cg as ae, ct as E, cu as N, cL as B, cG as U, c4 as _, u as te, S as b, e as ie, c5 as D, b1 as T, c3 as re, b8 as me, c6 as C, cK as oe, bU as ue, g as le } from "./index-DCFAlA0r.mjs";
|
|
5
5
|
const h = new u("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
|
|
6
6
|
new u("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");
|
|
7
7
|
const A = new u("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var h=Object.defineProperty;var m=(a,e,r)=>e in a?h(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r;var o=(a,e,r)=>m(a,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-
|
|
1
|
+
"use strict";var h=Object.defineProperty;var m=(a,e,r)=>e in a?h(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r;var o=(a,e,r)=>m(a,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-CjaaWCsQ.js"),u=require("./sui-yf1o5y4o.js");class d{constructor(e,r,t,n){o(this,"network");o(this,"chain");o(this,"provider");o(this,"contracts");o(this,"chainId");o(this,"coreBridgePackageId");this.network=e,this.chain=r,this.provider=t,this.contracts=n,this.chainId=c.toChainId(r);const s=n.coreBridge;if(!s)throw new Error(`CoreBridge contract Address for chain ${r} not found`);this.coreBridgePackageId=s}getGuardianSet(e){throw new Error("Method not implemented.")}getMessageFee(){throw new Error("Method not implemented.")}static async fromRpc(e,r){const[t,n]=await u.SuiPlatform.chainFromRpc(e),s=r[n];if(s.network!==t)throw new Error(`Network mismatch: ${s.network} !== ${t}`);return new d(t,n,e,s.contracts)}async*verifyMessage(e,r){throw new Error("Method not implemented.")}async*publishMessage(e,r){throw new Error("Method not implemented.")}async parseTransaction(e){return(await this.parseMessages(e)).map(t=>({emitter:t.emitterAddress,sequence:t.sequence,chain:this.chain}))}async getGuardianSetIndex(){throw new Error("Method not implemented.")}async parseMessages(e){var n;const t=(n=(await this.provider.getTransactionBlock({digest:e,options:{showEvents:!0,showEffects:!0,showInput:!0}})).events)==null?void 0:n.filter(s=>s.type.endsWith("WormholeMessage"));if(!t||t.length==0)throw new Error("WormholeMessage not found");return t.map(s=>{const i=s.parsedJson;return c.createVAA("Uint8Array",{emitterChain:this.chain,emitterAddress:new c.SuiAddress(i.sender).toUniversalAddress(),sequence:BigInt(i.sequence),guardianSet:0,timestamp:Number(i.timestamp),consistencyLevel:i.consistency_level,nonce:i.nonce,signatures:[],payload:new Uint8Array(i.payload)})})}}c.registerProtocol("Sui","WormholeCore",d);exports.SuiWormholeCore=d;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var m = Object.defineProperty;
|
|
2
2
|
var w = (i, e, t) => e in i ? m(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
3
|
var a = (i, e, t) => w(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { C as u } from "./cosmwasm-
|
|
5
|
-
import { cM as g, ca as l, u as h, bU as p, a9 as f } from "./index-
|
|
4
|
+
import { C as u } from "./cosmwasm-B90CBMmk.mjs";
|
|
5
|
+
import { cM as g, ca as l, u as h, bU as p, a9 as f } from "./index-DCFAlA0r.mjs";
|
|
6
6
|
class c {
|
|
7
7
|
constructor(e, t, s, r) {
|
|
8
8
|
a(this, "network");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var J = Object.defineProperty;
|
|
2
2
|
var K = (n, f, e) => f in n ? J(n, f, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[f] = e;
|
|
3
3
|
var d = (n, f, e) => K(n, typeof f != "symbol" ? f + "" : f, e);
|
|
4
|
-
import { ar as y, bV as f0, bW as z, bX as p, bY as e0, bZ as a0, b_ as t0, b$ as _, c0 as b0, c1 as n0, c2 as d0, aj as L, c3 as O, E as v, a as C, c4 as D, u as U, bN as u, c5 as H, bQ as c0, c6 as N, bS as q, bT as j, a8 as s0, c7 as i0, c8 as I, bI as S, aA as $, bU as V, _ as Q } from "./index-
|
|
5
|
-
import "./index-
|
|
4
|
+
import { ar as y, bV as f0, bW as z, bX as p, bY as e0, bZ as a0, b_ as t0, b$ as _, c0 as b0, c1 as n0, c2 as d0, aj as L, c3 as O, E as v, a as C, c4 as D, u as U, bN as u, c5 as H, bQ as c0, c6 as N, bS as q, bT as j, a8 as s0, c7 as i0, c8 as I, bI as S, aA as $, bU as V, _ as Q } from "./index-DCFAlA0r.mjs";
|
|
5
|
+
import "./index-qCDztmW8.mjs";
|
|
6
6
|
const r0 = new RegExp("^bytes([0-9]+)$"), p0 = new RegExp("^(u?int)([0-9]*)$"), y0 = new RegExp("^(.*)\\[([0-9]*)\\]$");
|
|
7
7
|
function X(n, f, e) {
|
|
8
8
|
switch (n) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var uu = Object.defineProperty;
|
|
2
2
|
var du = (e, t, n) => t in e ? uu(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var ct = (e, t, n) => du(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import { X as h, Y as Ur, Z as lu, h as tt, $ as ia, a0 as aa, aa as fi, a3 as hi, N as pi, o as mu, a8 as gi, p as fu, cY as hu, a6 as yi, cZ as Qo, c_ as bi, c$ as vi, d0 as wi, d1 as ki, d2 as _i, d3 as Si, d4 as pu, d5 as gu, d6 as yu, bU as bu, a9 as vu } from "./index-
|
|
5
|
-
import { t as jt, l as wu, s as qr, a as Rs, c as ca, m as ku } from "./index-
|
|
6
|
-
import { b as _u, r as Su, a as ua, c as Pu, d as Au, e as Tu, x as Bt, f as Eu, g as Cu } from "./pako.esm-
|
|
7
|
-
import { k as Mu, a as Ou, b as ju, t as da, c as Bu, v as Ru, p as Iu, q as $u, d as Nu, e as Du, f as xu, g as la, h as Uu, i as qu, j as Hu, l as Vu, m as Fu, n as Wu, o as Ju, r as Gu, s as Hr, u as Lu, w as zu, x as Ku, y as Qu, z as Zu, A as Xu, B as Yu, D as ed, E as td, F as nd, H as rd, I as ma, J as od, K as sd, L as id, M as ad, N as cd, G as Nt, C as Zo } from "./cosmwasm-
|
|
8
|
-
import { CosmwasmWormholeCore as ud } from "./index-
|
|
9
|
-
import { c as dd, C as ld } from "./unsignedTransaction-
|
|
4
|
+
import { X as h, Y as Ur, Z as lu, h as tt, $ as ia, a0 as aa, aa as fi, a3 as hi, N as pi, o as mu, a8 as gi, p as fu, cY as hu, a6 as yi, cZ as Qo, c_ as bi, c$ as vi, d0 as wi, d1 as ki, d2 as _i, d3 as Si, d4 as pu, d5 as gu, d6 as yu, bU as bu, a9 as vu } from "./index-DCFAlA0r.mjs";
|
|
5
|
+
import { t as jt, l as wu, s as qr, a as Rs, c as ca, m as ku } from "./index-CszotuUi.mjs";
|
|
6
|
+
import { b as _u, r as Su, a as ua, c as Pu, d as Au, e as Tu, x as Bt, f as Eu, g as Cu } from "./pako.esm-ZR78Kcp_.mjs";
|
|
7
|
+
import { k as Mu, a as Ou, b as ju, t as da, c as Bu, v as Ru, p as Iu, q as $u, d as Nu, e as Du, f as xu, g as la, h as Uu, i as qu, j as Hu, l as Vu, m as Fu, n as Wu, o as Ju, r as Gu, s as Hr, u as Lu, w as zu, x as Ku, y as Qu, z as Zu, A as Xu, B as Yu, D as ed, E as td, F as nd, H as rd, I as ma, J as od, K as sd, L as id, M as ad, N as cd, G as Nt, C as Zo } from "./cosmwasm-B90CBMmk.mjs";
|
|
8
|
+
import { CosmwasmWormholeCore as ud } from "./index-BK5v6OjI.mjs";
|
|
9
|
+
import { c as dd, C as ld } from "./unsignedTransaction-CWcOEDGs.mjs";
|
|
10
10
|
function md(e) {
|
|
11
11
|
return e.id !== void 0 && e.pending !== void 0 && e.data !== void 0;
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var P=Object.defineProperty;var U=(k,o,t)=>o in k?P(k,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):k[o]=t;var g=(k,o,t)=>U(k,typeof o!="symbol"?o+"":o,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-CS85YWnw.js"),e=require("./index-COPDbEYS.js"),v=require("./algorand-B5akecmo.js"),j=e.ABIMethod.fromSignature("portal_transfer(byte[])byte[]"),p=class p{constructor(o,t,r,s){g(this,"network");g(this,"chain");g(this,"connection");g(this,"contracts");g(this,"chainId");g(this,"coreBridge");g(this,"coreAppId");g(this,"coreAppAddress");g(this,"tokenBridgeAppId");g(this,"tokenBridgeAddress");if(this.network=o,this.chain=t,this.connection=r,this.contracts=s,this.chainId=e.toChainId(t),!s.coreBridge)throw new Error(`Core contract address for chain ${t} not found`);const i=BigInt(s.coreBridge);if(this.coreAppId=i,this.coreAppAddress=e.getApplicationAddress(i),this.coreBridge=new d.AlgorandWormholeCore(o,t,r,s),!s.tokenBridge)throw new Error(`TokenBridge contract address for chain ${t} not found`);const a=BigInt(s.tokenBridge);this.tokenBridgeAppId=a,this.tokenBridgeAddress=e.getApplicationAddress(a)}static async fromRpc(o,t){const[r,s]=await v.AlgorandPlatform.chainFromRpc(o),i=t[s];if(i.network!==r)throw new Error(`Network mismatch: ${i.network} != ${r}`);return new p(r,s,o,i.contracts)}async isWrappedAsset(o){const t=new e.AlgorandAddress(o).toInt();if(t===0)return!1;const r=await this.connection.getAssetByID(t).do(),i=e.Asset.from_obj_for_encoding(r).params.creator,a=await this.connection.accountInformation(i).exclude("all").do(),n=e.Account.from_obj_for_encoding(a);return(n==null?void 0:n.authAddr)===this.tokenBridgeAddress}async getOriginalAsset(o){const t=new e.AlgorandAddress(o).toInt(),r=await this.connection.getAssetByID(t).do(),s=e.Asset.from_obj_for_encoding(r),i=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,s.params.creator);if(i.length<94)throw new Error("Invalid local state data");const a=i.slice(92,94),n=e.toChain(e.bignum.decode(a)),A=new e.UniversalAddress(i.slice(60,92));return{chain:n,address:A}}async getTokenUniversalAddress(o){return new e.AlgorandAddress(o).toUniversalAddress()}async getTokenNativeAddress(o,t){return new e.AlgorandAddress(t).toNative()}async getWrappedAsset(o){if(e.isNative(o.address))throw new Error("native asset cannot be a wrapped asset");const t=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,o),r=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,t.address());if(r.length<8)throw new Error("Invalid wrapped asset data");return e.toNative(this.chain,e.bignum.decode(r.slice(0,8)).toString())}async hasWrappedAsset(o){try{return await this.getWrappedAsset(o),!0}catch{}return!1}async getWrappedNative(){return e.toNative(this.chain,"0")}async isTransferCompleted(o){const t=d.StorageLogicSig.forMessageId(this.tokenBridgeAppId,{sequence:o.sequence,chain:o.emitterChain,emitter:o.emitterAddress});try{return await d.StorageLogicSig.checkBitsSet(this.connection,this.tokenBridgeAppId,t.address(),o.sequence)}catch{}return!1}async*createAttestation(o,t){if(!t)throw new Error("Payer required to create attestation");const r=new e.AlgorandAddress(t).toString(),s=new e.AlgorandAddress(o).toInt(),i=[],a=await this.connection.getTransactionParams().do(),n=d.StorageLogicSig.forEmitter(this.coreAppId,new e.AlgorandAddress(this.tokenBridgeAddress).toUint8Array()),{accounts:[A],txs:I}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.coreAppId,n,a);i.push(...I);let h="",c;if(s!==0){const u=await this.connection.getAssetByID(s).do(),b=e.Asset.from_obj_for_encoding(u),S=await this.connection.accountInformation(b.params.creator).do();if(c=e.Account.from_obj_for_encoding(S),c.authAddr===this.tokenBridgeAddress.toString())throw new Error("Cannot re-attest wormhole assets")}const B=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(s)),w=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.tokenBridgeAppId,B);h=w.accounts[0],i.push(...w.txs);const m=e.makeApplicationCallTxnFromObject({from:r,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.noop],suggestedParams:a});i.push({tx:m});const f=await this.coreBridge.getMessageFee();if(f>BigInt(0)){const u=e.makePaymentTxnWithSuggestedParamsFromObject({from:r,suggestedParams:a,to:this.tokenBridgeAddress,amount:f});i.push({tx:u})}let y=[A,h,this.coreAppAddress];c&&y.push(c.address);let l=e.makeApplicationCallTxnFromObject({appArgs:[p.attestToken,e.bignum.toBytes(s,8)],accounts:y,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignApps:[e.safeBigIntToNumber(this.coreAppId)],foreignAssets:[s],from:r,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:a});f>BigInt(0)?l.fee*=3:l.fee*=2,i.push({tx:l});for(const u of i)yield this.createUnsignedTx(u,"TokenBridge.createAttestation",!0)}async*submitAttestation(o,t,r){if(!t)throw new Error("Sender required to submit attestation");r||(r=await this.connection.getTransactionParams().do());const s=t.toString(),a=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,o.payload.token).address(),n=[],A=[],I=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,a);I.length>8&&A.push(new e.AlgorandAddress(I.slice(0,8)).toInt()),n.push({tx:e.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:a,amount:1e5,suggestedParams:r})});let h=new Uint8Array(1);h[0]=1,n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[p.noop,h],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),h=new Uint8Array(1),h[0]=2,n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[p.noop,h],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),n.push({tx:e.makeApplicationCallTxnFromObject({accounts:[],appArgs:[p.receiveAttest,e.serialize(o)],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:A,from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),n[n.length-1].tx.fee=n[n.length-1].tx.fee*2;for(const c of n)yield this.createUnsignedTx(c,"TokenBridge.submitAttestation",!0)}async*transfer(o,t,r,s,i){const a=o.toString(),n=e.isNative(r)?0:new e.AlgorandAddress(r).toInt(),A=s,I=e.toChainId(t.chain),h=t.address.toUniversalAddress().toUint8Array(),c=await this.connection.getTransactionParams().do(),B=BigInt(0),w=d.StorageLogicSig.fromData({appId:this.coreAppId,appAddress:e.decodeAddress(this.coreAppAddress).publicKey,idx:BigInt(0),address:e.decodeAddress(this.tokenBridgeAddress).publicKey}),m=[],{accounts:[f],txs:y}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.coreAppId,w,c);m.push(...y);let l="",u,b=!1;if(n!==0){const x=await this.connection.getAssetByID(n).do();l=e.Asset.from_obj_for_encoding(x).params.creator;const C=await this.connection.accountInformation(l).do();u=e.Account.from_obj_for_encoding(C),b=u.authAddr===this.tokenBridgeAddress.toString()}const S=await this.coreBridge.getMessageFee();if(S>0&&m.push({tx:e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:this.tokenBridgeAddress,amount:S,suggestedParams:c})}),!b){const x=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(n)),{accounts:[T],txs:C}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.tokenBridgeAppId,x,c);l=T,C.push(...C)}if(n!==0&&!await p.isOptedInToAsset(this.connection,l,n)){const x=e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:l,amount:1e5,suggestedParams:c});let T=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.optIn,e.bigIntToBytes(n,8)],foreignAssets:[n],accounts:[l],suggestedParams:c});T.fee*=2,m.unshift({tx:x},{tx:T})}const L=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.noop],suggestedParams:c});m.push({tx:L});let N=[];if(n===0){const x=e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:l,amount:A,suggestedParams:c});m.push({tx:x}),N=[f,l,l]}else{const x=e.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:l,amount:A,assetIndex:n,suggestedParams:c});m.push({tx:x}),N=u!=null&&u.address?[f,l,u.address]:[f,l]}const W=[p.sendTransfer,e.bignum.toBytes(n,8),e.bignum.toBytes(A,8),h,e.bignum.toBytes(I,8),e.bignum.toBytes(B,8)];i&&W.push(i);const F=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:W,foreignApps:[e.safeBigIntToNumber(this.coreAppId)],foreignAssets:[n],accounts:N,suggestedParams:c});F.fee*=2,m.push({tx:F});for(const x of m)yield this.createUnsignedTx(x,"TokenBridge.transfer",!0)}async*redeem(o,t,r=!0,s){s||(s=await this.connection.getTransactionParams().do());const i=new e.AlgorandAddress(o).toString(),{accounts:a,txs:n}=await d.AlgorandWormholeCore.submitVAAHeader(this.connection,this.coreAppId,this.tokenBridgeAppId,t,i);let A,I="",h=[],c=0;if(t.payload.token.chain!==this.chain){A=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,t.payload.token),I=A.address();const f=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,I);c=new e.AlgorandAddress(f.slice(0,8)).toInt()}else{const f=new e.AlgorandAddress(t.payload.token.address).toBigInt();A=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,f),I=A.address(),c=e.safeBigIntToNumber(f)}a.push(I);let B=0,w="";if(t.payloadName==="TransferWithPayload"?(B=new e.AlgorandAddress(t.payload.to.address).toInt(),w=e.getApplicationAddress(B)):w=new e.AlgorandAddress(t.payload.to.address.toUint8Array()).toString(),a.push(w),c!==0&&(h.push(c),!await p.isOptedInToAsset(this.connection,w,c))){if(i!=w)throw new Error("Cannot ASA optin for somebody else (asset "+c.toString()+")");n.unshift({tx:e.makeAssetTransferTxnWithSuggestedParamsFromObject({amount:0,assetIndex:c,from:i,suggestedParams:s,to:i})})}const m={accounts:a,appArgs:[p.completeTransfer,e.serialize(t)],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:h,from:i,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:s};n.push({tx:e.makeApplicationCallTxnFromObject(m)}),n[n.length-1].tx.fee=n[n.length-1].tx.fee*(t.payloadName==="Transfer"&&t.payload.fee!==void 0&&t.payload.fee===0n?2:3),t.payloadName==="TransferWithPayload"&&(n[n.length-1].tx.appForeignApps=[B],n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[j.getSelector(),j.args[0].type.encode(e.serialize(t))],appIndex:B,foreignAssets:h,from:i,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:s})}));for(const f of n)yield this.createUnsignedTx(f,"TokenBridge.redeem",!0)}static async isOptedInToAsset(o,t,r){var s;try{const i=await o.accountAssetInformation(t,r).do();return(((s=e.AccountAssetResponse.from_obj_for_encoding(i).assetHolding)==null?void 0:s.amount)??0)>0}catch{}return!1}createUnsignedTx(o,t,r=!0){return new d.AlgorandUnsignedTransaction(o,this.network,this.chain,t,r)}};g(p,"sendTransfer",e.bytes.encode("sendTransfer")),g(p,"attestToken",e.bytes.encode("attestToken")),g(p,"noop",e.bytes.encode("nop")),g(p,"optIn",e.bytes.encode("optin")),g(p,"completeTransfer",e.bytes.encode("completeTransfer")),g(p,"receiveAttest",e.bytes.encode("receiveAttest"));let O=p;e.registerProtocol(e._platform$4,"TokenBridge",O);exports.AlgorandTokenBridge=O;exports.TransferMethodSelector=j;
|
|
1
|
+
"use strict";var P=Object.defineProperty;var U=(k,o,t)=>o in k?P(k,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):k[o]=t;var g=(k,o,t)=>U(k,typeof o!="symbol"?o+"":o,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-C4PiSpuF.js"),e=require("./index-CjaaWCsQ.js"),v=require("./algorand-DZQLtCs3.js"),j=e.ABIMethod.fromSignature("portal_transfer(byte[])byte[]"),p=class p{constructor(o,t,r,s){g(this,"network");g(this,"chain");g(this,"connection");g(this,"contracts");g(this,"chainId");g(this,"coreBridge");g(this,"coreAppId");g(this,"coreAppAddress");g(this,"tokenBridgeAppId");g(this,"tokenBridgeAddress");if(this.network=o,this.chain=t,this.connection=r,this.contracts=s,this.chainId=e.toChainId(t),!s.coreBridge)throw new Error(`Core contract address for chain ${t} not found`);const i=BigInt(s.coreBridge);if(this.coreAppId=i,this.coreAppAddress=e.getApplicationAddress(i),this.coreBridge=new d.AlgorandWormholeCore(o,t,r,s),!s.tokenBridge)throw new Error(`TokenBridge contract address for chain ${t} not found`);const a=BigInt(s.tokenBridge);this.tokenBridgeAppId=a,this.tokenBridgeAddress=e.getApplicationAddress(a)}static async fromRpc(o,t){const[r,s]=await v.AlgorandPlatform.chainFromRpc(o),i=t[s];if(i.network!==r)throw new Error(`Network mismatch: ${i.network} != ${r}`);return new p(r,s,o,i.contracts)}async isWrappedAsset(o){const t=new e.AlgorandAddress(o).toInt();if(t===0)return!1;const r=await this.connection.getAssetByID(t).do(),i=e.Asset.from_obj_for_encoding(r).params.creator,a=await this.connection.accountInformation(i).exclude("all").do(),n=e.Account.from_obj_for_encoding(a);return(n==null?void 0:n.authAddr)===this.tokenBridgeAddress}async getOriginalAsset(o){const t=new e.AlgorandAddress(o).toInt(),r=await this.connection.getAssetByID(t).do(),s=e.Asset.from_obj_for_encoding(r),i=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,s.params.creator);if(i.length<94)throw new Error("Invalid local state data");const a=i.slice(92,94),n=e.toChain(e.bignum.decode(a)),A=new e.UniversalAddress(i.slice(60,92));return{chain:n,address:A}}async getTokenUniversalAddress(o){return new e.AlgorandAddress(o).toUniversalAddress()}async getTokenNativeAddress(o,t){return new e.AlgorandAddress(t).toNative()}async getWrappedAsset(o){if(e.isNative(o.address))throw new Error("native asset cannot be a wrapped asset");const t=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,o),r=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,t.address());if(r.length<8)throw new Error("Invalid wrapped asset data");return e.toNative(this.chain,e.bignum.decode(r.slice(0,8)).toString())}async hasWrappedAsset(o){try{return await this.getWrappedAsset(o),!0}catch{}return!1}async getWrappedNative(){return e.toNative(this.chain,"0")}async isTransferCompleted(o){const t=d.StorageLogicSig.forMessageId(this.tokenBridgeAppId,{sequence:o.sequence,chain:o.emitterChain,emitter:o.emitterAddress});try{return await d.StorageLogicSig.checkBitsSet(this.connection,this.tokenBridgeAppId,t.address(),o.sequence)}catch{}return!1}async*createAttestation(o,t){if(!t)throw new Error("Payer required to create attestation");const r=new e.AlgorandAddress(t).toString(),s=new e.AlgorandAddress(o).toInt(),i=[],a=await this.connection.getTransactionParams().do(),n=d.StorageLogicSig.forEmitter(this.coreAppId,new e.AlgorandAddress(this.tokenBridgeAddress).toUint8Array()),{accounts:[A],txs:I}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.coreAppId,n,a);i.push(...I);let h="",c;if(s!==0){const u=await this.connection.getAssetByID(s).do(),b=e.Asset.from_obj_for_encoding(u),S=await this.connection.accountInformation(b.params.creator).do();if(c=e.Account.from_obj_for_encoding(S),c.authAddr===this.tokenBridgeAddress.toString())throw new Error("Cannot re-attest wormhole assets")}const B=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(s)),w=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.tokenBridgeAppId,B);h=w.accounts[0],i.push(...w.txs);const m=e.makeApplicationCallTxnFromObject({from:r,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.noop],suggestedParams:a});i.push({tx:m});const f=await this.coreBridge.getMessageFee();if(f>BigInt(0)){const u=e.makePaymentTxnWithSuggestedParamsFromObject({from:r,suggestedParams:a,to:this.tokenBridgeAddress,amount:f});i.push({tx:u})}let y=[A,h,this.coreAppAddress];c&&y.push(c.address);let l=e.makeApplicationCallTxnFromObject({appArgs:[p.attestToken,e.bignum.toBytes(s,8)],accounts:y,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignApps:[e.safeBigIntToNumber(this.coreAppId)],foreignAssets:[s],from:r,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:a});f>BigInt(0)?l.fee*=3:l.fee*=2,i.push({tx:l});for(const u of i)yield this.createUnsignedTx(u,"TokenBridge.createAttestation",!0)}async*submitAttestation(o,t,r){if(!t)throw new Error("Sender required to submit attestation");r||(r=await this.connection.getTransactionParams().do());const s=t.toString(),a=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,o.payload.token).address(),n=[],A=[],I=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,a);I.length>8&&A.push(new e.AlgorandAddress(I.slice(0,8)).toInt()),n.push({tx:e.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:a,amount:1e5,suggestedParams:r})});let h=new Uint8Array(1);h[0]=1,n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[p.noop,h],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),h=new Uint8Array(1),h[0]=2,n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[p.noop,h],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),n.push({tx:e.makeApplicationCallTxnFromObject({accounts:[],appArgs:[p.receiveAttest,e.serialize(o)],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:A,from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),n[n.length-1].tx.fee=n[n.length-1].tx.fee*2;for(const c of n)yield this.createUnsignedTx(c,"TokenBridge.submitAttestation",!0)}async*transfer(o,t,r,s,i){const a=o.toString(),n=e.isNative(r)?0:new e.AlgorandAddress(r).toInt(),A=s,I=e.toChainId(t.chain),h=t.address.toUniversalAddress().toUint8Array(),c=await this.connection.getTransactionParams().do(),B=BigInt(0),w=d.StorageLogicSig.fromData({appId:this.coreAppId,appAddress:e.decodeAddress(this.coreAppAddress).publicKey,idx:BigInt(0),address:e.decodeAddress(this.tokenBridgeAddress).publicKey}),m=[],{accounts:[f],txs:y}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.coreAppId,w,c);m.push(...y);let l="",u,b=!1;if(n!==0){const x=await this.connection.getAssetByID(n).do();l=e.Asset.from_obj_for_encoding(x).params.creator;const C=await this.connection.accountInformation(l).do();u=e.Account.from_obj_for_encoding(C),b=u.authAddr===this.tokenBridgeAddress.toString()}const S=await this.coreBridge.getMessageFee();if(S>0&&m.push({tx:e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:this.tokenBridgeAddress,amount:S,suggestedParams:c})}),!b){const x=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(n)),{accounts:[T],txs:C}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.tokenBridgeAppId,x,c);l=T,C.push(...C)}if(n!==0&&!await p.isOptedInToAsset(this.connection,l,n)){const x=e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:l,amount:1e5,suggestedParams:c});let T=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.optIn,e.bigIntToBytes(n,8)],foreignAssets:[n],accounts:[l],suggestedParams:c});T.fee*=2,m.unshift({tx:x},{tx:T})}const L=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.noop],suggestedParams:c});m.push({tx:L});let N=[];if(n===0){const x=e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:l,amount:A,suggestedParams:c});m.push({tx:x}),N=[f,l,l]}else{const x=e.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:l,amount:A,assetIndex:n,suggestedParams:c});m.push({tx:x}),N=u!=null&&u.address?[f,l,u.address]:[f,l]}const W=[p.sendTransfer,e.bignum.toBytes(n,8),e.bignum.toBytes(A,8),h,e.bignum.toBytes(I,8),e.bignum.toBytes(B,8)];i&&W.push(i);const F=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:W,foreignApps:[e.safeBigIntToNumber(this.coreAppId)],foreignAssets:[n],accounts:N,suggestedParams:c});F.fee*=2,m.push({tx:F});for(const x of m)yield this.createUnsignedTx(x,"TokenBridge.transfer",!0)}async*redeem(o,t,r=!0,s){s||(s=await this.connection.getTransactionParams().do());const i=new e.AlgorandAddress(o).toString(),{accounts:a,txs:n}=await d.AlgorandWormholeCore.submitVAAHeader(this.connection,this.coreAppId,this.tokenBridgeAppId,t,i);let A,I="",h=[],c=0;if(t.payload.token.chain!==this.chain){A=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,t.payload.token),I=A.address();const f=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,I);c=new e.AlgorandAddress(f.slice(0,8)).toInt()}else{const f=new e.AlgorandAddress(t.payload.token.address).toBigInt();A=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,f),I=A.address(),c=e.safeBigIntToNumber(f)}a.push(I);let B=0,w="";if(t.payloadName==="TransferWithPayload"?(B=new e.AlgorandAddress(t.payload.to.address).toInt(),w=e.getApplicationAddress(B)):w=new e.AlgorandAddress(t.payload.to.address.toUint8Array()).toString(),a.push(w),c!==0&&(h.push(c),!await p.isOptedInToAsset(this.connection,w,c))){if(i!=w)throw new Error("Cannot ASA optin for somebody else (asset "+c.toString()+")");n.unshift({tx:e.makeAssetTransferTxnWithSuggestedParamsFromObject({amount:0,assetIndex:c,from:i,suggestedParams:s,to:i})})}const m={accounts:a,appArgs:[p.completeTransfer,e.serialize(t)],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:h,from:i,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:s};n.push({tx:e.makeApplicationCallTxnFromObject(m)}),n[n.length-1].tx.fee=n[n.length-1].tx.fee*(t.payloadName==="Transfer"&&t.payload.fee!==void 0&&t.payload.fee===0n?2:3),t.payloadName==="TransferWithPayload"&&(n[n.length-1].tx.appForeignApps=[B],n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[j.getSelector(),j.args[0].type.encode(e.serialize(t))],appIndex:B,foreignAssets:h,from:i,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:s})}));for(const f of n)yield this.createUnsignedTx(f,"TokenBridge.redeem",!0)}static async isOptedInToAsset(o,t,r){var s;try{const i=await o.accountAssetInformation(t,r).do();return(((s=e.AccountAssetResponse.from_obj_for_encoding(i).assetHolding)==null?void 0:s.amount)??0)>0}catch{}return!1}createUnsignedTx(o,t,r=!0){return new d.AlgorandUnsignedTransaction(o,this.network,this.chain,t,r)}};g(p,"sendTransfer",e.bytes.encode("sendTransfer")),g(p,"attestToken",e.bytes.encode("attestToken")),g(p,"noop",e.bytes.encode("nop")),g(p,"optIn",e.bytes.encode("optin")),g(p,"completeTransfer",e.bytes.encode("completeTransfer")),g(p,"receiveAttest",e.bytes.encode("receiveAttest"));let O=p;e.registerProtocol(e._platform$4,"TokenBridge",O);exports.AlgorandTokenBridge=O;exports.TransferMethodSelector=j;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var Zr = Object.defineProperty;
|
|
2
2
|
var Qr = (t, e, r) => e in t ? Zr(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
3
|
var C = (t, e, r) => Qr(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
-
import { ac as Yr, F as en, cT as ft, L as tn, cU as hr, cV as ke, aj as rn, c9 as nt, bO as nn, ca as nr, a8 as ce, Q as ge, p as oe, bL as sn, cf as ir, cc as an, cW as on, bP as ht, N as cn, u as De, a5 as un, cq as sr, cX as dn, O as ar, bU as gr } from "./index-
|
|
5
|
-
import { g as tt, a as gt, i as Ve, S as Y, b as H, p as ln, c as fn, d as it, u as ze, e as pr, f as hn, h as He, j as gn, k as pn } from "./sui-
|
|
6
|
-
import "./index-
|
|
4
|
+
import { ac as Yr, F as en, cT as ft, L as tn, cU as hr, cV as ke, aj as rn, c9 as nt, bO as nn, ca as nr, a8 as ce, Q as ge, p as oe, bL as sn, cf as ir, cc as an, cW as on, bP as ht, N as cn, u as De, a5 as un, cq as sr, cX as dn, O as ar, bU as gr } from "./index-DCFAlA0r.mjs";
|
|
5
|
+
import { g as tt, a as gt, i as Ve, S as Y, b as H, p as ln, c as fn, d as it, u as ze, e as pr, f as hn, h as He, j as gn, k as pn } from "./sui-BCKOTjLA.mjs";
|
|
6
|
+
import "./index-CfsjU0i8.mjs";
|
|
7
7
|
class yr {
|
|
8
8
|
constructor(e, r, n, i, s = !1) {
|
|
9
9
|
C(this, "transaction");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var D=Object.defineProperty;var q=(o,e,n)=>e in o?D(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n;var p=(o,e,n)=>q(o,typeof e!="symbol"?e+"":e,n);const t=require("./index-COPDbEYS.js"),H=require("./algorand-B5akecmo.js");class j{constructor(e,n,r,s,i=!1){p(this,"transaction");p(this,"network");p(this,"chain");p(this,"description");p(this,"parallelizable");this.transaction=e,this.network=n,this.chain=r,this.description=s,this.parallelizable=i}}const K=1002e3,O=15,U=127,L=8,R=U*L,V=U*O,N=L*V,m={_limit:127,encodingLength:o=>{let e=0;for(;o>=128;e++)o>>=7;return e+1},encode:(o,e,n)=>{if(typeof o=="bigint"&&(o=t.safeBigIntToNumber(o)),o<0)throw new RangeError("value must be unsigned");const r=m.encodingLength(o);if(e=e||new ArrayBuffer(r),n=n||0,e.byteLength<n+r)throw new RangeError("the buffer is too small to encode the number at the offset");const s=new Uint8Array(e,n);let i=0;for(;m._limit<o;)s[i++]=o&m._limit|128,o>>=7;return s[i]=Number(o),s},decode:(o,e=0)=>{let n=0,r=0,s;do{if(s=o[e+r],s===void 0)throw new RangeError("offset out of range");n+=(s&m._limit)<<r*7,r++}while(128<=s);return n}},u={forMessageId:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey,r=e.emitter.toUniversalAddress().toUint8Array(),s=t.bignum.toBytes(BigInt(t.toChainId(e.chain)),2),i=t.bytes.concat(s,r);return u.fromData({appId:o,appAddress:n,idx:e.sequence/BigInt(N),address:i})},forWrappedAsset:(o,e)=>{if(t.isNative(e.address))throw new Error("native asset cannot be a wrapped asset");const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:BigInt(t.toChainId(e.chain)),address:e.address.toUniversalAddress().toUint8Array()})},forNativeAsset:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:e,address:t.bytes.encode("native")})},forGuardianSet:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:BigInt(e),address:t.bytes.encode("guardian")})},forEmitter:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:0n,address:e})},_encode:o=>typeof o=="bigint"?[t.hex.encode(m.encode(o))]:[t.hex.encode(m.encode(o.length)),t.hex.encode(o)],fromData:o=>{const e=["0620010181",...u._encode(o.idx),"4880",...u._encode(o.address),"483110810612443119221244311881",...u._encode(o.appId),"1244312080",...u._encode(o.appAddress),"124431018100124431093203124431153203124422"],n=t.hex.decode(e.join(""));return new t.LogicSigAccount(n)},decodeLocalState:async(o,e,n)=>{let r;try{const a=await o.accountApplicationInformation(n,t.safeBigIntToNumber(e)).do();r=t.AccountApplicationResponse.from_obj_for_encoding(a).appLocalState}catch{return new Uint8Array}const s=t.b64.encode("meta");let i=new Map;for(const a of r.keyValue){if(a.key===s)continue;const g=t.b64.decode(a.key)[0],l=t.b64.decode(a.value.bytes);i.set(g,l)}const d=[];for(let a=0;a<O;a++)i.has(a)&&d.push(i.get(a));return t.bytes.concat(...d)},checkBitsSet:async(o,e,n,r)=>{let s=!1,i;const d=await o.accountInformation(n).do(),g=t.Account.from_obj_for_encoding(d).appsLocalState;if(g&&g.forEach(h=>{BigInt(h.id)===e&&(i=h.keyValue)}),(i==null?void 0:i.length)===0)return s;const l=BigInt(N),f=BigInt(8),y=r/l*l,b=t.safeBigIntToNumber(r-y),T=Math.floor(b/R),x=Math.floor((b-T*R)/8),B=t.b64.encode(t.bignum.toBytes(T,1));return i==null||i.forEach(h=>{if(h.key===B){const _=t.dist.Buffer.from(h.value.bytes,"base64"),w=1<<t.safeBigIntToNumber(r%f);s=(_[x]&w)!=0;return}}),s},storageAccountExists:async(o,e,n)=>{try{const r=await o.accountApplicationInformation(e,t.safeBigIntToNumber(n)).do();return Object.keys(r).length>0}catch{}return!1}},c=class c{constructor(e,n,r,s){p(this,"network");p(this,"chain");p(this,"connection");p(this,"contracts");p(this,"chainId");p(this,"coreAppId");p(this,"coreAppAddress");p(this,"tokenBridgeAppId");p(this,"tokenBridgeAppAddress");if(this.network=e,this.chain=n,this.connection=r,this.contracts=s,this.chainId=t.toChainId(n),!s.coreBridge)throw new Error(`Core contract address for chain ${n} not found`);const i=BigInt(s.coreBridge);if(this.coreAppId=i,this.coreAppAddress=t.getApplicationAddress(i),!s.tokenBridge)throw new Error(`TokenBridge contract address for chain ${n} not found`);const d=BigInt(s.tokenBridge);this.tokenBridgeAppId=d,this.tokenBridgeAppAddress=t.getApplicationAddress(d)}getGuardianSet(e){throw new Error("Method not implemented.")}async*verifyMessage(e,n,r){const s=new t.AlgorandAddress(e).toString(),i=await c.submitVAAHeader(this.connection,this.coreAppId,r??this.coreAppId,n,s);for(const d of i.txs)yield this.createUnsignedTx(d,"Core.verifyMessage")}static async fromRpc(e,n){const[r,s]=await H.AlgorandPlatform.chainFromRpc(e),i=n[s];if(i.network!==r)throw new Error(`Network mismatch: ${i.network} !== ${r}`);return new c(r,s,e,i.contracts)}async*publishMessage(e,n){const r=new t.AlgorandAddress(e),s=r.toString(),i=await this.connection.getTransactionParams().do(),d=u.forEmitter(this.coreAppId,r.toUint8Array()),{accounts:a,txs:g}=await c.maybeCreateStorageTx(this.connection,s,this.coreAppId,d,i);for(const f of g)yield this.createUnsignedTx(f,"Core.publishMessage",!0);const l=t.makeApplicationCallTxnFromObject({from:s,appIndex:t.safeBigIntToNumber(this.coreAppId),appArgs:[c.publishMessage,n,t.bignum.toBytes(0n,8)],accounts:a,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:i});yield this.createUnsignedTx({tx:l},"Core.publishMessage",!0)}async getMessageFee(){var s;const e=await this.connection.getApplicationByID(t.safeBigIntToNumber(this.coreAppId)).do(),r=(s=t.Application.from_obj_for_encoding(e).params.globalState)==null?void 0:s.find(i=>i.key===c.feeKey);return r?BigInt(r.value.uint):0n}async getGuardianSetIndex(){throw new Error("Not implemented")}async parseTransaction(e){const n=await this.connection.pendingTransactionInformation(e).do(),r=t.PendingTransactionResponse.from_obj_for_encoding(n);return this.parseTx(r).map(s=>({chain:s.emitterChain,emitter:s.emitterAddress,sequence:s.sequence}))}async parseMessages(e){const n=await this.connection.pendingTransactionInformation(e).do(),r=t.PendingTransactionResponse.from_obj_for_encoding(n);return this.parseTx(r)}parseTx(e){const n=[];if(e.innerTxns&&e.innerTxns.length>0&&n.push(...e.innerTxns.flatMap(g=>this.parseTx(g))),BigInt(e.txn.txn.apid??0)!==this.coreAppId||!e.logs||e.logs.length===0)return n;const r=e.txn.txn.apaa??[];if(r.length!==3||!t.bytes.equals(new Uint8Array(r[0]),c.publishMessage))return n;const s=t.bignum.decode(e.logs[0]),i=new t.AlgorandAddress(e.txn.txn.snd).toUniversalAddress(),d=new Uint8Array(r[1]),a=t.bignum.decode(r[2]);return n.push(t.createVAA("Uint8Array",{emitterChain:this.chain,emitterAddress:i,sequence:s,guardianSet:0,timestamp:0,consistencyLevel:0,nonce:Number(a),payload:d,signatures:[]})),n}static async maybeCreateStorageTx(e,n,r,s,i){const d=t.getApplicationAddress(r),a=s.address(),g=[];if(await u.storageAccountExists(e,a,r))return{accounts:[a],txs:g};i=i??await e.getTransactionParams().do();const l=t.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:a,amount:K,suggestedParams:i});l.fee=l.fee*2,g.push({tx:l});const f=t.makeApplicationOptInTxnFromObject({from:a,appIndex:t.safeBigIntToNumber(r),rekeyTo:d,suggestedParams:i});return f.fee=0,g.push({tx:f,signer:{address:s.address(),signTxn:y=>Promise.resolve(t.signLogicSigTransaction(y,s).blob)}}),{accounts:[a],txs:g}}static async submitVAAHeader(e,n,r,s,i,d){d=d??await e.getTransactionParams().do();let a=[];const g=u.forMessageId(r,{chain:s.emitterChain,sequence:s.sequence,emitter:s.emitterAddress}),{accounts:l,txs:f}=await c.maybeCreateStorageTx(e,i,r,g,d);a.push(...f);const y=u.forGuardianSet(n,s.guardianSet),{accounts:[b],txs:T}=await c.maybeCreateStorageTx(e,i,n,y,d);a.push(...T);let x=[...l,b];const B=await u.decodeLocalState(e,n,b),h=t.keccak_256(s.hash),_=s.signatures.length,w=Math.ceil(_/c.MAX_SIGS_PER_TXN),k=20,C=new t.LogicSigAccount(c.ALGO_VERIFY);for(let M=0;M<w;M++){const v=M*c.MAX_SIGS_PER_TXN,S=s.signatures.slice(v,v+c.MAX_SIGS_PER_TXN),F=S.length*k,G=new Uint8Array(F);for(let A=0;A<S.length;A++){const P=S[A],Y=B.slice(P.guardianIndex*k+1,(P.guardianIndex+1)*k+1);G.set(Y,A*20)}const X=t.makeApplicationCallTxnFromObject({appArgs:[c.verifySigs,t.bytes.concat(...S.map(A=>t.bytes.concat(new Uint8Array([A.guardianIndex]),A.signature.encode()))),G,h],accounts:x,appIndex:t.safeBigIntToNumber(n),from:c.ALGO_VERIFY_HASH,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:d});X.fee=0,a.push({tx:X,signer:{address:C.address(),signTxn:A=>Promise.resolve(t.signLogicSigTransaction(A,C).blob)}})}const E=t.makeApplicationCallTxnFromObject({appArgs:[c.verifyVaa,t.serialize(s)],accounts:x,appIndex:t.safeBigIntToNumber(n),from:i,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:d});return E.fee=E.fee*(2+w),a.push({tx:E}),{accounts:x,txs:a}}createUnsignedTx(e,n,r=!0){return new j(e,this.network,this.chain,n,r)}};p(c,"MAX_SIGS_PER_TXN",6),p(c,"ALGO_VERIFY_HASH","EZATROXX2HISIRZDRGXW4LRQ46Z6IUJYYIHU3PJGP7P5IQDPKVX42N767A"),p(c,"ALGO_VERIFY",new Uint8Array([6,32,4,1,0,32,20,38,1,0,49,32,50,3,18,68,49,1,35,18,68,49,16,129,6,18,68,54,26,1,54,26,3,54,26,2,136,0,3,68,34,67,53,2,53,1,53,0,40,53,240,40,53,241,52,0,21,53,5,35,53,3,35,53,4,52,3,52,5,12,65,0,68,52,1,52,0,52,3,129,65,8,34,88,23,52,0,52,3,34,8,36,88,52,0,52,3,129,33,8,36,88,7,0,53,241,53,240,52,2,52,4,37,88,52,240,52,241,80,2,87,12,20,18,68,52,3,129,66,8,53,3,52,4,37,8,53,4,66,255,180,34,137])),p(c,"feeKey",t.b64.encode("MessageFee")),p(c,"verifyVaa",t.bytes.encode("verifyVAA")),p(c,"verifySigs",t.bytes.encode("verifySigs")),p(c,"publishMessage",t.bytes.encode("publishMessage"));let I=c;t.registerProtocol("Algorand","WormholeCore",I);const z=Object.freeze(Object.defineProperty({__proto__:null,AlgorandWormholeCore:I,BITS_PER_BYTE:L,BITS_PER_KEY:R,MAX_BITS:N,MAX_BYTES:V,MAX_BYTES_PER_KEY:U,MAX_KEYS:O,SEED_AMT:K,StorageLogicSig:u,varint:m},Symbol.toStringTag,{value:"Module"}));exports.AlgorandUnsignedTransaction=j;exports.AlgorandWormholeCore=I;exports.StorageLogicSig=u;exports.index=z;
|
|
1
|
+
"use strict";var D=Object.defineProperty;var q=(o,e,n)=>e in o?D(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n;var p=(o,e,n)=>q(o,typeof e!="symbol"?e+"":e,n);const t=require("./index-CjaaWCsQ.js"),H=require("./algorand-DZQLtCs3.js");class j{constructor(e,n,r,s,i=!1){p(this,"transaction");p(this,"network");p(this,"chain");p(this,"description");p(this,"parallelizable");this.transaction=e,this.network=n,this.chain=r,this.description=s,this.parallelizable=i}}const K=1002e3,O=15,U=127,L=8,R=U*L,V=U*O,N=L*V,m={_limit:127,encodingLength:o=>{let e=0;for(;o>=128;e++)o>>=7;return e+1},encode:(o,e,n)=>{if(typeof o=="bigint"&&(o=t.safeBigIntToNumber(o)),o<0)throw new RangeError("value must be unsigned");const r=m.encodingLength(o);if(e=e||new ArrayBuffer(r),n=n||0,e.byteLength<n+r)throw new RangeError("the buffer is too small to encode the number at the offset");const s=new Uint8Array(e,n);let i=0;for(;m._limit<o;)s[i++]=o&m._limit|128,o>>=7;return s[i]=Number(o),s},decode:(o,e=0)=>{let n=0,r=0,s;do{if(s=o[e+r],s===void 0)throw new RangeError("offset out of range");n+=(s&m._limit)<<r*7,r++}while(128<=s);return n}},u={forMessageId:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey,r=e.emitter.toUniversalAddress().toUint8Array(),s=t.bignum.toBytes(BigInt(t.toChainId(e.chain)),2),i=t.bytes.concat(s,r);return u.fromData({appId:o,appAddress:n,idx:e.sequence/BigInt(N),address:i})},forWrappedAsset:(o,e)=>{if(t.isNative(e.address))throw new Error("native asset cannot be a wrapped asset");const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:BigInt(t.toChainId(e.chain)),address:e.address.toUniversalAddress().toUint8Array()})},forNativeAsset:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:e,address:t.bytes.encode("native")})},forGuardianSet:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:BigInt(e),address:t.bytes.encode("guardian")})},forEmitter:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:0n,address:e})},_encode:o=>typeof o=="bigint"?[t.hex.encode(m.encode(o))]:[t.hex.encode(m.encode(o.length)),t.hex.encode(o)],fromData:o=>{const e=["0620010181",...u._encode(o.idx),"4880",...u._encode(o.address),"483110810612443119221244311881",...u._encode(o.appId),"1244312080",...u._encode(o.appAddress),"124431018100124431093203124431153203124422"],n=t.hex.decode(e.join(""));return new t.LogicSigAccount(n)},decodeLocalState:async(o,e,n)=>{let r;try{const a=await o.accountApplicationInformation(n,t.safeBigIntToNumber(e)).do();r=t.AccountApplicationResponse.from_obj_for_encoding(a).appLocalState}catch{return new Uint8Array}const s=t.b64.encode("meta");let i=new Map;for(const a of r.keyValue){if(a.key===s)continue;const g=t.b64.decode(a.key)[0],l=t.b64.decode(a.value.bytes);i.set(g,l)}const d=[];for(let a=0;a<O;a++)i.has(a)&&d.push(i.get(a));return t.bytes.concat(...d)},checkBitsSet:async(o,e,n,r)=>{let s=!1,i;const d=await o.accountInformation(n).do(),g=t.Account.from_obj_for_encoding(d).appsLocalState;if(g&&g.forEach(h=>{BigInt(h.id)===e&&(i=h.keyValue)}),(i==null?void 0:i.length)===0)return s;const l=BigInt(N),f=BigInt(8),y=r/l*l,b=t.safeBigIntToNumber(r-y),T=Math.floor(b/R),x=Math.floor((b-T*R)/8),B=t.b64.encode(t.bignum.toBytes(T,1));return i==null||i.forEach(h=>{if(h.key===B){const _=t.dist.Buffer.from(h.value.bytes,"base64"),w=1<<t.safeBigIntToNumber(r%f);s=(_[x]&w)!=0;return}}),s},storageAccountExists:async(o,e,n)=>{try{const r=await o.accountApplicationInformation(e,t.safeBigIntToNumber(n)).do();return Object.keys(r).length>0}catch{}return!1}},c=class c{constructor(e,n,r,s){p(this,"network");p(this,"chain");p(this,"connection");p(this,"contracts");p(this,"chainId");p(this,"coreAppId");p(this,"coreAppAddress");p(this,"tokenBridgeAppId");p(this,"tokenBridgeAppAddress");if(this.network=e,this.chain=n,this.connection=r,this.contracts=s,this.chainId=t.toChainId(n),!s.coreBridge)throw new Error(`Core contract address for chain ${n} not found`);const i=BigInt(s.coreBridge);if(this.coreAppId=i,this.coreAppAddress=t.getApplicationAddress(i),!s.tokenBridge)throw new Error(`TokenBridge contract address for chain ${n} not found`);const d=BigInt(s.tokenBridge);this.tokenBridgeAppId=d,this.tokenBridgeAppAddress=t.getApplicationAddress(d)}getGuardianSet(e){throw new Error("Method not implemented.")}async*verifyMessage(e,n,r){const s=new t.AlgorandAddress(e).toString(),i=await c.submitVAAHeader(this.connection,this.coreAppId,r??this.coreAppId,n,s);for(const d of i.txs)yield this.createUnsignedTx(d,"Core.verifyMessage")}static async fromRpc(e,n){const[r,s]=await H.AlgorandPlatform.chainFromRpc(e),i=n[s];if(i.network!==r)throw new Error(`Network mismatch: ${i.network} !== ${r}`);return new c(r,s,e,i.contracts)}async*publishMessage(e,n){const r=new t.AlgorandAddress(e),s=r.toString(),i=await this.connection.getTransactionParams().do(),d=u.forEmitter(this.coreAppId,r.toUint8Array()),{accounts:a,txs:g}=await c.maybeCreateStorageTx(this.connection,s,this.coreAppId,d,i);for(const f of g)yield this.createUnsignedTx(f,"Core.publishMessage",!0);const l=t.makeApplicationCallTxnFromObject({from:s,appIndex:t.safeBigIntToNumber(this.coreAppId),appArgs:[c.publishMessage,n,t.bignum.toBytes(0n,8)],accounts:a,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:i});yield this.createUnsignedTx({tx:l},"Core.publishMessage",!0)}async getMessageFee(){var s;const e=await this.connection.getApplicationByID(t.safeBigIntToNumber(this.coreAppId)).do(),r=(s=t.Application.from_obj_for_encoding(e).params.globalState)==null?void 0:s.find(i=>i.key===c.feeKey);return r?BigInt(r.value.uint):0n}async getGuardianSetIndex(){throw new Error("Not implemented")}async parseTransaction(e){const n=await this.connection.pendingTransactionInformation(e).do(),r=t.PendingTransactionResponse.from_obj_for_encoding(n);return this.parseTx(r).map(s=>({chain:s.emitterChain,emitter:s.emitterAddress,sequence:s.sequence}))}async parseMessages(e){const n=await this.connection.pendingTransactionInformation(e).do(),r=t.PendingTransactionResponse.from_obj_for_encoding(n);return this.parseTx(r)}parseTx(e){const n=[];if(e.innerTxns&&e.innerTxns.length>0&&n.push(...e.innerTxns.flatMap(g=>this.parseTx(g))),BigInt(e.txn.txn.apid??0)!==this.coreAppId||!e.logs||e.logs.length===0)return n;const r=e.txn.txn.apaa??[];if(r.length!==3||!t.bytes.equals(new Uint8Array(r[0]),c.publishMessage))return n;const s=t.bignum.decode(e.logs[0]),i=new t.AlgorandAddress(e.txn.txn.snd).toUniversalAddress(),d=new Uint8Array(r[1]),a=t.bignum.decode(r[2]);return n.push(t.createVAA("Uint8Array",{emitterChain:this.chain,emitterAddress:i,sequence:s,guardianSet:0,timestamp:0,consistencyLevel:0,nonce:Number(a),payload:d,signatures:[]})),n}static async maybeCreateStorageTx(e,n,r,s,i){const d=t.getApplicationAddress(r),a=s.address(),g=[];if(await u.storageAccountExists(e,a,r))return{accounts:[a],txs:g};i=i??await e.getTransactionParams().do();const l=t.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:a,amount:K,suggestedParams:i});l.fee=l.fee*2,g.push({tx:l});const f=t.makeApplicationOptInTxnFromObject({from:a,appIndex:t.safeBigIntToNumber(r),rekeyTo:d,suggestedParams:i});return f.fee=0,g.push({tx:f,signer:{address:s.address(),signTxn:y=>Promise.resolve(t.signLogicSigTransaction(y,s).blob)}}),{accounts:[a],txs:g}}static async submitVAAHeader(e,n,r,s,i,d){d=d??await e.getTransactionParams().do();let a=[];const g=u.forMessageId(r,{chain:s.emitterChain,sequence:s.sequence,emitter:s.emitterAddress}),{accounts:l,txs:f}=await c.maybeCreateStorageTx(e,i,r,g,d);a.push(...f);const y=u.forGuardianSet(n,s.guardianSet),{accounts:[b],txs:T}=await c.maybeCreateStorageTx(e,i,n,y,d);a.push(...T);let x=[...l,b];const B=await u.decodeLocalState(e,n,b),h=t.keccak_256(s.hash),_=s.signatures.length,w=Math.ceil(_/c.MAX_SIGS_PER_TXN),k=20,C=new t.LogicSigAccount(c.ALGO_VERIFY);for(let M=0;M<w;M++){const v=M*c.MAX_SIGS_PER_TXN,S=s.signatures.slice(v,v+c.MAX_SIGS_PER_TXN),F=S.length*k,G=new Uint8Array(F);for(let A=0;A<S.length;A++){const P=S[A],Y=B.slice(P.guardianIndex*k+1,(P.guardianIndex+1)*k+1);G.set(Y,A*20)}const X=t.makeApplicationCallTxnFromObject({appArgs:[c.verifySigs,t.bytes.concat(...S.map(A=>t.bytes.concat(new Uint8Array([A.guardianIndex]),A.signature.encode()))),G,h],accounts:x,appIndex:t.safeBigIntToNumber(n),from:c.ALGO_VERIFY_HASH,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:d});X.fee=0,a.push({tx:X,signer:{address:C.address(),signTxn:A=>Promise.resolve(t.signLogicSigTransaction(A,C).blob)}})}const E=t.makeApplicationCallTxnFromObject({appArgs:[c.verifyVaa,t.serialize(s)],accounts:x,appIndex:t.safeBigIntToNumber(n),from:i,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:d});return E.fee=E.fee*(2+w),a.push({tx:E}),{accounts:x,txs:a}}createUnsignedTx(e,n,r=!0){return new j(e,this.network,this.chain,n,r)}};p(c,"MAX_SIGS_PER_TXN",6),p(c,"ALGO_VERIFY_HASH","EZATROXX2HISIRZDRGXW4LRQ46Z6IUJYYIHU3PJGP7P5IQDPKVX42N767A"),p(c,"ALGO_VERIFY",new Uint8Array([6,32,4,1,0,32,20,38,1,0,49,32,50,3,18,68,49,1,35,18,68,49,16,129,6,18,68,54,26,1,54,26,3,54,26,2,136,0,3,68,34,67,53,2,53,1,53,0,40,53,240,40,53,241,52,0,21,53,5,35,53,3,35,53,4,52,3,52,5,12,65,0,68,52,1,52,0,52,3,129,65,8,34,88,23,52,0,52,3,34,8,36,88,52,0,52,3,129,33,8,36,88,7,0,53,241,53,240,52,2,52,4,37,88,52,240,52,241,80,2,87,12,20,18,68,52,3,129,66,8,53,3,52,4,37,8,53,4,66,255,180,34,137])),p(c,"feeKey",t.b64.encode("MessageFee")),p(c,"verifyVaa",t.bytes.encode("verifyVAA")),p(c,"verifySigs",t.bytes.encode("verifySigs")),p(c,"publishMessage",t.bytes.encode("publishMessage"));let I=c;t.registerProtocol("Algorand","WormholeCore",I);const z=Object.freeze(Object.defineProperty({__proto__:null,AlgorandWormholeCore:I,BITS_PER_BYTE:L,BITS_PER_KEY:R,MAX_BITS:N,MAX_BYTES:V,MAX_BYTES_PER_KEY:U,MAX_KEYS:O,SEED_AMT:K,StorageLogicSig:u,varint:m},Symbol.toStringTag,{value:"Module"}));exports.AlgorandUnsignedTransaction=j;exports.AlgorandWormholeCore=I;exports.StorageLogicSig=u;exports.index=z;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bA as f, bB as s, bC as t, bD as c, bE as d, bF as A, aZ as o, bG as O, bH as b } from "./index-
|
|
1
|
+
import { bA as f, bB as s, bC as t, bD as c, bE as d, bF as A, aZ as o, bG as O, bH as b } from "./index-DCFAlA0r.mjs";
|
|
2
2
|
class p extends Error {
|
|
3
3
|
constructor(r) {
|
|
4
4
|
super(r);
|