@skip-go/client 1.0.0-alpha-2 → 1.0.0-alpha-4
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/api/{getAssets.d.mts → getAssets.d.ts} +2 -2
- package/dist/api/getAssets.js +2 -0
- package/dist/api/{getAssetsBetweenChains.d.mts → getAssetsBetweenChains.d.ts} +2 -2
- package/dist/api/getAssetsBetweenChains.js +2 -0
- package/dist/api/{getBridges.d.mts → getBridges.d.ts} +2 -2
- package/dist/api/getBridges.js +2 -0
- package/dist/api/{getChains.d.mts → getChains.d.ts} +2 -2
- package/dist/api/getChains.js +2 -0
- package/dist/api/{getVenues.d.mts → getVenues.d.ts} +1 -1
- package/dist/api/getVenues.js +2 -0
- package/dist/api/{postAssetsFromSource.d.mts → postAssetsFromSource.d.ts} +2 -2
- package/dist/api/postAssetsFromSource.js +3 -0
- package/dist/api/{postBalances.d.mts → postBalances.d.ts} +3 -3
- package/dist/api/postBalances.js +2 -0
- package/dist/api/{postIbcOriginAssets.d.mts → postIbcOriginAssets.d.ts} +1 -1
- package/dist/api/postIbcOriginAssets.js +2 -0
- package/dist/api/{postMessages.d.mts → postMessages.d.ts} +186 -186
- package/dist/api/postMessages.js +2 -0
- package/dist/api/{postMessagesDirect.d.mts → postMessagesDirect.d.ts} +185 -185
- package/dist/api/postMessagesDirect.js +2 -0
- package/dist/api/{postRecommendAssets.d.mts → postRecommendAssets.d.ts} +2 -2
- package/dist/api/postRecommendAssets.js +2 -0
- package/dist/api/{postRoute.d.mts → postRoute.d.ts} +163 -163
- package/dist/api/postRoute.js +2 -0
- package/dist/api/{postSubmitTransaction.d.mts → postSubmitTransaction.d.ts} +1 -1
- package/dist/api/postSubmitTransaction.js +2 -0
- package/dist/api/{postTrackTransaction.d.mts → postTrackTransaction.d.ts} +1 -1
- package/dist/api/postTrackTransaction.js +2 -0
- package/dist/api/{postTransactionStatus.d.mts → postTransactionStatus.d.ts} +3 -3
- package/dist/api/postTransactionStatus.js +2 -0
- package/dist/{api/postRecommendAssets.mjs → chunk-2H4KT24S.js} +2 -2
- package/dist/chunk-3OZQ35X3.js +3597 -0
- package/dist/chunk-44YEAWRJ.js +22 -0
- package/dist/chunk-66DO7NZD.js +183 -0
- package/dist/chunk-6IZXDY7U.js +93 -0
- package/dist/chunk-6JMGI4N7.js +2229 -0
- package/dist/{api/postAssetsFromSource.mjs → chunk-6MCLH626.js} +3 -3
- package/dist/{api/postTrackTransaction.mjs → chunk-6SEZNZJY.js} +2 -2
- package/dist/{api/postSubmitTransaction.mjs → chunk-BQTWTYWD.js} +2 -2
- package/dist/chunk-DUCP65HQ.js +675 -0
- package/dist/{api/postMessages.mjs → chunk-EAVQIWH7.js} +2 -2
- package/dist/{api/postMessagesDirect.mjs → chunk-HFWTLB35.js} +2 -2
- package/dist/{api/getVenues.mjs → chunk-JBPMJE44.js} +2 -2
- package/dist/{api/postIbcOriginAssets.mjs → chunk-LJ4RFN4L.js} +2 -2
- package/dist/{api/postTransactionStatus.mjs → chunk-MKEROBAQ.js} +2 -2
- package/dist/{api/getBridges.mjs → chunk-QKCJUB43.js} +2 -2
- package/dist/{public-functions/setApiOptions.mjs → chunk-RSUFWUIE.js} +5 -7
- package/dist/chunk-SWYON2RG.js +7 -0
- package/dist/chunk-T3G7MVDN.js +16 -0
- package/dist/{public-functions/getRecommendedGasPrice.mjs → chunk-VQ5SIQWU.js} +1 -23
- package/dist/chunk-XEDYWBEU.js +1792 -0
- package/dist/chunk-XOC57DJF.js +269 -0
- package/dist/{api/getAssetsBetweenChains.mjs → chunk-XS6XFYYD.js} +2 -2
- package/dist/chunk-Y325PIRY.js +130 -0
- package/dist/{client-types-CVch1pZ-.d.mts → client-types-CxjtffyG.d.ts} +1 -1
- package/dist/{executeRoute-CRdeEz1o.d.mts → executeRoute-BKvMVd1I.d.ts} +3 -3
- package/dist/{generateApi-3mHZ6Zbr.d.mts → generateApi-DqCp36fX.d.ts} +1 -1
- package/dist/{index.d.mts → index.d.ts} +25 -25
- package/dist/index.js +24 -0
- package/dist/public-functions/{executeRoute.d.mts → executeRoute.d.ts} +4 -4
- package/dist/public-functions/executeRoute.js +12 -0
- package/dist/public-functions/{getFeeInfoForChain.d.mts → getFeeInfoForChain.d.ts} +2 -2
- package/dist/public-functions/getFeeInfoForChain.js +5 -0
- package/dist/public-functions/{getRecommendedGasPrice.d.mts → getRecommendedGasPrice.d.ts} +1 -1
- package/dist/public-functions/getRecommendedGasPrice.js +7 -0
- package/dist/public-functions/getSigningStargateClient.js +4 -0
- package/dist/public-functions/{setApiOptions.d.mts → setApiOptions.d.ts} +2 -2
- package/dist/public-functions/setApiOptions.js +2 -0
- package/dist/public-functions/setClientOptions.d.ts +9 -0
- package/dist/public-functions/setClientOptions.js +4 -0
- package/dist/{setClientOptions-CVB_OUIn.d.mts → setClientOptions-DbanEIwL.d.ts} +2 -2
- package/package.json +40 -6
- package/dist/api/getAssets.mjs +0 -25
- package/dist/api/getChains.mjs +0 -16
- package/dist/api/postBalances.mjs +0 -16
- package/dist/api/postRoute.mjs +0 -16
- package/dist/chunk-AXBFBHS2.mjs +0 -41
- package/dist/index.mjs +0 -24
- package/dist/public-functions/executeRoute.mjs +0 -100
- package/dist/public-functions/getFeeInfoForChain.mjs +0 -47
- package/dist/public-functions/getSigningStargateClient.mjs +0 -32
- package/dist/public-functions/setClientOptions.d.mts +0 -9
- package/dist/public-functions/setClientOptions.mjs +0 -34
- /package/dist/{apiState-CdzxTxYd.d.mts → apiState-CdzxTxYd.d.ts} +0 -0
- /package/dist/public-functions/{getSigningStargateClient.d.mts → getSigningStargateClient.d.ts} +0 -0
- /package/dist/{swaggerTypes-O9-gvCT1.d.mts → swaggerTypes-O9-gvCT1.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skip-go/client",
|
|
3
3
|
"description": "JavaScript SDK for Skip Go API",
|
|
4
|
-
"version": "1.0.0-alpha-
|
|
4
|
+
"version": "1.0.0-alpha-4",
|
|
5
5
|
"repository": "https://github.com/skip-mev/skip-go",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
8
10
|
"exports": {
|
|
9
11
|
".": {
|
|
10
|
-
"import": "./dist/index.
|
|
11
|
-
"types": "./dist/index.d.
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
12
14
|
},
|
|
13
15
|
"./package.json": "./package.json"
|
|
14
16
|
},
|
|
@@ -18,6 +20,38 @@
|
|
|
18
20
|
"*.d.ts"
|
|
19
21
|
],
|
|
20
22
|
"sideEffects": false,
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "yarn run codegen && tsup",
|
|
25
|
+
"clean": "rm -rf dist",
|
|
26
|
+
"codegen": "node scripts/codegen.js",
|
|
27
|
+
"e2e:clean": "make stop clean",
|
|
28
|
+
"e2e:setup": "make setup && make setup-kind",
|
|
29
|
+
"e2e:start": "make start",
|
|
30
|
+
"e2e:stop": "make stop",
|
|
31
|
+
"e2e:test": "vitest --dangerouslyIgnoreUnhandledErrors -c vitest.e2e.config.mjs --test-timeout=30000",
|
|
32
|
+
"postpublish": "git reset --hard",
|
|
33
|
+
"test": "vitest -c vitest.unit.config.mjs",
|
|
34
|
+
"watch": "tsup --watch",
|
|
35
|
+
"watch:link": "tsup --watch --onSuccess \"yalc push\"",
|
|
36
|
+
"update-registries": "yarn up @initia/initia-registry chain-registry",
|
|
37
|
+
"update-types": "node generateTypes.mjs"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@cosmjs/faucet": "0.32.3",
|
|
41
|
+
"@cosmjs/faucet-client": "0.32.3",
|
|
42
|
+
"@cosmology/telescope": "1.8.3",
|
|
43
|
+
"@initia/initia-registry": "^1.0.5",
|
|
44
|
+
"@protobufs/gogoproto": "0.0.10",
|
|
45
|
+
"@protobufs/google": "0.0.10",
|
|
46
|
+
"@types/keccak": "3.0.4",
|
|
47
|
+
"chain-registry": "^1.69.212",
|
|
48
|
+
"eslint-plugin-esm": "^0.8.1",
|
|
49
|
+
"eslint-plugin-import": "^2.31.0",
|
|
50
|
+
"minimatch": "^9.0.3",
|
|
51
|
+
"proxy-from-env": "^1.1.0",
|
|
52
|
+
"swagger-typescript-api": "^13.0.28",
|
|
53
|
+
"vitest": "^1.2.2"
|
|
54
|
+
},
|
|
21
55
|
"peerDependencies": {
|
|
22
56
|
"@solana/web3.js": "^1.95.8",
|
|
23
57
|
"viem": "2.x"
|
|
@@ -40,4 +74,4 @@
|
|
|
40
74
|
"publishConfig": {
|
|
41
75
|
"access": "public"
|
|
42
76
|
}
|
|
43
|
-
}
|
|
77
|
+
}
|
package/dist/api/getAssets.mjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import '../chunk-AXBFBHS2.mjs';
|
|
2
|
-
import { ClientState } from '../state/clientState.mjs';
|
|
3
|
-
import { api } from '../utils/generateApi.mjs';
|
|
4
|
-
|
|
5
|
-
var assets = api({
|
|
6
|
-
methodName: "getAssets",
|
|
7
|
-
path: "/v2/fungible/assets",
|
|
8
|
-
transformResponse: (response) => {
|
|
9
|
-
return transformAssetsMap(response.chainToAssetsMap);
|
|
10
|
-
},
|
|
11
|
-
onSuccess: (response, options) => {
|
|
12
|
-
if ((options == null ? void 0 : options.includeEvmAssets) && (options == null ? void 0 : options.includeSvmAssets) && (options == null ? void 0 : options.includeCw20Assets)) {
|
|
13
|
-
ClientState.skipAssets = response;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
var transformAssetsMap = (input) => Object.entries(input != null ? input : {}).reduce(
|
|
18
|
-
(acc, [chainId, { assets: assets2 }]) => {
|
|
19
|
-
acc[chainId] = (assets2 != null ? assets2 : []).map((asset) => asset);
|
|
20
|
-
return acc;
|
|
21
|
-
},
|
|
22
|
-
{}
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
export { assets, transformAssetsMap };
|
package/dist/api/getChains.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import '../chunk-AXBFBHS2.mjs';
|
|
2
|
-
import { ClientState } from '../state/clientState.mjs';
|
|
3
|
-
import { api } from '../utils/generateApi.mjs';
|
|
4
|
-
|
|
5
|
-
var chains = api({
|
|
6
|
-
methodName: "getChains",
|
|
7
|
-
path: "/v2/info/chains",
|
|
8
|
-
transformResponse: (response) => response.chains,
|
|
9
|
-
onSuccess: (response, options) => {
|
|
10
|
-
if ((options == null ? void 0 : options.includeEvm) && (options == null ? void 0 : options.includeSvm)) {
|
|
11
|
-
ClientState.skipChains = response;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export { chains };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import '../chunk-AXBFBHS2.mjs';
|
|
2
|
-
import { ClientState } from '../state/clientState.mjs';
|
|
3
|
-
import { api } from '../utils/generateApi.mjs';
|
|
4
|
-
|
|
5
|
-
var balances = api({
|
|
6
|
-
methodName: "getBalances",
|
|
7
|
-
method: "post",
|
|
8
|
-
path: "/v2/info/balances",
|
|
9
|
-
onSuccess: (response, options) => {
|
|
10
|
-
if (!options) {
|
|
11
|
-
ClientState.skipBalances = response;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export { balances };
|
package/dist/api/postRoute.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
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 };
|
package/dist/chunk-AXBFBHS2.mjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __async = (__this, __arguments, generator) => {
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
var fulfilled = (value) => {
|
|
23
|
-
try {
|
|
24
|
-
step(generator.next(value));
|
|
25
|
-
} catch (e) {
|
|
26
|
-
reject(e);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
var rejected = (value) => {
|
|
30
|
-
try {
|
|
31
|
-
step(generator.throw(value));
|
|
32
|
-
} catch (e) {
|
|
33
|
-
reject(e);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
37
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export { __async, __spreadProps, __spreadValues };
|
package/dist/index.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import './chunk-AXBFBHS2.mjs';
|
|
2
|
-
export * from './types/index.mjs';
|
|
3
|
-
export { assets } from './api/getAssets.mjs';
|
|
4
|
-
export { assetsBetweenChains } from './api/getAssetsBetweenChains.mjs';
|
|
5
|
-
export { bridges } from './api/getBridges.mjs';
|
|
6
|
-
export { chains } from './api/getChains.mjs';
|
|
7
|
-
export { venues } from './api/getVenues.mjs';
|
|
8
|
-
export { ibcOriginAssets } from './api/postIbcOriginAssets.mjs';
|
|
9
|
-
export { messages } from './api/postMessages.mjs';
|
|
10
|
-
export { messagesDirect } from './api/postMessagesDirect.mjs';
|
|
11
|
-
export { recommendAssets } from './api/postRecommendAssets.mjs';
|
|
12
|
-
export { assetsFromSource } from './api/postAssetsFromSource.mjs';
|
|
13
|
-
export { balances } from './api/postBalances.mjs';
|
|
14
|
-
export { route } from './api/postRoute.mjs';
|
|
15
|
-
export { submitTransaction } from './api/postSubmitTransaction.mjs';
|
|
16
|
-
export { trackTransaction } from './api/postTrackTransaction.mjs';
|
|
17
|
-
export { transactionStatus } from './api/postTransactionStatus.mjs';
|
|
18
|
-
export { executeRoute } from './public-functions/executeRoute.mjs';
|
|
19
|
-
export { getSigningStargateClient } from './public-functions/getSigningStargateClient.mjs';
|
|
20
|
-
export { setClientOptions } from './public-functions/setClientOptions.mjs';
|
|
21
|
-
export { getRecommendedGasPrice } from './public-functions/getRecommendedGasPrice.mjs';
|
|
22
|
-
export { getFeeInfoForChain } from './public-functions/getFeeInfoForChain.mjs';
|
|
23
|
-
export { setApiOptions } from './public-functions/setApiOptions.mjs';
|
|
24
|
-
export { GAS_STATION_CHAIN_IDS } from './constants/constants.mjs';
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { __async, __spreadProps, __spreadValues } from '../chunk-AXBFBHS2.mjs';
|
|
2
|
-
import { PublicKey } from '@solana/web3.js';
|
|
3
|
-
import { ClientState } from '../state/clientState.mjs';
|
|
4
|
-
import { ChainType } from '../types/swaggerTypes.mjs';
|
|
5
|
-
import { bech32m, bech32 } from 'bech32';
|
|
6
|
-
import { executeTransactions } from '../private-functions/executeTransactions.mjs';
|
|
7
|
-
import { messages } from '../api/postMessages.mjs';
|
|
8
|
-
import { isAddress } from 'viem';
|
|
9
|
-
import { ApiState } from 'src/state/apiState.mjs';
|
|
10
|
-
|
|
11
|
-
var executeRoute = (options) => __async(void 0, null, function* () {
|
|
12
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
13
|
-
const { route, userAddresses, beforeMsg, afterMsg, timeoutSeconds } = options;
|
|
14
|
-
let addressList = [];
|
|
15
|
-
userAddresses.forEach((userAddress, index) => {
|
|
16
|
-
const requiredChainAddress = route.requiredChainAddresses[index];
|
|
17
|
-
if (requiredChainAddress === (userAddress == null ? void 0 : userAddress.chainId)) {
|
|
18
|
-
addressList.push(userAddress.address);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
if (addressList.length !== route.requiredChainAddresses.length) {
|
|
22
|
-
addressList = userAddresses.map((x) => x.address);
|
|
23
|
-
}
|
|
24
|
-
const validLength = addressList.length === route.requiredChainAddresses.length || addressList.length === ((_a = route.chainIds) == null ? void 0 : _a.length);
|
|
25
|
-
if (!validLength) {
|
|
26
|
-
throw new Error("executeRoute error: invalid address list");
|
|
27
|
-
}
|
|
28
|
-
const isUserAddressesValid = yield validateUserAddresses(userAddresses);
|
|
29
|
-
if (!isUserAddressesValid) {
|
|
30
|
-
throw new Error("executeRoute error: invalid user addresses");
|
|
31
|
-
}
|
|
32
|
-
const response = yield messages({
|
|
33
|
-
timeoutSeconds,
|
|
34
|
-
amountIn: route == null ? void 0 : route.amountIn,
|
|
35
|
-
amountOut: route.estimatedAmountOut || "0",
|
|
36
|
-
sourceAssetChainId: route == null ? void 0 : route.sourceAssetChainId,
|
|
37
|
-
sourceAssetDenom: route == null ? void 0 : route.sourceAssetDenom,
|
|
38
|
-
destAssetChainId: route == null ? void 0 : route.destAssetChainId,
|
|
39
|
-
destAssetDenom: route == null ? void 0 : route.destAssetDenom,
|
|
40
|
-
operations: route == null ? void 0 : route.operations,
|
|
41
|
-
addressList,
|
|
42
|
-
slippageTolerancePercent: options.slippageTolerancePercent || "1",
|
|
43
|
-
chainIdsToAffiliates: ApiState.chainIdsToAffiliates
|
|
44
|
-
});
|
|
45
|
-
if (beforeMsg && ((_c = (_b = response == null ? void 0 : response.txs) == null ? void 0 : _b.length) != null ? _c : 0) > 0) {
|
|
46
|
-
const firstTx = (_d = response == null ? void 0 : response.txs) == null ? void 0 : _d[0];
|
|
47
|
-
if (firstTx && "cosmosTx" in firstTx) {
|
|
48
|
-
(_f = (_e = firstTx.cosmosTx) == null ? void 0 : _e.msgs) == null ? void 0 : _f.unshift(beforeMsg);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (afterMsg && ((_h = (_g = response == null ? void 0 : response.txs) == null ? void 0 : _g.length) != null ? _h : 0) > 0) {
|
|
52
|
-
const lastTx = (_i = response == null ? void 0 : response.txs) == null ? void 0 : _i[response.txs.length - 1];
|
|
53
|
-
if (lastTx && "cosmosTx" in lastTx) {
|
|
54
|
-
(_k = (_j = lastTx.cosmosTx) == null ? void 0 : _j.msgs) == null ? void 0 : _k.push(afterMsg);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
yield executeTransactions(__spreadProps(__spreadValues({}, options), { txs: response == null ? void 0 : response.txs }));
|
|
58
|
-
});
|
|
59
|
-
var validateUserAddresses = (userAddresses) => __async(void 0, null, function* () {
|
|
60
|
-
const chains = yield ClientState.getSkipChains();
|
|
61
|
-
const validations = userAddresses.map((userAddress) => {
|
|
62
|
-
var _a, _b;
|
|
63
|
-
const chain = chains.find((chain2) => chain2.chainId === userAddress.chainId);
|
|
64
|
-
switch (chain == null ? void 0 : chain.chainType) {
|
|
65
|
-
case ChainType.Cosmos:
|
|
66
|
-
try {
|
|
67
|
-
if ((_a = chain.chainId) == null ? void 0 : _a.includes("penumbra")) {
|
|
68
|
-
try {
|
|
69
|
-
return chain.bech32Prefix === ((_b = bech32m.decode(userAddress.address, 143)) == null ? void 0 : _b.prefix);
|
|
70
|
-
} catch (e) {
|
|
71
|
-
return ["penumbracompat1", "tpenumbra"].includes(
|
|
72
|
-
bech32.decode(userAddress.address, 1023).prefix
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return chain.bech32Prefix === bech32.decode(userAddress.address, 1023).prefix;
|
|
77
|
-
} catch (e) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
case ChainType.Evm:
|
|
81
|
-
try {
|
|
82
|
-
return isAddress(userAddress.address);
|
|
83
|
-
} catch (_error) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
case ChainType.Svm:
|
|
87
|
-
try {
|
|
88
|
-
const publicKey = new PublicKey(userAddress.address);
|
|
89
|
-
return PublicKey.isOnCurve(publicKey);
|
|
90
|
-
} catch (_error) {
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
default:
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
return validations.every((validation) => validation);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
export { executeRoute };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { __async } from '../chunk-AXBFBHS2.mjs';
|
|
2
|
-
import { chains } from 'src/chains.mjs';
|
|
3
|
-
import { getDefaultGasTokenForChain } from '../private-functions/getDefaultGasTokenForChain.mjs';
|
|
4
|
-
import { ClientState } from 'src/state/clientState.mjs';
|
|
5
|
-
|
|
6
|
-
var getFeeInfoForChain = (_0) => __async(void 0, [_0], function* ({ chainId, apiUrl, apiKey }) {
|
|
7
|
-
var _a, _b, _c, _d, _e;
|
|
8
|
-
const skipChains = yield ClientState.getSkipChains({ apiUrl, apiKey });
|
|
9
|
-
const skipChain = skipChains.find((chain2) => chain2.chainId === chainId);
|
|
10
|
-
if (!skipChain) {
|
|
11
|
-
return void 0;
|
|
12
|
-
}
|
|
13
|
-
const defaultGasToken = yield getDefaultGasTokenForChain(chainId);
|
|
14
|
-
if (!defaultGasToken && !skipChain.feeAssets) {
|
|
15
|
-
return void 0;
|
|
16
|
-
}
|
|
17
|
-
const skipFeeInfo = defaultGasToken ? (_a = skipChain.feeAssets) == null ? void 0 : _a.find((skipFee) => skipFee.denom === defaultGasToken) : (_b = skipChain.feeAssets) == null ? void 0 : _b[0];
|
|
18
|
-
if (!skipFeeInfo && ((_d = (_c = skipChain.feeAssets) == null ? void 0 : _c[0]) == null ? void 0 : _d.gasPrice) !== null) {
|
|
19
|
-
return (_e = skipChain.feeAssets) == null ? void 0 : _e[0];
|
|
20
|
-
}
|
|
21
|
-
if (skipFeeInfo && skipFeeInfo.gasPrice !== null) {
|
|
22
|
-
return skipFeeInfo;
|
|
23
|
-
}
|
|
24
|
-
const chain = chains().find((chain2) => chain2.chain_id === chainId);
|
|
25
|
-
if (!chain) {
|
|
26
|
-
return void 0;
|
|
27
|
-
}
|
|
28
|
-
if (!chain.fees) {
|
|
29
|
-
return void 0;
|
|
30
|
-
}
|
|
31
|
-
const registryFeeInfo = chain.fees.fee_tokens.find(
|
|
32
|
-
(feeToken) => feeToken.denom === defaultGasToken
|
|
33
|
-
);
|
|
34
|
-
if (!registryFeeInfo) {
|
|
35
|
-
return void 0;
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
denom: registryFeeInfo.denom,
|
|
39
|
-
gasPrice: {
|
|
40
|
-
low: registryFeeInfo.low_gas_price ? `${registryFeeInfo.low_gas_price}` : "",
|
|
41
|
-
average: registryFeeInfo.average_gas_price ? `${registryFeeInfo.average_gas_price}` : "",
|
|
42
|
-
high: registryFeeInfo.high_gas_price ? `${registryFeeInfo.high_gas_price}` : ""
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export { getFeeInfoForChain };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { __async } from '../chunk-AXBFBHS2.mjs';
|
|
2
|
-
import { ClientState } from '../state/clientState.mjs';
|
|
3
|
-
import { SigningStargateClient } from '@cosmjs/stargate';
|
|
4
|
-
import { accountParser } from 'src/registry.mjs';
|
|
5
|
-
import { getRpcEndpointForChain } from '../private-functions/getRpcEndpointForChain.mjs';
|
|
6
|
-
|
|
7
|
-
var getSigningStargateClient = (_0) => __async(void 0, [_0], function* ({
|
|
8
|
-
chainId,
|
|
9
|
-
getOfflineSigner
|
|
10
|
-
}) {
|
|
11
|
-
var _a;
|
|
12
|
-
if (!getOfflineSigner) {
|
|
13
|
-
throw new Error("'getCosmosSigner' is not provided or configured in skip router");
|
|
14
|
-
}
|
|
15
|
-
if (!((_a = ClientState.signingStargateClientByChainId) == null ? void 0 : _a[chainId])) {
|
|
16
|
-
const [signer, endpoint] = yield Promise.all([
|
|
17
|
-
getOfflineSigner(chainId),
|
|
18
|
-
getRpcEndpointForChain(chainId)
|
|
19
|
-
]);
|
|
20
|
-
ClientState.signingStargateClientByChainId[chainId] = yield SigningStargateClient.connectWithSigner(endpoint, signer, {
|
|
21
|
-
aminoTypes: ClientState.aminoTypes,
|
|
22
|
-
registry: ClientState.registry,
|
|
23
|
-
accountParser
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
stargateClient: ClientState.signingStargateClientByChainId[chainId],
|
|
28
|
-
signer: yield getOfflineSigner(chainId)
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
export { getSigningStargateClient };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { s as setClientOptions } from '../setClientOptions-CVB_OUIn.mjs';
|
|
2
|
-
import '@cosmjs/proto-signing';
|
|
3
|
-
import '@cosmjs/stargate';
|
|
4
|
-
import '../apiState-CdzxTxYd.mjs';
|
|
5
|
-
import '../client-types-CVch1pZ-.mjs';
|
|
6
|
-
import '@cosmjs/amino';
|
|
7
|
-
import 'viem';
|
|
8
|
-
import '@solana/wallet-adapter-base';
|
|
9
|
-
import '../swaggerTypes-O9-gvCT1.mjs';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { __spreadValues } from '../chunk-AXBFBHS2.mjs';
|
|
2
|
-
import { AminoTypes, createDefaultAminoConverters, defaultRegistryTypes } from '@cosmjs/stargate';
|
|
3
|
-
import { createWasmAminoConverters } from '@cosmjs/cosmwasm-stargate/build/modules/wasm/aminomessages';
|
|
4
|
-
import { circleAminoConverters, circleProtoRegistry } from 'src/codegen/circle/client.mjs';
|
|
5
|
-
import { evmosAminoConverters, evmosProtoRegistry } from 'src/codegen/evmos/client.mjs';
|
|
6
|
-
import { Registry } from '@cosmjs/proto-signing/build/registry';
|
|
7
|
-
import { MsgExecuteContract } from 'cosmjs-types/cosmwasm/wasm/v1/tx';
|
|
8
|
-
import { MsgExecute } from 'src/codegen/initia/move/v1/tx.mjs';
|
|
9
|
-
import { MsgInitiateTokenDeposit } from 'src/codegen/opinit/ophost/v1/tx.mjs';
|
|
10
|
-
import { ClientState } from '../state/clientState.mjs';
|
|
11
|
-
import { createRequestClient } from '../utils/generateApi.mjs';
|
|
12
|
-
import { ApiState } from 'src/state/apiState.mjs';
|
|
13
|
-
|
|
14
|
-
var setClientOptions = (options = {}) => {
|
|
15
|
-
var _a, _b, _c;
|
|
16
|
-
ApiState.client = createRequestClient({
|
|
17
|
-
baseUrl: options.apiUrl || "https://api.skip.build",
|
|
18
|
-
apiKey: options.apiKey
|
|
19
|
-
});
|
|
20
|
-
ClientState.endpointOptions = (_a = options.endpointOptions) != null ? _a : {};
|
|
21
|
-
ClientState.aminoTypes = new AminoTypes(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, createDefaultAminoConverters()), createWasmAminoConverters()), circleAminoConverters), evmosAminoConverters), (_b = options.aminoTypes) != null ? _b : {}));
|
|
22
|
-
ClientState.registry = new Registry([
|
|
23
|
-
...defaultRegistryTypes,
|
|
24
|
-
["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract],
|
|
25
|
-
["/initia.move.v1.MsgExecute", MsgExecute],
|
|
26
|
-
["/opinit.ophost.v1.MsgInitiateTokenDeposit", MsgInitiateTokenDeposit],
|
|
27
|
-
...circleProtoRegistry,
|
|
28
|
-
...evmosProtoRegistry,
|
|
29
|
-
...(_c = options.registryTypes) != null ? _c : []
|
|
30
|
-
]);
|
|
31
|
-
ApiState.setClientInitialized();
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export { setClientOptions };
|
|
File without changes
|
/package/dist/public-functions/{getSigningStargateClient.d.mts → getSigningStargateClient.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|