@chainflip/utils 0.7.1 → 0.7.2-assethub.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.
@@ -36,23 +36,36 @@ __export(chainflip_exports, {
36
36
  });
37
37
  module.exports = __toCommonJS(chainflip_exports);
38
38
  var chainflipAssets = [
39
- "Usdc",
40
- "Usdt",
41
- "Flip",
39
+ "Btc",
42
40
  "Dot",
41
+ // Ethereum
43
42
  "Eth",
44
- "Btc",
43
+ "Usdc",
44
+ "Flip",
45
+ "Usdt",
46
+ // Arbitrum
45
47
  "ArbUsdc",
46
48
  "ArbEth",
49
+ // Solana
47
50
  "Sol",
48
- "SolUsdc"
51
+ "SolUsdc",
52
+ // AssetHub
53
+ "HubDot",
54
+ "HubUsdc",
55
+ "HubUsdt"
49
56
  ];
50
57
  var rpcAssets = ["USDC", "USDT", "FLIP", "DOT", "ETH", "BTC", "SOL"];
51
58
  var baseChainflipAssets = chainflipAssets.filter(
52
59
  (asset) => asset !== "Usdc"
53
60
  );
54
61
  var chainflipEvmChains = ["Ethereum", "Arbitrum"];
55
- var chainflipChains = [...chainflipEvmChains, "Bitcoin", "Polkadot", "Solana"];
62
+ var chainflipChains = [
63
+ ...chainflipEvmChains,
64
+ "Bitcoin",
65
+ "Polkadot",
66
+ "Solana",
67
+ "Assethub"
68
+ ];
56
69
  var chainflipNetworks = ["backspin", "sisyphos", "perseverance", "mainnet"];
57
70
  var addressTypes = ["Eth", "Btc", "Dot", "Arb", "Sol"];
58
71
  function readAssetValue(map, asset) {
@@ -109,6 +122,21 @@ var assetConstants = {
109
122
  chain: "Solana",
110
123
  rpcAsset: "USDC",
111
124
  decimals: 6
125
+ },
126
+ HubDot: {
127
+ chain: "Assethub",
128
+ rpcAsset: "DOT",
129
+ decimals: 10
130
+ },
131
+ HubUsdc: {
132
+ chain: "Assethub",
133
+ rpcAsset: "USDC",
134
+ decimals: 6
135
+ },
136
+ HubUsdt: {
137
+ chain: "Assethub",
138
+ rpcAsset: "USDT",
139
+ decimals: 6
112
140
  }
113
141
  };
114
142
  var chainConstants = {
@@ -141,26 +169,40 @@ var chainConstants = {
141
169
  gasAsset: "Sol",
142
170
  addressType: "Sol",
143
171
  blockTimeSeconds: 0.8
172
+ },
173
+ Assethub: {
174
+ assets: ["HubDot", "HubUsdc", "HubUsdt"],
175
+ gasAsset: "HubDot",
176
+ addressType: "Dot",
177
+ blockTimeSeconds: 12
144
178
  }
145
179
  };
146
180
  var internalAssetToRpcAsset = {
181
+ Btc: { chain: "Bitcoin", asset: "BTC" },
182
+ Dot: { chain: "Polkadot", asset: "DOT" },
183
+ // Ethereum
147
184
  Eth: { chain: "Ethereum", asset: "ETH" },
148
- Flip: { chain: "Ethereum", asset: "FLIP" },
149
185
  Usdc: { chain: "Ethereum", asset: "USDC" },
186
+ Flip: { chain: "Ethereum", asset: "FLIP" },
150
187
  Usdt: { chain: "Ethereum", asset: "USDT" },
151
- Dot: { chain: "Polkadot", asset: "DOT" },
152
- Btc: { chain: "Bitcoin", asset: "BTC" },
188
+ // Arbitrum
153
189
  ArbUsdc: { chain: "Arbitrum", asset: "USDC" },
154
190
  ArbEth: { chain: "Arbitrum", asset: "ETH" },
191
+ // Solana
155
192
  Sol: { chain: "Solana", asset: "SOL" },
156
- SolUsdc: { chain: "Solana", asset: "USDC" }
193
+ SolUsdc: { chain: "Solana", asset: "USDC" },
194
+ // AssetHub
195
+ HubDot: { chain: "Assethub", asset: "DOT" },
196
+ HubUsdc: { chain: "Assethub", asset: "USDC" },
197
+ HubUsdt: { chain: "Assethub", asset: "USDT" }
157
198
  };
