@skip-go/client 1.1.4 → 1.1.6

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 (79) hide show
  1. package/dist/api/getAssets.d.ts +1 -1
  2. package/dist/api/getAssets.js +3 -2
  3. package/dist/api/getAssetsBetweenChains.d.ts +1 -1
  4. package/dist/api/getAssetsBetweenChains.js +3 -2
  5. package/dist/api/getBridges.d.ts +1 -1
  6. package/dist/api/getBridges.js +3 -2
  7. package/dist/api/getChains.d.ts +1 -1
  8. package/dist/api/getChains.js +3 -2
  9. package/dist/api/getVenues.js +3 -2
  10. package/dist/api/postAssetsFromSource.d.ts +1 -1
  11. package/dist/api/postAssetsFromSource.js +4 -3
  12. package/dist/api/postBalances.d.ts +2 -2
  13. package/dist/api/postBalances.js +3 -2
  14. package/dist/api/postIbcOriginAssets.js +3 -2
  15. package/dist/api/postMessages.d.ts +6 -473
  16. package/dist/api/postMessages.js +3 -2
  17. package/dist/api/postMessagesDirect.d.ts +5 -1
  18. package/dist/api/postMessagesDirect.js +3 -2
  19. package/dist/api/postRecommendAssets.d.ts +1 -1
  20. package/dist/api/postRecommendAssets.js +3 -2
  21. package/dist/api/postRoute.d.ts +6 -2
  22. package/dist/api/postRoute.js +3 -2
  23. package/dist/api/postSubmit.d.ts +17 -0
  24. package/dist/api/postSubmit.js +3 -0
  25. package/dist/api/postSubmitTransaction.js +3 -2
  26. package/dist/api/postTrackTransaction.js +3 -2
  27. package/dist/api/postTransactionStatus.d.ts +2 -2
  28. package/dist/api/postTransactionStatus.js +3 -2
  29. package/dist/callbacks-BGRu2Ule.d.ts +33 -0
  30. package/dist/chunk-25FJ6EBA.js +36 -0
  31. package/dist/{chunk-4TKPLI5S.js → chunk-2YP6FMPV.js} +1 -1
  32. package/dist/{chunk-MB5ENUER.js → chunk-5QPGL2BH.js} +1 -1
  33. package/dist/{chunk-H6RXHDUX.js → chunk-5WMPFEIQ.js} +1 -1
  34. package/dist/{chunk-R2N4D2PY.js → chunk-C4URP37X.js} +1 -1
  35. package/dist/{chunk-7P6AOFMX.js → chunk-CRTTBUO4.js} +1 -1
  36. package/dist/{chunk-LJSGCCOX.js → chunk-DAR753BM.js} +1 -1
  37. package/dist/chunk-DU3RX43W.js +34 -0
  38. package/dist/chunk-DV3I2S3T.js +181 -0
  39. package/dist/chunk-GV2QOWB4.js +26 -0
  40. package/dist/{chunk-R3KHKN33.js → chunk-IWW34V4S.js} +1 -1
  41. package/dist/{chunk-PZM2IB6H.js → chunk-JZBFAMHE.js} +1 -1
  42. package/dist/{chunk-GTJ2EDUG.js → chunk-KKNOCIFN.js} +2 -2
  43. package/dist/{chunk-EAUM5JYS.js → chunk-NWC6BSNB.js} +1 -1
  44. package/dist/{chunk-R4PWQNPU.js → chunk-NXNVAUER.js} +18 -351
  45. package/dist/{chunk-2NYWLY5S.js → chunk-PPUUN7FI.js} +1 -1
  46. package/dist/{chunk-5EU3SRDQ.js → chunk-RCSN7BAU.js} +2 -2
  47. package/dist/{chunk-KWVMUF5R.js → chunk-RFZBKQ35.js} +1 -1
  48. package/dist/{chunk-WWDCZAB5.js → chunk-RYOVQFZO.js} +1 -1
  49. package/dist/{chunk-BCN2WD5Q.js → chunk-T7GKUROO.js} +1 -1
  50. package/dist/chunk-TV2XPAIF.js +295 -0
  51. package/dist/{chunk-VRPPVMXO.js → chunk-U6XZFJW2.js} +1 -1
  52. package/dist/{chunk-SOGMQT4H.js → chunk-UXUJNZOA.js} +1 -181
  53. package/dist/chunk-X67P5URV.js +10 -0
  54. package/dist/{chunk-RL5AVCSG.js → chunk-XXJUDZKJ.js} +1 -1
  55. package/dist/{client-types-B_ihV5t6.d.ts → client-types-BkeR6R_z.d.ts} +1 -1
  56. package/dist/{generateApi-CpUxWvEf.d.ts → generateApi-8YPJU-Al.d.ts} +1 -1
  57. package/dist/index.d.ts +13 -5
  58. package/dist/index.js +26 -21
  59. package/dist/public-functions/executeRoute.d.ts +40 -4
  60. package/dist/public-functions/executeRoute.js +15 -10
  61. package/dist/public-functions/getCosmosGasAmountForMessage.d.ts +8 -0
  62. package/dist/public-functions/getCosmosGasAmountForMessage.js +2 -0
  63. package/dist/public-functions/getEvmGasAmountForMessage.d.ts +11 -0
  64. package/dist/public-functions/getEvmGasAmountForMessage.js +2 -0
  65. package/dist/public-functions/getFeeInfoForChain.d.ts +1 -1
  66. package/dist/public-functions/getFeeInfoForChain.js +4 -3
  67. package/dist/public-functions/getRecommendedGasPrice.js +5 -4
  68. package/dist/public-functions/getSigningStargateClient.js +4 -3
  69. package/dist/public-functions/setApiOptions.d.ts +1 -1
  70. package/dist/public-functions/setApiOptions.js +3 -2
  71. package/dist/public-functions/setClientOptions.d.ts +3 -3
  72. package/dist/public-functions/setClientOptions.js +4 -3
  73. package/dist/public-functions/waitForTransaction.d.ts +621 -0
  74. package/dist/public-functions/waitForTransaction.js +5 -0
  75. package/dist/{setClientOptions-C4rwBrB4.d.ts → setClientOptions-CI_7IPLT.d.ts} +1 -1
  76. package/dist/{swaggerTypes-sZ9ALP9m.d.ts → swaggerTypes-CAERZYPb.d.ts} +4 -1
  77. package/package.json +1 -1
  78. package/dist/chunk-7FSLD7Y4.js +0 -10
  79. package/dist/executeRoute-Bob9mV8C.d.ts +0 -69
