@skip-go/client 1.5.3-alpha.0 → 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 (47) hide show
  1. package/dist/cjs/{chunk-CZKIE576.cjs → chunk-APJDSXWR.cjs} +2 -2
  2. package/dist/cjs/{chunk-GWRZ6MPC.cjs → chunk-I2FDWZZJ.cjs} +16 -16
  3. package/dist/cjs/{chunk-GGSF5JZH.cjs → chunk-NWD4MAMT.cjs} +4 -4
  4. package/dist/cjs/{chunk-J7HZ6VJE.cjs → chunk-PDTIT3JO.cjs} +3 -3
  5. package/dist/cjs/{chunk-MOWOIPUG.cjs → chunk-RC73RNNQ.cjs} +2 -2
  6. package/dist/cjs/chunk-UMBMSRZZ.cjs +185 -0
  7. package/dist/cjs/index.cjs +35 -35
  8. package/dist/cjs/public-functions/executeMultipleRoutes.cjs +7 -7
  9. package/dist/cjs/public-functions/executeRoute.cjs +7 -7
  10. package/dist/cjs/public-functions/getFeeInfoForChain.cjs +3 -3
  11. package/dist/cjs/public-functions/getRecommendedGasPrice.cjs +4 -4
  12. package/dist/cjs/public-functions/getRouteWithGasOnReceive.cjs +7 -7
  13. package/dist/cjs/public-functions/getSigningStargateClient.cjs +3 -3
  14. package/dist/cjs/public-functions/validateCosmosGasBalance.cjs +4 -4
  15. package/dist/esm/{chunk-SOVU5NCL.js → chunk-2PWROHHX.js} +1 -1
  16. package/dist/esm/{chunk-RJ35JBT4.js → chunk-IKWC55JU.js} +4 -4
  17. package/dist/esm/chunk-O4J7DHZA.js +180 -0
  18. package/dist/esm/{chunk-YWG4XR5A.js → chunk-QRKO56DH.js} +1 -1
  19. package/dist/esm/{chunk-47HN6VKU.js → chunk-SFWTQBQT.js} +1 -1
  20. package/dist/esm/{chunk-JNVGNIOE.js → chunk-V7VKYD4J.js} +1 -1
  21. package/dist/esm/index.js +6 -6
  22. package/dist/esm/public-functions/executeMultipleRoutes.js +6 -6
  23. package/dist/esm/public-functions/executeRoute.js +6 -6
  24. package/dist/esm/public-functions/getFeeInfoForChain.js +2 -2
  25. package/dist/esm/public-functions/getRecommendedGasPrice.js +3 -3
  26. package/dist/esm/public-functions/getRouteWithGasOnReceive.js +6 -6
  27. package/dist/esm/public-functions/getSigningStargateClient.js +2 -2
  28. package/dist/esm/public-functions/validateCosmosGasBalance.js +3 -3
  29. package/package.json +1 -1
  30. package/dist/cjs/chunk-ARCCHERF.cjs +0 -1478
  31. package/dist/cjs/chunk-BQDOKZFX.cjs +0 -214
  32. package/dist/cjs/chunk-EVEVOW2U.cjs +0 -2179
  33. package/dist/cjs/chunk-H2T4LMS2.cjs +0 -55
  34. package/dist/cjs/chunk-I6VYDEUV.cjs +0 -454
  35. package/dist/cjs/chunk-KSJ5QYMR.cjs +0 -185
  36. package/dist/cjs/chunk-KZOSEIWH.cjs +0 -10
  37. package/dist/cjs/chunk-UY5LWG5D.cjs +0 -95
  38. package/dist/cjs/chunk-W6ID22B6.cjs +0 -24
  39. package/dist/esm/chunk-DL374PFE.js +0 -53
  40. package/dist/esm/chunk-FDRLM2JD.js +0 -431
  41. package/dist/esm/chunk-H3MY23AH.js +0 -93
  42. package/dist/esm/chunk-IGK7LJCM.js +0 -1475
  43. package/dist/esm/chunk-RHGDUD76.js +0 -180
  44. package/dist/esm/chunk-RHLE3EW7.js +0 -212
  45. package/dist/esm/chunk-SWYON2RG.js +0 -7
  46. package/dist/esm/chunk-X2IBEHMZ.js +0 -2154
  47. package/dist/esm/chunk-XHLXJGVB.js +0 -22
