@skip-go/client 1.0.1 → 1.0.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/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.js +2 -11
- package/dist/api/postMessagesDirect.js +2 -11
- package/dist/api/postRecommendAssets.js +2 -11
- 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-X2YPYBVN.js → chunk-3N7XVGLX.js} +59 -68
- package/dist/{chunk-RT5TZAMU.js → chunk-3OZQ35X3.js} +212 -312
- package/dist/{chunk-Z4ZKOUGH.js → chunk-4JJWOILI.js} +3 -5
- package/dist/chunk-735L35R6.js +1790 -0
- package/dist/chunk-BQTQJQ5E.js +10 -0
- package/dist/chunk-BRJDNGYH.js +22 -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-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-RE2QZJWE.js → chunk-PRQ2NHRZ.js} +3 -5
- package/dist/chunk-RDRDFJQE.js +10 -0
- package/dist/chunk-RMP3HM5N.js +14 -0
- package/dist/{chunk-GFRPLEJR.js → chunk-SQGWZAUC.js} +279 -311
- package/dist/chunk-SWYON2RG.js +1 -4
- package/dist/{chunk-PKPZTO4H.js → chunk-TW77BXMT.js} +10 -13
- 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 -2
- 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 +1 -1
- 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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BigNumber } from './chunk-VQ5SIQWU.js';
|
|
2
|
+
import { getFeeInfoForChain } from './chunk-VMPFHQ7U.js';
|
|
3
|
+
import { Decimal } from '@cosmjs/math/build/decimal';
|
|
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 };
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { api } from './chunk-W6TBGBV3.js';
|
|
2
|
+
|
|
3
|
+
// src/private-functions/getMainnetAndTestnetChains.ts
|
|
4
|
+
var getMainnetAndTestnetChains = async (apiOptions) => {
|
|
5
|
+
const [mainnetRes, testnetRes] = await Promise.all([
|
|
6
|
+
chains({
|
|
7
|
+
includeEvm: true,
|
|
8
|
+
includeSvm: true,
|
|
9
|
+
...apiOptions
|
|
10
|
+
}),
|
|
11
|
+
chains({
|
|
12
|
+
includeEvm: true,
|
|
13
|
+
includeSvm: true,
|
|
14
|
+
onlyTestnets: true,
|
|
15
|
+
...apiOptions
|
|
16
|
+
})
|
|
17
|
+
]);
|
|
18
|
+
const combinedChains = [...mainnetRes ?? [], ...testnetRes ?? []];
|
|
19
|
+
ClientState.skipChains = combinedChains;
|
|
20
|
+
return combinedChains;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// src/api/getAssets.ts
|
|
24
|
+
var assets = api({
|
|
25
|
+
methodName: "getAssets",
|
|
26
|
+
path: "/v2/fungible/assets",
|
|
27
|
+
transformResponse: (response) => {
|
|
28
|
+
return transformAssetsMap(response.chainToAssetsMap);
|
|
29
|
+
},
|
|
30
|
+
onSuccess: (response, options) => {
|
|
31
|
+
if (options?.includeEvmAssets && options?.includeSvmAssets && options?.includeCw20Assets) {
|
|
32
|
+
ClientState.skipAssets = response;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
var transformAssetsMap = (input) => Object.entries(input ?? {}).reduce(
|
|
37
|
+
(acc, [chainId, { assets: assets2 }]) => {
|
|
38
|
+
acc[chainId] = (assets2 ?? []).map((asset) => asset);
|
|
39
|
+
return acc;
|
|
40
|
+
},
|
|
41
|
+
{}
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
// src/private-functions/getMainnetAndTestnetAssets.ts
|
|
45
|
+
var getMainnetAndTestnetAssets = async ({
|
|
46
|
+
chainId,
|
|
47
|
+
...apiOptions
|
|
48
|
+
}) => {
|
|
49
|
+
const [assetsMainnet, assetsTestnet] = await Promise.all([
|
|
50
|
+
assets({
|
|
51
|
+
chainIds: chainId ? [chainId] : void 0,
|
|
52
|
+
...apiOptions
|
|
53
|
+
}),
|
|
54
|
+
assets({
|
|
55
|
+
chainIds: chainId ? [chainId] : void 0,
|
|
56
|
+
onlyTestnets: true,
|
|
57
|
+
...apiOptions
|
|
58
|
+
})
|
|
59
|
+
]);
|
|
60
|
+
const mainnet = assetsMainnet;
|
|
61
|
+
const testnet = assetsTestnet;
|
|
62
|
+
const merged = {
|
|
63
|
+
...mainnet,
|
|
64
|
+
...testnet
|
|
65
|
+
};
|
|
66
|
+
ClientState.skipAssets = merged;
|
|
67
|
+
return merged;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// src/api/postBalances.ts
|
|
71
|
+
var balances = api({
|
|
72
|
+
methodName: "getBalances",
|
|
73
|
+
method: "post",
|
|
74
|
+
path: "/v2/info/balances",
|
|
75
|
+
onSuccess: (response, options) => {
|
|
76
|
+
if (!options) {
|
|
77
|
+
ClientState.skipBalances = response;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// src/state/clientState.ts
|
|
83
|
+
var ClientState = class {
|
|
84
|
+
static aminoTypes;
|
|
85
|
+
static registry;
|
|
86
|
+
static endpointOptions;
|
|
87
|
+
static skipChains;
|
|
88
|
+
static skipAssets;
|
|
89
|
+
static skipBalances;
|
|
90
|
+
static async getSkipChains(apiOptions) {
|
|
91
|
+
if (this.skipChains) {
|
|
92
|
+
return this.skipChains;
|
|
93
|
+
}
|
|
94
|
+
const response = await getMainnetAndTestnetChains(apiOptions);
|
|
95
|
+
this.skipChains = response;
|
|
96
|
+
return response;
|
|
97
|
+
}
|
|
98
|
+
static async getSkipAssets(props) {
|
|
99
|
+
if (this.skipAssets) {
|
|
100
|
+
return this.skipAssets;
|
|
101
|
+
}
|
|
102
|
+
const response = await getMainnetAndTestnetAssets(props);
|
|
103
|
+
this.skipAssets = response;
|
|
104
|
+
return response;
|
|
105
|
+
}
|
|
106
|
+
static async getSkipBalances() {
|
|
107
|
+
if (this.skipBalances) {
|
|
108
|
+
return this.skipBalances;
|
|
109
|
+
}
|
|
110
|
+
const response = await balances();
|
|
111
|
+
this.skipBalances = response;
|
|
112
|
+
return response;
|
|
113
|
+
}
|
|
114
|
+
static signingStargateClientByChainId = {};
|
|
115
|
+
static validateGasResults;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// src/api/getChains.ts
|
|
119
|
+
var chains = api({
|
|
120
|
+
methodName: "getChains",
|
|
121
|
+
path: "/v2/info/chains",
|
|
122
|
+
transformResponse: (response) => response.chains,
|
|
123
|
+
onSuccess: (response, options) => {
|
|
124
|
+
if (options?.includeEvm && options?.includeSvm) {
|
|
125
|
+
ClientState.skipChains = response;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
export { ClientState, assets, balances, chains, transformAssetsMap };
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var chunkASPVKNJ7_js = require('./chunk-ASPVKNJ7.js');
|
|
1
|
+
import { api } from './chunk-W6TBGBV3.js';
|
|
4
2
|
|
|
5
3
|
// src/api/getVenues.ts
|
|
6
|
-
var venues =
|
|
4
|
+
var venues = api({
|
|
7
5
|
methodName: "getVenues",
|
|
8
6
|
path: "/v2/fungible/venues",
|
|
9
7
|
transformResponse: (response) => response.venues
|
|
10
8
|
});
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
export { venues };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ApiState, api } from './chunk-W6TBGBV3.js';
|
|
2
|
+
|
|
3
|
+
// src/api/postRoute.ts
|
|
4
|
+
var route = async (request) => {
|
|
5
|
+
const requestWithAffiliateFeeBps = {
|
|
6
|
+
...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 };
|