@@ -0,0 +1,295 @@
1
+ import { MsgDepositForBurn, MsgDepositForBurnWithCaller, MsgExecute, MsgInitiateTokenDeposit, BaseVestingAccount, Timestamp, toTimestamp, Period, fromTimestamp, isSet, fromJsonTimestamp } from './chunk-TD63P2AG.js';
2
+ import '@cosmjs/stargate';
3
+ import { toUtf8 } from '@cosmjs/encoding';
4
+ import { MsgTransfer as MsgTransfer$1, MsgExecuteContractCompat } from '@injectivelabs/sdk-ts';
5
+ import { MsgSend } from 'cosmjs-types/cosmos/bank/v1beta1/tx.js';
6
+ import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx.js';
7
+ import { MsgTransfer } from 'cosmjs-types/ibc/applications/transfer/v1/tx.js';
8
+ import _m0 from 'protobufjs/minimal.js';
9
+
10
+ function createBaseClawbackVestingAccount() {
11
+ return {
12
+ baseVestingAccount: void 0,
13
+ funderAddress: "",
14
+ startTime: /* @__PURE__ */ new Date(),
15
+ lockupPeriods: [],
16
+ vestingPeriods: []
17
+ };
18
+ }
19
+ var ClawbackVestingAccount = {
20
+ typeUrl: "/evmos.vesting.v2.ClawbackVestingAccount",
21
+ encode(message, writer = _m0.Writer.create()) {
22
+ if (message.baseVestingAccount !== void 0) {
23
+ BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim();
24
+ }
25
+ if (message.funderAddress !== "") {
26
+ writer.uint32(18).string(message.funderAddress);
27
+ }
28
+ if (message.startTime !== void 0) {
29
+ Timestamp.encode(toTimestamp(message.startTime), writer.uint32(26).fork()).ldelim();
30
+ }
31
+ for (const v of message.lockupPeriods) {
32
+ Period.encode(v, writer.uint32(34).fork()).ldelim();
33
+ }
34
+ for (const v of message.vestingPeriods) {
35
+ Period.encode(v, writer.uint32(42).fork()).ldelim();
36
+ }
37
+ return writer;
38
+ },
39
+ decode(input, length) {
40
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
41
+ let end = length === void 0 ? reader.len : reader.pos + length;
42
+ const message = createBaseClawbackVestingAccount();
43
+ while (reader.pos < end) {
44
+ const tag = reader.uint32();
45
+ switch (tag >>> 3) {
46
+ case 1:
47
+ message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32());
48
+ break;
49
+ case 2:
50
+ message.funderAddress = reader.string();
51
+ break;
52
+ case 3:
53
+ message.startTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
54
+ break;
55
+ case 4:
56
+ message.lockupPeriods.push(Period.decode(reader, reader.uint32()));
57
+ break;
58
+ case 5:
59
+ message.vestingPeriods.push(Period.decode(reader, reader.uint32()));
60
+ break;
61
+ default:
62
+ reader.skipType(tag & 7);
63
+ break;
64
+ }
65
+ }
66
+ return message;
67
+ },
68
+ fromJSON(object) {
69
+ return {
70
+ baseVestingAccount: isSet(object.baseVestingAccount) ? BaseVestingAccount.fromJSON(object.baseVestingAccount) : void 0,
71
+ funderAddress: isSet(object.funderAddress) ? String(object.funderAddress) : "",
72
+ startTime: isSet(object.startTime) ? fromJsonTimestamp(object.startTime) : void 0,
73
+ lockupPeriods: Array.isArray(object?.lockupPeriods) ? object.lockupPeriods.map((e) => Period.fromJSON(e)) : [],
74
+ vestingPeriods: Array.isArray(object?.vestingPeriods) ? object.vestingPeriods.map((e) => Period.fromJSON(e)) : []
75
+ };
76
+ },
77
+ toJSON(message) {
78
+ const obj = {};
79
+ message.baseVestingAccount !== void 0 && (obj.baseVestingAccount = message.baseVestingAccount ? BaseVestingAccount.toJSON(message.baseVestingAccount) : void 0);
80
+ message.funderAddress !== void 0 && (obj.funderAddress = message.funderAddress);
81
+ message.startTime !== void 0 && (obj.startTime = message.startTime.toISOString());
82
+ if (message.lockupPeriods) {
83
+ obj.lockupPeriods = message.lockupPeriods.map((e) => e ? Period.toJSON(e) : void 0);
84
+ } else {
85
+ obj.lockupPeriods = [];
86
+ }
87
+ if (message.vestingPeriods) {
88
+ obj.vestingPeriods = message.vestingPeriods.map((e) => e ? Period.toJSON(e) : void 0);
89
+ } else {
90
+ obj.vestingPeriods = [];
91
+ }
92
+ return obj;
93
+ },
94
+ fromPartial(object) {
95
+ const message = createBaseClawbackVestingAccount();
96
+ message.baseVestingAccount = object.baseVestingAccount !== void 0 && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : void 0;
97
+ message.funderAddress = object.funderAddress ?? "";
98
+ message.startTime = object.startTime ?? void 0;
99
+ message.lockupPeriods = object.lockupPeriods?.map((e) => Period.fromPartial(e)) || [];
100
+ message.vestingPeriods = object.vestingPeriods?.map((e) => Period.fromPartial(e)) || [];
101
+ return message;
102
+ },
103
+ fromAmino(object) {
104
+ const message = createBaseClawbackVestingAccount();
105
+ if (object.base_vesting_account !== void 0 && object.base_vesting_account !== null) {
106
+ message.baseVestingAccount = BaseVestingAccount.fromAmino(object.base_vesting_account);
107
+ }
108
+ if (object.funder_address !== void 0 && object.funder_address !== null) {
109
+ message.funderAddress = object.funder_address;
110
+ }
111
+ if (object.start_time !== void 0 && object.start_time !== null) {
112
+ message.startTime = fromTimestamp(Timestamp.fromAmino(object.start_time));
113
+ }
114
+ message.lockupPeriods = object.lockup_periods?.map((e) => Period.fromAmino(e)) || [];
115
+ message.vestingPeriods = object.vesting_periods?.map((e) => Period.fromAmino(e)) || [];
116
+ return message;
117
+ },
118
+ toAmino(message) {
119
+ const obj = {};
120
+ obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : void 0;
121
+ obj.funder_address = message.funderAddress === "" ? void 0 : message.funderAddress;
122
+ obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : void 0;
123
+ if (message.lockupPeriods) {
124
+ obj.lockup_periods = message.lockupPeriods.map((e) => e ? Period.toAmino(e) : void 0);
125
+ } else {
126
+ obj.lockup_periods = message.lockupPeriods;
127
+ }
128
+ if (message.vestingPeriods) {
129
+ obj.vesting_periods = message.vestingPeriods.map((e) => e ? Period.toAmino(e) : void 0);
130
+ } else {
131
+ obj.vesting_periods = message.vestingPeriods;
132
+ }
133
+ return obj;
134
+ },
135
+ fromAminoMsg(object) {
136
+ return ClawbackVestingAccount.fromAmino(object.value);
137
+ },
138
+ toAminoMsg(message) {
139
+ return {
140
+ type: "vesting/ClawbackVestingAccount",
141
+ value: ClawbackVestingAccount.toAmino(message)
142
+ };
143
+ },
144
+ fromProtoMsg(message) {
145
+ return ClawbackVestingAccount.decode(message.value);
146
+ },
147
+ toProto(message) {
148
+ return ClawbackVestingAccount.encode(message).finish();
149
+ },
150
+ toProtoMsg(message) {
151
+ return {
152
+ typeUrl: "/evmos.vesting.v2.ClawbackVestingAccount",
153
+ value: ClawbackVestingAccount.encode(message).finish()
154
+ };
155
+ }
156
+ };
157
+
158
+ // src/private-functions/cosmos/getEncodeObjectFromCosmosMessage.ts
159
+ function getEncodeObjectFromCosmosMessage(message) {
160
+ const msgJson = JSON.parse(message.msg ?? "");
161
+ if (message.msgTypeUrl === "/ibc.applications.transfer.v1.MsgTransfer") {
162
+ return {
163
+ typeUrl: "/ibc.applications.transfer.v1.MsgTransfer",
164
+ value: MsgTransfer.fromJSON({
165
+ sourcePort: msgJson.source_port,
166
+ sourceChannel: msgJson.source_channel,
167
+ token: msgJson.token,
168
+ sender: msgJson.sender,
169
+ receiver: msgJson.receiver,
170
+ timeoutHeight: msgJson.timeout_height,
171
+ timeoutTimestamp: msgJson.timeout_timestamp,
172
+ memo: msgJson.memo
173
+ })
174
+ };
175
+ }
176
+ if (message.msgTypeUrl === "/cosmwasm.wasm.v1.MsgExecuteContract") {
177
+ return {
178
+ typeUrl: message.msgTypeUrl,
179
+ value: MsgExecuteContract.fromPartial({
180
+ sender: msgJson.sender,
181
+ contract: msgJson.contract,
182
+ msg: toUtf8(JSON.stringify(msgJson.msg)),
183
+ funds: msgJson.funds
184
+ })
185
+ };
186
+ }
187
+ if (message.msgTypeUrl === "/cosmos.bank.v1beta1.MsgSend") {
188
+ return {
189
+ typeUrl: message.msgTypeUrl,
190
+ value: MsgSend.fromPartial({
191
+ fromAddress: msgJson.from_address,
192
+ toAddress: msgJson.to_address,
193
+ amount: msgJson.amount
194
+ })
195
+ };
196
+ }
197
+ if (message.msgTypeUrl === "/circle.cctp.v1.MsgDepositForBurn") {
198
+ return {
199
+ typeUrl: message.msgTypeUrl,
200
+ value: MsgDepositForBurn.fromAmino(msgJson)
201
+ };
202
+ }
203
+ if (message.msgTypeUrl === "/circle.cctp.v1.MsgDepositForBurnWithCaller") {
204
+ return {
205
+ typeUrl: message.msgTypeUrl,
206
+ value: MsgDepositForBurnWithCaller.fromAmino(msgJson)
207
+ };
208
+ }
209
+ if (message.msgTypeUrl === "/initia.move.v1.MsgExecute") {
210
+ return {
211
+ typeUrl: message.msgTypeUrl,
212
+ value: MsgExecute.fromPartial({
213
+ sender: msgJson.sender,
214
+ moduleAddress: msgJson.module_address,
215
+ moduleName: msgJson.module_name,
216
+ functionName: msgJson.function_name,
217
+ args: msgJson.args
218
+ })
219
+ };
220
+ }
221
+ if (message.msgTypeUrl === "/opinit.ophost.v1.MsgInitiateTokenDeposit") {
222
+ return {
223
+ typeUrl: message.msgTypeUrl,
224
+ value: MsgInitiateTokenDeposit.fromPartial({
225
+ sender: msgJson.sender,
226
+ to: msgJson.to,
227
+ amount: msgJson.amount,
228
+ bridgeId: msgJson.bridge_id
229
+ })
230
+ };
231
+ }
232
+ if (message.msgTypeUrl === "/evmos.vesting.v2.ClawbackVestingAccount") {
233
+ return {
234
+ typeUrl: message.msgTypeUrl,
235
+ value: ClawbackVestingAccount.fromPartial({
236
+ baseVestingAccount: msgJson.base_vesting_account,
237
+ funderAddress: msgJson.funder_address,
238
+ lockupPeriods: msgJson.lockup_periods,
239
+ startTime: msgJson.start_time,
240
+ vestingPeriods: msgJson.vesting_periods
241
+ })
242
+ };
243
+ }
244
+ return {
245
+ typeUrl: message.msgTypeUrl ?? "",
246
+ value: msgJson
247
+ };
248
+ }
249
+ function getEncodeObjectFromCosmosMessageInjective(message) {
250
+ const msgJson = JSON.parse(message.msg ?? "");
251
+ if (message.msgTypeUrl === "/ibc.applications.transfer.v1.MsgTransfer") {
252
+ return MsgTransfer$1.fromJSON({
253
+ port: msgJson.source_port,
254
+ channelId: msgJson.source_channel,
255
+ amount: msgJson.token,
256
+ sender: msgJson.sender,
257
+ receiver: msgJson.receiver,
258
+ timeout: msgJson.timeout_timestamp,
259
+ memo: msgJson.memo
260
+ });
261
+ }
262
+ if (message.msgTypeUrl === "/cosmwasm.wasm.v1.MsgExecuteContract") {
263
+ return MsgExecuteContractCompat.fromJSON({
264
+ sender: msgJson.sender,
265
+ contractAddress: msgJson.contract,
266
+ msg: msgJson.msg,
267
+ funds: msgJson.funds
268
+ });
269
+ }
270
+ throw new Error("Unsupported message type");
271
+ }
272
+
273
+ // src/public-functions/getCosmosGasAmountForMessage.ts
274
+ var DEFAULT_GAS_MULTIPLIER = 1.5;
275
+ async function getCosmosGasAmountForMessage(client, signerAddress, chainId, messages, encodedMsgs, multiplier = DEFAULT_GAS_MULTIPLIER) {
276
+ if (!messages && !encodedMsgs) {
277
+ throw new Error("Either message or encodedMsg must be provided");
278
+ }
279
+ const _encodedMsgs = messages?.map((message) => getEncodeObjectFromCosmosMessage(message));
280
+ encodedMsgs = encodedMsgs || _encodedMsgs;
281
+ if (!encodedMsgs) {
282
+ throw new Error("Either message or encodedMsg must be provided");
283
+ }
284
+ if (chainId.includes("evmos") || chainId.includes("injective") || chainId.includes("dymension") || process?.env.NODE_ENV === "test") {
285
+ if (messages?.find((i) => i.msgTypeUrl === "/cosmwasm.wasm.v1.MsgExecuteContract")) {
286
+ return "2400000";
287
+ }
288
+ return "280000";
289
+ }
290
+ const estimatedGas = await client.simulate(signerAddress, encodedMsgs, "");
291
+ const estimatedGasWithBuffer = estimatedGas * multiplier;
292
+ return Math.ceil(estimatedGasWithBuffer).toFixed(0);
293
+ }
294
+
295
+ export { DEFAULT_GAS_MULTIPLIER, getCosmosGasAmountForMessage, getEncodeObjectFromCosmosMessage, getEncodeObjectFromCosmosMessageInjective };
@@ -1,4 +1,4 @@
1
- import { api } from './chunk-SOGMQT4H.js';
1
+ import { api } from './chunk-DV3I2S3T.js';
2
2
 
