@chainflip/utils 0.4.3 → 0.4.5

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/consts.d.cts CHANGED
@@ -16,134 +16,14 @@ declare const chainflipCommunityLinks: {
16
16
  twitter: string;
17
17
  telegram: string;
18
18
  };
19
- declare const brokerAliasMap: {
20
- cFLRQDfEdmnv6d2XfHJNRBQHi4fruPMReLSfvB8WWD2ENbqj7: {
19
+ type AccountAliasMap = {
20
+ [account: string]: {
21
21
  name: string;
22
- twitter: string;
23
- };
24
- cFN1AfNQBEBCkuNAV37WWw34bCAdiW5e5sHTY4LaaRWiBSh7B: {
25
- name: string;
26
- twitter: string;
27
- };
28
- cFJZVRaybb2PBwxTiAiRLiQfHY4KPB3RpJK22Q7Fhqk979aCH: {
29
- name: string;
30
- twitter: string;
31
- };
32
- cFLuWQcabsKpegned1ka3Qad6cTATzpgwLYZK8U5spmkG9MEf: {
33
- name: string;
34
- twitter: string;
35
- };
36
- cFJjZKzA5rUTb9qkZMGfec7piCpiAQKr15B4nALzriMGQL8BE: {
37
- name: string;
38
- twitter: string;
39
- };
40
- cFLdvBS9Gq9iqB8Zdb5cmnWgmhqvEojQYGMBquDz7xRiSvsJV: {
41
- name: string;
42
- twitter: string;
43
- };
44
- cFJWWedhJmnsk3P9jEmCfbmgmg62ZpA7LT5WCpwLXEzXuRuc3: {
45
- name: string;
46
- twitter: string;
47
- };
48
- cFKYhAZR1ycHnXLC1PVttiAMVRK489rKhfRXPA4v9yG4WdzqP: {
49
- name: string;
50
- twitter: string;
51
- };
52
- cFN3CjHtr3QdUymjhQPFgHzF3WiNNQy36DJxhLwet269qPWaQ: {
53
- name: string;
54
- twitter: string;
55
- };
56
- cFJsX7ECMDciU1Ce6VTmNz5TwgkiTMC3j9XVqmbf3eaxSyjXs: {
57
- name: string;
58
- twitter: string;
59
- };
60
- cFNx21kQWmr9wsqq29zWM7RpDBKv4bctudEUE6J22Hd4NUUHR: {
61
- name: string;
62
- twitter: string;
63
- };
64
- cFNdyY1j7jKqgJPLg6UH1aaA4N3s9S52Zyxo8nATYxkovtHUr: {
65
- name: string;
66
- twitter: string;
67
- };
68
- cFNmhAeG1L7f4KrbPvsZyUM8xsNmVbJ51AKv4zgHRaTrF4kBf: {
69
- name: string;
70
- twitter: string;
71
- };
72
- cFLraJ446JFyGxmXhEwbcFQrWoWbGL3n18giQ99ktVFFP2LaJ: {
73
- name: string;
74
- twitter: string;
75
- };
76
- cFN122fMqitRHRxhVnPHuGeQG1GQ5dQXb25J4FoJmn74x7Mhe: {
77
- name: string;
78
- twitter: string;
79
- };
80
- cFMYQgx3LhxLNDEiFC5nLXp5r1ZUrXocrQDqJB1Z3mqEegT6g: {
81
- name: string;
82
- twitter: string;
83
- };
84
- };
85
- declare const lpAliasMap: {
86
- cFLBKavxvThwqLWNr7cTwtqhYD6jDqXM31d6QoTLvuK4X78ve: {
87
- name: string;
88
- twitter: string;
89
- };
90
- cFKy4xbhLxvAVxYuPEWbbTJTed5WtyqNVikH2fS2WYLNHRrFh: {
91
- name: string;
92
- twitter: string;
93
- };
94
- cFKHPcU7dWqZjQarJerUei1ZJWCSGb2AC4VhW5axwYzTsaYRT: {
95
- name: string;
96
- twitter: string;
97
- };
98
- cFKbPkHcjWs6oryCc4L8i7hgGgFBgS73V8aRpzvQAXykJRrz1: {
99
- name: string;
100
- twitter: string;
101
- };
102
- cFHy5rshwuXtRvXyEt9a2eK4mzPbs4WqwGkGPWT9XP7jAc2kB: {
103
- name: string;
104
- twitter: string;
105
- };
106
- cFMboYsd4HvERKXX11LyvZXuTcQzV7KAe9ipP4La5vUs8fd4e: {
107
- name: string;
108
- twitter: string;
109
- };
110
- cFMVQrUbuTuXmeRinPQovRkCgoyrrRd3N4Q5ZdHfqv4VJi5Hh: {
111
- name: string;
112
- twitter: string;
113
- };
114
- cFNzKSS48cZ1xQmdub2ykc2LUc5UZS2YjLaZBUvmxoXHjMMVh: {
115
- name: string;
116
- twitter: null;
117
- };
118
- cFK6qCSmgYJACMNVk6JnCb5nkccr7yM6aZiKtXUnFAzsX7hvs: {
119
- name: string;
120
- twitter: string;
121
- };
122
- cFJXT4WEEdfiShje4z9JMwAvMiMTu7nioPgXsE9o1KqdVrzLg: {
123
- name: string;
124
- twitter: string;
125
- };
126
- cFLGvPhhrribWCx9id5kLVqwiFK4QiVNjQ6ViyaRFF2Nrgq7j: {
127
- name: string;
128
- twitter: string;
129
- };
130
- cFKZarxpf9MVwzzmYUtQfV61PRkYgTj9wUgUCeuKpKgMLrTow: {
131
- name: string;
132
- twitter: string;
133
- };
134
- cFLBRkucKofjzUNnFpSoW8Lv4RK24K5tUPFKAWgdrBci9WPDY: {
135
- name: string;
136
- twitter: string;
137
- };
138
- cFJsDTPT4Pcwco6raEz5PJC65nrdvhcu3ZoEBhtQxapsWmB8A: {
139
- name: string;
140
- twitter: string;
141
- };
142
- cFPJNbXH9KNP1CRejnf19ARopcS8w8c4teTz5GF3G36MZRWJG: {
143
- name: string;
144
- twitter: null;
22
+ twitter: string | null;
145
23
  };
146
24
  };
25
+ declare const brokerAliasMap: AccountAliasMap;
26
+ declare const lpAliasMap: AccountAliasMap;
147
27
  declare const GENESIS_LP_ACCOUNT_IDS: string[];
148
28
 
149
29
  export { CHAINFLIP_BLOCKS_PER_YEAR, CHAINFLIP_BLOCK_TIME_SECONDS, CHAINFLIP_SS58_PREFIX, GENESIS_LP_ACCOUNT_IDS, HEARTBEAT_BLOCK_INTERVAL, POLKADOT_SS58_PREFIX, brokerAliasMap, chainflipCommunityLinks, chainflipLinks, lpAliasMap };
package/dist/consts.d.ts CHANGED
@@ -16,134 +16,14 @@ declare const chainflipCommunityLinks: {
16
16
  twitter: string;
17
17
  telegram: string;
18
18
  };
19
- declare const brokerAliasMap: {
20
- cFLRQDfEdmnv6d2XfHJNRBQHi4fruPMReLSfvB8WWD2ENbqj7: {
19
+ type AccountAliasMap = {
20
+ [account: string]: {
21
21
  name: string;
22
- twitter: string;
23
- };
24
- cFN1AfNQBEBCkuNAV37WWw34bCAdiW5e5sHTY4LaaRWiBSh7B: {
25
- name: string;
26
- twitter: string;
27
- };
28
- cFJZVRaybb2PBwxTiAiRLiQfHY4KPB3RpJK22Q7Fhqk979aCH: {
29
- name: string;
30
- twitter: string;
31
- };
32
- cFLuWQcabsKpegned1ka3Qad6cTATzpgwLYZK8U5spmkG9MEf: {
33
- name: string;
34
- twitter: string;
35
- };
36
- cFJjZKzA5rUTb9qkZMGfec7piCpiAQKr15B4nALzriMGQL8BE: {
37
- name: string;
38
- twitter: string;
39
- };
40
- cFLdvBS9Gq9iqB8Zdb5cmnWgmhqvEojQYGMBquDz7xRiSvsJV: {
41
- name: string;
42
- twitter: string;
43
- };
44
- cFJWWedhJmnsk3P9jEmCfbmgmg62ZpA7LT5WCpwLXEzXuRuc3: {
45
- name: string;
46
- twitter: string;
47
- };
48
- cFKYhAZR1ycHnXLC1PVttiAMVRK489rKhfRXPA4v9yG4WdzqP: {
49
- name: string;
50
- twitter: string;
51
- };
52
- cFN3CjHtr3QdUymjhQPFgHzF3WiNNQy36DJxhLwet269qPWaQ: {
53
- name: string;
54
- twitter: string;
55
- };
56
- cFJsX7ECMDciU1Ce6VTmNz5TwgkiTMC3j9XVqmbf3eaxSyjXs: {
57
- name: string;
58
- twitter: string;
59
- };
60
- cFNx21kQWmr9wsqq29zWM7RpDBKv4bctudEUE6J22Hd4NUUHR: {
61
- name: string;
62
- twitter: string;
63
- };
64
- cFNdyY1j7jKqgJPLg6UH1aaA4N3s9S52Zyxo8nATYxkovtHUr: {
65
- name: string;
66
- twitter: string;
67
- };
68
- cFNmhAeG1L7f4KrbPvsZyUM8xsNmVbJ51AKv4zgHRaTrF4kBf: {
69
- name: string;
70
- twitter: string;
71
- };
72
- cFLraJ446JFyGxmXhEwbcFQrWoWbGL3n18giQ99ktVFFP2LaJ: {
73
- name: string;
74
- twitter: string;
75
- };
76
- cFN122fMqitRHRxhVnPHuGeQG1GQ5dQXb25J4FoJmn74x7Mhe: {
77
- name: string;
78
- twitter: string;
79
- };
80
- cFMYQgx3LhxLNDEiFC5nLXp5r1ZUrXocrQDqJB1Z3mqEegT6g: {
81
- name: string;
82
- twitter: string;
83
- };
84
- };
85
- declare const lpAliasMap: {
86
- cFLBKavxvThwqLWNr7cTwtqhYD6jDqXM31d6QoTLvuK4X78ve: {
87
- name: string;
88
- twitter: string;
89
- };
90
- cFKy4xbhLxvAVxYuPEWbbTJTed5WtyqNVikH2fS2WYLNHRrFh: {
91
- name: string;
92
- twitter: string;
93
- };
94
- cFKHPcU7dWqZjQarJerUei1ZJWCSGb2AC4VhW5axwYzTsaYRT: {
95
- name: string;
96
- twitter: string;
97
- };
98
- cFKbPkHcjWs6oryCc4L8i7hgGgFBgS73V8aRpzvQAXykJRrz1: {
99
- name: string;
100
- twitter: string;
101
- };
102
- cFHy5rshwuXtRvXyEt9a2eK4mzPbs4WqwGkGPWT9XP7jAc2kB: {
103
- name: string;
104
- twitter: string;
105
- };
106
- cFMboYsd4HvERKXX11LyvZXuTcQzV7KAe9ipP4La5vUs8fd4e: {
107
- name: string;
108
- twitter: string;
109
- };
110
- cFMVQrUbuTuXmeRinPQovRkCgoyrrRd3N4Q5ZdHfqv4VJi5Hh: {
111
- name: string;
112
- twitter: string;
113
- };
114
- cFNzKSS48cZ1xQmdub2ykc2LUc5UZS2YjLaZBUvmxoXHjMMVh: {
115
- name: string;
116
- twitter: null;
117
- };
118
- cFK6qCSmgYJACMNVk6JnCb5nkccr7yM6aZiKtXUnFAzsX7hvs: {
119
- name: string;
120
- twitter: string;
121
- };
122
- cFJXT4WEEdfiShje4z9JMwAvMiMTu7nioPgXsE9o1KqdVrzLg: {
123
- name: string;
124
- twitter: string;
125
- };
126
- cFLGvPhhrribWCx9id5kLVqwiFK4QiVNjQ6ViyaRFF2Nrgq7j: {
127
- name: string;
128
- twitter: string;
129
- };
130
- cFKZarxpf9MVwzzmYUtQfV61PRkYgTj9wUgUCeuKpKgMLrTow: {
131
- name: string;
132
- twitter: string;
133
- };
134
- cFLBRkucKofjzUNnFpSoW8Lv4RK24K5tUPFKAWgdrBci9WPDY: {
135
- name: string;
136
- twitter: string;
137
- };
138
- cFJsDTPT4Pcwco6raEz5PJC65nrdvhcu3ZoEBhtQxapsWmB8A: {
139
- name: string;
140
- twitter: string;
141
- };
142
- cFPJNbXH9KNP1CRejnf19ARopcS8w8c4teTz5GF3G36MZRWJG: {
143
- name: string;
144
- twitter: null;
22
+ twitter: string | null;
145
23
  };
146
24
  };
25
+ declare const brokerAliasMap: AccountAliasMap;
26
+ declare const lpAliasMap: AccountAliasMap;
147
27
  declare const GENESIS_LP_ACCOUNT_IDS: string[];
148
28
 
149
29
  export { CHAINFLIP_BLOCKS_PER_YEAR, CHAINFLIP_BLOCK_TIME_SECONDS, CHAINFLIP_SS58_PREFIX, GENESIS_LP_ACCOUNT_IDS, HEARTBEAT_BLOCK_INTERVAL, POLKADOT_SS58_PREFIX, brokerAliasMap, chainflipCommunityLinks, chainflipLinks, lpAliasMap };
package/dist/number.cjs CHANGED
@@ -34,13 +34,31 @@ __export(number_exports, {
34
34
  hexEncodeNumber: () => hexEncodeNumber
35
35
  });
36
36
  module.exports = __toCommonJS(number_exports);
37
- var import_assert = __toESM(require("assert"), 1);
38
37
  var import_bignumber = __toESM(require("bignumber.js"), 1);
38
+
39
+ // src/guard.ts
40
+ var createIsGuard = (type) => (value) => typeof value === type;
41
+ var isString = createIsGuard("string");
42
+ var isNumber = createIsGuard("number");
43
+ var isBigInt = createIsGuard("bigint");
44
+ var isBoolean = createIsGuard("boolean");
45
+ var isSymbol = createIsGuard("symbol");
46
+ var isObject = createIsGuard("object");
47
+ var isUndefined = createIsGuard("undefined");
48
+
49
+ // src/assertion.ts
50
+ function assert(condition, message = "assertion failed", Constructor = Error) {
51
+ if (!condition) {
52
+ throw new Constructor(message);
53
+ }
54
+ }
55
+
56
+ // src/number.ts
39
57
  var hexEncodeNumber = (num) => `0x${num.toString(16)}`;
40
58
  function formatUsdValue(value, precise = true) {
41
59
  if (value == null) return value;
42
60
  let usdAmount = new import_bignumber.default(value);
43
- (0, import_assert.default)(usdAmount.gte(0), "negative amounts not supported");
61
+ assert(usdAmount.gte(0), "negative amounts not supported");
44
62
  if (!usdAmount.eq(0) && usdAmount.lt(0.01)) return `<$0.01`;
45
63
  let suffix = "";
46
64
  let decimals = 2;
package/dist/number.js CHANGED
@@ -1,5 +1,9 @@
1
+ import {
2
+ assert
3
+ } from "./chunk-ZHIKNZLU.js";
4
+ import "./chunk-HBIFE4XN.js";
5
+
1
6
  // src/number.ts
2
- import assert from "assert";
3
7
  import BigNumber from "bignumber.js";
4
8
  var hexEncodeNumber = (num) => `0x${num.toString(16)}`;
5
9
  function formatUsdValue(value, precise = true) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainflip/utils",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",