@skip-go/client 1.0.0-alpha-2 → 1.0.0-alpha-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.
Files changed (51) hide show
  1. package/dist/api/getAssets.mjs +2 -25
  2. package/dist/api/getAssetsBetweenChains.mjs +2 -9
  3. package/dist/api/getBridges.mjs +2 -10
  4. package/dist/api/getChains.mjs +2 -16
  5. package/dist/api/getVenues.mjs +2 -10
  6. package/dist/api/postAssetsFromSource.mjs +3 -14
  7. package/dist/api/postBalances.mjs +2 -16
  8. package/dist/api/postIbcOriginAssets.mjs +2 -11
  9. package/dist/api/postMessages.d.mts +183 -183
  10. package/dist/api/postMessages.mjs +2 -10
  11. package/dist/api/postMessagesDirect.d.mts +183 -183
  12. package/dist/api/postMessagesDirect.mjs +2 -10
  13. package/dist/api/postRecommendAssets.mjs +2 -13
  14. package/dist/api/postRoute.d.mts +160 -160
  15. package/dist/api/postRoute.mjs +2 -16
  16. package/dist/api/postSubmitTransaction.mjs +2 -10
  17. package/dist/api/postTrackTransaction.mjs +2 -11
  18. package/dist/api/postTransactionStatus.mjs +2 -10
  19. package/dist/chunk-2ETF4N4H.mjs +45 -0
  20. package/dist/chunk-2F4MBSMT.mjs +99 -0
  21. package/dist/chunk-2FYLP573.mjs +15 -0
  22. package/dist/chunk-7TBBV2YY.mjs +13 -0
  23. package/dist/chunk-B72MYSG5.mjs +273 -0
  24. package/dist/chunk-C5CGY2X7.mjs +10 -0
  25. package/dist/chunk-CAAR7GDJ.mjs +11 -0
  26. package/dist/chunk-CZ27FEZ7.mjs +11 -0
  27. package/dist/chunk-DKIWPD5I.mjs +124 -0
  28. package/dist/chunk-IGD32L7C.mjs +9 -0
  29. package/dist/chunk-J7GGREYX.mjs +10 -0
  30. package/dist/chunk-KPK3Z6QZ.mjs +10 -0
  31. package/dist/chunk-KSMJWLEH.mjs +2315 -0
  32. package/dist/chunk-LJVI5DLG.mjs +10 -0
  33. package/dist/chunk-NNZFCKHP.mjs +10 -0
  34. package/dist/chunk-NU7MCJOK.mjs +187 -0
  35. package/dist/chunk-OTLFF5OB.mjs +3634 -0
  36. package/dist/chunk-PEZHVPSR.mjs +2237 -0
  37. package/dist/chunk-QZ3X6MP3.mjs +10 -0
  38. package/dist/chunk-RXWDHQLG.mjs +231 -0
  39. package/dist/chunk-TUBI6VE6.mjs +1344 -0
  40. package/dist/chunk-WDMGUHWR.mjs +23 -0
  41. package/dist/chunk-YWYU6P7W.mjs +14 -0
  42. package/dist/chunk-ZAF3Z56R.mjs +7 -0
  43. package/dist/index.mjs +24 -24
  44. package/dist/public-functions/executeRoute.mjs +12 -100
  45. package/dist/public-functions/getFeeInfoForChain.mjs +5 -47
  46. package/dist/public-functions/getRecommendedGasPrice.mjs +7 -1366
  47. package/dist/public-functions/getSigningStargateClient.mjs +4 -32
  48. package/dist/public-functions/setApiOptions.mjs +2 -46
  49. package/dist/public-functions/setClientOptions.mjs +4 -34
  50. package/package.json +1 -8
  51. package/dist/chunk-AXBFBHS2.mjs +0 -41