3
3
  // src/api/getBridges.ts
4
4
  var bridges = api({
@@ -532,184 +532,4 @@ var Api = class extends HttpClient {
532
532
  });
533
533
  };
534
534
 
535
- // src/utils/convert.ts
536
- function toSnake(obj) {
537
- return convertKeys(obj, (key) => key.replace(/([A-Z])/g, "_$1").toLowerCase());
538
- }
539
- function toCamel(obj) {
540
- return convertKeys(obj, (key) => key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()));
541
- }
542
- function convertKeys(obj, convertKey) {
543
- if (Array.isArray(obj)) {
544
- return obj.map((item) => convertKeys(item, convertKey));
545
- } else if (obj !== null && typeof obj === "object") {
546
- return Object.keys(obj).reduce((acc, key) => {
547
- acc[convertKey(key)] = convertKeys(obj[key], convertKey);
548
- return acc;
549
- }, {});
550
- } else {
551
- return obj;
552
- }
553
- }
554
-
555
- // src/utils/timer.ts
556
- var wait = (ms) => {
557
- return new Promise((resolve) => setTimeout(resolve, ms));
558
- };
559
-
560
- // src/utils/generateApi.ts
561
- var createRequestClient = ({ baseUrl, apiKey }) => {
562
- const defaultHeaders = {
563
- "content-type": "application/json",
564
- ...apiKey ? { authorization: apiKey } : {}
565
- };
566
- const handleResponse = async (response) => {
567
- const contentType = response.headers.get("content-type");
568
- const isJson = contentType?.includes("application/json");
569
- const body = isJson ? await response.json() : await response.text();
570
- if (!response.ok) {
571
- const message = typeof body === "object" && body?.message ? body.message : response.statusText;
572
- throw new Error(message);
573
- }
574
- return body;
575
- };
576
- const get = async (path, params, signal) => {
577
- const url = new URL(baseUrl + (path ?? ""));
578
- if (params && typeof params === "object") {
579
- Object.entries(params).forEach(([key, value]) => {
580
- if (value !== void 0 && value !== null) {
581
- url.searchParams.append(key, String(value));
582
- }
583
- });
584
- }
585
- const response = await fetch(url.toString(), {
586
- method: "GET",
587
- headers: defaultHeaders,
588
- signal
589
- });
590
- return handleResponse(response);
591
- };
592
- const post = async (path, data = {}, signal) => {
593
- const response = await fetch(new URL(baseUrl + path).toString(), {
594
- method: "POST",
595
- headers: defaultHeaders,
596
- body: JSON.stringify(data),
597
- signal
598
- });
599
- return handleResponse(response);
600
- };
601
- return { get, post };
602
- };
603
- function createRequest({
604
- path,
605
- method = "get",
606
- onSuccess,
607
- transformResponse
608
- }) {
609
- let controller = null;
610
- const request = async (options) => {
611
- const { apiKey, apiUrl, abortDuplicateRequests, ...requestParams } = options ?? {};
612
- let fetchClient = ApiState.client;
613
- if (apiUrl || apiKey) {
614
- fetchClient = createRequestClient({
615
- baseUrl: apiUrl || "https://api.skip.build",
616
- apiKey
617
- });
618
- } else {
619
- await ApiState.clientInitialized;
620
- }
621
- if (abortDuplicateRequests && controller && !controller?.signal?.aborted) {
622
- controller?.abort();
623
- }
624
- controller = new AbortController();
625
- try {
626
- const response = await fetchClient[method](
627
- path,
628
- requestParams ? toSnake(requestParams) : void 0,
629
- controller.signal
630
- );
631
- const camelCased = toCamel(response ?? {});
632
- const finalResponse = transformResponse ? transformResponse(camelCased) : camelCased;
633
- onSuccess?.(finalResponse, requestParams);
634
- return finalResponse;
635
- } catch (error) {
636
- if (error.name === "AbortError") {
637
- console.log("Request was cancelled");
638
- } else {
639
- console.error("Error:", error);
640
- throw error;
641
- }
642
- }
643
- };
644
- return request;
645
- }
646
- function api({
647
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
648
- methodName,
649
- path,
650
- onSuccess,
651
- method = "get",
652
- transformResponse
653
- }) {
654
- return createRequest({
655
- path,
656
- method,
657
- onSuccess,
658
- transformResponse
659
- });
660
- }
661
- function pollingApi({
662
- methodName,
663
- path,
664
- method = "get",
665
- onSuccess,
666
- onError,
667
- isSuccess = () => true,
668
- maxRetries = 5,
669
- retryInterval = 1e3,
670
- backoffMultiplier = 2
671
- }) {
672
- const request = async (requestParams) => {
673
- let attempt = 0;
674
- let lastError;
675
- while (attempt < maxRetries) {
676
- try {
677
- const result = await api({ methodName, path, method })(requestParams);
678
- if (result && isSuccess(result)) {
679
- onSuccess?.(result, attempt);
680
- return result;
681
- }
682
- } catch (err) {
683
- lastError = err;
684
- onError?.(err, attempt);
685
- }
686
- const delay = retryInterval * Math.pow(backoffMultiplier, attempt);
687
- await wait(delay);
688
- attempt++;
689
- }
690
- throw lastError ?? new Error("pollingApi: max retries exceeded");
691
- };
692
- return (params) => request(params);
693
- }
694
-
695
- // src/state/apiState.ts
696
- var ApiState = class _ApiState {
697
- static client;
698
- static chainIdsToAffiliates;
699
- static cumulativeAffiliateFeeBPS = "0";
700
- static isInitialized = false;
701
- static resolveInitialization;
702
- static clientInitialized = new Promise((resolve) => {
703
- _ApiState.resolveInitialization = () => {
704
- if (!_ApiState.isInitialized) {
705
- _ApiState.isInitialized = true;
706
- resolve();
707
- }
708
- };
709
- });
710
- static setClientInitialized() {
711
- _ApiState.resolveInitialization();
712
- }
713
- };
714
-
715
- export { Api, ApiState, AutopilotAction, AxelarTransferState, AxelarTransferType, BridgeType, CCTPTransferState, ChainType, ContentType, ContractCallWithTokenErrorType, FeeType, GoFastTransferState, HttpClient, HyperlaneTransferState, LayerZeroTransferState, OPInitTransferState, PacketErrorType, Reason, RoutePriceWarningType, SendTokenErrorType, StargateTransferState, StatusErrorType, TransactionState, TransferState, api, createRequestClient, pollingApi, toCamel, wait };
535
+ export { Api, AutopilotAction, AxelarTransferState, AxelarTransferType, BridgeType, CCTPTransferState, ChainType, ContentType, ContractCallWithTokenErrorType, FeeType, GoFastTransferState, HttpClient, HyperlaneTransferState, LayerZeroTransferState, OPInitTransferState, PacketErrorType, Reason, RoutePriceWarningType, SendTokenErrorType, StargateTransferState, StatusErrorType, TransactionState, TransferState };
@@ -0,0 +1,10 @@
1
+ import { api } from './chunk-DV3I2S3T.js';
2
+
3
+ // src/api/postSubmit.ts
4
+ var submit = api({
5
+ methodName: "submit",
6
+ method: "post",
7
+ path: "/v2/tx/submit"
8
+ });
9
+
10
+ export { submit };
@@ -1,4 +1,4 @@
1
- import { api } from './chunk-SOGMQT4H.js';
1
+ import { api } from './chunk-DV3I2S3T.js';
2
2
 
