@skip-go/client 1.3.7 → 1.5.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-2EKCOIWV.cjs → chunk-23YF4LFI.cjs} +185 -154
- package/dist/cjs/chunk-3M7YYWGL.cjs +295 -0
- package/dist/cjs/chunk-4YTACAVP.cjs +185 -0
- 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-YYBGBKRE.cjs → chunk-A26H4FVN.cjs} +4 -4
- package/dist/cjs/{chunk-P7CDAHIX.cjs → chunk-AXYRULAI.cjs} +2 -2
- package/dist/cjs/{chunk-E2P5MVX3.cjs → chunk-CUDPMOR6.cjs} +16 -9
- 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-GCJO6DZD.cjs +55 -0
- package/dist/cjs/{chunk-OEYY7NXT.cjs → chunk-HHZGD62Y.cjs} +256 -168
- package/dist/cjs/{chunk-DBDB2XWX.cjs → chunk-JBKNEFXB.cjs} +3 -3
- package/dist/cjs/{chunk-AF7EI5BT.cjs → chunk-K4YAPDUE.cjs} +2 -2
- 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-2VQ2TNFM.cjs → chunk-QPM7H2YL.cjs} +2 -2
- package/dist/cjs/{chunk-FO25SR66.cjs → chunk-RCGCQD6T.cjs} +6 -6
- package/dist/cjs/chunk-UIQML2XG.cjs +455 -0
- package/dist/cjs/chunk-VF65UG3E.cjs +214 -0
- package/dist/cjs/{chunk-VKVHMUDR.cjs → chunk-W3KF3V57.cjs} +6 -6
- package/dist/cjs/{chunk-YN66ABRQ.cjs → chunk-X22PL5T7.cjs} +126 -16
- package/dist/cjs/{chunk-DCFIIF7G.cjs → chunk-X5AJHZ2J.cjs} +2 -2
- package/dist/cjs/{chunk-MCZ3F457.cjs → chunk-ZBPDDVQ2.cjs} +2 -2
- package/dist/cjs/index.cjs +66 -54
- package/dist/cjs/public-functions/executeMultipleRoutes.cjs +29 -0
- package/dist/cjs/public-functions/executeRoute.cjs +17 -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-CvqAtBJq.d.ts +130 -0
- package/dist/esm/{chunk-SJP6W2SK.js → chunk-3XOGEVJL.js} +1 -1
- package/dist/esm/{chunk-JSY7M43P.js → chunk-52PEBJRQ.js} +1 -1
- package/dist/esm/chunk-7RS3YIVC.js +53 -0
- 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-AZALP3WR.js +212 -0
- package/dist/esm/{chunk-5JZOTYDC.js → chunk-CX5N7ZLJ.js} +1 -1
- package/dist/esm/{chunk-JYUNVL4F.js → chunk-FH2YHZVV.js} +1 -1
- package/dist/esm/chunk-IUYOY23L.js +180 -0
- package/dist/esm/{chunk-IQQDEBLI.js → chunk-JKN4E5VN.js} +11 -4
- package/dist/esm/{chunk-OHV2LZEG.js → chunk-JQ4F4WBG.js} +1 -1
- package/dist/esm/{chunk-5FKIW2ZL.js → chunk-KLGGCB73.js} +2 -2
- package/dist/esm/{chunk-P76IRSIS.js → chunk-KNXMSLOB.js} +2 -2
- package/dist/esm/{chunk-IWXRHEX4.js → chunk-LHNGF5J2.js} +2 -2
- package/dist/esm/{chunk-KJVD5P3Q.js → chunk-MPSXXWKL.js} +109 -3
- package/dist/esm/{chunk-FFFVITWF.js → chunk-MTAS5XMN.js} +219 -132
- 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-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-VUXLWWLF.js +450 -0
- package/dist/esm/{chunk-OL7CWCPB.js → chunk-WBZVMPPV.js} +34 -3
- 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/client-types-Dk6ypWdO.d.ts +114 -0
- package/dist/esm/index.d.ts +5 -5
- package/dist/esm/index.js +29 -25
- package/dist/esm/public-functions/executeMultipleRoutes.d.ts +60 -0
- package/dist/esm/public-functions/executeMultipleRoutes.js +20 -0
- package/dist/esm/public-functions/executeRoute.d.ts +7 -76
- package/dist/esm/public-functions/executeRoute.js +16 -14
- package/dist/esm/public-functions/getCosmosGasAmountForMessage.js +3 -2
- package/dist/esm/public-functions/getEvmGasAmountForMessage.d.ts +4 -1
- 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.d.ts +4 -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 +7 -5
- package/dist/esm/public-functions/validateCosmosGasBalance.js +8 -7
- package/dist/esm/public-functions/waitForTransaction.d.ts +6 -2
- package/dist/esm/public-functions/waitForTransaction.js +4 -4
- package/dist/esm/{setClientOptions-BTRwCbmt.d.ts → setClientOptions-BD8e7m2x.d.ts} +1 -1
- 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
- package/dist/esm/client-types-B7Fin0mq.d.ts +0 -61
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { getEncodeObjectFromCosmosMessage } from './chunk-
|
|
1
|
+
import { updateRouteDetails } from './chunk-VUXLWWLF.js';
|
|
2
|
+
import { validateCosmosGasBalance } from './chunk-JKN4E5VN.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 {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { ApiState, toCamel, wait } from './chunk-LZI7A4JI.js';
|
|
14
|
-
import { PublicKey, Transaction, Connection, LAMPORTS_PER_SOL } from '@solana/web3.js';
|
|
15
|
-
import { bech32m, bech32 } from 'bech32';
|
|
7
|
+
import { getRpcEndpointForChain, accountParser, getSigningStargateClient } from './chunk-MPSXXWKL.js';
|
|
8
|
+
import { chains, findFirstWorkingEndpoint, getIsEthermint, getIsInitia } from './chunk-IUYOY23L.js';
|
|
9
|
+
import { submitTransaction } from './chunk-JQ4F4WBG.js';
|
|
10
|
+
import { venues } from './chunk-52PEBJRQ.js';
|
|
11
|
+
import { ClientState, balances } from './chunk-ZOUYAZU6.js';
|
|
12
|
+
import { toCamel, wait } from './chunk-A6KSECAH.js';
|
|
16
13
|
import { StargateClient } from '@cosmjs/stargate';
|
|
17
14
|
import { TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx.js';
|
|
18
15
|
import { isOfflineDirectSigner, makeAuthInfoBytes, makeSignDoc, encodePubkey } from '@cosmjs/proto-signing';
|
|
@@ -23,6 +20,8 @@ import { Any } from 'cosmjs-types/google/protobuf/any.js';
|
|
|
23
20
|
import { Int53 } from '@cosmjs/math';
|
|
24
21
|
import { SignMode } from 'cosmjs-types/cosmos/tx/signing/v1beta1/signing.js';
|
|
25
22
|
import { isAddress, publicActions, maxUint256, formatUnits } from 'viem';
|
|
23
|
+
import { Transaction, PublicKey, Connection, LAMPORTS_PER_SOL } from '@solana/web3.js';
|
|
24
|
+
import { bech32m, bech32 } from 'bech32';
|
|
26
25
|
|
|
27
26
|
// src/private-functions/getRestEndpointForChain.ts
|
|
28
27
|
var getRestEndpointForChain = async (chainId) => {
|
|
@@ -172,11 +171,11 @@ var signCosmosMessageDirect = async (options) => {
|
|
|
172
171
|
if (!accountFromSigner) {
|
|
173
172
|
throw new Error("signCosmosMessageDirect error: failed to retrieve account from signer");
|
|
174
173
|
}
|
|
175
|
-
const
|
|
174
|
+
const messages = cosmosMsgs.map((cosmosMsg) => getEncodeObjectFromCosmosMessage(cosmosMsg));
|
|
176
175
|
const txBodyEncodeObject = {
|
|
177
176
|
typeUrl: "/cosmos.tx.v1beta1.TxBody",
|
|
178
177
|
value: {
|
|
179
|
-
messages
|
|
178
|
+
messages
|
|
180
179
|
}
|
|
181
180
|
};
|
|
182
181
|
const txBodyBytes = ClientState.registry.encode(txBodyEncodeObject);
|
|
@@ -207,26 +206,40 @@ var signCosmosMessageAmino = async (options) => {
|
|
|
207
206
|
signerData: { accountNumber, sequence, chainId: signerChainId }
|
|
208
207
|
} = options;
|
|
209
208
|
const accounts = await signer.getAccounts();
|
|
210
|
-
const accountFromSigner = accounts.find(
|
|
209
|
+
const accountFromSigner = accounts.find(
|
|
210
|
+
(account) => account.address === signerAddress
|
|
211
|
+
);
|
|
211
212
|
if (!accountFromSigner) {
|
|
212
|
-
throw new Error(
|
|
213
|
+
throw new Error(
|
|
214
|
+
"signCosmosMessageAmino: failed to retrieve account from signer"
|
|
215
|
+
);
|
|
213
216
|
}
|
|
214
|
-
const
|
|
217
|
+
const messages = cosmosMsgs.map(
|
|
218
|
+
(cosmosMsg) => getEncodeObjectFromCosmosMessage(cosmosMsg)
|
|
219
|
+
);
|
|
215
220
|
const signMode = SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
|
|
216
|
-
const msgs =
|
|
217
|
-
|
|
218
|
-
|
|
221
|
+
const msgs = messages.map((msg) => ClientState.aminoTypes.toAmino(msg));
|
|
222
|
+
const signDoc = makeSignDoc$1(
|
|
223
|
+
msgs,
|
|
224
|
+
fee,
|
|
225
|
+
signerChainId,
|
|
226
|
+
"",
|
|
227
|
+
accountNumber,
|
|
228
|
+
sequence
|
|
229
|
+
);
|
|
219
230
|
const { signature, signed } = await signer.signAmino(signerAddress, signDoc);
|
|
220
231
|
const signedTxBody = {
|
|
221
232
|
messages: signed.msgs.map((msg) => ClientState.aminoTypes.fromAmino(msg)),
|
|
222
233
|
memo: signed.memo
|
|
223
234
|
};
|
|
224
|
-
signedTxBody.messages[0].value.memo =
|
|
235
|
+
signedTxBody.messages[0].value.memo = messages[0].value.memo;
|
|
225
236
|
const signedTxBodyEncodeObject = {
|
|
226
237
|
typeUrl: "/cosmos.tx.v1beta1.TxBody",
|
|
227
238
|
value: signedTxBody
|
|
228
239
|
};
|
|
229
|
-
const signedTxBodyBytes = ClientState.registry.encode(
|
|
240
|
+
const signedTxBodyBytes = ClientState.registry.encode(
|
|
241
|
+
signedTxBodyEncodeObject
|
|
242
|
+
);
|
|
230
243
|
const signedGasLimit = Int53.fromString(signed.fee.gas).toNumber();
|
|
231
244
|
const signedSequence = Int53.fromString(signed.sequence).toNumber();
|
|
232
245
|
const pubkeyAny = makePubkeyAnyFromAccount(accountFromSigner, chainId);
|
|
@@ -249,14 +262,15 @@ var signCosmosMessageAmino = async (options) => {
|
|
|
249
262
|
var signCosmosTransaction = async ({
|
|
250
263
|
tx,
|
|
251
264
|
options,
|
|
252
|
-
index
|
|
265
|
+
index,
|
|
266
|
+
routeId
|
|
253
267
|
}) => {
|
|
254
268
|
const { userAddresses } = options;
|
|
255
269
|
if (tx === void 0) {
|
|
256
270
|
throw new Error("executeCosmosTransaction error: tx is undefined");
|
|
257
271
|
}
|
|
258
272
|
const chainId = tx.cosmosTx?.chainId;
|
|
259
|
-
const
|
|
273
|
+
const messages = tx.cosmosTx?.msgs;
|
|
260
274
|
const currentUserAddress = userAddresses.find((x) => x.chainId === tx.cosmosTx?.chainId)?.address;
|
|
261
275
|
const gasArray = ClientState.validateGasResults;
|
|
262
276
|
const gas = gasArray?.find((gas2) => gas2?.error !== null && gas2?.error !== void 0);
|
|
@@ -270,7 +284,7 @@ var signCosmosTransaction = async ({
|
|
|
270
284
|
if (chainId === void 0) {
|
|
271
285
|
throw new Error("no chainId found for tx");
|
|
272
286
|
}
|
|
273
|
-
if (
|
|
287
|
+
if (messages === void 0) {
|
|
274
288
|
throw new Error("no messages found for tx");
|
|
275
289
|
}
|
|
276
290
|
const { signer } = await getSigningStargateClient({
|
|
@@ -299,7 +313,7 @@ var signCosmosTransaction = async ({
|
|
|
299
313
|
const commonRawTxBody = {
|
|
300
314
|
signerAddress: currentUserAddress,
|
|
301
315
|
chainId,
|
|
302
|
-
cosmosMsgs:
|
|
316
|
+
cosmosMsgs: messages,
|
|
303
317
|
fee,
|
|
304
318
|
signerData: {
|
|
305
319
|
accountNumber,
|
|
@@ -312,6 +326,11 @@ var signCosmosTransaction = async ({
|
|
|
312
326
|
txIndex: index,
|
|
313
327
|
signerAddress: currentUserAddress
|
|
314
328
|
});
|
|
329
|
+
updateRouteDetails({
|
|
330
|
+
status: "signing",
|
|
331
|
+
routeId,
|
|
332
|
+
options
|
|
333
|
+
});
|
|
315
334
|
if (isOfflineDirectSigner(signer)) {
|
|
316
335
|
rawTx = await signCosmosMessageDirect({
|
|
317
336
|
...commonRawTxBody,
|
|
@@ -323,6 +342,11 @@ var signCosmosTransaction = async ({
|
|
|
323
342
|
options?.onTransactionSigned?.({
|
|
324
343
|
chainId
|
|
325
344
|
});
|
|
345
|
+
updateRouteDetails({
|
|
346
|
+
status: "pending",
|
|
347
|
+
routeId,
|
|
348
|
+
options
|
|
349
|
+
});
|
|
326
350
|
const txBytes = TxRaw.encode(rawTx).finish();
|
|
327
351
|
const rawTxBase64 = Buffer.from(txBytes).toString("base64");
|
|
328
352
|
return rawTxBase64;
|
|
@@ -332,7 +356,8 @@ var signCosmosTransaction = async ({
|
|
|
332
356
|
var executeCosmosTransaction = async ({
|
|
333
357
|
tx,
|
|
334
358
|
options,
|
|
335
|
-
index
|
|
359
|
+
index,
|
|
360
|
+
routeId
|
|
336
361
|
}) => {
|
|
337
362
|
if (tx === void 0) {
|
|
338
363
|
throw new Error("executeCosmosTransaction error: tx is undefined");
|
|
@@ -340,7 +365,8 @@ var executeCosmosTransaction = async ({
|
|
|
340
365
|
const rawTxBase64 = await signCosmosTransaction({
|
|
341
366
|
tx,
|
|
342
367
|
options,
|
|
343
|
-
index
|
|
368
|
+
index,
|
|
369
|
+
routeId
|
|
344
370
|
});
|
|
345
371
|
const chainId = tx.cosmosTx?.chainId;
|
|
346
372
|
const txResponse = await submitTransaction({
|
|
@@ -555,7 +581,7 @@ var erc20ABI = /* @__PURE__ */ createAbi([
|
|
|
555
581
|
]);
|
|
556
582
|
|
|
557
583
|
// src/private-functions/evm/executeEvmTransaction.ts
|
|
558
|
-
var executeEvmTransaction = async (message, options, index) => {
|
|
584
|
+
var executeEvmTransaction = async (message, options, index, routeId) => {
|
|
559
585
|
const gasArray = ClientState.validateGasResults;
|
|
560
586
|
const gas = gasArray?.find((gas2) => gas2?.error !== null && gas2?.error !== void 0);
|
|
561
587
|
if (typeof gas?.error === "string") {
|
|
@@ -602,6 +628,11 @@ var executeEvmTransaction = async (message, options, index) => {
|
|
|
602
628
|
status: "pending",
|
|
603
629
|
allowance: requiredApproval
|
|
604
630
|
});
|
|
631
|
+
updateRouteDetails({
|
|
632
|
+
status: "allowance",
|
|
633
|
+
routeId,
|
|
634
|
+
options
|
|
635
|
+
});
|
|
605
636
|
const txHash2 = await extendedSigner.writeContract({
|
|
606
637
|
account: evmSigner.account,
|
|
607
638
|
address: requiredApproval.tokenContract,
|
|
@@ -631,6 +662,11 @@ var executeEvmTransaction = async (message, options, index) => {
|
|
|
631
662
|
signerAddress: evmSigner.account.address,
|
|
632
663
|
txIndex: index
|
|
633
664
|
});
|
|
665
|
+
updateRouteDetails({
|
|
666
|
+
status: "signing",
|
|
667
|
+
routeId,
|
|
668
|
+
options
|
|
669
|
+
});
|
|
634
670
|
const txHash = await extendedSigner.sendTransaction({
|
|
635
671
|
account: evmSigner.account,
|
|
636
672
|
to: evmTx.to,
|
|
@@ -638,6 +674,11 @@ var executeEvmTransaction = async (message, options, index) => {
|
|
|
638
674
|
chain: evmSigner.chain,
|
|
639
675
|
value: evmTx.value === "" ? void 0 : BigInt(evmTx.value)
|
|
640
676
|
});
|
|
677
|
+
updateRouteDetails({
|
|
678
|
+
status: "pending",
|
|
679
|
+
routeId,
|
|
680
|
+
options
|
|
681
|
+
});
|
|
641
682
|
onTransactionSigned?.({
|
|
642
683
|
chainId: evmTx.chainId
|
|
643
684
|
});
|
|
@@ -649,7 +690,8 @@ var executeEvmTransaction = async (message, options, index) => {
|
|
|
649
690
|
var signSvmTransaction = async ({
|
|
650
691
|
tx,
|
|
651
692
|
options,
|
|
652
|
-
index
|
|
693
|
+
index,
|
|
694
|
+
routeId
|
|
653
695
|
}) => {
|
|
654
696
|
const gasArray = ClientState.validateGasResults;
|
|
655
697
|
if (tx === void 0) {
|
|
@@ -688,19 +730,29 @@ var signSvmTransaction = async ({
|
|
|
688
730
|
signerAddress: signer.publicKey?.toBase58(),
|
|
689
731
|
txIndex: index
|
|
690
732
|
});
|
|
733
|
+
updateRouteDetails({
|
|
734
|
+
status: "signing",
|
|
735
|
+
routeId,
|
|
736
|
+
options
|
|
737
|
+
});
|
|
691
738
|
const signedTx = await signer.signTransaction(transaction);
|
|
692
739
|
options?.onTransactionSigned?.({ chainId: svmTx.chainId });
|
|
740
|
+
updateRouteDetails({
|
|
741
|
+
status: "pending",
|
|
742
|
+
routeId,
|
|
743
|
+
options
|
|
744
|
+
});
|
|
693
745
|
const serializedTx = signedTx.serialize();
|
|
694
746
|
return serializedTx;
|
|
695
747
|
};
|
|
696
748
|
|
|
697
749
|
// src/private-functions/svm/executeSvmTransaction.ts
|
|
698
|
-
var executeSvmTransaction = async (tx, options, index) => {
|
|
750
|
+
var executeSvmTransaction = async (tx, options, index, routeId) => {
|
|
699
751
|
const svmTx = tx?.svmTx;
|
|
700
752
|
if (!svmTx?.chainId) {
|
|
701
753
|
throw new Error("executeSvmTransaction error: chainId not found in svmTx");
|
|
702
754
|
}
|
|
703
|
-
const signedTx = await signSvmTransaction({ tx, options, index });
|
|
755
|
+
const signedTx = await signSvmTransaction({ tx, options, index, routeId });
|
|
704
756
|
if (!signedTx) {
|
|
705
757
|
throw new Error("executeSvmTransaction error: signedTx is undefined");
|
|
706
758
|
}
|
|
@@ -837,7 +889,8 @@ var validateEvmGasBalance = async ({
|
|
|
837
889
|
signer,
|
|
838
890
|
tx,
|
|
839
891
|
getFallbackGasAmount,
|
|
840
|
-
useUnlimitedApproval
|
|
892
|
+
useUnlimitedApproval,
|
|
893
|
+
bypassApprovalCheck
|
|
841
894
|
}) => {
|
|
842
895
|
const chainId = tx?.chainId ?? "";
|
|
843
896
|
const skipAssets = (await ClientState.getSkipAssets({ chainId }))?.[chainId];
|
|
@@ -862,7 +915,7 @@ var validateEvmGasBalance = async ({
|
|
|
862
915
|
)?.[1];
|
|
863
916
|
const gasBalance = nativeGasBalance || zeroAddressGasBalance;
|
|
864
917
|
const { requiredErc20Approvals } = tx;
|
|
865
|
-
if (requiredErc20Approvals) {
|
|
918
|
+
if (!bypassApprovalCheck && requiredErc20Approvals) {
|
|
866
919
|
try {
|
|
867
920
|
await validateEvmTokenApproval({
|
|
868
921
|
requiredErc20Approvals,
|
|
@@ -999,8 +1052,10 @@ var validateGasBalances = async ({
|
|
|
999
1052
|
simulate,
|
|
1000
1053
|
disabledChainIds,
|
|
1001
1054
|
enabledChainIds,
|
|
1002
|
-
|
|
1003
|
-
|
|
1055
|
+
getCosmosPriorityFeeDenom,
|
|
1056
|
+
routeId,
|
|
1057
|
+
options,
|
|
1058
|
+
isMultiRoutes
|
|
1004
1059
|
}) => {
|
|
1005
1060
|
const validateResult = await Promise.all(
|
|
1006
1061
|
txs.map(async (tx, i) => {
|
|
@@ -1011,6 +1066,11 @@ var validateGasBalances = async ({
|
|
|
1011
1066
|
onValidateGasBalance?.({
|
|
1012
1067
|
status: "pending"
|
|
1013
1068
|
});
|
|
1069
|
+
updateRouteDetails({
|
|
1070
|
+
status: "validating",
|
|
1071
|
+
routeId,
|
|
1072
|
+
options
|
|
1073
|
+
});
|
|
1014
1074
|
if (!tx?.cosmosTx?.msgs) {
|
|
1015
1075
|
throw new Error(`invalid msgs ${tx?.cosmosTx?.msgs}`);
|
|
1016
1076
|
}
|
|
@@ -1023,7 +1083,8 @@ var validateGasBalances = async ({
|
|
|
1023
1083
|
getOfflineSigner: getCosmosSigner,
|
|
1024
1084
|
txIndex: i,
|
|
1025
1085
|
simulate,
|
|
1026
|
-
getCosmosPriorityFeeDenom
|
|
1086
|
+
getCosmosPriorityFeeDenom,
|
|
1087
|
+
isMultiRoutes
|
|
1027
1088
|
});
|
|
1028
1089
|
return res;
|
|
1029
1090
|
} catch (e) {
|
|
@@ -1039,6 +1100,11 @@ var validateGasBalances = async ({
|
|
|
1039
1100
|
onValidateGasBalance?.({
|
|
1040
1101
|
status: "pending"
|
|
1041
1102
|
});
|
|
1103
|
+
updateRouteDetails({
|
|
1104
|
+
status: "validating",
|
|
1105
|
+
routeId,
|
|
1106
|
+
options
|
|
1107
|
+
});
|
|
1042
1108
|
const signer = await getEvmSigner?.(tx?.evmTx?.chainId ?? "");
|
|
1043
1109
|
if (!signer) {
|
|
1044
1110
|
throw new Error(
|
|
@@ -1050,7 +1116,8 @@ var validateGasBalances = async ({
|
|
|
1050
1116
|
tx: tx.evmTx,
|
|
1051
1117
|
signer,
|
|
1052
1118
|
getFallbackGasAmount,
|
|
1053
|
-
useUnlimitedApproval
|
|
1119
|
+
useUnlimitedApproval: options?.useUnlimitedApproval,
|
|
1120
|
+
bypassApprovalCheck: options?.bypassApprovalCheck
|
|
1054
1121
|
});
|
|
1055
1122
|
return res;
|
|
1056
1123
|
} catch (e) {
|
|
@@ -1066,6 +1133,11 @@ var validateGasBalances = async ({
|
|
|
1066
1133
|
onValidateGasBalance?.({
|
|
1067
1134
|
status: "pending"
|
|
1068
1135
|
});
|
|
1136
|
+
updateRouteDetails({
|
|
1137
|
+
status: "validating",
|
|
1138
|
+
routeId,
|
|
1139
|
+
options
|
|
1140
|
+
});
|
|
1069
1141
|
try {
|
|
1070
1142
|
const res = await validateSvmGasBalance({
|
|
1071
1143
|
tx: tx.svmTx,
|
|
@@ -1100,12 +1172,35 @@ var validateGasBalances = async ({
|
|
|
1100
1172
|
ClientState.validateGasResults = validateResult;
|
|
1101
1173
|
};
|
|
1102
1174
|
|
|
1175
|
+
// src/private-functions/getChainIdsFromTxs.ts
|
|
1176
|
+
var getChainIdsFromTxs = (txs) => {
|
|
1177
|
+
return txs.map((tx) => {
|
|
1178
|
+
if ("cosmosTx" in tx) {
|
|
1179
|
+
return {
|
|
1180
|
+
chainType: "cosmos" /* Cosmos */,
|
|
1181
|
+
chainId: tx.cosmosTx?.chainId
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
if ("svmTx" in tx) {
|
|
1185
|
+
return {
|
|
1186
|
+
chainType: "svm" /* Svm */,
|
|
1187
|
+
chainId: tx.svmTx?.chainId
|
|
1188
|
+
};
|
|
1189
|
+
}
|
|
1190
|
+
if ("evmTx" in tx) {
|
|
1191
|
+
return {
|
|
1192
|
+
chainType: "evm" /* Evm */,
|
|
1193
|
+
chainId: tx.evmTx?.chainId
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1196
|
+
});
|
|
1197
|
+
};
|
|
1198
|
+
|
|
1103
1199
|
// src/private-functions/executeTransactions.ts
|
|
1104
1200
|
var executeTransactions = async (options) => {
|
|
1105
1201
|
const {
|
|
1106
1202
|
txs,
|
|
1107
1203
|
onTransactionBroadcast,
|
|
1108
|
-
onTransactionCompleted,
|
|
1109
1204
|
simulate = true,
|
|
1110
1205
|
batchSimulate = true,
|
|
1111
1206
|
getFallbackGasAmount = getDefaultFallbackGasAmount,
|
|
@@ -1113,35 +1208,34 @@ var executeTransactions = async (options) => {
|
|
|
1113
1208
|
getEvmSigner,
|
|
1114
1209
|
onValidateGasBalance,
|
|
1115
1210
|
trackTxPollingOptions,
|
|
1116
|
-
batchSignTxs = true
|
|
1211
|
+
batchSignTxs = true,
|
|
1212
|
+
routeId,
|
|
1213
|
+
isMultiRoutes
|
|
1117
1214
|
} = options;
|
|
1118
1215
|
if (txs === void 0) {
|
|
1119
1216
|
throw new Error(
|
|
1120
1217
|
"executeTransactions error: txs is undefined in executeTransactions"
|
|
1121
1218
|
);
|
|
1122
1219
|
}
|
|
1123
|
-
const chainIds = txs
|
|
1220
|
+
const chainIds = getChainIdsFromTxs(txs);
|
|
1221
|
+
const transactionDetails = txs.map((tx) => {
|
|
1124
1222
|
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
|
-
};
|
|
1223
|
+
return { chainId: tx.cosmosTx?.chainId, chainType: "cosmos" /* Cosmos */ };
|
|
1224
|
+
} else if ("evmTx" in tx) {
|
|
1225
|
+
return { chainId: tx.evmTx?.chainId, chainType: "evm" /* Evm */ };
|
|
1226
|
+
} else if ("svmTx" in tx) {
|
|
1227
|
+
return { chainId: tx.svmTx?.chainId, chainType: "svm" /* Svm */ };
|
|
1228
|
+
} else {
|
|
1229
|
+
throw new Error("executeRoute error: invalid message type");
|
|
1141
1230
|
}
|
|
1142
1231
|
});
|
|
1232
|
+
updateRouteDetails({
|
|
1233
|
+
transactionDetails,
|
|
1234
|
+
routeId,
|
|
1235
|
+
options
|
|
1236
|
+
});
|
|
1143
1237
|
const isGasStationSourceEVM = chainIds.find((item, i, array) => {
|
|
1144
|
-
return GAS_STATION_CHAIN_IDS.includes(item?.chainId ?? "") && array[i - 1]?.chainType === "evm"
|
|
1238
|
+
return GAS_STATION_CHAIN_IDS.includes(item?.chainId ?? "") && array[i - 1]?.chainType === "evm" /* Evm */;
|
|
1145
1239
|
});
|
|
1146
1240
|
ClientState.validateGasResults = void 0;
|
|
1147
1241
|
const validateChainIds = !batchSimulate ? chainIds.map((x) => x?.chainId ?? "") : isGasStationSourceEVM ? GAS_STATION_CHAIN_IDS : [];
|
|
@@ -1153,7 +1247,10 @@ var executeTransactions = async (options) => {
|
|
|
1153
1247
|
onValidateGasBalance,
|
|
1154
1248
|
simulate,
|
|
1155
1249
|
disabledChainIds: validateChainIds,
|
|
1156
|
-
getCosmosPriorityFeeDenom: options.getCosmosPriorityFeeDenom
|
|
1250
|
+
getCosmosPriorityFeeDenom: options.getCosmosPriorityFeeDenom,
|
|
1251
|
+
options,
|
|
1252
|
+
routeId,
|
|
1253
|
+
isMultiRoutes
|
|
1157
1254
|
});
|
|
1158
1255
|
const validateEnabledChainIds = async (chainId) => {
|
|
1159
1256
|
await validateGasBalances({
|
|
@@ -1164,7 +1261,10 @@ var executeTransactions = async (options) => {
|
|
|
1164
1261
|
onValidateGasBalance,
|
|
1165
1262
|
simulate,
|
|
1166
1263
|
enabledChainIds: !batchSimulate ? [chainId] : validateChainIds,
|
|
1167
|
-
getCosmosPriorityFeeDenom: options.getCosmosPriorityFeeDenom
|
|
1264
|
+
getCosmosPriorityFeeDenom: options.getCosmosPriorityFeeDenom,
|
|
1265
|
+
options,
|
|
1266
|
+
routeId,
|
|
1267
|
+
isMultiRoutes
|
|
1168
1268
|
});
|
|
1169
1269
|
};
|
|
1170
1270
|
let signedTxs = [];
|
|
@@ -1178,11 +1278,16 @@ var executeTransactions = async (options) => {
|
|
|
1178
1278
|
await validateEnabledChainIds(tx.cosmosTx?.chainId ?? "");
|
|
1179
1279
|
const isAllowedToBatchSignTxsUpfront = await (async () => {
|
|
1180
1280
|
try {
|
|
1181
|
-
const currentUserAddress = options.userAddresses.find(
|
|
1281
|
+
const currentUserAddress = options.userAddresses.find(
|
|
1282
|
+
(x) => x.chainId === tx.cosmosTx?.chainId
|
|
1283
|
+
)?.address;
|
|
1182
1284
|
if (!currentUserAddress) {
|
|
1183
1285
|
return false;
|
|
1184
1286
|
}
|
|
1185
|
-
const { accountNumber } = await getAccountNumberAndSequence(
|
|
1287
|
+
const { accountNumber } = await getAccountNumberAndSequence(
|
|
1288
|
+
currentUserAddress,
|
|
1289
|
+
tx.cosmosTx?.chainId
|
|
1290
|
+
);
|
|
1186
1291
|
if (accountNumber) {
|
|
1187
1292
|
return true;
|
|
1188
1293
|
}
|
|
@@ -1197,7 +1302,8 @@ var executeTransactions = async (options) => {
|
|
|
1197
1302
|
const signedTx = await signCosmosTransaction({
|
|
1198
1303
|
tx,
|
|
1199
1304
|
options,
|
|
1200
|
-
index: i
|
|
1305
|
+
index: i,
|
|
1306
|
+
routeId
|
|
1201
1307
|
});
|
|
1202
1308
|
signedTxs.push({
|
|
1203
1309
|
index: i,
|
|
@@ -1208,7 +1314,12 @@ var executeTransactions = async (options) => {
|
|
|
1208
1314
|
}
|
|
1209
1315
|
if ("svmTx" in tx) {
|
|
1210
1316
|
await validateEnabledChainIds(tx.svmTx?.chainId ?? "");
|
|
1211
|
-
const signedTx = await signSvmTransaction({
|
|
1317
|
+
const signedTx = await signSvmTransaction({
|
|
1318
|
+
tx,
|
|
1319
|
+
options,
|
|
1320
|
+
index: i,
|
|
1321
|
+
routeId
|
|
1322
|
+
});
|
|
1212
1323
|
if (!signedTx) {
|
|
1213
1324
|
throw new Error(`executeRoute error: signedTx is undefined`);
|
|
1214
1325
|
}
|
|
@@ -1221,13 +1332,13 @@ var executeTransactions = async (options) => {
|
|
|
1221
1332
|
}
|
|
1222
1333
|
}
|
|
1223
1334
|
}
|
|
1224
|
-
|
|
1225
|
-
const tx = txs[
|
|
1335
|
+
const executeTransaction = async (index) => {
|
|
1336
|
+
const tx = txs[index];
|
|
1226
1337
|
if (!tx) {
|
|
1227
|
-
throw new Error(`executeRoute error: invalid message at index ${
|
|
1338
|
+
throw new Error(`executeRoute error: invalid message at index ${index}`);
|
|
1228
1339
|
}
|
|
1229
1340
|
let txResult;
|
|
1230
|
-
const txSigned = signedTxs.find((item) => item.index ===
|
|
1341
|
+
const txSigned = signedTxs.find((item) => item.index === index);
|
|
1231
1342
|
if (txSigned) {
|
|
1232
1343
|
const txResponse = await submitTransaction({
|
|
1233
1344
|
chainId: txSigned.chainId,
|
|
@@ -1244,34 +1355,35 @@ var executeTransactions = async (options) => {
|
|
|
1244
1355
|
txResult = await executeCosmosTransaction({
|
|
1245
1356
|
tx,
|
|
1246
1357
|
options,
|
|
1247
|
-
index
|
|
1358
|
+
index,
|
|
1359
|
+
routeId
|
|
1248
1360
|
});
|
|
1249
1361
|
} else if ("evmTx" in tx) {
|
|
1250
1362
|
await validateEnabledChainIds(tx.evmTx?.chainId ?? "");
|
|
1251
|
-
const txResponse = await executeEvmTransaction(
|
|
1363
|
+
const txResponse = await executeEvmTransaction(
|
|
1364
|
+
tx,
|
|
1365
|
+
options,
|
|
1366
|
+
index,
|
|
1367
|
+
routeId
|
|
1368
|
+
);
|
|
1252
1369
|
txResult = {
|
|
1253
1370
|
chainId: tx?.evmTx?.chainId ?? "",
|
|
1254
1371
|
txHash: txResponse.transactionHash
|
|
1255
1372
|
};
|
|
1256
1373
|
} else if ("svmTx" in tx) {
|
|
1257
1374
|
await validateEnabledChainIds(tx.svmTx?.chainId ?? "");
|
|
1258
|
-
txResult = await executeSvmTransaction(tx, options,
|
|
1375
|
+
txResult = await executeSvmTransaction(tx, options, index, routeId);
|
|
1259
1376
|
} else {
|
|
1260
1377
|
throw new Error("executeRoute error: invalid message type");
|
|
1261
1378
|
}
|
|
1262
1379
|
}
|
|
1263
1380
|
await onTransactionBroadcast?.({ ...txResult });
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
chainId: txResult.chainId,
|
|
1271
|
-
txHash: txResult.txHash,
|
|
1272
|
-
status: txStatusResponse
|
|
1273
|
-
});
|
|
1274
|
-
}
|
|
1381
|
+
return txResult;
|
|
1382
|
+
};
|
|
1383
|
+
return {
|
|
1384
|
+
transactionDetails,
|
|
1385
|
+
executeTransaction
|
|
1386
|
+
};
|
|
1275
1387
|
};
|
|
1276
1388
|
var EVM_GAS_AMOUNT = 15e4;
|
|
1277
1389
|
var COSMOS_GAS_AMOUNT = {
|
|
@@ -1296,55 +1408,6 @@ var getDefaultFallbackGasAmount = async (chainId, chainType) => {
|
|
|
1296
1408
|
}
|
|
1297
1409
|
return defaultGasAmount;
|
|
1298
1410
|
};
|
|
1299
|
-
var executeRoute = async (options) => {
|
|
1300
|
-
const { route, userAddresses, beforeMsg, afterMsg, timeoutSeconds } = options;
|
|
1301
|
-
let addressList = [];
|
|
1302
|
-
userAddresses.forEach((userAddress, index) => {
|
|
1303
|
-
const requiredChainAddress = route.requiredChainAddresses[index];
|
|
1304
|
-
if (requiredChainAddress === userAddress?.chainId) {
|
|
1305
|
-
addressList.push(userAddress.address);
|
|
1306
|
-
}
|
|
1307
|
-
});
|
|
1308
|
-
if (addressList.length !== route.requiredChainAddresses.length) {
|
|
1309
|
-
addressList = userAddresses.map((x) => x.address);
|
|
1310
|
-
}
|
|
1311
|
-
const validLength = addressList.length === route.requiredChainAddresses.length || addressList.length === route.chainIds?.length;
|
|
1312
|
-
if (!validLength) {
|
|
1313
|
-
throw new Error("executeRoute error: invalid address list");
|
|
1314
|
-
}
|
|
1315
|
-
const isUserAddressesValid = await validateUserAddresses(userAddresses);
|
|
1316
|
-
if (!isUserAddressesValid) {
|
|
1317
|
-
throw new Error("executeRoute error: invalid user addresses");
|
|
1318
|
-
}
|
|
1319
|
-
const response = await messages({
|
|
1320
|
-
timeoutSeconds,
|
|
1321
|
-
amountIn: route?.amountIn,
|
|
1322
|
-
amountOut: route.estimatedAmountOut || "0",
|
|
1323
|
-
sourceAssetChainId: route?.sourceAssetChainId,
|
|
1324
|
-
sourceAssetDenom: route?.sourceAssetDenom,
|
|
1325
|
-
destAssetChainId: route?.destAssetChainId,
|
|
1326
|
-
destAssetDenom: route?.destAssetDenom,
|
|
1327
|
-
operations: route?.operations,
|
|
1328
|
-
addressList,
|
|
1329
|
-
slippageTolerancePercent: options.slippageTolerancePercent || "1",
|
|
1330
|
-
chainIdsToAffiliates: ApiState.chainIdsToAffiliates,
|
|
1331
|
-
postRouteHandler: options.postRouteHandler,
|
|
1332
|
-
feePayerAddress: options.svmFeePayer?.address
|
|
1333
|
-
});
|
|
1334
|
-
if (beforeMsg && (response?.txs?.length ?? 0) > 0) {
|
|
1335
|
-
const firstTx = response?.txs?.[0];
|
|
1336
|
-
if (firstTx && "cosmosTx" in firstTx) {
|
|
1337
|
-
firstTx.cosmosTx?.msgs?.unshift(beforeMsg);
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
if (afterMsg && (response?.txs?.length ?? 0) > 0) {
|
|
1341
|
-
const lastTx = response?.txs?.[response.txs.length - 1];
|
|
1342
|
-
if (lastTx && "cosmosTx" in lastTx) {
|
|
1343
|
-
lastTx.cosmosTx?.msgs?.push(afterMsg);
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
await executeTransactions({ ...options, txs: response?.txs });
|
|
1347
|
-
};
|
|
1348
1411
|
var validateUserAddresses = async (userAddresses) => {
|
|
1349
1412
|
const chains2 = await ClientState.getSkipChains();
|
|
1350
1413
|
const validations = userAddresses.map((userAddress) => {
|
|
@@ -1384,5 +1447,29 @@ var validateUserAddresses = async (userAddresses) => {
|
|
|
1384
1447
|
});
|
|
1385
1448
|
return validations.every((validation) => validation);
|
|
1386
1449
|
};
|
|
1450
|
+
var createValidAddressList = async ({
|
|
1451
|
+
userAddresses,
|
|
1452
|
+
route
|
|
1453
|
+
}) => {
|
|
1454
|
+
let addressList = [];
|
|
1455
|
+
userAddresses.forEach((userAddress, index) => {
|
|
1456
|
+
const requiredChainAddress = route.requiredChainAddresses[index];
|
|
1457
|
+
if (requiredChainAddress === userAddress?.chainId) {
|
|
1458
|
+
addressList.push(userAddress.address);
|
|
1459
|
+
}
|
|
1460
|
+
});
|
|
1461
|
+
if (addressList.length !== route.requiredChainAddresses.length) {
|
|
1462
|
+
addressList = userAddresses.map((x) => x.address);
|
|
1463
|
+
}
|
|
1464
|
+
const validLength = addressList.length === route.requiredChainAddresses.length || addressList.length === route.chainIds?.length;
|
|
1465
|
+
if (!validLength) {
|
|
1466
|
+
throw new Error("createValidAddressList error: invalid address list");
|
|
1467
|
+
}
|
|
1468
|
+
const isUserAddressesValid = await validateUserAddresses(userAddresses);
|
|
1469
|
+
if (!isUserAddressesValid) {
|
|
1470
|
+
throw new Error("createValidAddressList error: invalid user addresses");
|
|
1471
|
+
}
|
|
1472
|
+
return addressList;
|
|
1473
|
+
};
|
|
1387
1474
|
|
|
1388
|
-
export {
|
|
1475
|
+
export { createValidAddressList, executeTransactions };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { trackTransaction } from './chunk-
|
|
2
|
-
import { transactionStatus } from './chunk-
|
|
3
|
-
import { wait } from './chunk-
|
|
1
|
+
import { trackTransaction } from './chunk-7X4ERB3R.js';
|
|
2
|
+
import { transactionStatus } from './chunk-APRMN34M.js';
|
|
3
|
+
import { wait } from './chunk-A6KSECAH.js';
|
|
4
4
|
|
|
5
5
|
// src/public-functions/waitForTransaction.ts
|
|
6
6
|
var waitForTransaction = async ({
|