@talismn/balances 0.0.0-pr2120-20250805025334 → 0.0.0-pr2127-20250806071759
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.
@@ -8,6 +8,10 @@ type FormattedAmount<GenericAmount extends AmountWithLabel<TLabel>, TLabel exten
|
|
8
8
|
export declare function excludeFromTransferableAmount(locks: Amount | FormattedAmount<LockedAmount<string>, string> | Array<FormattedAmount<LockedAmount<string>, string>>): bigint;
|
9
9
|
export declare function excludeFromFeePayableLocks(locks: Amount | LockedAmount<string> | Array<LockedAmount<string>>): Array<LockedAmount<string>>;
|
10
10
|
export declare function includeInTotalExtraAmount(extra?: FormattedAmount<ExtraAmount<string>, string> | Array<FormattedAmount<ExtraAmount<string>, string>>): bigint;
|
11
|
+
/**
|
12
|
+
* Have the importing library define its Token and BalanceJson enums (as a sum type of all plugins) and pass them into some
|
13
|
+
* internal global typescript context, which is then picked up on by this module.
|
14
|
+
*/
|
11
15
|
/** A utility type used to extract the underlying `BalanceType` of a specific source from a generalised `BalanceJson` */
|
12
16
|
export type NarrowBalanceType<S extends IBalance, P> = S extends {
|
13
17
|
source: P;
|
@@ -68,4 +68,8 @@ export type ExtraAmount<TLabel extends string> = BaseAmountWithLabel<TLabel> & {
|
|
68
68
|
/** If set to true, this extra amount will be included in the calculation of the total amount of this balance. */
|
69
69
|
includeInTotal?: boolean;
|
70
70
|
};
|
71
|
+
/** Used by plugins to help define their custom `BalanceType` */
|
72
|
+
export type NewBalanceType<TModuleType extends string, TBalanceValueType extends "simple" | "complex"> = IBalanceBase & (TBalanceValueType extends "simple" ? IBalanceSimpleValues : IBalanceComplexValues) & {
|
73
|
+
source: TModuleType;
|
74
|
+
};
|
71
75
|
export {};
|
@@ -1852,6 +1852,11 @@ function includeInTotalExtraAmount(extra) {
|
|
1852
1852
|
return extra.filter(extra => extra.includeInTotal).map(extra => extra.amount.planck).reduce((a, b) => a + b, 0n);
|
1853
1853
|
}
|
1854
1854
|
|
1855
|
+
/**
|
1856
|
+
* Have the importing library define its Token and BalanceJson enums (as a sum type of all plugins) and pass them into some
|
1857
|
+
* internal global typescript context, which is then picked up on by this module.
|
1858
|
+
*/
|
1859
|
+
|
1855
1860
|
/** A utility type used to extract the underlying `BalanceType` of a specific source from a generalised `BalanceJson` */
|
1856
1861
|
|
1857
1862
|
/** TODO: Remove this in favour of a frontend-friendly `ChaindataProvider` */
|
@@ -2588,6 +2593,8 @@ const getValueId = amount => {
|
|
2588
2593
|
|
2589
2594
|
/** A labelled extra amount of a balance */
|
2590
2595
|
|
2596
|
+
/** Used by plugins to help define their custom `BalanceType` */
|
2597
|
+
|
2591
2598
|
/** For fast db access, you can calculate the primary key for a miniMetadata using this method */
|
2592
2599
|
const deriveMiniMetadataId = ({
|
2593
2600
|
source,
|
@@ -1852,6 +1852,11 @@ function includeInTotalExtraAmount(extra) {
|
|
1852
1852
|
return extra.filter(extra => extra.includeInTotal).map(extra => extra.amount.planck).reduce((a, b) => a + b, 0n);
|
1853
1853
|
}
|
1854
1854
|
|
1855
|
+
/**
|
1856
|
+
* Have the importing library define its Token and BalanceJson enums (as a sum type of all plugins) and pass them into some
|
1857
|
+
* internal global typescript context, which is then picked up on by this module.
|
1858
|
+
*/
|
1859
|
+
|
1855
1860
|
/** A utility type used to extract the underlying `BalanceType` of a specific source from a generalised `BalanceJson` */
|
1856
1861
|
|
1857
1862
|
/** TODO: Remove this in favour of a frontend-friendly `ChaindataProvider` */
|
@@ -2588,6 +2593,8 @@ const getValueId = amount => {
|
|
2588
2593
|
|
2589
2594
|
/** A labelled extra amount of a balance */
|
2590
2595
|
|
2596
|
+
/** Used by plugins to help define their custom `BalanceType` */
|
2597
|
+
|
2591
2598
|
/** For fast db access, you can calculate the primary key for a miniMetadata using this method */
|
2592
2599
|
const deriveMiniMetadataId = ({
|
2593
2600
|
source,
|
@@ -1843,6 +1843,11 @@ function includeInTotalExtraAmount(extra) {
|
|
1843
1843
|
return extra.filter(extra => extra.includeInTotal).map(extra => extra.amount.planck).reduce((a, b) => a + b, 0n);
|
1844
1844
|
}
|
1845
1845
|
|
1846
|
+
/**
|
1847
|
+
* Have the importing library define its Token and BalanceJson enums (as a sum type of all plugins) and pass them into some
|
1848
|
+
* internal global typescript context, which is then picked up on by this module.
|
1849
|
+
*/
|
1850
|
+
|
1846
1851
|
/** A utility type used to extract the underlying `BalanceType` of a specific source from a generalised `BalanceJson` */
|
1847
1852
|
|
1848
1853
|
/** TODO: Remove this in favour of a frontend-friendly `ChaindataProvider` */
|
@@ -2579,6 +2584,8 @@ const getValueId = amount => {
|
|
2579
2584
|
|
2580
2585
|
/** A labelled extra amount of a balance */
|
2581
2586
|
|
2587
|
+
/** Used by plugins to help define their custom `BalanceType` */
|
2588
|
+
|
2582
2589
|
/** For fast db access, you can calculate the primary key for a miniMetadata using this method */
|
2583
2590
|
const deriveMiniMetadataId = ({
|
2584
2591
|
source,
|
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-pr2127-20250806071759",
|
4
4
|
"author": "Talisman",
|
5
5
|
"homepage": "https://talisman.xyz",
|
6
6
|
"license": "GPL-3.0-or-later",
|
@@ -34,13 +34,13 @@
|
|
34
34
|
"scale-ts": "^1.6.1",
|
35
35
|
"viem": "^2.27.3",
|
36
36
|
"zod": "^3.25.76",
|
37
|
-
"@talismn/chain-connector": "0.0.0-
|
38
|
-
"@talismn/chaindata-provider": "0.0.0-
|
37
|
+
"@talismn/chain-connector": "0.0.0-pr2127-20250806071759",
|
38
|
+
"@talismn/chaindata-provider": "0.0.0-pr2127-20250806071759",
|
39
39
|
"@talismn/sapi": "0.0.8",
|
40
|
+
"@talismn/chain-connector-evm": "0.0.0-pr2127-20250806071759",
|
40
41
|
"@talismn/scale": "0.2.0",
|
41
|
-
"@talismn/token-rates": "0.0.0-
|
42
|
-
"@talismn/
|
43
|
-
"@talismn/util": "0.0.0-pr2120-20250805025334"
|
42
|
+
"@talismn/token-rates": "0.0.0-pr2127-20250806071759",
|
43
|
+
"@talismn/util": "0.5.0"
|
44
44
|
},
|
45
45
|
"devDependencies": {
|
46
46
|
"@polkadot/api-contract": "16.1.2",
|