@skip-go/client 1.0.0-alpha-2 → 1.0.0-alpha-3
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.mjs +2 -25
- package/dist/api/getAssetsBetweenChains.mjs +2 -9
- package/dist/api/getBridges.mjs +2 -10
- package/dist/api/getChains.mjs +2 -16
- package/dist/api/getVenues.mjs +2 -10
- package/dist/api/postAssetsFromSource.mjs +3 -14
- package/dist/api/postBalances.mjs +2 -16
- package/dist/api/postIbcOriginAssets.mjs +2 -11
- package/dist/api/postMessages.d.mts +183 -183
- package/dist/api/postMessages.mjs +2 -10
- package/dist/api/postMessagesDirect.d.mts +183 -183
- package/dist/api/postMessagesDirect.mjs +2 -10
- package/dist/api/postRecommendAssets.mjs +2 -13
- package/dist/api/postRoute.d.mts +160 -160
- package/dist/api/postRoute.mjs +2 -16
- package/dist/api/postSubmitTransaction.mjs +2 -10
- package/dist/api/postTrackTransaction.mjs +2 -11
- package/dist/api/postTransactionStatus.mjs +2 -10
- package/dist/chunk-2ETF4N4H.mjs +45 -0
- package/dist/chunk-2F4MBSMT.mjs +99 -0
- package/dist/chunk-2FYLP573.mjs +15 -0
- package/dist/chunk-7TBBV2YY.mjs +13 -0
- package/dist/chunk-B72MYSG5.mjs +273 -0
- package/dist/chunk-C5CGY2X7.mjs +10 -0
- package/dist/chunk-CAAR7GDJ.mjs +11 -0
- package/dist/chunk-CZ27FEZ7.mjs +11 -0
- package/dist/chunk-DKIWPD5I.mjs +124 -0
- package/dist/chunk-IGD32L7C.mjs +9 -0
- package/dist/chunk-J7GGREYX.mjs +10 -0
- package/dist/chunk-KPK3Z6QZ.mjs +10 -0
- package/dist/chunk-KSMJWLEH.mjs +2315 -0
- package/dist/chunk-LJVI5DLG.mjs +10 -0
- package/dist/chunk-NNZFCKHP.mjs +10 -0
- package/dist/chunk-NU7MCJOK.mjs +187 -0
- package/dist/chunk-OTLFF5OB.mjs +3634 -0
- package/dist/chunk-PEZHVPSR.mjs +2237 -0
- package/dist/chunk-QZ3X6MP3.mjs +10 -0
- package/dist/chunk-RXWDHQLG.mjs +231 -0
- package/dist/chunk-TUBI6VE6.mjs +1344 -0
- package/dist/chunk-WDMGUHWR.mjs +23 -0
- package/dist/chunk-YWYU6P7W.mjs +14 -0
- package/dist/chunk-ZAF3Z56R.mjs +7 -0
- package/dist/index.mjs +24 -24
- package/dist/public-functions/executeRoute.mjs +12 -100
- package/dist/public-functions/getFeeInfoForChain.mjs +5 -47
- package/dist/public-functions/getRecommendedGasPrice.mjs +7 -1366
- package/dist/public-functions/getSigningStargateClient.mjs +4 -32
- package/dist/public-functions/setApiOptions.mjs +2 -46
- package/dist/public-functions/setClientOptions.mjs +4 -34
- package/package.json +1 -8
- package/dist/chunk-AXBFBHS2.mjs +0 -41
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BigNumber } from './chunk-TUBI6VE6.mjs';
|
|
2
|
+
import { getFeeInfoForChain } from './chunk-2F4MBSMT.mjs';
|
|
3
|
+
import { __async } from './chunk-RXWDHQLG.mjs';
|
|
4
|
+
import { Decimal } from '@cosmjs/math/build/decimal';
|
|
5
|
+
import { GasPrice } from '@cosmjs/stargate';
|
|
6
|
+
|
|
7
|
+
var getRecommendedGasPrice = (props) => __async(void 0, null, function* () {
|
|
8
|
+
const feeInfo = yield getFeeInfoForChain(props);
|
|
9
|
+
if (!feeInfo || !feeInfo.gasPrice) {
|
|
10
|
+
return void 0;
|
|
11
|
+
}
|
|
12
|
+
let price = feeInfo.gasPrice.average;
|
|
13
|
+
if (price === "") {
|
|
14
|
+
price = feeInfo.gasPrice.high;
|
|
15
|
+
}
|
|
16
|
+
if (price === "") {
|
|
17
|
+
price = feeInfo.gasPrice.low;
|
|
18
|
+
}
|
|
19
|
+
if (!price) return;
|
|
20
|
+
return new GasPrice(Decimal.fromUserInput(BigNumber(price).toFixed(), 18), feeInfo.denom);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export { getRecommendedGasPrice };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { transformAssetsMap } from './chunk-DKIWPD5I.mjs';
|
|
2
|
+
import { api } from './chunk-RXWDHQLG.mjs';
|
|
3
|
+
|
|
4
|
+
// src/api/postAssetsFromSource.ts
|
|
5
|
+
var assetsFromSource = api({
|
|
6
|
+
methodName: "getAssetsFromSource",
|
|
7
|
+
method: "post",
|
|
8
|
+
path: "/v2/fungible/assets_from_source",
|
|
9
|
+
transformResponse(response) {
|
|
10
|
+
return transformAssetsMap(response.destAssets);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { assetsFromSource };
|
package/dist/index.mjs
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
|
|
1
|
+
export { Api, AutopilotAction, AxelarTransferState, AxelarTransferType, BridgeType, CCTPTransferState, ChainType, ContentType, ContractCallWithTokenErrorType, FeeType, GoFastTransferState, HttpClient, HyperlaneTransferState, LayerZeroTransferState, OPInitTransferState, PacketErrorType, Reason, RoutePriceWarningType, SendTokenErrorType, StargateTransferState, StatusErrorType, TransactionState, TransferState, executeRoute } from './chunk-KSMJWLEH.mjs';
|
|
2
|
+
export { getRecommendedGasPrice } from './chunk-WDMGUHWR.mjs';
|
|
3
|
+
import './chunk-TUBI6VE6.mjs';
|
|
4
|
+
export { getFeeInfoForChain } from './chunk-2F4MBSMT.mjs';
|
|
5
|
+
export { GAS_STATION_CHAIN_IDS } from './chunk-ZAF3Z56R.mjs';
|
|
6
|
+
export { getSigningStargateClient } from './chunk-B72MYSG5.mjs';
|
|
7
|
+
import './chunk-NU7MCJOK.mjs';
|
|
8
|
+
export { setApiOptions } from './chunk-2ETF4N4H.mjs';
|
|
9
|
+
export { setClientOptions } from './chunk-PEZHVPSR.mjs';
|
|
10
|
+
import './chunk-OTLFF5OB.mjs';
|
|
11
|
+
export { ibcOriginAssets } from './chunk-CZ27FEZ7.mjs';
|
|
12
|
+
export { messages } from './chunk-KPK3Z6QZ.mjs';
|
|
13
|
+
export { messagesDirect } from './chunk-QZ3X6MP3.mjs';
|
|
14
|
+
export { recommendAssets } from './chunk-7TBBV2YY.mjs';
|
|
15
|
+
export { route } from './chunk-2FYLP573.mjs';
|
|
16
|
+
export { submitTransaction } from './chunk-LJVI5DLG.mjs';
|
|
17
|
+
export { trackTransaction } from './chunk-CAAR7GDJ.mjs';
|
|
18
|
+
export { transactionStatus } from './chunk-C5CGY2X7.mjs';
|
|
19
|
+
export { assetsBetweenChains } from './chunk-IGD32L7C.mjs';
|
|
20
|
+
export { bridges } from './chunk-J7GGREYX.mjs';
|
|
21
|
+
export { venues } from './chunk-NNZFCKHP.mjs';
|
|
22
|
+
export { assetsFromSource } from './chunk-YWYU6P7W.mjs';
|
|
23
|
+
export { assets, balances, chains } from './chunk-DKIWPD5I.mjs';
|
|
24
|
+
import './chunk-RXWDHQLG.mjs';
|
|
@@ -1,100 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
export { executeRoute } from '../chunk-KSMJWLEH.mjs';
|
|
2
|
+
import '../chunk-TUBI6VE6.mjs';
|
|
3
|
+
import '../chunk-ZAF3Z56R.mjs';
|
|
4
|
+
import '../chunk-B72MYSG5.mjs';
|
|
5
|
+
import '../chunk-NU7MCJOK.mjs';
|
|
6
|
+
import '../chunk-OTLFF5OB.mjs';
|
|
7
|
+
import '../chunk-KPK3Z6QZ.mjs';
|
|
8
|
+
import '../chunk-LJVI5DLG.mjs';
|
|
9
|
+
import '../chunk-CAAR7GDJ.mjs';
|
|
10
|
+
import '../chunk-C5CGY2X7.mjs';
|
|
11
|
+
import '../chunk-DKIWPD5I.mjs';
|
|
12
|
+
import '../chunk-RXWDHQLG.mjs';
|
|
@@ -1,47 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
|
+
export { getFeeInfoForChain } from '../chunk-2F4MBSMT.mjs';
|
|
2
|
+
import '../chunk-ZAF3Z56R.mjs';
|
|
3
|
+
import '../chunk-NU7MCJOK.mjs';
|
|
4
|
+
import '../chunk-DKIWPD5I.mjs';
|
|
5
|
+
import '../chunk-RXWDHQLG.mjs';
|