@skip-go/client 1.5.2 → 1.5.3-alpha.1

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.
Files changed (151) hide show
  1. package/dist/cjs/api/getAssets.cjs +5 -5
  2. package/dist/cjs/api/getAssetsBetweenChains.cjs +4 -4
  3. package/dist/cjs/api/getBridges.cjs +4 -4
  4. package/dist/cjs/api/getChains.cjs +4 -4
  5. package/dist/cjs/api/getVenues.cjs +4 -4
  6. package/dist/cjs/api/postAssetsFromSource.cjs +5 -5
  7. package/dist/cjs/api/postBalances.cjs +4 -4
  8. package/dist/cjs/api/postIbcOriginAssets.cjs +4 -4
  9. package/dist/cjs/api/postMessages.cjs +4 -4
  10. package/dist/cjs/api/postMessagesDirect.cjs +4 -4
  11. package/dist/cjs/api/postRecommendAssets.cjs +4 -4
  12. package/dist/cjs/api/postRoute.cjs +4 -4
  13. package/dist/cjs/api/postSubmitTransaction.cjs +4 -4
  14. package/dist/cjs/api/postTrackTransaction.cjs +4 -4
  15. package/dist/cjs/api/postTransactionStatus.cjs +4 -4
  16. package/dist/cjs/{chunk-EI4ZWAEU.cjs → chunk-262HFM6V.cjs} +2 -2
  17. package/dist/cjs/{chunk-XPQRSO4J.cjs → chunk-3NHW3XWK.cjs} +2 -2
  18. package/dist/cjs/{chunk-XEBVLUYW.cjs → chunk-4MV4GLIA.cjs} +2 -2
  19. package/dist/cjs/{chunk-MHVCR4QO.cjs → chunk-4NGHNHAS.cjs} +6 -6
  20. package/dist/cjs/{chunk-3IWLZ562.cjs → chunk-7SZZBUBD.cjs} +3 -3
  21. package/dist/cjs/{chunk-LARLMUFZ.cjs → chunk-APJDSXWR.cjs} +10 -10
  22. package/dist/cjs/{chunk-R3TSJPKH.cjs → chunk-AW6IQ7JH.cjs} +2 -2
  23. package/dist/cjs/{chunk-7D433NQ5.cjs → chunk-BCX2D6TE.cjs} +91 -18
  24. package/dist/cjs/{chunk-JUKPQLLQ.cjs → chunk-FF5UWES6.cjs} +4 -4
  25. package/dist/cjs/{chunk-MMGVGXA5.cjs → chunk-HFEMNOJS.cjs} +7 -1
  26. package/dist/cjs/{chunk-HEYFLFKD.cjs → chunk-I2FDWZZJ.cjs} +810 -109
  27. package/dist/cjs/{chunk-MFJ6S6TL.cjs → chunk-JWWJIJUE.cjs} +2 -2
  28. package/dist/cjs/{chunk-5RP766TT.cjs → chunk-KWH6S7PB.cjs} +6 -6
  29. package/dist/cjs/{chunk-GO4BJ6G2.cjs → chunk-NWD4MAMT.cjs} +14 -8
  30. package/dist/cjs/{chunk-66VIHDGM.cjs → chunk-PDTIT3JO.cjs} +13 -13
  31. package/dist/cjs/{chunk-2MAYN27U.cjs → chunk-PLO5CVGN.cjs} +2 -2
  32. package/dist/cjs/{chunk-5HZLL5KD.cjs → chunk-QAHHTQ7V.cjs} +4 -4
  33. package/dist/cjs/{chunk-AJYZ5GAD.cjs → chunk-RBM66GW6.cjs} +2 -2
  34. package/dist/cjs/{chunk-ULD54VE4.cjs → chunk-RC73RNNQ.cjs} +4 -4
  35. package/dist/cjs/{chunk-N2RG3CRN.cjs → chunk-S3BKLN4L.cjs} +2 -2
  36. package/dist/cjs/{chunk-KPV3PGBG.cjs → chunk-T5EGKQAT.cjs} +2 -2
  37. package/dist/cjs/chunk-UMBMSRZZ.cjs +185 -0
  38. package/dist/cjs/{chunk-4R6OCWRR.cjs → chunk-WKYP2NMS.cjs} +8 -6
  39. package/dist/cjs/{chunk-VMWCRZVT.cjs → chunk-XCFPRLX3.cjs} +8 -8
  40. package/dist/cjs/{chunk-XDKONUY6.cjs → chunk-ZBJZTBIW.cjs} +2 -2
  41. package/dist/cjs/index.cjs +189 -251
  42. package/dist/cjs/public-functions/executeMultipleRoutes.cjs +27 -17
  43. package/dist/cjs/public-functions/executeRoute.cjs +27 -17
  44. package/dist/cjs/public-functions/getEvmGasAmountForMessage.cjs +1 -1
  45. package/dist/cjs/public-functions/getFeeInfoForChain.cjs +6 -7
  46. package/dist/cjs/public-functions/getRecommendedGasPrice.cjs +8 -9
  47. package/dist/cjs/public-functions/getRouteWithGasOnReceive.cjs +39 -0
  48. package/dist/cjs/public-functions/getSigningStargateClient.cjs +6 -6
  49. package/dist/cjs/public-functions/setApiOptions.cjs +4 -4
  50. package/dist/cjs/public-functions/setClientOptions.cjs +5 -5
  51. package/dist/cjs/public-functions/subscribeToRouteStatus.cjs +9 -9
  52. package/dist/cjs/public-functions/validateCosmosGasBalance.cjs +8 -8
  53. package/dist/cjs/public-functions/waitForTransaction.cjs +6 -6
  54. package/dist/esm/api/getAssets.d.ts +1 -1
  55. package/dist/esm/api/getAssets.js +3 -3
  56. package/dist/esm/api/getAssetsBetweenChains.d.ts +21 -21
  57. package/dist/esm/api/getAssetsBetweenChains.js +3 -3
  58. package/dist/esm/api/getBridges.d.ts +1 -1
  59. package/dist/esm/api/getBridges.js +3 -3
  60. package/dist/esm/api/getChains.d.ts +1 -1
  61. package/dist/esm/api/getChains.js +3 -3
  62. package/dist/esm/api/getVenues.js +3 -3
  63. package/dist/esm/api/postAssetsFromSource.d.ts +1 -1
  64. package/dist/esm/api/postAssetsFromSource.js +4 -4
  65. package/dist/esm/api/postBalances.d.ts +2 -2
  66. package/dist/esm/api/postBalances.js +3 -3
  67. package/dist/esm/api/postIbcOriginAssets.d.ts +10 -10
  68. package/dist/esm/api/postIbcOriginAssets.js +3 -3
  69. package/dist/esm/api/postMessages.d.ts +12 -12
  70. package/dist/esm/api/postMessages.js +3 -3
  71. package/dist/esm/api/postMessagesDirect.d.ts +163 -161
  72. package/dist/esm/api/postMessagesDirect.js +3 -3
  73. package/dist/esm/api/postRecommendAssets.d.ts +11 -11
  74. package/dist/esm/api/postRecommendAssets.js +3 -3
  75. package/dist/esm/api/postRoute.d.ts +161 -159
  76. package/dist/esm/api/postRoute.js +3 -3
  77. package/dist/esm/api/postSubmitTransaction.d.ts +2 -2
  78. package/dist/esm/api/postSubmitTransaction.js +3 -3
  79. package/dist/esm/api/postTrackTransaction.d.ts +2 -2
  80. package/dist/esm/api/postTrackTransaction.js +3 -3
  81. package/dist/esm/api/postTransactionStatus.d.ts +36 -36
  82. package/dist/esm/api/postTransactionStatus.js +3 -3
  83. package/dist/esm/{callbacks-DCqqd0D9.d.ts → callbacks-C-KUJnDv.d.ts} +34 -4
  84. package/dist/esm/{chunk-GU3UHER5.js → chunk-2PWROHHX.js} +3 -3
  85. package/dist/esm/{chunk-MFHZBJGQ.js → chunk-3WFXBPS2.js} +1 -1
  86. package/dist/esm/{chunk-B36HVX2L.js → chunk-44IX6KPJ.js} +1 -1
  87. package/dist/esm/{chunk-WSAZDCXR.js → chunk-5IXH2QPF.js} +86 -16
  88. package/dist/esm/{chunk-Z2HSHJLW.js → chunk-6M7N6EAO.js} +3 -3
  89. package/dist/esm/{chunk-6HKZYODA.js → chunk-AUNRER4I.js} +1 -1
  90. package/dist/esm/{chunk-H2HTF2UF.js → chunk-FNTPI2AV.js} +1 -1
  91. package/dist/esm/{chunk-W5AA7QOQ.js → chunk-HDW6XFWX.js} +1 -1
  92. package/dist/esm/{chunk-RXZJUE4K.js → chunk-HELQO7PA.js} +2 -2
  93. package/dist/esm/{chunk-45B6E7AT.js → chunk-IHSSWY3M.js} +1 -1
  94. package/dist/esm/{chunk-JQOJIEZA.js → chunk-IKWC55JU.js} +739 -60
  95. package/dist/esm/{chunk-VQ5SIQWU.js → chunk-JYYCFKB4.js} +8 -7
  96. package/dist/esm/chunk-KNXMSLOB.js +1 -1
  97. package/dist/esm/{chunk-HPA2XUA3.js → chunk-KXQ2ASHQ.js} +1 -1
  98. package/dist/esm/{chunk-263RYJUL.js → chunk-MYGJGC62.js} +1 -1
  99. package/dist/esm/chunk-O4J7DHZA.js +180 -0
  100. package/dist/esm/{chunk-BNMWBXN3.js → chunk-QRKO56DH.js} +9 -4
  101. package/dist/esm/{chunk-VG3G5QHN.js → chunk-RFJYCJK4.js} +1 -1
  102. package/dist/esm/{chunk-A4MFVNZO.js → chunk-SFWTQBQT.js} +3 -3
  103. package/dist/esm/{chunk-7WXPBTSR.js → chunk-TNIGHYH2.js} +3 -3
  104. package/dist/esm/{chunk-EJZGYHGH.js → chunk-UBVBVJPY.js} +1 -1
  105. package/dist/esm/chunk-UIDIKXMB.js +1 -1
  106. package/dist/esm/{chunk-DQXGZGNJ.js → chunk-V7VKYD4J.js} +2 -2
  107. package/dist/esm/{chunk-X3PQKUOS.js → chunk-VGCTTJO7.js} +7 -1
  108. package/dist/esm/{chunk-TLVHKYQ3.js → chunk-VWOMKMH2.js} +1 -1
  109. package/dist/esm/{chunk-AGHQ7SIE.js → chunk-YGQ4NKTM.js} +1 -1
  110. package/dist/esm/{chunk-A35RPDUV.js → chunk-YLVUKXLR.js} +1 -1
  111. package/dist/esm/{client-types-BSZasIDd.d.ts → client-types-CGMuZ3zo.d.ts} +2 -2
  112. package/dist/esm/{generateApi-CwM4Ca30.d.ts → generateApi-D_-Gso-x.d.ts} +1 -1
  113. package/dist/esm/index.d.ts +166 -143
  114. package/dist/esm/index.js +26 -175
  115. package/dist/esm/public-functions/executeMultipleRoutes.d.ts +30 -10
  116. package/dist/esm/public-functions/executeMultipleRoutes.js +26 -16
  117. package/dist/esm/public-functions/executeRoute.d.ts +4 -4
  118. package/dist/esm/public-functions/executeRoute.js +26 -16
  119. package/dist/esm/public-functions/getCosmosGasAmountForMessage.d.ts +1 -1
  120. package/dist/esm/public-functions/getEvmGasAmountForMessage.d.ts +3 -3
  121. package/dist/esm/public-functions/getEvmGasAmountForMessage.js +1 -1
  122. package/dist/esm/public-functions/getFeeInfoForChain.d.ts +1 -1
  123. package/dist/esm/public-functions/getFeeInfoForChain.js +5 -6
  124. package/dist/esm/public-functions/getRecommendedGasPrice.js +7 -8
  125. package/dist/esm/public-functions/getRouteWithGasOnReceive.d.ts +20 -0
  126. package/dist/esm/public-functions/getRouteWithGasOnReceive.js +30 -0
  127. package/dist/esm/public-functions/getSigningStargateClient.js +5 -5
  128. package/dist/esm/public-functions/setApiOptions.d.ts +1 -1
  129. package/dist/esm/public-functions/setApiOptions.js +3 -3
  130. package/dist/esm/public-functions/setClientOptions.d.ts +4 -4
  131. package/dist/esm/public-functions/setClientOptions.js +4 -4
  132. package/dist/esm/public-functions/subscribeToRouteStatus.d.ts +4 -4
  133. package/dist/esm/public-functions/subscribeToRouteStatus.js +5 -5
  134. package/dist/esm/public-functions/validateCosmosGasBalance.d.ts +4 -4
  135. package/dist/esm/public-functions/validateCosmosGasBalance.js +7 -7
  136. package/dist/esm/public-functions/waitForTransaction.d.ts +38 -38
  137. package/dist/esm/public-functions/waitForTransaction.js +5 -5
  138. package/dist/esm/setClientOptions-C8g92xTm.d.ts +76 -0
  139. package/dist/esm/{swaggerTypes-Bh6hu5Q-.d.ts → swaggerTypes-B_jKfpvz.d.ts} +154 -132
  140. package/package.json +1 -1
  141. package/dist/cjs/chunk-D57TNRV3.cjs +0 -214
  142. package/dist/cjs/chunk-KSJ5QYMR.cjs +0 -185
  143. package/dist/cjs/chunk-KZOSEIWH.cjs +0 -10
  144. package/dist/cjs/chunk-Q33F7U2Y.cjs +0 -55
  145. package/dist/esm/chunk-4YTLUDRU.js +0 -212
  146. package/dist/esm/chunk-CP55HI6R.js +0 -53
  147. package/dist/esm/chunk-RHGDUD76.js +0 -180
  148. package/dist/esm/chunk-SWYON2RG.js +0 -7
  149. package/dist/esm/setClientOptions-CrXIODm0.d.ts +0 -19
  150. package/dist/cjs/{chunk-IDDRJJO5.cjs → chunk-DLT6Q6RB.cjs} +1 -1
  151. package/dist/esm/{chunk-OQDBWVET.js → chunk-QL423UEF.js} +1 -1
