@chainflip/utils 0.4.12 → 1.8.0-assethub.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.
@@ -34,23 +34,36 @@ __export(chainflip_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(chainflip_exports);
36
36
  var chainflipAssets = [
37
- "Usdc",
38
- "Usdt",
39
- "Flip",
37
+ "Btc",
40
38
  "Dot",
39
+ // Ethereum
41
40
  "Eth",
42
- "Btc",
41
+ "Usdc",
42
+ "Flip",
43
+ "Usdt",
44
+ // Arbitrum
43
45
  "ArbUsdc",
44
46
  "ArbEth",
47
+ // Solana
45
48
  "Sol",
46
- "SolUsdc"
49
+ "SolUsdc",
50
+ // AssetHub
51
+ "HubDot",
52
+ "HubUsdc",
53
+ "HubUsdt"
47
54
  ];
48
55
  var rpcAssets = ["USDC", "USDT", "FLIP", "DOT", "ETH", "BTC", "SOL"];
49
56
  var baseChainflipAssets = chainflipAssets.filter(
50
57
  (asset) => asset !== "Usdc"
51
58
  );
52
59
  var chainflipEvmChains = ["Ethereum", "Arbitrum"];
53
- var chainflipChains = [...chainflipEvmChains, "Bitcoin", "Polkadot", "Solana"];
60
+ var chainflipChains = [
61
+ ...chainflipEvmChains,
62
+ "Bitcoin",
63
+ "Polkadot",
64
+ "Solana",
65
+ "Assethub"
66
+ ];
54
67
  var chainflipNetworks = ["backspin", "sisyphos", "perseverance", "mainnet"];
55
68
  var addressTypes = ["Eth", "Btc", "Dot", "Arb", "Sol"];
56
69
  function readAssetValue(map, asset) {
@@ -107,6 +120,21 @@ var assetConstants = {
107
120
  chain: "Solana",
108
121
  rpcAsset: "USDC",
109
122
  decimals: 6
123
+ },
124
+ HubDot: {
125
+ chain: "Assethub",
126
+ rpcAsset: "DOT",
127
+ decimals: 10
128
+ },
129
+ HubUsdc: {
130
+ chain: "Assethub",
131
+ rpcAsset: "USDC",
132
+ decimals: 6
133
+ },
134
+ HubUsdt: {
135
+ chain: "Assethub",
136
+ rpcAsset: "USDT",
137
+ decimals: 6
110
138
  }
111
139
  };
112
140
  var chainConstants = {
@@ -139,19 +167,32 @@ var chainConstants = {
139
167
  gasAsset: "Sol",
140
168
  addressType: "Sol",
141
169
  blockTimeSeconds: 0.8
170
+ },
171
+ Assethub: {
172
+ assets: ["HubDot", "HubUsdc", "HubUsdt"],
173
+ gasAsset: "HubDot",
174
+ addressType: "Dot",
175
+ blockTimeSeconds: 12
142
176
  }
143
177
  };
144
178
  var internalAssetToRpcAsset = {
179
+ Btc: { chain: "Bitcoin", asset: "BTC" },
180
+ Dot: { chain: "Polkadot", asset: "DOT" },
181
+ // Ethereum
145
182
  Eth: { chain: "Ethereum", asset: "ETH" },
146
- Flip: { chain: "Ethereum", asset: "FLIP" },
147
183
  Usdc: { chain: "Ethereum", asset: "USDC" },
184
+ Flip: { chain: "Ethereum", asset: "FLIP" },
148
185
  Usdt: { chain: "Ethereum", asset: "USDT" },
149
- Dot: { chain: "Polkadot", asset: "DOT" },
150
- Btc: { chain: "Bitcoin", asset: "BTC" },
186
+ // Arbitrum
151
187
  ArbUsdc: { chain: "Arbitrum", asset: "USDC" },
152
188
  ArbEth: { chain: "Arbitrum", asset: "ETH" },
189
+ // Solana
153
190
  Sol: { chain: "Solana", asset: "SOL" },
154
- SolUsdc: { chain: "Solana", asset: "USDC" }
191
+ SolUsdc: { chain: "Solana", asset: "USDC" },
192
+ // AssetHub
193
+ HubDot: { chain: "Assethub", asset: "DOT" },
194
+ HubUsdc: { chain: "Assethub", asset: "USDC" },
195
+ HubUsdt: { chain: "Assethub", asset: "USDT" }
155
196
  };
156
197
  // Annotate the CommonJS export names for ESM import in node:
157
198
  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
 
@@ -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
 
package/dist/chainflip.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  internalAssetToRpcAsset,
11
11
  readAssetValue,
12
12
  rpcAssets
13
- } from "./chunk-FKSZD3R5.js";
13
+ } from "./chunk-X7QHJLN2.js";
14
14
  export {
15
15
  addressTypes,
16
16
  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,19 +133,32 @@ 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
 
123
164
  export {
package/dist/ss58.cjs CHANGED
@@ -26,37 +26,37 @@ __export(ss58_exports, {
26
26
  });
27
27
  module.exports = __toCommonJS(ss58_exports);
28
28
 
29
- // ../../node_modules/.pnpm/@noble+hashes@1.6.1/node_modules/@noble/hashes/esm/_assert.js
30
- function anumber(n) {
29
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_assert.js
30
+ function number(n) {
31
31
  if (!Number.isSafeInteger(n) || n < 0)
32
- throw new Error("positive integer expected, got " + n);
32
+ throw new Error(`positive integer expected, not ${n}`);
33
33
  }
34
34
  function isBytes(a) {
35
- return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
35
+ return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
36
36
  }
37
- function abytes(b, ...lengths) {
37
+ function bytes(b, ...lengths) {
38
38
  if (!isBytes(b))
39
39
  throw new Error("Uint8Array expected");
40
40
  if (lengths.length > 0 && !lengths.includes(b.length))
41
- throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
41
+ throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);
42
42
  }
43
- function aexists(instance, checkFinished = true) {
43
+ function exists(instance, checkFinished = true) {
44
44
  if (instance.destroyed)
45
45
  throw new Error("Hash instance has been destroyed");
46
46
  if (checkFinished && instance.finished)
47
47
  throw new Error("Hash#digest() has already been called");
48
48
  }
49
- function aoutput(out, instance) {
50
- abytes(out);
49
+ function output(out, instance) {
50
+ bytes(out);
51
51
  const min = instance.outputLen;
52
52
  if (out.length < min) {
53
- throw new Error("digestInto() expects output buffer of length at least " + min);
53
+ throw new Error(`digestInto() expects output buffer of length at least ${min}`);
54
54
  }
55
55
  }
56
56
 
57
- // ../../node_modules/.pnpm/@noble+hashes@1.6.1/node_modules/@noble/hashes/esm/utils.js
57
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/utils.js
58
58
  var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
59
- var isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
59
+ var isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
60
60
  var byteSwap = (word) => word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
61
61
  var byteSwapIfBE = isLE ? (n) => n : (n) => byteSwap(n);
62
62
  function byteSwap32(arr) {
@@ -66,13 +66,13 @@ function byteSwap32(arr) {
66
66
  }
67
67
  function utf8ToBytes(str) {
68
68
  if (typeof str !== "string")
69
- throw new Error("utf8ToBytes expected string, got " + typeof str);
69
+ throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
70
70
  return new Uint8Array(new TextEncoder().encode(str));
71
71
  }
72
72
  function toBytes(data) {
73
73
  if (typeof data === "string")
74
74
  data = utf8ToBytes(data);
75
- abytes(data);
75
+ bytes(data);
76
76
  return data;
77
77
  }
78
78
  var Hash = class {
@@ -81,6 +81,7 @@ var Hash = class {
81
81
  return this._cloneInto();
82
82
  }
83
83
  };
84
+ var toStr = {}.toString;
84
85
  function wrapConstructorWithOpts(hashCons) {
85
86
  const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
86
87
  const tmp = hashCons({});
@@ -90,7 +91,7 @@ function wrapConstructorWithOpts(hashCons) {
90
91
  return hashC;
91
92
  }
92
93
 
93
- // ../../node_modules/.pnpm/@noble+hashes@1.6.1/node_modules/@noble/hashes/esm/_blake.js
94
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_blake.js
94
95
  var SIGMA = /* @__PURE__ */ new Uint8Array([
95
96
  0,
96
97
  1,
@@ -294,22 +295,21 @@ var BLAKE = class extends Hash {
294
295
  this.pos = 0;
295
296
  this.finished = false;
296
297
  this.destroyed = false;
297
- anumber(blockLen);
298
- anumber(outputLen);
299
- anumber(keyLen);
298
+ number(blockLen);
299
+ number(outputLen);
300
+ number(keyLen);
300
301
  if (outputLen < 0 || outputLen > keyLen)
301
302
  throw new Error("outputLen bigger than keyLen");
302
303
  if (opts.key !== void 0 && (opts.key.length < 1 || opts.key.length > keyLen))
303
- throw new Error("key length must be undefined or 1.." + keyLen);
304
+ throw new Error(`key must be up 1..${keyLen} byte long or undefined`);
304
305
  if (opts.salt !== void 0 && opts.salt.length !== saltLen)
305
- throw new Error("salt must be undefined or " + saltLen);
306
+ throw new Error(`salt must be ${saltLen} byte long or undefined`);
306
307
  if (opts.personalization !== void 0 && opts.personalization.length !== persLen)
307
- throw new Error("personalization must be undefined or " + persLen);
308
- this.buffer = new Uint8Array(blockLen);
309
- this.buffer32 = u32(this.buffer);
308
+ throw new Error(`personalization must be ${persLen} byte long or undefined`);
309
+ this.buffer32 = u32(this.buffer = new Uint8Array(blockLen));
310
310
  }
311
311
  update(data) {
312
- aexists(this);
312
+ exists(this);
313
313
  const { blockLen, buffer, buffer32 } = this;
314
314
  data = toBytes(data);
315
315
  const len = data.length;
@@ -346,8 +346,8 @@ var BLAKE = class extends Hash {
346
346
  return this;
347
347
  }
348
348
  digestInto(out) {
349
- aexists(this);
350
- aoutput(out, this);
349
+ exists(this);
350
+ output(out, this);
351
351
  const { pos, buffer32 } = this;
352
352
  this.finished = true;
353
353
  this.buffer.subarray(pos).fill(0);
@@ -380,7 +380,7 @@ var BLAKE = class extends Hash {
380
380
  }
381
381
  };
382
382
 
383
- // ../../node_modules/.pnpm/@noble+hashes@1.6.1/node_modules/@noble/hashes/esm/_u64.js
383
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_u64.js
384
384
  var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
385
385
  var _32n = /* @__PURE__ */ BigInt(32);
386
386
  function fromBig(n, le = false) {
@@ -446,7 +446,7 @@ var u64 = {
446
446
  };
447
447
  var u64_default = u64;
448
448
 
449
- // ../../node_modules/.pnpm/@noble+hashes@1.6.1/node_modules/@noble/hashes/esm/blake2b.js
449
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/blake2b.js
450
450
  var B2B_IV = /* @__PURE__ */ new Uint32Array([
451
451
  4089235720,
452
452
  1779033703,
@@ -644,21 +644,21 @@ function assert(condition, message = "assertion failed", Constructor = Error) {
644
644
 
645
645
  // src/bytes.ts
646
646
  var bytesToHex = (input) => {
647
- const bytes = new Uint8Array(input);
648
- return `0x${Array.from(bytes).map((byte) => byte.toString(16).padStart(2, "0")).join("")}`;
647
+ const bytes2 = new Uint8Array(input);
648
+ return `0x${Array.from(bytes2).map((byte) => byte.toString(16).padStart(2, "0")).join("")}`;
649
649
  };
650
650
  var hexToBytes = (input) => {
651
651
  assert(/^0x[\da-f]*$/i.test(input) && input.length % 2 === 0, "Invalid hex string");
652
652
  const hex = input.slice(2);
653
- const bytes = new Uint8Array(hex.length / 2);
653
+ const bytes2 = new Uint8Array(hex.length / 2);
654
654
  for (let i = 0; i < hex.length; i += 2) {
655
- bytes[i / 2] = Number.parseInt(hex.slice(i, i + 2), 16);
655
+ bytes2[i / 2] = Number.parseInt(hex.slice(i, i + 2), 16);
656
656
  }
657
- return bytes;
657
+ return bytes2;
658
658
  };
659
- var convertBase = (bytes, fromBase, toBase) => {
659
+ var convertBase = (bytes2, fromBase, toBase) => {
660
660
  const result = [];
661
- for (const byte of bytes) {
661
+ for (const byte of bytes2) {
662
662
  let carry = byte;
663
663
  for (let i = 0; i < result.length; i += 1) {
664
664
  carry += result[i] * fromBase;
@@ -671,23 +671,23 @@ var convertBase = (bytes, fromBase, toBase) => {
671
671
  }
672
672
  }
673
673
  let leadingZeros = 0;
674
- while (bytes[leadingZeros] === 0) {
674
+ while (bytes2[leadingZeros] === 0) {
675
675
  leadingZeros += 1;
676
676
  result.push(0);
677
677
  }
678
678
  return result.reverse();
679
679
  };
680
- var encodeBytesWithCharset = (bytes, charset2) => convertBase(bytes, 256, charset2.length).map((charCode) => charset2.charAt(charCode)).join("");
680
+ var encodeBytesWithCharset = (bytes2, charset2) => convertBase(bytes2, 256, charset2.length).map((charCode) => charset2.charAt(charCode)).join("");
681
681
  var decodeBytesWithCharset = (input, charset2) => {
682
682
  assert(new RegExp(`^[${charset2}]*$`).test(input), "Invalid input");
683
683
  const charMap = Object.fromEntries([...charset2].map((char, index) => [char, index]));
684
- const bytes = input.split("").map((char) => charMap[char]);
685
- return new Uint8Array(convertBase(bytes, charset2.length, 256));
684
+ const bytes2 = input.split("").map((char) => charMap[char]);
685
+ return new Uint8Array(convertBase(bytes2, charset2.length, 256));
686
686
  };
687
687
 
688
688
  // src/base58.ts
689
689
  var charset = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
690
- var encode = (bytes) => encodeBytesWithCharset(bytes, charset);
690
+ var encode = (bytes2) => encodeBytesWithCharset(bytes2, charset);
691
691
  var decode = (input) => decodeBytesWithCharset(input, charset);
692
692
 
693
693
  // src/ss58.ts
package/dist/ss58.js CHANGED
@@ -11,37 +11,37 @@ import {
11
11
  } from "./chunk-ZHIKNZLU.js";
12
12
  import "./chunk-HBIFE4XN.js";
13
13
 
14
- // ../../node_modules/.pnpm/@noble+hashes@1.6.1/node_modules/@noble/hashes/esm/_assert.js
15
- function anumber(n) {
14
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_assert.js
15
+ function number(n) {
16
16
  if (!Number.isSafeInteger(n) || n < 0)
17
- throw new Error("positive integer expected, got " + n);
17
+ throw new Error(`positive integer expected, not ${n}`);
18
18
  }
19
19
  function isBytes(a) {
20
- return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
20
+ return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
21
21
  }
22
- function abytes(b, ...lengths) {
22
+ function bytes(b, ...lengths) {
23
23
  if (!isBytes(b))
24
24
  throw new Error("Uint8Array expected");
25
25
  if (lengths.length > 0 && !lengths.includes(b.length))
26
- throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
26
+ throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);
27
27
  }
28
- function aexists(instance, checkFinished = true) {
28
+ function exists(instance, checkFinished = true) {
29
29
  if (instance.destroyed)
30
30
  throw new Error("Hash instance has been destroyed");
31
31
  if (checkFinished && instance.finished)
32
32
  throw new Error("Hash#digest() has already been called");
33
33
  }
34
- function aoutput(out, instance) {
35
- abytes(out);
34
+ function output(out, instance) {
35
+ bytes(out);
36
36
  const min = instance.outputLen;
37
37
  if (out.length < min) {
38
- throw new Error("digestInto() expects output buffer of length at least " + min);
38
+ throw new Error(`digestInto() expects output buffer of length at least ${min}`);
39
39
  }
40
40
  }
41
41
 
42
- // ../../node_modules/.pnpm/@noble+hashes@1.6.1/node_modules/@noble/hashes/esm/utils.js
42
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/utils.js
43
43
  var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
44
- var isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
44
+ var isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
45
45
  var byteSwap = (word) => word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
46
46
  var byteSwapIfBE = isLE ? (n) => n : (n) => byteSwap(n);
47
47
  function byteSwap32(arr) {
@@ -51,13 +51,13 @@ function byteSwap32(arr) {
51
51
  }
52
52
  function utf8ToBytes(str) {
53
53
  if (typeof str !== "string")
54
- throw new Error("utf8ToBytes expected string, got " + typeof str);
54
+ throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
55
55
  return new Uint8Array(new TextEncoder().encode(str));
56
56
  }
57
57
  function toBytes(data) {
58
58
  if (typeof data === "string")
59
59
  data = utf8ToBytes(data);
60
- abytes(data);
60
+ bytes(data);
61
61
  return data;
62
62
  }
63
63
  var Hash = class {
@@ -66,6 +66,7 @@ var Hash = class {
66
66
  return this._cloneInto();
67
67
  }
68
68
  };
69
+ var toStr = {}.toString;
69
70
  function wrapConstructorWithOpts(hashCons) {
70
71
  const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
71
72
  const tmp = hashCons({});
@@ -75,7 +76,7 @@ function wrapConstructorWithOpts(hashCons) {
75
76
  return hashC;
76
77
  }
77
78
 
78
- // ../../node_modules/.pnpm/@noble+hashes@1.6.1/node_modules/@noble/hashes/esm/_blake.js
79
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_blake.js
79
80
  var SIGMA = /* @__PURE__ */ new Uint8Array([
80
81
  0,
81
82
  1,
@@ -279,22 +280,21 @@ var BLAKE = class extends Hash {
279
280
  this.pos = 0;
280
281
  this.finished = false;
281
282
  this.destroyed = false;
282
- anumber(blockLen);
283
- anumber(outputLen);
284
- anumber(keyLen);
283
+ number(blockLen);
284
+ number(outputLen);
285
+ number(keyLen);
285
286
  if (outputLen < 0 || outputLen > keyLen)
286
287
  throw new Error("outputLen bigger than keyLen");
287
288
  if (opts.key !== void 0 && (opts.key.length < 1 || opts.key.length > keyLen))
288
- throw new Error("key length must be undefined or 1.." + keyLen);
289
+ throw new Error(`key must be up 1..${keyLen} byte long or undefined`);
289
290
  if (opts.salt !== void 0 && opts.salt.length !== saltLen)
290
- throw new Error("salt must be undefined or " + saltLen);
291
+ throw new Error(`salt must be ${saltLen} byte long or undefined`);
291
292
  if (opts.personalization !== void 0 && opts.personalization.length !== persLen)
292
- throw new Error("personalization must be undefined or " + persLen);
293
- this.buffer = new Uint8Array(blockLen);
294
- this.buffer32 = u32(this.buffer);
293
+ throw new Error(`personalization must be ${persLen} byte long or undefined`);
294
+ this.buffer32 = u32(this.buffer = new Uint8Array(blockLen));
295
295
  }
296
296
  update(data) {
297
- aexists(this);
297
+ exists(this);
298
298
  const { blockLen, buffer, buffer32 } = this;
299
299
  data = toBytes(data);
300
300
  const len = data.length;
@@ -331,8 +331,8 @@ var BLAKE = class extends Hash {
331
331
  return this;
332
332
  }
333
333
  digestInto(out) {
334
- aexists(this);
335
- aoutput(out, this);
334
+ exists(this);
335
+ output(out, this);
336
336
  const { pos, buffer32 } = this;
337
337
  this.finished = true;
338
338
  this.buffer.subarray(pos).fill(0);
@@ -365,7 +365,7 @@ var BLAKE = class extends Hash {
365
365
  }
366
366
  };
367
367
 
368
- // ../../node_modules/.pnpm/@noble+hashes@1.6.1/node_modules/@noble/hashes/esm/_u64.js
368
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_u64.js
369
369
  var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
370
370
  var _32n = /* @__PURE__ */ BigInt(32);
371
371
  function fromBig(n, le = false) {
@@ -431,7 +431,7 @@ var u64 = {
431
431
  };
432
432
  var u64_default = u64;
433
433
 
434
- // ../../node_modules/.pnpm/@noble+hashes@1.6.1/node_modules/@noble/hashes/esm/blake2b.js
434
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/blake2b.js
435
435
  var B2B_IV = /* @__PURE__ */ new Uint32Array([
436
436
  4089235720,
437
437
  1779033703,
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-FKSZD3R5.js";
3
+ } from "./chunk-X7QHJLN2.js";
4
4
 
5
5
  // src/tickMath.ts
6
6
  import { BigNumber } from "bignumber.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainflip/utils",
3
- "version": "0.4.12",
3
+ "version": "1.8.0-assethub.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",