@wormhole-foundation/wormhole-connect 0.3.4-beta.3-development → 0.3.4-beta.5-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-xr4FQXXG.js → ccip-3Wt6ReJT.js} +1 -1
- package/dist/assets/{evm-hFktu6UR.js → evm-OtsElgWW.js} +15 -15
- package/dist/main.js +4 -4
- package/dist/src/routes/ntt/chains/solana/nttManager.d.ts +3 -4
- package/dist/src/routes/ntt/chains/solana/nttManager.d.ts.map +1 -1
- package/dist/src/routes/ntt/chains/solana/nttQuoter.d.ts +2 -2
- package/dist/src/routes/ntt/chains/solana/nttQuoter.d.ts.map +1 -1
- package/dist/src/routes/ntt/nttRelay.d.ts.map +1 -1
- package/dist/src/views/Bridge/Bridge.d.ts.map +1 -1
- package/lib/{aptos-A2P3fZwR.js → aptos-FYfrFJAn.js} +1 -1
- package/lib/{aptos-LzsTT-yE.mjs → aptos-yOAGVL0A.mjs} +1 -1
- package/lib/{ccip-MYRIWxwr.js → ccip-4DZ4y4JK.js} +1 -1
- package/lib/{ccip-EX9Uy7uh.mjs → ccip-bVd-xAgW.mjs} +3 -3
- package/lib/{cosmos-8BhxGLk5.mjs → cosmos-1ZHcemM-.mjs} +3 -3
- package/lib/{cosmos-LAGywRPJ.js → cosmos-I3W2GDrq.js} +1 -1
- package/lib/{evm-4xBDvIbh.mjs → evm-6AZAv06H.mjs} +344 -342
- package/lib/{evm-rkkBtxAA.js → evm-Dzswfm9c.js} +12 -12
- package/lib/{index-FCAzcpcI.js → index-89JtoVA8.js} +1 -1
- package/lib/{index-SXsxLkBQ.mjs → index-9RUWMOOC.mjs} +2 -2
- package/lib/{index-IzBi7jkq.js → index-IL1hzgXP.js} +1 -1
- package/lib/{index-HrOVvUmR.mjs → index-NnYKIwKJ.mjs} +1 -1
- package/lib/{index-DFThg9zD.js → index-SMvLj77M.js} +1 -1
- package/lib/{index-DiFBiIsU.js → index-V4A_PX6c.js} +3 -3
- package/lib/{index-f0MmfW4C.js → index-Y9Whgj7X.js} +1 -1
- package/lib/{index-TXf-Y_5p.mjs → index-aNk0rR65.mjs} +150 -133
- package/lib/{index-oQ6mMVQe.mjs → index-n7HccAMm.mjs} +3 -3
- package/lib/{index-6l7AaQMo.mjs → index-sTeBL6uV.mjs} +1 -1
- package/lib/{index.es-B2GmSqJ1.mjs → index.es-B5KKhbgG.mjs} +1 -1
- package/lib/{index.es-dyXbfeDn.js → index.es-FooOQYo2.js} +1 -1
- package/lib/{index.es-JGv9-9pp.js → index.es-Fw2-l5Vm.js} +1 -1
- package/lib/{index.es-wdCYxk2S.mjs → index.es-XUetntT2.mjs} +2 -2
- package/lib/{index.es-i0PmGTV8.js → index.es-iJxWQe3h.js} +2 -2
- package/lib/{index.es-qoSsRT_G.mjs → index.es-uE9XWdwW.mjs} +4 -4
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{libsodium-wrappers-x1Tf86Kb.js → libsodium-wrappers-HWiLdcvs.js} +1 -1
- package/lib/{libsodium-wrappers-ffJoUj0j.mjs → libsodium-wrappers-Iiu5QMxq.mjs} +1 -1
- package/lib/{sei-ams4Dv3V.js → sei-DXA4aJ5R.js} +1 -1
- package/lib/{sei-yioT3-Yb.mjs → sei-tHeAuZcQ.mjs} +2 -2
- package/lib/{solana-VyhiGF9X.mjs → solana-tyLp6YrX.mjs} +3 -3
- package/lib/{solana-2Gb2ijrF.js → solana-zPx_afVl.js} +1 -1
- package/lib/{solanaEmbed.esm-O2q9SxIk.mjs → solanaEmbed.esm-fOkHBl3q.mjs} +2 -2
- package/lib/{solanaEmbed.esm-AyFAReSD.js → solanaEmbed.esm-tQPC6nIa.js} +1 -1
- package/lib/src/routes/ntt/chains/solana/nttManager.d.ts +3 -4
- package/lib/src/routes/ntt/chains/solana/nttManager.d.ts.map +1 -1
- package/lib/src/routes/ntt/chains/solana/nttQuoter.d.ts +2 -2
- package/lib/src/routes/ntt/chains/solana/nttQuoter.d.ts.map +1 -1
- package/lib/src/routes/ntt/nttRelay.d.ts.map +1 -1
- package/lib/src/views/Bridge/Bridge.d.ts.map +1 -1
- package/lib/{sui-vAj128v8.js → sui-ATDAv5fP.js} +1 -1
- package/lib/{sui-8zqO_WMc.mjs → sui-l6oFo8G_.mjs} +1 -1
- package/package.json +2 -2
|
@@ -287663,7 +287663,7 @@ const walletConnection = {
|
|
|
287663
287663
|
if (Fe.getNetworkInfo().chainId !== e) {
|
|
287664
287664
|
if (Qe.context === Context.ETH)
|
|
287665
287665
|
try {
|
|
287666
|
-
const { switchChain: qe } = await import("./evm-
|
|
287666
|
+
const { switchChain: qe } = await import("./evm-6AZAv06H.mjs").then((We) => We.f);
|
|
287667
287667
|
await qe(Fe, e);
|
|
287668
287668
|
} catch (qe) {
|
|
287669
287669
|
if (qe instanceof NotSupported)
|
|
@@ -287671,7 +287671,7 @@ const walletConnection = {
|
|
|
287671
287671
|
throw qe;
|
|
287672
287672
|
}
|
|
287673
287673
|
if (Qe.context === Context.COSMOS) {
|
|
287674
|
-
const { switchChain: qe } = await import("./cosmos-
|
|
287674
|
+
const { switchChain: qe } = await import("./cosmos-1ZHcemM-.mjs");
|
|
287675
287675
|
await qe(Fe, e);
|
|
287676
287676
|
}
|
|
287677
287677
|
return Fe.getAddress();
|
|
@@ -287680,7 +287680,7 @@ const walletConnection = {
|
|
|
287680
287680
|
const Re = walletConnection[e];
|
|
287681
287681
|
Re && await Re.disconnect();
|
|
287682
287682
|
}, watchAsset = async (e, Re) => {
|
|
287683
|
-
const Fe = walletConnection[Re], { watchAsset: Qe } = await import("./evm-
|
|
287683
|
+
const Fe = walletConnection[Re], { watchAsset: Qe } = await import("./evm-6AZAv06H.mjs").then((Je) => Je.f);
|
|
287684
287684
|
await Qe(e, Fe);
|
|
287685
287685
|
}, signAndSendTransaction = async (e, Re, Fe, Qe = {}) => {
|
|
287686
287686
|
const Je = config$1.chains[e], qe = walletConnection[Fe];
|
|
@@ -287690,23 +287690,23 @@ const walletConnection = {
|
|
|
287690
287690
|
case Context.ETH:
|
|
287691
287691
|
return Re.transactionHash;
|
|
287692
287692
|
case Context.SOLANA: {
|
|
287693
|
-
const { signAndSendTransaction: We } = await import("./solana-
|
|
287693
|
+
const { signAndSendTransaction: We } = await import("./solana-tyLp6YrX.mjs");
|
|
287694
287694
|
return (await We(Re, qe, Qe)).id;
|
|
287695
287695
|
}
|
|
287696
287696
|
case Context.SUI: {
|
|
287697
|
-
const { signAndSendTransaction: We } = await import("./sui-
|
|
287697
|
+
const { signAndSendTransaction: We } = await import("./sui-l6oFo8G_.mjs");
|
|
287698
287698
|
return (await We(Re, qe)).id;
|
|
287699
287699
|
}
|
|
287700
287700
|
case Context.APTOS: {
|
|
287701
|
-
const { signAndSendTransaction: We } = await import("./aptos-
|
|
287701
|
+
const { signAndSendTransaction: We } = await import("./aptos-yOAGVL0A.mjs");
|
|
287702
287702
|
return (await We(Re, qe)).id;
|
|
287703
287703
|
}
|
|
287704
287704
|
case Context.SEI: {
|
|
287705
|
-
const { signAndSendTransaction: We } = await import("./sei-
|
|
287705
|
+
const { signAndSendTransaction: We } = await import("./sei-tHeAuZcQ.mjs");
|
|
287706
287706
|
return (await We(Re, qe)).id;
|
|
287707
287707
|
}
|
|
287708
287708
|
case Context.COSMOS: {
|
|
287709
|
-
const { signAndSendTransaction: We } = await import("./cosmos-
|
|
287709
|
+
const { signAndSendTransaction: We } = await import("./cosmos-1ZHcemM-.mjs");
|
|
287710
287710
|
return (await We(Re, qe)).id;
|
|
287711
287711
|
}
|
|
287712
287712
|
default:
|
|
@@ -287739,39 +287739,39 @@ const walletConnection = {
|
|
|
287739
287739
|
if (e === void 0)
|
|
287740
287740
|
return [];
|
|
287741
287741
|
if (e.context === Context.ETH) {
|
|
287742
|
-
const { wallets: Re } = await import("./evm-
|
|
287742
|
+
const { wallets: Re } = await import("./evm-6AZAv06H.mjs").then((Fe) => Fe.f);
|
|
287743
287743
|
return Object.values(mapWallets(Re, Context.ETH));
|
|
287744
287744
|
} else if (e.context === Context.SOLANA) {
|
|
287745
|
-
const { fetchOptions: Re } = await import("./solana-
|
|
287745
|
+
const { fetchOptions: Re } = await import("./solana-tyLp6YrX.mjs"), Fe = Re();
|
|
287746
287746
|
return Object.values(mapWallets(Fe, Context.SOLANA));
|
|
287747
287747
|
} else if (e.context === Context.SUI) {
|
|
287748
|
-
const Fe = await (await import("./sui-
|
|
287748
|
+
const Fe = await (await import("./sui-l6oFo8G_.mjs")).fetchOptions();
|
|
287749
287749
|
return Object.values(mapWallets(Fe, Context.SUI));
|
|
287750
287750
|
} else if (e.context === Context.APTOS) {
|
|
287751
|
-
const Fe = (await import("./aptos-
|
|
287751
|
+
const Fe = (await import("./aptos-yOAGVL0A.mjs")).fetchOptions();
|
|
287752
287752
|
return Object.values(mapWallets(Fe, Context.APTOS));
|
|
287753
287753
|
} else if (e.context === Context.SEI) {
|
|
287754
|
-
const Fe = await (await import("./sei-
|
|
287754
|
+
const Fe = await (await import("./sei-tHeAuZcQ.mjs")).fetchOptions();
|
|
287755
287755
|
return Object.values(mapWallets(Fe, Context.SEI));
|
|
287756
287756
|
} else if (e.context === Context.COSMOS)
|
|
287757
287757
|
if (e.id === CHAIN_ID_EVMOS$1) {
|
|
287758
287758
|
const {
|
|
287759
287759
|
wallets: { cosmosEvm: Re }
|
|
287760
|
-
} = await import("./cosmos-
|
|
287760
|
+
} = await import("./cosmos-1ZHcemM-.mjs");
|
|
287761
287761
|
return Object.values(
|
|
287762
287762
|
mapWallets(Re, Context.COSMOS, ["OKX Wallet"])
|
|
287763
287763
|
);
|
|
287764
287764
|
} else if (e.id === CHAIN_ID_INJECTIVE$1) {
|
|
287765
287765
|
const {
|
|
287766
287766
|
wallets: { cosmosEvm: Re }
|
|
287767
|
-
} = await import("./cosmos-
|
|
287767
|
+
} = await import("./cosmos-1ZHcemM-.mjs");
|
|
287768
287768
|
return Object.values(
|
|
287769
287769
|
mapWallets(Re, Context.COSMOS, ["OKX Wallet"])
|
|
287770
287770
|
);
|
|
287771
287771
|
} else {
|
|
287772
287772
|
const {
|
|
287773
287773
|
wallets: { cosmos: Re }
|
|
287774
|
-
} = await import("./cosmos-
|
|
287774
|
+
} = await import("./cosmos-1ZHcemM-.mjs");
|
|
287775
287775
|
return Object.values(mapWallets(Re, Context.COSMOS));
|
|
287776
287776
|
}
|
|
287777
287777
|
return [];
|
|
@@ -312392,25 +312392,25 @@ class NttQuoter {
|
|
|
312392
312392
|
}
|
|
312393
312393
|
}
|
|
312394
312394
|
// calculates the relay cost in lamports
|
|
312395
|
-
async calcRelayCost(Re, Fe = 0) {
|
|
312396
|
-
const [
|
|
312395
|
+
async calcRelayCost(Re, Fe, Qe = 0) {
|
|
312396
|
+
const [Je, qe, We, Ke] = await Promise.all([
|
|
312397
312397
|
this.getRegisteredChain(Re),
|
|
312398
|
-
this.getRegisteredNtt(
|
|
312398
|
+
this.getRegisteredNtt(new PublicKey$4(Fe)),
|
|
312399
312399
|
this.getInstance(),
|
|
312400
312400
|
this.program.provider.connection.getMinimumBalanceForRentExemption(
|
|
312401
312401
|
this.program.account.relayRequest.size
|
|
312402
312402
|
)
|
|
312403
312403
|
]);
|
|
312404
|
-
if (
|
|
312404
|
+
if (Je.nativePriceUsd === 0)
|
|
312405
312405
|
throw new Error("Native price is 0");
|
|
312406
|
-
if (
|
|
312406
|
+
if (We.solPriceUsd === 0)
|
|
312407
312407
|
throw new Error("SOL price is 0");
|
|
312408
|
-
if (
|
|
312408
|
+
if (Qe > Je.maxGasDropoffEth)
|
|
312409
312409
|
throw new Error("Requested gas dropoff exceeds allowed maximum");
|
|
312410
|
-
const
|
|
312411
|
-
return U64.to(
|
|
312410
|
+
const dt = Je.nativePriceUsd * (Qe + Je.gasPriceGwei * qe.gasCost / GWEI_PER_ETH), Ze = Ke / LAMPORTS_PER_SOL + (Je.basePriceUsd + dt) / We.solPriceUsd;
|
|
312411
|
+
return U64.to(Ze * 1.05, LAMPORTS_PER_SOL);
|
|
312412
312412
|
}
|
|
312413
|
-
async createRequestRelayInstruction(Re, Fe, Qe, Je) {
|
|
312413
|
+
async createRequestRelayInstruction(Re, Fe, Qe, Je, qe) {
|
|
312414
312414
|
return this.program.methods.requestRelay({
|
|
312415
312415
|
maxFee: Je,
|
|
312416
312416
|
gasDropoff: new BN$a(0)
|
|
@@ -312418,6 +312418,7 @@ class NttQuoter {
|
|
|
312418
312418
|
payer: Re,
|
|
312419
312419
|
instance: this.instance,
|
|
312420
312420
|
registeredChain: this.registeredChainPda(toChainId$1(Qe)),
|
|
312421
|
+
registeredNtt: this.registeredNttPda(new PublicKey$4(qe)),
|
|
312421
312422
|
outboxItem: Fe,
|
|
312422
312423
|
relayRequest: this.relayRequestPda(Fe),
|
|
312423
312424
|
systemProgram: SystemProgram.programId
|
|
@@ -312667,72 +312668,71 @@ var theta = {};
|
|
|
312667
312668
|
const RATE_LIMIT_DURATION = 24 * 60 * 60, $0 = class $0 {
|
|
312668
312669
|
constructor(Re) {
|
|
312669
312670
|
ys(this, "connection");
|
|
312670
|
-
ys(this, "program");
|
|
312671
312671
|
ys(this, "wormholeId");
|
|
312672
312672
|
this.nttId = Re;
|
|
312673
312673
|
const { connection: Fe } = solanaContext();
|
|
312674
312674
|
if (!Fe)
|
|
312675
312675
|
throw new Error("Connection not found");
|
|
312676
|
-
this.connection = Fe
|
|
312676
|
+
this.connection = Fe;
|
|
312677
312677
|
const Qe = config$1.wh.mustGetContracts("solana").core;
|
|
312678
312678
|
if (!Qe)
|
|
312679
312679
|
throw new Error("Core not found");
|
|
312680
312680
|
this.wormholeId = Qe;
|
|
312681
312681
|
}
|
|
312682
312682
|
async send(Re, Fe, Qe, Je, qe, We) {
|
|
312683
|
-
await this.
|
|
312684
|
-
const Ke = await this.getConfig(), dt = Keypair.generate(), Ze = config$1.wh.getContext(qe), ht = new PublicKey$4(Fe), Wn = getAssociatedTokenAddressSync(
|
|
312683
|
+
const Ke = await this.getProgram(), dt = await this.getConfig(), Ze = Keypair.generate(), ht = config$1.wh.getContext(qe), Wn = new PublicKey$4(Fe), Dt = getAssociatedTokenAddressSync(
|
|
312685
312684
|
new PublicKey$4(Re.address),
|
|
312686
|
-
|
|
312687
|
-
),
|
|
312688
|
-
payer:
|
|
312689
|
-
from:
|
|
312685
|
+
Wn
|
|
312686
|
+
), Fn = {
|
|
312687
|
+
payer: Wn,
|
|
312688
|
+
from: Dt,
|
|
312690
312689
|
amount: new BN$a(Je.toString()),
|
|
312691
312690
|
recipientChain: toChainName(qe),
|
|
312692
|
-
recipientAddress:
|
|
312693
|
-
fromAuthority:
|
|
312694
|
-
outboxItem:
|
|
312695
|
-
config:
|
|
312691
|
+
recipientAddress: ht.formatAddress(Qe),
|
|
312692
|
+
fromAuthority: Wn,
|
|
312693
|
+
outboxItem: Ze.publicKey,
|
|
312694
|
+
config: dt,
|
|
312696
312695
|
shouldQueue: !1
|
|
312697
312696
|
// revert instead of getting queued
|
|
312698
312697
|
};
|
|
312699
|
-
let
|
|
312700
|
-
|
|
312701
|
-
const
|
|
312702
|
-
payer:
|
|
312703
|
-
outboxItem:
|
|
312704
|
-
revertOnDelay: !
|
|
312705
|
-
}),
|
|
312706
|
-
amount:
|
|
312707
|
-
recipientChain: { id: toChainId$1(
|
|
312708
|
-
recipientAddress: Array.from(
|
|
312709
|
-
shouldQueue:
|
|
312710
|
-
},
|
|
312698
|
+
let Un;
|
|
312699
|
+
dt.mode.locking ? Un = await this.createTransferLockInstruction(Fn) : Un = await this.createTransferBurnInstruction(Fn);
|
|
312700
|
+
const Hn = await this.createReleaseOutboundInstruction({
|
|
312701
|
+
payer: Wn,
|
|
312702
|
+
outboxItem: Ze.publicKey,
|
|
312703
|
+
revertOnDelay: !Fn.shouldQueue
|
|
312704
|
+
}), qn = {
|
|
312705
|
+
amount: Fn.amount,
|
|
312706
|
+
recipientChain: { id: toChainId$1(Fn.recipientChain) },
|
|
312707
|
+
recipientAddress: Array.from(Fn.recipientAddress),
|
|
312708
|
+
shouldQueue: Fn.shouldQueue
|
|
312709
|
+
}, Xn = createApproveInstruction(
|
|
312710
|
+
Dt,
|
|
312711
|
+
this.sessionAuthorityAddress(Fn.fromAuthority, qn),
|
|
312711
312712
|
Wn,
|
|
312712
|
-
this.sessionAuthorityAddress(Dt.fromAuthority, Hn),
|
|
312713
|
-
ht,
|
|
312714
312713
|
BigInt(Je.toString())
|
|
312715
|
-
),
|
|
312716
|
-
if (
|
|
312717
|
-
const
|
|
312718
|
-
|
|
312714
|
+
), Zn = new Transaction();
|
|
312715
|
+
if (Zn.add(Xn, Un, Hn), !We) {
|
|
312716
|
+
const ir = getNttManagerConfigByAddress(
|
|
312717
|
+
Ke.programId.toString(),
|
|
312719
312718
|
"solana"
|
|
312720
312719
|
);
|
|
312721
|
-
if (!
|
|
312720
|
+
if (!ir || !ir.solanaQuoter)
|
|
312722
312721
|
throw new Error("no quoter");
|
|
312723
|
-
const
|
|
312724
|
-
|
|
312725
|
-
|
|
312722
|
+
const or = new NttQuoter(ir.solanaQuoter), Yn = await or.calcRelayCost(qe, ir.address), dr = await or.createRequestRelayInstruction(
|
|
312723
|
+
Wn,
|
|
312724
|
+
Ze.publicKey,
|
|
312726
312725
|
qe,
|
|
312727
|
-
|
|
312726
|
+
Yn,
|
|
312727
|
+
ir.address
|
|
312728
312728
|
);
|
|
312729
|
-
|
|
312729
|
+
Zn.add(dr);
|
|
312730
312730
|
}
|
|
312731
|
-
|
|
312732
|
-
const { blockhash:
|
|
312733
|
-
return
|
|
312731
|
+
Zn.feePayer = Wn;
|
|
312732
|
+
const { blockhash: jn } = await this.connection.getLatestBlockhash("finalized");
|
|
312733
|
+
return Zn.recentBlockhash = jn, await addComputeBudget(this.connection, Zn), Zn.partialSign(Ze), await signAndSendTransaction(
|
|
312734
312734
|
"solana",
|
|
312735
|
-
|
|
312735
|
+
Zn,
|
|
312736
312736
|
TransferWallet.SENDING,
|
|
312737
312737
|
{ commitment: "finalized" }
|
|
312738
312738
|
);
|
|
@@ -312878,7 +312878,7 @@ const RATE_LIMIT_DURATION = 24 * 60 * 60, $0 = class $0 {
|
|
|
312878
312878
|
derivePda(Re) {
|
|
312879
312879
|
const Fe = Re instanceof dist$8.Buffer ? [Re] : Re, [Qe] = PublicKey$4.findProgramAddressSync(
|
|
312880
312880
|
Fe,
|
|
312881
|
-
this.
|
|
312881
|
+
new PublicKey$4(this.nttId)
|
|
312882
312882
|
);
|
|
312883
312883
|
return Qe;
|
|
312884
312884
|
}
|
|
@@ -312965,7 +312965,7 @@ const RATE_LIMIT_DURATION = 24 * 60 * 60, $0 = class $0 {
|
|
|
312965
312965
|
recipientAddress: Array.from(Re.recipientAddress),
|
|
312966
312966
|
shouldQueue: Re.shouldQueue
|
|
312967
312967
|
};
|
|
312968
|
-
return await this.
|
|
312968
|
+
return await (await this.getProgram()).methods.transferBurn({
|
|
312969
312969
|
amount: Re.amount,
|
|
312970
312970
|
recipientChain: { id: Qe },
|
|
312971
312971
|
recipientAddress: Array.from(Re.recipientAddress),
|
|
@@ -312998,7 +312998,7 @@ const RATE_LIMIT_DURATION = 24 * 60 * 60, $0 = class $0 {
|
|
|
312998
312998
|
recipientAddress: Array.from(Re.recipientAddress),
|
|
312999
312999
|
shouldQueue: Re.shouldQueue
|
|
313000
313000
|
};
|
|
313001
|
-
return await this.
|
|
313001
|
+
return await (await this.getProgram()).methods.transferLock({
|
|
313002
313002
|
amount: Re.amount,
|
|
313003
313003
|
recipientChain: { id: Fe },
|
|
313004
313004
|
recipientAddress: Array.from(Re.recipientAddress),
|
|
@@ -313026,56 +313026,56 @@ const RATE_LIMIT_DURATION = 24 * 60 * 60, $0 = class $0 {
|
|
|
313026
313026
|
* Creates a release_outbound instruction. The `payer` needs to sign the transaction.
|
|
313027
313027
|
*/
|
|
313028
313028
|
async createReleaseOutboundInstruction(Re) {
|
|
313029
|
-
const Fe = getWormholeDerivedAccounts(
|
|
313030
|
-
|
|
313029
|
+
const Fe = await this.getProgram(), Qe = getWormholeDerivedAccounts(
|
|
313030
|
+
Fe.programId,
|
|
313031
313031
|
this.wormholeId
|
|
313032
313032
|
);
|
|
313033
|
-
return await
|
|
313033
|
+
return await Fe.methods.releaseWormholeOutbound({
|
|
313034
313034
|
revertOnDelay: Re.revertOnDelay
|
|
313035
313035
|
}).accounts({
|
|
313036
313036
|
payer: Re.payer,
|
|
313037
313037
|
config: { config: this.configAccountAddress() },
|
|
313038
313038
|
outboxItem: Re.outboxItem,
|
|
313039
313039
|
wormholeMessage: this.wormholeMessageAccountAddress(Re.outboxItem),
|
|
313040
|
-
emitter:
|
|
313041
|
-
transceiver: this.registeredTransceiverAddress(
|
|
313040
|
+
emitter: Qe.wormholeEmitter,
|
|
313041
|
+
transceiver: this.registeredTransceiverAddress(Fe.programId),
|
|
313042
313042
|
wormhole: {
|
|
313043
|
-
bridge:
|
|
313044
|
-
feeCollector:
|
|
313045
|
-
sequence:
|
|
313043
|
+
bridge: Qe.wormholeBridge,
|
|
313044
|
+
feeCollector: Qe.wormholeFeeCollector,
|
|
313045
|
+
sequence: Qe.wormholeSequence,
|
|
313046
313046
|
program: this.wormholeId
|
|
313047
313047
|
}
|
|
313048
313048
|
}).instruction();
|
|
313049
313049
|
}
|
|
313050
313050
|
async createReleaseInboundMintInstruction(Re) {
|
|
313051
|
-
const Fe = await this.getConfig(Re.config),
|
|
313052
|
-
return await
|
|
313051
|
+
const Fe = await this.getProgram(), Qe = await this.getConfig(Re.config), Je = await this.mintAccountAddress(Qe);
|
|
313052
|
+
return await Fe.methods.releaseInboundMint({
|
|
313053
313053
|
revertOnDelay: Re.revertOnDelay
|
|
313054
313054
|
}).accounts({
|
|
313055
313055
|
common: {
|
|
313056
313056
|
payer: Re.payer,
|
|
313057
313057
|
config: { config: this.configAccountAddress() },
|
|
313058
313058
|
inboxItem: this.inboxItemAccountAddress(Re.messageDigest),
|
|
313059
|
-
recipient: getAssociatedTokenAddressSync(
|
|
313060
|
-
mint:
|
|
313059
|
+
recipient: getAssociatedTokenAddressSync(Je, Re.recipient),
|
|
313060
|
+
mint: Je,
|
|
313061
313061
|
tokenAuthority: this.tokenAuthorityAddress()
|
|
313062
313062
|
}
|
|
313063
313063
|
}).instruction();
|
|
313064
313064
|
}
|
|
313065
313065
|
async createReleaseInboundUnlockInstruction(Re) {
|
|
313066
|
-
const Fe = await this.getConfig(Re.config),
|
|
313067
|
-
return await
|
|
313066
|
+
const Fe = await this.getProgram(), Qe = await this.getConfig(Re.config), Je = await this.mintAccountAddress(Qe);
|
|
313067
|
+
return await Fe.methods.releaseInboundUnlock({
|
|
313068
313068
|
revertOnDelay: Re.revertOnDelay
|
|
313069
313069
|
}).accounts({
|
|
313070
313070
|
common: {
|
|
313071
313071
|
payer: Re.payer,
|
|
313072
313072
|
config: { config: this.configAccountAddress() },
|
|
313073
313073
|
inboxItem: this.inboxItemAccountAddress(Re.messageDigest),
|
|
313074
|
-
recipient: getAssociatedTokenAddressSync(
|
|
313075
|
-
mint:
|
|
313074
|
+
recipient: getAssociatedTokenAddressSync(Je, Re.recipient),
|
|
313075
|
+
mint: Je,
|
|
313076
313076
|
tokenAuthority: this.tokenAuthorityAddress()
|
|
313077
313077
|
},
|
|
313078
|
-
custody: await this.custodyAccountAddress(
|
|
313078
|
+
custody: await this.custodyAccountAddress(Qe)
|
|
313079
313079
|
}).instruction();
|
|
313080
313080
|
}
|
|
313081
313081
|
async createReceiveWormholeMessageInstruction(Re) {
|
|
@@ -313083,7 +313083,7 @@ const RATE_LIMIT_DURATION = 24 * 60 * 60, $0 = class $0 {
|
|
|
313083
313083
|
"Ntt:WormholeTransfer",
|
|
313084
313084
|
Fe.payload
|
|
313085
313085
|
), Je = toChainId$1(Fe.emitterChain), qe = this.transceiverPeerAccountAddress(Je);
|
|
313086
|
-
return await this.
|
|
313086
|
+
return await (await this.getProgram()).methods.receiveWormholeMessage().accounts({
|
|
313087
313087
|
payer: Re.payer,
|
|
313088
313088
|
config: { config: this.configAccountAddress() },
|
|
313089
313089
|
peer: qe,
|
|
@@ -313101,8 +313101,8 @@ const RATE_LIMIT_DURATION = 24 * 60 * 60, $0 = class $0 {
|
|
|
313101
313101
|
), qe = toChainId$1(Qe.emitterChain), We = Ntt.messageDigest(
|
|
313102
313102
|
toChain(qe),
|
|
313103
313103
|
Je
|
|
313104
|
-
), Ke = this.peerAccountAddress(qe), dt = this.inboxRateLimitAccountAddress(qe);
|
|
313105
|
-
return await
|
|
313104
|
+
), Ke = this.peerAccountAddress(qe), dt = this.inboxRateLimitAccountAddress(qe), Ze = await this.getProgram();
|
|
313105
|
+
return await Ze.methods.redeem({}).accounts({
|
|
313106
313106
|
payer: Re.payer,
|
|
313107
313107
|
config: this.configAccountAddress(),
|
|
313108
313108
|
peer: Ke,
|
|
@@ -313110,7 +313110,7 @@ const RATE_LIMIT_DURATION = 24 * 60 * 60, $0 = class $0 {
|
|
|
313110
313110
|
qe,
|
|
313111
313111
|
dist$8.Buffer.from(Je.id)
|
|
313112
313112
|
),
|
|
313113
|
-
transceiver: this.registeredTransceiverAddress(
|
|
313113
|
+
transceiver: this.registeredTransceiverAddress(Ze.programId),
|
|
313114
313114
|
mint: await this.mintAccountAddress(Fe),
|
|
313115
313115
|
inboxItem: this.inboxItemAccountAddress(utils$P.hexlify(We)),
|
|
313116
313116
|
inboxRateLimit: dt,
|
|
@@ -313127,7 +313127,7 @@ const RATE_LIMIT_DURATION = 24 * 60 * 60, $0 = class $0 {
|
|
|
313127
313127
|
* once and passed around.
|
|
313128
313128
|
*/
|
|
313129
313129
|
async getConfig(Re) {
|
|
313130
|
-
return Re ?? await this.
|
|
313130
|
+
return Re ?? await (await this.getProgram()).account.config.fetch(this.configAccountAddress());
|
|
313131
313131
|
}
|
|
313132
313132
|
async isPaused(Re) {
|
|
313133
313133
|
return (await this.getConfig(Re)).paused;
|
|
@@ -313139,36 +313139,43 @@ const RATE_LIMIT_DURATION = 24 * 60 * 60, $0 = class $0 {
|
|
|
313139
313139
|
return (await this.getConfig(Re)).tokenProgram;
|
|
313140
313140
|
}
|
|
313141
313141
|
async getInboxItem(Re) {
|
|
313142
|
-
return await this.
|
|
313142
|
+
return await (await this.getProgram()).account.inboxItem.fetch(
|
|
313143
313143
|
this.inboxItemAccountAddress(Re)
|
|
313144
313144
|
);
|
|
313145
313145
|
}
|
|
313146
313146
|
async getOutboxRateLimit() {
|
|
313147
|
-
return await this.
|
|
313147
|
+
return await (await this.getProgram()).account.outboxRateLimit.fetch(
|
|
313148
313148
|
this.outboxRateLimitAccountAddress()
|
|
313149
313149
|
);
|
|
313150
313150
|
}
|
|
313151
313151
|
async getInboxRateLimit(Re) {
|
|
313152
|
-
return await this.
|
|
313152
|
+
return await (await this.getProgram()).account.inboxRateLimit.fetch(
|
|
313153
313153
|
this.inboxRateLimitAccountAddress(Re)
|
|
313154
313154
|
);
|
|
313155
313155
|
}
|
|
313156
313156
|
// View functions
|
|
313157
|
-
async
|
|
313158
|
-
var
|
|
313159
|
-
|
|
313160
|
-
|
|
313161
|
-
|
|
313162
|
-
|
|
313163
|
-
|
|
313164
|
-
|
|
313165
|
-
|
|
313166
|
-
|
|
313167
|
-
})
|
|
313168
|
-
|
|
313169
|
-
|
|
313170
|
-
|
|
313171
|
-
|
|
313157
|
+
async getVersion() {
|
|
313158
|
+
var We;
|
|
313159
|
+
const Fe = await new Program(IDL$1, this.nttId, {
|
|
313160
|
+
connection: this.connection
|
|
313161
|
+
}).methods.version().accountsStrict({}).instruction(), Qe = await this.connection.getLatestBlockhash(), Je = new PublicKey$4(
|
|
313162
|
+
"CHaW6yNSbYdAvxhRiEy7Wa6g7JLJQBYZxudadXTNqWX8"
|
|
313163
|
+
), qe = new TransactionMessage({
|
|
313164
|
+
payerKey: Je,
|
|
313165
|
+
recentBlockhash: Qe.blockhash,
|
|
313166
|
+
instructions: [Fe]
|
|
313167
|
+
}).compileToV0Message();
|
|
313168
|
+
try {
|
|
313169
|
+
const Ke = new VersionedTransaction(qe), Ze = (We = (await this.connection.simulateTransaction(Ke, {
|
|
313170
|
+
sigVerify: !1
|
|
313171
|
+
})).value.returnData) == null ? void 0 : We.data[0];
|
|
313172
|
+
if (!Ze)
|
|
313173
|
+
throw new Error("No version() return data");
|
|
313174
|
+
const ht = dist$8.Buffer.from(Ze, "base64"), Wn = ht.readUInt32LE(0);
|
|
313175
|
+
return ht.slice(4, Wn + 4).toString();
|
|
313176
|
+
} catch (Ke) {
|
|
313177
|
+
throw console.error(`Unable to fetch solana contract version: ${Ke}`), Ke;
|
|
313178
|
+
}
|
|
313172
313179
|
}
|
|
313173
313180
|
/**
|
|
313174
313181
|
* Returns the address of the custody account. If the config is available
|
|
@@ -313184,10 +313191,14 @@ const RATE_LIMIT_DURATION = 24 * 60 * 60, $0 = class $0 {
|
|
|
313184
313191
|
owner: this.tokenAuthorityAddress()
|
|
313185
313192
|
});
|
|
313186
313193
|
}
|
|
313187
|
-
async
|
|
313188
|
-
let
|
|
313189
|
-
if (
|
|
313190
|
-
|
|
313194
|
+
async getProgram() {
|
|
313195
|
+
let Re = $0.abiVersionCache.get(this.nttId);
|
|
313196
|
+
if (!Re) {
|
|
313197
|
+
if (await this.getVersion() !== "1.0.0")
|
|
313198
|
+
throw new UnsupportedContractAbiVersion();
|
|
313199
|
+
Re = new Program(IDL$1, this.nttId, { connection: this.connection }), $0.abiVersionCache.set(this.nttId, Re);
|
|
313200
|
+
}
|
|
313201
|
+
return Re;
|
|
313191
313202
|
}
|
|
313192
313203
|
};
|
|
313193
313204
|
ys($0, "abiVersionCache", /* @__PURE__ */ new Map());
|
|
@@ -313599,7 +313610,10 @@ class NttRelay extends NttBase {
|
|
|
313599
313610
|
if (toChainName(Fe) === "solana") {
|
|
313600
313611
|
if (!dt.solanaQuoter)
|
|
313601
313612
|
throw new Error("no solana quoter");
|
|
313602
|
-
const ht = await new NttQuoter(dt.solanaQuoter).calcRelayCost(
|
|
313613
|
+
const ht = await new NttQuoter(dt.solanaQuoter).calcRelayCost(
|
|
313614
|
+
Qe,
|
|
313615
|
+
dt.address
|
|
313616
|
+
);
|
|
313603
313617
|
return { fee: BigNumber$2.from(ht.toString()), feeToken: "native" };
|
|
313604
313618
|
}
|
|
313605
313619
|
throw new Error("unsupported chain");
|
|
@@ -337282,42 +337296,45 @@ function Bridge() {
|
|
|
337282
337296
|
};
|
|
337283
337297
|
}, [Ze, qe, dt, Fe]), useEffect(() => {
|
|
337284
337298
|
(async () => {
|
|
337285
|
-
var
|
|
337299
|
+
var $n, nr;
|
|
337286
337300
|
let fr = await RouteOperator.allSupportedDestTokens(
|
|
337287
337301
|
config$1.tokens[Ke],
|
|
337288
337302
|
qe,
|
|
337289
337303
|
We
|
|
337290
337304
|
);
|
|
337291
|
-
|
|
337292
|
-
|
|
337293
|
-
|
|
337305
|
+
if (Ke) {
|
|
337306
|
+
const pr = fr.filter((ar) => ar.nativeChain === We);
|
|
337307
|
+
pr.length > 0 && (fr = pr);
|
|
337308
|
+
}
|
|
337309
|
+
Fe(setSupportedDestTokens(fr));
|
|
337310
|
+
const sr = await RouteOperator.allSupportedDestTokens(
|
|
337294
337311
|
void 0,
|
|
337295
337312
|
qe,
|
|
337296
337313
|
We
|
|
337297
337314
|
);
|
|
337298
|
-
Fe(setAllSupportedDestTokens(
|
|
337299
|
-
const
|
|
337300
|
-
if (We &&
|
|
337301
|
-
const
|
|
337302
|
-
(
|
|
337303
|
-
var
|
|
337304
|
-
return
|
|
337315
|
+
Fe(setAllSupportedDestTokens(sr)), We && fr.length === 1 && Fe(setDestToken(fr[0].key));
|
|
337316
|
+
const Qn = fr.map((pr) => pr.symbol);
|
|
337317
|
+
if (We && Qn.every((pr) => pr === Qn[0]) && ["USDC", "tBTC"].includes(Qn[0])) {
|
|
337318
|
+
const pr = ($n = fr.find(
|
|
337319
|
+
(ar) => {
|
|
337320
|
+
var gr;
|
|
337321
|
+
return ar.symbol === Qn[0] && ar.nativeChain === ((gr = ar.tokenId) == null ? void 0 : gr.chain) && ar.nativeChain === We;
|
|
337305
337322
|
}
|
|
337306
|
-
)) == null ? void 0 :
|
|
337307
|
-
|
|
337323
|
+
)) == null ? void 0 : $n.key;
|
|
337324
|
+
pr && Fe(setDestToken(pr));
|
|
337308
337325
|
}
|
|
337309
337326
|
if (Ke && dt === "" && We && (!Ze || isPorticoRoute(Ze))) {
|
|
337310
|
-
const
|
|
337327
|
+
const pr = (nr = config$1.tokens[Ke]) == null ? void 0 : nr.symbol;
|
|
337311
337328
|
if ([
|
|
337312
337329
|
...ETHBridge.SUPPORTED_TOKENS,
|
|
337313
337330
|
...wstETHBridge.SUPPORTED_TOKENS
|
|
337314
|
-
].includes(
|
|
337315
|
-
let
|
|
337316
|
-
if (!
|
|
337317
|
-
const
|
|
337318
|
-
|
|
337331
|
+
].includes(pr)) {
|
|
337332
|
+
let gr = getNativeVersionOfToken(pr, We);
|
|
337333
|
+
if (!gr) {
|
|
337334
|
+
const _r = getWrappedToken(config$1.tokens[Ke]);
|
|
337335
|
+
gr = getNativeVersionOfToken(_r.symbol, We);
|
|
337319
337336
|
}
|
|
337320
|
-
|
|
337337
|
+
gr && isSupportedToken(gr, fr) && Fe(setDestToken(gr));
|
|
337321
337338
|
}
|
|
337322
337339
|
}
|
|
337323
337340
|
})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { d as $, p as Jt, s as Nr, g as jt, a9 as Br, ad as Rr } from "./index-
|
|
1
|
+
import { d as $, p as Jt, s as Nr, g as jt, a9 as Br, ad as Rr } from "./index-aNk0rR65.mjs";
|
|
2
2
|
import { d as Lr } from "./dijkstra-_4avdlbo.mjs";
|
|
3
|
-
import { Q as Mr } from "./index.es-
|
|
4
|
-
import { U as Pr, z as Or } from "./index.es-
|
|
3
|
+
import { Q as Mr } from "./index.es-XUetntT2.mjs";
|
|
4
|
+
import { U as Pr, z as Or } from "./index.es-B5KKhbgG.mjs";
|
|
5
5
|
import "react";
|
|
6
6
|
import "react-dom";
|
|
7
7
|
var Ir = function() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { q as P, b0 as Ye, d as Z, b1 as Ze, aW as it } from "./index-
|
|
1
|
+
import { q as P, b0 as Ye, d as Z, b1 as Ze, aW as it } from "./index-aNk0rR65.mjs";
|
|
2
2
|
var Je = {}, Qe = { exports: {} }, je = {};
|
|
3
3
|
(function(o) {
|
|
4
4
|
o.fetch = n(P.fetch) && n(P.ReadableStream), o.writableStream = n(P.WritableStream), o.abortController = n(P.AbortController);
|