@chainflip/utils 0.8.22 → 0.11.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/chainflip.cjs +1 -5
- package/dist/chainflip.d.cts +14 -10
- package/dist/chainflip.d.ts +14 -10
- package/dist/chainflip.js +1 -1
- package/dist/{chunk-QLABW6HJ.js → chunk-MM5AVJMD.js} +1 -5
- package/dist/tickMath.js +1 -1
- package/package.json +1 -1
package/dist/chainflip.cjs
CHANGED
|
@@ -217,7 +217,6 @@ var internalAssetToRpcAsset = {
|
|
|
217
217
|
Flip: { chain: "Ethereum", asset: "FLIP" },
|
|
218
218
|
Usdc: { chain: "Ethereum", asset: "USDC" },
|
|
219
219
|
Usdt: { chain: "Ethereum", asset: "USDT" },
|
|
220
|
-
Dot: { chain: "Polkadot", asset: "DOT" },
|
|
221
220
|
Btc: { chain: "Bitcoin", asset: "BTC" },
|
|
222
221
|
ArbUsdc: { chain: "Arbitrum", asset: "USDC" },
|
|
223
222
|
ArbEth: { chain: "Arbitrum", asset: "ETH" },
|
|
@@ -239,8 +238,8 @@ var assetContractId = {
|
|
|
239
238
|
Eth: 1,
|
|
240
239
|
Flip: 2,
|
|
241
240
|
Usdc: 3,
|
|
242
|
-
Usdt: 8,
|
|
243
241
|
Dot: 4,
|
|
242
|
+
Usdt: 8,
|
|
244
243
|
Btc: 5,
|
|
245
244
|
ArbEth: 6,
|
|
246
245
|
ArbUsdc: 7,
|
|
@@ -261,9 +260,6 @@ function getInternalAsset(asset, assert = true) {
|
|
|
261
260
|
Bitcoin: {
|
|
262
261
|
BTC: "Btc"
|
|
263
262
|
},
|
|
264
|
-
Polkadot: {
|
|
265
|
-
DOT: "Dot"
|
|
266
|
-
},
|
|
267
263
|
Arbitrum: {
|
|
268
264
|
USDC: "ArbUsdc",
|
|
269
265
|
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;
|
|
@@ -187,8 +187,12 @@ declare const chainConstants: {
|
|
|
187
187
|
};
|
|
188
188
|
};
|
|
189
189
|
declare const internalAssetToRpcAsset: InternalAssetMap<AssetAndChain>;
|
|
190
|
-
declare const chainContractId: ChainMap<number
|
|
191
|
-
|
|
190
|
+
declare const chainContractId: ChainMap<number> & {
|
|
191
|
+
Polkadot: 2;
|
|
192
|
+
};
|
|
193
|
+
declare const assetContractId: InternalAssetMap<number> & {
|
|
194
|
+
Dot: 4;
|
|
195
|
+
};
|
|
192
196
|
declare function getInternalAsset(asset: BaseAssetAndChain): BaseChainflipAsset;
|
|
193
197
|
declare function getInternalAsset(asset: AssetAndChain): ChainflipAsset;
|
|
194
198
|
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;
|
|
@@ -187,8 +187,12 @@ declare const chainConstants: {
|
|
|
187
187
|
};
|
|
188
188
|
};
|
|
189
189
|
declare const internalAssetToRpcAsset: InternalAssetMap<AssetAndChain>;
|
|
190
|
-
declare const chainContractId: ChainMap<number
|
|
191
|
-
|
|
190
|
+
declare const chainContractId: ChainMap<number> & {
|
|
191
|
+
Polkadot: 2;
|
|
192
|
+
};
|
|
193
|
+
declare const assetContractId: InternalAssetMap<number> & {
|
|
194
|
+
Dot: 4;
|
|
195
|
+
};
|
|
192
196
|
declare function getInternalAsset(asset: BaseAssetAndChain): BaseChainflipAsset;
|
|
193
197
|
declare function getInternalAsset(asset: AssetAndChain): ChainflipAsset;
|
|
194
198
|
declare function getInternalAsset(asset: UncheckedAssetAndChain): ChainflipAsset;
|
package/dist/chainflip.js
CHANGED
|
@@ -175,7 +175,6 @@ var internalAssetToRpcAsset = {
|
|
|
175
175
|
Flip: { chain: "Ethereum", asset: "FLIP" },
|
|
176
176
|
Usdc: { chain: "Ethereum", asset: "USDC" },
|
|
177
177
|
Usdt: { chain: "Ethereum", asset: "USDT" },
|
|
178
|
-
Dot: { chain: "Polkadot", asset: "DOT" },
|
|
179
178
|
Btc: { chain: "Bitcoin", asset: "BTC" },
|
|
180
179
|
ArbUsdc: { chain: "Arbitrum", asset: "USDC" },
|
|
181
180
|
ArbEth: { chain: "Arbitrum", asset: "ETH" },
|
|
@@ -197,8 +196,8 @@ var assetContractId = {
|
|
|
197
196
|
Eth: 1,
|
|
198
197
|
Flip: 2,
|
|
199
198
|
Usdc: 3,
|
|
200
|
-
Usdt: 8,
|
|
201
199
|
Dot: 4,
|
|
200
|
+
Usdt: 8,
|
|
202
201
|
Btc: 5,
|
|
203
202
|
ArbEth: 6,
|
|
204
203
|
ArbUsdc: 7,
|
|
@@ -219,9 +218,6 @@ function getInternalAsset(asset, assert = true) {
|
|
|
219
218
|
Bitcoin: {
|
|
220
219
|
BTC: "Btc"
|
|
221
220
|
},
|
|
222
|
-
Polkadot: {
|
|
223
|
-
DOT: "Dot"
|
|
224
|
-
},
|
|
225
221
|
Arbitrum: {
|
|
226
222
|
USDC: "ArbUsdc",
|
|
227
223
|
ETH: "ArbEth"
|
package/dist/tickMath.js
CHANGED