3
3
  // src/api/getVenues.ts
4
4
  var venues = api({
@@ -3,7 +3,7 @@ import { OfflineDirectSigner } from '@cosmjs/proto-signing';
3
3
  import { StdFee, GasPrice, SignerData } from '@cosmjs/stargate';
4
4
  import { WalletClient } from 'viem';
5
5
  import { Adapter } from '@solana/wallet-adapter-base';
6
- import { a3 as FeeAsset, L as ChainType, W as CosmosMsg } from './swaggerTypes-sZ9ALP9m.js';
6
+ import { a3 as FeeAsset, L as ChainType, W as CosmosMsg } from './swaggerTypes-CAERZYPb.js';
7
7
 
8
8
  /** Common Types */
9
9
  type UserAddress = {
@@ -1,4 +1,4 @@
1
- import { bw as Api } from './swaggerTypes-sZ9ALP9m.js';
1
+ import { bv as Api } from './swaggerTypes-CAERZYPb.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 ? {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { A as AcknowledgementErrorDetails, a as Affiliate, bw as Api, bs as ApiConfig, b as ApiError, c as Asset, d as AssetBetweenChains, e as AssetRecommendation, bh as AssetRecommendationsResponse, bd as AssetsFromSourceResponse, bb as AssetsRequest, bc as AssetsResponse, f as AutopilotAction, g as AutopilotMsg, h as AutopilotMsgWrapper, i as AxelarTransfer, j as AxelarTransferInfo, k as AxelarTransferState, l as AxelarTransferType, m as AxelarTransferWrapper, B as BalanceRequestChainEntry, E as BalanceResponseChainEntry, D as BalanceResponseDenomEntry, b7 as BalancesResponse, F as BankSend, H as BankSendWrapper, I as Bridge, J as BridgeType, b8 as BridgesResponse, C as CCTPTransfer, n as CCTPTransferInfo, p as CCTPTransferState, o as CCTPTransferTxs, q as CCTPTransferWrapper, K as Chain, M as ChainAffiliates, am as ChainTransaction, L as ChainType, b5 as ChainsRequest, b6 as ChainsResponse, bu as ContentType, N as ContractCallWithTokenError, O as ContractCallWithTokenErrorType, P as ContractCallWithTokenTxs, Q as CosmWasmContractMsg, R as CosmWasmContractMsgWrapper, b1 as CosmosModuleSupport, W as CosmosMsg, X as CosmosTx, Y as CosmosTxWrapper, T as Erc20Approval, V as Error, U as ErrorDetail, aW as EurekaTransfer, aX as EurekaTransferInfo, aY as EurekaTransferWrapper, Z as EvmSwap, _ as EvmSwapWrapper, $ as EvmTx, a0 as EvmTxWrapper, b4 as Fee, a3 as FeeAsset, b3 as FeeType, bq as FullRequestParams, bn as FungibleAssetsBetweenChainsCreateResponse, a5 as GRPCStatusCode, a4 as GoFastFee, G as GoFastTransfer, y as GoFastTransferInfo, w as GoFastTransferState, x as GoFastTransferTxs, z as GoFastTransferWrapper, bv as HttpClient, bt as HttpResponse, a6 as HyperlaneTransfer, a7 as HyperlaneTransferInfo, a8 as HyperlaneTransferState, a9 as HyperlaneTransferTransactions, aa as HyperlaneTransferWrapper, ab as IBCTransferInfo, b2 as IbcCapabilities, bm as IbcOriginAssetsResponse, aZ as LayerZeroTransfer, a_ as LayerZeroTransferInfo, aP as LayerZeroTransferState, ai as LayerZeroTransferTransactions, a$ as LayerZeroTransferWrapper, ac as Msg, bg as MsgsDirectResponse, bf as MsgsResponse, ae as MultiChainMsg, af as MultiChainMsgWrapper, aK as OPInitTransfer, aM as OPInitTransferInfo, aO as OPInitTransferState, aN as OPInitTransferTxs, aL as OPInitTransferWrapper, ag as Operation, ah as OptionalAsset, aj as Packet, ak as PacketError, al as PacketErrorType, an as PostHandler, bo as QueryParamsType, ao as Reason, b0 as RecommendationRequest, br as RequestParams, bp as ResponseFormat, aq as Route, ap as RoutePriceWarningType, be as RouteResponse, ar as SendTokenError, as as SendTokenErrorType, at as SendTokenTxs, S as SmartRelayFeeQuote, aD as SmartSwapExactCoinIn, aF as SmartSwapInWrapper, aE as SmartSwapOptions, r as StargateTransfer, u as StargateTransferInfo, s as StargateTransferState, t as StargateTransferTxs, v as StargateTransferWrapper, au as StatusError, av as StatusErrorType, bk as StatusRequest, bl as StatusResponse, bi as SubmitResponse, a1 as SvmTx, a2 as SvmTxWrapper, aw as Swap, ax as SwapExactCoinIn, ay as SwapExactCoinOut, az as SwapInWrapper, aA as SwapOperation, aB as SwapOutWrapper, aC as SwapRoute, aG as SwapVenue, aH as SwapWrapper, bj as TrackResponse, aI as TransactionExecutionErrorDetails, aJ as TransactionState, aQ as Transfer, aT as TransferAssetRelease, aR as TransferEvent, aS as TransferState, aU as TransferStatus, aV as TransferWrapper, ad as Tx, b9 as VenuesRequest, ba as VenuesResponse } from './swaggerTypes-sZ9ALP9m.js';
2
- export { E as ExecuteRouteOptions, T as TransactionCallbacks, e as executeRoute } from './executeRoute-Bob9mV8C.js';
3
- export { E as EndpointOptions, b as GasOptions, G as GetFallbackGasAmount, a as GetGasPrice, e as SignCosmosMessageAminoOptions, d as SignCosmosMessageDirectOptions, c as SignCosmosMessageOptionsBase, S as SignerGetters, T as TxResult, U as UserAddress, V as ValidateGasResult } from './client-types-B_ihV5t6.js';
1
+ export { A as AcknowledgementErrorDetails, a as Affiliate, bv as Api, br as ApiConfig, b as ApiError, c as Asset, d as AssetBetweenChains, e as AssetRecommendation, bh as AssetRecommendationsResponse, bd as AssetsFromSourceResponse, bb as AssetsRequest, bc as AssetsResponse, f as AutopilotAction, g as AutopilotMsg, h as AutopilotMsgWrapper, i as AxelarTransfer, j as AxelarTransferInfo, k as AxelarTransferState, l as AxelarTransferType, m as AxelarTransferWrapper, B as BalanceRequestChainEntry, E as BalanceResponseChainEntry, D as BalanceResponseDenomEntry, b7 as BalancesResponse, F as BankSend, H as BankSendWrapper, I as Bridge, J as BridgeType, b8 as BridgesResponse, C as CCTPTransfer, n as CCTPTransferInfo, p as CCTPTransferState, o as CCTPTransferTxs, q as CCTPTransferWrapper, K as Chain, M as ChainAffiliates, am as ChainTransaction, L as ChainType, b5 as ChainsRequest, b6 as ChainsResponse, bt as ContentType, N as ContractCallWithTokenError, O as ContractCallWithTokenErrorType, P as ContractCallWithTokenTxs, Q as CosmWasmContractMsg, R as CosmWasmContractMsgWrapper, b1 as CosmosModuleSupport, W as CosmosMsg, X as CosmosTx, Y as CosmosTxWrapper, T as Erc20Approval, V as Error, U as ErrorDetail, aW as EurekaTransfer, aX as EurekaTransferInfo, aY as EurekaTransferWrapper, Z as EvmSwap, _ as EvmSwapWrapper, $ as EvmTx, a0 as EvmTxWrapper, b4 as Fee, a3 as FeeAsset, b3 as FeeType, bp as FullRequestParams, bm as FungibleAssetsBetweenChainsCreateResponse, a5 as GRPCStatusCode, a4 as GoFastFee, G as GoFastTransfer, y as GoFastTransferInfo, w as GoFastTransferState, x as GoFastTransferTxs, z as GoFastTransferWrapper, bu as HttpClient, bs as HttpResponse, a6 as HyperlaneTransfer, a7 as HyperlaneTransferInfo, a8 as HyperlaneTransferState, a9 as HyperlaneTransferTransactions, aa as HyperlaneTransferWrapper, ab as IBCTransferInfo, b2 as IbcCapabilities, bl as IbcOriginAssetsResponse, aZ as LayerZeroTransfer, a_ as LayerZeroTransferInfo, aP as LayerZeroTransferState, ai as LayerZeroTransferTransactions, a$ as LayerZeroTransferWrapper, ac as Msg, bg as MsgsDirectResponse, bf as MsgsResponse, ae as MultiChainMsg, af as MultiChainMsgWrapper, aK as OPInitTransfer, aM as OPInitTransferInfo, aO as OPInitTransferState, aN as OPInitTransferTxs, aL as OPInitTransferWrapper, ag as Operation, ah as OptionalAsset, aj as Packet, ak as PacketError, al as PacketErrorType, an as PostHandler, bn as QueryParamsType, ao as Reason, b0 as RecommendationRequest, bq as RequestParams, bo as ResponseFormat, aq as Route, ap as RoutePriceWarningType, be as RouteResponse, ar as SendTokenError, as as SendTokenErrorType, at as SendTokenTxs, S as SmartRelayFeeQuote, aD as SmartSwapExactCoinIn, aF as SmartSwapInWrapper, aE as SmartSwapOptions, r as StargateTransfer, u as StargateTransferInfo, s as StargateTransferState, t as StargateTransferTxs, v as StargateTransferWrapper, au as StatusError, av as StatusErrorType, bj as StatusRequest, bk as StatusResponse, a1 as SvmTx, a2 as SvmTxWrapper, aw as Swap, ax as SwapExactCoinIn, ay as SwapExactCoinOut, az as SwapInWrapper, aA as SwapOperation, aB as SwapOutWrapper, aC as SwapRoute, aG as SwapVenue, aH as SwapWrapper, bi as TrackResponse, aI as TransactionExecutionErrorDetails, aJ as TransactionState, aQ as Transfer, aT as TransferAssetRelease, aR as TransferEvent, aS as TransferState, aU as TransferStatus, aV as TransferWrapper, ad as Tx, b9 as VenuesRequest, ba as VenuesResponse } from './swaggerTypes-CAERZYPb.js';
2
+ export { T as TransactionCallbacks } from './callbacks-BGRu2Ule.js';
3
+ export { E as EndpointOptions, b as GasOptions, G as GetFallbackGasAmount, a as GetGasPrice, e as SignCosmosMessageAminoOptions, d as SignCosmosMessageDirectOptions, c as SignCosmosMessageOptionsBase, S as SignerGetters, T as TxResult, U as UserAddress, V as ValidateGasResult } from './client-types-BkeR6R_z.js';
4
4
  export { assets } from './api/getAssets.js';
5
5
  export { assetsBetweenChains } from './api/getAssetsBetweenChains.js';
6
6
  export { bridges } from './api/getBridges.js';
@@ -16,18 +16,23 @@ export { RouteRequest, route } from './api/postRoute.js';
16
16
  export { submitTransaction } from './api/postSubmitTransaction.js';
17
17
  export { trackTransaction } from './api/postTrackTransaction.js';
18
18
  export { TxStatusResponse, transactionStatus } from './api/postTransactionStatus.js';
19
+ export { ExecuteRouteOptions, executeRoute } from './public-functions/executeRoute.js';
19
20
  export { getSigningStargateClient, getSigningStargateClientProps } from './public-functions/getSigningStargateClient.js';
20
- export { S as SkipClientOptions, s as setClientOptions } from './setClientOptions-C4rwBrB4.js';
21
+ export { S as SkipClientOptions, s as setClientOptions } from './setClientOptions-CI_7IPLT.js';
21
22
  export { getRecommendedGasPrice } from './public-functions/getRecommendedGasPrice.js';
22
23
  export { getFeeInfoForChain } from './public-functions/getFeeInfoForChain.js';
23
24
  export { SetApiOptionsProps, setApiOptions } from './public-functions/setApiOptions.js';
24
- import './generateApi-CpUxWvEf.js';
25
+ export { waitForTransaction } from './public-functions/waitForTransaction.js';
26
+ export { getCosmosGasAmountForMessage } from './public-functions/getCosmosGasAmountForMessage.js';
27
+ export { getEVMGasAmountForMessage } from './public-functions/getEvmGasAmountForMessage.js';
28
+ export { SubmitRequest, SubmitResponse, submit } from './api/postSubmit.js';
25
29
  import '@cosmjs/amino';
26
30
  import '@cosmjs/proto-signing';
27
31
  import '@cosmjs/stargate';
28
32
  import 'viem';
29
33
  import '@solana/wallet-adapter-base';
30
34
  import './apiState-CdzxTxYd.js';
35
+ import './generateApi-8YPJU-Al.js';
31
36
 
32
37
  interface AcknowledgementErrorDetailsJson {
33
38
  /** Error code */
@@ -1180,6 +1185,9 @@ interface TransferJson {
1180
1185
  denom_out?: string;
1181
1186
  /** Amount of the fee asset to be paid as the transfer fee if applicable. */
1182
1187
  fee_amount?: string | null;
1188
+ /** Address of the entry contract on the destination chain */
1189
+ to_chain_entry_contract_address?: string | null;
1190
+ to_chain_callback_contract_address?: string | null;
1183
1191
  /** Amount of the fee asset to be paid as the transfer fee if applicable, converted to USD value */
1184
1192
  usd_fee_amount?: string | null;
1185
1193
  /** Asset to be paid as the transfer fee if applicable. */
package/dist/index.js CHANGED
@@ -1,27 +1,32 @@
1
- export { executeRoute } from './chunk-R4PWQNPU.js';
2
- export { getRecommendedGasPrice } from './chunk-LJSGCCOX.js';
1
+ export { setClientOptions } from './chunk-KKNOCIFN.js';
2
+ export { executeRoute } from './chunk-NXNVAUER.js';
3
+ export { waitForTransaction } from './chunk-DU3RX43W.js';
4
+ export { transactionStatus } from './chunk-PPUUN7FI.js';
5
+ export { getCosmosGasAmountForMessage } from './chunk-TV2XPAIF.js';
6
+ import './chunk-TD63P2AG.js';
7
+ export { getEVMGasAmountForMessage } from './chunk-GV2QOWB4.js';
8
+ export { getRecommendedGasPrice } from './chunk-DAR753BM.js';
3
9
  import './chunk-VQ5SIQWU.js';
4
- export { getFeeInfoForChain } from './chunk-4TKPLI5S.js';
10
+ export { getFeeInfoForChain } from './chunk-2YP6FMPV.js';
5
11
  export { GAS_STATION_CHAIN_IDS } from './chunk-SWYON2RG.js';
6
- export { getSigningStargateClient } from './chunk-MB5ENUER.js';
12
+ export { getSigningStargateClient } from './chunk-5QPGL2BH.js';
7
13
  import './chunk-36MCR5DZ.js';
8
- export { setApiOptions } from './chunk-KWVMUF5R.js';
9
- export { setClientOptions } from './chunk-GTJ2EDUG.js';
10
- import './chunk-TD63P2AG.js';
11
- export { ibcOriginAssets } from './chunk-WWDCZAB5.js';
12
- export { messages } from './chunk-7FSLD7Y4.js';
13
- export { messagesDirect } from './chunk-H6RXHDUX.js';
14
- export { recommendAssets } from './chunk-PZM2IB6H.js';
15
- export { route } from './chunk-R2N4D2PY.js';
16
- export { submitTransaction } from './chunk-7P6AOFMX.js';
17
- export { trackTransaction } from './chunk-BCN2WD5Q.js';
18
- export { transactionStatus } from './chunk-2NYWLY5S.js';
19
- export { assetsBetweenChains } from './chunk-R3KHKN33.js';
20
- export { bridges } from './chunk-VRPPVMXO.js';
21
- export { venues } from './chunk-RL5AVCSG.js';
22
- export { assetsFromSource } from './chunk-5EU3SRDQ.js';
23
- export { assets, balances, chains } from './chunk-EAUM5JYS.js';
24
- export { Api, AutopilotAction, AxelarTransferState, AxelarTransferType, BridgeType, CCTPTransferState, ChainType, ContentType, ContractCallWithTokenErrorType, FeeType, GoFastTransferState, HttpClient, HyperlaneTransferState, LayerZeroTransferState, OPInitTransferState, PacketErrorType, Reason, RoutePriceWarningType, SendTokenErrorType, StargateTransferState, StatusErrorType, TransactionState, TransferState } from './chunk-SOGMQT4H.js';
14
+ export { setApiOptions } from './chunk-RFZBKQ35.js';
15
+ export { ibcOriginAssets } from './chunk-RYOVQFZO.js';
16
+ export { messages } from './chunk-25FJ6EBA.js';
17
+ export { messagesDirect } from './chunk-5WMPFEIQ.js';
18
+ export { recommendAssets } from './chunk-JZBFAMHE.js';
19
+ export { route } from './chunk-C4URP37X.js';
20
+ export { submit } from './chunk-X67P5URV.js';
21
+ export { submitTransaction } from './chunk-CRTTBUO4.js';
22
+ export { trackTransaction } from './chunk-T7GKUROO.js';
23
+ export { assetsBetweenChains } from './chunk-IWW34V4S.js';
24
+ export { bridges } from './chunk-U6XZFJW2.js';
25
+ export { venues } from './chunk-XXJUDZKJ.js';
26
+ export { assetsFromSource } from './chunk-RCSN7BAU.js';
27
+ export { assets, balances, chains } from './chunk-NWC6BSNB.js';
28
+ import './chunk-DV3I2S3T.js';
29
+ export { Api, AutopilotAction, AxelarTransferState, AxelarTransferType, BridgeType, CCTPTransferState, ChainType, ContentType, ContractCallWithTokenErrorType, FeeType, GoFastTransferState, HttpClient, HyperlaneTransferState, LayerZeroTransferState, OPInitTransferState, PacketErrorType, Reason, RoutePriceWarningType, SendTokenErrorType, StargateTransferState, StatusErrorType, TransactionState, TransferState } from './chunk-UXUJNZOA.js';
25
30
 
26
31
  // src/types/swaggerTypesJson.ts
27
32
  var AutopilotActionJson = /* @__PURE__ */ ((AutopilotActionJson2) => {