@@ -1,214 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkARCCHERF_cjs = require('./chunk-ARCCHERF.cjs');
4
- var chunkBCX2D6TE_cjs = require('./chunk-BCX2D6TE.cjs');
5
- var chunk3NHW3XWK_cjs = require('./chunk-3NHW3XWK.cjs');
6
- var chunkPLO5CVGN_cjs = require('./chunk-PLO5CVGN.cjs');
7
- var chunkHFEMNOJS_cjs = require('./chunk-HFEMNOJS.cjs');
8
-
9
- // src/public-functions/executeMultipleRoutes.ts
10
- var executeMultipleRoutes = async (options) => {
11
- const {
12
- route,
13
- userAddresses,
14
- appendCosmosMsgs,
15
- postRouteHandler,
16
- slippageTolerancePercent,
17
- ...restOptions
18
- } = options;
19
- const addressList = {};
20
- for (const [routeKey, routeValue] of Object.entries(route)) {
21
- const _userAddresses = userAddresses[routeKey];
22
- if (_userAddresses === void 0) {
23
- throw new Error(
24
- `executeMultipleRoutes error: no user addresses found for route: ${routeKey}`
25
- );
26
- }
27
- const routeAddressList = await chunkARCCHERF_cjs.createValidAddressList({
28
- userAddresses: _userAddresses,
29
- route: routeValue
30
- });
31
- addressList[routeKey] = routeAddressList;
32
- }
33
- const msgsResponses = await Promise.all(
34
- Object.entries(route).map(async ([routeKey, routeValue]) => {
35
- const routeAddressList = addressList[routeKey];
36
- if (routeAddressList === void 0) {
37
- throw new Error(
38
- `executeMultipleRoutes error: address list not found for route ${routeKey}`
39
- );
40
- }
41
- return await chunk3NHW3XWK_cjs.messages({
42
- timeoutSeconds: options.timeoutSeconds,
43
- amountIn: routeValue?.amountIn,
44
- amountOut: routeValue.estimatedAmountOut || "0",
45
- sourceAssetChainId: routeValue?.sourceAssetChainId,
46
- sourceAssetDenom: routeValue?.sourceAssetDenom,
47
- destAssetChainId: routeValue?.destAssetChainId,
48
- destAssetDenom: routeValue?.destAssetDenom,
49
- operations: routeValue?.operations,
50
- addressList: routeAddressList,
51
- slippageTolerancePercent: slippageTolerancePercent?.[routeKey] || "1",
52
- chainIdsToAffiliates: chunkHFEMNOJS_cjs.ApiState.chainIdsToAffiliates,
53
- postRouteHandler: postRouteHandler?.[routeKey],
54
- feePayerAddress: options.svmFeePayer?.address
55
- });
56
- })
57
- );
58
- let msgsRecord = {};
59
- msgsResponses.forEach((msg, index2) => {
60
- const routeKey = Object.keys(route)[index2];
61
- if (!routeKey) {
62
- throw new Error(
63
- `executeMultipleRoutes error: route key not found for index ${index2}`
64
- );
65
- }
66
- const addedCosmosMsgs = appendCosmosMsgs?.[routeKey];
67
- if (addedCosmosMsgs) {
68
- Object.entries(addedCosmosMsgs).forEach(([chainId, msgs]) => {
69
- const txIndex = msg?.txs?.findIndex(
70
- (tx2) => "cosmosTx" in tx2 && tx2.cosmosTx.chainId === chainId
71
- );
72
- if (txIndex === void 0 || txIndex === -1) return;
73
- const tx = msg?.txs?.[txIndex];
74
- if (tx && "cosmosTx" in tx) {
75
- tx.cosmosTx.msgs?.unshift(...msgs);
76
- }
77
- });
78
- }
79
- msgsRecord[routeKey] = msg;
80
- });
81
- let transferIndexToRouteKey = void 0;
82
- const cosmosTxIndex0Map = /* @__PURE__ */ new Map();
83
- let transferIndex = 0;
84
- for (const [routeKey, msgs] of Object.entries(msgsRecord)) {
85
- const firstTx = msgs?.txs?.[0];
86
- if (firstTx && "cosmosTx" in firstTx) {
87
- const { chainId, msgs: firstTxMsgs } = firstTx.cosmosTx;
88
- if (!transferIndexToRouteKey) {
89
- transferIndexToRouteKey = {};
90
- }
91
- transferIndexToRouteKey[transferIndex] = routeKey;
92
- transferIndex++;
93
- if (!cosmosTxIndex0Map.has(chainId)) {
94
- cosmosTxIndex0Map.set(chainId, {
95
- routeKey,
96
- firstCosmosTx: firstTx.cosmosTx
97
- });
98
- } else {
99
- const existing = cosmosTxIndex0Map.get(chainId);
100
- if (existing && firstTxMsgs) {
101
- const modifyTarget = msgsRecord[existing.routeKey]?.txs?.[0];
102
- if (modifyTarget && "cosmosTx" in modifyTarget) {
103
- modifyTarget.cosmosTx.msgs?.push(...firstTxMsgs);
104
- msgsRecord[routeKey]?.txs?.shift();
105
- }
106
- }
107
- }
108
- }
109
- }
110
- Object.entries(msgsRecord).forEach(([routeKey, msgs]) => {
111
- if (msgs?.txs?.length === 0) {
112
- delete msgsRecord[routeKey];
113
- }
114
- });
115
- let mainRouteId = void 0;
116
- let msgsRecordIndexToRouteId = {};
117
- let index = 0;
118
- const transactionDetailsList = {};
119
- const executeTransactionList = {};
120
- const mergedMainAndSecondaryRoutes = Object.entries(msgsRecord).length !== Object.entries(route).length;
121
- for (const [routeKey, msgsResponse] of Object.entries(msgsRecord)) {
122
- const { id: routeId } = chunkBCX2D6TE_cjs.updateRouteDetails({
123
- status: "unconfirmed",
124
- options: {
125
- route: route[routeKey],
126
- ...restOptions
127
- },
128
- mainRouteId,
129
- transferIndexToRouteKey
130
- });
131
- msgsRecordIndexToRouteId[index] = routeId;
132
- if (routeKey === "mainRoute") {
133
- mainRouteId = routeId;
134
- }
135
- const { transactionDetails, executeTransaction: _executeTransaction } = await chunkARCCHERF_cjs.executeTransactions({
136
- ...restOptions,
137
- routeId,
138
- txs: msgsResponse?.txs,
139
- route: route[routeKey],
140
- userAddresses: userAddresses[routeKey],
141
- isMultiRoutes: true
142
- });
143
- const executeTransaction = async (index2) => {
144
- const txResult = await _executeTransaction(index2);
145
- if (routeKey !== "mainRoute" || mergedMainAndSecondaryRoutes) {
146
- const relatedRoutes = Object.entries(route).filter(([key]) => key !== "mainRoute").map(([key, route2]) => ({ route: route2, routeKey: key, status: "pending" }));
147
- chunkBCX2D6TE_cjs.updateRouteDetails({
148
- options: {
149
- route: route[routeKey],
150
- ...restOptions
151
- },
152
- routeId: mainRouteId,
153
- transferIndexToRouteKey,
154
- relatedRoutes
155
- });
156
- }
157
- return txResult;
158
- };
159
- if (transactionDetails[0]?.chainType === "evm" /* Evm */) {
160
- for (const [index2, transactionDetail] of transactionDetails.entries()) {
161
- const txResult = await executeTransaction(index2);
162
- if (txResult.txHash) {
163
- const trackResponse = await chunkPLO5CVGN_cjs.trackTransaction({
164
- chainId: transactionDetail.chainId,
165
- txHash: txResult.txHash,
166
- ...options.trackTxPollingOptions
167
- });
168
- await options?.onTransactionTracked?.({
169
- txHash: txResult.txHash,
170
- chainId: transactionDetail.chainId,
171
- explorerLink: trackResponse.explorerLink
172
- });
173
- transactionDetail.txHash = txResult.txHash;
174
- transactionDetail.explorerLink = trackResponse.explorerLink;
175
- }
176
- }
177
- } else {
178
- executeTransactionList[index] = executeTransaction;
179
- }
180
- transactionDetailsList[index] = transactionDetails;
181
- index++;
182
- }
183
- await Promise.all(
184
- Object.entries(msgsRecord).map(([routeKey, msgsResponse], index2) => {
185
- return chunkBCX2D6TE_cjs.executeAndSubscribeToRouteStatus({
186
- transactionDetails: transactionDetailsList[index2],
187
- executeTransaction: executeTransactionList[index2],
188
- routeId: msgsRecordIndexToRouteId[index2],
189
- options: {
190
- route: route[routeKey],
191
- userAddresses: userAddresses[routeKey],
192
- ...restOptions,
193
- onRouteStatusUpdated: (routeStatus) => {
194
- const relatedRoutes = Object.entries(route).filter(([key]) => key !== "mainRoute").map(([key, route2]) => ({ route: route2, routeKey: key, status: routeStatus.status }));
195
- if (routeKey !== "mainRoute") {
196
- chunkBCX2D6TE_cjs.updateRouteDetails({
197
- options: {
198
- route: route[routeKey],
199
- ...restOptions
200
- },
201
- routeId: mainRouteId,
202
- transferIndexToRouteKey,
203
- relatedRoutes
204
- });
205
- }
206
- options.onRouteStatusUpdated?.(routeStatus);
207
- }
208
- }
209
- });
210
- })
211
- );
212
- };
213
-
214
- exports.executeMultipleRoutes = executeMultipleRoutes;