@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,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunk7MC3BVQN_cjs = require('./chunk-7MC3BVQN.cjs');
|
|
4
|
+
var chunk46VB6RQK_cjs = require('./chunk-46VB6RQK.cjs');
|
|
5
|
+
var chunkKM2D7PJL_cjs = require('./chunk-KM2D7PJL.cjs');
|
|
6
6
|
var chunkF3EB2AQG_cjs = require('./chunk-F3EB2AQG.cjs');
|
|
7
7
|
var chunk4R6OCWRR_cjs = require('./chunk-4R6OCWRR.cjs');
|
|
8
8
|
var chunkKZOSEIWH_cjs = require('./chunk-KZOSEIWH.cjs');
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
9
|
+
var chunk6LA66667_cjs = require('./chunk-6LA66667.cjs');
|
|
10
|
+
var chunkVIG2BHYJ_cjs = require('./chunk-VIG2BHYJ.cjs');
|
|
11
|
+
var chunkOZUCMWNE_cjs = require('./chunk-OZUCMWNE.cjs');
|
|
12
|
+
var chunk5HDKZVOL_cjs = require('./chunk-5HDKZVOL.cjs');
|
|
13
|
+
var chunk5AYPH3ZR_cjs = require('./chunk-5AYPH3ZR.cjs');
|
|
14
|
+
var chunkN4UW74AG_cjs = require('./chunk-N4UW74AG.cjs');
|
|
15
|
+
var chunkERGJBZUC_cjs = require('./chunk-ERGJBZUC.cjs');
|
|
16
16
|
var web3_js = require('@solana/web3.js');
|
|
17
17
|
var bech32 = require('bech32');
|
|
18
18
|
var stargate = require('@cosmjs/stargate');
|
|
@@ -28,16 +28,16 @@ var viem = require('viem');
|
|
|
28
28
|
|
|
29
29
|
// src/private-functions/getRestEndpointForChain.ts
|
|
30
30
|
var getRestEndpointForChain = async (chainId) => {
|
|
31
|
-
if (
|
|
32
|
-
return
|
|
31
|
+
if (chunkN4UW74AG_cjs.ClientState.endpointOptions.getRestEndpointForChain) {
|
|
32
|
+
return chunkN4UW74AG_cjs.ClientState.endpointOptions.getRestEndpointForChain(chainId);
|
|
33
33
|
}
|
|
34
|
-
if (
|
|
35
|
-
const endpointOptions =
|
|
34
|
+
if (chunkN4UW74AG_cjs.ClientState.endpointOptions.endpoints && chunkN4UW74AG_cjs.ClientState.endpointOptions.endpoints[chainId]) {
|
|
35
|
+
const endpointOptions = chunkN4UW74AG_cjs.ClientState.endpointOptions.endpoints[chainId];
|
|
36
36
|
if (endpointOptions?.rest) {
|
|
37
37
|
return endpointOptions.rest;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
const chain =
|
|
40
|
+
const chain = chunkVIG2BHYJ_cjs.chains().find((chain2) => chain2.chainId === chainId);
|
|
41
41
|
if (!chain) {
|
|
42
42
|
throw new Error(
|
|
43
43
|
`getRestEndpointForChain error: failed to find chain id '${chainId}' in registry`
|
|
@@ -49,7 +49,7 @@ var getRestEndpointForChain = async (chainId) => {
|
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
const endpoints = chain.apis?.rest?.map((api) => api.address);
|
|
52
|
-
const endpoint = await
|
|
52
|
+
const endpoint = await chunkVIG2BHYJ_cjs.findFirstWorkingEndpoint(endpoints, "rest");
|
|
53
53
|
if (!endpoint) {
|
|
54
54
|
throw new Error(
|
|
55
55
|
`getRestEndpointForChain error: failed to find REST endpoint for chain id '${chainId}'`
|
|
@@ -63,9 +63,9 @@ var getAccountNumberAndSequence = async (address, chainId) => {
|
|
|
63
63
|
if (chainId.includes("dymension")) {
|
|
64
64
|
return getAccountNumberAndSequenceFromDymension(address, chainId);
|
|
65
65
|
}
|
|
66
|
-
const endpoint = await
|
|
67
|
-
const client =
|
|
68
|
-
accountParser:
|
|
66
|
+
const endpoint = await chunk6LA66667_cjs.getRpcEndpointForChain(chainId);
|
|
67
|
+
const client = chunkN4UW74AG_cjs.ClientState.signingStargateClientByChainId[chainId] ?? await stargate.StargateClient.connect(endpoint, {
|
|
68
|
+
accountParser: chunk6LA66667_cjs.accountParser
|
|
69
69
|
});
|
|
70
70
|
const account = await client.getAccount(address);
|
|
71
71
|
if (!account) {
|
|
@@ -91,7 +91,7 @@ var getAccountNumberAndSequenceFromDymension = async (address, chainId) => {
|
|
|
91
91
|
throw new Error(`Failed to fetch account data: ${res.statusText}`);
|
|
92
92
|
}
|
|
93
93
|
const jsonResponse = await res.json();
|
|
94
|
-
const response =
|
|
94
|
+
const response = chunkERGJBZUC_cjs.toCamel(jsonResponse);
|
|
95
95
|
let sequence = 0;
|
|
96
96
|
let accountNumber = 0;
|
|
97
97
|
if (response.account.baseAccount) {
|
|
@@ -126,7 +126,7 @@ function encodeEthSecp256k1Pubkey(pubkey) {
|
|
|
126
126
|
|
|
127
127
|
// src/proto-signing/pubkey.ts
|
|
128
128
|
function makePubkeyAnyFromAccount(account, chainId) {
|
|
129
|
-
const isEthermint =
|
|
129
|
+
const isEthermint = chunkVIG2BHYJ_cjs.getIsEthermint(chainId);
|
|
130
130
|
const pubkey = isEthermint ? encodeEthSecp256k1Pubkey(account.pubkey) : amino.encodeSecp256k1Pubkey(account.pubkey);
|
|
131
131
|
const pubkeyAny = encodePubkeyToAny(pubkey, chainId, isEthermint);
|
|
132
132
|
return pubkeyAny;
|
|
@@ -147,7 +147,7 @@ function encodePubkeyToAny(pubkey, chainId, isEthermint) {
|
|
|
147
147
|
value: Uint8Array.from(keys_js.PubKey.encode(pubkeyProto).finish())
|
|
148
148
|
});
|
|
149
149
|
} else {
|
|
150
|
-
const isInitia =
|
|
150
|
+
const isInitia = chunkVIG2BHYJ_cjs.getIsInitia(chainId);
|
|
151
151
|
const pubkeyProto = keys_js.PubKey.fromPartial({
|
|
152
152
|
key: encoding.fromBase64(pubkey.value)
|
|
153
153
|
});
|
|
@@ -174,14 +174,14 @@ var signCosmosMessageDirect = async (options) => {
|
|
|
174
174
|
if (!accountFromSigner) {
|
|
175
175
|
throw new Error("signCosmosMessageDirect error: failed to retrieve account from signer");
|
|
176
176
|
}
|
|
177
|
-
const messages2 = cosmosMsgs.map((cosmosMsg) =>
|
|
177
|
+
const messages2 = cosmosMsgs.map((cosmosMsg) => chunkKM2D7PJL_cjs.getEncodeObjectFromCosmosMessage(cosmosMsg));
|
|
178
178
|
const txBodyEncodeObject = {
|
|
179
179
|
typeUrl: "/cosmos.tx.v1beta1.TxBody",
|
|
180
180
|
value: {
|
|
181
181
|
messages: messages2
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
|
-
const txBodyBytes =
|
|
184
|
+
const txBodyBytes = chunkN4UW74AG_cjs.ClientState.registry.encode(txBodyEncodeObject);
|
|
185
185
|
const gasLimit = math.Int53.fromString(fee.gas).toNumber();
|
|
186
186
|
const pubkeyAny = makePubkeyAnyFromAccount(accountFromSigner, chainId);
|
|
187
187
|
const authInfoBytes = protoSigning.makeAuthInfoBytes(
|
|
@@ -213,14 +213,14 @@ var signCosmosMessageAmino = async (options) => {
|
|
|
213
213
|
if (!accountFromSigner) {
|
|
214
214
|
throw new Error("signCosmosMessageAmino: failed to retrieve account from signer");
|
|
215
215
|
}
|
|
216
|
-
const messages2 = cosmosMsgs.map((cosmosMsg) =>
|
|
216
|
+
const messages2 = cosmosMsgs.map((cosmosMsg) => chunkKM2D7PJL_cjs.getEncodeObjectFromCosmosMessage(cosmosMsg));
|
|
217
217
|
const signMode = signing_js.SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
|
|
218
|
-
const msgs = messages2.map((msg) =>
|
|
218
|
+
const msgs = messages2.map((msg) => chunkN4UW74AG_cjs.ClientState.aminoTypes.toAmino(msg));
|
|
219
219
|
console.log("sign cosmos message amino", msgs, fee, signerChainId, "", accountNumber, sequence);
|
|
220
220
|
const signDoc = amino.makeSignDoc(msgs, fee, signerChainId, "", accountNumber, sequence);
|
|
221
221
|
const { signature, signed } = await signer.signAmino(signerAddress, signDoc);
|
|
222
222
|
const signedTxBody = {
|
|
223
|
-
messages: signed.msgs.map((msg) =>
|
|
223
|
+
messages: signed.msgs.map((msg) => chunkN4UW74AG_cjs.ClientState.aminoTypes.fromAmino(msg)),
|
|
224
224
|
memo: signed.memo
|
|
225
225
|
};
|
|
226
226
|
signedTxBody.messages[0].value.memo = messages2[0].value.memo;
|
|
@@ -228,7 +228,7 @@ var signCosmosMessageAmino = async (options) => {
|
|
|
228
228
|
typeUrl: "/cosmos.tx.v1beta1.TxBody",
|
|
229
229
|
value: signedTxBody
|
|
230
230
|
};
|
|
231
|
-
const signedTxBodyBytes =
|
|
231
|
+
const signedTxBodyBytes = chunkN4UW74AG_cjs.ClientState.registry.encode(signedTxBodyEncodeObject);
|
|
232
232
|
const signedGasLimit = math.Int53.fromString(signed.fee.gas).toNumber();
|
|
233
233
|
const signedSequence = math.Int53.fromString(signed.sequence).toNumber();
|
|
234
234
|
const pubkeyAny = makePubkeyAnyFromAccount(accountFromSigner, chainId);
|
|
@@ -251,7 +251,8 @@ var signCosmosMessageAmino = async (options) => {
|
|
|
251
251
|
var signCosmosTransaction = async ({
|
|
252
252
|
tx,
|
|
253
253
|
options,
|
|
254
|
-
index
|
|
254
|
+
index,
|
|
255
|
+
routeId
|
|
255
256
|
}) => {
|
|
256
257
|
const { userAddresses } = options;
|
|
257
258
|
if (tx === void 0) {
|
|
@@ -260,7 +261,7 @@ var signCosmosTransaction = async ({
|
|
|
260
261
|
const chainId = tx.cosmosTx?.chainId;
|
|
261
262
|
const messages2 = tx.cosmosTx?.msgs;
|
|
262
263
|
const currentUserAddress = userAddresses.find((x) => x.chainId === tx.cosmosTx?.chainId)?.address;
|
|
263
|
-
const gasArray =
|
|
264
|
+
const gasArray = chunkN4UW74AG_cjs.ClientState.validateGasResults;
|
|
264
265
|
const gas = gasArray?.find((gas2) => gas2?.error !== null && gas2?.error !== void 0);
|
|
265
266
|
if (typeof gas?.error === "string") {
|
|
266
267
|
throw new Error(gas?.error);
|
|
@@ -275,7 +276,7 @@ var signCosmosTransaction = async ({
|
|
|
275
276
|
if (messages2 === void 0) {
|
|
276
277
|
throw new Error("no messages found for tx");
|
|
277
278
|
}
|
|
278
|
-
const { signer } = await
|
|
279
|
+
const { signer } = await chunk6LA66667_cjs.getSigningStargateClient({
|
|
279
280
|
chainId,
|
|
280
281
|
getOfflineSigner: options?.getCosmosSigner
|
|
281
282
|
});
|
|
@@ -314,6 +315,11 @@ var signCosmosTransaction = async ({
|
|
|
314
315
|
txIndex: index,
|
|
315
316
|
signerAddress: currentUserAddress
|
|
316
317
|
});
|
|
318
|
+
chunk7MC3BVQN_cjs.updateRouteDetails({
|
|
319
|
+
status: "signing",
|
|
320
|
+
routeId,
|
|
321
|
+
options
|
|
322
|
+
});
|
|
317
323
|
if (protoSigning.isOfflineDirectSigner(signer)) {
|
|
318
324
|
rawTx = await signCosmosMessageDirect({
|
|
319
325
|
...commonRawTxBody,
|
|
@@ -325,6 +331,11 @@ var signCosmosTransaction = async ({
|
|
|
325
331
|
options?.onTransactionSigned?.({
|
|
326
332
|
chainId
|
|
327
333
|
});
|
|
334
|
+
chunk7MC3BVQN_cjs.updateRouteDetails({
|
|
335
|
+
status: "pending",
|
|
336
|
+
routeId,
|
|
337
|
+
options
|
|
338
|
+
});
|
|
328
339
|
const txBytes = tx_js.TxRaw.encode(rawTx).finish();
|
|
329
340
|
const rawTxBase64 = Buffer.from(txBytes).toString("base64");
|
|
330
341
|
return rawTxBase64;
|
|
@@ -334,7 +345,8 @@ var signCosmosTransaction = async ({
|
|
|
334
345
|
var executeCosmosTransaction = async ({
|
|
335
346
|
tx,
|
|
336
347
|
options,
|
|
337
|
-
index
|
|
348
|
+
index,
|
|
349
|
+
routeId
|
|
338
350
|
}) => {
|
|
339
351
|
if (tx === void 0) {
|
|
340
352
|
throw new Error("executeCosmosTransaction error: tx is undefined");
|
|
@@ -342,10 +354,11 @@ var executeCosmosTransaction = async ({
|
|
|
342
354
|
const rawTxBase64 = await signCosmosTransaction({
|
|
343
355
|
tx,
|
|
344
356
|
options,
|
|
345
|
-
index
|
|
357
|
+
index,
|
|
358
|
+
routeId
|
|
346
359
|
});
|
|
347
360
|
const chainId = tx.cosmosTx?.chainId;
|
|
348
|
-
const txResponse = await
|
|
361
|
+
const txResponse = await chunk5HDKZVOL_cjs.submitTransaction({
|
|
349
362
|
chainId,
|
|
350
363
|
tx: rawTxBase64
|
|
351
364
|
});
|
|
@@ -557,8 +570,8 @@ var erc20ABI = /* @__PURE__ */ createAbi([
|
|
|
557
570
|
]);
|
|
558
571
|
|
|
559
572
|
// src/private-functions/evm/executeEvmTransaction.ts
|
|
560
|
-
var executeEvmTransaction = async (message, options, index) => {
|
|
561
|
-
const gasArray =
|
|
573
|
+
var executeEvmTransaction = async (message, options, index, routeId) => {
|
|
574
|
+
const gasArray = chunkN4UW74AG_cjs.ClientState.validateGasResults;
|
|
562
575
|
const gas = gasArray?.find((gas2) => gas2?.error !== null && gas2?.error !== void 0);
|
|
563
576
|
if (typeof gas?.error === "string") {
|
|
564
577
|
throw new Error(gas?.error);
|
|
@@ -604,6 +617,11 @@ var executeEvmTransaction = async (message, options, index) => {
|
|
|
604
617
|
status: "pending",
|
|
605
618
|
allowance: requiredApproval
|
|
606
619
|
});
|
|
620
|
+
chunk7MC3BVQN_cjs.updateRouteDetails({
|
|
621
|
+
status: "allowance",
|
|
622
|
+
routeId,
|
|
623
|
+
options
|
|
624
|
+
});
|
|
607
625
|
const txHash2 = await extendedSigner.writeContract({
|
|
608
626
|
account: evmSigner.account,
|
|
609
627
|
address: requiredApproval.tokenContract,
|
|
@@ -633,6 +651,11 @@ var executeEvmTransaction = async (message, options, index) => {
|
|
|
633
651
|
signerAddress: evmSigner.account.address,
|
|
634
652
|
txIndex: index
|
|
635
653
|
});
|
|
654
|
+
chunk7MC3BVQN_cjs.updateRouteDetails({
|
|
655
|
+
status: "signing",
|
|
656
|
+
routeId,
|
|
657
|
+
options
|
|
658
|
+
});
|
|
636
659
|
const txHash = await extendedSigner.sendTransaction({
|
|
637
660
|
account: evmSigner.account,
|
|
638
661
|
to: evmTx.to,
|
|
@@ -640,6 +663,11 @@ var executeEvmTransaction = async (message, options, index) => {
|
|
|
640
663
|
chain: evmSigner.chain,
|
|
641
664
|
value: evmTx.value === "" ? void 0 : BigInt(evmTx.value)
|
|
642
665
|
});
|
|
666
|
+
chunk7MC3BVQN_cjs.updateRouteDetails({
|
|
667
|
+
status: "pending",
|
|
668
|
+
routeId,
|
|
669
|
+
options
|
|
670
|
+
});
|
|
643
671
|
onTransactionSigned?.({
|
|
644
672
|
chainId: evmTx.chainId
|
|
645
673
|
});
|
|
@@ -651,9 +679,10 @@ var executeEvmTransaction = async (message, options, index) => {
|
|
|
651
679
|
var signSvmTransaction = async ({
|
|
652
680
|
tx,
|
|
653
681
|
options,
|
|
654
|
-
index
|
|
682
|
+
index,
|
|
683
|
+
routeId
|
|
655
684
|
}) => {
|
|
656
|
-
const gasArray =
|
|
685
|
+
const gasArray = chunkN4UW74AG_cjs.ClientState.validateGasResults;
|
|
657
686
|
if (tx === void 0) {
|
|
658
687
|
throw new Error("executeSvmTransaction error: tx is undefined");
|
|
659
688
|
}
|
|
@@ -690,26 +719,36 @@ var signSvmTransaction = async ({
|
|
|
690
719
|
signerAddress: signer.publicKey?.toBase58(),
|
|
691
720
|
txIndex: index
|
|
692
721
|
});
|
|
722
|
+
chunk7MC3BVQN_cjs.updateRouteDetails({
|
|
723
|
+
status: "signing",
|
|
724
|
+
routeId,
|
|
725
|
+
options
|
|
726
|
+
});
|
|
693
727
|
const signedTx = await signer.signTransaction(transaction);
|
|
694
728
|
options?.onTransactionSigned?.({ chainId: svmTx.chainId });
|
|
729
|
+
chunk7MC3BVQN_cjs.updateRouteDetails({
|
|
730
|
+
status: "pending",
|
|
731
|
+
routeId,
|
|
732
|
+
options
|
|
733
|
+
});
|
|
695
734
|
const serializedTx = signedTx.serialize();
|
|
696
735
|
return serializedTx;
|
|
697
736
|
};
|
|
698
737
|
|
|
699
738
|
// src/private-functions/svm/executeSvmTransaction.ts
|
|
700
|
-
var executeSvmTransaction = async (tx, options, index) => {
|
|
739
|
+
var executeSvmTransaction = async (tx, options, index, routeId) => {
|
|
701
740
|
const svmTx = tx?.svmTx;
|
|
702
741
|
if (!svmTx?.chainId) {
|
|
703
742
|
throw new Error("executeSvmTransaction error: chainId not found in svmTx");
|
|
704
743
|
}
|
|
705
|
-
const signedTx = await signSvmTransaction({ tx, options, index });
|
|
744
|
+
const signedTx = await signSvmTransaction({ tx, options, index, routeId });
|
|
706
745
|
if (!signedTx) {
|
|
707
746
|
throw new Error("executeSvmTransaction error: signedTx is undefined");
|
|
708
747
|
}
|
|
709
|
-
const endpoint = await
|
|
748
|
+
const endpoint = await chunk6LA66667_cjs.getRpcEndpointForChain(svmTx.chainId);
|
|
710
749
|
const connection = new web3_js.Connection(endpoint);
|
|
711
750
|
let signature;
|
|
712
|
-
const submitTxResponse = await
|
|
751
|
+
const submitTxResponse = await chunk5HDKZVOL_cjs.submitTransaction({
|
|
713
752
|
chainId: svmTx.chainId,
|
|
714
753
|
tx: signedTx.toString("base64")
|
|
715
754
|
});
|
|
@@ -737,13 +776,13 @@ var executeSvmTransaction = async (tx, options, index) => {
|
|
|
737
776
|
};
|
|
738
777
|
}
|
|
739
778
|
if (getStatusCount > 12) {
|
|
740
|
-
await
|
|
779
|
+
await chunkERGJBZUC_cjs.wait(3e3);
|
|
741
780
|
throw new Error(
|
|
742
781
|
`executeSvmTransaction error: waiting finalized status timed out for ${signature}`
|
|
743
782
|
);
|
|
744
783
|
}
|
|
745
784
|
getStatusCount++;
|
|
746
|
-
await
|
|
785
|
+
await chunkERGJBZUC_cjs.wait(3e3);
|
|
747
786
|
} catch (error) {
|
|
748
787
|
errorCount++;
|
|
749
788
|
if (errorCount > 12) {
|
|
@@ -777,7 +816,7 @@ var validateEvmTokenApproval = async ({
|
|
|
777
816
|
const fee = await extendedSigner.estimateFeesPerGas();
|
|
778
817
|
const allowanceGasFee = BigInt(fee.maxFeePerGas) * BigInt(1e5);
|
|
779
818
|
if (!gasBalance) {
|
|
780
|
-
const chainAssets = (await
|
|
819
|
+
const chainAssets = (await chunkN4UW74AG_cjs.ClientState.getSkipAssets({ chainId: tx.chainId }))[tx.chainId];
|
|
781
820
|
const nativeAsset = chainAssets?.find((x) => x.denom.includes("-native"));
|
|
782
821
|
const zeroAddressAsset = chainAssets?.find(
|
|
783
822
|
(x) => x.denom.toLowerCase() === "0x0000000000000000000000000000000000000000"
|
|
@@ -794,7 +833,7 @@ var validateEvmTokenApproval = async ({
|
|
|
794
833
|
);
|
|
795
834
|
}
|
|
796
835
|
if (chunk4R6OCWRR_cjs.BigNumber(gasBalance.amount).lt(Number(allowanceGasFee))) {
|
|
797
|
-
const chainAssets = (await
|
|
836
|
+
const chainAssets = (await chunkN4UW74AG_cjs.ClientState.getSkipAssets({ chainId: tx.chainId }))[tx.chainId];
|
|
798
837
|
const asset = chainAssets?.find(
|
|
799
838
|
(x) => x.denom.includes("-native") || x.denom.toLowerCase() === "0x0000000000000000000000000000000000000000"
|
|
800
839
|
);
|
|
@@ -842,8 +881,8 @@ var validateEvmGasBalance = async ({
|
|
|
842
881
|
useUnlimitedApproval
|
|
843
882
|
}) => {
|
|
844
883
|
const chainId = tx?.chainId ?? "";
|
|
845
|
-
const skipAssets = (await
|
|
846
|
-
const skipChains = await
|
|
884
|
+
const skipAssets = (await chunkN4UW74AG_cjs.ClientState.getSkipAssets({ chainId }))?.[chainId];
|
|
885
|
+
const skipChains = await chunkN4UW74AG_cjs.ClientState.getSkipChains();
|
|
847
886
|
const chain = skipChains?.find?.((chain2) => chain2.chainId === chainId);
|
|
848
887
|
if (!chain) {
|
|
849
888
|
throw new Error(`failed to find chain for chainId: '${chainId}'`);
|
|
@@ -851,7 +890,7 @@ var validateEvmGasBalance = async ({
|
|
|
851
890
|
if (!signer.account?.address) {
|
|
852
891
|
throw new Error("validateEvmGasBalance: Signer address not found");
|
|
853
892
|
}
|
|
854
|
-
const skipBalances = (await
|
|
893
|
+
const skipBalances = (await chunkN4UW74AG_cjs.balances({
|
|
855
894
|
chains: {
|
|
856
895
|
[tx?.chainId ?? ""]: {
|
|
857
896
|
address: signer.account?.address
|
|
@@ -937,7 +976,7 @@ var validateSvmGasBalance = async ({
|
|
|
937
976
|
fee: null
|
|
938
977
|
};
|
|
939
978
|
}
|
|
940
|
-
const endpoint = await
|
|
979
|
+
const endpoint = await chunk6LA66667_cjs.getRpcEndpointForChain(tx.chainId ?? "");
|
|
941
980
|
const connection = new web3_js.Connection(endpoint);
|
|
942
981
|
if (!connection) throw new Error(`Failed to connect to ${tx.chainId}`);
|
|
943
982
|
if (!tx.tx) {
|
|
@@ -1002,7 +1041,9 @@ var validateGasBalances = async ({
|
|
|
1002
1041
|
disabledChainIds,
|
|
1003
1042
|
enabledChainIds,
|
|
1004
1043
|
useUnlimitedApproval,
|
|
1005
|
-
getCosmosPriorityFeeDenom
|
|
1044
|
+
getCosmosPriorityFeeDenom,
|
|
1045
|
+
routeId,
|
|
1046
|
+
options
|
|
1006
1047
|
}) => {
|
|
1007
1048
|
const validateResult = await Promise.all(
|
|
1008
1049
|
txs.map(async (tx, i) => {
|
|
@@ -1013,11 +1054,16 @@ var validateGasBalances = async ({
|
|
|
1013
1054
|
onValidateGasBalance?.({
|
|
1014
1055
|
status: "pending"
|
|
1015
1056
|
});
|
|
1057
|
+
chunk7MC3BVQN_cjs.updateRouteDetails({
|
|
1058
|
+
status: "validating",
|
|
1059
|
+
routeId,
|
|
1060
|
+
options
|
|
1061
|
+
});
|
|
1016
1062
|
if (!tx?.cosmosTx?.msgs) {
|
|
1017
1063
|
throw new Error(`invalid msgs ${tx?.cosmosTx?.msgs}`);
|
|
1018
1064
|
}
|
|
1019
1065
|
try {
|
|
1020
|
-
const res = await
|
|
1066
|
+
const res = await chunk46VB6RQK_cjs.validateCosmosGasBalance({
|
|
1021
1067
|
chainId: tx.cosmosTx.chainId ?? "",
|
|
1022
1068
|
signerAddress: tx.cosmosTx.signerAddress ?? "",
|
|
1023
1069
|
messages: tx.cosmosTx.msgs,
|
|
@@ -1041,6 +1087,11 @@ var validateGasBalances = async ({
|
|
|
1041
1087
|
onValidateGasBalance?.({
|
|
1042
1088
|
status: "pending"
|
|
1043
1089
|
});
|
|
1090
|
+
chunk7MC3BVQN_cjs.updateRouteDetails({
|
|
1091
|
+
status: "validating",
|
|
1092
|
+
routeId,
|
|
1093
|
+
options
|
|
1094
|
+
});
|
|
1044
1095
|
const signer = await getEvmSigner?.(tx?.evmTx?.chainId ?? "");
|
|
1045
1096
|
if (!signer) {
|
|
1046
1097
|
throw new Error(
|
|
@@ -1068,6 +1119,11 @@ var validateGasBalances = async ({
|
|
|
1068
1119
|
onValidateGasBalance?.({
|
|
1069
1120
|
status: "pending"
|
|
1070
1121
|
});
|
|
1122
|
+
chunk7MC3BVQN_cjs.updateRouteDetails({
|
|
1123
|
+
status: "validating",
|
|
1124
|
+
routeId,
|
|
1125
|
+
options
|
|
1126
|
+
});
|
|
1071
1127
|
try {
|
|
1072
1128
|
const res = await validateSvmGasBalance({
|
|
1073
1129
|
tx: tx.svmTx,
|
|
@@ -1093,13 +1149,37 @@ var validateGasBalances = async ({
|
|
|
1093
1149
|
onValidateGasBalance?.({
|
|
1094
1150
|
status: "error"
|
|
1095
1151
|
});
|
|
1096
|
-
|
|
1152
|
+
chunkN4UW74AG_cjs.ClientState.validateGasResults = validateResult;
|
|
1097
1153
|
throw new Error(`${txError.error}`);
|
|
1098
1154
|
}
|
|
1099
1155
|
onValidateGasBalance?.({
|
|
1100
1156
|
status: "completed"
|
|
1101
1157
|
});
|
|
1102
|
-
|
|
1158
|
+
chunkN4UW74AG_cjs.ClientState.validateGasResults = validateResult;
|
|
1159
|
+
};
|
|
1160
|
+
|
|
1161
|
+
// src/private-functions/getChainIdsFromTxs.ts
|
|
1162
|
+
var getChainIdsFromTxs = (txs) => {
|
|
1163
|
+
return txs.map((tx) => {
|
|
1164
|
+
if ("cosmosTx" in tx) {
|
|
1165
|
+
return {
|
|
1166
|
+
chainType: "cosmos" /* Cosmos */,
|
|
1167
|
+
chainId: tx.cosmosTx?.chainId
|
|
1168
|
+
};
|
|
1169
|
+
}
|
|
1170
|
+
if ("svmTx" in tx) {
|
|
1171
|
+
return {
|
|
1172
|
+
chainType: "svm" /* Svm */,
|
|
1173
|
+
chainId: tx.svmTx?.chainId
|
|
1174
|
+
};
|
|
1175
|
+
}
|
|
1176
|
+
if ("evmTx" in tx) {
|
|
1177
|
+
return {
|
|
1178
|
+
chainType: "evm" /* Evm */,
|
|
1179
|
+
chainId: tx.evmTx?.chainId
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
});
|
|
1103
1183
|
};
|
|
1104
1184
|
|
|
1105
1185
|
// src/private-functions/executeTransactions.ts
|
|
@@ -1107,7 +1187,6 @@ var executeTransactions = async (options) => {
|
|
|
1107
1187
|
const {
|
|
1108
1188
|
txs,
|
|
1109
1189
|
onTransactionBroadcast,
|
|
1110
|
-
onTransactionCompleted,
|
|
1111
1190
|
simulate = true,
|
|
1112
1191
|
batchSimulate = true,
|
|
1113
1192
|
getFallbackGasAmount = getDefaultFallbackGasAmount,
|
|
@@ -1115,37 +1194,35 @@ var executeTransactions = async (options) => {
|
|
|
1115
1194
|
getEvmSigner,
|
|
1116
1195
|
onValidateGasBalance,
|
|
1117
1196
|
trackTxPollingOptions,
|
|
1118
|
-
batchSignTxs = true
|
|
1197
|
+
batchSignTxs = true,
|
|
1198
|
+
routeId
|
|
1119
1199
|
} = options;
|
|
1120
1200
|
if (txs === void 0) {
|
|
1121
1201
|
throw new Error(
|
|
1122
1202
|
"executeTransactions error: txs is undefined in executeTransactions"
|
|
1123
1203
|
);
|
|
1124
1204
|
}
|
|
1125
|
-
const chainIds = txs
|
|
1205
|
+
const chainIds = getChainIdsFromTxs(txs);
|
|
1206
|
+
const transactionDetails = txs.map((tx) => {
|
|
1126
1207
|
if ("cosmosTx" in tx) {
|
|
1127
|
-
return {
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
chainType: "svm",
|
|
1135
|
-
chainId: tx.svmTx?.chainId
|
|
1136
|
-
};
|
|
1137
|
-
}
|
|
1138
|
-
if ("evmTx" in tx) {
|
|
1139
|
-
return {
|
|
1140
|
-
chainType: "evm",
|
|
1141
|
-
chainId: tx.evmTx?.chainId
|
|
1142
|
-
};
|
|
1208
|
+
return { chainId: tx.cosmosTx?.chainId };
|
|
1209
|
+
} else if ("evmTx" in tx) {
|
|
1210
|
+
return { chainId: tx.evmTx?.chainId };
|
|
1211
|
+
} else if ("svmTx" in tx) {
|
|
1212
|
+
return { chainId: tx.svmTx?.chainId };
|
|
1213
|
+
} else {
|
|
1214
|
+
throw new Error("executeRoute error: invalid message type");
|
|
1143
1215
|
}
|
|
1144
1216
|
});
|
|
1217
|
+
chunk7MC3BVQN_cjs.updateRouteDetails({
|
|
1218
|
+
transactionDetails,
|
|
1219
|
+
routeId,
|
|
1220
|
+
options
|
|
1221
|
+
});
|
|
1145
1222
|
const isGasStationSourceEVM = chainIds.find((item, i, array) => {
|
|
1146
|
-
return chunkKZOSEIWH_cjs.GAS_STATION_CHAIN_IDS.includes(item?.chainId ?? "") && array[i - 1]?.chainType === "evm"
|
|
1223
|
+
return chunkKZOSEIWH_cjs.GAS_STATION_CHAIN_IDS.includes(item?.chainId ?? "") && array[i - 1]?.chainType === "evm" /* Evm */;
|
|
1147
1224
|
});
|
|
1148
|
-
|
|
1225
|
+
chunkN4UW74AG_cjs.ClientState.validateGasResults = void 0;
|
|
1149
1226
|
const validateChainIds = !batchSimulate ? chainIds.map((x) => x?.chainId ?? "") : isGasStationSourceEVM ? chunkKZOSEIWH_cjs.GAS_STATION_CHAIN_IDS : [];
|
|
1150
1227
|
await validateGasBalances({
|
|
1151
1228
|
txs,
|
|
@@ -1155,7 +1232,9 @@ var executeTransactions = async (options) => {
|
|
|
1155
1232
|
onValidateGasBalance,
|
|
1156
1233
|
simulate,
|
|
1157
1234
|
disabledChainIds: validateChainIds,
|
|
1158
|
-
getCosmosPriorityFeeDenom: options.getCosmosPriorityFeeDenom
|
|
1235
|
+
getCosmosPriorityFeeDenom: options.getCosmosPriorityFeeDenom,
|
|
1236
|
+
options,
|
|
1237
|
+
routeId
|
|
1159
1238
|
});
|
|
1160
1239
|
const validateEnabledChainIds = async (chainId) => {
|
|
1161
1240
|
await validateGasBalances({
|
|
@@ -1166,7 +1245,9 @@ var executeTransactions = async (options) => {
|
|
|
1166
1245
|
onValidateGasBalance,
|
|
1167
1246
|
simulate,
|
|
1168
1247
|
enabledChainIds: !batchSimulate ? [chainId] : validateChainIds,
|
|
1169
|
-
getCosmosPriorityFeeDenom: options.getCosmosPriorityFeeDenom
|
|
1248
|
+
getCosmosPriorityFeeDenom: options.getCosmosPriorityFeeDenom,
|
|
1249
|
+
options,
|
|
1250
|
+
routeId
|
|
1170
1251
|
});
|
|
1171
1252
|
};
|
|
1172
1253
|
let signedTxs = [];
|
|
@@ -1199,7 +1280,8 @@ var executeTransactions = async (options) => {
|
|
|
1199
1280
|
const signedTx = await signCosmosTransaction({
|
|
1200
1281
|
tx,
|
|
1201
1282
|
options,
|
|
1202
|
-
index: i
|
|
1283
|
+
index: i,
|
|
1284
|
+
routeId
|
|
1203
1285
|
});
|
|
1204
1286
|
signedTxs.push({
|
|
1205
1287
|
index: i,
|
|
@@ -1210,7 +1292,7 @@ var executeTransactions = async (options) => {
|
|
|
1210
1292
|
}
|
|
1211
1293
|
if ("svmTx" in tx) {
|
|
1212
1294
|
await validateEnabledChainIds(tx.svmTx?.chainId ?? "");
|
|
1213
|
-
const signedTx = await signSvmTransaction({ tx, options, index: i });
|
|
1295
|
+
const signedTx = await signSvmTransaction({ tx, options, index: i, routeId });
|
|
1214
1296
|
if (!signedTx) {
|
|
1215
1297
|
throw new Error(`executeRoute error: signedTx is undefined`);
|
|
1216
1298
|
}
|
|
@@ -1223,15 +1305,15 @@ var executeTransactions = async (options) => {
|
|
|
1223
1305
|
}
|
|
1224
1306
|
}
|
|
1225
1307
|
}
|
|
1226
|
-
|
|
1227
|
-
const tx = txs[
|
|
1308
|
+
const executeTransaction = async (index) => {
|
|
1309
|
+
const tx = txs[index];
|
|
1228
1310
|
if (!tx) {
|
|
1229
|
-
throw new Error(`executeRoute error: invalid message at index ${
|
|
1311
|
+
throw new Error(`executeRoute error: invalid message at index ${index}`);
|
|
1230
1312
|
}
|
|
1231
1313
|
let txResult;
|
|
1232
|
-
const txSigned = signedTxs.find((item) => item.index ===
|
|
1314
|
+
const txSigned = signedTxs.find((item) => item.index === index);
|
|
1233
1315
|
if (txSigned) {
|
|
1234
|
-
const txResponse = await
|
|
1316
|
+
const txResponse = await chunk5HDKZVOL_cjs.submitTransaction({
|
|
1235
1317
|
chainId: txSigned.chainId,
|
|
1236
1318
|
tx: txSigned.tx
|
|
1237
1319
|
});
|
|
@@ -1246,34 +1328,32 @@ var executeTransactions = async (options) => {
|
|
|
1246
1328
|
txResult = await executeCosmosTransaction({
|
|
1247
1329
|
tx,
|
|
1248
1330
|
options,
|
|
1249
|
-
index
|
|
1331
|
+
index,
|
|
1332
|
+
routeId
|
|
1250
1333
|
});
|
|
1251
1334
|
} else if ("evmTx" in tx) {
|
|
1252
1335
|
await validateEnabledChainIds(tx.evmTx?.chainId ?? "");
|
|
1253
|
-
const txResponse = await executeEvmTransaction(tx, options,
|
|
1336
|
+
const txResponse = await executeEvmTransaction(tx, options, index, routeId);
|
|
1254
1337
|
txResult = {
|
|
1255
1338
|
chainId: tx?.evmTx?.chainId ?? "",
|
|
1256
1339
|
txHash: txResponse.transactionHash
|
|
1257
1340
|
};
|
|
1258
1341
|
} else if ("svmTx" in tx) {
|
|
1259
1342
|
await validateEnabledChainIds(tx.svmTx?.chainId ?? "");
|
|
1260
|
-
txResult = await executeSvmTransaction(tx, options,
|
|
1343
|
+
txResult = await executeSvmTransaction(tx, options, index, routeId);
|
|
1261
1344
|
} else {
|
|
1262
1345
|
throw new Error("executeRoute error: invalid message type");
|
|
1263
1346
|
}
|
|
1264
1347
|
}
|
|
1265
1348
|
await onTransactionBroadcast?.({ ...txResult });
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
status: txStatusResponse
|
|
1275
|
-
});
|
|
1276
|
-
}
|
|
1349
|
+
return txResult;
|
|
1350
|
+
};
|
|
1351
|
+
await chunk7MC3BVQN_cjs.executeAndSubscribeToRouteStatus({
|
|
1352
|
+
transactionDetails,
|
|
1353
|
+
executeTransaction,
|
|
1354
|
+
routeId,
|
|
1355
|
+
options
|
|
1356
|
+
});
|
|
1277
1357
|
};
|
|
1278
1358
|
var EVM_GAS_AMOUNT = 15e4;
|
|
1279
1359
|
var COSMOS_GAS_AMOUNT = {
|
|
@@ -1286,7 +1366,7 @@ var getDefaultFallbackGasAmount = async (chainId, chainType) => {
|
|
|
1286
1366
|
return EVM_GAS_AMOUNT;
|
|
1287
1367
|
}
|
|
1288
1368
|
if (chainType !== "cosmos" /* Cosmos */) return void 0;
|
|
1289
|
-
const venuesResult = await
|
|
1369
|
+
const venuesResult = await chunk5AYPH3ZR_cjs.venues();
|
|
1290
1370
|
const isSwapChain = venuesResult?.some(
|
|
1291
1371
|
(venue) => venue.chainId === chainId
|
|
1292
1372
|
) ?? false;
|
|
@@ -1300,6 +1380,10 @@ var getDefaultFallbackGasAmount = async (chainId, chainType) => {
|
|
|
1300
1380
|
};
|
|
1301
1381
|
var executeRoute = async (options) => {
|
|
1302
1382
|
const { route, userAddresses, beforeMsg, afterMsg, timeoutSeconds } = options;
|
|
1383
|
+
const { id: routeId } = chunk7MC3BVQN_cjs.updateRouteDetails({
|
|
1384
|
+
status: "unconfirmed",
|
|
1385
|
+
options
|
|
1386
|
+
});
|
|
1303
1387
|
let addressList = [];
|
|
1304
1388
|
userAddresses.forEach((userAddress, index) => {
|
|
1305
1389
|
const requiredChainAddress = route.requiredChainAddresses[index];
|
|
@@ -1318,7 +1402,7 @@ var executeRoute = async (options) => {
|
|
|
1318
1402
|
if (!isUserAddressesValid) {
|
|
1319
1403
|
throw new Error("executeRoute error: invalid user addresses");
|
|
1320
1404
|
}
|
|
1321
|
-
const response = await
|
|
1405
|
+
const response = await chunkOZUCMWNE_cjs.messages({
|
|
1322
1406
|
timeoutSeconds,
|
|
1323
1407
|
amountIn: route?.amountIn,
|
|
1324
1408
|
amountOut: route.estimatedAmountOut || "0",
|
|
@@ -1329,7 +1413,7 @@ var executeRoute = async (options) => {
|
|
|
1329
1413
|
operations: route?.operations,
|
|
1330
1414
|
addressList,
|
|
1331
1415
|
slippageTolerancePercent: options.slippageTolerancePercent || "1",
|
|
1332
|
-
chainIdsToAffiliates:
|
|
1416
|
+
chainIdsToAffiliates: chunkERGJBZUC_cjs.ApiState.chainIdsToAffiliates,
|
|
1333
1417
|
postRouteHandler: options.postRouteHandler,
|
|
1334
1418
|
feePayerAddress: options.svmFeePayer?.address
|
|
1335
1419
|
});
|
|
@@ -1345,10 +1429,10 @@ var executeRoute = async (options) => {
|
|
|
1345
1429
|
lastTx.cosmosTx?.msgs?.push(afterMsg);
|
|
1346
1430
|
}
|
|
1347
1431
|
}
|
|
1348
|
-
await executeTransactions({ ...options, txs: response?.txs });
|
|
1432
|
+
await executeTransactions({ ...options, routeId, txs: response?.txs });
|
|
1349
1433
|
};
|
|
1350
1434
|
var validateUserAddresses = async (userAddresses) => {
|
|
1351
|
-
const chains2 = await
|
|
1435
|
+
const chains2 = await chunkN4UW74AG_cjs.ClientState.getSkipChains();
|
|
1352
1436
|
const validations = userAddresses.map((userAddress) => {
|
|
1353
1437
|
const chain = chains2.find((chain2) => chain2.chainId === userAddress.chainId);
|
|
1354
1438
|
switch (chain?.chainType) {
|