@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,212 +0,0 @@
1
- import { createValidAddressList, executeTransactions } from './chunk-IGK7LJCM.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 };
@@ -1,7 +0,0 @@
1
- // src/constants/constants.ts
2
- var DEFAULT_GAS_DENOM_OVERRIDES = {
3
- "noble-1": "uusdc"
4
- };
5
- var GAS_STATION_CHAIN_IDS = ["bbn-test-5", "bbn-1"];
6
-
7
- export { DEFAULT_GAS_DENOM_OVERRIDES, GAS_STATION_CHAIN_IDS };