@skip-go/client 1.3.0 → 1.3.2
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.
- package/dist/cjs/api/getAssets.cjs +16 -0
- package/dist/cjs/api/getAssetsBetweenChains.cjs +12 -0
- package/dist/cjs/api/getBridges.cjs +12 -0
- package/dist/cjs/api/getChains.cjs +12 -0
- package/dist/cjs/api/getVenues.cjs +12 -0
- package/dist/cjs/api/postAssetsFromSource.cjs +13 -0
- package/dist/cjs/api/postBalances.cjs +12 -0
- package/dist/cjs/api/postIbcOriginAssets.cjs +12 -0
- package/dist/cjs/api/postMessages.cjs +12 -0
- package/dist/cjs/api/postMessagesDirect.cjs +12 -0
- package/dist/cjs/api/postRecommendAssets.cjs +12 -0
- package/dist/cjs/api/postRoute.cjs +12 -0
- package/dist/cjs/api/postSubmit.cjs +12 -0
- package/dist/cjs/api/postSubmitTransaction.cjs +12 -0
- package/dist/cjs/api/postTrackTransaction.cjs +12 -0
- package/dist/cjs/api/postTransactionStatus.cjs +12 -0
- package/dist/cjs/chunk-4R6OCWRR.cjs +1346 -0
- package/dist/cjs/chunk-5FR25GF5.cjs +209 -0
- package/dist/cjs/chunk-AHRSARNR.cjs +38 -0
- package/dist/cjs/chunk-CWUD7UGL.cjs +13 -0
- package/dist/cjs/chunk-D2W4UBJB.cjs +136 -0
- package/dist/cjs/chunk-DUJSZRFD.cjs +1445 -0
- package/dist/cjs/chunk-EINQFLWN.cjs +12 -0
- package/dist/cjs/chunk-EQBTNGJJ.cjs +11 -0
- package/dist/cjs/chunk-F3EB2AQG.cjs +28 -0
- package/dist/cjs/chunk-G3G6PBIF.cjs +47 -0
- package/dist/cjs/chunk-HDKNPB2J.cjs +182 -0
- package/dist/cjs/chunk-IDDRJJO5.cjs +567 -0
- package/dist/cjs/chunk-KMDNP6DN.cjs +24 -0
- package/dist/cjs/chunk-KZOSEIWH.cjs +10 -0
- package/dist/cjs/chunk-MGYSCMET.cjs +273 -0
- package/dist/cjs/chunk-N3LR7KTI.cjs +304 -0
- package/dist/cjs/chunk-NQR3EPN2.cjs +12 -0
- package/dist/cjs/chunk-OA5PE7TW.cjs +18 -0
- package/dist/cjs/chunk-PFCGKAXF.cjs +15 -0
- package/dist/cjs/chunk-PG7RVHOU.cjs +12 -0
- package/dist/cjs/chunk-RFBDXALX.cjs +12 -0
- package/dist/cjs/chunk-SIY2K7TT.cjs +13 -0
- package/dist/cjs/chunk-SLZCWA4K.cjs +2234 -0
- package/dist/cjs/chunk-T5LPU5A2.cjs +188 -0
- package/dist/cjs/chunk-TCQMGBFL.cjs +38 -0
- package/dist/cjs/chunk-TFL5E5A6.cjs +12 -0
- package/dist/cjs/chunk-TWPLCFOH.cjs +16 -0
- package/dist/cjs/chunk-W2DPDT3Y.cjs +22 -0
- package/dist/cjs/chunk-WE7KICKO.cjs +95 -0
- package/dist/cjs/chunk-WMXUOVHN.cjs +3642 -0
- package/dist/cjs/index.cjs +402 -0
- package/dist/cjs/public-functions/executeRoute.cjs +28 -0
- package/dist/cjs/public-functions/getCosmosGasAmountForMessage.cjs +15 -0
- package/dist/cjs/public-functions/getEvmGasAmountForMessage.cjs +11 -0
- package/dist/cjs/public-functions/getFeeInfoForChain.cjs +15 -0
- package/dist/cjs/public-functions/getRecommendedGasPrice.cjs +17 -0
- package/dist/cjs/public-functions/getSigningStargateClient.cjs +14 -0
- package/dist/cjs/public-functions/setApiOptions.cjs +12 -0
- package/dist/cjs/public-functions/setClientOptions.cjs +14 -0
- package/dist/cjs/public-functions/validateCosmosGasBalance.cjs +18 -0
- package/dist/cjs/public-functions/waitForTransaction.cjs +14 -0
- package/dist/{api → esm/api}/getAssets.d.ts +1 -1
- package/dist/{api → esm/api}/getAssets.js +1 -1
- package/dist/{api → esm/api}/getAssetsBetweenChains.d.ts +1 -1
- package/dist/{api → esm/api}/getAssetsBetweenChains.js +1 -1
- package/dist/{api → esm/api}/getBridges.d.ts +1 -1
- package/dist/{api → esm/api}/getBridges.js +1 -1
- package/dist/{api → esm/api}/getChains.d.ts +1 -1
- package/dist/{api → esm/api}/getChains.js +1 -1
- package/dist/{api → esm/api}/getVenues.js +1 -1
- package/dist/{api → esm/api}/postAssetsFromSource.d.ts +1 -1
- package/dist/{api → esm/api}/postAssetsFromSource.js +1 -1
- package/dist/{api → esm/api}/postBalances.d.ts +2 -2
- package/dist/{api → esm/api}/postBalances.js +1 -1
- package/dist/{api → esm/api}/postIbcOriginAssets.js +1 -1
- package/dist/{api → esm/api}/postMessages.d.ts +2 -2
- package/dist/{api → esm/api}/postMessages.js +1 -1
- package/dist/{api → esm/api}/postMessagesDirect.d.ts +2 -2
- package/dist/{api → esm/api}/postMessagesDirect.js +1 -1
- package/dist/{api → esm/api}/postRecommendAssets.d.ts +1 -1
- package/dist/{api → esm/api}/postRecommendAssets.js +1 -1
- package/dist/{api → esm/api}/postRoute.d.ts +3 -3
- package/dist/{api → esm/api}/postRoute.js +1 -1
- package/dist/{api → esm/api}/postSubmit.d.ts +2 -2
- package/dist/{api → esm/api}/postSubmit.js +1 -1
- package/dist/{api → esm/api}/postSubmitTransaction.js +1 -1
- package/dist/{api → esm/api}/postTrackTransaction.d.ts +2 -2
- package/dist/{api → esm/api}/postTrackTransaction.js +1 -1
- package/dist/{api → esm/api}/postTransactionStatus.d.ts +2 -2
- package/dist/{api → esm/api}/postTransactionStatus.js +1 -1
- package/dist/{callbacks-DK2GxU0a.d.ts → esm/callbacks-DGLv2hr0.d.ts} +6 -1
- package/dist/{chunk-HIJ6YOTK.js → esm/chunk-HAGMHUOI.js} +20 -4
- package/dist/{chunk-KYLULQOS.js → esm/chunk-OQDBWVET.js} +1 -0
- package/dist/{client-types-DuWWc2_J.d.ts → esm/client-types-CSzTHcG9.d.ts} +1 -1
- package/dist/{generateApi-DvFEIUee.d.ts → esm/generateApi-Bfli9ipj.d.ts} +1 -1
- package/dist/{index.d.ts → esm/index.d.ts} +19 -6
- package/dist/{index.js → esm/index.js} +3 -2
- package/dist/{public-functions → esm/public-functions}/executeRoute.d.ts +4 -4
- package/dist/{public-functions → esm/public-functions}/executeRoute.js +2 -2
- package/dist/{public-functions → esm/public-functions}/getCosmosGasAmountForMessage.d.ts +1 -1
- package/dist/{public-functions → esm/public-functions}/getEvmGasAmountForMessage.d.ts +2 -2
- package/dist/{public-functions → esm/public-functions}/getEvmGasAmountForMessage.js +1 -1
- package/dist/{public-functions → esm/public-functions}/getFeeInfoForChain.d.ts +1 -1
- package/dist/{public-functions → esm/public-functions}/getFeeInfoForChain.js +1 -1
- package/dist/{public-functions → esm/public-functions}/getRecommendedGasPrice.js +1 -1
- package/dist/{public-functions → esm/public-functions}/getSigningStargateClient.js +1 -1
- package/dist/{public-functions → esm/public-functions}/setApiOptions.d.ts +1 -1
- package/dist/{public-functions → esm/public-functions}/setApiOptions.js +1 -1
- package/dist/{public-functions → esm/public-functions}/setClientOptions.d.ts +3 -3
- package/dist/{public-functions → esm/public-functions}/setClientOptions.js +1 -1
- package/dist/{public-functions → esm/public-functions}/validateCosmosGasBalance.d.ts +4 -4
- package/dist/{public-functions → esm/public-functions}/validateCosmosGasBalance.js +1 -1
- package/dist/{public-functions → esm/public-functions}/waitForTransaction.d.ts +3 -3
- package/dist/{public-functions → esm/public-functions}/waitForTransaction.js +1 -1
- package/dist/{setClientOptions-B27lt_6h.d.ts → esm/setClientOptions-RMgGQ1KD.d.ts} +1 -1
- package/dist/{swaggerTypes-BrC-ZYnx.d.ts → esm/swaggerTypes-BIYUp1AO.d.ts} +14 -1
- package/package.json +19 -7
- /package/dist/{api → esm/api}/getVenues.d.ts +0 -0
- /package/dist/{api → esm/api}/postIbcOriginAssets.d.ts +0 -0
- /package/dist/{api → esm/api}/postSubmitTransaction.d.ts +0 -0
- /package/dist/{apiState-DwZhwVul.d.ts → esm/apiState-DwZhwVul.d.ts} +0 -0
- /package/dist/{chunk-2R5COFPS.js → esm/chunk-2R5COFPS.js} +0 -0
- /package/dist/{chunk-43P4WRGN.js → esm/chunk-43P4WRGN.js} +0 -0
- /package/dist/{chunk-4DI7G6TH.js → esm/chunk-4DI7G6TH.js} +0 -0
- /package/dist/{chunk-6ULKULTX.js → esm/chunk-6ULKULTX.js} +0 -0
- /package/dist/{chunk-6UMMVC2P.js → esm/chunk-6UMMVC2P.js} +0 -0
- /package/dist/{chunk-7ZG7HNNC.js → esm/chunk-7ZG7HNNC.js} +0 -0
- /package/dist/{chunk-C6NHVJ3R.js → esm/chunk-C6NHVJ3R.js} +0 -0
- /package/dist/{chunk-CGZ5DA2T.js → esm/chunk-CGZ5DA2T.js} +0 -0
- /package/dist/{chunk-ERPZHRBM.js → esm/chunk-ERPZHRBM.js} +0 -0
- /package/dist/{chunk-F65QOYUA.js → esm/chunk-F65QOYUA.js} +0 -0
- /package/dist/{chunk-GOD6ESBZ.js → esm/chunk-GOD6ESBZ.js} +0 -0
- /package/dist/{chunk-GV2QOWB4.js → esm/chunk-GV2QOWB4.js} +0 -0
- /package/dist/{chunk-HS2D6FKN.js → esm/chunk-HS2D6FKN.js} +0 -0
- /package/dist/{chunk-I4AMZAHH.js → esm/chunk-I4AMZAHH.js} +0 -0
- /package/dist/{chunk-MAOMQHG5.js → esm/chunk-MAOMQHG5.js} +0 -0
- /package/dist/{chunk-NZVZH6OA.js → esm/chunk-NZVZH6OA.js} +0 -0
- /package/dist/{chunk-PIQZD2VE.js → esm/chunk-PIQZD2VE.js} +0 -0
- /package/dist/{chunk-QPJEHGY7.js → esm/chunk-QPJEHGY7.js} +0 -0
- /package/dist/{chunk-SS5LQKBL.js → esm/chunk-SS5LQKBL.js} +0 -0
- /package/dist/{chunk-SWYON2RG.js → esm/chunk-SWYON2RG.js} +0 -0
- /package/dist/{chunk-TD63P2AG.js → esm/chunk-TD63P2AG.js} +0 -0
- /package/dist/{chunk-TV2XPAIF.js → esm/chunk-TV2XPAIF.js} +0 -0
- /package/dist/{chunk-UZKIIX6A.js → esm/chunk-UZKIIX6A.js} +0 -0
- /package/dist/{chunk-VQ5SIQWU.js → esm/chunk-VQ5SIQWU.js} +0 -0
- /package/dist/{chunk-VUOOTNLG.js → esm/chunk-VUOOTNLG.js} +0 -0
- /package/dist/{chunk-YLMQS52U.js → esm/chunk-YLMQS52U.js} +0 -0
- /package/dist/{chunk-YYXOIRHZ.js → esm/chunk-YYXOIRHZ.js} +0 -0
- /package/dist/{chunk-ZTDLGX7X.js → esm/chunk-ZTDLGX7X.js} +0 -0
- /package/dist/{public-functions → esm/public-functions}/getCosmosGasAmountForMessage.js +0 -0
- /package/dist/{public-functions → esm/public-functions}/getRecommendedGasPrice.d.ts +0 -0
- /package/dist/{public-functions → esm/public-functions}/getSigningStargateClient.d.ts +0 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/utils/timer.ts
|
|
4
|
+
var wait = (ms) => {
|
|
5
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// src/utils/convert.ts
|
|
9
|
+
function toSnake(obj) {
|
|
10
|
+
return convertKeys(obj, (key) => key.replace(/([A-Z])/g, "_$1").toLowerCase());
|
|
11
|
+
}
|
|
12
|
+
function toCamel(obj) {
|
|
13
|
+
return convertKeys(obj, (key) => key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()));
|
|
14
|
+
}
|
|
15
|
+
function convertKeys(obj, convertKey) {
|
|
16
|
+
if (Array.isArray(obj)) {
|
|
17
|
+
return obj.map((item) => convertKeys(item, convertKey));
|
|
18
|
+
} else if (obj !== null && typeof obj === "object") {
|
|
19
|
+
return Object.keys(obj).reduce((acc, key) => {
|
|
20
|
+
acc[convertKey(key)] = convertKeys(obj[key], convertKey);
|
|
21
|
+
return acc;
|
|
22
|
+
}, {});
|
|
23
|
+
} else {
|
|
24
|
+
return obj;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// src/utils/generateApi.ts
|
|
29
|
+
var createRequestClient = ({ apiUrl, apiKey, apiHeaders }) => {
|
|
30
|
+
if (!apiUrl?.endsWith("/")) {
|
|
31
|
+
apiUrl += "/";
|
|
32
|
+
}
|
|
33
|
+
const headers = new Headers({
|
|
34
|
+
"content-type": "application/json"
|
|
35
|
+
});
|
|
36
|
+
if (apiKey) {
|
|
37
|
+
headers.set("authorization", apiKey);
|
|
38
|
+
}
|
|
39
|
+
if (apiHeaders) {
|
|
40
|
+
new Headers(apiHeaders).forEach((value, key) => {
|
|
41
|
+
headers.set(key, value);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const handleResponse = async (response) => {
|
|
45
|
+
const contentType = response.headers.get("content-type");
|
|
46
|
+
const isJson = contentType?.includes("application/json");
|
|
47
|
+
const body = isJson ? await response.json() : await response.text();
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
const message = typeof body === "object" && body?.message ? body.message : response.statusText;
|
|
50
|
+
throw new Error(message);
|
|
51
|
+
}
|
|
52
|
+
return body;
|
|
53
|
+
};
|
|
54
|
+
const get = async (path, params, signal) => {
|
|
55
|
+
if (path?.startsWith("/")) {
|
|
56
|
+
console.warn("paths that start with / are treated as absolute paths, please remove the leading / if this path is intended to be a relative path");
|
|
57
|
+
}
|
|
58
|
+
const url = new URL(path ?? "", apiUrl);
|
|
59
|
+
if (params && typeof params === "object") {
|
|
60
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
61
|
+
if (value !== void 0 && value !== null) {
|
|
62
|
+
url.searchParams.append(key, String(value));
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
const response = await fetch(url.toString(), {
|
|
67
|
+
method: "GET",
|
|
68
|
+
headers,
|
|
69
|
+
signal
|
|
70
|
+
});
|
|
71
|
+
return handleResponse(response);
|
|
72
|
+
};
|
|
73
|
+
const post = async (path, data = {}, signal) => {
|
|
74
|
+
if (path?.startsWith("/")) {
|
|
75
|
+
console.warn("paths that start with / are treated as absolute paths, please remove the leading / if this path is intended to be a relative path");
|
|
76
|
+
}
|
|
77
|
+
const response = await fetch(new URL(path, apiUrl).toString(), {
|
|
78
|
+
method: "POST",
|
|
79
|
+
headers,
|
|
80
|
+
body: JSON.stringify(data),
|
|
81
|
+
signal
|
|
82
|
+
});
|
|
83
|
+
return handleResponse(response);
|
|
84
|
+
};
|
|
85
|
+
return { get, post };
|
|
86
|
+
};
|
|
87
|
+
function createRequest({
|
|
88
|
+
path,
|
|
89
|
+
method = "get",
|
|
90
|
+
onSuccess,
|
|
91
|
+
transformResponse
|
|
92
|
+
}) {
|
|
93
|
+
let controller = null;
|
|
94
|
+
const request = async (options) => {
|
|
95
|
+
const { apiKey, apiUrl, apiHeaders, abortDuplicateRequests, ...requestParams } = options ?? {};
|
|
96
|
+
let fetchClient = ApiState.client;
|
|
97
|
+
if (apiUrl || apiKey) {
|
|
98
|
+
fetchClient = createRequestClient({
|
|
99
|
+
apiUrl: apiUrl || "https://api.skip.build",
|
|
100
|
+
apiKey,
|
|
101
|
+
apiHeaders
|
|
102
|
+
});
|
|
103
|
+
} else {
|
|
104
|
+
await ApiState.clientInitialized;
|
|
105
|
+
}
|
|
106
|
+
if (abortDuplicateRequests && controller && !controller?.signal?.aborted) {
|
|
107
|
+
controller?.abort();
|
|
108
|
+
}
|
|
109
|
+
controller = new AbortController();
|
|
110
|
+
try {
|
|
111
|
+
const response = await fetchClient[method](
|
|
112
|
+
path,
|
|
113
|
+
requestParams ? toSnake(requestParams) : void 0,
|
|
114
|
+
controller.signal
|
|
115
|
+
);
|
|
116
|
+
const camelCased = toCamel(response ?? {});
|
|
117
|
+
const finalResponse = transformResponse ? transformResponse(camelCased) : camelCased;
|
|
118
|
+
onSuccess?.(finalResponse, requestParams);
|
|
119
|
+
return finalResponse;
|
|
120
|
+
} catch (error) {
|
|
121
|
+
if (error.name === "AbortError") {
|
|
122
|
+
console.log("Request was cancelled");
|
|
123
|
+
} else {
|
|
124
|
+
console.error("Error:", error);
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
return request;
|
|
130
|
+
}
|
|
131
|
+
function api({
|
|
132
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
133
|
+
methodName,
|
|
134
|
+
path,
|
|
135
|
+
onSuccess,
|
|
136
|
+
method = "get",
|
|
137
|
+
transformResponse
|
|
138
|
+
}) {
|
|
139
|
+
return createRequest({
|
|
140
|
+
path,
|
|
141
|
+
method,
|
|
142
|
+
onSuccess,
|
|
143
|
+
transformResponse
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function pollingApi({
|
|
147
|
+
methodName,
|
|
148
|
+
path,
|
|
149
|
+
method = "get",
|
|
150
|
+
onSuccess,
|
|
151
|
+
onError,
|
|
152
|
+
isSuccess = () => true,
|
|
153
|
+
maxRetries = 5,
|
|
154
|
+
retryInterval = 1e3,
|
|
155
|
+
backoffMultiplier = 2,
|
|
156
|
+
throwOnError = false
|
|
157
|
+
}) {
|
|
158
|
+
const request = async (requestParams) => {
|
|
159
|
+
let attempt = 0;
|
|
160
|
+
let lastError;
|
|
161
|
+
while (attempt < maxRetries) {
|
|
162
|
+
try {
|
|
163
|
+
const result = await api({ methodName, path, method })(requestParams);
|
|
164
|
+
if (result && isSuccess(result)) {
|
|
165
|
+
onSuccess?.(result, attempt);
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
} catch (err) {
|
|
169
|
+
lastError = err;
|
|
170
|
+
onError?.(err, attempt);
|
|
171
|
+
if (throwOnError) {
|
|
172
|
+
throw err;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
const delay = retryInterval * Math.pow(backoffMultiplier, attempt);
|
|
176
|
+
await wait(delay);
|
|
177
|
+
attempt++;
|
|
178
|
+
}
|
|
179
|
+
throw lastError ?? new Error("pollingApi: max retries exceeded");
|
|
180
|
+
};
|
|
181
|
+
return (params) => request(params);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// src/state/apiState.ts
|
|
185
|
+
var ApiState = class _ApiState {
|
|
186
|
+
static client;
|
|
187
|
+
static chainIdsToAffiliates;
|
|
188
|
+
static cumulativeAffiliateFeeBPS = "0";
|
|
189
|
+
static isInitialized = false;
|
|
190
|
+
static resolveInitialization;
|
|
191
|
+
static clientInitialized = new Promise((resolve) => {
|
|
192
|
+
_ApiState.resolveInitialization = () => {
|
|
193
|
+
if (!_ApiState.isInitialized) {
|
|
194
|
+
_ApiState.isInitialized = true;
|
|
195
|
+
resolve();
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
});
|
|
199
|
+
static setClientInitialized() {
|
|
200
|
+
_ApiState.resolveInitialization();
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
exports.ApiState = ApiState;
|
|
205
|
+
exports.api = api;
|
|
206
|
+
exports.createRequestClient = createRequestClient;
|
|
207
|
+
exports.pollingApi = pollingApi;
|
|
208
|
+
exports.toCamel = toCamel;
|
|
209
|
+
exports.wait = wait;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk5FR25GF5_cjs = require('./chunk-5FR25GF5.cjs');
|
|
4
|
+
|
|
5
|
+
// src/utils/filterMessagesRequest.ts
|
|
6
|
+
var filterMessagesRequest = (request) => {
|
|
7
|
+
const messagesRequest = {
|
|
8
|
+
sourceAssetDenom: request.sourceAssetDenom,
|
|
9
|
+
sourceAssetChainId: request.sourceAssetChainId,
|
|
10
|
+
destAssetDenom: request.destAssetDenom,
|
|
11
|
+
destAssetChainId: request.destAssetChainId,
|
|
12
|
+
amountIn: request.amountIn,
|
|
13
|
+
amountOut: request.amountOut,
|
|
14
|
+
addressList: request.addressList,
|
|
15
|
+
operations: request.operations,
|
|
16
|
+
estimatedAmountOut: request.estimatedAmountOut,
|
|
17
|
+
slippageTolerancePercent: request.slippageTolerancePercent,
|
|
18
|
+
timeoutSeconds: request.timeoutSeconds,
|
|
19
|
+
postRouteHandler: request.postRouteHandler,
|
|
20
|
+
chainIdsToAffiliates: request.chainIdsToAffiliates,
|
|
21
|
+
enableGasWarnings: request.enableGasWarnings,
|
|
22
|
+
apiUrl: request.apiUrl,
|
|
23
|
+
apiKey: request.apiKey,
|
|
24
|
+
abortDuplicateRequests: request.abortDuplicateRequests
|
|
25
|
+
};
|
|
26
|
+
return messagesRequest;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// src/api/postMessages.ts
|
|
30
|
+
var messages = async (request) => {
|
|
31
|
+
return chunk5FR25GF5_cjs.api({
|
|
32
|
+
methodName: "msgs",
|
|
33
|
+
method: "post",
|
|
34
|
+
path: "v2/fungible/msgs"
|
|
35
|
+
})(filterMessagesRequest(request));
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
exports.messages = messages;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk5FR25GF5_cjs = require('./chunk-5FR25GF5.cjs');
|
|
4
|
+
|
|
5
|
+
// src/api/postIbcOriginAssets.ts
|
|
6
|
+
var ibcOriginAssets = chunk5FR25GF5_cjs.api({
|
|
7
|
+
methodName: "ibcOriginAssets",
|
|
8
|
+
method: "post",
|
|
9
|
+
path: "v2/fungible/ibc_origin_assets",
|
|
10
|
+
transformResponse: (response) => response.originAssets
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
exports.ibcOriginAssets = ibcOriginAssets;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk5FR25GF5_cjs = require('./chunk-5FR25GF5.cjs');
|
|
4
|
+
|
|
5
|
+
// src/private-functions/getMainnetAndTestnetChains.ts
|
|
6
|
+
var getMainnetAndTestnetChains = async (apiOptions) => {
|
|
7
|
+
const [mainnetRes, testnetRes] = await Promise.all([
|
|
8
|
+
chains({
|
|
9
|
+
includeEvm: true,
|
|
10
|
+
includeSvm: true,
|
|
11
|
+
...apiOptions
|
|
12
|
+
}),
|
|
13
|
+
chains({
|
|
14
|
+
includeEvm: true,
|
|
15
|
+
includeSvm: true,
|
|
16
|
+
onlyTestnets: true,
|
|
17
|
+
...apiOptions
|
|
18
|
+
})
|
|
19
|
+
]);
|
|
20
|
+
const combinedChains = [...mainnetRes ?? [], ...testnetRes ?? []];
|
|
21
|
+
ClientState.skipChains = combinedChains;
|
|
22
|
+
return combinedChains;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// src/api/getAssets.ts
|
|
26
|
+
var assets = chunk5FR25GF5_cjs.api({
|
|
27
|
+
methodName: "assets",
|
|
28
|
+
path: "v2/fungible/assets",
|
|
29
|
+
transformResponse: (response) => {
|
|
30
|
+
return transformAssetsMap(response.chainToAssetsMap);
|
|
31
|
+
},
|
|
32
|
+
onSuccess: (response, options) => {
|
|
33
|
+
if (options?.includeEvmAssets && options?.includeSvmAssets && options?.includeCw20Assets) {
|
|
34
|
+
ClientState.skipAssets = response;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
var transformAssetsMap = (input) => Object.entries(input ?? {}).reduce(
|
|
39
|
+
(acc, [chainId, { assets: assets2 }]) => {
|
|
40
|
+
acc[chainId] = (assets2 ?? []).map((asset) => asset);
|
|
41
|
+
return acc;
|
|
42
|
+
},
|
|
43
|
+
{}
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// src/private-functions/getMainnetAndTestnetAssets.ts
|
|
47
|
+
var getMainnetAndTestnetAssets = async ({
|
|
48
|
+
chainId,
|
|
49
|
+
...apiOptions
|
|
50
|
+
}) => {
|
|
51
|
+
const [assetsMainnet, assetsTestnet] = await Promise.all([
|
|
52
|
+
assets({
|
|
53
|
+
chainIds: chainId ? [chainId] : void 0,
|
|
54
|
+
...apiOptions
|
|
55
|
+
}),
|
|
56
|
+
assets({
|
|
57
|
+
chainIds: chainId ? [chainId] : void 0,
|
|
58
|
+
onlyTestnets: true,
|
|
59
|
+
...apiOptions
|
|
60
|
+
})
|
|
61
|
+
]);
|
|
62
|
+
const mainnet = assetsMainnet;
|
|
63
|
+
const testnet = assetsTestnet;
|
|
64
|
+
const merged = {
|
|
65
|
+
...mainnet,
|
|
66
|
+
...testnet
|
|
67
|
+
};
|
|
68
|
+
ClientState.skipAssets = merged;
|
|
69
|
+
return merged;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/api/postBalances.ts
|
|
73
|
+
var balances = chunk5FR25GF5_cjs.api({
|
|
74
|
+
methodName: "balances",
|
|
75
|
+
method: "post",
|
|
76
|
+
path: "v2/info/balances",
|
|
77
|
+
onSuccess: (response, options) => {
|
|
78
|
+
if (!options) {
|
|
79
|
+
ClientState.skipBalances = response;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// src/state/clientState.ts
|
|
85
|
+
var ClientState = class {
|
|
86
|
+
static aminoTypes;
|
|
87
|
+
static registry;
|
|
88
|
+
static endpointOptions;
|
|
89
|
+
static skipChains;
|
|
90
|
+
static skipAssets;
|
|
91
|
+
static skipBalances;
|
|
92
|
+
static async getSkipChains(apiOptions) {
|
|
93
|
+
if (this.skipChains) {
|
|
94
|
+
return this.skipChains;
|
|
95
|
+
}
|
|
96
|
+
const response = await getMainnetAndTestnetChains(apiOptions);
|
|
97
|
+
this.skipChains = response;
|
|
98
|
+
return response;
|
|
99
|
+
}
|
|
100
|
+
static async getSkipAssets(props) {
|
|
101
|
+
if (props.chainId && this.skipAssets?.[props.chainId] || !props.chainId && this.skipAssets) {
|
|
102
|
+
return this.skipAssets;
|
|
103
|
+
}
|
|
104
|
+
const response = await getMainnetAndTestnetAssets(props);
|
|
105
|
+
this.skipAssets = response;
|
|
106
|
+
return response;
|
|
107
|
+
}
|
|
108
|
+
static async getSkipBalances() {
|
|
109
|
+
if (this.skipBalances) {
|
|
110
|
+
return this.skipBalances;
|
|
111
|
+
}
|
|
112
|
+
const response = await balances();
|
|
113
|
+
this.skipBalances = response;
|
|
114
|
+
return response;
|
|
115
|
+
}
|
|
116
|
+
static signingStargateClientByChainId = {};
|
|
117
|
+
static validateGasResults;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// src/api/getChains.ts
|
|
121
|
+
var chains = chunk5FR25GF5_cjs.api({
|
|
122
|
+
methodName: "chains",
|
|
123
|
+
path: "v2/info/chains",
|
|
124
|
+
transformResponse: (response) => response.chains,
|
|
125
|
+
onSuccess: (response, options) => {
|
|
126
|
+
if (options?.includeEvm && options?.includeSvm) {
|
|
127
|
+
ClientState.skipChains = response;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
exports.ClientState = ClientState;
|
|
133
|
+
exports.assets = assets;
|
|
134
|
+
exports.balances = balances;
|
|
135
|
+
exports.chains = chains;
|
|
136
|
+
exports.transformAssetsMap = transformAssetsMap;
|