@skip-go/client 1.5.3-alpha.1 → 1.5.3
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 +1 -1
- package/dist/cjs/api/getAssetsBetweenChains.cjs +1 -1
- package/dist/cjs/api/getBridges.cjs +1 -1
- package/dist/cjs/api/getChains.cjs +1 -1
- package/dist/cjs/api/getVenues.cjs +1 -1
- package/dist/cjs/api/postAssetsFromSource.cjs +1 -1
- package/dist/cjs/api/postBalances.cjs +1 -1
- package/dist/cjs/api/postIbcOriginAssets.cjs +1 -1
- package/dist/cjs/api/postMessages.cjs +1 -1
- package/dist/cjs/api/postMessagesDirect.cjs +1 -1
- package/dist/cjs/api/postRecommendAssets.cjs +1 -1
- package/dist/cjs/api/postRoute.cjs +1 -1
- package/dist/cjs/api/postSubmitTransaction.cjs +1 -1
- package/dist/cjs/api/postTrackTransaction.cjs +1 -1
- package/dist/cjs/api/postTransactionStatus.cjs +1 -1
- package/dist/cjs/chunk-3UPZIINE.cjs +454 -0
- package/dist/cjs/chunk-4RLEZ5DV.cjs +55 -0
- package/dist/cjs/{chunk-KM2D7PJL.cjs → chunk-4TBONPD6.cjs} +33 -33
- package/dist/cjs/{chunk-WKYP2NMS.cjs → chunk-6W2OIU3O.cjs} +15 -15
- package/dist/cjs/{chunk-I2FDWZZJ.cjs → chunk-BFA7XKVT.cjs} +64 -765
- package/dist/cjs/chunk-BT6HQNBF.cjs +214 -0
- package/dist/cjs/{chunk-APJDSXWR.cjs → chunk-DAPPFYGA.cjs} +8 -8
- package/dist/cjs/{chunk-RC73RNNQ.cjs → chunk-GOQK63JP.cjs} +4 -4
- package/dist/cjs/chunk-KZOSEIWH.cjs +10 -0
- package/dist/cjs/{chunk-3M7YYWGL.cjs → chunk-MUJBB64F.cjs} +3 -7
- package/dist/cjs/{chunk-NWD4MAMT.cjs → chunk-ND7SYSAP.cjs} +2 -8
- package/dist/cjs/{chunk-DWOE6N5S.cjs → chunk-NM4PISTQ.cjs} +189 -188
- package/dist/cjs/{chunk-PDTIT3JO.cjs → chunk-QWQVTCKP.cjs} +12 -12
- package/dist/cjs/{chunk-XCFPRLX3.cjs → chunk-U2NZCNKX.cjs} +153 -153
- package/dist/cjs/{chunk-DLT6Q6RB.cjs → chunk-WOSAJSJB.cjs} +163 -149
- package/dist/cjs/index.cjs +83 -79
- package/dist/cjs/public-functions/executeMultipleRoutes.cjs +11 -21
- package/dist/cjs/public-functions/executeRoute.cjs +11 -21
- package/dist/cjs/public-functions/getCosmosGasAmountForMessage.cjs +5 -5
- package/dist/cjs/public-functions/getEvmGasAmountForMessage.cjs +1 -1
- package/dist/cjs/public-functions/getFeeInfoForChain.cjs +4 -3
- package/dist/cjs/public-functions/getRecommendedGasPrice.cjs +6 -5
- package/dist/cjs/public-functions/getRouteWithGasOnReceive.cjs +17 -13
- package/dist/cjs/public-functions/getSigningStargateClient.cjs +4 -4
- package/dist/cjs/public-functions/setApiOptions.cjs +1 -1
- package/dist/cjs/public-functions/setClientOptions.cjs +5 -5
- package/dist/cjs/public-functions/subscribeToRouteStatus.cjs +1 -1
- package/dist/cjs/public-functions/validateCosmosGasBalance.cjs +8 -8
- package/dist/cjs/public-functions/waitForTransaction.cjs +1 -1
- package/dist/esm/api/getAssets.d.ts +1 -1
- package/dist/esm/api/getAssets.js +1 -1
- package/dist/esm/api/getAssetsBetweenChains.d.ts +1 -1
- package/dist/esm/api/getAssetsBetweenChains.js +1 -1
- package/dist/esm/api/getBridges.d.ts +1 -1
- package/dist/esm/api/getBridges.js +1 -1
- package/dist/esm/api/getChains.d.ts +1 -1
- package/dist/esm/api/getChains.js +1 -1
- package/dist/esm/api/getVenues.js +1 -1
- package/dist/esm/api/postAssetsFromSource.d.ts +1 -1
- package/dist/esm/api/postAssetsFromSource.js +1 -1
- package/dist/esm/api/postBalances.d.ts +2 -2
- package/dist/esm/api/postBalances.js +1 -1
- package/dist/esm/api/postIbcOriginAssets.js +1 -1
- package/dist/esm/api/postMessages.d.ts +2 -2
- package/dist/esm/api/postMessages.js +1 -1
- package/dist/esm/api/postMessagesDirect.d.ts +1 -1
- package/dist/esm/api/postMessagesDirect.js +1 -1
- package/dist/esm/api/postRecommendAssets.d.ts +1 -1
- package/dist/esm/api/postRecommendAssets.js +1 -1
- package/dist/esm/api/postRoute.d.ts +2 -2
- package/dist/esm/api/postRoute.js +1 -1
- package/dist/esm/api/postSubmitTransaction.d.ts +2 -2
- package/dist/esm/api/postSubmitTransaction.js +1 -1
- package/dist/esm/api/postTrackTransaction.d.ts +2 -2
- package/dist/esm/api/postTrackTransaction.js +1 -1
- package/dist/esm/api/postTransactionStatus.d.ts +2 -2
- package/dist/esm/api/postTransactionStatus.js +1 -1
- package/dist/esm/{callbacks-C-KUJnDv.d.ts → callbacks-CJ_p70xa.d.ts} +3 -3
- package/dist/esm/chunk-426BGQ4K.js +431 -0
- package/dist/esm/chunk-BBEFB277.js +53 -0
- package/dist/esm/{chunk-UIDIKXMB.js → chunk-F2LQB2DP.js} +6 -5
- package/dist/esm/{chunk-KNXMSLOB.js → chunk-GLH7IRLX.js} +2 -2
- package/dist/esm/{chunk-2PWROHHX.js → chunk-GLM7QWYT.js} +1 -1
- package/dist/esm/{chunk-SFWTQBQT.js → chunk-H2TTIB5K.js} +3 -3
- package/dist/esm/{chunk-QL423UEF.js → chunk-HP5EMWC6.js} +163 -149
- package/dist/esm/{chunk-V7VKYD4J.js → chunk-HZVXNDMH.js} +2 -2
- package/dist/esm/{chunk-JYYCFKB4.js → chunk-KS764SOZ.js} +15 -15
- package/dist/esm/{chunk-IKWC55JU.js → chunk-L233BZ4I.js} +59 -738
- package/dist/esm/{chunk-6M7N6EAO.js → chunk-LBS7KX5I.js} +12 -12
- package/dist/esm/{chunk-QRKO56DH.js → chunk-QYIZGNWZ.js} +2 -7
- package/dist/esm/{chunk-QO2CYYF5.js → chunk-RTDD7HZ3.js} +4 -7
- package/dist/esm/chunk-SA4GETWP.js +212 -0
- package/dist/esm/chunk-SWYON2RG.js +7 -0
- package/dist/esm/{client-types-CGMuZ3zo.d.ts → client-types-uXKJQRqe.d.ts} +1 -1
- package/dist/esm/{generateApi-D_-Gso-x.d.ts → generateApi-BMFrG4FZ.d.ts} +1 -1
- package/dist/esm/index.d.ts +260 -259
- package/dist/esm/index.js +16 -12
- package/dist/esm/public-functions/executeMultipleRoutes.d.ts +4 -4
- package/dist/esm/public-functions/executeMultipleRoutes.js +10 -20
- package/dist/esm/public-functions/executeRoute.d.ts +4 -4
- package/dist/esm/public-functions/executeRoute.js +10 -20
- package/dist/esm/public-functions/getCosmosGasAmountForMessage.d.ts +1 -1
- package/dist/esm/public-functions/getCosmosGasAmountForMessage.js +3 -3
- package/dist/esm/public-functions/getEvmGasAmountForMessage.d.ts +3 -3
- package/dist/esm/public-functions/getEvmGasAmountForMessage.js +1 -1
- package/dist/esm/public-functions/getFeeInfoForChain.d.ts +1 -1
- package/dist/esm/public-functions/getFeeInfoForChain.js +3 -2
- package/dist/esm/public-functions/getRecommendedGasPrice.js +5 -4
- package/dist/esm/public-functions/getRouteWithGasOnReceive.d.ts +1 -1
- package/dist/esm/public-functions/getRouteWithGasOnReceive.js +16 -12
- package/dist/esm/public-functions/getSigningStargateClient.js +3 -3
- package/dist/esm/public-functions/setApiOptions.d.ts +1 -1
- package/dist/esm/public-functions/setApiOptions.js +1 -1
- package/dist/esm/public-functions/setClientOptions.d.ts +4 -4
- package/dist/esm/public-functions/setClientOptions.js +4 -4
- package/dist/esm/public-functions/subscribeToRouteStatus.d.ts +4 -4
- package/dist/esm/public-functions/subscribeToRouteStatus.js +1 -1
- package/dist/esm/public-functions/validateCosmosGasBalance.d.ts +4 -4
- package/dist/esm/public-functions/validateCosmosGasBalance.js +7 -7
- package/dist/esm/public-functions/waitForTransaction.d.ts +4 -4
- package/dist/esm/public-functions/waitForTransaction.js +1 -1
- package/dist/esm/{setClientOptions-C8g92xTm.d.ts → setClientOptions-D1qgaOqC.d.ts} +3 -3
- package/dist/esm/{swaggerTypes-B_jKfpvz.d.ts → swaggerTypes-Cop47I0X.d.ts} +257 -255
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MsgUpdateSignatureThreshold, MsgSetMaxBurnAmountPerMessage, MsgUpdateMaxMessageBodySize, MsgUpdatePauser, MsgUpdateTokenController, MsgUpdateAttesterManager, MsgUpdateOwner, MsgUnpauseSendingAndReceivingMessages, MsgUnpauseBurningAndMinting, MsgUnlinkTokenPair, MsgSendMessageWithCaller, MsgSendMessage, MsgReplaceMessage, MsgReplaceDepositForBurn, MsgRemoveRemoteTokenMessenger, MsgReceiveMessage, MsgPauseSendingAndReceivingMessages, MsgPauseBurningAndMinting, MsgLinkTokenPair, MsgEnableAttester, MsgDisableAttester, MsgDepositForBurnWithCaller, MsgDepositForBurn, MsgAddRemoteTokenMessenger, MsgAcceptOwner, MsgExecute, MsgInitiateTokenDeposit, Coin, Timestamp, Period } from './chunk-
|
|
2
|
-
import { isSet, Long, toTimestamp, fromTimestamp, fromJsonTimestamp
|
|
1
|
+
import { MsgUpdateSignatureThreshold, MsgSetMaxBurnAmountPerMessage, MsgUpdateMaxMessageBodySize, MsgUpdatePauser, MsgUpdateTokenController, MsgUpdateAttesterManager, MsgUpdateOwner, MsgUnpauseSendingAndReceivingMessages, MsgUnpauseBurningAndMinting, MsgUnlinkTokenPair, MsgSendMessageWithCaller, MsgSendMessage, MsgReplaceMessage, MsgReplaceDepositForBurn, MsgRemoveRemoteTokenMessenger, MsgReceiveMessage, MsgPauseSendingAndReceivingMessages, MsgPauseBurningAndMinting, MsgLinkTokenPair, MsgEnableAttester, MsgDisableAttester, MsgDepositForBurnWithCaller, MsgDepositForBurn, MsgAddRemoteTokenMessenger, MsgAcceptOwner, MsgExecute, MsgInitiateTokenDeposit, Coin, Timestamp, Period } from './chunk-F2LQB2DP.js';
|
|
2
|
+
import { isSet, Long, toTimestamp, fromTimestamp, fromJsonTimestamp } from './chunk-RTDD7HZ3.js';
|
|
3
3
|
import { ClientState } from './chunk-MYGJGC62.js';
|
|
4
4
|
import { createRequestClient, ApiState } from './chunk-VGCTTJO7.js';
|
|
5
5
|
import { AminoTypes, createDefaultAminoConverters, defaultRegistryTypes } from '@cosmjs/stargate';
|
|
@@ -642,9 +642,9 @@ var InflationDistribution = {
|
|
|
642
642
|
},
|
|
643
643
|
toAmino(message) {
|
|
644
644
|
const obj = {};
|
|
645
|
-
obj.staking_rewards =
|
|
646
|
-
obj.usage_incentives =
|
|
647
|
-
obj.community_pool =
|
|
645
|
+
obj.staking_rewards = message.stakingRewards === "" ? void 0 : Decimal.fromUserInput(message.stakingRewards, 18).atomics;
|
|
646
|
+
obj.usage_incentives = message.usageIncentives === "" ? void 0 : Decimal.fromUserInput(message.usageIncentives, 18).atomics;
|
|
647
|
+
obj.community_pool = message.communityPool === "" ? void 0 : Decimal.fromUserInput(message.communityPool, 18).atomics;
|
|
648
648
|
return obj;
|
|
649
649
|
},
|
|
650
650
|
fromAminoMsg(object) {
|
|
@@ -775,11 +775,11 @@ var ExponentialCalculation = {
|
|
|
775
775
|
},
|
|
776
776
|
toAmino(message) {
|
|
777
777
|
const obj = {};
|
|
778
|
-
obj.a =
|
|
779
|
-
obj.r =
|
|
780
|
-
obj.c =
|
|
781
|
-
obj.bonding_target =
|
|
782
|
-
obj.max_variance =
|
|
778
|
+
obj.a = message.a === "" ? void 0 : Decimal.fromUserInput(message.a, 18).atomics;
|
|
779
|
+
obj.r = message.r === "" ? void 0 : Decimal.fromUserInput(message.r, 18).atomics;
|
|
780
|
+
obj.c = message.c === "" ? void 0 : Decimal.fromUserInput(message.c, 18).atomics;
|
|
781
|
+
obj.bonding_target = message.bondingTarget === "" ? void 0 : Decimal.fromUserInput(message.bondingTarget, 18).atomics;
|
|
782
|
+
obj.max_variance = message.maxVariance === "" ? void 0 : Decimal.fromUserInput(message.maxVariance, 18).atomics;
|
|
783
783
|
return obj;
|
|
784
784
|
},
|
|
785
785
|
fromAminoMsg(object) {
|
|
@@ -1102,8 +1102,8 @@ var Params3 = {
|
|
|
1102
1102
|
toAmino(message) {
|
|
1103
1103
|
const obj = {};
|
|
1104
1104
|
obj.enable_revenue = message.enableRevenue === false ? void 0 : message.enableRevenue;
|
|
1105
|
-
obj.developer_shares =
|
|
1106
|
-
obj.addr_derivation_cost_create = !message.addrDerivationCostCreate.isZero() ? message.addrDerivationCostCreate
|
|
1105
|
+
obj.developer_shares = message.developerShares === "" ? void 0 : Decimal.fromUserInput(message.developerShares, 18).atomics;
|
|
1106
|
+
obj.addr_derivation_cost_create = !message.addrDerivationCostCreate.isZero() ? message.addrDerivationCostCreate?.toString() : void 0;
|
|
1107
1107
|
return obj;
|
|
1108
1108
|
},
|
|
1109
1109
|
fromAminoMsg(object) {
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
+
import { DEFAULT_GAS_DENOM_OVERRIDES } from './chunk-SWYON2RG.js';
|
|
1
2
|
import { chains } from './chunk-O4J7DHZA.js';
|
|
2
3
|
import { ClientState } from './chunk-MYGJGC62.js';
|
|
3
4
|
|
|
4
|
-
// src/constants/constants.ts
|
|
5
|
-
var DEFAULT_GAS_DENOM_OVERRIDES = {
|
|
6
|
-
"noble-1": "uusdc"
|
|
7
|
-
};
|
|
8
|
-
var GAS_STATION_CHAIN_IDS = ["bbn-test-5", "bbn-1"];
|
|
9
|
-
|
|
10
5
|
// src/private-functions/getDefaultGasTokenForChain.ts
|
|
11
6
|
var getDefaultGasTokenForChain = async (chainId) => {
|
|
12
7
|
const gasDenom = DEFAULT_GAS_DENOM_OVERRIDES[chainId];
|
|
@@ -95,4 +90,4 @@ var getFeeInfoForChain = async ({ chainId, apiUrl, apiKey }) => {
|
|
|
95
90
|
};
|
|
96
91
|
};
|
|
97
92
|
|
|
98
|
-
export {
|
|
93
|
+
export { getFeeInfoForChain };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _m0 from 'protobufjs/minimal.js';
|
|
2
2
|
import Long from 'long';
|
|
3
3
|
export { default as Long } from 'long';
|
|
4
|
-
import
|
|
4
|
+
import '@keplr-wallet/unit';
|
|
5
5
|
|
|
6
6
|
// src/codegen/helpers.ts
|
|
7
7
|
if (_m0.util.Long !== Long) {
|
|
@@ -66,9 +66,6 @@ function fromJsonTimestamp(o) {
|
|
|
66
66
|
function numberToLong(number) {
|
|
67
67
|
return Long.fromNumber(number);
|
|
68
68
|
}
|
|
69
|
-
function padDecimal(decStr) {
|
|
70
|
-
return decStr ? new Dec(decStr).toString() : decStr;
|
|
71
|
-
}
|
|
72
69
|
function createBaseAny() {
|
|
73
70
|
return {
|
|
74
71
|
$typeUrl: "/google.protobuf.Any",
|
|
@@ -248,8 +245,8 @@ var BaseAccount = {
|
|
|
248
245
|
const obj = {};
|
|
249
246
|
obj.address = message.address === "" ? void 0 : message.address;
|
|
250
247
|
obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : void 0;
|
|
251
|
-
obj.account_number = !message.accountNumber.isZero() ? message.accountNumber
|
|
252
|
-
obj.sequence = !message.sequence.isZero() ? message.sequence
|
|
248
|
+
obj.account_number = !message.accountNumber.isZero() ? message.accountNumber?.toString() : void 0;
|
|
249
|
+
obj.sequence = !message.sequence.isZero() ? message.sequence?.toString() : void 0;
|
|
253
250
|
return obj;
|
|
254
251
|
},
|
|
255
252
|
fromAminoMsg(object) {
|
|
@@ -275,4 +272,4 @@ var BaseAccount = {
|
|
|
275
272
|
}
|
|
276
273
|
};
|
|
277
274
|
|
|
278
|
-
export { BaseAccount, base64FromBytes, bytesFromBase64, fromJsonTimestamp, fromTimestamp, isSet,
|
|
275
|
+
export { BaseAccount, base64FromBytes, bytesFromBase64, fromJsonTimestamp, fromTimestamp, isSet, toTimestamp };
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { createValidAddressList, executeTransactions } from './chunk-L233BZ4I.js';
|
|
2
|
+
import { updateRouteDetails, executeAndSubscribeToRouteStatus } from './chunk-5IXH2QPF.js';
|
|
3
|
+
import { messages } from './chunk-IHSSWY3M.js';
|
|
4
|
+
import { trackTransaction } from './chunk-AUNRER4I.js';
|
|
5
|
+
import { ApiState } from './chunk-VGCTTJO7.js';
|
|
6
|
+
|
|
7
|
+
// src/public-functions/executeMultipleRoutes.ts
|
|
8
|
+
var executeMultipleRoutes = async (options) => {
|
|
9
|
+
const {
|
|
10
|
+
route,
|
|
11
|
+
userAddresses,
|
|
12
|
+
appendCosmosMsgs,
|
|
13
|
+
postRouteHandler,
|
|
14
|
+
slippageTolerancePercent,
|
|
15
|
+
...restOptions
|
|
16
|
+
} = options;
|
|
17
|
+
const addressList = {};
|
|
18
|
+
for (const [routeKey, routeValue] of Object.entries(route)) {
|
|
19
|
+
const _userAddresses = userAddresses[routeKey];
|
|
20
|
+
if (_userAddresses === void 0) {
|
|
21
|
+
throw new Error(
|
|
22
|
+
`executeMultipleRoutes error: no user addresses found for route: ${routeKey}`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
const routeAddressList = await createValidAddressList({
|
|
26
|
+
userAddresses: _userAddresses,
|
|
27
|
+
route: routeValue
|
|
28
|
+
});
|
|
29
|
+
addressList[routeKey] = routeAddressList;
|
|
30
|
+
}
|
|
31
|
+
const msgsResponses = await Promise.all(
|
|
32
|
+
Object.entries(route).map(async ([routeKey, routeValue]) => {
|
|
33
|
+
const routeAddressList = addressList[routeKey];
|
|
34
|
+
if (routeAddressList === void 0) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
`executeMultipleRoutes error: address list not found for route ${routeKey}`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return await messages({
|
|
40
|
+
timeoutSeconds: options.timeoutSeconds,
|
|
41
|
+
amountIn: routeValue?.amountIn,
|
|
42
|
+
amountOut: routeValue.estimatedAmountOut || "0",
|
|
43
|
+
sourceAssetChainId: routeValue?.sourceAssetChainId,
|
|
44
|
+
sourceAssetDenom: routeValue?.sourceAssetDenom,
|
|
45
|
+
destAssetChainId: routeValue?.destAssetChainId,
|
|
46
|
+
destAssetDenom: routeValue?.destAssetDenom,
|
|
47
|
+
operations: routeValue?.operations,
|
|
48
|
+
addressList: routeAddressList,
|
|
49
|
+
slippageTolerancePercent: slippageTolerancePercent?.[routeKey] || "1",
|
|
50
|
+
chainIdsToAffiliates: ApiState.chainIdsToAffiliates,
|
|
51
|
+
postRouteHandler: postRouteHandler?.[routeKey],
|
|
52
|
+
feePayerAddress: options.svmFeePayer?.address
|
|
53
|
+
});
|
|
54
|
+
})
|
|
55
|
+
);
|
|
56
|
+
let msgsRecord = {};
|
|
57
|
+
msgsResponses.forEach((msg, index2) => {
|
|
58
|
+
const routeKey = Object.keys(route)[index2];
|
|
59
|
+
if (!routeKey) {
|
|
60
|
+
throw new Error(
|
|
61
|
+
`executeMultipleRoutes error: route key not found for index ${index2}`
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
const addedCosmosMsgs = appendCosmosMsgs?.[routeKey];
|
|
65
|
+
if (addedCosmosMsgs) {
|
|
66
|
+
Object.entries(addedCosmosMsgs).forEach(([chainId, msgs]) => {
|
|
67
|
+
const txIndex = msg?.txs?.findIndex(
|
|
68
|
+
(tx2) => "cosmosTx" in tx2 && tx2.cosmosTx.chainId === chainId
|
|
69
|
+
);
|
|
70
|
+
if (txIndex === void 0 || txIndex === -1) return;
|
|
71
|
+
const tx = msg?.txs?.[txIndex];
|
|
72
|
+
if (tx && "cosmosTx" in tx) {
|
|
73
|
+
tx.cosmosTx.msgs?.unshift(...msgs);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
msgsRecord[routeKey] = msg;
|
|
78
|
+
});
|
|
79
|
+
let transferIndexToRouteKey = void 0;
|
|
80
|
+
const cosmosTxIndex0Map = /* @__PURE__ */ new Map();
|
|
81
|
+
let transferIndex = 0;
|
|
82
|
+
for (const [routeKey, msgs] of Object.entries(msgsRecord)) {
|
|
83
|
+
const firstTx = msgs?.txs?.[0];
|
|
84
|
+
if (firstTx && "cosmosTx" in firstTx) {
|
|
85
|
+
const { chainId, msgs: firstTxMsgs } = firstTx.cosmosTx;
|
|
86
|
+
if (!transferIndexToRouteKey) {
|
|
87
|
+
transferIndexToRouteKey = {};
|
|
88
|
+
}
|
|
89
|
+
transferIndexToRouteKey[transferIndex] = routeKey;
|
|
90
|
+
transferIndex++;
|
|
91
|
+
if (!cosmosTxIndex0Map.has(chainId)) {
|
|
92
|
+
cosmosTxIndex0Map.set(chainId, {
|
|
93
|
+
routeKey,
|
|
94
|
+
firstCosmosTx: firstTx.cosmosTx
|
|
95
|
+
});
|
|
96
|
+
} else {
|
|
97
|
+
const existing = cosmosTxIndex0Map.get(chainId);
|
|
98
|
+
if (existing && firstTxMsgs) {
|
|
99
|
+
const modifyTarget = msgsRecord[existing.routeKey]?.txs?.[0];
|
|
100
|
+
if (modifyTarget && "cosmosTx" in modifyTarget) {
|
|
101
|
+
modifyTarget.cosmosTx.msgs?.push(...firstTxMsgs);
|
|
102
|
+
msgsRecord[routeKey]?.txs?.shift();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
Object.entries(msgsRecord).forEach(([routeKey, msgs]) => {
|
|
109
|
+
if (msgs?.txs?.length === 0) {
|
|
110
|
+
delete msgsRecord[routeKey];
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
let mainRouteId = void 0;
|
|
114
|
+
let msgsRecordIndexToRouteId = {};
|
|
115
|
+
let index = 0;
|
|
116
|
+
const transactionDetailsList = {};
|
|
117
|
+
const executeTransactionList = {};
|
|
118
|
+
const mergedMainAndSecondaryRoutes = Object.entries(msgsRecord).length !== Object.entries(route).length;
|
|
119
|
+
for (const [routeKey, msgsResponse] of Object.entries(msgsRecord)) {
|
|
120
|
+
const { id: routeId } = updateRouteDetails({
|
|
121
|
+
status: "unconfirmed",
|
|
122
|
+
options: {
|
|
123
|
+
route: route[routeKey],
|
|
124
|
+
...restOptions
|
|
125
|
+
},
|
|
126
|
+
mainRouteId,
|
|
127
|
+
transferIndexToRouteKey
|
|
128
|
+
});
|
|
129
|
+
msgsRecordIndexToRouteId[index] = routeId;
|
|
130
|
+
if (routeKey === "mainRoute") {
|
|
131
|
+
mainRouteId = routeId;
|
|
132
|
+
}
|
|
133
|
+
const { transactionDetails, executeTransaction: _executeTransaction } = await executeTransactions({
|
|
134
|
+
...restOptions,
|
|
135
|
+
routeId,
|
|
136
|
+
txs: msgsResponse?.txs,
|
|
137
|
+
route: route[routeKey],
|
|
138
|
+
userAddresses: userAddresses[routeKey],
|
|
139
|
+
isMultiRoutes: true
|
|
140
|
+
});
|
|
141
|
+
const executeTransaction = async (index2) => {
|
|
142
|
+
const txResult = await _executeTransaction(index2);
|
|
143
|
+
if (routeKey !== "mainRoute" || mergedMainAndSecondaryRoutes) {
|
|
144
|
+
const relatedRoutes = Object.entries(route).filter(([key]) => key !== "mainRoute").map(([key, route2]) => ({ route: route2, routeKey: key, status: "pending" }));
|
|
145
|
+
updateRouteDetails({
|
|
146
|
+
options: {
|
|
147
|
+
route: route[routeKey],
|
|
148
|
+
...restOptions
|
|
149
|
+
},
|
|
150
|
+
routeId: mainRouteId,
|
|
151
|
+
transferIndexToRouteKey,
|
|
152
|
+
relatedRoutes
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return txResult;
|
|
156
|
+
};
|
|
157
|
+
if (transactionDetails[0]?.chainType === "evm" /* Evm */) {
|
|
158
|
+
for (const [index2, transactionDetail] of transactionDetails.entries()) {
|
|
159
|
+
const txResult = await executeTransaction(index2);
|
|
160
|
+
if (txResult.txHash) {
|
|
161
|
+
const trackResponse = await trackTransaction({
|
|
162
|
+
chainId: transactionDetail.chainId,
|
|
163
|
+
txHash: txResult.txHash,
|
|
164
|
+
...options.trackTxPollingOptions
|
|
165
|
+
});
|
|
166
|
+
await options?.onTransactionTracked?.({
|
|
167
|
+
txHash: txResult.txHash,
|
|
168
|
+
chainId: transactionDetail.chainId,
|
|
169
|
+
explorerLink: trackResponse.explorerLink
|
|
170
|
+
});
|
|
171
|
+
transactionDetail.txHash = txResult.txHash;
|
|
172
|
+
transactionDetail.explorerLink = trackResponse.explorerLink;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
executeTransactionList[index] = executeTransaction;
|
|
177
|
+
}
|
|
178
|
+
transactionDetailsList[index] = transactionDetails;
|
|
179
|
+
index++;
|
|
180
|
+
}
|
|
181
|
+
await Promise.all(
|
|
182
|
+
Object.entries(msgsRecord).map(([routeKey, msgsResponse], index2) => {
|
|
183
|
+
return executeAndSubscribeToRouteStatus({
|
|
184
|
+
transactionDetails: transactionDetailsList[index2],
|
|
185
|
+
executeTransaction: executeTransactionList[index2],
|
|
186
|
+
routeId: msgsRecordIndexToRouteId[index2],
|
|
187
|
+
options: {
|
|
188
|
+
route: route[routeKey],
|
|
189
|
+
userAddresses: userAddresses[routeKey],
|
|
190
|
+
...restOptions,
|
|
191
|
+
onRouteStatusUpdated: (routeStatus) => {
|
|
192
|
+
const relatedRoutes = Object.entries(route).filter(([key]) => key !== "mainRoute").map(([key, route2]) => ({ route: route2, routeKey: key, status: routeStatus.status }));
|
|
193
|
+
if (routeKey !== "mainRoute") {
|
|
194
|
+
updateRouteDetails({
|
|
195
|
+
options: {
|
|
196
|
+
route: route[routeKey],
|
|
197
|
+
...restOptions
|
|
198
|
+
},
|
|
199
|
+
routeId: mainRouteId,
|
|
200
|
+
transferIndexToRouteKey,
|
|
201
|
+
relatedRoutes
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
options.onRouteStatusUpdated?.(routeStatus);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
})
|
|
209
|
+
);
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
export { executeMultipleRoutes };
|
|
@@ -3,7 +3,7 @@ import { OfflineDirectSigner } from '@cosmjs/proto-signing';
|
|
|
3
3
|
import { GasPrice, StdFee, SignerData } from '@cosmjs/stargate';
|
|
4
4
|
import { WalletClient } from 'viem';
|
|
5
5
|
import { Adapter } from '@solana/wallet-adapter-base';
|
|
6
|
-
import {
|
|
6
|
+
import { e as ChainType, af as FeeAsset, a6 as CosmosMsg } from './swaggerTypes-Cop47I0X.js';
|
|
7
7
|
import { TrackTxPollingProps } from './api/postTrackTransaction.js';
|
|
8
8
|
|
|
9
9
|
/** Common Types */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bI as Api } from './swaggerTypes-
|
|
1
|
+
import { bI as Api } from './swaggerTypes-Cop47I0X.js';
|
|
2
2
|
|
|
3
3
|
type CamelKey<S extends string> = S extends `${infer T}_${infer U}` ? `${T}${Capitalize<CamelKey<U>>}` : S;
|
|
4
4
|
type Camel<T> = T extends (infer U)[] ? Camel<U>[] : T extends object ? {
|