@skip-go/client 1.0.1 → 1.0.3-alpha-0
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.js +2 -15
- package/dist/api/getAssetsBetweenChains.js +2 -11
- package/dist/api/getBridges.js +2 -11
- package/dist/api/getChains.js +2 -11
- package/dist/api/getVenues.js +2 -11
- package/dist/api/postAssetsFromSource.js +3 -12
- package/dist/api/postBalances.js +2 -11
- package/dist/api/postIbcOriginAssets.js +2 -11
- package/dist/api/postMessages.d.ts +183 -183
- package/dist/api/postMessages.js +2 -11
- package/dist/api/postMessagesDirect.d.ts +183 -183
- package/dist/api/postMessagesDirect.js +2 -11
- package/dist/api/postRecommendAssets.js +2 -11
- package/dist/api/postRoute.d.ts +160 -160
- package/dist/api/postRoute.js +2 -11
- package/dist/api/postSubmitTransaction.js +2 -11
- package/dist/api/postTrackTransaction.js +2 -11
- package/dist/api/postTransactionStatus.js +2 -11
- package/dist/chunk-33K6EESX.js +10 -0
- package/dist/{chunk-Z4ZKOUGH.js → chunk-4JJWOILI.js} +3 -5
- package/dist/chunk-BQTQJQ5E.js +10 -0
- package/dist/chunk-BRMONS6A.js +130 -0
- package/dist/{chunk-ZG23Z3WY.js → chunk-C2EDPY6J.js} +3 -5
- package/dist/chunk-DW4U6YI6.js +10 -0
- package/dist/chunk-F75DC5RW.js +1786 -0
- package/dist/chunk-GARVPN2H.js +16 -0
- package/dist/{chunk-CG5CQQBW.js → chunk-JTIHU43D.js} +33 -42
- package/dist/{chunk-5ZJBR5AQ.js → chunk-KNV72XRZ.js} +3 -5
- package/dist/chunk-MGVXJ2U4.js +11 -0
- package/dist/chunk-MTMPHY3Y.js +9 -0
- package/dist/{chunk-GFRPLEJR.js → chunk-PHTQQIAH.js} +278 -311
- package/dist/{chunk-RE2QZJWE.js → chunk-PRQ2NHRZ.js} +3 -5
- package/dist/chunk-RDRDFJQE.js +10 -0
- package/dist/chunk-RMP3HM5N.js +14 -0
- package/dist/{chunk-X2YPYBVN.js → chunk-SONZJVQM.js} +59 -68
- package/dist/chunk-SWYON2RG.js +1 -4
- package/dist/{chunk-RT5TZAMU.js → chunk-TD63P2AG.js} +212 -312
- package/dist/{chunk-PKPZTO4H.js → chunk-TW77BXMT.js} +10 -13
- package/dist/chunk-UNF72WYO.js +22 -0
- package/dist/{chunk-4XWIXR2P.js → chunk-VMPFHQ7U.js} +19 -27
- package/dist/chunk-VQ5SIQWU.js +1 -3
- package/dist/chunk-W6TBGBV3.js +675 -0
- package/dist/index.d.ts +0 -3
- package/dist/index.js +24 -209
- package/dist/public-functions/executeRoute.js +12 -21
- package/dist/public-functions/getFeeInfoForChain.js +5 -14
- package/dist/public-functions/getRecommendedGasPrice.d.ts +1 -1
- package/dist/public-functions/getRecommendedGasPrice.js +7 -16
- package/dist/public-functions/getSigningStargateClient.d.ts +2 -2
- package/dist/public-functions/getSigningStargateClient.js +4 -13
- package/dist/public-functions/setApiOptions.js +2 -11
- package/dist/public-functions/setClientOptions.js +4 -13
- package/package.json +12 -3
- package/dist/chunk-2WHYWV4Y.js +0 -12
- package/dist/chunk-5KVRQLI5.js +0 -17
- package/dist/chunk-6BTWKTNM.js +0 -16
- package/dist/chunk-6GJEXV5J.js +0 -130
- package/dist/chunk-ASPVKNJ7.js +0 -242
- package/dist/chunk-EQLA2SEZ.js +0 -2361
- package/dist/chunk-FVSSCQ6C.js +0 -12
- package/dist/chunk-KYFTM3PI.js +0 -12
- package/dist/chunk-L2Q5RP6O.js +0 -25
- package/dist/chunk-LRIPQQ4M.js +0 -11
- package/dist/chunk-X2E2TKVR.js +0 -12
- package/dist/chunk-YYNIFO2A.js +0 -13
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var chunkASPVKNJ7_js = require('./chunk-ASPVKNJ7.js');
|
|
1
|
+
import { ApiState, createRequestClient } from './chunk-W6TBGBV3.js';
|
|
4
2
|
|
|
5
3
|
// src/public-functions/setApiOptions.ts
|
|
6
4
|
var setApiOptions = (options = {}) => {
|
|
7
|
-
|
|
5
|
+
ApiState.client = createRequestClient({
|
|
8
6
|
baseUrl: options.apiUrl || "https://api.skip.build",
|
|
9
7
|
apiKey: options.apiKey
|
|
10
8
|
});
|
|
11
|
-
|
|
9
|
+
ApiState.setClientInitialized();
|
|
12
10
|
if (options.chainIdsToAffiliates) {
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
ApiState.cumulativeAffiliateFeeBPS = validateChainIdsToAffiliates(options.chainIdsToAffiliates);
|
|
12
|
+
ApiState.chainIdsToAffiliates = options.chainIdsToAffiliates;
|
|
15
13
|
}
|
|
16
|
-
return
|
|
14
|
+
return ApiState.clientInitialized;
|
|
17
15
|
};
|
|
18
16
|
function validateChainIdsToAffiliates(chainIdsToAffiliates) {
|
|
19
|
-
var _a;
|
|
20
17
|
const affiliatesArray = Object.values(chainIdsToAffiliates).map((chain) => chain.affiliates).filter((a) => a !== void 0);
|
|
21
|
-
const firstAffiliateBasisPointsFee =
|
|
18
|
+
const firstAffiliateBasisPointsFee = affiliatesArray[0]?.reduce((acc, affiliate) => {
|
|
22
19
|
if (!affiliate.basisPointsFee) {
|
|
23
20
|
throw new Error("basisPointFee must exist in each affiliate");
|
|
24
21
|
}
|
|
@@ -32,7 +29,7 @@ function validateChainIdsToAffiliates(chainIdsToAffiliates) {
|
|
|
32
29
|
if (!affiliate2.address) {
|
|
33
30
|
throw new Error("address to receive fee must exist in each affiliate");
|
|
34
31
|
}
|
|
35
|
-
return acc + parseInt(affiliate2
|
|
32
|
+
return acc + parseInt(affiliate2?.basisPointsFee, 10);
|
|
36
33
|
}, 0);
|
|
37
34
|
return totalBasisPointsFee === firstAffiliateBasisPointsFee;
|
|
38
35
|
});
|
|
@@ -41,7 +38,7 @@ function validateChainIdsToAffiliates(chainIdsToAffiliates) {
|
|
|
41
38
|
"basisPointFee does not add up to the same number for each chain in chainIdsToAffiliates"
|
|
42
39
|
);
|
|
43
40
|
}
|
|
44
|
-
return firstAffiliateBasisPointsFee
|
|
41
|
+
return firstAffiliateBasisPointsFee?.toFixed(0);
|
|
45
42
|
}
|
|
46
43
|
|
|
47
|
-
|
|
44
|
+
export { setApiOptions };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BigNumber } from './chunk-VQ5SIQWU.js';
|
|
2
|
+
import { getFeeInfoForChain } from './chunk-VMPFHQ7U.js';
|
|
3
|
+
import { Decimal } from '@cosmjs/math';
|
|
4
|
+
import { GasPrice } from '@cosmjs/stargate';
|
|
5
|
+
|
|
6
|
+
var getRecommendedGasPrice = async (props) => {
|
|
7
|
+
const feeInfo = await getFeeInfoForChain(props);
|
|
8
|
+
if (!feeInfo || !feeInfo.gasPrice) {
|
|
9
|
+
return void 0;
|
|
10
|
+
}
|
|
11
|
+
let price = feeInfo.gasPrice.average;
|
|
12
|
+
if (price === "") {
|
|
13
|
+
price = feeInfo.gasPrice.high;
|
|
14
|
+
}
|
|
15
|
+
if (price === "") {
|
|
16
|
+
price = feeInfo.gasPrice.low;
|
|
17
|
+
}
|
|
18
|
+
if (!price) return;
|
|
19
|
+
return new GasPrice(Decimal.fromUserInput(BigNumber(price).toFixed(), 18), feeInfo.denom);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { getRecommendedGasPrice };
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var chunkCG5CQQBW_js = require('./chunk-CG5CQQBW.js');
|
|
5
|
-
var chunk6GJEXV5J_js = require('./chunk-6GJEXV5J.js');
|
|
6
|
-
var chunkASPVKNJ7_js = require('./chunk-ASPVKNJ7.js');
|
|
1
|
+
import { DEFAULT_GAS_DENOM_OVERRIDES } from './chunk-SWYON2RG.js';
|
|
2
|
+
import { chains } from './chunk-JTIHU43D.js';
|
|
3
|
+
import { ClientState } from './chunk-BRMONS6A.js';
|
|
7
4
|
|
|
8
5
|
// src/private-functions/getDefaultGasTokenForChain.ts
|
|
9
|
-
var getDefaultGasTokenForChain = (chainId) =>
|
|
10
|
-
|
|
11
|
-
const gasDenom = chunkSWYON2RG_js.DEFAULT_GAS_DENOM_OVERRIDES[chainId];
|
|
6
|
+
var getDefaultGasTokenForChain = async (chainId) => {
|
|
7
|
+
const gasDenom = DEFAULT_GAS_DENOM_OVERRIDES[chainId];
|
|
12
8
|
if (gasDenom) {
|
|
13
9
|
return gasDenom;
|
|
14
10
|
}
|
|
15
|
-
const chain =
|
|
11
|
+
const chain = chains().find((chain2) => chain2.chain_id === chainId);
|
|
16
12
|
if (!chain) {
|
|
17
13
|
return void 0;
|
|
18
14
|
}
|
|
@@ -22,10 +18,7 @@ var getDefaultGasTokenForChain = (chainId) => chunkASPVKNJ7_js.__async(void 0, n
|
|
|
22
18
|
const stakingTokens = getStakingTokensForChain(chainId);
|
|
23
19
|
if (stakingTokens && stakingTokens.length > 0) {
|
|
24
20
|
const feeAsset = chain.fees.fee_tokens.find(
|
|
25
|
-
(feeToken) =>
|
|
26
|
-
var _a2;
|
|
27
|
-
return feeToken.denom === ((_a2 = stakingTokens[0]) == null ? void 0 : _a2.denom);
|
|
28
|
-
}
|
|
21
|
+
(feeToken) => feeToken.denom === stakingTokens[0]?.denom
|
|
29
22
|
);
|
|
30
23
|
if (feeAsset) {
|
|
31
24
|
return feeAsset.denom;
|
|
@@ -41,10 +34,10 @@ var getDefaultGasTokenForChain = (chainId) => chunkASPVKNJ7_js.__async(void 0, n
|
|
|
41
34
|
if (nonL2Asset) {
|
|
42
35
|
return nonL2Asset.denom;
|
|
43
36
|
}
|
|
44
|
-
return
|
|
45
|
-
}
|
|
37
|
+
return chain.fees.fee_tokens[0]?.denom;
|
|
38
|
+
};
|
|
46
39
|
var getStakingTokensForChain = (chainId) => {
|
|
47
|
-
const chain =
|
|
40
|
+
const chain = chains().find((chain2) => chain2.chain_id === chainId);
|
|
48
41
|
if (!chain) {
|
|
49
42
|
throw new Error(
|
|
50
43
|
`getStakingTokensForChain error: failed to find chain id '${chainId}' in registry`
|
|
@@ -57,25 +50,24 @@ var getStakingTokensForChain = (chainId) => {
|
|
|
57
50
|
};
|
|
58
51
|
|
|
59
52
|
// src/public-functions/getFeeInfoForChain.ts
|
|
60
|
-
var getFeeInfoForChain =
|
|
61
|
-
|
|
62
|
-
const skipChains = yield chunk6GJEXV5J_js.ClientState.getSkipChains({ apiUrl, apiKey });
|
|
53
|
+
var getFeeInfoForChain = async ({ chainId, apiUrl, apiKey }) => {
|
|
54
|
+
const skipChains = await ClientState.getSkipChains({ apiUrl, apiKey });
|
|
63
55
|
const skipChain = skipChains.find((chain2) => chain2.chainId === chainId);
|
|
64
56
|
if (!skipChain) {
|
|
65
57
|
return void 0;
|
|
66
58
|
}
|
|
67
|
-
const defaultGasToken =
|
|
59
|
+
const defaultGasToken = await getDefaultGasTokenForChain(chainId);
|
|
68
60
|
if (!defaultGasToken && !skipChain.feeAssets) {
|
|
69
61
|
return void 0;
|
|
70
62
|
}
|
|
71
|
-
const skipFeeInfo = defaultGasToken ?
|
|
72
|
-
if (!skipFeeInfo &&
|
|
73
|
-
return
|
|
63
|
+
const skipFeeInfo = defaultGasToken ? skipChain.feeAssets?.find((skipFee) => skipFee.denom === defaultGasToken) : skipChain.feeAssets?.[0];
|
|
64
|
+
if (!skipFeeInfo && skipChain.feeAssets?.[0]?.gasPrice !== null) {
|
|
65
|
+
return skipChain.feeAssets?.[0];
|
|
74
66
|
}
|
|
75
67
|
if (skipFeeInfo && skipFeeInfo.gasPrice !== null) {
|
|
76
68
|
return skipFeeInfo;
|
|
77
69
|
}
|
|
78
|
-
const chain =
|
|
70
|
+
const chain = chains().find((chain2) => chain2.chain_id === chainId);
|
|
79
71
|
if (!chain) {
|
|
80
72
|
return void 0;
|
|
81
73
|
}
|
|
@@ -96,6 +88,6 @@ var getFeeInfoForChain = (_0) => chunkASPVKNJ7_js.__async(void 0, [_0], function
|
|
|
96
88
|
high: registryFeeInfo.high_gas_price ? `${registryFeeInfo.high_gas_price}` : ""
|
|
97
89
|
}
|
|
98
90
|
};
|
|
99
|
-
}
|
|
91
|
+
};
|
|
100
92
|
|
|
101
|
-
|
|
93
|
+
export { getFeeInfoForChain };
|
package/dist/chunk-VQ5SIQWU.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
// ../../node_modules/bignumber.js/bignumber.mjs
|
|
4
2
|
var isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
|
|
5
3
|
var mathceil = Math.ceil;
|
|
@@ -1343,4 +1341,4 @@ function toFixedPoint(str, e, z) {
|
|
|
1343
1341
|
}
|
|
1344
1342
|
var BigNumber = clone();
|
|
1345
1343
|
|
|
1346
|
-
|
|
1344
|
+
export { BigNumber };
|