@@ -12,128 +12,6 @@ declare const route: (request: RouteRequest) => Promise<{
12
12
  doesSwap?: boolean | undefined;
13
13
  estimatedAmountOut: string;
14
14
  operations: ({
15
- transfer?: {
16
- fromChainId?: string | undefined;
17
- toChainId?: string | undefined;
18
- channel?: string | undefined;
19
- destDenom?: string | undefined;
20
- pfmEnabled?: boolean | undefined;
21
- port?: string | undefined;
22
- supportsMemo?: boolean | undefined;
23
- denomIn?: string | undefined;
24
- denomOut?: string | undefined;
25
- feeAmount?: string | undefined;
26
- usdFeeAmount?: string | undefined;
27
- feeAsset?: {
28
- chainId: string;
29
- coingeckoId?: string | undefined;
30
- decimals?: number | undefined;
31
- denom: string;
32
- description?: string | undefined;
33
- isCw20: boolean;
34
- isEvm: boolean;
35
- isSvm: boolean;
36
- logoUri?: string | undefined;
37
- name?: string | undefined;
38
- originChainId: string;
39
- originDenom: string;
40
- recommendedSymbol?: string | undefined;
41
- symbol?: string | undefined;
42
- tokenContract?: string | undefined;
43
- trace: string;
44
- } | undefined;
45
- bridgeId?: BridgeType | undefined;
46
- smartRelay?: boolean | undefined;
47
- } | undefined;
48
- txIndex: number;
49
- amountIn: string;
50
- amountOut: string;
51
- } | {
52
- swap?: {
53
- swapIn?: {
54
- swapAmountIn?: string | undefined;
55
- swapOperations?: {
56
- denomIn?: string | undefined;
57
- denomOut?: string | undefined;
58
- pool?: string | undefined;
59
- interface?: string | undefined;
60
- }[] | undefined;
61
- swapVenue?: {
62
- chainId?: string | undefined;
63
- name?: string | undefined;
64
- logoUri?: string | undefined;
65
- } | undefined;
66
- priceImpactPercent?: string | undefined;
67
- } | undefined;
68
- estimatedAffiliateFee?: string | undefined;
69
- chainId?: string | undefined;
70
- fromChainId?: string | undefined;
71
- denomIn?: string | undefined;
72
- denomOut?: string | undefined;
73
- swapVenues?: {
74
- chainId?: string | undefined;
75
- name?: string | undefined;
76
- logoUri?: string | undefined;
77
- }[] | undefined;
78
- } | {
79
- swapOut?: {
80
- swapAmountOut?: string | undefined;
81
- swapOperations?: {
82
- denomIn?: string | undefined;
83
- denomOut?: string | undefined;
84
- pool?: string | undefined;
85
- interface?: string | undefined;
86
- }[] | undefined;
87
- swapVenue?: {
88
- chainId?: string | undefined;
89
- name?: string | undefined;
90
- logoUri?: string | undefined;
91
- } | undefined;
92
- priceImpactPercent?: string | undefined;
93
- } | undefined;
94
- estimatedAffiliateFee?: string | undefined;
95
- chainId?: string | undefined;
96
- fromChainId?: string | undefined;
97
- denomIn?: string | undefined;
98
- denomOut?: string | undefined;
99
- swapVenues?: {
100
- chainId?: string | undefined;
101
- name?: string | undefined;
102
- logoUri?: string | undefined;
103
- }[] | undefined;
104
- } | {
105
- smartSwapIn?: {
106
- swapVenue?: {
107
- chainId?: string | undefined;
108
- name?: string | undefined;
109
- logoUri?: string | undefined;
110
- } | undefined;
111
- swapRoutes?: {
112
- swapAmountIn?: string | undefined;
113
- denomIn?: string | undefined;
114
- swapOperations?: {
115
- denomIn?: string | undefined;
116
- denomOut?: string | undefined;
117
- pool?: string | undefined;
118
- interface?: string | undefined;
119
- }[] | undefined;
120
- }[] | undefined;
121
- } | undefined;
122
- estimatedAffiliateFee?: string | undefined;
123
- chainId?: string | undefined;
124
- fromChainId?: string | undefined;
125
- denomIn?: string | undefined;
126
- denomOut?: string | undefined;
127
- swapVenues?: {
128
- chainId?: string | undefined;
129
- name?: string | undefined;
130
- logoUri?: string | undefined;
131
- }[] | undefined;
132
- } | undefined;
133
- txIndex: number;
134
- amountIn: string;
135
- amountOut: string;
136
- } | {
137
15
  axelarTransfer?: {
138
16
  asset?: string | undefined;
139
17
  feeAmount?: string | undefined;
@@ -203,14 +81,6 @@ declare const route: (request: RouteRequest) => Promise<{
203
81
  txIndex: number;
204
82
  amountIn: string;
205
83
  amountOut: string;
206
- } | {
207
- bankSend?: {
208
- chainId?: string | undefined;
209
- denom?: string | undefined;
210
- } | undefined;
211
- txIndex: number;
212
- amountIn: string;
213
- amountOut: string;
214
84
  } | {
215
85
  cctpTransfer?: {
216
86
  fromChainId?: string | undefined;
@@ -232,14 +102,15 @@ declare const route: (request: RouteRequest) => Promise<{
232
102
  amountIn: string;
233
103
  amountOut: string;
234
104
  } | {
235
- hyperlaneTransfer?: {
105
+ stargateTransfer?: {
236
106
  fromChainId?: string | undefined;
237
107
  toChainId?: string | undefined;
238
108
  denomIn?: string | undefined;
239
109
  denomOut?: string | undefined;
240
- hyperlaneContractAddress?: string | undefined;
241
- feeAmount?: string | undefined;
242
- feeAsset?: {
110
+ bridgeId?: BridgeType | undefined;
111
+ poolAddress?: string | undefined;
112
+ destinationEndpointId?: number | undefined;
113
+ oftFeeAsset?: {
243
114
  chainId: string;
244
115
  coingeckoId?: string | undefined;
245
116
  decimals?: number | undefined;
@@ -257,9 +128,36 @@ declare const route: (request: RouteRequest) => Promise<{
257
128
  tokenContract?: string | undefined;
258
129
  trace: string;
259
130
  } | undefined;
260
- usdFeeAmount?: string | undefined;
261
- bridgeId?: BridgeType | undefined;
262
- smartRelay?: boolean | undefined;
131
+ oftFeeAmount?: string | undefined;
132
+ oftFeeAmountUsd?: string | undefined;
133
+ messagingFeeAsset?: {
134
+ chainId: string;
135
+ coingeckoId?: string | undefined;
136
+ decimals?: number | undefined;
137
+ denom: string;
138
+ description?: string | undefined;
139
+ isCw20: boolean;
140
+ isEvm: boolean;
141
+ isSvm: boolean;
142
+ logoUri?: string | undefined;
143
+ name?: string | undefined;
144
+ originChainId: string;
145
+ originDenom: string;
146
+ recommendedSymbol?: string | undefined;
147
+ symbol?: string | undefined;
148
+ tokenContract?: string | undefined;
149
+ trace: string;
150
+ } | undefined;
151
+ messagingFeeAmount?: string | undefined;
152
+ messageingFeeAmountUsd?: string | undefined;
153
+ } | undefined;
154
+ txIndex: number;
155
+ amountIn: string;
156
+ amountOut: string;
157
+ } | {
158
+ bankSend?: {
159
+ chainId?: string | undefined;
160
+ denom?: string | undefined;
263
161
  } | undefined;
264
162
  txIndex: number;
265
163
  amountIn: string;
@@ -283,28 +181,14 @@ declare const route: (request: RouteRequest) => Promise<{
283
181
  amountIn: string;
284
182
  amountOut: string;
285
183
  } | {
286
- transfer?: {
287
- fromChainId?: string | undefined;
288
- toChainId?: string | undefined;
289
- denomIn?: string | undefined;
290
- denomOut?: string | undefined;
291
- opInitBridgeId?: any;
292
- bridgeId?: BridgeType | undefined;
293
- smartRelay?: boolean | undefined;
294
- } | undefined;
295
- txIndex: number;
296
- amountIn: string;
297
- amountOut: string;
298
- } | {
299
- stargateTransfer?: {
184
+ hyperlaneTransfer?: {
300
185
  fromChainId?: string | undefined;
301
186
  toChainId?: string | undefined;
302
187
  denomIn?: string | undefined;
303
188
  denomOut?: string | undefined;
304
- bridgeId?: BridgeType | undefined;
305
- poolAddress?: string | undefined;
306
- destinationEndpointId?: number | undefined;
307
- oftFeeAsset?: {
189
+ hyperlaneContractAddress?: string | undefined;
190
+ feeAmount?: string | undefined;
191
+ feeAsset?: {
308
192
  chainId: string;
309
193
  coingeckoId?: string | undefined;
310
194
  decimals?: number | undefined;
@@ -322,9 +206,27 @@ declare const route: (request: RouteRequest) => Promise<{
322
206
  tokenContract?: string | undefined;
323
207
  trace: string;
324
208
  } | undefined;
325
- oftFeeAmount?: string | undefined;
326
- oftFeeAmountUsd?: string | undefined;
327
- messagingFeeAsset?: {
209
+ usdFeeAmount?: string | undefined;
210
+ bridgeId?: BridgeType | undefined;
211
+ smartRelay?: boolean | undefined;
212
+ } | undefined;
213
+ txIndex: number;
214
+ amountIn: string;
215
+ amountOut: string;
216
+ } | {
217
+ transfer?: {
218
+ fromChainId?: string | undefined;
219
+ toChainId?: string | undefined;
220
+ channel?: string | undefined;
221
+ destDenom?: string | undefined;
222
+ pfmEnabled?: boolean | undefined;
223
+ port?: string | undefined;
224
+ supportsMemo?: boolean | undefined;
225
+ denomIn?: string | undefined;
226
+ denomOut?: string | undefined;
227
+ feeAmount?: string | undefined;
228
+ usdFeeAmount?: string | undefined;
229
+ feeAsset?: {
328
230
  chainId: string;
329
231
  coingeckoId?: string | undefined;
330
232
  decimals?: number | undefined;
@@ -342,8 +244,106 @@ declare const route: (request: RouteRequest) => Promise<{
342
244
  tokenContract?: string | undefined;
343
245
  trace: string;
344
246
  } | undefined;
345
- messagingFeeAmount?: string | undefined;
346
- messageingFeeAmountUsd?: string | undefined;
247
+ bridgeId?: BridgeType | undefined;
248
+ smartRelay?: boolean | undefined;
249
+ } | undefined;
250
+ txIndex: number;
251
+ amountIn: string;
252
+ amountOut: string;
253
+ } | {
254
+ swap?: {
255
+ swapIn?: {
256
+ swapAmountIn?: string | undefined;
257
+ swapOperations?: {
258
+ denomIn?: string | undefined;
259
+ denomOut?: string | undefined;
260
+ pool?: string | undefined;
261
+ interface?: string | undefined;
262
+ }[] | undefined;
263
+ swapVenue?: {
264
+ chainId?: string | undefined;
265
+ name?: string | undefined;
266
+ logoUri?: string | undefined;
267
+ } | undefined;
268
+ priceImpactPercent?: string | undefined;
269
+ } | undefined;
270
+ estimatedAffiliateFee?: string | undefined;
271
+ chainId?: string | undefined;
272
+ fromChainId?: string | undefined;
273
+ denomIn?: string | undefined;
274
+ denomOut?: string | undefined;
275
+ swapVenues?: {
276
+ chainId?: string | undefined;
277
+ name?: string | undefined;
278
+ logoUri?: string | undefined;
279
+ }[] | undefined;
280
+ } | {
281
+ swapOut?: {
282
+ swapAmountOut?: string | undefined;
283
+ swapOperations?: {
284
+ denomIn?: string | undefined;
285
+ denomOut?: string | undefined;
286
+ pool?: string | undefined;
287
+ interface?: string | undefined;
288
+ }[] | undefined;
289
+ swapVenue?: {
290
+ chainId?: string | undefined;
291
+ name?: string | undefined;
292
+ logoUri?: string | undefined;
293
+ } | undefined;
294
+ priceImpactPercent?: string | undefined;
295
+ } | undefined;
296
+ estimatedAffiliateFee?: string | undefined;
297
+ chainId?: string | undefined;
298
+ fromChainId?: string | undefined;
299
+ denomIn?: string | undefined;
300
+ denomOut?: string | undefined;
301
+ swapVenues?: {
302
+ chainId?: string | undefined;
303
+ name?: string | undefined;
304
+ logoUri?: string | undefined;
305
+ }[] | undefined;
306
+ } | {
307
+ smartSwapIn?: {
308
+ swapVenue?: {
309
+ chainId?: string | undefined;
310
+ name?: string | undefined;
311
+ logoUri?: string | undefined;
312
+ } | undefined;
313
+ swapRoutes?: {
314
+ swapAmountIn?: string | undefined;
315
+ denomIn?: string | undefined;
316
+ swapOperations?: {
317
+ denomIn?: string | undefined;
318
+ denomOut?: string | undefined;
319
+ pool?: string | undefined;
320
+ interface?: string | undefined;
321
+ }[] | undefined;
322
+ }[] | undefined;
323
+ } | undefined;
324
+ estimatedAffiliateFee?: string | undefined;
325
+ chainId?: string | undefined;
326
+ fromChainId?: string | undefined;
327
+ denomIn?: string | undefined;
328
+ denomOut?: string | undefined;
329
+ swapVenues?: {
330
+ chainId?: string | undefined;
331
+ name?: string | undefined;
332
+ logoUri?: string | undefined;
333
+ }[] | undefined;
334
+ } | undefined;
335
+ txIndex: number;
336
+ amountIn: string;
337
+ amountOut: string;
338
+ } | {
339
+ transfer?: {
340
+ fromChainId?: string | undefined;
341
+ toChainId?: string | undefined;
342
+ denomIn?: string | undefined;
343
+ denomOut?: string | undefined;
344
+ opInitBridgeId?: any;
345
+ bridgeId?: BridgeType | undefined;
346
+ smartRelay?: boolean | undefined;
347
347
  } | undefined;
348
348
  txIndex: number;
349
349
  amountIn: string;
@@ -1,16 +1,2 @@
1
- import { __async, __spreadProps, __spreadValues } from '../chunk-AXBFBHS2.mjs';
2
- import { api } from '../utils/generateApi.mjs';
3
- import { ApiState } from 'src/state/apiState.mjs';
4
-
5
- var route = (request) => __async(void 0, null, function* () {
6
- const requestWithAffiliateFeeBps = __spreadProps(__spreadValues({}, request), {
7
- cumulativeAffiliateFeeBps: ApiState.cumulativeAffiliateFeeBPS
8
- });
9
- return api({
10
- methodName: "getRouteV2",
11
- method: "post",
12
- path: "/v2/fungible/route"
13
- })(requestWithAffiliateFeeBps);
14
- });
15
-
16
- export { route };
1
+ export { route } from '../chunk-2FYLP573.mjs';
2
+ import '../chunk-RXWDHQLG.mjs';
@@ -1,10 +1,2 @@
1
- import '../chunk-AXBFBHS2.mjs';
2
- import { api } from '../utils/generateApi.mjs';
3
-
4
- var submitTransaction = api({
5
- methodName: "submitTransactionV2",
6
- method: "post",
7
- path: "/v2/tx/submit"
8
- });
9
-
10
- export { submitTransaction };
1
+ export { submitTransaction } from '../chunk-LJVI5DLG.mjs';
2
+ import '../chunk-RXWDHQLG.mjs';
@@ -1,11 +1,2 @@
1
- import '../chunk-AXBFBHS2.mjs';
2
- import { pollingApi } from '../utils/generateApi.mjs';
3
-
4
- var trackTransaction = pollingApi({
5
- methodName: "trackTransactionV2",
6
- path: "/v2/tx/track",
7
- method: "post",
8
- backoffMultiplier: 2.5
9
- });
10
-
11
- export { trackTransaction };
1
+ export { trackTransaction } from '../chunk-CAAR7GDJ.mjs';
2
+ import '../chunk-RXWDHQLG.mjs';
@@ -1,10 +1,2 @@
1
- import '../chunk-AXBFBHS2.mjs';
2
- import { pollingApi } from '../utils/generateApi.mjs';
3
-
4
- var transactionStatus = pollingApi({
5
- methodName: "getTransactionStatusV2",
6
- path: "/v2/tx/status",
7
- method: "get"
8
- });
9
-
10
- export { transactionStatus };
1
+ export { transactionStatus } from '../chunk-C5CGY2X7.mjs';
2
+ import '../chunk-RXWDHQLG.mjs';
@@ -0,0 +1,45 @@
1
+ import { ApiState, createRequestClient } from './chunk-RXWDHQLG.mjs';
2
+
3
+ // src/public-functions/setApiOptions.ts
4
+ var setApiOptions = (options = {}) => {
5
+ ApiState.client = createRequestClient({
6
+ baseUrl: options.apiUrl || "https://api.skip.build",
7
+ apiKey: options.apiKey
8
+ });
9
+ ApiState.setClientInitialized();
10
+ if (options.chainIdsToAffiliates) {
11
+ ApiState.cumulativeAffiliateFeeBPS = validateChainIdsToAffiliates(options.chainIdsToAffiliates);
12
+ ApiState.chainIdsToAffiliates = options.chainIdsToAffiliates;
13
+ }
14
+ return ApiState.clientInitialized;
15
+ };
16
+ function validateChainIdsToAffiliates(chainIdsToAffiliates) {
17
+ var _a;
18
+ const affiliatesArray = Object.values(chainIdsToAffiliates).map((chain) => chain.affiliates).filter((a) => a !== void 0);
19
+ const firstAffiliateBasisPointsFee = (_a = affiliatesArray[0]) == null ? void 0 : _a.reduce((acc, affiliate) => {
20
+ if (!affiliate.basisPointsFee) {
21
+ throw new Error("basisPointFee must exist in each affiliate");
22
+ }
23
+ return acc + parseInt(affiliate.basisPointsFee, 10);
24
+ }, 0);
25
+ const allBasisPointsAreEqual = affiliatesArray.every((affiliate) => {
26
+ const totalBasisPointsFee = affiliate.reduce((acc, affiliate2) => {
27
+ if (!affiliate2.basisPointsFee) {
28
+ throw new Error("basisPointFee must exist in each affiliate");
29
+ }
30
+ if (!affiliate2.address) {
31
+ throw new Error("address to receive fee must exist in each affiliate");
32
+ }
33
+ return acc + parseInt(affiliate2 == null ? void 0 : affiliate2.basisPointsFee, 10);
34
+ }, 0);
35
+ return totalBasisPointsFee === firstAffiliateBasisPointsFee;
36
+ });
37
+ if (!allBasisPointsAreEqual) {
38
+ throw new Error(
39
+ "basisPointFee does not add up to the same number for each chain in chainIdsToAffiliates"
40
+ );
41
+ }
42
+ return firstAffiliateBasisPointsFee == null ? void 0 : firstAffiliateBasisPointsFee.toFixed(0);
43
+ }
44
+
45
+ export { setApiOptions };
@@ -0,0 +1,99 @@
1
+ import { DEFAULT_GAS_DENOM_OVERRIDES } from './chunk-ZAF3Z56R.mjs';
2
+ import { chains } from './chunk-NU7MCJOK.mjs';
3
+ import { ClientState } from './chunk-DKIWPD5I.mjs';
4
+ import { __async } from './chunk-RXWDHQLG.mjs';
5
+
6
+ // src/private-functions/getDefaultGasTokenForChain.ts
7
+ var getDefaultGasTokenForChain = (chainId) => __async(void 0, null, function* () {
8
+ var _a;
9
+ const gasDenom = DEFAULT_GAS_DENOM_OVERRIDES[chainId];
10
+ if (gasDenom) {
11
+ return gasDenom;
12
+ }
13
+ const chain = chains().find((chain2) => chain2.chain_id === chainId);
14
+ if (!chain) {
15
+ return void 0;
16
+ }
17
+ if (!chain.fees) {
18
+ return void 0;
19
+ }
20
+ const stakingTokens = getStakingTokensForChain(chainId);
21
+ if (stakingTokens && stakingTokens.length > 0) {
22
+ const feeAsset = chain.fees.fee_tokens.find(
23
+ (feeToken) => {
24
+ var _a2;
25
+ return feeToken.denom === ((_a2 = stakingTokens[0]) == null ? void 0 : _a2.denom);
26
+ }
27
+ );
28
+ if (feeAsset) {
29
+ return feeAsset.denom;
30
+ }
31
+ }
32
+ const nonIBCAsset = chain.fees.fee_tokens.find(
33
+ (token) => !token.denom.startsWith("ibc/") && !token.denom.startsWith("l2/")
34
+ );
35
+ if (nonIBCAsset) {
36
+ return nonIBCAsset.denom;
37
+ }
38
+ const nonL2Asset = chain.fees.fee_tokens.find((token) => !token.denom.startsWith("l2/"));
39
+ if (nonL2Asset) {
40
+ return nonL2Asset.denom;
41
+ }
42
+ return (_a = chain.fees.fee_tokens[0]) == null ? void 0 : _a.denom;
43
+ });
44
+ var getStakingTokensForChain = (chainId) => {
45
+ const chain = chains().find((chain2) => chain2.chain_id === chainId);
46
+ if (!chain) {
47
+ throw new Error(
48
+ `getStakingTokensForChain error: failed to find chain id '${chainId}' in registry`
49
+ );
50
+ }
51
+ if (!chain.staking) {
52
+ return void 0;
53
+ }
54
+ return chain.staking.staking_tokens;
55
+ };
56
+
57
+ // src/public-functions/getFeeInfoForChain.ts
58
+ var getFeeInfoForChain = (_0) => __async(void 0, [_0], function* ({ chainId, apiUrl, apiKey }) {
59
+ var _a, _b, _c, _d, _e;
60
+ const skipChains = yield ClientState.getSkipChains({ apiUrl, apiKey });
61
+ const skipChain = skipChains.find((chain2) => chain2.chainId === chainId);
62
+ if (!skipChain) {
63
+ return void 0;
64
+ }
65
+ const defaultGasToken = yield getDefaultGasTokenForChain(chainId);
66
+ if (!defaultGasToken && !skipChain.feeAssets) {
67
+ return void 0;
68
+ }
69
+ const skipFeeInfo = defaultGasToken ? (_a = skipChain.feeAssets) == null ? void 0 : _a.find((skipFee) => skipFee.denom === defaultGasToken) : (_b = skipChain.feeAssets) == null ? void 0 : _b[0];
70
+ if (!skipFeeInfo && ((_d = (_c = skipChain.feeAssets) == null ? void 0 : _c[0]) == null ? void 0 : _d.gasPrice) !== null) {
71
+ return (_e = skipChain.feeAssets) == null ? void 0 : _e[0];
72
+ }
73
+ if (skipFeeInfo && skipFeeInfo.gasPrice !== null) {
74
+ return skipFeeInfo;
75
+ }
76
+ const chain = chains().find((chain2) => chain2.chain_id === chainId);
77
+ if (!chain) {
78
+ return void 0;
79
+ }
80
+ if (!chain.fees) {
81
+ return void 0;
82
+ }
83
+ const registryFeeInfo = chain.fees.fee_tokens.find(
84
+ (feeToken) => feeToken.denom === defaultGasToken
85
+ );
86
+ if (!registryFeeInfo) {
87
+ return void 0;
88
+ }
89
+ return {
90
+ denom: registryFeeInfo.denom,
91
+ gasPrice: {
92
+ low: registryFeeInfo.low_gas_price ? `${registryFeeInfo.low_gas_price}` : "",
93
+ average: registryFeeInfo.average_gas_price ? `${registryFeeInfo.average_gas_price}` : "",
94
+ high: registryFeeInfo.high_gas_price ? `${registryFeeInfo.high_gas_price}` : ""
95
+ }
96
+ };
97
+ });
98
+
99
+ export { getFeeInfoForChain };
@@ -0,0 +1,15 @@
1
+ import { __async, __spreadProps, __spreadValues, ApiState, api } from './chunk-RXWDHQLG.mjs';
2
+
3
+ // src/api/postRoute.ts
4
+ var route = (request) => __async(void 0, null, function* () {
5
+ const requestWithAffiliateFeeBps = __spreadProps(__spreadValues({}, request), {
6
+ cumulativeAffiliateFeeBps: ApiState.cumulativeAffiliateFeeBPS
7
+ });
8
+ return api({
9
+ methodName: "getRouteV2",
10
+ method: "post",
11
+ path: "/v2/fungible/route"
12
+ })(requestWithAffiliateFeeBps);
13
+ });
14
+
15
+ export { route };
@@ -0,0 +1,13 @@
1
+ import { api } from './chunk-RXWDHQLG.mjs';
2
+
3
+ // src/api/postRecommendAssets.ts
4
+ var recommendAssets = api({
5
+ methodName: "getAssetRecommendations",
6
+ method: "post",
7
+ path: "/v2/fungible/recommend_assets",
8
+ transformResponse(response) {
9
+ return response.recommendationEntries;
10
+ }
11
+ });
12
+
13
+ export { recommendAssets };