@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
@@ -1,6 +1,6 @@
1
- import { J as BridgeType, ap as RoutePriceWarningType, b3 as FeeType } from '../swaggerTypes-sZ9ALP9m.js';
1
+ import { J as BridgeType, ap as RoutePriceWarningType, b3 as FeeType } from '../swaggerTypes-CAERZYPb.js';
2
2
  import { S as SkipApiOptions } from '../apiState-CdzxTxYd.js';
3
- import { A as ApiRequest } from '../generateApi-CpUxWvEf.js';
3
+ import { A as ApiRequest } from '../generateApi-8YPJU-Al.js';
4
4
 
5
5
  declare const route: (request: RouteRequest) => Promise<{
6
6
  amountIn: string;
@@ -53,6 +53,8 @@ declare const route: (request: RouteRequest) => Promise<{
53
53
  denomIn?: string | undefined;
54
54
  denomOut?: string | undefined;
55
55
  feeAmount?: string | undefined;
56
+ toChainEntryContractAddress?: string | undefined;
57
+ toChainCallbackContractAddress?: string | undefined;
56
58
  usdFeeAmount?: string | undefined;
57
59
  feeAsset?: {
58
60
  chainId: string;
@@ -263,6 +265,8 @@ declare const route: (request: RouteRequest) => Promise<{
263
265
  denomIn?: string | undefined;
264
266
  denomOut?: string | undefined;
265
267
  feeAmount?: string | undefined;
268
+ toChainEntryContractAddress?: string | undefined;
269
+ toChainCallbackContractAddress?: string | undefined;
266
270
  usdFeeAmount?: string | undefined;
267
271
  feeAsset?: {
268
272
  chainId: string;
@@ -1,2 +1,3 @@
1
- export { route } from '../chunk-R2N4D2PY.js';
2
- import '../chunk-SOGMQT4H.js';
1
+ export { route } from '../chunk-C4URP37X.js';
2
+ import '../chunk-DV3I2S3T.js';
3
+ import '../chunk-UXUJNZOA.js';
@@ -0,0 +1,17 @@
1
+ import { S as SkipApiOptions } from '../apiState-CdzxTxYd.js';
2
+ import { A as ApiRequest, a as ApiResponse } from '../generateApi-8YPJU-Al.js';
3
+ import '../swaggerTypes-CAERZYPb.js';
4
+
5
+ declare const submit: (options?: ({
6
+ tx?: string | undefined;
7
+ chainId?: string | undefined;
8
+ } & SkipApiOptions & {
9
+ abortDuplicateRequests?: boolean | undefined;
10
+ }) | undefined) => Promise<{
11
+ txHash?: string | undefined;
12
+ explorerLink?: string | undefined;
13
+ } | undefined>;
14
+ type SubmitRequest = ApiRequest<"submit">;
15
+ type SubmitResponse = ApiResponse<"submit">;
16
+
17
+ export { type SubmitRequest, type SubmitResponse, submit };
@@ -0,0 +1,3 @@
1
+ export { submit } from '../chunk-X67P5URV.js';
2
+ import '../chunk-DV3I2S3T.js';
3
+ import '../chunk-UXUJNZOA.js';
@@ -1,2 +1,3 @@
1
- export { submitTransaction } from '../chunk-7P6AOFMX.js';
2
- import '../chunk-SOGMQT4H.js';
1
+ export { submitTransaction } from '../chunk-CRTTBUO4.js';
2
+ import '../chunk-DV3I2S3T.js';
3
+ import '../chunk-UXUJNZOA.js';
@@ -1,2 +1,3 @@
1
- export { trackTransaction } from '../chunk-BCN2WD5Q.js';
2
- import '../chunk-SOGMQT4H.js';
1
+ export { trackTransaction } from '../chunk-T7GKUROO.js';
2
+ import '../chunk-DV3I2S3T.js';
3
+ import '../chunk-UXUJNZOA.js';
@@ -1,6 +1,6 @@
1
- import { av as StatusErrorType, aJ as TransactionState, al as PacketErrorType, aS as TransferState, k as AxelarTransferState, O as ContractCallWithTokenErrorType, as as SendTokenErrorType, l as AxelarTransferType, p as CCTPTransferState, a8 as HyperlaneTransferState, aO as OPInitTransferState, s as StargateTransferState, w as GoFastTransferState, aP as LayerZeroTransferState } from '../swaggerTypes-sZ9ALP9m.js';
1
+ import { av as StatusErrorType, aJ as TransactionState, al as PacketErrorType, aS as TransferState, k as AxelarTransferState, O as ContractCallWithTokenErrorType, as as SendTokenErrorType, l as AxelarTransferType, p as CCTPTransferState, a8 as HyperlaneTransferState, aO as OPInitTransferState, s as StargateTransferState, w as GoFastTransferState, aP as LayerZeroTransferState } from '../swaggerTypes-CAERZYPb.js';
2
2
  import { S as SkipApiOptions } from '../apiState-CdzxTxYd.js';
3
- import { a as ApiResponse } from '../generateApi-CpUxWvEf.js';
3
+ import { a as ApiResponse } from '../generateApi-8YPJU-Al.js';
4
4
 
5
5
  declare const transactionStatus: (params?: ({
6
6
  txHash: string;
@@ -1,2 +1,3 @@
1
- export { transactionStatus } from '../chunk-2NYWLY5S.js';
2
- import '../chunk-SOGMQT4H.js';
1
+ export { transactionStatus } from '../chunk-PPUUN7FI.js';
2
+ import '../chunk-DV3I2S3T.js';
3
+ import '../chunk-UXUJNZOA.js';
@@ -0,0 +1,33 @@
1
+ import { aU as TransferStatus, T as Erc20Approval } from './swaggerTypes-CAERZYPb.js';
2
+
3
+ type CallbackStatus = "success" | "error" | "pending" | "completed";
4
+ type TransactionCallbacks = {
5
+ onTransactionSigned?: (txInfo: {
6
+ chainId: string;
7
+ }) => Promise<void>;
8
+ onTransactionBroadcast?: (txInfo: {
9
+ txHash: string;
10
+ chainId: string;
11
+ }) => Promise<void>;
12
+ onTransactionTracked?: (txInfo: {
13
+ txHash: string;
14
+ chainId: string;
15
+ explorerLink: string;
16
+ }) => Promise<void>;
17
+ onTransactionCompleted?: (txInfo: {
18
+ chainId: string;
19
+ txHash: string;
20
+ status?: TransferStatus;
21
+ }) => Promise<void>;
22
+ onValidateGasBalance?: (value: {
23
+ chainId?: string;
24
+ txIndex?: number;
25
+ status: CallbackStatus;
26
+ }) => Promise<void>;
27
+ onApproveAllowance?: (value: {
28
+ allowance?: Erc20Approval;
29
+ status: CallbackStatus;
30
+ }) => Promise<void>;
31
+ };
32
+
33
+ export type { TransactionCallbacks as T };
@@ -0,0 +1,36 @@
1
+ import { api } from './chunk-DV3I2S3T.js';
2
+
3
+ // src/utils/filterMessagesRequest.ts
4
+ var filterMessagesRequest = (request) => {
5
+ const messagesRequest = {
6
+ sourceAssetDenom: request.sourceAssetDenom,
7
+ sourceAssetChainId: request.sourceAssetChainId,
8
+ destAssetDenom: request.destAssetDenom,
9
+ destAssetChainId: request.destAssetChainId,
10
+ amountIn: request.amountIn,
11
+ amountOut: request.amountOut,
12
+ addressList: request.addressList,
13
+ operations: request.operations,
14
+ estimatedAmountOut: request.estimatedAmountOut,
15
+ slippageTolerancePercent: request.slippageTolerancePercent,
16
+ timeoutSeconds: request.timeoutSeconds,
17
+ postRouteHandler: request.postRouteHandler,
18
+ chainIdsToAffiliates: request.chainIdsToAffiliates,
19
+ enableGasWarnings: request.enableGasWarnings,
20
+ apiUrl: request.apiUrl,
21
+ apiKey: request.apiKey,
22
+ abortDuplicateRequests: request.abortDuplicateRequests
23
+ };
24
+ return messagesRequest;
25
+ };
26
+
27
+ // src/api/postMessages.ts
28
+ var messages = async (request) => {
29
+ return api({
30
+ methodName: "msgs",
31
+ method: "post",
32
+ path: "/v2/fungible/msgs"
33
+ })(filterMessagesRequest(request));
34
+ };
35
+
36
+ export { messages };
@@ -1,6 +1,6 @@
1
1
  import { DEFAULT_GAS_DENOM_OVERRIDES } from './chunk-SWYON2RG.js';
2
2
  import { chains } from './chunk-36MCR5DZ.js';
3
- import { ClientState } from './chunk-EAUM5JYS.js';
3
+ import { ClientState } from './chunk-NWC6BSNB.js';
4
4
 
5
5
  // src/private-functions/getDefaultGasTokenForChain.ts
6
6
  var getDefaultGasTokenForChain = async (chainId) => {
@@ -1,5 +1,5 @@
1
1
  import { chains, findFirstWorkingEndpoint } from './chunk-36MCR5DZ.js';
2
- import { ClientState } from './chunk-EAUM5JYS.js';
2
+ import { ClientState } from './chunk-NWC6BSNB.js';
3
3
  import { accountFromAny, SigningStargateClient } from '@cosmjs/stargate';
4
4
  import { assertDefinedAndNotNull } from '@cosmjs/utils';
5
5
  import { BinaryWriter, BinaryReader } from 'cosmjs-types/binary.js';
@@ -1,4 +1,4 @@
1
- import { api } from './chunk-SOGMQT4H.js';
1
+ import { api } from './chunk-DV3I2S3T.js';
2
2
 
3
3
  // src/api/postMessagesDirect.ts
4
4
  var messagesDirect = api({
@@ -1,4 +1,4 @@
1
- import { ApiState, api } from './chunk-SOGMQT4H.js';
1
+ import { ApiState, api } from './chunk-DV3I2S3T.js';
2
2
 
3
3
  // src/api/postRoute.ts
4
4
  var route = async (request) => {
@@ -1,4 +1,4 @@
1
- import { api } from './chunk-SOGMQT4H.js';
1
+ import { api } from './chunk-DV3I2S3T.js';
2
2
 
3
3
  // src/api/postSubmitTransaction.ts
4
4
  var submitTransaction = api({
@@ -1,5 +1,5 @@
1
1
  import { BigNumber } from './chunk-VQ5SIQWU.js';
2
- import { getFeeInfoForChain } from './chunk-4TKPLI5S.js';
2
+ import { getFeeInfoForChain } from './chunk-2YP6FMPV.js';
3
3
  import { Decimal } from '@cosmjs/math';
4
4
  import { GasPrice } from '@cosmjs/stargate';
5
5
 
@@ -0,0 +1,34 @@
1
+ import { transactionStatus } from './chunk-PPUUN7FI.js';
2
+ import { trackTransaction } from './chunk-T7GKUROO.js';
3
+ import { wait } from './chunk-DV3I2S3T.js';
4
+
5
+ // src/public-functions/waitForTransaction.ts
6
+ var waitForTransaction = async ({
7
+ chainId,
8
+ txHash,
9
+ onTransactionTracked
10
+ }) => {
11
+ const { explorerLink } = await trackTransaction({
12
+ chainId,
13
+ txHash
14
+ });
15
+ await onTransactionTracked?.({ txHash, chainId, explorerLink });
16
+ while (true) {
17
+ const txStatusResponse = await transactionStatus({
18
+ chainId,
19
+ txHash
20
+ });
21
+ if (txStatusResponse.state === "STATE_COMPLETED_SUCCESS") {
22
+ return txStatusResponse;
23
+ }
24
+ if (txStatusResponse.state === "STATE_COMPLETED_ERROR") {
25
+ throw new Error(`${txStatusResponse.error?.type}: ${txStatusResponse.error?.message}`);
26
+ }
27
+ if (txStatusResponse.state === "STATE_ABANDONED") {
28
+ throw new Error("Tracking for the transaction has been abandoned");
29
+ }
30
+ await wait(1e3);
31
+ }
32
+ };
33
+
34
+ export { waitForTransaction };
@@ -0,0 +1,181 @@
1
+ // src/utils/timer.ts
2
+ var wait = (ms) => {
3
+ return new Promise((resolve) => setTimeout(resolve, ms));
4
+ };
5
+
6
+ // src/utils/convert.ts
7
+ function toSnake(obj) {
8
+ return convertKeys(obj, (key) => key.replace(/([A-Z])/g, "_$1").toLowerCase());
9
+ }
10
+ function toCamel(obj) {
11
+ return convertKeys(obj, (key) => key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()));
12
+ }
13
+ function convertKeys(obj, convertKey) {
14
+ if (Array.isArray(obj)) {
15
+ return obj.map((item) => convertKeys(item, convertKey));
16
+ } else if (obj !== null && typeof obj === "object") {
17
+ return Object.keys(obj).reduce((acc, key) => {
18
+ acc[convertKey(key)] = convertKeys(obj[key], convertKey);
19
+ return acc;
20
+ }, {});
21
+ } else {
22
+ return obj;
23
+ }
24
+ }
25
+
26
+ // src/utils/generateApi.ts
27
+ var createRequestClient = ({ baseUrl, apiKey }) => {
28
+ const defaultHeaders = {
29
+ "content-type": "application/json",
30
+ ...apiKey ? { authorization: apiKey } : {}
31
+ };
32
+ const handleResponse = async (response) => {
33
+ const contentType = response.headers.get("content-type");
34
+ const isJson = contentType?.includes("application/json");
35
+ const body = isJson ? await response.json() : await response.text();
36
+ if (!response.ok) {
37
+ const message = typeof body === "object" && body?.message ? body.message : response.statusText;
38
+ throw new Error(message);
39
+ }
40
+ return body;
41
+ };
42
+ const get = async (path, params, signal) => {
43
+ const url = new URL(baseUrl + (path ?? ""));
44
+ if (params && typeof params === "object") {
45
+ Object.entries(params).forEach(([key, value]) => {
46
+ if (value !== void 0 && value !== null) {
47
+ url.searchParams.append(key, String(value));
48
+ }
49
+ });
50
+ }
51
+ const response = await fetch(url.toString(), {
52
+ method: "GET",
53
+ headers: defaultHeaders,
54
+ signal
55
+ });
56
+ return handleResponse(response);
57
+ };
58
+ const post = async (path, data = {}, signal) => {
59
+ const response = await fetch(new URL(baseUrl + path).toString(), {
60
+ method: "POST",
61
+ headers: defaultHeaders,
62
+ body: JSON.stringify(data),
63
+ signal
64
+ });
65
+ return handleResponse(response);
66
+ };
67
+ return { get, post };
68
+ };
69
+ function createRequest({
70
+ path,
71
+ method = "get",
72
+ onSuccess,
73
+ transformResponse
74
+ }) {
75
+ let controller = null;
76
+ const request = async (options) => {
77
+ const { apiKey, apiUrl, abortDuplicateRequests, ...requestParams } = options ?? {};
78
+ let fetchClient = ApiState.client;
79
+ if (apiUrl || apiKey) {
80
+ fetchClient = createRequestClient({
81
+ baseUrl: apiUrl || "https://api.skip.build",
82
+ apiKey
83
+ });
84
+ } else {
85
+ await ApiState.clientInitialized;
86
+ }
87
+ if (abortDuplicateRequests && controller && !controller?.signal?.aborted) {
88
+ controller?.abort();
89
+ }
90
+ controller = new AbortController();
91
+ try {
92
+ const response = await fetchClient[method](
93
+ path,
94
+ requestParams ? toSnake(requestParams) : void 0,
95
+ controller.signal
96
+ );
97
+ const camelCased = toCamel(response ?? {});
98
+ const finalResponse = transformResponse ? transformResponse(camelCased) : camelCased;
99
+ onSuccess?.(finalResponse, requestParams);
100
+ return finalResponse;
101
+ } catch (error) {
102
+ if (error.name === "AbortError") {
103
+ console.log("Request was cancelled");
104
+ } else {
105
+ console.error("Error:", error);
106
+ throw error;
107
+ }
108
+ }
109
+ };
110
+ return request;
111
+ }
112
+ function api({
113
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
114
+ methodName,
115
+ path,
116
+ onSuccess,
117
+ method = "get",
118
+ transformResponse
119
+ }) {
120
+ return createRequest({
121
+ path,
122
+ method,
123
+ onSuccess,
124
+ transformResponse
125
+ });
126
+ }
127
+ function pollingApi({
128
+ methodName,
129
+ path,
130
+ method = "get",
131
+ onSuccess,
132
+ onError,
133
+ isSuccess = () => true,
134
+ maxRetries = 5,
135
+ retryInterval = 1e3,
136
+ backoffMultiplier = 2
137
+ }) {
138
+ const request = async (requestParams) => {
139
+ let attempt = 0;
140
+ let lastError;
141
+ while (attempt < maxRetries) {
142
+ try {
143
+ const result = await api({ methodName, path, method })(requestParams);
144
+ if (result && isSuccess(result)) {
145
+ onSuccess?.(result, attempt);
146
+ return result;
147
+ }
148
+ } catch (err) {
149
+ lastError = err;
150
+ onError?.(err, attempt);
151
+ }
152
+ const delay = retryInterval * Math.pow(backoffMultiplier, attempt);
153
+ await wait(delay);
154
+ attempt++;
155
+ }
156
+ throw lastError ?? new Error("pollingApi: max retries exceeded");
157
+ };
158
+ return (params) => request(params);
159
+ }
160
+
161
+ // src/state/apiState.ts
162
+ var ApiState = class _ApiState {
163
+ static client;
164
+ static chainIdsToAffiliates;
165
+ static cumulativeAffiliateFeeBPS = "0";
166
+ static isInitialized = false;
167
+ static resolveInitialization;
168
+ static clientInitialized = new Promise((resolve) => {
169
+ _ApiState.resolveInitialization = () => {
170
+ if (!_ApiState.isInitialized) {
171
+ _ApiState.isInitialized = true;
172
+ resolve();
173
+ }
174
+ };
175
+ });
176
+ static setClientInitialized() {
177
+ _ApiState.resolveInitialization();
178
+ }
179
+ };
180
+
181
+ export { ApiState, api, createRequestClient, pollingApi, toCamel, wait };
@@ -0,0 +1,26 @@
1
+ import { publicActions } from 'viem';
2
+
3
+ // src/public-functions/getEvmGasAmountForMessage.ts
4
+ async function getEVMGasAmountForMessage(signer, tx, getFallbackGasAmount) {
5
+ const { to, data, value } = tx;
6
+ if (!signer.account) throw new Error("estimateGasForEvmTx: No account found");
7
+ const extendedSigner = signer.extend(publicActions);
8
+ const fee = await extendedSigner.estimateFeesPerGas();
9
+ try {
10
+ const gasAmount = await extendedSigner.estimateGas({
11
+ account: signer.account,
12
+ to,
13
+ data: `0x${data}`,
14
+ value: value === "" ? void 0 : BigInt(value ?? "")
15
+ });
16
+ return gasAmount * fee.maxFeePerGas;
17
+ } catch (error) {
18
+ const fallbackGasAmount = await getFallbackGasAmount?.(tx.chainId ?? "", "evm" /* Evm */);
19
+ if (fallbackGasAmount) {
20
+ return BigInt(fallbackGasAmount) * fee.maxFeePerGas;
21
+ }
22
+ throw error;
23
+ }
24
+ }
25
+
26
+ export { getEVMGasAmountForMessage };
@@ -1,4 +1,4 @@
1
- import { api } from './chunk-SOGMQT4H.js';
1
+ import { api } from './chunk-DV3I2S3T.js';
2
2
 
3
3
  // src/api/getAssetsBetweenChains.ts
4
4
  var assetsBetweenChains = api({
@@ -1,4 +1,4 @@
1
- import { api } from './chunk-SOGMQT4H.js';
1
+ import { api } from './chunk-DV3I2S3T.js';
2
2
 
3
3
  // src/api/postRecommendAssets.ts
4
4
  var recommendAssets = api({
@@ -1,6 +1,6 @@
1
1
  import { MsgAcceptOwner, MsgAddRemoteTokenMessenger, MsgDepositForBurn, MsgDepositForBurnWithCaller, MsgDisableAttester, MsgEnableAttester, MsgLinkTokenPair, MsgPauseBurningAndMinting, MsgPauseSendingAndReceivingMessages, MsgReceiveMessage, MsgRemoveRemoteTokenMessenger, MsgReplaceDepositForBurn, MsgReplaceMessage, MsgSendMessage, MsgSendMessageWithCaller, MsgUnlinkTokenPair, MsgUnpauseBurningAndMinting, MsgUnpauseSendingAndReceivingMessages, MsgUpdateOwner, MsgUpdateAttesterManager, MsgUpdateTokenController, MsgUpdatePauser, MsgUpdateMaxMessageBodySize, MsgSetMaxBurnAmountPerMessage, MsgUpdateSignatureThreshold, MsgExecute, MsgInitiateTokenDeposit, Coin, isSet, Long, Timestamp, toTimestamp, Period, fromTimestamp, fromJsonTimestamp, padDecimal } from './chunk-TD63P2AG.js';
2
- import { ClientState } from './chunk-EAUM5JYS.js';
3
- import { ApiState, createRequestClient } from './chunk-SOGMQT4H.js';
2
+ import { ClientState } from './chunk-NWC6BSNB.js';
3
+ import { ApiState, createRequestClient } from './chunk-DV3I2S3T.js';
4
4
  import { AminoTypes, createDefaultAminoConverters, defaultRegistryTypes } from '@cosmjs/stargate';
5
5
  import { createWasmAminoConverters } from '@cosmjs/cosmwasm-stargate';
6
6
  import { Registry } from '@cosmjs/proto-signing';
@@ -1,4 +1,4 @@
1
- import { api } from './chunk-SOGMQT4H.js';
1
+ import { api } from './chunk-DV3I2S3T.js';
2
2
 
3
3
  // src/private-functions/getMainnetAndTestnetChains.ts
4
4
  var getMainnetAndTestnetChains = async (apiOptions) => {