@talismn/balances 3.0.4 → 3.0.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/README.md +24 -101
- package/dist/index.d.mts +201 -188
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +199 -186
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2431 -2702
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2431 -2702
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -8
package/dist/index.d.ts
CHANGED
|
@@ -82,25 +82,7 @@ export type ExtraAmount<TLabel extends string> = BaseAmountWithLabel<TLabel> & {
|
|
|
82
82
|
includeInTotal?: boolean;
|
|
83
83
|
};
|
|
84
84
|
//#endregion
|
|
85
|
-
//#region src/
|
|
86
|
-
type FormattedAmount<GenericAmount extends AmountWithLabel<TLabel>, TLabel extends string> = Omit<GenericAmount, "amount"> & {
|
|
87
|
-
amount: BalanceFormatter;
|
|
88
|
-
};
|
|
89
|
-
export declare function excludeFromTransferableAmount(locks: Amount | FormattedAmount<LockedAmount<string>, string> | Array<FormattedAmount<LockedAmount<string>, string>>): bigint;
|
|
90
|
-
export declare function excludeFromFeePayableLocks(locks: Amount | LockedAmount<string> | Array<LockedAmount<string>>): Array<LockedAmount<string>>;
|
|
91
|
-
export declare function includeInTotalExtraAmount(extra?: FormattedAmount<ExtraAmount<string>, string> | Array<FormattedAmount<ExtraAmount<string>, string>>): bigint;
|
|
92
|
-
/** A utility type used to extract the underlying `BalanceType` of a specific source from a generalised `BalanceJson` */
|
|
93
|
-
export type NarrowBalanceType<S extends IBalance, P> = S extends {
|
|
94
|
-
source: P;
|
|
95
|
-
} ? S : never;
|
|
96
|
-
export type BalanceSource = BalanceJson["source"];
|
|
97
|
-
/** TODO: Remove this in favour of a frontend-friendly `ChaindataProvider` */
|
|
98
|
-
export type HydrateDb = Partial<{
|
|
99
|
-
networks: NetworkList;
|
|
100
|
-
tokens: TokenList;
|
|
101
|
-
tokenRates: TokenRatesList;
|
|
102
|
-
}>;
|
|
103
|
-
export type BalanceSearchQuery = Partial<NonFunctionProperties<Balance>> | ((balance: Balance) => boolean);
|
|
85
|
+
//#region src/classes/Balances.d.ts
|
|
104
86
|
/**
|
|
105
87
|
* A collection of balances.
|
|
106
88
|
*/
|
|
@@ -182,7 +164,6 @@ export declare class Balances {
|
|
|
182
164
|
get count(): number;
|
|
183
165
|
/**
|
|
184
166
|
* Get the summed value of balances in this collection.
|
|
185
|
-
* TODO: Sum up token amounts AND fiat amounts
|
|
186
167
|
*
|
|
187
168
|
* @example
|
|
188
169
|
* // Get the sum of all transferable balances in usd.
|
|
@@ -190,10 +171,116 @@ export declare class Balances {
|
|
|
190
171
|
*/
|
|
191
172
|
get sum(): SumBalancesFormatter;
|
|
192
173
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/classes/formatters.d.ts
|
|
176
|
+
export declare class BalanceValueGetter {
|
|
177
|
+
#private;
|
|
178
|
+
constructor(storage: BalanceJson);
|
|
179
|
+
get(valueType: BalanceStatusTypes): AmountWithLabel<string>[];
|
|
180
|
+
add(valueType: BalanceStatusTypes, amount: Omit<AmountWithLabel<string>, "type">): void;
|
|
181
|
+
}
|
|
182
|
+
export declare class BalanceFormatter {
|
|
183
|
+
#private;
|
|
184
|
+
constructor(planck: string | bigint | undefined, decimals?: number | undefined, fiatRatios?: TokenRates | null);
|
|
185
|
+
toJSON: () => string;
|
|
186
|
+
get planck(): bigint;
|
|
187
|
+
get tokens(): string;
|
|
188
|
+
fiat(currency: TokenRateCurrency): number | null;
|
|
189
|
+
}
|
|
190
|
+
export declare class PlanckSumBalancesFormatter {
|
|
191
|
+
#private;
|
|
192
|
+
constructor(balances: Balances);
|
|
193
|
+
/**
|
|
194
|
+
* The total balance of these tokens. Includes the free and the reserved amount.
|
|
195
|
+
*/
|
|
196
|
+
get total(): bigint;
|
|
197
|
+
/** The non-reserved balance of these tokens. Includes the frozen amount. Is included in the total. */
|
|
198
|
+
get free(): bigint;
|
|
199
|
+
/** The reserved balance of these tokens. Is included in the total. */
|
|
200
|
+
get reserved(): bigint;
|
|
201
|
+
/** The frozen balance of these tokens. Is included in the free amount. */
|
|
202
|
+
get locked(): bigint;
|
|
203
|
+
/** @deprecated Use balances.locked */
|
|
204
|
+
get frozen(): bigint;
|
|
205
|
+
/** The transferable balance of these tokens. Is generally the free amount - the miscFrozen amount. */
|
|
206
|
+
get transferable(): bigint;
|
|
207
|
+
/** The unavailable balance of these tokens. */
|
|
208
|
+
get unavailable(): bigint;
|
|
209
|
+
/** The feePayable balance of these tokens. Is generally the free amount - the feeFrozen amount. */
|
|
210
|
+
get feePayable(): bigint;
|
|
211
|
+
}
|
|
212
|
+
export declare class FiatSumBalancesFormatter {
|
|
213
|
+
#private;
|
|
214
|
+
constructor(balances: Balances, currency: TokenRateCurrency);
|
|
215
|
+
/**
|
|
216
|
+
* The total balance of these tokens. Includes the free and the reserved amount.
|
|
217
|
+
*/
|
|
218
|
+
get total(): number;
|
|
219
|
+
/** The non-reserved balance of these tokens. Includes the frozen amount. Is included in the total. */
|
|
220
|
+
get free(): number;
|
|
221
|
+
/** The reserved balance of these tokens. Is included in the total. */
|
|
222
|
+
get reserved(): number;
|
|
223
|
+
/** The frozen balance of these tokens. Is included in the free amount. */
|
|
224
|
+
get locked(): number;
|
|
225
|
+
/** @deprecated Use balances.locked */
|
|
226
|
+
get frozen(): number;
|
|
227
|
+
/** The transferable balance of these tokens. Is generally the free amount - the miscFrozen amount. */
|
|
228
|
+
get transferable(): number;
|
|
229
|
+
/** The unavailable balance of these tokens. */
|
|
230
|
+
get unavailable(): number;
|
|
231
|
+
/** The feePayable balance of these tokens. Is generally the free amount - the feeFrozen amount. */
|
|
232
|
+
get feePayable(): number;
|
|
233
|
+
}
|
|
234
|
+
export declare class SumBalancesFormatter {
|
|
235
|
+
#private;
|
|
236
|
+
constructor(balances: Balances);
|
|
237
|
+
get planck(): PlanckSumBalancesFormatter;
|
|
238
|
+
fiat(currency: TokenRateCurrency): FiatSumBalancesFormatter;
|
|
239
|
+
change24h(currency: TokenRateCurrency): Change24hCurrencyFormatter;
|
|
240
|
+
}
|
|
241
|
+
export declare class Change24hCurrencyFormatter {
|
|
242
|
+
#private;
|
|
243
|
+
constructor(balances: Balances, currency: TokenRateCurrency);
|
|
244
|
+
get total(): {
|
|
245
|
+
diff: number;
|
|
246
|
+
ratio: number;
|
|
247
|
+
} | null;
|
|
248
|
+
get free(): {
|
|
249
|
+
diff: number;
|
|
250
|
+
ratio: number;
|
|
251
|
+
} | null;
|
|
252
|
+
get reserved(): {
|
|
253
|
+
diff: number;
|
|
254
|
+
ratio: number;
|
|
255
|
+
} | null;
|
|
256
|
+
get locked(): {
|
|
257
|
+
diff: number;
|
|
258
|
+
ratio: number;
|
|
259
|
+
} | null;
|
|
260
|
+
get frozen(): {
|
|
261
|
+
diff: number;
|
|
262
|
+
ratio: number;
|
|
263
|
+
} | null;
|
|
264
|
+
get transferable(): {
|
|
265
|
+
diff: number;
|
|
266
|
+
ratio: number;
|
|
267
|
+
} | null;
|
|
268
|
+
get unavailable(): {
|
|
269
|
+
diff: number;
|
|
270
|
+
ratio: number;
|
|
271
|
+
} | null;
|
|
272
|
+
get feePayable(): {
|
|
273
|
+
diff: number;
|
|
274
|
+
ratio: number;
|
|
275
|
+
} | null;
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/classes/FormattedAmount.d.ts
|
|
279
|
+
type FormattedAmount<GenericAmount extends AmountWithLabel<TLabel>, TLabel extends string> = Omit<GenericAmount, "amount"> & {
|
|
280
|
+
amount: BalanceFormatter;
|
|
281
|
+
};
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region src/classes/Balance.d.ts
|
|
197
284
|
export declare class Balance {
|
|
198
285
|
#private;
|
|
199
286
|
constructor(storage: BalanceJson | IBalance, hydrate?: HydrateDb);
|
|
@@ -328,20 +415,6 @@ export declare class Balance {
|
|
|
328
415
|
} | null;
|
|
329
416
|
get tokenId(): string;
|
|
330
417
|
get token(): {
|
|
331
|
-
id: string;
|
|
332
|
-
networkId: string;
|
|
333
|
-
isDefault?: boolean | undefined;
|
|
334
|
-
decimals: number;
|
|
335
|
-
symbol: string;
|
|
336
|
-
name?: string | undefined;
|
|
337
|
-
logo?: string | undefined;
|
|
338
|
-
coingeckoId?: string | undefined;
|
|
339
|
-
noDiscovery?: boolean | undefined;
|
|
340
|
-
mirrorOf?: string | undefined;
|
|
341
|
-
type: "sol-spl";
|
|
342
|
-
platform: "solana";
|
|
343
|
-
mintAddress: string;
|
|
344
|
-
} | {
|
|
345
418
|
id: string;
|
|
346
419
|
networkId: string;
|
|
347
420
|
isDefault?: boolean | undefined;
|
|
@@ -366,8 +439,12 @@ export declare class Balance {
|
|
|
366
439
|
coingeckoId?: string | undefined;
|
|
367
440
|
noDiscovery?: boolean | undefined;
|
|
368
441
|
mirrorOf?: string | undefined;
|
|
369
|
-
type: "
|
|
370
|
-
platform: "
|
|
442
|
+
type: "substrate-hydration";
|
|
443
|
+
platform: "polkadot";
|
|
444
|
+
onChainId: number;
|
|
445
|
+
assetType: "Erc20" | "External" | "Token";
|
|
446
|
+
isSufficient: boolean;
|
|
447
|
+
existentialDeposit: string;
|
|
371
448
|
} | {
|
|
372
449
|
id: string;
|
|
373
450
|
networkId: string;
|
|
@@ -396,10 +473,18 @@ export declare class Balance {
|
|
|
396
473
|
coingeckoId?: string | undefined;
|
|
397
474
|
noDiscovery?: boolean | undefined;
|
|
398
475
|
mirrorOf?: string | undefined;
|
|
399
|
-
type: "
|
|
400
|
-
platform: "
|
|
401
|
-
|
|
402
|
-
|
|
476
|
+
type: "evm-uniswapv2";
|
|
477
|
+
platform: "ethereum";
|
|
478
|
+
contractAddress: `0x${string}`;
|
|
479
|
+
isCustom?: boolean | undefined;
|
|
480
|
+
symbol0: string;
|
|
481
|
+
symbol1: string;
|
|
482
|
+
decimals0: number;
|
|
483
|
+
decimals1: number;
|
|
484
|
+
tokenAddress0: `0x${string}`;
|
|
485
|
+
tokenAddress1: `0x${string}`;
|
|
486
|
+
coingeckoId0?: string | undefined;
|
|
487
|
+
coingeckoId1?: string | undefined;
|
|
403
488
|
} | {
|
|
404
489
|
id: string;
|
|
405
490
|
networkId: string;
|
|
@@ -411,9 +496,8 @@ export declare class Balance {
|
|
|
411
496
|
coingeckoId?: string | undefined;
|
|
412
497
|
noDiscovery?: boolean | undefined;
|
|
413
498
|
mirrorOf?: string | undefined;
|
|
414
|
-
type: "
|
|
415
|
-
platform: "
|
|
416
|
-
contractAddress: string;
|
|
499
|
+
type: "evm-native";
|
|
500
|
+
platform: "ethereum";
|
|
417
501
|
} | {
|
|
418
502
|
id: string;
|
|
419
503
|
networkId: string;
|
|
@@ -442,10 +526,12 @@ export declare class Balance {
|
|
|
442
526
|
coingeckoId?: string | undefined;
|
|
443
527
|
noDiscovery?: boolean | undefined;
|
|
444
528
|
mirrorOf?: string | undefined;
|
|
445
|
-
type: "substrate-
|
|
529
|
+
type: "substrate-dtao";
|
|
446
530
|
platform: "polkadot";
|
|
447
|
-
|
|
448
|
-
|
|
531
|
+
netuid: number;
|
|
532
|
+
subnetName?: string | undefined;
|
|
533
|
+
hotkey?: string | undefined;
|
|
534
|
+
isTransferable: boolean;
|
|
449
535
|
} | {
|
|
450
536
|
id: string;
|
|
451
537
|
networkId: string;
|
|
@@ -457,11 +543,8 @@ export declare class Balance {
|
|
|
457
543
|
coingeckoId?: string | undefined;
|
|
458
544
|
noDiscovery?: boolean | undefined;
|
|
459
545
|
mirrorOf?: string | undefined;
|
|
460
|
-
type: "substrate-
|
|
546
|
+
type: "substrate-native";
|
|
461
547
|
platform: "polkadot";
|
|
462
|
-
onChainId: number;
|
|
463
|
-
assetType: "Erc20" | "External" | "Token";
|
|
464
|
-
isSufficient: boolean;
|
|
465
548
|
existentialDeposit: string;
|
|
466
549
|
} | {
|
|
467
550
|
id: string;
|
|
@@ -474,18 +557,9 @@ export declare class Balance {
|
|
|
474
557
|
coingeckoId?: string | undefined;
|
|
475
558
|
noDiscovery?: boolean | undefined;
|
|
476
559
|
mirrorOf?: string | undefined;
|
|
477
|
-
type: "
|
|
478
|
-
platform: "
|
|
479
|
-
contractAddress:
|
|
480
|
-
isCustom?: boolean | undefined;
|
|
481
|
-
symbol0: string;
|
|
482
|
-
symbol1: string;
|
|
483
|
-
decimals0: number;
|
|
484
|
-
decimals1: number;
|
|
485
|
-
tokenAddress0: `0x${string}`;
|
|
486
|
-
tokenAddress1: `0x${string}`;
|
|
487
|
-
coingeckoId0?: string | undefined;
|
|
488
|
-
coingeckoId1?: string | undefined;
|
|
560
|
+
type: "substrate-psp22";
|
|
561
|
+
platform: "polkadot";
|
|
562
|
+
contractAddress: string;
|
|
489
563
|
} | {
|
|
490
564
|
id: string;
|
|
491
565
|
networkId: string;
|
|
@@ -497,12 +571,10 @@ export declare class Balance {
|
|
|
497
571
|
coingeckoId?: string | undefined;
|
|
498
572
|
noDiscovery?: boolean | undefined;
|
|
499
573
|
mirrorOf?: string | undefined;
|
|
500
|
-
type: "substrate-
|
|
574
|
+
type: "substrate-tokens";
|
|
501
575
|
platform: "polkadot";
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
hotkey?: string | undefined;
|
|
505
|
-
isTransferable: boolean;
|
|
576
|
+
onChainId: string | number;
|
|
577
|
+
existentialDeposit: string;
|
|
506
578
|
} | {
|
|
507
579
|
id: string;
|
|
508
580
|
networkId: string;
|
|
@@ -514,9 +586,8 @@ export declare class Balance {
|
|
|
514
586
|
coingeckoId?: string | undefined;
|
|
515
587
|
noDiscovery?: boolean | undefined;
|
|
516
588
|
mirrorOf?: string | undefined;
|
|
517
|
-
type: "
|
|
518
|
-
platform: "
|
|
519
|
-
existentialDeposit: string;
|
|
589
|
+
type: "sol-native";
|
|
590
|
+
platform: "solana";
|
|
520
591
|
} | {
|
|
521
592
|
id: string;
|
|
522
593
|
networkId: string;
|
|
@@ -528,8 +599,24 @@ export declare class Balance {
|
|
|
528
599
|
coingeckoId?: string | undefined;
|
|
529
600
|
noDiscovery?: boolean | undefined;
|
|
530
601
|
mirrorOf?: string | undefined;
|
|
531
|
-
type: "sol-
|
|
602
|
+
type: "sol-spl";
|
|
532
603
|
platform: "solana";
|
|
604
|
+
mintAddress: string;
|
|
605
|
+
} | {
|
|
606
|
+
id: string;
|
|
607
|
+
networkId: string;
|
|
608
|
+
isDefault?: boolean | undefined;
|
|
609
|
+
decimals: number;
|
|
610
|
+
symbol: string;
|
|
611
|
+
name?: string | undefined;
|
|
612
|
+
logo?: string | undefined;
|
|
613
|
+
coingeckoId?: string | undefined;
|
|
614
|
+
noDiscovery?: boolean | undefined;
|
|
615
|
+
mirrorOf?: string | undefined;
|
|
616
|
+
type: "sol-token2022";
|
|
617
|
+
platform: "solana";
|
|
618
|
+
mintAddress: string;
|
|
619
|
+
isTransferable?: boolean | undefined;
|
|
533
620
|
} | null;
|
|
534
621
|
get decimals(): number | null;
|
|
535
622
|
get rates(): TokenRates | null;
|
|
@@ -581,117 +668,20 @@ export declare class Balance {
|
|
|
581
668
|
/** The feePayable balance of this token. Is generally the free amount - the feeFrozen amount. */
|
|
582
669
|
get feePayable(): BalanceFormatter;
|
|
583
670
|
}
|
|
584
|
-
/** raw
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
*/
|
|
592
|
-
export
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
}
|
|
599
|
-
export declare class BalanceFormatter {
|
|
600
|
-
#private;
|
|
601
|
-
constructor(planck: string | bigint | undefined, decimals?: number | undefined, fiatRatios?: TokenRates | null);
|
|
602
|
-
toJSON: () => string;
|
|
603
|
-
get planck(): bigint;
|
|
604
|
-
get tokens(): string;
|
|
605
|
-
fiat(currency: TokenRateCurrency): number | null;
|
|
606
|
-
}
|
|
607
|
-
export declare class PlanckSumBalancesFormatter {
|
|
608
|
-
#private;
|
|
609
|
-
constructor(balances: Balances);
|
|
610
|
-
/**
|
|
611
|
-
* The total balance of these tokens. Includes the free and the reserved amount.
|
|
612
|
-
*/
|
|
613
|
-
get total(): bigint;
|
|
614
|
-
/** The non-reserved balance of these tokens. Includes the frozen amount. Is included in the total. */
|
|
615
|
-
get free(): bigint;
|
|
616
|
-
/** The reserved balance of these tokens. Is included in the total. */
|
|
617
|
-
get reserved(): bigint;
|
|
618
|
-
/** The frozen balance of these tokens. Is included in the free amount. */
|
|
619
|
-
get locked(): bigint;
|
|
620
|
-
/** @deprecated Use balances.locked */
|
|
621
|
-
get frozen(): bigint;
|
|
622
|
-
/** The transferable balance of these tokens. Is generally the free amount - the miscFrozen amount. */
|
|
623
|
-
get transferable(): bigint;
|
|
624
|
-
/** The unavailable balance of these tokens. */
|
|
625
|
-
get unavailable(): bigint;
|
|
626
|
-
/** The feePayable balance of these tokens. Is generally the free amount - the feeFrozen amount. */
|
|
627
|
-
get feePayable(): bigint;
|
|
628
|
-
}
|
|
629
|
-
export declare class FiatSumBalancesFormatter {
|
|
630
|
-
#private;
|
|
631
|
-
constructor(balances: Balances, currency: TokenRateCurrency);
|
|
632
|
-
/**
|
|
633
|
-
* The total balance of these tokens. Includes the free and the reserved amount.
|
|
634
|
-
*/
|
|
635
|
-
get total(): number;
|
|
636
|
-
/** The non-reserved balance of these tokens. Includes the frozen amount. Is included in the total. */
|
|
637
|
-
get free(): number;
|
|
638
|
-
/** The reserved balance of these tokens. Is included in the total. */
|
|
639
|
-
get reserved(): number;
|
|
640
|
-
/** The frozen balance of these tokens. Is included in the free amount. */
|
|
641
|
-
get locked(): number;
|
|
642
|
-
/** @deprecated Use balances.locked */
|
|
643
|
-
get frozen(): number;
|
|
644
|
-
/** The transferable balance of these tokens. Is generally the free amount - the miscFrozen amount. */
|
|
645
|
-
get transferable(): number;
|
|
646
|
-
/** The unavailable balance of these tokens. */
|
|
647
|
-
get unavailable(): number;
|
|
648
|
-
/** The feePayable balance of these tokens. Is generally the free amount - the feeFrozen amount. */
|
|
649
|
-
get feePayable(): number;
|
|
650
|
-
}
|
|
651
|
-
export declare class SumBalancesFormatter {
|
|
652
|
-
#private;
|
|
653
|
-
constructor(balances: Balances);
|
|
654
|
-
get planck(): PlanckSumBalancesFormatter;
|
|
655
|
-
fiat(currency: TokenRateCurrency): FiatSumBalancesFormatter;
|
|
656
|
-
change24h(currency: TokenRateCurrency): Change24hCurrencyFormatter;
|
|
657
|
-
}
|
|
658
|
-
export declare class Change24hCurrencyFormatter {
|
|
659
|
-
#private;
|
|
660
|
-
constructor(balances: Balances, currency: TokenRateCurrency);
|
|
661
|
-
get total(): {
|
|
662
|
-
diff: number;
|
|
663
|
-
ratio: number;
|
|
664
|
-
} | null;
|
|
665
|
-
get free(): {
|
|
666
|
-
diff: number;
|
|
667
|
-
ratio: number;
|
|
668
|
-
} | null;
|
|
669
|
-
get reserved(): {
|
|
670
|
-
diff: number;
|
|
671
|
-
ratio: number;
|
|
672
|
-
} | null;
|
|
673
|
-
get locked(): {
|
|
674
|
-
diff: number;
|
|
675
|
-
ratio: number;
|
|
676
|
-
} | null;
|
|
677
|
-
get frozen(): {
|
|
678
|
-
diff: number;
|
|
679
|
-
ratio: number;
|
|
680
|
-
} | null;
|
|
681
|
-
get transferable(): {
|
|
682
|
-
diff: number;
|
|
683
|
-
ratio: number;
|
|
684
|
-
} | null;
|
|
685
|
-
get unavailable(): {
|
|
686
|
-
diff: number;
|
|
687
|
-
ratio: number;
|
|
688
|
-
} | null;
|
|
689
|
-
get feePayable(): {
|
|
690
|
-
diff: number;
|
|
691
|
-
ratio: number;
|
|
692
|
-
} | null;
|
|
693
|
-
}
|
|
694
|
-
export declare const filterMirrorTokens: (balance: Balance, _i: number, balances: Balance[]) => boolean;
|
|
671
|
+
/** raw values of a given type, straight from the IBalance JSON (no Balance/formatter allocation) */
|
|
672
|
+
//#endregion
|
|
673
|
+
//#region src/types/balances.d.ts
|
|
674
|
+
export type NarrowBalanceType<S extends IBalance, P> = S extends {
|
|
675
|
+
source: P;
|
|
676
|
+
} ? S : never;
|
|
677
|
+
export type BalanceSource = BalanceJson["source"];
|
|
678
|
+
/** TODO: Remove this in favour of a frontend-friendly `ChaindataProvider` */
|
|
679
|
+
export type HydrateDb = Partial<{
|
|
680
|
+
networks: NetworkList;
|
|
681
|
+
tokens: TokenList;
|
|
682
|
+
tokenRates: TokenRatesList;
|
|
683
|
+
}>;
|
|
684
|
+
export type BalanceSearchQuery = Partial<NonFunctionProperties<Balance>> | ((balance: Balance) => boolean);
|
|
695
685
|
//#endregion
|
|
696
686
|
//#region src/types/chainConnectors.d.ts
|
|
697
687
|
export type ChainConnectors = {
|
|
@@ -877,6 +867,28 @@ export declare class BalancesProvider {
|
|
|
877
867
|
}
|
|
878
868
|
export declare const getSweepStaleVariant: (balance: IBalance) => IBalance;
|
|
879
869
|
//#endregion
|
|
870
|
+
//#region src/classes/helpers.d.ts
|
|
871
|
+
export declare function excludeFromTransferableAmount(locks: Amount | FormattedAmount<LockedAmount<string>, string> | Array<FormattedAmount<LockedAmount<string>, string>>): bigint;
|
|
872
|
+
export declare function excludeFromFeePayableLocks(locks: Amount | LockedAmount<string> | Array<LockedAmount<string>>): Array<LockedAmount<string>>;
|
|
873
|
+
export declare function includeInTotalExtraAmount(extra?: FormattedAmount<ExtraAmount<string>, string> | Array<FormattedAmount<ExtraAmount<string>, string>>): bigint;
|
|
874
|
+
/** A utility type used to extract the underlying `BalanceType` of a specific source from a generalised `BalanceJson` */
|
|
875
|
+
export declare const getBalanceId: (balance: Pick<IBalance, "address" | "tokenId">) => string;
|
|
876
|
+
/**
|
|
877
|
+
* An individual balance.
|
|
878
|
+
*/
|
|
879
|
+
export declare const filterMirrorTokens: (balance: Balance, _i: number, balances: Balance[]) => boolean;
|
|
880
|
+
//#endregion
|
|
881
|
+
//#region src/classes/rawBalance.d.ts
|
|
882
|
+
/** raw "locked" values, straight from the IBalance JSON (see getRawTotalPlanck) */
|
|
883
|
+
export declare const getRawLocks: (balance: IBalance) => AmountWithLabel<string>[];
|
|
884
|
+
/**
|
|
885
|
+
* Computes `new Balance(b).total.planck` without constructing a Balance (which allocates
|
|
886
|
+
* several BalanceFormatters per access) — used for high-frequency zero-balance filtering.
|
|
887
|
+
* MUST mirror Balance.total exactly, including the DelegatedStaking-hold/nompool rule
|
|
888
|
+
* (guarded by a parity test in balance-raw-helpers.test.ts).
|
|
889
|
+
*/
|
|
890
|
+
export declare const getRawTotalPlanck: (balance: IBalance) => bigint;
|
|
891
|
+
//#endregion
|
|
880
892
|
//#region src/modules/abis/erc20BalancesAggregator.d.ts
|
|
881
893
|
export declare const erc20BalancesAggregatorAbi: readonly [{
|
|
882
894
|
readonly name: "balances";
|
|
@@ -23605,6 +23617,7 @@ export declare const BALANCE_MODULES: (IBalanceModule<"evm-erc20", {
|
|
|
23605
23617
|
}, {
|
|
23606
23618
|
palletId: string;
|
|
23607
23619
|
}>)[];
|
|
23620
|
+
/** @deprecated unused */
|
|
23608
23621
|
export type AnyBalanceModule = (typeof BALANCE_MODULES)[number];
|
|
23609
23622
|
//#endregion
|
|
23610
23623
|
export { type DTaoClaimTarget, type DTaoConvictionLockInfo, MINIMETADATA_VERSION };
|