@chainflip/sdk 1.8.3 → 1.9.0-beta.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/chunk-GWPJTKIG.mjs +106 -0
- package/dist/funding.d.mts +1 -1
- package/dist/funding.d.ts +1 -1
- package/dist/funding.js +12 -25
- package/dist/funding.mjs +8 -5
- package/dist/swap.d.mts +326 -215
- package/dist/swap.d.ts +326 -215
- package/dist/swap.js +214 -587
- package/dist/swap.mjs +183 -377
- package/package.json +5 -5
- package/dist/chunk-HBQFFIRA.mjs +0 -292
- package/dist/enums-_AFEOA70.d.mts +0 -69
- package/dist/enums-_AFEOA70.d.ts +0 -69
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainflip/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0-beta.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./swap": {
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@chainflip/bitcoin": "^1.2.
|
|
45
|
-
"@chainflip/rpc": "
|
|
46
|
-
"@chainflip/solana": "^2.1.
|
|
47
|
-
"@chainflip/utils": "^0.
|
|
44
|
+
"@chainflip/bitcoin": "^1.2.5",
|
|
45
|
+
"@chainflip/rpc": "~1.9.5",
|
|
46
|
+
"@chainflip/solana": "^2.1.7",
|
|
47
|
+
"@chainflip/utils": "^0.8.6",
|
|
48
48
|
"@trpc/client": "^10.45.2",
|
|
49
49
|
"axios": "^1.7.7",
|
|
50
50
|
"bignumber.js": "^9.1.2",
|
package/dist/chunk-HBQFFIRA.mjs
DELETED
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
import { HttpClient, constants } from '@chainflip/rpc';
|
|
2
|
-
|
|
3
|
-
// ../shared/src/enums.ts
|
|
4
|
-
var arrayToMap = (array) => Object.fromEntries(array.map((key) => [key, key]));
|
|
5
|
-
var InternalAssets = arrayToMap([
|
|
6
|
-
"Flip",
|
|
7
|
-
"Usdc",
|
|
8
|
-
"Dot",
|
|
9
|
-
"Eth",
|
|
10
|
-
"Btc",
|
|
11
|
-
"Usdt",
|
|
12
|
-
"ArbUsdc",
|
|
13
|
-
"ArbEth",
|
|
14
|
-
"Sol",
|
|
15
|
-
"SolUsdc"
|
|
16
|
-
]);
|
|
17
|
-
var Chains = arrayToMap(["Bitcoin", "Ethereum", "Polkadot", "Arbitrum", "Solana"]);
|
|
18
|
-
var Assets = arrayToMap(["FLIP", "USDC", "DOT", "ETH", "BTC", "USDT", "SOL"]);
|
|
19
|
-
var ChainflipNetworks = arrayToMap(["backspin", "sisyphos", "perseverance", "mainnet"]);
|
|
20
|
-
var isTestnet = (network) => network !== ChainflipNetworks.mainnet;
|
|
21
|
-
var assetConstants = {
|
|
22
|
-
[InternalAssets.Eth]: {
|
|
23
|
-
chain: Chains.Ethereum,
|
|
24
|
-
asset: Assets.ETH,
|
|
25
|
-
name: "Ether",
|
|
26
|
-
decimals: 18,
|
|
27
|
-
contractId: 1
|
|
28
|
-
},
|
|
29
|
-
[InternalAssets.Flip]: {
|
|
30
|
-
chain: Chains.Ethereum,
|
|
31
|
-
asset: Assets.FLIP,
|
|
32
|
-
name: "FLIP",
|
|
33
|
-
decimals: 18,
|
|
34
|
-
contractId: 2
|
|
35
|
-
},
|
|
36
|
-
[InternalAssets.Usdc]: {
|
|
37
|
-
chain: Chains.Ethereum,
|
|
38
|
-
asset: Assets.USDC,
|
|
39
|
-
name: "USDC",
|
|
40
|
-
decimals: 6,
|
|
41
|
-
contractId: 3
|
|
42
|
-
},
|
|
43
|
-
[InternalAssets.Usdt]: {
|
|
44
|
-
chain: Chains.Ethereum,
|
|
45
|
-
asset: Assets.USDT,
|
|
46
|
-
name: "USDT",
|
|
47
|
-
decimals: 6,
|
|
48
|
-
contractId: 8
|
|
49
|
-
},
|
|
50
|
-
[InternalAssets.Dot]: {
|
|
51
|
-
chain: Chains.Polkadot,
|
|
52
|
-
asset: Assets.DOT,
|
|
53
|
-
name: "Polkadot",
|
|
54
|
-
decimals: 10,
|
|
55
|
-
contractId: 4
|
|
56
|
-
},
|
|
57
|
-
[InternalAssets.Btc]: {
|
|
58
|
-
chain: Chains.Bitcoin,
|
|
59
|
-
asset: Assets.BTC,
|
|
60
|
-
name: "Bitcoin",
|
|
61
|
-
decimals: 8,
|
|
62
|
-
contractId: 5
|
|
63
|
-
},
|
|
64
|
-
[InternalAssets.ArbEth]: {
|
|
65
|
-
chain: Chains.Arbitrum,
|
|
66
|
-
asset: Assets.ETH,
|
|
67
|
-
name: "Arbitrum Ether",
|
|
68
|
-
decimals: 18,
|
|
69
|
-
contractId: 6
|
|
70
|
-
},
|
|
71
|
-
[InternalAssets.ArbUsdc]: {
|
|
72
|
-
chain: Chains.Arbitrum,
|
|
73
|
-
asset: Assets.USDC,
|
|
74
|
-
name: "Arbitrum USDC",
|
|
75
|
-
decimals: 6,
|
|
76
|
-
contractId: 7
|
|
77
|
-
},
|
|
78
|
-
[InternalAssets.Sol]: {
|
|
79
|
-
chain: Chains.Solana,
|
|
80
|
-
asset: Assets.SOL,
|
|
81
|
-
name: "Solana",
|
|
82
|
-
decimals: 9,
|
|
83
|
-
contractId: 9
|
|
84
|
-
},
|
|
85
|
-
[InternalAssets.SolUsdc]: {
|
|
86
|
-
chain: Chains.Solana,
|
|
87
|
-
asset: Assets.USDC,
|
|
88
|
-
name: "Solana USDC",
|
|
89
|
-
decimals: 6,
|
|
90
|
-
contractId: 10
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
var chainConstants = {
|
|
94
|
-
[Chains.Ethereum]: {
|
|
95
|
-
assets: [Assets.ETH, Assets.FLIP, Assets.USDC, Assets.USDT],
|
|
96
|
-
gasAsset: InternalAssets.Eth,
|
|
97
|
-
contractId: 1,
|
|
98
|
-
blockTimeSeconds: 12
|
|
99
|
-
},
|
|
100
|
-
[Chains.Polkadot]: {
|
|
101
|
-
assets: [Assets.DOT],
|
|
102
|
-
gasAsset: InternalAssets.Dot,
|
|
103
|
-
contractId: 2,
|
|
104
|
-
blockTimeSeconds: 6
|
|
105
|
-
},
|
|
106
|
-
[Chains.Bitcoin]: {
|
|
107
|
-
assets: [Assets.BTC],
|
|
108
|
-
gasAsset: InternalAssets.Btc,
|
|
109
|
-
contractId: 3,
|
|
110
|
-
blockTimeSeconds: 10 * 60
|
|
111
|
-
},
|
|
112
|
-
[Chains.Arbitrum]: {
|
|
113
|
-
assets: [Assets.ETH, Assets.USDC],
|
|
114
|
-
gasAsset: InternalAssets.ArbEth,
|
|
115
|
-
contractId: 4,
|
|
116
|
-
blockTimeSeconds: 0.26
|
|
117
|
-
},
|
|
118
|
-
[Chains.Solana]: {
|
|
119
|
-
assets: [Assets.SOL, Assets.USDC],
|
|
120
|
-
gasAsset: InternalAssets.Sol,
|
|
121
|
-
contractId: 5,
|
|
122
|
-
blockTimeSeconds: (400 + 800) / 2 / 1e3
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
function isValidAssetAndChain(assetAndChain) {
|
|
126
|
-
const { asset, chain } = assetAndChain;
|
|
127
|
-
if (!(chain in Chains)) return false;
|
|
128
|
-
const validAssets = chainConstants[chain].assets;
|
|
129
|
-
return validAssets.includes(asset);
|
|
130
|
-
}
|
|
131
|
-
var readChainAssetValue = (map, asset) => {
|
|
132
|
-
const { chain, asset: symbol } = assetConstants[asset];
|
|
133
|
-
const chainValues = map[chain];
|
|
134
|
-
return chainValues[symbol];
|
|
135
|
-
};
|
|
136
|
-
function getInternalAsset(asset, assert2 = true) {
|
|
137
|
-
if (!isValidAssetAndChain(asset)) {
|
|
138
|
-
if (assert2) {
|
|
139
|
-
throw new Error(`invalid asset and chain combination: ${JSON.stringify(asset)}`);
|
|
140
|
-
}
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
const map = {
|
|
144
|
-
[Chains.Ethereum]: {
|
|
145
|
-
[Assets.USDC]: InternalAssets.Usdc,
|
|
146
|
-
[Assets.FLIP]: InternalAssets.Flip,
|
|
147
|
-
[Assets.ETH]: InternalAssets.Eth,
|
|
148
|
-
[Assets.USDT]: InternalAssets.Usdt
|
|
149
|
-
},
|
|
150
|
-
[Chains.Bitcoin]: {
|
|
151
|
-
[Assets.BTC]: InternalAssets.Btc
|
|
152
|
-
},
|
|
153
|
-
[Chains.Polkadot]: {
|
|
154
|
-
[Assets.DOT]: InternalAssets.Dot
|
|
155
|
-
},
|
|
156
|
-
[Chains.Arbitrum]: {
|
|
157
|
-
[Assets.USDC]: InternalAssets.ArbUsdc,
|
|
158
|
-
[Assets.ETH]: InternalAssets.ArbEth
|
|
159
|
-
},
|
|
160
|
-
[Chains.Solana]: {
|
|
161
|
-
[Assets.SOL]: InternalAssets.Sol,
|
|
162
|
-
[Assets.USDC]: InternalAssets.SolUsdc
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
const chain = map[asset.chain];
|
|
166
|
-
return chain[asset.asset];
|
|
167
|
-
}
|
|
168
|
-
function getInternalAssets({
|
|
169
|
-
srcAsset,
|
|
170
|
-
srcChain,
|
|
171
|
-
destAsset,
|
|
172
|
-
destChain
|
|
173
|
-
}, assert2 = true) {
|
|
174
|
-
return {
|
|
175
|
-
srcAsset: getInternalAsset({ asset: srcAsset, chain: srcChain }, assert2),
|
|
176
|
-
destAsset: getInternalAsset({ asset: destAsset, chain: destChain }, assert2)
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
function getAssetAndChain(internalAsset, prefix) {
|
|
180
|
-
const { chain, asset } = assetConstants[internalAsset];
|
|
181
|
-
if (prefix) {
|
|
182
|
-
return {
|
|
183
|
-
[`${prefix}Asset`]: asset,
|
|
184
|
-
[`${prefix}Chain`]: chain
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
return { chain, asset };
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// ../shared/src/guards.ts
|
|
191
|
-
var isString = (value) => typeof value === "string";
|
|
192
|
-
var isNotNullish = (value) => value !== null && value !== void 0;
|
|
193
|
-
function assert(condition, message, Constructor = Error) {
|
|
194
|
-
if (condition) return;
|
|
195
|
-
const error = new Constructor(message);
|
|
196
|
-
if (error.stack) {
|
|
197
|
-
error.stack = error.stack.replace(/\n.+/, "\n");
|
|
198
|
-
}
|
|
199
|
-
throw error;
|
|
200
|
-
}
|
|
201
|
-
var camelCase = (str) => str.replace(/_([a-z])/g, (_, char) => char.toUpperCase());
|
|
202
|
-
var camelCaseKeys = (obj) => {
|
|
203
|
-
if (typeof obj !== "object" || obj === null) return obj;
|
|
204
|
-
if (Array.isArray(obj)) return obj.map((item) => camelCaseKeys(item));
|
|
205
|
-
return Object.fromEntries(
|
|
206
|
-
Object.entries(obj).map(([key, value]) => [camelCase(key), camelCaseKeys(value)])
|
|
207
|
-
);
|
|
208
|
-
};
|
|
209
|
-
var createRequest = (method) => async (urlOrNetwork, ...params) => {
|
|
210
|
-
const url = "network" in urlOrNetwork ? constants.PUBLIC_RPC_ENDPOINTS[urlOrNetwork.network] : urlOrNetwork.rpcUrl;
|
|
211
|
-
const result = await new HttpClient(url).sendRequest(method, ...params);
|
|
212
|
-
return camelCaseKeys(result);
|
|
213
|
-
};
|
|
214
|
-
var transform = (fn, cb) => (...args) => fn(...args).then(cb);
|
|
215
|
-
var getFundingEnvironment = createRequest("cf_funding_environment");
|
|
216
|
-
var getEnvironment = createRequest("cf_environment");
|
|
217
|
-
var getSupportedAssets = createRequest("cf_supported_assets");
|
|
218
|
-
var getAllBoostPoolsDepth = transform(
|
|
219
|
-
createRequest("cf_boost_pools_depth"),
|
|
220
|
-
(result) => result.map(({ chain, asset, ...rest }) => ({
|
|
221
|
-
asset: getInternalAsset({ chain, asset }),
|
|
222
|
-
...rest
|
|
223
|
-
}))
|
|
224
|
-
);
|
|
225
|
-
var ETHEREUM_EVM_CHAIN_ID = {
|
|
226
|
-
[ChainflipNetworks.backspin]: 10997,
|
|
227
|
-
// backspin ethereum
|
|
228
|
-
[ChainflipNetworks.sisyphos]: 11155111,
|
|
229
|
-
// sepolia
|
|
230
|
-
[ChainflipNetworks.perseverance]: 11155111,
|
|
231
|
-
// sepolia
|
|
232
|
-
[ChainflipNetworks.mainnet]: 1
|
|
233
|
-
// mainnet
|
|
234
|
-
};
|
|
235
|
-
var ARBITRUM_EVM_CHAIN_ID = {
|
|
236
|
-
[ChainflipNetworks.backspin]: 412346,
|
|
237
|
-
// backspin arbitrum
|
|
238
|
-
[ChainflipNetworks.sisyphos]: 421614,
|
|
239
|
-
// arb-sepolia
|
|
240
|
-
[ChainflipNetworks.perseverance]: 421614,
|
|
241
|
-
// arb-sepolia
|
|
242
|
-
[ChainflipNetworks.mainnet]: 42161
|
|
243
|
-
// mainnet
|
|
244
|
-
};
|
|
245
|
-
var getEvmChainId = (chain, network) => {
|
|
246
|
-
switch (chain) {
|
|
247
|
-
case Chains.Ethereum:
|
|
248
|
-
return ETHEREUM_EVM_CHAIN_ID[network];
|
|
249
|
-
case Chains.Arbitrum:
|
|
250
|
-
return ARBITRUM_EVM_CHAIN_ID[network];
|
|
251
|
-
default:
|
|
252
|
-
return void 0;
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
var SEPOLIA_USDC_CONTRACT_ADDRESS = "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238";
|
|
256
|
-
var SEPOLIA_USDT_CONTRACT_ADDRESS = "0x27CEA6Eb8a21Aae05Eb29C91c5CA10592892F584";
|
|
257
|
-
var ADDRESSES = {
|
|
258
|
-
[ChainflipNetworks.backspin]: {
|
|
259
|
-
FLIP_CONTRACT_ADDRESS: "0x10C6E9530F1C1AF873a391030a1D9E8ed0630D26",
|
|
260
|
-
USDC_CONTRACT_ADDRESS: "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0",
|
|
261
|
-
USDT_CONTRACT_ADDRESS: "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82",
|
|
262
|
-
ARBUSDC_CONTRACT_ADDRESS: "0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9",
|
|
263
|
-
STATE_CHAIN_GATEWAY_ADDRESS: "0xeEBe00Ac0756308ac4AaBfD76c05c4F3088B8883",
|
|
264
|
-
SOLUSDC_CONTRACT_ADDRESS: "24PNhTaNtomHhoy3fTRaMhAFCRj4uHqhZEEoWrKDbR5p"
|
|
265
|
-
},
|
|
266
|
-
[ChainflipNetworks.sisyphos]: {
|
|
267
|
-
FLIP_CONTRACT_ADDRESS: "0xcD079EAB6B5443b545788Fd210C8800FEADd87fa",
|
|
268
|
-
USDC_CONTRACT_ADDRESS: SEPOLIA_USDC_CONTRACT_ADDRESS,
|
|
269
|
-
USDT_CONTRACT_ADDRESS: SEPOLIA_USDT_CONTRACT_ADDRESS,
|
|
270
|
-
ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
|
|
271
|
-
STATE_CHAIN_GATEWAY_ADDRESS: "0x1F7fE41C798cc7b1D34BdC8de2dDDA4a4bE744D9",
|
|
272
|
-
SOLUSDC_CONTRACT_ADDRESS: "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"
|
|
273
|
-
},
|
|
274
|
-
[ChainflipNetworks.perseverance]: {
|
|
275
|
-
FLIP_CONTRACT_ADDRESS: "0xdC27c60956cB065D19F08bb69a707E37b36d8086",
|
|
276
|
-
USDC_CONTRACT_ADDRESS: SEPOLIA_USDC_CONTRACT_ADDRESS,
|
|
277
|
-
USDT_CONTRACT_ADDRESS: SEPOLIA_USDT_CONTRACT_ADDRESS,
|
|
278
|
-
ARBUSDC_CONTRACT_ADDRESS: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
|
|
279
|
-
STATE_CHAIN_GATEWAY_ADDRESS: "0xA34a967197Ee90BB7fb28e928388a573c5CFd099",
|
|
280
|
-
SOLUSDC_CONTRACT_ADDRESS: "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"
|
|
281
|
-
},
|
|
282
|
-
[ChainflipNetworks.mainnet]: {
|
|
283
|
-
FLIP_CONTRACT_ADDRESS: "0x826180541412D574cf1336d22c0C0a287822678A",
|
|
284
|
-
USDC_CONTRACT_ADDRESS: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
285
|
-
USDT_CONTRACT_ADDRESS: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
|
|
286
|
-
ARBUSDC_CONTRACT_ADDRESS: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
287
|
-
STATE_CHAIN_GATEWAY_ADDRESS: "0x6995Ab7c4D7F4B03f467Cf4c8E920427d9621DBd",
|
|
288
|
-
SOLUSDC_CONTRACT_ADDRESS: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
export { ADDRESSES, Assets, ChainflipNetworks, Chains, InternalAssets, assert, assetConstants, getAllBoostPoolsDepth, getAssetAndChain, getEnvironment, getEvmChainId, getFundingEnvironment, getInternalAsset, getInternalAssets, getSupportedAssets, isNotNullish, isString, isTestnet, isValidAssetAndChain, readChainAssetValue };
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
type ArrayToMap<T extends readonly string[]> = {
|
|
2
|
-
[K in T[number]]: K;
|
|
3
|
-
};
|
|
4
|
-
declare const InternalAssets: ArrayToMap<readonly ["Flip", "Usdc", "Dot", "Eth", "Btc", "Usdt", "ArbUsdc", "ArbEth", "Sol", "SolUsdc"]>;
|
|
5
|
-
type InternalAsset = (typeof InternalAssets)[keyof typeof InternalAssets];
|
|
6
|
-
declare const Chains: ArrayToMap<readonly ["Bitcoin", "Ethereum", "Polkadot", "Arbitrum", "Solana"]>;
|
|
7
|
-
type Chain = (typeof Chains)[keyof typeof Chains];
|
|
8
|
-
declare const Assets: ArrayToMap<readonly ["FLIP", "USDC", "DOT", "ETH", "BTC", "USDT", "SOL"]>;
|
|
9
|
-
type Asset = (typeof Assets)[keyof typeof Assets];
|
|
10
|
-
declare const ChainflipNetworks: ArrayToMap<readonly ["backspin", "sisyphos", "perseverance", "mainnet"]>;
|
|
11
|
-
type ChainflipNetwork = (typeof ChainflipNetworks)[keyof typeof ChainflipNetworks];
|
|
12
|
-
declare const chainConstants: {
|
|
13
|
-
readonly Ethereum: {
|
|
14
|
-
readonly assets: ["ETH", "FLIP", "USDC", "USDT"];
|
|
15
|
-
readonly gasAsset: "Eth";
|
|
16
|
-
readonly contractId: 1;
|
|
17
|
-
readonly blockTimeSeconds: 12;
|
|
18
|
-
};
|
|
19
|
-
readonly Polkadot: {
|
|
20
|
-
readonly assets: ["DOT"];
|
|
21
|
-
readonly gasAsset: "Dot";
|
|
22
|
-
readonly contractId: 2;
|
|
23
|
-
readonly blockTimeSeconds: 6;
|
|
24
|
-
};
|
|
25
|
-
readonly Bitcoin: {
|
|
26
|
-
readonly assets: ["BTC"];
|
|
27
|
-
readonly gasAsset: "Btc";
|
|
28
|
-
readonly contractId: 3;
|
|
29
|
-
readonly blockTimeSeconds: number;
|
|
30
|
-
};
|
|
31
|
-
readonly Arbitrum: {
|
|
32
|
-
readonly assets: ["ETH", "USDC"];
|
|
33
|
-
readonly gasAsset: "ArbEth";
|
|
34
|
-
readonly contractId: 4;
|
|
35
|
-
readonly blockTimeSeconds: 0.26;
|
|
36
|
-
};
|
|
37
|
-
readonly Solana: {
|
|
38
|
-
readonly assets: ["SOL", "USDC"];
|
|
39
|
-
readonly gasAsset: "Sol";
|
|
40
|
-
readonly contractId: 5;
|
|
41
|
-
readonly blockTimeSeconds: number;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
type AssetOfChain<C extends Chain> = (typeof chainConstants)[C]['assets'][number];
|
|
45
|
-
type UncheckedAssetAndChain = {
|
|
46
|
-
asset: Asset;
|
|
47
|
-
chain: Chain;
|
|
48
|
-
};
|
|
49
|
-
type AssetAndChain = {
|
|
50
|
-
[C in Chain]: {
|
|
51
|
-
[A in AssetOfChain<C>]: {
|
|
52
|
-
chain: C;
|
|
53
|
-
asset: A;
|
|
54
|
-
};
|
|
55
|
-
}[AssetOfChain<C>];
|
|
56
|
-
}[Chain];
|
|
57
|
-
type ChainAssetMap<T> = {
|
|
58
|
-
[C in Chain]: {
|
|
59
|
-
[A in AssetOfChain<C>]: T;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
type ChainMap<T> = {
|
|
63
|
-
[C in Chain]: T;
|
|
64
|
-
};
|
|
65
|
-
declare function getInternalAsset(asset: UncheckedAssetAndChain): InternalAsset;
|
|
66
|
-
declare function getInternalAsset(asset: UncheckedAssetAndChain, assert: true): InternalAsset;
|
|
67
|
-
declare function getInternalAsset(asset: UncheckedAssetAndChain, assert: boolean): InternalAsset | null;
|
|
68
|
-
|
|
69
|
-
export { type AssetAndChain as A, type Chain as C, type InternalAsset as I, type UncheckedAssetAndChain as U, type Asset as a, type AssetOfChain as b, type ChainflipNetwork as c, type ChainAssetMap as d, type ChainMap as e, Chains as f, Assets as g, InternalAssets as h, ChainflipNetworks as i, getInternalAsset as j };
|
package/dist/enums-_AFEOA70.d.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
type ArrayToMap<T extends readonly string[]> = {
|
|
2
|
-
[K in T[number]]: K;
|
|
3
|
-
};
|
|
4
|
-
declare const InternalAssets: ArrayToMap<readonly ["Flip", "Usdc", "Dot", "Eth", "Btc", "Usdt", "ArbUsdc", "ArbEth", "Sol", "SolUsdc"]>;
|
|
5
|
-
type InternalAsset = (typeof InternalAssets)[keyof typeof InternalAssets];
|
|
6
|
-
declare const Chains: ArrayToMap<readonly ["Bitcoin", "Ethereum", "Polkadot", "Arbitrum", "Solana"]>;
|
|
7
|
-
type Chain = (typeof Chains)[keyof typeof Chains];
|
|
8
|
-
declare const Assets: ArrayToMap<readonly ["FLIP", "USDC", "DOT", "ETH", "BTC", "USDT", "SOL"]>;
|
|
9
|
-
type Asset = (typeof Assets)[keyof typeof Assets];
|
|
10
|
-
declare const ChainflipNetworks: ArrayToMap<readonly ["backspin", "sisyphos", "perseverance", "mainnet"]>;
|
|
11
|
-
type ChainflipNetwork = (typeof ChainflipNetworks)[keyof typeof ChainflipNetworks];
|
|
12
|
-
declare const chainConstants: {
|
|
13
|
-
readonly Ethereum: {
|
|
14
|
-
readonly assets: ["ETH", "FLIP", "USDC", "USDT"];
|
|
15
|
-
readonly gasAsset: "Eth";
|
|
16
|
-
readonly contractId: 1;
|
|
17
|
-
readonly blockTimeSeconds: 12;
|
|
18
|
-
};
|
|
19
|
-
readonly Polkadot: {
|
|
20
|
-
readonly assets: ["DOT"];
|
|
21
|
-
readonly gasAsset: "Dot";
|
|
22
|
-
readonly contractId: 2;
|
|
23
|
-
readonly blockTimeSeconds: 6;
|
|
24
|
-
};
|
|
25
|
-
readonly Bitcoin: {
|
|
26
|
-
readonly assets: ["BTC"];
|
|
27
|
-
readonly gasAsset: "Btc";
|
|
28
|
-
readonly contractId: 3;
|
|
29
|
-
readonly blockTimeSeconds: number;
|
|
30
|
-
};
|
|
31
|
-
readonly Arbitrum: {
|
|
32
|
-
readonly assets: ["ETH", "USDC"];
|
|
33
|
-
readonly gasAsset: "ArbEth";
|
|
34
|
-
readonly contractId: 4;
|
|
35
|
-
readonly blockTimeSeconds: 0.26;
|
|
36
|
-
};
|
|
37
|
-
readonly Solana: {
|
|
38
|
-
readonly assets: ["SOL", "USDC"];
|
|
39
|
-
readonly gasAsset: "Sol";
|
|
40
|
-
readonly contractId: 5;
|
|
41
|
-
readonly blockTimeSeconds: number;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
type AssetOfChain<C extends Chain> = (typeof chainConstants)[C]['assets'][number];
|
|
45
|
-
type UncheckedAssetAndChain = {
|
|
46
|
-
asset: Asset;
|
|
47
|
-
chain: Chain;
|
|
48
|
-
};
|
|
49
|
-
type AssetAndChain = {
|
|
50
|
-
[C in Chain]: {
|
|
51
|
-
[A in AssetOfChain<C>]: {
|
|
52
|
-
chain: C;
|
|
53
|
-
asset: A;
|
|
54
|
-
};
|
|
55
|
-
}[AssetOfChain<C>];
|
|
56
|
-
}[Chain];
|
|
57
|
-
type ChainAssetMap<T> = {
|
|
58
|
-
[C in Chain]: {
|
|
59
|
-
[A in AssetOfChain<C>]: T;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
type ChainMap<T> = {
|
|
63
|
-
[C in Chain]: T;
|
|
64
|
-
};
|
|
65
|
-
declare function getInternalAsset(asset: UncheckedAssetAndChain): InternalAsset;
|
|
66
|
-
declare function getInternalAsset(asset: UncheckedAssetAndChain, assert: true): InternalAsset;
|
|
67
|
-
declare function getInternalAsset(asset: UncheckedAssetAndChain, assert: boolean): InternalAsset | null;
|
|
68
|
-
|
|
69
|
-
export { type AssetAndChain as A, type Chain as C, type InternalAsset as I, type UncheckedAssetAndChain as U, type Asset as a, type AssetOfChain as b, type ChainflipNetwork as c, type ChainAssetMap as d, type ChainMap as e, Chains as f, Assets as g, InternalAssets as h, ChainflipNetworks as i, getInternalAsset as j };
|