@talismn/balances 0.0.0-pr640-20230321101310 → 0.0.0-pr643-20230322031130
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/CHANGELOG.md
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
# @talismn/balances
|
2
2
|
|
3
|
-
## 0.0.0-
|
3
|
+
## 0.0.0-pr643-20230322031130
|
4
4
|
|
5
5
|
### Patch Changes
|
6
6
|
|
7
|
+
- 3068bd6: feat: stale balances and exponential rpc backoff
|
7
8
|
- 6643a4e: fix: tokenRates in @talismn/balances-react
|
8
9
|
- 6643a4e: fix: ported useDbCache related perf fixes to @talismn/balances-react
|
10
|
+
- Updated dependencies [3068bd6]
|
9
11
|
- Updated dependencies [6643a4e]
|
10
12
|
- Updated dependencies [79f6ccf]
|
11
|
-
-
|
12
|
-
- @talismn/
|
13
|
-
- @talismn/
|
14
|
-
- @talismn/
|
15
|
-
- @talismn/chain-connector-evm@0.0.0-
|
13
|
+
- @talismn/chain-connector@0.0.0-pr643-20230322031130
|
14
|
+
- @talismn/util@0.0.0-pr643-20230322031130
|
15
|
+
- @talismn/token-rates@0.0.0-pr643-20230322031130
|
16
|
+
- @talismn/chaindata-provider@0.0.0-pr643-20230322031130
|
17
|
+
- @talismn/chain-connector-evm@0.0.0-pr643-20230322031130
|
16
18
|
|
17
19
|
## 0.3.3
|
18
20
|
|
@@ -23,7 +23,7 @@ export type BalanceTypes = {
|
|
23
23
|
export type BalanceJson = BalanceTypes[keyof BalanceTypes] extends never ? IBalance : BalanceTypes[keyof BalanceTypes];
|
24
24
|
/** A collection of `BalanceJson` objects */
|
25
25
|
export type BalanceJsonList = Record<string, BalanceJson>;
|
26
|
-
export type BalanceStatus = "live" | "cache";
|
26
|
+
export type BalanceStatus = "live" | "cache" | "stale";
|
27
27
|
/** `IBalance` is a common interface which all balance types must implement. */
|
28
28
|
export type IBalance = {
|
29
29
|
/** The module that this balance was retrieved by */
|
@@ -67,7 +67,7 @@ const db = new TalismanBalancesDatabase();
|
|
67
67
|
|
68
68
|
var packageJson = {
|
69
69
|
name: "@talismn/balances",
|
70
|
-
version: "0.0.0-
|
70
|
+
version: "0.0.0-pr643-20230322031130",
|
71
71
|
author: "Talisman",
|
72
72
|
homepage: "https://talisman.xyz",
|
73
73
|
license: "UNLICENSED",
|
@@ -86,7 +86,7 @@ var packageJson = {
|
|
86
86
|
"/plugins"
|
87
87
|
],
|
88
88
|
engines: {
|
89
|
-
node: ">=
|
89
|
+
node: ">=14"
|
90
90
|
},
|
91
91
|
scripts: {
|
92
92
|
test: "jest",
|
@@ -157,8 +157,9 @@ const createTypeRegistryCache = () => {
|
|
157
157
|
};
|
158
158
|
};
|
159
159
|
const filterMirrorTokens = (balance, i, balances) => {
|
160
|
+
var _balance$token;
|
160
161
|
// TODO: implement a mirrorOf property, which should be set from chaindata
|
161
|
-
const mirrorOf = balance.token
|
162
|
+
const mirrorOf = (_balance$token = balance.token) === null || _balance$token === void 0 ? void 0 : _balance$token.mirrorOf;
|
162
163
|
return !mirrorOf || !balances.find(b => b.tokenId === mirrorOf);
|
163
164
|
};
|
164
165
|
|
@@ -194,7 +195,8 @@ class StorageHelper {
|
|
194
195
|
}
|
195
196
|
}
|
196
197
|
get stateKey() {
|
197
|
-
|
198
|
+
var _this$storageKey;
|
199
|
+
return (_this$storageKey = this.#storageKey) === null || _this$storageKey === void 0 ? void 0 : _this$storageKey.toHex();
|
198
200
|
}
|
199
201
|
get module() {
|
200
202
|
return this.#module;
|
@@ -419,7 +421,10 @@ class Balances {
|
|
419
421
|
* @returns A sorted array of the balances in this collection.
|
420
422
|
*/
|
421
423
|
get sorted() {
|
422
|
-
return [...this].sort((a, b) =>
|
424
|
+
return [...this].sort((a, b) => {
|
425
|
+
var _ref, _ref2;
|
426
|
+
return (((_ref = a.chain || a.evmNetwork) === null || _ref === void 0 ? void 0 : _ref.sortIndex) ?? Number.MAX_SAFE_INTEGER) - (((_ref2 = b.chain || b.evmNetwork) === null || _ref2 === void 0 ? void 0 : _ref2.sortIndex) ?? Number.MAX_SAFE_INTEGER);
|
427
|
+
});
|
423
428
|
}
|
424
429
|
|
425
430
|
/**
|
@@ -483,7 +488,10 @@ class Balance {
|
|
483
488
|
hydrate = hydrate => {
|
484
489
|
if (hydrate !== undefined) this.#db = hydrate;
|
485
490
|
};
|
486
|
-
#format = balance =>
|
491
|
+
#format = balance => {
|
492
|
+
var _this$db;
|
493
|
+
return new BalanceFormatter(typeof balance === "bigint" ? balance.toString() : balance, this.decimals || undefined, ((_this$db = this.#db) === null || _this$db === void 0 ? void 0 : _this$db.tokenRates) && this.#db.tokenRates[this.tokenId]);
|
494
|
+
};
|
487
495
|
|
488
496
|
//
|
489
497
|
// Accessors
|
@@ -513,27 +521,32 @@ class Balance {
|
|
513
521
|
return this.#storage.chainId;
|
514
522
|
}
|
515
523
|
get chain() {
|
516
|
-
|
524
|
+
var _this$db2, _this$db3;
|
525
|
+
return ((_this$db2 = this.#db) === null || _this$db2 === void 0 ? void 0 : _this$db2.chains) && this.chainId && ((_this$db3 = this.#db) === null || _this$db3 === void 0 ? void 0 : _this$db3.chains[this.chainId]) || null;
|
517
526
|
}
|
518
527
|
get evmNetworkId() {
|
519
528
|
return this.#storage.evmNetworkId;
|
520
529
|
}
|
521
530
|
get evmNetwork() {
|
531
|
+
var _this$db4, _this$db5;
|
522
532
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
523
|
-
return this.#db
|
533
|
+
return ((_this$db4 = this.#db) === null || _this$db4 === void 0 ? void 0 : _this$db4.evmNetworks) && ((_this$db5 = this.#db) === null || _this$db5 === void 0 ? void 0 : _this$db5.evmNetworks[this.evmNetworkId]) || null;
|
524
534
|
}
|
525
535
|
get tokenId() {
|
526
536
|
return this.#storage.tokenId;
|
527
537
|
}
|
528
538
|
get token() {
|
539
|
+
var _this$db6, _this$db7;
|
529
540
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
530
|
-
return this.#db
|
541
|
+
return ((_this$db6 = this.#db) === null || _this$db6 === void 0 ? void 0 : _this$db6.tokens) && ((_this$db7 = this.#db) === null || _this$db7 === void 0 ? void 0 : _this$db7.tokens[this.tokenId]) || null;
|
531
542
|
}
|
532
543
|
get decimals() {
|
533
|
-
|
544
|
+
var _this$token;
|
545
|
+
return ((_this$token = this.token) === null || _this$token === void 0 ? void 0 : _this$token.decimals) || null;
|
534
546
|
}
|
535
547
|
get rates() {
|
536
|
-
|
548
|
+
var _this$db8;
|
549
|
+
return ((_this$db8 = this.#db) === null || _this$db8 === void 0 ? void 0 : _this$db8.tokenRates) && this.#db.tokenRates[this.tokenId] || null;
|
537
550
|
}
|
538
551
|
|
539
552
|
/**
|
@@ -547,15 +560,18 @@ class Balance {
|
|
547
560
|
}
|
548
561
|
/** The non-reserved balance of this token. Includes the frozen amount. Is included in the total. */
|
549
562
|
get free() {
|
550
|
-
|
563
|
+
var _this$storage$free;
|
564
|
+
return this.#format(typeof this.#storage.free === "string" ? BigInt(this.#storage.free) : Array.isArray(this.#storage.free) ? this.#storage.free.map(reserve => BigInt(reserve.amount)).reduce((a, b) => a + b, BigInt("0")) : BigInt(((_this$storage$free = this.#storage.free) === null || _this$storage$free === void 0 ? void 0 : _this$storage$free.amount) || "0"));
|
551
565
|
}
|
552
566
|
/** The reserved balance of this token. Is included in the total. */
|
553
567
|
get reserved() {
|
554
|
-
|
568
|
+
var _this$storage$reserve;
|
569
|
+
return this.#format(typeof this.#storage.reserves === "string" ? BigInt(this.#storage.reserves) : Array.isArray(this.#storage.reserves) ? this.#storage.reserves.map(reserve => BigInt(reserve.amount)).reduce((a, b) => a + b, BigInt("0")) : BigInt(((_this$storage$reserve = this.#storage.reserves) === null || _this$storage$reserve === void 0 ? void 0 : _this$storage$reserve.amount) || "0"));
|
555
570
|
}
|
556
571
|
/** The frozen balance of this token. Is included in the free amount. */
|
557
572
|
get locked() {
|
558
|
-
|
573
|
+
var _this$storage$locks;
|
574
|
+
return this.#format(typeof this.#storage.locks === "string" ? BigInt(this.#storage.locks) : Array.isArray(this.#storage.locks) ? this.#storage.locks.map(lock => BigInt(lock.amount)).reduce((a, b) => util.BigMath.max(a, b), BigInt("0")) : BigInt(((_this$storage$locks = this.#storage.locks) === null || _this$storage$locks === void 0 ? void 0 : _this$storage$locks.amount) || "0"));
|
559
575
|
}
|
560
576
|
/** @depreacted - use balance.locked */
|
561
577
|
get frozen() {
|
@@ -67,7 +67,7 @@ const db = new TalismanBalancesDatabase();
|
|
67
67
|
|
68
68
|
var packageJson = {
|
69
69
|
name: "@talismn/balances",
|
70
|
-
version: "0.0.0-
|
70
|
+
version: "0.0.0-pr643-20230322031130",
|
71
71
|
author: "Talisman",
|
72
72
|
homepage: "https://talisman.xyz",
|
73
73
|
license: "UNLICENSED",
|
@@ -86,7 +86,7 @@ var packageJson = {
|
|
86
86
|
"/plugins"
|
87
87
|
],
|
88
88
|
engines: {
|
89
|
-
node: ">=
|
89
|
+
node: ">=14"
|
90
90
|
},
|
91
91
|
scripts: {
|
92
92
|
test: "jest",
|
@@ -157,8 +157,9 @@ const createTypeRegistryCache = () => {
|
|
157
157
|
};
|
158
158
|
};
|
159
159
|
const filterMirrorTokens = (balance, i, balances) => {
|
160
|
+
var _balance$token;
|
160
161
|
// TODO: implement a mirrorOf property, which should be set from chaindata
|
161
|
-
const mirrorOf = balance.token
|
162
|
+
const mirrorOf = (_balance$token = balance.token) === null || _balance$token === void 0 ? void 0 : _balance$token.mirrorOf;
|
162
163
|
return !mirrorOf || !balances.find(b => b.tokenId === mirrorOf);
|
163
164
|
};
|
164
165
|
|
@@ -194,7 +195,8 @@ class StorageHelper {
|
|
194
195
|
}
|
195
196
|
}
|
196
197
|
get stateKey() {
|
197
|
-
|
198
|
+
var _this$storageKey;
|
199
|
+
return (_this$storageKey = this.#storageKey) === null || _this$storageKey === void 0 ? void 0 : _this$storageKey.toHex();
|
198
200
|
}
|
199
201
|
get module() {
|
200
202
|
return this.#module;
|
@@ -419,7 +421,10 @@ class Balances {
|
|
419
421
|
* @returns A sorted array of the balances in this collection.
|
420
422
|
*/
|
421
423
|
get sorted() {
|
422
|
-
return [...this].sort((a, b) =>
|
424
|
+
return [...this].sort((a, b) => {
|
425
|
+
var _ref, _ref2;
|
426
|
+
return (((_ref = a.chain || a.evmNetwork) === null || _ref === void 0 ? void 0 : _ref.sortIndex) ?? Number.MAX_SAFE_INTEGER) - (((_ref2 = b.chain || b.evmNetwork) === null || _ref2 === void 0 ? void 0 : _ref2.sortIndex) ?? Number.MAX_SAFE_INTEGER);
|
427
|
+
});
|
423
428
|
}
|
424
429
|
|
425
430
|
/**
|
@@ -483,7 +488,10 @@ class Balance {
|
|
483
488
|
hydrate = hydrate => {
|
484
489
|
if (hydrate !== undefined) this.#db = hydrate;
|
485
490
|
};
|
486
|
-
#format = balance =>
|
491
|
+
#format = balance => {
|
492
|
+
var _this$db;
|
493
|
+
return new BalanceFormatter(typeof balance === "bigint" ? balance.toString() : balance, this.decimals || undefined, ((_this$db = this.#db) === null || _this$db === void 0 ? void 0 : _this$db.tokenRates) && this.#db.tokenRates[this.tokenId]);
|
494
|
+
};
|
487
495
|
|
488
496
|
//
|
489
497
|
// Accessors
|
@@ -513,27 +521,32 @@ class Balance {
|
|
513
521
|
return this.#storage.chainId;
|
514
522
|
}
|
515
523
|
get chain() {
|
516
|
-
|
524
|
+
var _this$db2, _this$db3;
|
525
|
+
return ((_this$db2 = this.#db) === null || _this$db2 === void 0 ? void 0 : _this$db2.chains) && this.chainId && ((_this$db3 = this.#db) === null || _this$db3 === void 0 ? void 0 : _this$db3.chains[this.chainId]) || null;
|
517
526
|
}
|
518
527
|
get evmNetworkId() {
|
519
528
|
return this.#storage.evmNetworkId;
|
520
529
|
}
|
521
530
|
get evmNetwork() {
|
531
|
+
var _this$db4, _this$db5;
|
522
532
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
523
|
-
return this.#db
|
533
|
+
return ((_this$db4 = this.#db) === null || _this$db4 === void 0 ? void 0 : _this$db4.evmNetworks) && ((_this$db5 = this.#db) === null || _this$db5 === void 0 ? void 0 : _this$db5.evmNetworks[this.evmNetworkId]) || null;
|
524
534
|
}
|
525
535
|
get tokenId() {
|
526
536
|
return this.#storage.tokenId;
|
527
537
|
}
|
528
538
|
get token() {
|
539
|
+
var _this$db6, _this$db7;
|
529
540
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
530
|
-
return this.#db
|
541
|
+
return ((_this$db6 = this.#db) === null || _this$db6 === void 0 ? void 0 : _this$db6.tokens) && ((_this$db7 = this.#db) === null || _this$db7 === void 0 ? void 0 : _this$db7.tokens[this.tokenId]) || null;
|
531
542
|
}
|
532
543
|
get decimals() {
|
533
|
-
|
544
|
+
var _this$token;
|
545
|
+
return ((_this$token = this.token) === null || _this$token === void 0 ? void 0 : _this$token.decimals) || null;
|
534
546
|
}
|
535
547
|
get rates() {
|
536
|
-
|
548
|
+
var _this$db8;
|
549
|
+
return ((_this$db8 = this.#db) === null || _this$db8 === void 0 ? void 0 : _this$db8.tokenRates) && this.#db.tokenRates[this.tokenId] || null;
|
537
550
|
}
|
538
551
|
|
539
552
|
/**
|
@@ -547,15 +560,18 @@ class Balance {
|
|
547
560
|
}
|
548
561
|
/** The non-reserved balance of this token. Includes the frozen amount. Is included in the total. */
|
549
562
|
get free() {
|
550
|
-
|
563
|
+
var _this$storage$free;
|
564
|
+
return this.#format(typeof this.#storage.free === "string" ? BigInt(this.#storage.free) : Array.isArray(this.#storage.free) ? this.#storage.free.map(reserve => BigInt(reserve.amount)).reduce((a, b) => a + b, BigInt("0")) : BigInt(((_this$storage$free = this.#storage.free) === null || _this$storage$free === void 0 ? void 0 : _this$storage$free.amount) || "0"));
|
551
565
|
}
|
552
566
|
/** The reserved balance of this token. Is included in the total. */
|
553
567
|
get reserved() {
|
554
|
-
|
568
|
+
var _this$storage$reserve;
|
569
|
+
return this.#format(typeof this.#storage.reserves === "string" ? BigInt(this.#storage.reserves) : Array.isArray(this.#storage.reserves) ? this.#storage.reserves.map(reserve => BigInt(reserve.amount)).reduce((a, b) => a + b, BigInt("0")) : BigInt(((_this$storage$reserve = this.#storage.reserves) === null || _this$storage$reserve === void 0 ? void 0 : _this$storage$reserve.amount) || "0"));
|
555
570
|
}
|
556
571
|
/** The frozen balance of this token. Is included in the free amount. */
|
557
572
|
get locked() {
|
558
|
-
|
573
|
+
var _this$storage$locks;
|
574
|
+
return this.#format(typeof this.#storage.locks === "string" ? BigInt(this.#storage.locks) : Array.isArray(this.#storage.locks) ? this.#storage.locks.map(lock => BigInt(lock.amount)).reduce((a, b) => util.BigMath.max(a, b), BigInt("0")) : BigInt(((_this$storage$locks = this.#storage.locks) === null || _this$storage$locks === void 0 ? void 0 : _this$storage$locks.amount) || "0"));
|
559
575
|
}
|
560
576
|
/** @depreacted - use balance.locked */
|
561
577
|
get frozen() {
|
@@ -59,7 +59,7 @@ const db = new TalismanBalancesDatabase();
|
|
59
59
|
|
60
60
|
var packageJson = {
|
61
61
|
name: "@talismn/balances",
|
62
|
-
version: "0.0.0-
|
62
|
+
version: "0.0.0-pr643-20230322031130",
|
63
63
|
author: "Talisman",
|
64
64
|
homepage: "https://talisman.xyz",
|
65
65
|
license: "UNLICENSED",
|
@@ -78,7 +78,7 @@ var packageJson = {
|
|
78
78
|
"/plugins"
|
79
79
|
],
|
80
80
|
engines: {
|
81
|
-
node: ">=
|
81
|
+
node: ">=14"
|
82
82
|
},
|
83
83
|
scripts: {
|
84
84
|
test: "jest",
|
@@ -149,8 +149,9 @@ const createTypeRegistryCache = () => {
|
|
149
149
|
};
|
150
150
|
};
|
151
151
|
const filterMirrorTokens = (balance, i, balances) => {
|
152
|
+
var _balance$token;
|
152
153
|
// TODO: implement a mirrorOf property, which should be set from chaindata
|
153
|
-
const mirrorOf = balance.token
|
154
|
+
const mirrorOf = (_balance$token = balance.token) === null || _balance$token === void 0 ? void 0 : _balance$token.mirrorOf;
|
154
155
|
return !mirrorOf || !balances.find(b => b.tokenId === mirrorOf);
|
155
156
|
};
|
156
157
|
|
@@ -186,7 +187,8 @@ class StorageHelper {
|
|
186
187
|
}
|
187
188
|
}
|
188
189
|
get stateKey() {
|
189
|
-
|
190
|
+
var _this$storageKey;
|
191
|
+
return (_this$storageKey = this.#storageKey) === null || _this$storageKey === void 0 ? void 0 : _this$storageKey.toHex();
|
190
192
|
}
|
191
193
|
get module() {
|
192
194
|
return this.#module;
|
@@ -411,7 +413,10 @@ class Balances {
|
|
411
413
|
* @returns A sorted array of the balances in this collection.
|
412
414
|
*/
|
413
415
|
get sorted() {
|
414
|
-
return [...this].sort((a, b) =>
|
416
|
+
return [...this].sort((a, b) => {
|
417
|
+
var _ref, _ref2;
|
418
|
+
return (((_ref = a.chain || a.evmNetwork) === null || _ref === void 0 ? void 0 : _ref.sortIndex) ?? Number.MAX_SAFE_INTEGER) - (((_ref2 = b.chain || b.evmNetwork) === null || _ref2 === void 0 ? void 0 : _ref2.sortIndex) ?? Number.MAX_SAFE_INTEGER);
|
419
|
+
});
|
415
420
|
}
|
416
421
|
|
417
422
|
/**
|
@@ -475,7 +480,10 @@ class Balance {
|
|
475
480
|
hydrate = hydrate => {
|
476
481
|
if (hydrate !== undefined) this.#db = hydrate;
|
477
482
|
};
|
478
|
-
#format = balance =>
|
483
|
+
#format = balance => {
|
484
|
+
var _this$db;
|
485
|
+
return new BalanceFormatter(typeof balance === "bigint" ? balance.toString() : balance, this.decimals || undefined, ((_this$db = this.#db) === null || _this$db === void 0 ? void 0 : _this$db.tokenRates) && this.#db.tokenRates[this.tokenId]);
|
486
|
+
};
|
479
487
|
|
480
488
|
//
|
481
489
|
// Accessors
|
@@ -505,27 +513,32 @@ class Balance {
|
|
505
513
|
return this.#storage.chainId;
|
506
514
|
}
|
507
515
|
get chain() {
|
508
|
-
|
516
|
+
var _this$db2, _this$db3;
|
517
|
+
return ((_this$db2 = this.#db) === null || _this$db2 === void 0 ? void 0 : _this$db2.chains) && this.chainId && ((_this$db3 = this.#db) === null || _this$db3 === void 0 ? void 0 : _this$db3.chains[this.chainId]) || null;
|
509
518
|
}
|
510
519
|
get evmNetworkId() {
|
511
520
|
return this.#storage.evmNetworkId;
|
512
521
|
}
|
513
522
|
get evmNetwork() {
|
523
|
+
var _this$db4, _this$db5;
|
514
524
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
515
|
-
return this.#db
|
525
|
+
return ((_this$db4 = this.#db) === null || _this$db4 === void 0 ? void 0 : _this$db4.evmNetworks) && ((_this$db5 = this.#db) === null || _this$db5 === void 0 ? void 0 : _this$db5.evmNetworks[this.evmNetworkId]) || null;
|
516
526
|
}
|
517
527
|
get tokenId() {
|
518
528
|
return this.#storage.tokenId;
|
519
529
|
}
|
520
530
|
get token() {
|
531
|
+
var _this$db6, _this$db7;
|
521
532
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
522
|
-
return this.#db
|
533
|
+
return ((_this$db6 = this.#db) === null || _this$db6 === void 0 ? void 0 : _this$db6.tokens) && ((_this$db7 = this.#db) === null || _this$db7 === void 0 ? void 0 : _this$db7.tokens[this.tokenId]) || null;
|
523
534
|
}
|
524
535
|
get decimals() {
|
525
|
-
|
536
|
+
var _this$token;
|
537
|
+
return ((_this$token = this.token) === null || _this$token === void 0 ? void 0 : _this$token.decimals) || null;
|
526
538
|
}
|
527
539
|
get rates() {
|
528
|
-
|
540
|
+
var _this$db8;
|
541
|
+
return ((_this$db8 = this.#db) === null || _this$db8 === void 0 ? void 0 : _this$db8.tokenRates) && this.#db.tokenRates[this.tokenId] || null;
|
529
542
|
}
|
530
543
|
|
531
544
|
/**
|
@@ -539,15 +552,18 @@ class Balance {
|
|
539
552
|
}
|
540
553
|
/** The non-reserved balance of this token. Includes the frozen amount. Is included in the total. */
|
541
554
|
get free() {
|
542
|
-
|
555
|
+
var _this$storage$free;
|
556
|
+
return this.#format(typeof this.#storage.free === "string" ? BigInt(this.#storage.free) : Array.isArray(this.#storage.free) ? this.#storage.free.map(reserve => BigInt(reserve.amount)).reduce((a, b) => a + b, BigInt("0")) : BigInt(((_this$storage$free = this.#storage.free) === null || _this$storage$free === void 0 ? void 0 : _this$storage$free.amount) || "0"));
|
543
557
|
}
|
544
558
|
/** The reserved balance of this token. Is included in the total. */
|
545
559
|
get reserved() {
|
546
|
-
|
560
|
+
var _this$storage$reserve;
|
561
|
+
return this.#format(typeof this.#storage.reserves === "string" ? BigInt(this.#storage.reserves) : Array.isArray(this.#storage.reserves) ? this.#storage.reserves.map(reserve => BigInt(reserve.amount)).reduce((a, b) => a + b, BigInt("0")) : BigInt(((_this$storage$reserve = this.#storage.reserves) === null || _this$storage$reserve === void 0 ? void 0 : _this$storage$reserve.amount) || "0"));
|
547
562
|
}
|
548
563
|
/** The frozen balance of this token. Is included in the free amount. */
|
549
564
|
get locked() {
|
550
|
-
|
565
|
+
var _this$storage$locks;
|
566
|
+
return this.#format(typeof this.#storage.locks === "string" ? BigInt(this.#storage.locks) : Array.isArray(this.#storage.locks) ? this.#storage.locks.map(lock => BigInt(lock.amount)).reduce((a, b) => BigMath.max(a, b), BigInt("0")) : BigInt(((_this$storage$locks = this.#storage.locks) === null || _this$storage$locks === void 0 ? void 0 : _this$storage$locks.amount) || "0"));
|
551
567
|
}
|
552
568
|
/** @depreacted - use balance.locked */
|
553
569
|
get frozen() {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@talismn/balances",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-pr643-20230322031130",
|
4
4
|
"author": "Talisman",
|
5
5
|
"homepage": "https://talisman.xyz",
|
6
6
|
"license": "UNLICENSED",
|
@@ -19,7 +19,7 @@
|
|
19
19
|
"/plugins"
|
20
20
|
],
|
21
21
|
"engines": {
|
22
|
-
"node": ">=
|
22
|
+
"node": ">=14"
|
23
23
|
},
|
24
24
|
"scripts": {
|
25
25
|
"test": "jest",
|
@@ -27,11 +27,11 @@
|
|
27
27
|
"clean": "rm -rf dist && rm -rf .turbo rm -rf node_modules"
|
28
28
|
},
|
29
29
|
"dependencies": {
|
30
|
-
"@talismn/chain-connector": "^0.0.0-
|
31
|
-
"@talismn/chain-connector-evm": "^0.0.0-
|
32
|
-
"@talismn/chaindata-provider": "^0.0.0-
|
33
|
-
"@talismn/token-rates": "^0.0.0-
|
34
|
-
"@talismn/util": "^0.
|
30
|
+
"@talismn/chain-connector": "^0.0.0-pr643-20230322031130",
|
31
|
+
"@talismn/chain-connector-evm": "^0.0.0-pr643-20230322031130",
|
32
|
+
"@talismn/chaindata-provider": "^0.0.0-pr643-20230322031130",
|
33
|
+
"@talismn/token-rates": "^0.0.0-pr643-20230322031130",
|
34
|
+
"@talismn/util": "^0.0.0-pr643-20230322031130",
|
35
35
|
"anylogger": "^1.0.11",
|
36
36
|
"dexie": "^3.2.3"
|
37
37
|
},
|