@skip-go/client 1.3.7 → 1.4.0
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/cjs/api/getAssets.cjs +4 -4
- package/dist/cjs/api/getAssetsBetweenChains.cjs +3 -3
- package/dist/cjs/api/getBridges.cjs +3 -3
- package/dist/cjs/api/getChains.cjs +3 -3
- package/dist/cjs/api/getVenues.cjs +3 -3
- package/dist/cjs/api/postAssetsFromSource.cjs +4 -4
- package/dist/cjs/api/postBalances.cjs +3 -3
- package/dist/cjs/api/postIbcOriginAssets.cjs +3 -3
- package/dist/cjs/api/postMessages.cjs +3 -3
- package/dist/cjs/api/postMessagesDirect.cjs +3 -3
- package/dist/cjs/api/postRecommendAssets.cjs +3 -3
- package/dist/cjs/api/postRoute.cjs +3 -3
- package/dist/cjs/api/postSubmitTransaction.cjs +3 -3
- package/dist/cjs/api/postTrackTransaction.cjs +3 -3
- package/dist/cjs/api/postTransactionStatus.cjs +3 -3
- package/dist/cjs/chunk-3M7YYWGL.cjs +295 -0
- package/dist/cjs/{chunk-E2P5MVX3.cjs → chunk-46VB6RQK.cjs} +8 -8
- package/dist/cjs/{chunk-MW3TE7DC.cjs → chunk-5AYPH3ZR.cjs} +2 -2
- package/dist/cjs/{chunk-2CCLIBCC.cjs → chunk-5HDKZVOL.cjs} +2 -2
- package/dist/cjs/{chunk-YN66ABRQ.cjs → chunk-6LA66667.cjs} +126 -16
- package/dist/cjs/chunk-7MC3BVQN.cjs +370 -0
- package/dist/cjs/{chunk-YYBGBKRE.cjs → chunk-A26H4FVN.cjs} +4 -4
- package/dist/cjs/{chunk-P7CDAHIX.cjs → chunk-AXYRULAI.cjs} +2 -2
- package/dist/cjs/{chunk-WMXUOVHN.cjs → chunk-DWOE6N5S.cjs} +248 -532
- package/dist/cjs/{chunk-7I2KQNIU.cjs → chunk-EJMC4JXF.cjs} +2 -2
- package/dist/cjs/{chunk-HKQ5VION.cjs → chunk-ERGJBZUC.cjs} +5 -1
- package/dist/cjs/{chunk-J5RC6ZU5.cjs → chunk-FNB244QI.cjs} +6 -6
- package/dist/cjs/{chunk-2EKCOIWV.cjs → chunk-IDEJORRT.cjs} +155 -154
- package/dist/cjs/{chunk-DBDB2XWX.cjs → chunk-JBKNEFXB.cjs} +3 -3
- package/dist/cjs/{chunk-MN6HFZJA.cjs → chunk-KM2D7PJL.cjs} +33 -33
- package/dist/cjs/{chunk-XGBCEYWI.cjs → chunk-LHY62HPI.cjs} +2 -2
- package/dist/cjs/{chunk-EXK2GDR5.cjs → chunk-LUVMRHAJ.cjs} +2 -2
- package/dist/cjs/{chunk-QSISUSYP.cjs → chunk-N4UW74AG.cjs} +4 -4
- package/dist/cjs/{chunk-FY56EEFB.cjs → chunk-OZUCMWNE.cjs} +2 -2
- package/dist/cjs/{chunk-VKVHMUDR.cjs → chunk-Q43XCBMX.cjs} +6 -6
- package/dist/cjs/{chunk-2VQ2TNFM.cjs → chunk-QPM7H2YL.cjs} +2 -2
- package/dist/cjs/{chunk-FO25SR66.cjs → chunk-RCGCQD6T.cjs} +6 -6
- package/dist/cjs/chunk-VIG2BHYJ.cjs +185 -0
- package/dist/cjs/{chunk-DCFIIF7G.cjs → chunk-X5AJHZ2J.cjs} +2 -2
- package/dist/cjs/{chunk-AF7EI5BT.cjs → chunk-ZAATXQBG.cjs} +2 -2
- package/dist/cjs/{chunk-MCZ3F457.cjs → chunk-ZBPDDVQ2.cjs} +2 -2
- package/dist/cjs/{chunk-OEYY7NXT.cjs → chunk-ZKBSNSHQ.cjs} +187 -103
- package/dist/cjs/index.cjs +57 -51
- package/dist/cjs/public-functions/executeRoute.cjs +16 -15
- package/dist/cjs/public-functions/getCosmosGasAmountForMessage.cjs +5 -4
- package/dist/cjs/public-functions/getFeeInfoForChain.cjs +5 -5
- package/dist/cjs/public-functions/getRecommendedGasPrice.cjs +6 -6
- package/dist/cjs/public-functions/getSigningStargateClient.cjs +6 -5
- package/dist/cjs/public-functions/setApiOptions.cjs +3 -3
- package/dist/cjs/public-functions/setClientOptions.cjs +6 -5
- package/dist/cjs/public-functions/subscribeToRouteStatus.cjs +26 -0
- package/dist/cjs/public-functions/validateCosmosGasBalance.cjs +9 -8
- package/dist/cjs/public-functions/waitForTransaction.cjs +5 -5
- package/dist/esm/api/getAssets.js +2 -2
- package/dist/esm/api/getAssetsBetweenChains.js +2 -2
- package/dist/esm/api/getBridges.js +2 -2
- package/dist/esm/api/getChains.js +2 -2
- package/dist/esm/api/getVenues.js +2 -2
- package/dist/esm/api/postAssetsFromSource.js +3 -3
- package/dist/esm/api/postBalances.js +2 -2
- package/dist/esm/api/postIbcOriginAssets.js +2 -2
- package/dist/esm/api/postMessages.js +2 -2
- package/dist/esm/api/postMessagesDirect.js +2 -2
- package/dist/esm/api/postRecommendAssets.js +2 -2
- package/dist/esm/api/postRoute.js +2 -2
- package/dist/esm/api/postSubmitTransaction.js +2 -2
- package/dist/esm/api/postTrackTransaction.d.ts +2 -1
- package/dist/esm/api/postTrackTransaction.js +2 -2
- package/dist/esm/api/postTransactionStatus.d.ts +1 -1
- package/dist/esm/api/postTransactionStatus.js +2 -2
- package/dist/esm/callbacks-B3kjKg0v.d.ts +175 -0
- package/dist/esm/chunk-3J6O2PVK.js +180 -0
- package/dist/esm/{chunk-SJP6W2SK.js → chunk-3XOGEVJL.js} +1 -1
- package/dist/esm/{chunk-5FKIW2ZL.js → chunk-4RLJWCQR.js} +2 -2
- package/dist/esm/{chunk-JSY7M43P.js → chunk-52PEBJRQ.js} +1 -1
- package/dist/esm/{chunk-7ITTEUMR.js → chunk-7X4ERB3R.js} +1 -1
- package/dist/esm/{chunk-LZI7A4JI.js → chunk-A6KSECAH.js} +5 -1
- package/dist/esm/{chunk-7LSTJXAF.js → chunk-AND7HVIU.js} +1 -1
- package/dist/esm/{chunk-MXCJ2M3K.js → chunk-APRMN34M.js} +1 -1
- package/dist/esm/{chunk-FFFVITWF.js → chunk-BAJFQZDT.js} +145 -61
- package/dist/esm/{chunk-5JZOTYDC.js → chunk-CIAOTO3M.js} +1 -1
- package/dist/esm/{chunk-JYUNVL4F.js → chunk-FH2YHZVV.js} +1 -1
- package/dist/esm/{chunk-IQQDEBLI.js → chunk-GHNH5QC3.js} +3 -3
- package/dist/esm/{chunk-OHV2LZEG.js → chunk-JQ4F4WBG.js} +1 -1
- package/dist/esm/{chunk-P76IRSIS.js → chunk-KNXMSLOB.js} +2 -2
- package/dist/esm/{chunk-KJVD5P3Q.js → chunk-KYDY7QRT.js} +109 -3
- package/dist/esm/{chunk-IWXRHEX4.js → chunk-LHNGF5J2.js} +2 -2
- package/dist/esm/{chunk-JIADJKRD.js → chunk-OTS5KO43.js} +1 -1
- package/dist/esm/{chunk-CU6W3622.js → chunk-QIS6ILPS.js} +3 -3
- package/dist/esm/chunk-QO2CYYF5.js +278 -0
- package/dist/esm/{chunk-OL7CWCPB.js → chunk-REWUSU53.js} +4 -3
- package/dist/esm/chunk-RQ7DXNSS.js +365 -0
- package/dist/esm/{chunk-XXTECZG3.js → chunk-S4RO2LHD.js} +1 -1
- package/dist/esm/{chunk-7YN3UVVF.js → chunk-UI3SIFZN.js} +1 -1
- package/dist/esm/{chunk-TD63P2AG.js → chunk-UIDIKXMB.js} +65 -340
- package/dist/esm/{chunk-HT6O3BQ7.js → chunk-Y2YCODZK.js} +1 -1
- package/dist/esm/{chunk-IPHFFTGO.js → chunk-ZI3SYUQH.js} +1 -1
- package/dist/esm/{chunk-2L7PKZDY.js → chunk-ZOUYAZU6.js} +1 -1
- package/dist/esm/index.d.ts +2 -3
- package/dist/esm/index.js +27 -25
- package/dist/esm/public-functions/executeRoute.d.ts +7 -76
- package/dist/esm/public-functions/executeRoute.js +15 -14
- package/dist/esm/public-functions/getCosmosGasAmountForMessage.js +3 -2
- package/dist/esm/public-functions/getFeeInfoForChain.js +4 -4
- package/dist/esm/public-functions/getRecommendedGasPrice.js +5 -5
- package/dist/esm/public-functions/getSigningStargateClient.js +5 -4
- package/dist/esm/public-functions/setApiOptions.js +2 -2
- package/dist/esm/public-functions/setClientOptions.js +5 -4
- package/dist/esm/public-functions/subscribeToRouteStatus.d.ts +12 -0
- package/dist/esm/public-functions/subscribeToRouteStatus.js +5 -0
- package/dist/esm/public-functions/validateCosmosGasBalance.d.ts +3 -2
- package/dist/esm/public-functions/validateCosmosGasBalance.js +8 -7
- package/dist/esm/public-functions/waitForTransaction.d.ts +5 -1
- package/dist/esm/public-functions/waitForTransaction.js +4 -4
- package/package.json +3 -3
- package/dist/cjs/chunk-7H6XRQAX.cjs +0 -185
- package/dist/esm/callbacks-CuL50GnB.d.ts +0 -38
- package/dist/esm/chunk-U6AH2WOP.js +0 -180
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_GAS_DENOM_OVERRIDES } from './chunk-SWYON2RG.js';
|
|
2
|
-
import { chains } from './chunk-
|
|
3
|
-
import { ClientState } from './chunk-
|
|
2
|
+
import { chains } from './chunk-3J6O2PVK.js';
|
|
3
|
+
import { ClientState } from './chunk-ZOUYAZU6.js';
|
|
4
4
|
|
|
5
5
|
// src/private-functions/getDefaultGasTokenForChain.ts
|
|
6
6
|
var getDefaultGasTokenForChain = async (chainId) => {
|
|
@@ -45,7 +45,11 @@ var createRequestClient = ({ apiUrl, apiKey, apiHeaders }) => {
|
|
|
45
45
|
const body = isJson ? await response.json() : await response.text();
|
|
46
46
|
if (!response.ok) {
|
|
47
47
|
const message = typeof body === "object" && body?.message ? body.message : response.statusText;
|
|
48
|
-
|
|
48
|
+
const error = new Error(message);
|
|
49
|
+
if (body?.code) {
|
|
50
|
+
error.code = body.code;
|
|
51
|
+
}
|
|
52
|
+
throw error;
|
|
49
53
|
}
|
|
50
54
|
return body;
|
|
51
55
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { getEncodeObjectFromCosmosMessage } from './chunk-
|
|
1
|
+
import { updateRouteDetails, executeAndSubscribeToRouteStatus } from './chunk-RQ7DXNSS.js';
|
|
2
|
+
import { validateCosmosGasBalance } from './chunk-GHNH5QC3.js';
|
|
3
|
+
import { getEncodeObjectFromCosmosMessage } from './chunk-KNXMSLOB.js';
|
|
4
4
|
import { getEVMGasAmountForMessage } from './chunk-GV2QOWB4.js';
|
|
5
5
|
import { BigNumber } from './chunk-VQ5SIQWU.js';
|
|
6
6
|
import { GAS_STATION_CHAIN_IDS } from './chunk-SWYON2RG.js';
|
|
7
|
-
import { getRpcEndpointForChain, accountParser, getSigningStargateClient } from './chunk-
|
|
8
|
-
import { chains, findFirstWorkingEndpoint, getIsEthermint, getIsInitia } from './chunk-
|
|
9
|
-
import { messages } from './chunk-
|
|
10
|
-
import { submitTransaction } from './chunk-
|
|
11
|
-
import { venues } from './chunk-
|
|
12
|
-
import { ClientState, balances } from './chunk-
|
|
13
|
-
import { ApiState, toCamel, wait } from './chunk-
|
|
7
|
+
import { getRpcEndpointForChain, accountParser, getSigningStargateClient } from './chunk-KYDY7QRT.js';
|
|
8
|
+
import { chains, findFirstWorkingEndpoint, getIsEthermint, getIsInitia } from './chunk-3J6O2PVK.js';
|
|
9
|
+
import { messages } from './chunk-AND7HVIU.js';
|
|
10
|
+
import { submitTransaction } from './chunk-JQ4F4WBG.js';
|
|
11
|
+
import { venues } from './chunk-52PEBJRQ.js';
|
|
12
|
+
import { ClientState, balances } from './chunk-ZOUYAZU6.js';
|
|
13
|
+
import { ApiState, toCamel, wait } from './chunk-A6KSECAH.js';
|
|
14
14
|
import { PublicKey, Transaction, Connection, LAMPORTS_PER_SOL } from '@solana/web3.js';
|
|
15
15
|
import { bech32m, bech32 } from 'bech32';
|
|
16
16
|
import { StargateClient } from '@cosmjs/stargate';
|
|
@@ -249,7 +249,8 @@ var signCosmosMessageAmino = async (options) => {
|
|
|
249
249
|
var signCosmosTransaction = async ({
|
|
250
250
|
tx,
|
|
251
251
|
options,
|
|
252
|
-
index
|
|
252
|
+
index,
|
|
253
|
+
routeId
|
|
253
254
|
}) => {
|
|
254
255
|
const { userAddresses } = options;
|
|
255
256
|
if (tx === void 0) {
|
|
@@ -312,6 +313,11 @@ var signCosmosTransaction = async ({
|
|
|
312
313
|
txIndex: index,
|
|
313
314
|
signerAddress: currentUserAddress
|
|
314
315
|
});
|
|
316
|
+
updateRouteDetails({
|
|
317
|
+
status: "signing",
|
|
318
|
+
routeId,
|
|
319
|
+
options
|
|
320
|
+
});
|
|
315
321
|
if (isOfflineDirectSigner(signer)) {
|
|
316
322
|
rawTx = await signCosmosMessageDirect({
|
|
317
323
|
...commonRawTxBody,
|
|
@@ -323,6 +329,11 @@ var signCosmosTransaction = async ({
|
|
|
323
329
|
options?.onTransactionSigned?.({
|
|
324
330
|
chainId
|
|
325
331
|
});
|
|
332
|
+
updateRouteDetails({
|
|
333
|
+
status: "pending",
|
|
334
|
+
routeId,
|
|
335
|
+
options
|
|
336
|
+
});
|
|
326
337
|
const txBytes = TxRaw.encode(rawTx).finish();
|
|
327
338
|
const rawTxBase64 = Buffer.from(txBytes).toString("base64");
|
|
328
339
|
return rawTxBase64;
|
|
@@ -332,7 +343,8 @@ var signCosmosTransaction = async ({
|
|
|
332
343
|
var executeCosmosTransaction = async ({
|
|
333
344
|
tx,
|
|
334
345
|
options,
|
|
335
|
-
index
|
|
346
|
+
index,
|
|
347
|
+
routeId
|
|
336
348
|
}) => {
|
|
337
349
|
if (tx === void 0) {
|
|
338
350
|
throw new Error("executeCosmosTransaction error: tx is undefined");
|
|
@@ -340,7 +352,8 @@ var executeCosmosTransaction = async ({
|
|
|
340
352
|
const rawTxBase64 = await signCosmosTransaction({
|
|
341
353
|
tx,
|
|
342
354
|
options,
|
|
343
|
-
index
|
|
355
|
+
index,
|
|
356
|
+
routeId
|
|
344
357
|
});
|
|
345
358
|
const chainId = tx.cosmosTx?.chainId;
|
|
346
359
|
const txResponse = await submitTransaction({
|
|
@@ -555,7 +568,7 @@ var erc20ABI = /* @__PURE__ */ createAbi([
|
|
|
555
568
|
]);
|
|
556
569
|
|
|
557
570
|
// src/private-functions/evm/executeEvmTransaction.ts
|
|
558
|
-
var executeEvmTransaction = async (message, options, index) => {
|
|
571
|
+
var executeEvmTransaction = async (message, options, index, routeId) => {
|
|
559
572
|
const gasArray = ClientState.validateGasResults;
|
|
560
573
|
const gas = gasArray?.find((gas2) => gas2?.error !== null && gas2?.error !== void 0);
|
|
561
574
|
if (typeof gas?.error === "string") {
|
|
@@ -602,6 +615,11 @@ var executeEvmTransaction = async (message, options, index) => {
|
|
|
602
615
|
status: "pending",
|
|
603
616
|
allowance: requiredApproval
|
|
604
617
|
});
|
|
618
|
+
updateRouteDetails({
|
|
619
|
+
status: "allowance",
|
|
620
|
+
routeId,
|
|
621
|
+
options
|
|
622
|
+
});
|
|
605
623
|
const txHash2 = await extendedSigner.writeContract({
|
|
606
624
|
account: evmSigner.account,
|
|
607
625
|
address: requiredApproval.tokenContract,
|
|
@@ -631,6 +649,11 @@ var executeEvmTransaction = async (message, options, index) => {
|
|
|
631
649
|
signerAddress: evmSigner.account.address,
|
|
632
650
|
txIndex: index
|
|
633
651
|
});
|
|
652
|
+
updateRouteDetails({
|
|
653
|
+
status: "signing",
|
|
654
|
+
routeId,
|
|
655
|
+
options
|
|
656
|
+
});
|
|
634
657
|
const txHash = await extendedSigner.sendTransaction({
|
|
635
658
|
account: evmSigner.account,
|
|
636
659
|
to: evmTx.to,
|
|
@@ -638,6 +661,11 @@ var executeEvmTransaction = async (message, options, index) => {
|
|
|
638
661
|
chain: evmSigner.chain,
|
|
639
662
|
value: evmTx.value === "" ? void 0 : BigInt(evmTx.value)
|
|
640
663
|
});
|
|
664
|
+
updateRouteDetails({
|
|
665
|
+
status: "pending",
|
|
666
|
+
routeId,
|
|
667
|
+
options
|
|
668
|
+
});
|
|
641
669
|
onTransactionSigned?.({
|
|
642
670
|
chainId: evmTx.chainId
|
|
643
671
|
});
|
|
@@ -649,7 +677,8 @@ var executeEvmTransaction = async (message, options, index) => {
|
|
|
649
677
|
var signSvmTransaction = async ({
|
|
650
678
|
tx,
|
|
651
679
|
options,
|
|
652
|
-
index
|
|
680
|
+
index,
|
|
681
|
+
routeId
|
|
653
682
|
}) => {
|
|
654
683
|
const gasArray = ClientState.validateGasResults;
|
|
655
684
|
if (tx === void 0) {
|
|
@@ -688,19 +717,29 @@ var signSvmTransaction = async ({
|
|
|
688
717
|
signerAddress: signer.publicKey?.toBase58(),
|
|
689
718
|
txIndex: index
|
|
690
719
|
});
|
|
720
|
+
updateRouteDetails({
|
|
721
|
+
status: "signing",
|
|
722
|
+
routeId,
|
|
723
|
+
options
|
|
724
|
+
});
|
|
691
725
|
const signedTx = await signer.signTransaction(transaction);
|
|
692
726
|
options?.onTransactionSigned?.({ chainId: svmTx.chainId });
|
|
727
|
+
updateRouteDetails({
|
|
728
|
+
status: "pending",
|
|
729
|
+
routeId,
|
|
730
|
+
options
|
|
731
|
+
});
|
|
693
732
|
const serializedTx = signedTx.serialize();
|
|
694
733
|
return serializedTx;
|
|
695
734
|
};
|
|
696
735
|
|
|
697
736
|
// src/private-functions/svm/executeSvmTransaction.ts
|
|
698
|
-
var executeSvmTransaction = async (tx, options, index) => {
|
|
737
|
+
var executeSvmTransaction = async (tx, options, index, routeId) => {
|
|
699
738
|
const svmTx = tx?.svmTx;
|
|
700
739
|
if (!svmTx?.chainId) {
|
|
701
740
|
throw new Error("executeSvmTransaction error: chainId not found in svmTx");
|
|
702
741
|
}
|
|
703
|
-
const signedTx = await signSvmTransaction({ tx, options, index });
|
|
742
|
+
const signedTx = await signSvmTransaction({ tx, options, index, routeId });
|
|
704
743
|
if (!signedTx) {
|
|
705
744
|
throw new Error("executeSvmTransaction error: signedTx is undefined");
|
|
706
745
|
}
|
|
@@ -1000,7 +1039,9 @@ var validateGasBalances = async ({
|
|
|
1000
1039
|
disabledChainIds,
|
|
1001
1040
|
enabledChainIds,
|
|
1002
1041
|
useUnlimitedApproval,
|
|
1003
|
-
getCosmosPriorityFeeDenom
|
|
1042
|
+
getCosmosPriorityFeeDenom,
|
|
1043
|
+
routeId,
|
|
1044
|
+
options
|
|
1004
1045
|
}) => {
|
|
1005
1046
|
const validateResult = await Promise.all(
|
|
1006
1047
|
txs.map(async (tx, i) => {
|
|
@@ -1011,6 +1052,11 @@ var validateGasBalances = async ({
|
|
|
1011
1052
|
onValidateGasBalance?.({
|
|
1012
1053
|
status: "pending"
|
|
1013
1054
|
});
|
|
1055
|
+
updateRouteDetails({
|
|
1056
|
+
status: "validating",
|
|
1057
|
+
routeId,
|
|
1058
|
+
options
|
|
1059
|
+
});
|
|
1014
1060
|
if (!tx?.cosmosTx?.msgs) {
|
|
1015
1061
|
throw new Error(`invalid msgs ${tx?.cosmosTx?.msgs}`);
|
|
1016
1062
|
}
|
|
@@ -1039,6 +1085,11 @@ var validateGasBalances = async ({
|
|
|
1039
1085
|
onValidateGasBalance?.({
|
|
1040
1086
|
status: "pending"
|
|
1041
1087
|
});
|
|
1088
|
+
updateRouteDetails({
|
|
1089
|
+
status: "validating",
|
|
1090
|
+
routeId,
|
|
1091
|
+
options
|
|
1092
|
+
});
|
|
1042
1093
|
const signer = await getEvmSigner?.(tx?.evmTx?.chainId ?? "");
|
|
1043
1094
|
if (!signer) {
|
|
1044
1095
|
throw new Error(
|
|
@@ -1066,6 +1117,11 @@ var validateGasBalances = async ({
|
|
|
1066
1117
|
onValidateGasBalance?.({
|
|
1067
1118
|
status: "pending"
|
|
1068
1119
|
});
|
|
1120
|
+
updateRouteDetails({
|
|
1121
|
+
status: "validating",
|
|
1122
|
+
routeId,
|
|
1123
|
+
options
|
|
1124
|
+
});
|
|
1069
1125
|
try {
|
|
1070
1126
|
const res = await validateSvmGasBalance({
|
|
1071
1127
|
tx: tx.svmTx,
|
|
@@ -1100,12 +1156,35 @@ var validateGasBalances = async ({
|
|
|
1100
1156
|
ClientState.validateGasResults = validateResult;
|
|
1101
1157
|
};
|
|
1102
1158
|
|
|
1159
|
+
// src/private-functions/getChainIdsFromTxs.ts
|
|
1160
|
+
var getChainIdsFromTxs = (txs) => {
|
|
1161
|
+
return txs.map((tx) => {
|
|
1162
|
+
if ("cosmosTx" in tx) {
|
|
1163
|
+
return {
|
|
1164
|
+
chainType: "cosmos" /* Cosmos */,
|
|
1165
|
+
chainId: tx.cosmosTx?.chainId
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
if ("svmTx" in tx) {
|
|
1169
|
+
return {
|
|
1170
|
+
chainType: "svm" /* Svm */,
|
|
1171
|
+
chainId: tx.svmTx?.chainId
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
if ("evmTx" in tx) {
|
|
1175
|
+
return {
|
|
1176
|
+
chainType: "evm" /* Evm */,
|
|
1177
|
+
chainId: tx.evmTx?.chainId
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
});
|
|
1181
|
+
};
|
|
1182
|
+
|
|
1103
1183
|
// src/private-functions/executeTransactions.ts
|
|
1104
1184
|
var executeTransactions = async (options) => {
|
|
1105
1185
|
const {
|
|
1106
1186
|
txs,
|
|
1107
1187
|
onTransactionBroadcast,
|
|
1108
|
-
onTransactionCompleted,
|
|
1109
1188
|
simulate = true,
|
|
1110
1189
|
batchSimulate = true,
|
|
1111
1190
|
getFallbackGasAmount = getDefaultFallbackGasAmount,
|
|
@@ -1113,35 +1192,33 @@ var executeTransactions = async (options) => {
|
|
|
1113
1192
|
getEvmSigner,
|
|
1114
1193
|
onValidateGasBalance,
|
|
1115
1194
|
trackTxPollingOptions,
|
|
1116
|
-
batchSignTxs = true
|
|
1195
|
+
batchSignTxs = true,
|
|
1196
|
+
routeId
|
|
1117
1197
|
} = options;
|
|
1118
1198
|
if (txs === void 0) {
|
|
1119
1199
|
throw new Error(
|
|
1120
1200
|
"executeTransactions error: txs is undefined in executeTransactions"
|
|
1121
1201
|
);
|
|
1122
1202
|
}
|
|
1123
|
-
const chainIds = txs
|
|
1203
|
+
const chainIds = getChainIdsFromTxs(txs);
|
|
1204
|
+
const transactionDetails = txs.map((tx) => {
|
|
1124
1205
|
if ("cosmosTx" in tx) {
|
|
1125
|
-
return {
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
chainType: "svm",
|
|
1133
|
-
chainId: tx.svmTx?.chainId
|
|
1134
|
-
};
|
|
1135
|
-
}
|
|
1136
|
-
if ("evmTx" in tx) {
|
|
1137
|
-
return {
|
|
1138
|
-
chainType: "evm",
|
|
1139
|
-
chainId: tx.evmTx?.chainId
|
|
1140
|
-
};
|
|
1206
|
+
return { chainId: tx.cosmosTx?.chainId };
|
|
1207
|
+
} else if ("evmTx" in tx) {
|
|
1208
|
+
return { chainId: tx.evmTx?.chainId };
|
|
1209
|
+
} else if ("svmTx" in tx) {
|
|
1210
|
+
return { chainId: tx.svmTx?.chainId };
|
|
1211
|
+
} else {
|
|
1212
|
+
throw new Error("executeRoute error: invalid message type");
|
|
1141
1213
|
}
|
|
1142
1214
|
});
|
|
1215
|
+
updateRouteDetails({
|
|
1216
|
+
transactionDetails,
|
|
1217
|
+
routeId,
|
|
1218
|
+
options
|
|
1219
|
+
});
|
|
1143
1220
|
const isGasStationSourceEVM = chainIds.find((item, i, array) => {
|
|
1144
|
-
return GAS_STATION_CHAIN_IDS.includes(item?.chainId ?? "") && array[i - 1]?.chainType === "evm"
|
|
1221
|
+
return GAS_STATION_CHAIN_IDS.includes(item?.chainId ?? "") && array[i - 1]?.chainType === "evm" /* Evm */;
|
|
1145
1222
|
});
|
|
1146
1223
|
ClientState.validateGasResults = void 0;
|
|
1147
1224
|
const validateChainIds = !batchSimulate ? chainIds.map((x) => x?.chainId ?? "") : isGasStationSourceEVM ? GAS_STATION_CHAIN_IDS : [];
|
|
@@ -1153,7 +1230,9 @@ var executeTransactions = async (options) => {
|
|
|
1153
1230
|
onValidateGasBalance,
|
|
1154
1231
|
simulate,
|
|
1155
1232
|
disabledChainIds: validateChainIds,
|
|
1156
|
-
getCosmosPriorityFeeDenom: options.getCosmosPriorityFeeDenom
|
|
1233
|
+
getCosmosPriorityFeeDenom: options.getCosmosPriorityFeeDenom,
|
|
1234
|
+
options,
|
|
1235
|
+
routeId
|
|
1157
1236
|
});
|
|
1158
1237
|
const validateEnabledChainIds = async (chainId) => {
|
|
1159
1238
|
await validateGasBalances({
|
|
@@ -1164,7 +1243,9 @@ var executeTransactions = async (options) => {
|
|
|
1164
1243
|
onValidateGasBalance,
|
|
1165
1244
|
simulate,
|
|
1166
1245
|
enabledChainIds: !batchSimulate ? [chainId] : validateChainIds,
|
|
1167
|
-
getCosmosPriorityFeeDenom: options.getCosmosPriorityFeeDenom
|
|
1246
|
+
getCosmosPriorityFeeDenom: options.getCosmosPriorityFeeDenom,
|
|
1247
|
+
options,
|
|
1248
|
+
routeId
|
|
1168
1249
|
});
|
|
1169
1250
|
};
|
|
1170
1251
|
let signedTxs = [];
|
|
@@ -1197,7 +1278,8 @@ var executeTransactions = async (options) => {
|
|
|
1197
1278
|
const signedTx = await signCosmosTransaction({
|
|
1198
1279
|
tx,
|
|
1199
1280
|
options,
|
|
1200
|
-
index: i
|
|
1281
|
+
index: i,
|
|
1282
|
+
routeId
|
|
1201
1283
|
});
|
|
1202
1284
|
signedTxs.push({
|
|
1203
1285
|
index: i,
|
|
@@ -1208,7 +1290,7 @@ var executeTransactions = async (options) => {
|
|
|
1208
1290
|
}
|
|
1209
1291
|
if ("svmTx" in tx) {
|
|
1210
1292
|
await validateEnabledChainIds(tx.svmTx?.chainId ?? "");
|
|
1211
|
-
const signedTx = await signSvmTransaction({ tx, options, index: i });
|
|
1293
|
+
const signedTx = await signSvmTransaction({ tx, options, index: i, routeId });
|
|
1212
1294
|
if (!signedTx) {
|
|
1213
1295
|
throw new Error(`executeRoute error: signedTx is undefined`);
|
|
1214
1296
|
}
|
|
@@ -1221,13 +1303,13 @@ var executeTransactions = async (options) => {
|
|
|
1221
1303
|
}
|
|
1222
1304
|
}
|
|
1223
1305
|
}
|
|
1224
|
-
|
|
1225
|
-
const tx = txs[
|
|
1306
|
+
const executeTransaction = async (index) => {
|
|
1307
|
+
const tx = txs[index];
|
|
1226
1308
|
if (!tx) {
|
|
1227
|
-
throw new Error(`executeRoute error: invalid message at index ${
|
|
1309
|
+
throw new Error(`executeRoute error: invalid message at index ${index}`);
|
|
1228
1310
|
}
|
|
1229
1311
|
let txResult;
|
|
1230
|
-
const txSigned = signedTxs.find((item) => item.index ===
|
|
1312
|
+
const txSigned = signedTxs.find((item) => item.index === index);
|
|
1231
1313
|
if (txSigned) {
|
|
1232
1314
|
const txResponse = await submitTransaction({
|
|
1233
1315
|
chainId: txSigned.chainId,
|
|
@@ -1244,34 +1326,32 @@ var executeTransactions = async (options) => {
|
|
|
1244
1326
|
txResult = await executeCosmosTransaction({
|
|
1245
1327
|
tx,
|
|
1246
1328
|
options,
|
|
1247
|
-
index
|
|
1329
|
+
index,
|
|
1330
|
+
routeId
|
|
1248
1331
|
});
|
|
1249
1332
|
} else if ("evmTx" in tx) {
|
|
1250
1333
|
await validateEnabledChainIds(tx.evmTx?.chainId ?? "");
|
|
1251
|
-
const txResponse = await executeEvmTransaction(tx, options,
|
|
1334
|
+
const txResponse = await executeEvmTransaction(tx, options, index, routeId);
|
|
1252
1335
|
txResult = {
|
|
1253
1336
|
chainId: tx?.evmTx?.chainId ?? "",
|
|
1254
1337
|
txHash: txResponse.transactionHash
|
|
1255
1338
|
};
|
|
1256
1339
|
} else if ("svmTx" in tx) {
|
|
1257
1340
|
await validateEnabledChainIds(tx.svmTx?.chainId ?? "");
|
|
1258
|
-
txResult = await executeSvmTransaction(tx, options,
|
|
1341
|
+
txResult = await executeSvmTransaction(tx, options, index, routeId);
|
|
1259
1342
|
} else {
|
|
1260
1343
|
throw new Error("executeRoute error: invalid message type");
|
|
1261
1344
|
}
|
|
1262
1345
|
}
|
|
1263
1346
|
await onTransactionBroadcast?.({ ...txResult });
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
status: txStatusResponse
|
|
1273
|
-
});
|
|
1274
|
-
}
|
|
1347
|
+
return txResult;
|
|
1348
|
+
};
|
|
1349
|
+
await executeAndSubscribeToRouteStatus({
|
|
1350
|
+
transactionDetails,
|
|
1351
|
+
executeTransaction,
|
|
1352
|
+
routeId,
|
|
1353
|
+
options
|
|
1354
|
+
});
|
|
1275
1355
|
};
|
|
1276
1356
|
var EVM_GAS_AMOUNT = 15e4;
|
|
1277
1357
|
var COSMOS_GAS_AMOUNT = {
|
|
@@ -1298,6 +1378,10 @@ var getDefaultFallbackGasAmount = async (chainId, chainType) => {
|
|
|
1298
1378
|
};
|
|
1299
1379
|
var executeRoute = async (options) => {
|
|
1300
1380
|
const { route, userAddresses, beforeMsg, afterMsg, timeoutSeconds } = options;
|
|
1381
|
+
const { id: routeId } = updateRouteDetails({
|
|
1382
|
+
status: "unconfirmed",
|
|
1383
|
+
options
|
|
1384
|
+
});
|
|
1301
1385
|
let addressList = [];
|
|
1302
1386
|
userAddresses.forEach((userAddress, index) => {
|
|
1303
1387
|
const requiredChainAddress = route.requiredChainAddresses[index];
|
|
@@ -1343,7 +1427,7 @@ var executeRoute = async (options) => {
|
|
|
1343
1427
|
lastTx.cosmosTx?.msgs?.push(afterMsg);
|
|
1344
1428
|
}
|
|
1345
1429
|
}
|
|
1346
|
-
await executeTransactions({ ...options, txs: response?.txs });
|
|
1430
|
+
await executeTransactions({ ...options, routeId, txs: response?.txs });
|
|
1347
1431
|
};
|
|
1348
1432
|
var validateUserAddresses = async (userAddresses) => {
|
|
1349
1433
|
const chains2 = await ClientState.getSkipChains();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getCosmosGasAmountForMessage } from './chunk-
|
|
1
|
+
import { getCosmosGasAmountForMessage } from './chunk-KNXMSLOB.js';
|
|
2
2
|
import { BigNumber } from './chunk-VQ5SIQWU.js';
|
|
3
|
-
import { getSigningStargateClient } from './chunk-
|
|
4
|
-
import { ClientState, balances } from './chunk-
|
|
3
|
+
import { getSigningStargateClient } from './chunk-KYDY7QRT.js';
|
|
4
|
+
import { ClientState, balances } from './chunk-ZOUYAZU6.js';
|
|
5
5
|
import { GasPrice, calculateFee } from '@cosmjs/stargate';
|
|
6
6
|
import { Decimal } from '@cosmjs/math';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MsgDepositForBurn, MsgDepositForBurnWithCaller, MsgExecute, MsgInitiateTokenDeposit, BaseVestingAccount, Timestamp,
|
|
1
|
+
import { MsgDepositForBurn, MsgDepositForBurnWithCaller, MsgExecute, MsgInitiateTokenDeposit, BaseVestingAccount, Timestamp, Period } from './chunk-UIDIKXMB.js';
|
|
2
|
+
import { toTimestamp, fromTimestamp, isSet, fromJsonTimestamp } from './chunk-QO2CYYF5.js';
|
|
2
3
|
import '@cosmjs/stargate';
|
|
3
4
|
import { toUtf8 } from '@cosmjs/encoding';
|
|
4
|
-
import '@injectivelabs/sdk-ts';
|
|
5
5
|
import { MsgSend } from 'cosmjs-types/cosmos/bank/v1beta1/tx.js';
|
|
6
6
|
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx.js';
|
|
7
7
|
import { MsgTransfer } from 'cosmjs-types/ibc/applications/transfer/v1/tx.js';
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { chains, findFirstWorkingEndpoint } from './chunk-
|
|
2
|
-
import {
|
|
1
|
+
import { chains, findFirstWorkingEndpoint } from './chunk-3J6O2PVK.js';
|
|
2
|
+
import { BaseAccount as BaseAccount$1, isSet, bytesFromBase64, base64FromBytes } from './chunk-QO2CYYF5.js';
|
|
3
|
+
import { ClientState } from './chunk-ZOUYAZU6.js';
|
|
3
4
|
import { accountFromAny, SigningStargateClient } from '@cosmjs/stargate';
|
|
4
5
|
import { assertDefinedAndNotNull } from '@cosmjs/utils';
|
|
5
6
|
import { BinaryWriter, BinaryReader } from 'cosmjs-types/binary.js';
|
|
6
7
|
import { BaseAccount } from 'cosmjs-types/cosmos/auth/v1beta1/auth.js';
|
|
7
8
|
import { Coin } from 'cosmjs-types/cosmos/base/v1beta1/coin.js';
|
|
8
9
|
import { decodePubkey } from '@cosmjs/proto-signing';
|
|
9
|
-
import { accountEthParser } from '@injectivelabs/sdk-ts';
|
|
10
10
|
import { PubKey } from 'cosmjs-types/cosmos/crypto/secp256k1/keys.js';
|
|
11
11
|
import { encodeSecp256k1Pubkey } from '@cosmjs/amino';
|
|
12
|
+
import _m0 from 'protobufjs/minimal.js';
|
|
12
13
|
|
|
13
14
|
var createBaseVestingAccount = () => {
|
|
14
15
|
return {
|
|
@@ -168,6 +169,95 @@ var StridePeriodicVestingAccount = {
|
|
|
168
169
|
return message;
|
|
169
170
|
}
|
|
170
171
|
};
|
|
172
|
+
function createBaseEthAccount() {
|
|
173
|
+
return {
|
|
174
|
+
baseAccount: void 0,
|
|
175
|
+
codeHash: new Uint8Array()
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
var EthAccount = {
|
|
179
|
+
typeUrl: "/injective.types.v1beta1.EthAccount",
|
|
180
|
+
encode(message, writer = _m0.Writer.create()) {
|
|
181
|
+
if (message.baseAccount !== void 0) {
|
|
182
|
+
BaseAccount$1.encode(message.baseAccount, writer.uint32(10).fork()).ldelim();
|
|
183
|
+
}
|
|
184
|
+
if (message.codeHash.length !== 0) {
|
|
185
|
+
writer.uint32(18).bytes(message.codeHash);
|
|
186
|
+
}
|
|
187
|
+
return writer;
|
|
188
|
+
},
|
|
189
|
+
decode(input, length) {
|
|
190
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
191
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
192
|
+
const message = createBaseEthAccount();
|
|
193
|
+
while (reader.pos < end) {
|
|
194
|
+
const tag = reader.uint32();
|
|
195
|
+
switch (tag >>> 3) {
|
|
196
|
+
case 1:
|
|
197
|
+
message.baseAccount = BaseAccount$1.decode(reader, reader.uint32());
|
|
198
|
+
break;
|
|
199
|
+
case 2:
|
|
200
|
+
message.codeHash = reader.bytes();
|
|
201
|
+
break;
|
|
202
|
+
default:
|
|
203
|
+
reader.skipType(tag & 7);
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return message;
|
|
208
|
+
},
|
|
209
|
+
fromJSON(object) {
|
|
210
|
+
return {
|
|
211
|
+
baseAccount: isSet(object.baseAccount) ? BaseAccount$1.fromJSON(object.baseAccount) : void 0,
|
|
212
|
+
codeHash: isSet(object.codeHash) ? bytesFromBase64(object.codeHash) : new Uint8Array()
|
|
213
|
+
};
|
|
214
|
+
},
|
|
215
|
+
toJSON(message) {
|
|
216
|
+
const obj = {};
|
|
217
|
+
message.baseAccount !== void 0 && (obj.baseAccount = message.baseAccount ? BaseAccount$1.toJSON(message.baseAccount) : void 0);
|
|
218
|
+
message.codeHash !== void 0 && (obj.codeHash = base64FromBytes(message.codeHash !== void 0 ? message.codeHash : new Uint8Array()));
|
|
219
|
+
return obj;
|
|
220
|
+
},
|
|
221
|
+
fromPartial(object) {
|
|
222
|
+
const message = createBaseEthAccount();
|
|
223
|
+
message.baseAccount = object.baseAccount !== void 0 && object.baseAccount !== null ? BaseAccount$1.fromPartial(object.baseAccount) : void 0;
|
|
224
|
+
message.codeHash = object.codeHash ?? new Uint8Array();
|
|
225
|
+
return message;
|
|
226
|
+
},
|
|
227
|
+
fromAmino(object) {
|
|
228
|
+
const message = createBaseEthAccount();
|
|
229
|
+
if (object.base_account !== void 0 && object.base_account !== null) {
|
|
230
|
+
message.baseAccount = BaseAccount$1.fromAmino(object.base_account);
|
|
231
|
+
}
|
|
232
|
+
if (object.code_hash !== void 0 && object.code_hash !== null) {
|
|
233
|
+
message.codeHash = bytesFromBase64(object.code_hash);
|
|
234
|
+
}
|
|
235
|
+
return message;
|
|
236
|
+
},
|
|
237
|
+
toAmino(message) {
|
|
238
|
+
const obj = {};
|
|
239
|
+
obj.base_account = message.baseAccount ? BaseAccount$1.toAmino(message.baseAccount) : void 0;
|
|
240
|
+
obj.code_hash = message.codeHash ? base64FromBytes(message.codeHash) : void 0;
|
|
241
|
+
return obj;
|
|
242
|
+
},
|
|
243
|
+
fromAminoMsg(object) {
|
|
244
|
+
return EthAccount.fromAmino(object.value);
|
|
245
|
+
},
|
|
246
|
+
fromProtoMsg(message) {
|
|
247
|
+
return EthAccount.decode(message.value);
|
|
248
|
+
},
|
|
249
|
+
toProto(message) {
|
|
250
|
+
return EthAccount.encode(message).finish();
|
|
251
|
+
},
|
|
252
|
+
toProtoMsg(message) {
|
|
253
|
+
return {
|
|
254
|
+
typeUrl: "/injective.types.v1beta1.EthAccount",
|
|
255
|
+
value: EthAccount.encode(message).finish()
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
// src/registry.ts
|
|
171
261
|
var accountParser = (acc) => {
|
|
172
262
|
switch (acc.typeUrl) {
|
|
173
263
|
case "/stride.vesting.StridePeriodicVestingAccount": {
|
|
@@ -207,6 +297,22 @@ var accountParser = (acc) => {
|
|
|
207
297
|
}
|
|
208
298
|
}
|
|
209
299
|
};
|
|
300
|
+
var accountEthParser = (ethAccount, pubKeyTypeUrl = "/injective.crypto.v1beta1.ethsecp256k1.PubKey") => {
|
|
301
|
+
const account = EthAccount.decode(
|
|
302
|
+
ethAccount.value
|
|
303
|
+
);
|
|
304
|
+
const baseAccount = account.baseAccount;
|
|
305
|
+
const pubKey = baseAccount.pubKey;
|
|
306
|
+
return {
|
|
307
|
+
address: baseAccount.address,
|
|
308
|
+
pubkey: pubKey ? {
|
|
309
|
+
type: pubKeyTypeUrl,
|
|
310
|
+
value: Buffer.from(pubKey.value).toString("base64")
|
|
311
|
+
} : null,
|
|
312
|
+
accountNumber: parseInt(baseAccount.accountNumber.toString(), 10),
|
|
313
|
+
sequence: parseInt(baseAccount.sequence.toString(), 10)
|
|
314
|
+
};
|
|
315
|
+
};
|
|
210
316
|
|
|
211
317
|
// src/private-functions/getRpcEndpointForChain.ts
|
|
212
318
|
var getRpcEndpointForChain = async (chainId) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { transformAssetsMap } from './chunk-
|
|
2
|
-
import { api } from './chunk-
|
|
1
|
+
import { transformAssetsMap } from './chunk-ZOUYAZU6.js';
|
|
2
|
+
import { api } from './chunk-A6KSECAH.js';
|
|
3
3
|
|
|
4
4
|
// src/api/postAssetsFromSource.ts
|
|
5
5
|
var assetsFromSource = api({
|