@chainflip/utils 2.1.2-beta.0 → 2.1.2-beta.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/chainflip.cjs +24 -8
- package/dist/chainflip.d.cts +47 -2
- package/dist/chainflip.d.mts +47 -2
- package/dist/chainflip.mjs +21 -9
- package/package.json +1 -1
package/dist/chainflip.cjs
CHANGED
|
@@ -167,14 +167,6 @@ const chainConstants = {
|
|
|
167
167
|
addressType: "Eth",
|
|
168
168
|
blockTimeSeconds: 12
|
|
169
169
|
},
|
|
170
|
-
Polkadot: {
|
|
171
|
-
chainflipAssets: ["Dot"],
|
|
172
|
-
assets: ["DOT"],
|
|
173
|
-
rpcAssets: ["DOT"],
|
|
174
|
-
gasAsset: "Dot",
|
|
175
|
-
addressType: "Dot",
|
|
176
|
-
blockTimeSeconds: 6
|
|
177
|
-
},
|
|
178
170
|
Bitcoin: {
|
|
179
171
|
chainflipAssets: ["Btc"],
|
|
180
172
|
assets: ["BTC"],
|
|
@@ -244,6 +236,17 @@ const chainConstants = {
|
|
|
244
236
|
blockTimeSeconds: 12
|
|
245
237
|
}
|
|
246
238
|
};
|
|
239
|
+
const anyChainConstants = {
|
|
240
|
+
...chainConstants,
|
|
241
|
+
Polkadot: {
|
|
242
|
+
chainflipAssets: ["Dot"],
|
|
243
|
+
assets: ["DOT"],
|
|
244
|
+
rpcAssets: ["DOT"],
|
|
245
|
+
gasAsset: "Dot",
|
|
246
|
+
addressType: "Dot",
|
|
247
|
+
blockTimeSeconds: 6
|
|
248
|
+
}
|
|
249
|
+
};
|
|
247
250
|
const internalAssetToRpcAsset = {
|
|
248
251
|
Eth: {
|
|
249
252
|
chain: "Ethereum",
|
|
@@ -405,10 +408,20 @@ const chainflipAssetToPriceAssetMap = {
|
|
|
405
408
|
HubDot: null,
|
|
406
409
|
Wbtc: "Btc"
|
|
407
410
|
};
|
|
411
|
+
function isChainflipAsset(asset) {
|
|
412
|
+
return chainflipAssets.includes(asset);
|
|
413
|
+
}
|
|
414
|
+
function isLegacyChainflipAsset(asset) {
|
|
415
|
+
return legacyChainflipAssets.includes(asset);
|
|
416
|
+
}
|
|
417
|
+
function isAnyChainflipAsset(asset) {
|
|
418
|
+
return isChainflipAsset(asset) || isLegacyChainflipAsset(asset);
|
|
419
|
+
}
|
|
408
420
|
|
|
409
421
|
//#endregion
|
|
410
422
|
exports.addressTypes = addressTypes;
|
|
411
423
|
exports.anyAssetConstants = anyAssetConstants;
|
|
424
|
+
exports.anyChainConstants = anyChainConstants;
|
|
412
425
|
exports.anyInternalAssetToRpcAsset = anyInternalAssetToRpcAsset;
|
|
413
426
|
exports.assetConstants = assetConstants;
|
|
414
427
|
exports.assetContractId = assetContractId;
|
|
@@ -425,6 +438,9 @@ exports.getAnyInternalAsset = getAnyInternalAsset;
|
|
|
425
438
|
exports.getInternalAsset = getInternalAsset;
|
|
426
439
|
exports.getInternalAssets = getInternalAssets;
|
|
427
440
|
exports.internalAssetToRpcAsset = internalAssetToRpcAsset;
|
|
441
|
+
exports.isAnyChainflipAsset = isAnyChainflipAsset;
|
|
442
|
+
exports.isChainflipAsset = isChainflipAsset;
|
|
443
|
+
exports.isLegacyChainflipAsset = isLegacyChainflipAsset;
|
|
428
444
|
exports.isValidAssetAndChain = isValidAssetAndChain;
|
|
429
445
|
exports.legacyAddressTypes = legacyAddressTypes;
|
|
430
446
|
exports.legacyChainflipAssets = legacyChainflipAssets;
|
package/dist/chainflip.d.cts
CHANGED
|
@@ -25,7 +25,7 @@ declare const legacyAddressTypes: readonly ["Dot"];
|
|
|
25
25
|
type LegacyAddressType = (typeof legacyAddressTypes)[number];
|
|
26
26
|
type AnyAddressType = AddressType | LegacyAddressType;
|
|
27
27
|
type AssetOfChain<C extends ChainflipChain> = (typeof chainConstants)[C]['assets'][number];
|
|
28
|
-
type AnyAssetOfChain<C extends AnyChainflipChain> = (typeof
|
|
28
|
+
type AnyAssetOfChain<C extends AnyChainflipChain> = (typeof anyChainConstants)[C]['assets'][number];
|
|
29
29
|
type ChainAssetMap<T> = { [C in ChainflipChain]: { [A in AssetOfChain<C>]: T } };
|
|
30
30
|
type AnyChainAssetMap<T> = { [C in AnyChainflipChain]: { [A in AnyAssetOfChain<C>]: T } };
|
|
31
31
|
type BaseChainAssetMap<T> = { [C in ChainflipChain]: { [A in BaseChainflipAsset as Extract<(typeof assetConstants)[A], {
|
|
@@ -235,6 +235,40 @@ declare const chainConstants: {
|
|
|
235
235
|
readonly addressType: "Eth";
|
|
236
236
|
readonly blockTimeSeconds: 12;
|
|
237
237
|
};
|
|
238
|
+
readonly Bitcoin: {
|
|
239
|
+
readonly chainflipAssets: ["Btc"];
|
|
240
|
+
readonly assets: ["BTC"];
|
|
241
|
+
readonly rpcAssets: ["BTC"];
|
|
242
|
+
readonly gasAsset: "Btc";
|
|
243
|
+
readonly addressType: "Btc";
|
|
244
|
+
readonly blockTimeSeconds: number;
|
|
245
|
+
};
|
|
246
|
+
readonly Arbitrum: {
|
|
247
|
+
readonly chainflipAssets: ["ArbUsdc", "ArbUsdt", "ArbEth"];
|
|
248
|
+
readonly assets: ["USDC", "USDT", "ETH"];
|
|
249
|
+
readonly rpcAssets: ["USDC", "USDT", "ETH"];
|
|
250
|
+
readonly gasAsset: "ArbEth";
|
|
251
|
+
readonly addressType: "Arb";
|
|
252
|
+
readonly blockTimeSeconds: 0.26;
|
|
253
|
+
};
|
|
254
|
+
readonly Solana: {
|
|
255
|
+
readonly chainflipAssets: ["Sol", "SolUsdc", "SolUsdt"];
|
|
256
|
+
readonly assets: ["SOL", "USDC", "USDT"];
|
|
257
|
+
readonly rpcAssets: ["SOL", "USDC", "USDT"];
|
|
258
|
+
readonly gasAsset: "Sol";
|
|
259
|
+
readonly addressType: "Sol";
|
|
260
|
+
readonly blockTimeSeconds: 0.8;
|
|
261
|
+
};
|
|
262
|
+
readonly Assethub: {
|
|
263
|
+
readonly chainflipAssets: ["HubDot", "HubUsdt", "HubUsdc"];
|
|
264
|
+
readonly assets: ["DOT", "USDT", "USDC"];
|
|
265
|
+
readonly rpcAssets: ["DOT", "USDT", "USDC"];
|
|
266
|
+
readonly gasAsset: "HubDot";
|
|
267
|
+
readonly addressType: "Hub";
|
|
268
|
+
readonly blockTimeSeconds: 12;
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
declare const anyChainConstants: {
|
|
238
272
|
readonly Polkadot: {
|
|
239
273
|
readonly chainflipAssets: ["Dot"];
|
|
240
274
|
readonly assets: ["DOT"];
|
|
@@ -243,6 +277,14 @@ declare const chainConstants: {
|
|
|
243
277
|
readonly addressType: "Dot";
|
|
244
278
|
readonly blockTimeSeconds: 6;
|
|
245
279
|
};
|
|
280
|
+
readonly Ethereum: {
|
|
281
|
+
readonly chainflipAssets: ["Eth", "Flip", "Usdc", "Usdt", "Wbtc"];
|
|
282
|
+
readonly assets: ["ETH", "FLIP", "USDC", "USDT", "WBTC"];
|
|
283
|
+
readonly rpcAssets: ["ETH", "FLIP", "USDC", "USDT", "WBTC"];
|
|
284
|
+
readonly gasAsset: "Eth";
|
|
285
|
+
readonly addressType: "Eth";
|
|
286
|
+
readonly blockTimeSeconds: 12;
|
|
287
|
+
};
|
|
246
288
|
readonly Bitcoin: {
|
|
247
289
|
readonly chainflipAssets: ["Btc"];
|
|
248
290
|
readonly assets: ["BTC"];
|
|
@@ -317,5 +359,8 @@ declare function getInternalAssets(data: {
|
|
|
317
359
|
destAsset: ChainflipAsset | null;
|
|
318
360
|
};
|
|
319
361
|
declare const chainflipAssetToPriceAssetMap: Record<ChainflipAsset, Exclude<PriceAsset, 'Usd'> | null>;
|
|
362
|
+
declare function isChainflipAsset(asset: string): asset is ChainflipAsset;
|
|
363
|
+
declare function isLegacyChainflipAsset(asset: string): asset is LegacyChainflipAsset;
|
|
364
|
+
declare function isAnyChainflipAsset(asset: string): asset is AnyChainflipAsset;
|
|
320
365
|
//#endregion
|
|
321
|
-
export { AddressType, AnyAddressType, AnyAssetAndChain, AnyAssetOfChain, AnyBaseAssetAndChain, AnyBaseChainAssetMap, AnyBaseChainflipAsset, AnyChainAssetMap, AnyChainMap, AnyChainflipAsset, AnyChainflipChain, AnyInternalAssetMap, AnyUncheckedAssetAndChain, AssetAndChain, AssetOfChain, AssetSymbol, BaseAssetAndChain, BaseChainAssetMap, BaseChainflipAsset, ChainAssetMap, ChainMap, ChainflipAsset, ChainflipChain, ChainflipEvmChain, ChainflipNetwork, InternalAssetMap, LegacyAddressType, LegacyChainflipAsset, LegacyChainflipChain, NonDeprecatedBaseChainflipAsset, PriceAsset, UncheckedAssetAndChain, addressTypes, anyAssetConstants, anyInternalAssetToRpcAsset, assetConstants, assetContractId, assetSymbols, baseChainflipAssets, chainConstants, chainContractId, chainflipAssetToPriceAssetMap, chainflipAssets, chainflipChains, chainflipEvmChains, chainflipNetworks, getAnyInternalAsset, getInternalAsset, getInternalAssets, internalAssetToRpcAsset, isValidAssetAndChain, legacyAddressTypes, legacyChainflipAssets, legacyChainflipChains, priceAssets, readAssetValue };
|
|
366
|
+
export { AddressType, AnyAddressType, AnyAssetAndChain, AnyAssetOfChain, AnyBaseAssetAndChain, AnyBaseChainAssetMap, AnyBaseChainflipAsset, AnyChainAssetMap, AnyChainMap, AnyChainflipAsset, AnyChainflipChain, AnyInternalAssetMap, AnyUncheckedAssetAndChain, AssetAndChain, AssetOfChain, AssetSymbol, BaseAssetAndChain, BaseChainAssetMap, BaseChainflipAsset, ChainAssetMap, ChainMap, ChainflipAsset, ChainflipChain, ChainflipEvmChain, ChainflipNetwork, InternalAssetMap, LegacyAddressType, LegacyChainflipAsset, LegacyChainflipChain, NonDeprecatedBaseChainflipAsset, PriceAsset, UncheckedAssetAndChain, addressTypes, anyAssetConstants, anyChainConstants, anyInternalAssetToRpcAsset, assetConstants, assetContractId, assetSymbols, baseChainflipAssets, chainConstants, chainContractId, chainflipAssetToPriceAssetMap, chainflipAssets, chainflipChains, chainflipEvmChains, chainflipNetworks, getAnyInternalAsset, getInternalAsset, getInternalAssets, internalAssetToRpcAsset, isAnyChainflipAsset, isChainflipAsset, isLegacyChainflipAsset, isValidAssetAndChain, legacyAddressTypes, legacyChainflipAssets, legacyChainflipChains, priceAssets, readAssetValue };
|
package/dist/chainflip.d.mts
CHANGED
|
@@ -25,7 +25,7 @@ declare const legacyAddressTypes: readonly ["Dot"];
|
|
|
25
25
|
type LegacyAddressType = (typeof legacyAddressTypes)[number];
|
|
26
26
|
type AnyAddressType = AddressType | LegacyAddressType;
|
|
27
27
|
type AssetOfChain<C extends ChainflipChain> = (typeof chainConstants)[C]['assets'][number];
|
|
28
|
-
type AnyAssetOfChain<C extends AnyChainflipChain> = (typeof
|
|
28
|
+
type AnyAssetOfChain<C extends AnyChainflipChain> = (typeof anyChainConstants)[C]['assets'][number];
|
|
29
29
|
type ChainAssetMap<T> = { [C in ChainflipChain]: { [A in AssetOfChain<C>]: T } };
|
|
30
30
|
type AnyChainAssetMap<T> = { [C in AnyChainflipChain]: { [A in AnyAssetOfChain<C>]: T } };
|
|
31
31
|
type BaseChainAssetMap<T> = { [C in ChainflipChain]: { [A in BaseChainflipAsset as Extract<(typeof assetConstants)[A], {
|
|
@@ -235,6 +235,40 @@ declare const chainConstants: {
|
|
|
235
235
|
readonly addressType: "Eth";
|
|
236
236
|
readonly blockTimeSeconds: 12;
|
|
237
237
|
};
|
|
238
|
+
readonly Bitcoin: {
|
|
239
|
+
readonly chainflipAssets: ["Btc"];
|
|
240
|
+
readonly assets: ["BTC"];
|
|
241
|
+
readonly rpcAssets: ["BTC"];
|
|
242
|
+
readonly gasAsset: "Btc";
|
|
243
|
+
readonly addressType: "Btc";
|
|
244
|
+
readonly blockTimeSeconds: number;
|
|
245
|
+
};
|
|
246
|
+
readonly Arbitrum: {
|
|
247
|
+
readonly chainflipAssets: ["ArbUsdc", "ArbUsdt", "ArbEth"];
|
|
248
|
+
readonly assets: ["USDC", "USDT", "ETH"];
|
|
249
|
+
readonly rpcAssets: ["USDC", "USDT", "ETH"];
|
|
250
|
+
readonly gasAsset: "ArbEth";
|
|
251
|
+
readonly addressType: "Arb";
|
|
252
|
+
readonly blockTimeSeconds: 0.26;
|
|
253
|
+
};
|
|
254
|
+
readonly Solana: {
|
|
255
|
+
readonly chainflipAssets: ["Sol", "SolUsdc", "SolUsdt"];
|
|
256
|
+
readonly assets: ["SOL", "USDC", "USDT"];
|
|
257
|
+
readonly rpcAssets: ["SOL", "USDC", "USDT"];
|
|
258
|
+
readonly gasAsset: "Sol";
|
|
259
|
+
readonly addressType: "Sol";
|
|
260
|
+
readonly blockTimeSeconds: 0.8;
|
|
261
|
+
};
|
|
262
|
+
readonly Assethub: {
|
|
263
|
+
readonly chainflipAssets: ["HubDot", "HubUsdt", "HubUsdc"];
|
|
264
|
+
readonly assets: ["DOT", "USDT", "USDC"];
|
|
265
|
+
readonly rpcAssets: ["DOT", "USDT", "USDC"];
|
|
266
|
+
readonly gasAsset: "HubDot";
|
|
267
|
+
readonly addressType: "Hub";
|
|
268
|
+
readonly blockTimeSeconds: 12;
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
declare const anyChainConstants: {
|
|
238
272
|
readonly Polkadot: {
|
|
239
273
|
readonly chainflipAssets: ["Dot"];
|
|
240
274
|
readonly assets: ["DOT"];
|
|
@@ -243,6 +277,14 @@ declare const chainConstants: {
|
|
|
243
277
|
readonly addressType: "Dot";
|
|
244
278
|
readonly blockTimeSeconds: 6;
|
|
245
279
|
};
|
|
280
|
+
readonly Ethereum: {
|
|
281
|
+
readonly chainflipAssets: ["Eth", "Flip", "Usdc", "Usdt", "Wbtc"];
|
|
282
|
+
readonly assets: ["ETH", "FLIP", "USDC", "USDT", "WBTC"];
|
|
283
|
+
readonly rpcAssets: ["ETH", "FLIP", "USDC", "USDT", "WBTC"];
|
|
284
|
+
readonly gasAsset: "Eth";
|
|
285
|
+
readonly addressType: "Eth";
|
|
286
|
+
readonly blockTimeSeconds: 12;
|
|
287
|
+
};
|
|
246
288
|
readonly Bitcoin: {
|
|
247
289
|
readonly chainflipAssets: ["Btc"];
|
|
248
290
|
readonly assets: ["BTC"];
|
|
@@ -317,5 +359,8 @@ declare function getInternalAssets(data: {
|
|
|
317
359
|
destAsset: ChainflipAsset | null;
|
|
318
360
|
};
|
|
319
361
|
declare const chainflipAssetToPriceAssetMap: Record<ChainflipAsset, Exclude<PriceAsset, 'Usd'> | null>;
|
|
362
|
+
declare function isChainflipAsset(asset: string): asset is ChainflipAsset;
|
|
363
|
+
declare function isLegacyChainflipAsset(asset: string): asset is LegacyChainflipAsset;
|
|
364
|
+
declare function isAnyChainflipAsset(asset: string): asset is AnyChainflipAsset;
|
|
320
365
|
//#endregion
|
|
321
|
-
export { AddressType, AnyAddressType, AnyAssetAndChain, AnyAssetOfChain, AnyBaseAssetAndChain, AnyBaseChainAssetMap, AnyBaseChainflipAsset, AnyChainAssetMap, AnyChainMap, AnyChainflipAsset, AnyChainflipChain, AnyInternalAssetMap, AnyUncheckedAssetAndChain, AssetAndChain, AssetOfChain, AssetSymbol, BaseAssetAndChain, BaseChainAssetMap, BaseChainflipAsset, ChainAssetMap, ChainMap, ChainflipAsset, ChainflipChain, ChainflipEvmChain, ChainflipNetwork, InternalAssetMap, LegacyAddressType, LegacyChainflipAsset, LegacyChainflipChain, NonDeprecatedBaseChainflipAsset, PriceAsset, UncheckedAssetAndChain, addressTypes, anyAssetConstants, anyInternalAssetToRpcAsset, assetConstants, assetContractId, assetSymbols, baseChainflipAssets, chainConstants, chainContractId, chainflipAssetToPriceAssetMap, chainflipAssets, chainflipChains, chainflipEvmChains, chainflipNetworks, getAnyInternalAsset, getInternalAsset, getInternalAssets, internalAssetToRpcAsset, isValidAssetAndChain, legacyAddressTypes, legacyChainflipAssets, legacyChainflipChains, priceAssets, readAssetValue };
|
|
366
|
+
export { AddressType, AnyAddressType, AnyAssetAndChain, AnyAssetOfChain, AnyBaseAssetAndChain, AnyBaseChainAssetMap, AnyBaseChainflipAsset, AnyChainAssetMap, AnyChainMap, AnyChainflipAsset, AnyChainflipChain, AnyInternalAssetMap, AnyUncheckedAssetAndChain, AssetAndChain, AssetOfChain, AssetSymbol, BaseAssetAndChain, BaseChainAssetMap, BaseChainflipAsset, ChainAssetMap, ChainMap, ChainflipAsset, ChainflipChain, ChainflipEvmChain, ChainflipNetwork, InternalAssetMap, LegacyAddressType, LegacyChainflipAsset, LegacyChainflipChain, NonDeprecatedBaseChainflipAsset, PriceAsset, UncheckedAssetAndChain, addressTypes, anyAssetConstants, anyChainConstants, anyInternalAssetToRpcAsset, assetConstants, assetContractId, assetSymbols, baseChainflipAssets, chainConstants, chainContractId, chainflipAssetToPriceAssetMap, chainflipAssets, chainflipChains, chainflipEvmChains, chainflipNetworks, getAnyInternalAsset, getInternalAsset, getInternalAssets, internalAssetToRpcAsset, isAnyChainflipAsset, isChainflipAsset, isLegacyChainflipAsset, isValidAssetAndChain, legacyAddressTypes, legacyChainflipAssets, legacyChainflipChains, priceAssets, readAssetValue };
|
package/dist/chainflip.mjs
CHANGED
|
@@ -165,14 +165,6 @@ const chainConstants = {
|
|
|
165
165
|
addressType: "Eth",
|
|
166
166
|
blockTimeSeconds: 12
|
|
167
167
|
},
|
|
168
|
-
Polkadot: {
|
|
169
|
-
chainflipAssets: ["Dot"],
|
|
170
|
-
assets: ["DOT"],
|
|
171
|
-
rpcAssets: ["DOT"],
|
|
172
|
-
gasAsset: "Dot",
|
|
173
|
-
addressType: "Dot",
|
|
174
|
-
blockTimeSeconds: 6
|
|
175
|
-
},
|
|
176
168
|
Bitcoin: {
|
|
177
169
|
chainflipAssets: ["Btc"],
|
|
178
170
|
assets: ["BTC"],
|
|
@@ -242,6 +234,17 @@ const chainConstants = {
|
|
|
242
234
|
blockTimeSeconds: 12
|
|
243
235
|
}
|
|
244
236
|
};
|
|
237
|
+
const anyChainConstants = {
|
|
238
|
+
...chainConstants,
|
|
239
|
+
Polkadot: {
|
|
240
|
+
chainflipAssets: ["Dot"],
|
|
241
|
+
assets: ["DOT"],
|
|
242
|
+
rpcAssets: ["DOT"],
|
|
243
|
+
gasAsset: "Dot",
|
|
244
|
+
addressType: "Dot",
|
|
245
|
+
blockTimeSeconds: 6
|
|
246
|
+
}
|
|
247
|
+
};
|
|
245
248
|
const internalAssetToRpcAsset = {
|
|
246
249
|
Eth: {
|
|
247
250
|
chain: "Ethereum",
|
|
@@ -403,6 +406,15 @@ const chainflipAssetToPriceAssetMap = {
|
|
|
403
406
|
HubDot: null,
|
|
404
407
|
Wbtc: "Btc"
|
|
405
408
|
};
|
|
409
|
+
function isChainflipAsset(asset) {
|
|
410
|
+
return chainflipAssets.includes(asset);
|
|
411
|
+
}
|
|
412
|
+
function isLegacyChainflipAsset(asset) {
|
|
413
|
+
return legacyChainflipAssets.includes(asset);
|
|
414
|
+
}
|
|
415
|
+
function isAnyChainflipAsset(asset) {
|
|
416
|
+
return isChainflipAsset(asset) || isLegacyChainflipAsset(asset);
|
|
417
|
+
}
|
|
406
418
|
|
|
407
419
|
//#endregion
|
|
408
|
-
export { addressTypes, anyAssetConstants, anyInternalAssetToRpcAsset, assetConstants, assetContractId, assetSymbols, baseChainflipAssets, chainConstants, chainContractId, chainflipAssetToPriceAssetMap, chainflipAssets, chainflipChains, chainflipEvmChains, chainflipNetworks, getAnyInternalAsset, getInternalAsset, getInternalAssets, internalAssetToRpcAsset, isValidAssetAndChain, legacyAddressTypes, legacyChainflipAssets, legacyChainflipChains, priceAssets, readAssetValue };
|
|
420
|
+
export { addressTypes, anyAssetConstants, anyChainConstants, anyInternalAssetToRpcAsset, assetConstants, assetContractId, assetSymbols, baseChainflipAssets, chainConstants, chainContractId, chainflipAssetToPriceAssetMap, chainflipAssets, chainflipChains, chainflipEvmChains, chainflipNetworks, getAnyInternalAsset, getInternalAsset, getInternalAssets, internalAssetToRpcAsset, isAnyChainflipAsset, isChainflipAsset, isLegacyChainflipAsset, isValidAssetAndChain, legacyAddressTypes, legacyChainflipAssets, legacyChainflipChains, priceAssets, readAssetValue };
|