158
199
  var chainContractId = {
159
200
  Ethereum: 1,
160
201
  Polkadot: 2,
161
202
  Bitcoin: 3,
162
203
  Arbitrum: 4,
163
- Solana: 5
204
+ Solana: 5,
205
+ Assethub: 6
164
206
  };
165
207
  var assetContractId = {
166
208
  Eth: 1,
@@ -172,7 +214,10 @@ var assetContractId = {
172
214
  ArbEth: 6,
173
215
  ArbUsdc: 7,
174
216
  Sol: 9,
175
- SolUsdc: 10
217
+ SolUsdc: 10,
218
+ HubDot: 11,
219
+ HubUsdt: 12,
220
+ HubUsdc: 13
176
221
  };
177
222
  // Annotate the CommonJS export names for ESM import in node:
178
223
  0 && (module.exports = {
@@ -1,11 +1,11 @@
1
- declare const chainflipAssets: readonly ["Usdc", "Usdt", "Flip", "Dot", "Eth", "Btc", "ArbUsdc", "ArbEth", "Sol", "SolUsdc"];
1
+ declare const chainflipAssets: readonly ["Btc", "Dot", "Eth", "Usdc", "Flip", "Usdt", "ArbUsdc", "ArbEth", "Sol", "SolUsdc", "HubDot", "HubUsdc", "HubUsdt"];
2
2
  type ChainflipAsset = (typeof chainflipAssets)[number];
3
3
  declare const rpcAssets: readonly ["USDC", "USDT", "FLIP", "DOT", "ETH", "BTC", "SOL"];
4
4
  type BaseChainflipAsset = Exclude<ChainflipAsset, 'Usdc'>;
5
5
  declare const baseChainflipAssets: BaseChainflipAsset[];
6
6
  declare const chainflipEvmChains: readonly ["Ethereum", "Arbitrum"];
7
7
  type ChainflipEvmChain = (typeof chainflipEvmChains)[number];
8
- declare const chainflipChains: readonly ["Ethereum", "Arbitrum", "Bitcoin", "Polkadot", "Solana"];
8
+ declare const chainflipChains: readonly ["Ethereum", "Arbitrum", "Bitcoin", "Polkadot", "Solana", "Assethub"];
9
9
  type ChainflipChain = (typeof chainflipChains)[number];
10
10
  declare const chainflipNetworks: readonly ["backspin", "sisyphos", "perseverance", "mainnet"];
11
11
  type ChainflipNetwork = (typeof chainflipNetworks)[number];
@@ -82,6 +82,21 @@ declare const assetConstants: {
82
82
  readonly rpcAsset: "USDC";
83
83
  readonly decimals: 6;
84
84
  };
85
+ readonly HubDot: {
86
+ readonly chain: "Assethub";
87
+ readonly rpcAsset: "DOT";
88
+ readonly decimals: 10;
89
+ };
90
+ readonly HubUsdc: {
91
+ readonly chain: "Assethub";
92
+ readonly rpcAsset: "USDC";
93
+ readonly decimals: 6;
94
+ };
95
+ readonly HubUsdt: {
96
+ readonly chain: "Assethub";
97
+ readonly rpcAsset: "USDT";
98
+ readonly decimals: 6;
99
+ };
85
100
  };
86
101
  declare const chainConstants: {
87
102
  readonly Ethereum: {
@@ -114,6 +129,12 @@ declare const chainConstants: {
114
129
  readonly addressType: "Sol";
115
130
  readonly blockTimeSeconds: 0.8;
116
131
  };
132
+ readonly Assethub: {
133
+ readonly assets: ["HubDot", "HubUsdc", "HubUsdt"];
134
+ readonly gasAsset: "HubDot";
135
+ readonly addressType: "Dot";
136
+ readonly blockTimeSeconds: 12;
137
+ };
117
138
  };
118
139
  declare const internalAssetToRpcAsset: Record<ChainflipAsset, AssetAndChain>;
119
140
  declare const chainContractId: Record<ChainflipChain, number>;
@@ -1,11 +1,11 @@
1
- declare const chainflipAssets: readonly ["Usdc", "Usdt", "Flip", "Dot", "Eth", "Btc", "ArbUsdc", "ArbEth", "Sol", "SolUsdc"];
1
+ declare const chainflipAssets: readonly ["Btc", "Dot", "Eth", "Usdc", "Flip", "Usdt", "ArbUsdc", "ArbEth", "Sol", "SolUsdc", "HubDot", "HubUsdc", "HubUsdt"];
2
2
  type ChainflipAsset = (typeof chainflipAssets)[number];
3
3
  declare const rpcAssets: readonly ["USDC", "USDT", "FLIP", "DOT", "ETH", "BTC", "SOL"];
4
4
  type BaseChainflipAsset = Exclude<ChainflipAsset, 'Usdc'>;
5
5
  declare const baseChainflipAssets: BaseChainflipAsset[];
6
6
  declare const chainflipEvmChains: readonly ["Ethereum", "Arbitrum"];
7
7
  type ChainflipEvmChain = (typeof chainflipEvmChains)[number];
8
- declare const chainflipChains: readonly ["Ethereum", "Arbitrum", "Bitcoin", "Polkadot", "Solana"];
8
+ declare const chainflipChains: readonly ["Ethereum", "Arbitrum", "Bitcoin", "Polkadot", "Solana", "Assethub"];
9
9
  type ChainflipChain = (typeof chainflipChains)[number];
10
10
  declare const chainflipNetworks: readonly ["backspin", "sisyphos", "perseverance", "mainnet"];
11
11
  type ChainflipNetwork = (typeof chainflipNetworks)[number];
@@ -82,6 +82,21 @@ declare const assetConstants: {
82
82
  readonly rpcAsset: "USDC";
83
83
  readonly decimals: 6;
84
84
  };
85
+ readonly HubDot: {
86
+ readonly chain: "Assethub";
87
+ readonly rpcAsset: "DOT";
88
+ readonly decimals: 10;
89
+ };
90
+ readonly HubUsdc: {
91
+ readonly chain: "Assethub";
92
+ readonly rpcAsset: "USDC";
93
+ readonly decimals: 6;
94
+ };
95
+ readonly HubUsdt: {
96
+ readonly chain: "Assethub";
97
+ readonly rpcAsset: "USDT";
98
+ readonly decimals: 6;
99
+ };
85
100
  };
86
101
  declare const chainConstants: {
87
102
  readonly Ethereum: {
@@ -114,6 +129,12 @@ declare const chainConstants: {
114
129
  readonly addressType: "Sol";
115
130
  readonly blockTimeSeconds: 0.8;
116
131
  };
132
+ readonly Assethub: {
133
+ readonly assets: ["HubDot", "HubUsdc", "HubUsdt"];
134
+ readonly gasAsset: "HubDot";
135
+ readonly addressType: "Dot";
136
+ readonly blockTimeSeconds: 12;
137
+ };
117
138
  };
118
139
  declare const internalAssetToRpcAsset: Record<ChainflipAsset, AssetAndChain>;
119
140
  declare const chainContractId: Record<ChainflipChain, number>;
package/dist/chainflip.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  internalAssetToRpcAsset,
13
13
  readAssetValue,
14
14
  rpcAssets
15
- } from "./chunk-YOAHWTE7.js";
15
+ } from "./chunk-26AL7ZVB.js";
16
16
  export {
17
17
  addressTypes,
18
18
  assetConstants,
@@ -1,22 +1,35 @@
1
1
  // src/chainflip.ts
2
2
  var chainflipAssets = [
3
- "Usdc",
4
- "Usdt",
5
- "Flip",
3
+ "Btc",
6
4
  "Dot",
5
+ // Ethereum
7
6
  "Eth",
8
- "Btc",
7
+ "Usdc",
8
+ "Flip",
9
+ "Usdt",
10
+ // Arbitrum
9
11
  "ArbUsdc",
10
12
  "ArbEth",
13
+ // Solana
11
14
  "Sol",
12
- "SolUsdc"
15
+ "SolUsdc",
16
+ // AssetHub
17
+ "HubDot",
18
+ "HubUsdc",
19
+ "HubUsdt"
13
20
  ];
14
21
  var rpcAssets = ["USDC", "USDT", "FLIP", "DOT", "ETH", "BTC", "SOL"];
15
22
  var baseChainflipAssets = chainflipAssets.filter(
16
23
  (asset) => asset !== "Usdc"
17
24
  );
18
25
  var chainflipEvmChains = ["Ethereum", "Arbitrum"];
19
- var chainflipChains = [...chainflipEvmChains, "Bitcoin", "Polkadot", "Solana"];
26
+ var chainflipChains = [
27
+ ...chainflipEvmChains,
28
+ "Bitcoin",
29
+ "Polkadot",
30
+ "Solana",
31
+ "Assethub"
32
+ ];
20
33
  var chainflipNetworks = ["backspin", "sisyphos", "perseverance", "mainnet"];
21
34
  var addressTypes = ["Eth", "Btc", "Dot", "Arb", "Sol"];
22
35
  function readAssetValue(map, asset) {
@@ -73,6 +86,21 @@ var assetConstants = {
73
86
  chain: "Solana",
74
87
  rpcAsset: "USDC",
75
88
  decimals: 6
89
+ },
90
+ HubDot: {
91
+ chain: "Assethub",
92
+ rpcAsset: "DOT",
93
+ decimals: 10
94
+ },
95
+ HubUsdc: {
96
+ chain: "Assethub",
97
+ rpcAsset: "USDC",
98
+ decimals: 6
99
+ },
100
+ HubUsdt: {
101
+ chain: "Assethub",
102
+ rpcAsset: "USDT",
103
+ decimals: 6
76
104
  }
77
105
  };
78
106
  var chainConstants = {
@@ -105,26 +133,40 @@ var chainConstants = {
105
133
  gasAsset: "Sol",
106
134
  addressType: "Sol",
107
135
  blockTimeSeconds: 0.8
136
+ },
137
+ Assethub: {
138
+ assets: ["HubDot", "HubUsdc", "HubUsdt"],
139
+ gasAsset: "HubDot",
140
+ addressType: "Dot",
141
+ blockTimeSeconds: 12
108
142
  }
109
143
  };
110
144
  var internalAssetToRpcAsset = {
145
+ Btc: { chain: "Bitcoin", asset: "BTC" },
146
+ Dot: { chain: "Polkadot", asset: "DOT" },
147
+ // Ethereum
111
148
  Eth: { chain: "Ethereum", asset: "ETH" },
112
- Flip: { chain: "Ethereum", asset: "FLIP" },
113
149
  Usdc: { chain: "Ethereum", asset: "USDC" },
150
+ Flip: { chain: "Ethereum", asset: "FLIP" },
114
151
  Usdt: { chain: "Ethereum", asset: "USDT" },
115
- Dot: { chain: "Polkadot", asset: "DOT" },
116
- Btc: { chain: "Bitcoin", asset: "BTC" },
152
+ // Arbitrum
117
153
  ArbUsdc: { chain: "Arbitrum", asset: "USDC" },
118
154
  ArbEth: { chain: "Arbitrum", asset: "ETH" },
155
+ // Solana
119
156
  Sol: { chain: "Solana", asset: "SOL" },
120
- SolUsdc: { chain: "Solana", asset: "USDC" }
157
+ SolUsdc: { chain: "Solana", asset: "USDC" },
158
+ // AssetHub
159
+ HubDot: { chain: "Assethub", asset: "DOT" },
160
+ HubUsdc: { chain: "Assethub", asset: "USDC" },
161
+ HubUsdt: { chain: "Assethub", asset: "USDT" }
121
162
  };
122
163
  var chainContractId = {
123
164
  Ethereum: 1,
124
165
  Polkadot: 2,
125
166
  Bitcoin: 3,
126
167
  Arbitrum: 4,
127
- Solana: 5
168
+ Solana: 5,
169
+ Assethub: 6
128
170
  };
129
171
  var assetContractId = {
130
172
  Eth: 1,
@@ -136,7 +178,10 @@ var assetContractId = {
136
178
  ArbEth: 6,
137
179
  ArbUsdc: 7,
138
180
  Sol: 9,
139
- SolUsdc: 10
181
+ SolUsdc: 10,
182
+ HubDot: 11,
183
+ HubUsdt: 12,
184
+ HubUsdc: 13
140
185
  };
141
186
 
142
187
  export {
package/dist/tickMath.cjs CHANGED
@@ -33,22 +33,35 @@ var import_bignumber = require("bignumber.js");
33
33
 
34
34
  // src/chainflip.ts
35
35
  var chainflipAssets = [
36
- "Usdc",
37
- "Usdt",
38
- "Flip",
36
+ "Btc",
39
37
  "Dot",
38
+ // Ethereum
40
39
  "Eth",
41
- "Btc",
40
+ "Usdc",
41
+ "Flip",
42
+ "Usdt",
43
+ // Arbitrum
42
44
  "ArbUsdc",
43
45
  "ArbEth",
46
+ // Solana
44
47
  "Sol",
45
- "SolUsdc"
48
+ "SolUsdc",
49
+ // AssetHub
50
+ "HubDot",
51
+ "HubUsdc",
52
+ "HubUsdt"
46
53
  ];
47
54
  var baseChainflipAssets = chainflipAssets.filter(
48
55
  (asset) => asset !== "Usdc"
49
56
  );
50
57
  var chainflipEvmChains = ["Ethereum", "Arbitrum"];
51
- var chainflipChains = [...chainflipEvmChains, "Bitcoin", "Polkadot", "Solana"];
58
+ var chainflipChains = [
59
+ ...chainflipEvmChains,
60
+ "Bitcoin",
61
+ "Polkadot",
62
+ "Solana",
63
+ "Assethub"
64
+ ];
52
65
  var assetConstants = {
53
66
  Eth: {
54
67
  chain: "Ethereum",
@@ -99,6 +112,21 @@ var assetConstants = {
99
112
  chain: "Solana",
100
113
  rpcAsset: "USDC",
101
114
  decimals: 6
115
+ },
116
+ HubDot: {
117
+ chain: "Assethub",
118
+ rpcAsset: "DOT",
119
+ decimals: 10
120
+ },
121
+ HubUsdc: {
122
+ chain: "Assethub",
123
+ rpcAsset: "USDC",
124
+ decimals: 6
125
+ },
126
+ HubUsdt: {
127
+ chain: "Assethub",
128
+ rpcAsset: "USDT",
129
+ decimals: 6
102
130
  }
103
131
  };
104
132
  var chainConstants = {
@@ -131,6 +159,12 @@ var chainConstants = {
131
159
  gasAsset: "Sol",
132
160
  addressType: "Sol",
133
161
  blockTimeSeconds: 0.8
162
+ },
163
+ Assethub: {
164
+ assets: ["HubDot", "HubUsdc", "HubUsdt"],
165
+ gasAsset: "HubDot",
166
+ addressType: "Dot",
167
+ blockTimeSeconds: 12
134
168
  }
135
169
  };
136
170
 
package/dist/tickMath.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  assetConstants
3
- } from "./chunk-YOAHWTE7.js";
3
+ } from "./chunk-26AL7ZVB.js";
4
4
 
5
5
  // src/tickMath.ts
6
6
  import { BigNumber } from "bignumber.js";
package/dist/types.d.cts CHANGED
@@ -2,14 +2,14 @@ import { ChainflipAsset } from './chainflip.cjs';
2
2
 
3
3
  type HexString = `0x${string}`;
4
4
  type Bytelike = Uint8Array | number[] | HexString;
5
- type VaultSwapData<T = never> = {
5
+ type VaultSwapData<Broker, CcmData = never> = {
6
6
  amount: bigint;
7
7
  destinationAddress: string;
8
8
  inputAsset: ChainflipAsset;
9
9
  outputAsset: ChainflipAsset;
10
- depositChainBlockHeight: number;
10
+ depositChainBlockHeight: number | null;
11
11
  brokerFee: {
12
- account: string | null;
12
+ account: Broker;
13
13
  commissionBps: number;
14
14
  };
15
15
  affiliateFees: {
@@ -31,7 +31,7 @@ type VaultSwapData<T = never> = {
31
31
  message: HexString;
32
32
  gasBudget: HexString;
33
33
  };
34
- ccmAdditionalData: T;
34
+ ccmAdditionalData: CcmData;
35
35
  } | null;
36
36
  };
37
37
 
package/dist/types.d.ts CHANGED
@@ -2,14 +2,14 @@ import { ChainflipAsset } from './chainflip.js';
2
2
 
3
3
  type HexString = `0x${string}`;
4
4
  type Bytelike = Uint8Array | number[] | HexString;
5
- type VaultSwapData<T = never> = {
5
+ type VaultSwapData<Broker, CcmData = never> = {
6
6
  amount: bigint;
7
7
  destinationAddress: string;
8
8
  inputAsset: ChainflipAsset;
9
9
  outputAsset: ChainflipAsset;
10
- depositChainBlockHeight: number;
10
+ depositChainBlockHeight: number | null;
11
11
  brokerFee: {
12
- account: string | null;
12
+ account: Broker;
13
13
  commissionBps: number;
14
14
  };
15
15
  affiliateFees: {
@@ -31,7 +31,7 @@ type VaultSwapData<T = never> = {
31
31
  message: HexString;
32
32
  gasBudget: HexString;
33
33
  };
34
- ccmAdditionalData: T;
34
+ ccmAdditionalData: CcmData;
35
35
  } | null;
36
36
  };
37
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainflip/utils",
3
- "version": "0.7.1",
3
+ "version": "0.7.2-assethub.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",