@@ -1,10 +0,0 @@
1
- 'use strict';
2
-
3
- // src/constants/constants.ts
4
- var DEFAULT_GAS_DENOM_OVERRIDES = {
5
- "noble-1": "uusdc"
6
- };
7
- var GAS_STATION_CHAIN_IDS = ["bbn-test-5", "bbn-1"];
8
-
9
- exports.DEFAULT_GAS_DENOM_OVERRIDES = DEFAULT_GAS_DENOM_OVERRIDES;
10
- exports.GAS_STATION_CHAIN_IDS = GAS_STATION_CHAIN_IDS;
@@ -1,55 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkHEYFLFKD_cjs = require('./chunk-HEYFLFKD.cjs');
4
- var chunk7D433NQ5_cjs = require('./chunk-7D433NQ5.cjs');
5
- var chunkXPQRSO4J_cjs = require('./chunk-XPQRSO4J.cjs');
6
- var chunkMMGVGXA5_cjs = require('./chunk-MMGVGXA5.cjs');
7
-
8
- // src/public-functions/executeRoute.ts
9
- var executeRoute = async (options) => {
10
- const { route, userAddresses, appendCosmosMsgs, timeoutSeconds } = options;
11
- const { id: routeId } = chunk7D433NQ5_cjs.updateRouteDetails({
12
- status: "unconfirmed",
13
- options
14
- });
15
- const addressList = await chunkHEYFLFKD_cjs.createValidAddressList({
16
- userAddresses,
17
- route
18
- });
19
- const response = await chunkXPQRSO4J_cjs.messages({
20
- timeoutSeconds,
21
- amountIn: route?.amountIn,
22
- amountOut: route.estimatedAmountOut || "0",
23
- sourceAssetChainId: route?.sourceAssetChainId,
24
- sourceAssetDenom: route?.sourceAssetDenom,
25
- destAssetChainId: route?.destAssetChainId,
26
- destAssetDenom: route?.destAssetDenom,
27
- operations: route?.operations,
28
- addressList,
29
- slippageTolerancePercent: options.slippageTolerancePercent || "1",
30
- chainIdsToAffiliates: chunkMMGVGXA5_cjs.ApiState.chainIdsToAffiliates,
31
- postRouteHandler: options.postRouteHandler,
32
- feePayerAddress: options.svmFeePayer?.address
33
- });
34
- if (appendCosmosMsgs) {
35
- Object.entries(appendCosmosMsgs).forEach(([chainId, msgs]) => {
36
- const txIndex = response?.txs?.findIndex(
37
- (tx2) => "cosmosTx" in tx2 && tx2.cosmosTx.chainId === chainId
38
- );
39
- if (txIndex === void 0 || txIndex === -1) return;
40
- const tx = response?.txs?.[txIndex];
41
- if (tx && "cosmosTx" in tx) {
42
- tx.cosmosTx.msgs?.unshift(...msgs);
43
- }
44
- });
45
- }
46
- const { transactionDetails, executeTransaction } = await chunkHEYFLFKD_cjs.executeTransactions({ ...options, routeId, txs: response?.txs });
47
- await chunk7D433NQ5_cjs.executeAndSubscribeToRouteStatus({
48
- transactionDetails,
49
- executeTransaction,
50
- routeId,
51
- options
52
- });
53
- };
54
-
55
- exports.executeRoute = executeRoute;
@@ -1,212 +0,0 @@
1
- import { createValidAddressList, executeTransactions } from './chunk-JQOJIEZA.js';
2
- import { updateRouteDetails, executeAndSubscribeToRouteStatus } from './chunk-WSAZDCXR.js';
3
- import { messages } from './chunk-45B6E7AT.js';
4
- import { trackTransaction } from './chunk-6HKZYODA.js';
5
- import { ApiState } from './chunk-X3PQKUOS.js';
6
- import 'uuid';
7
-
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 };
@@ -1,53 +0,0 @@
1
- import { createValidAddressList, executeTransactions } from './chunk-JQOJIEZA.js';
2
- import { updateRouteDetails, executeAndSubscribeToRouteStatus } from './chunk-WSAZDCXR.js';
3
- import { messages } from './chunk-45B6E7AT.js';
4
- import { ApiState } from './chunk-X3PQKUOS.js';
5
-
6
- // src/public-functions/executeRoute.ts
7
- var executeRoute = async (options) => {
8
- const { route, userAddresses, appendCosmosMsgs, timeoutSeconds } = options;
9
- const { id: routeId } = updateRouteDetails({
10
- status: "unconfirmed",
11
- options
12
- });
13
- const addressList = await createValidAddressList({
14
- userAddresses,
15
- route
16
- });
17
- const response = await messages({
18
- timeoutSeconds,
19
- amountIn: route?.amountIn,
20
- amountOut: route.estimatedAmountOut || "0",
21
- sourceAssetChainId: route?.sourceAssetChainId,
22
- sourceAssetDenom: route?.sourceAssetDenom,
23
- destAssetChainId: route?.destAssetChainId,
24
- destAssetDenom: route?.destAssetDenom,
25
- operations: route?.operations,
26
- addressList,
27
- slippageTolerancePercent: options.slippageTolerancePercent || "1",
28
- chainIdsToAffiliates: ApiState.chainIdsToAffiliates,
29
- postRouteHandler: options.postRouteHandler,
30
- feePayerAddress: options.svmFeePayer?.address
31
- });
32
- if (appendCosmosMsgs) {
33
- Object.entries(appendCosmosMsgs).forEach(([chainId, msgs]) => {
34
- const txIndex = response?.txs?.findIndex(
35
- (tx2) => "cosmosTx" in tx2 && tx2.cosmosTx.chainId === chainId
36
- );
37
- if (txIndex === void 0 || txIndex === -1) return;
38
- const tx = response?.txs?.[txIndex];
39
- if (tx && "cosmosTx" in tx) {
40
- tx.cosmosTx.msgs?.unshift(...msgs);
41
- }
42
- });
43
- }
44
- const { transactionDetails, executeTransaction } = await executeTransactions({ ...options, routeId, txs: response?.txs });
45
- await executeAndSubscribeToRouteStatus({
46
- transactionDetails,
47
- executeTransaction,
48
- routeId,
49
- options
50
- });
51
- };
52
-
53
- export { executeRoute };