@chainflip/utils 0.8.22 → 0.11.1
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 +1 -4
- package/dist/chainflip.d.cts +20 -11
- package/dist/chainflip.d.ts +20 -11
- package/dist/chainflip.js +1 -1
- package/dist/{chunk-QLABW6HJ.js → chunk-GJXUE6ZM.js} +1 -4
- package/dist/tickMath.js +1 -1
- package/package.json +1 -1
package/dist/chainflip.cjs
CHANGED
|
@@ -239,8 +239,8 @@ var assetContractId = {
|
|
|
239
239
|
Eth: 1,
|
|
240
240
|
Flip: 2,
|
|
241
241
|
Usdc: 3,
|
|
242
|
-
Usdt: 8,
|
|
243
242
|
Dot: 4,
|
|
243
|
+
Usdt: 8,
|
|
244
244
|
Btc: 5,
|
|
245
245
|
ArbEth: 6,
|
|
246
246
|
ArbUsdc: 7,
|
|
@@ -261,9 +261,6 @@ function getInternalAsset(asset, assert = true) {
|
|
|
261
261
|
Bitcoin: {
|
|
262
262
|
BTC: "Btc"
|
|
263
263
|
},
|
|
264
|
-
Polkadot: {
|
|
265
|
-
DOT: "Dot"
|
|
266
|
-
},
|
|
267
264
|
Arbitrum: {
|
|
268
265
|
USDC: "ArbUsdc",
|
|
269
266
|
ETH: "ArbEth"
|
package/dist/chainflip.d.cts
CHANGED
|
@@ -18,36 +18,36 @@ declare const chainflipNetworks: readonly ["backspin", "sisyphos", "perseverance
|
|
|
18
18
|
type ChainflipNetwork = (typeof chainflipNetworks)[number];
|
|
19
19
|
declare const addressTypes: readonly ["Eth", "Btc", "Dot", "Arb", "Sol", "Hub"];
|
|
20
20
|
type AddressType = (typeof addressTypes)[number];
|
|
21
|
-
type AssetOfChain<C extends ChainflipChain
|
|
21
|
+
type AssetOfChain<C extends Exclude<ChainflipChain, 'Polkadot'>> = (typeof chainConstants)[C]['assets'][number];
|
|
22
22
|
type ChainAssetMap<T> = {
|
|
23
|
-
[C in ChainflipChain]: {
|
|
23
|
+
[C in Exclude<ChainflipChain, 'Polkadot'>]: {
|
|
24
24
|
[A in AssetOfChain<C>]: T;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
type BaseChainAssetMap<T> = {
|
|
28
|
-
[C in ChainflipChain]: {
|
|
29
|
-
[A in BaseChainflipAsset as Extract<(typeof assetConstants)[A], {
|
|
28
|
+
[C in Exclude<ChainflipChain, 'Polkadot'>]: {
|
|
29
|
+
[A in Exclude<BaseChainflipAsset, 'Dot'> as Extract<(typeof assetConstants)[A], {
|
|
30
30
|
chain: C;
|
|
31
31
|
}>['symbol']]: T;
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
type AssetAndChain = {
|
|
35
|
-
[C in ChainflipChain]: {
|
|
35
|
+
[C in Exclude<ChainflipChain, 'Polkadot'>]: {
|
|
36
36
|
[A in keyof ChainAssetMap<unknown>[C]]: {
|
|
37
37
|
chain: C;
|
|
38
38
|
asset: A;
|
|
39
39
|
};
|
|
40
40
|
}[keyof ChainAssetMap<unknown>[C]];
|
|
41
|
-
}[ChainflipChain];
|
|
41
|
+
}[Exclude<ChainflipChain, 'Polkadot'>];
|
|
42
42
|
type BaseAssetAndChain = Exclude<AssetAndChain, {
|
|
43
43
|
chain: 'Ethereum';
|
|
44
44
|
asset: 'USDC';
|
|
45
45
|
}>;
|
|
46
46
|
type ChainMap<T> = {
|
|
47
|
-
[C in ChainflipChain]: T;
|
|
47
|
+
[C in Exclude<ChainflipChain, 'Polkadot'>]: T;
|
|
48
48
|
};
|
|
49
49
|
type InternalAssetMap<T> = {
|
|
50
|
-
[A in ChainflipAsset]: T;
|
|
50
|
+
[A in Exclude<ChainflipAsset, 'Dot'>]: T;
|
|
51
51
|
};
|
|
52
52
|
type UncheckedAssetAndChain = {
|
|
53
53
|
chain: ChainflipChain;
|
|
@@ -186,9 +186,18 @@ declare const chainConstants: {
|
|
|
186
186
|
readonly blockTimeSeconds: 12;
|
|
187
187
|
};
|
|
188
188
|
};
|
|
189
|
-
declare const internalAssetToRpcAsset: InternalAssetMap<AssetAndChain
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
declare const internalAssetToRpcAsset: InternalAssetMap<AssetAndChain> & {
|
|
190
|
+
Dot: {
|
|
191
|
+
chain: 'Polkadot';
|
|
192
|
+
asset: 'DOT';
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
declare const chainContractId: ChainMap<number> & {
|
|
196
|
+
Polkadot: 2;
|
|
197
|
+
};
|
|
198
|
+
declare const assetContractId: InternalAssetMap<number> & {
|
|
199
|
+
Dot: 4;
|
|
200
|
+
};
|
|
192
201
|
declare function getInternalAsset(asset: BaseAssetAndChain): BaseChainflipAsset;
|
|
193
202
|
declare function getInternalAsset(asset: AssetAndChain): ChainflipAsset;
|
|
194
203
|
declare function getInternalAsset(asset: UncheckedAssetAndChain): ChainflipAsset;
|
package/dist/chainflip.d.ts
CHANGED
|
@@ -18,36 +18,36 @@ declare const chainflipNetworks: readonly ["backspin", "sisyphos", "perseverance
|
|
|
18
18
|
type ChainflipNetwork = (typeof chainflipNetworks)[number];
|
|
19
19
|
declare const addressTypes: readonly ["Eth", "Btc", "Dot", "Arb", "Sol", "Hub"];
|
|
20
20
|
type AddressType = (typeof addressTypes)[number];
|
|
21
|
-
type AssetOfChain<C extends ChainflipChain
|
|
21
|
+
type AssetOfChain<C extends Exclude<ChainflipChain, 'Polkadot'>> = (typeof chainConstants)[C]['assets'][number];
|
|
22
22
|
type ChainAssetMap<T> = {
|
|
23
|
-
[C in ChainflipChain]: {
|
|
23
|
+
[C in Exclude<ChainflipChain, 'Polkadot'>]: {
|
|
24
24
|
[A in AssetOfChain<C>]: T;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
27
|
type BaseChainAssetMap<T> = {
|
|
28
|
-
[C in ChainflipChain]: {
|
|
29
|
-
[A in BaseChainflipAsset as Extract<(typeof assetConstants)[A], {
|
|
28
|
+
[C in Exclude<ChainflipChain, 'Polkadot'>]: {
|
|
29
|
+
[A in Exclude<BaseChainflipAsset, 'Dot'> as Extract<(typeof assetConstants)[A], {
|
|
30
30
|
chain: C;
|
|
31
31
|
}>['symbol']]: T;
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
type AssetAndChain = {
|
|
35
|
-
[C in ChainflipChain]: {
|
|
35
|
+
[C in Exclude<ChainflipChain, 'Polkadot'>]: {
|
|
36
36
|
[A in keyof ChainAssetMap<unknown>[C]]: {
|
|
37
37
|
chain: C;
|
|
38
38
|
asset: A;
|
|
39
39
|
};
|
|
40
40
|
}[keyof ChainAssetMap<unknown>[C]];
|
|
41
|
-
}[ChainflipChain];
|
|
41
|
+
}[Exclude<ChainflipChain, 'Polkadot'>];
|
|
42
42
|
type BaseAssetAndChain = Exclude<AssetAndChain, {
|
|
43
43
|
chain: 'Ethereum';
|
|
44
44
|
asset: 'USDC';
|
|
45
45
|
}>;
|
|
46
46
|
type ChainMap<T> = {
|
|
47
|
-
[C in ChainflipChain]: T;
|
|
47
|
+
[C in Exclude<ChainflipChain, 'Polkadot'>]: T;
|
|
48
48
|
};
|
|
49
49
|
type InternalAssetMap<T> = {
|
|
50
|
-
[A in ChainflipAsset]: T;
|
|
50
|
+
[A in Exclude<ChainflipAsset, 'Dot'>]: T;
|
|
51
51
|
};
|
|
52
52
|
type UncheckedAssetAndChain = {
|
|
53
53
|
chain: ChainflipChain;
|
|
@@ -186,9 +186,18 @@ declare const chainConstants: {
|
|
|
186
186
|
readonly blockTimeSeconds: 12;
|
|
187
187
|
};
|
|
188
188
|
};
|
|
189
|
-
declare const internalAssetToRpcAsset: InternalAssetMap<AssetAndChain
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
declare const internalAssetToRpcAsset: InternalAssetMap<AssetAndChain> & {
|
|
190
|
+
Dot: {
|
|
191
|
+
chain: 'Polkadot';
|
|
192
|
+
asset: 'DOT';
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
declare const chainContractId: ChainMap<number> & {
|
|
196
|
+
Polkadot: 2;
|
|
197
|
+
};
|
|
198
|
+
declare const assetContractId: InternalAssetMap<number> & {
|
|
199
|
+
Dot: 4;
|
|
200
|
+
};
|
|
192
201
|
declare function getInternalAsset(asset: BaseAssetAndChain): BaseChainflipAsset;
|
|
193
202
|
declare function getInternalAsset(asset: AssetAndChain): ChainflipAsset;
|
|
194
203
|
declare function getInternalAsset(asset: UncheckedAssetAndChain): ChainflipAsset;
|
package/dist/chainflip.js
CHANGED
|
@@ -197,8 +197,8 @@ var assetContractId = {
|
|
|
197
197
|
Eth: 1,
|
|
198
198
|
Flip: 2,
|
|
199
199
|
Usdc: 3,
|
|
200
|
-
Usdt: 8,
|
|
201
200
|
Dot: 4,
|
|
201
|
+
Usdt: 8,
|
|
202
202
|
Btc: 5,
|
|
203
203
|
ArbEth: 6,
|
|
204
204
|
ArbUsdc: 7,
|
|
@@ -219,9 +219,6 @@ function getInternalAsset(asset, assert = true) {
|
|
|
219
219
|
Bitcoin: {
|
|
220
220
|
BTC: "Btc"
|
|
221
221
|
},
|
|
222
|
-
Polkadot: {
|
|
223
|
-
DOT: "Dot"
|
|
224
|
-
},
|
|
225
222
|
Arbitrum: {
|
|
226
223
|
USDC: "ArbUsdc",
|
|
227
224
|
ETH: "ArbEth"
|
package/dist/tickMath.js
CHANGED