@talismn/balances 0.1.1 → 0.1.3

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,5 +1,24 @@
1
1
  # @talismn/balances
2
2
 
3
+ ## 0.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 5af305c: switched build output from esm to commonjs for ecosystem compatibility
8
+ - Updated dependencies [5af305c]
9
+ - @talismn/chain-connector@0.1.2
10
+ - @talismn/chaindata-provider@0.1.2
11
+ - @talismn/token-rates@0.1.2
12
+ - @talismn/util@0.1.3
13
+
14
+ ## 0.1.2
15
+
16
+ ### Patch Changes
17
+
18
+ - 2ccd51b: feat: implemented @talismn/balances-substrate-native
19
+ - Updated dependencies [2ccd51b]
20
+ - @talismn/util@0.1.2
21
+
3
22
  ## 0.1.1
4
23
 
5
24
  ### Patch Changes
@@ -11,15 +11,15 @@ export declare type ExtendableModuleConfig = Record<string, unknown> | undefined
11
11
  export declare type DefaultModuleConfig = undefined;
12
12
  interface BalanceModuleSubstrate<TModuleType extends string, TTokenType extends ExtendableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig> extends BalanceModuleCommon<TModuleType, TTokenType, TChainMeta, TModuleConfig> {
13
13
  /** Pre-processes any substrate chain metadata required by this module ahead of time */
14
- fetchSubstrateChainMeta(chainConnector: ChainConnector, chainId: ChainId): Promise<TChainMeta | null>;
14
+ fetchSubstrateChainMeta(chainConnector: ChainConnector, chaindataProvider: ChaindataProvider, chainId: ChainId): Promise<TChainMeta | null>;
15
15
  /** Detects which tokens are available on a given substrate chain */
16
- fetchSubstrateChainTokens(chainConnector: ChainConnector, chainId: ChainId, chainMeta: TChainMeta): Promise<Record<TTokenType["id"], TTokenType>>;
16
+ fetchSubstrateChainTokens(chainConnector: ChainConnector, chaindataProvider: ChaindataProvider, chainId: ChainId, chainMeta: TChainMeta): Promise<Record<TTokenType["id"], TTokenType>>;
17
17
  }
18
18
  interface BalanceModuleEvm<TModuleType extends string, TTokenType extends ExtendableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig> extends BalanceModuleCommon<TModuleType, TTokenType, TChainMeta, TModuleConfig> {
19
19
  /** Pre-processes any evm chain metadata required by this module ahead of time */
20
- fetchEvmChainMeta(chainConnector: ChainConnector, chainId: ChainId): Promise<TChainMeta | null>;
20
+ fetchEvmChainMeta(chainConnector: ChainConnector, chaindataProvider: ChaindataProvider, chainId: ChainId): Promise<TChainMeta | null>;
21
21
  /** Detects which tokens are available on a given evm chain */
22
- fetchEvmChainTokens(chainConnector: ChainConnector, chainId: ChainId, chainMeta: TChainMeta): Promise<Record<TTokenType["id"], TTokenType>>;
22
+ fetchEvmChainTokens(chainConnector: ChainConnector, chaindataProvider: ChaindataProvider, chainId: ChainId, chainMeta: TChainMeta): Promise<Record<TTokenType["id"], TTokenType>>;
23
23
  }
24
24
  interface BalanceModuleCommon<TModuleType extends string, TTokenType extends ExtendableTokenType, TChainMeta extends ExtendableChainMeta = DefaultChainMeta, TModuleConfig extends ExtendableModuleConfig = DefaultModuleConfig> {
25
25
  get type(): TModuleType;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -7,8 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
9
  });
9
10
  };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DefaultBalanceModule = void 0;
10
13
  // TODO: Document default balances module purpose/usage
11
- export const DefaultBalanceModule = (type) => ({
14
+ const DefaultBalanceModule = (type) => ({
12
15
  get type() {
13
16
  return type;
14
17
  },
@@ -22,12 +25,12 @@ export const DefaultBalanceModule = (type) => ({
22
25
  return null;
23
26
  });
24
27
  },
25
- fetchSubstrateChainTokens(chainConnector, chainId, chainMeta) {
28
+ fetchSubstrateChainTokens() {
26
29
  return __awaiter(this, void 0, void 0, function* () {
27
30
  return Promise.resolve({});
28
31
  });
29
32
  },
30
- fetchEvmChainTokens(chainConnector, chainId, chainMeta) {
33
+ fetchEvmChainTokens() {
31
34
  return __awaiter(this, void 0, void 0, function* () {
32
35
  return Promise.resolve({});
33
36
  });
@@ -44,3 +47,4 @@ export const DefaultBalanceModule = (type) => ({
44
47
  });
45
48
  },
46
49
  });
50
+ exports.DefaultBalanceModule = DefaultBalanceModule;
package/dist/helpers.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -7,7 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
9
  });
9
10
  };
10
- export function balances(balanceModule, chainConnector, chaindataProvider, addressesByToken, callback) {
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.balances = void 0;
13
+ function balances(balanceModule, chainConnector, chaindataProvider, addressesByToken, callback) {
11
14
  return __awaiter(this, void 0, void 0, function* () {
12
15
  // subscription request
13
16
  if (callback !== undefined)
@@ -16,3 +19,4 @@ export function balances(balanceModule, chainConnector, chaindataProvider, addre
16
19
  return yield balanceModule.fetchBalances(chainConnector, chaindataProvider, addressesByToken);
17
20
  });
18
21
  }
22
+ exports.balances = balances;
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  //
2
3
  // NOTE: Do not export `./plugins` from here!
3
4
  // Doing so will introduce a circular dependency!
@@ -9,6 +10,21 @@
9
10
  //
10
11
  // import { PluginBalanceTypes } from '@talismn/balances'
11
12
  //
12
- export * from "./BalanceModule";
13
- export * from "./helpers";
14
- export * from "./types";
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ __exportStar(require("./BalanceModule"), exports);
29
+ __exportStar(require("./helpers"), exports);
30
+ __exportStar(require("./types"), exports);
package/dist/plugins.js CHANGED
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
3
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
4
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -15,15 +16,20 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
16
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
16
17
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
17
18
  };
19
+ var __importDefault = (this && this.__importDefault) || function (mod) {
20
+ return (mod && mod.__esModule) ? mod : { "default": mod };
21
+ };
18
22
  var _Balances_balances, _a, _Balance_storage, _Balance_db, _Balance_format, _BalanceFormatter_planck, _BalanceFormatter_decimals, _BalanceFormatter_fiatRatios, _FiatSumBalancesFormatter_balances, _FiatSumBalancesFormatter_currency, _FiatSumBalancesFormatter_sum, _SumBalancesFormatter_balances;
19
- import { BigMath, isArrayOf, planckToTokens } from "@talismn/util";
20
- import memoize from "lodash/memoize";
21
- import { Memoize } from "typescript-memoize";
22
- import { excludeFromFeePayableLocks, excludeFromTransferableAmount, includeInTotalExtraAmount, } from "./balancetypes";
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.SumBalancesFormatter = exports.FiatSumBalancesFormatter = exports.BalanceFormatter = exports.Balance = exports.Balances = void 0;
25
+ const util_1 = require("@talismn/util");
26
+ const memoize_1 = __importDefault(require("lodash/memoize"));
27
+ const typescript_memoize_1 = require("typescript-memoize");
28
+ const balancetypes_1 = require("./balancetypes");
23
29
  /**
24
30
  * A collection of balances.
25
31
  */
26
- export class Balances {
32
+ class Balances {
27
33
  //
28
34
  // Methods
29
35
  //
@@ -135,7 +141,7 @@ export class Balances {
135
141
  if (balances.length === 0)
136
142
  return this;
137
143
  // handle BalanceJson[]
138
- if (!isArrayOf(balances, Balance))
144
+ if (!(0, util_1.isArrayOf)(balances, Balance))
139
145
  return new Balances(balances.map((storage) => new Balance(storage)), hydrate);
140
146
  // handle Balance[]
141
147
  __classPrivateFieldSet(this, _Balances_balances, Object.fromEntries(balances.map((balance) => [balance.id, balance])), "f");
@@ -176,18 +182,19 @@ export class Balances {
176
182
  }
177
183
  _Balances_balances = new WeakMap(), _a = Symbol.iterator;
178
184
  __decorate([
179
- Memoize()
185
+ (0, typescript_memoize_1.Memoize)()
180
186
  ], Balances.prototype, "sorted", null);
181
187
  __decorate([
182
- Memoize()
188
+ (0, typescript_memoize_1.Memoize)()
183
189
  ], Balances.prototype, "count", null);
184
190
  __decorate([
185
- Memoize()
191
+ (0, typescript_memoize_1.Memoize)()
186
192
  ], Balances.prototype, "sum", null);
193
+ exports.Balances = Balances;
187
194
  /**
188
195
  * An individual balance.
189
196
  */
190
- export class Balance {
197
+ class Balance {
191
198
  //
192
199
  // Methods
193
200
  //
@@ -229,7 +236,7 @@ export class Balance {
229
236
  // Accessors
230
237
  //
231
238
  );
232
- __classPrivateFieldSet(this, _Balance_format, memoize(__classPrivateFieldGet(this, _Balance_format, "f")), "f");
239
+ __classPrivateFieldSet(this, _Balance_format, (0, memoize_1.default)(__classPrivateFieldGet(this, _Balance_format, "f")), "f");
233
240
  __classPrivateFieldSet(this, _Balance_storage, storage, "f");
234
241
  if (hydrate !== undefined)
235
242
  this.hydrate(hydrate);
@@ -284,7 +291,7 @@ export class Balance {
284
291
  * The balance will be reaped if this goes below the existential deposit.
285
292
  */
286
293
  get total() {
287
- const extra = includeInTotalExtraAmount(__classPrivateFieldGet(this, _Balance_storage, "f").extra);
294
+ const extra = (0, balancetypes_1.includeInTotalExtraAmount)(__classPrivateFieldGet(this, _Balance_storage, "f").extra);
288
295
  return __classPrivateFieldGet(this, _Balance_format, "f").call(this, this.free.planck + this.reserved.planck + extra);
289
296
  }
290
297
  /** The non-reserved balance of this token. Includes the frozen amount. Is included in the total. */
@@ -317,7 +324,7 @@ export class Balance {
317
324
  : Array.isArray(__classPrivateFieldGet(this, _Balance_storage, "f").locks)
318
325
  ? __classPrivateFieldGet(this, _Balance_storage, "f").locks
319
326
  .map((lock) => BigInt(lock.amount))
320
- .reduce((a, b) => BigMath.max(a, b), BigInt("0"))
327
+ .reduce((a, b) => util_1.BigMath.max(a, b), BigInt("0"))
321
328
  : BigInt(((_b = __classPrivateFieldGet(this, _Balance_storage, "f").locks) === null || _b === void 0 ? void 0 : _b.amount) || "0"));
322
329
  }
323
330
  /** @depreacted - use balance.locked */
@@ -330,9 +337,9 @@ export class Balance {
330
337
  if (!__classPrivateFieldGet(this, _Balance_storage, "f").locks)
331
338
  return this.free;
332
339
  // find the largest lock (but ignore any locks which are marked as `includeInTransferable`)
333
- const excludeAmount = excludeFromTransferableAmount(__classPrivateFieldGet(this, _Balance_storage, "f").locks);
340
+ const excludeAmount = (0, balancetypes_1.excludeFromTransferableAmount)(__classPrivateFieldGet(this, _Balance_storage, "f").locks);
334
341
  // subtract the lock from the free amount (but don't go below 0)
335
- return __classPrivateFieldGet(this, _Balance_format, "f").call(this, BigMath.max(this.free.planck - excludeAmount, BigInt("0")));
342
+ return __classPrivateFieldGet(this, _Balance_format, "f").call(this, util_1.BigMath.max(this.free.planck - excludeAmount, BigInt("0")));
336
343
  }
337
344
  /** The feePayable balance of this token. Is generally the free amount - the feeFrozen amount. */
338
345
  get feePayable() {
@@ -340,36 +347,37 @@ export class Balance {
340
347
  if (!__classPrivateFieldGet(this, _Balance_storage, "f").locks)
341
348
  return this.free;
342
349
  // find the largest lock which can't be used to pay tx fees
343
- const excludeAmount = excludeFromFeePayableLocks(__classPrivateFieldGet(this, _Balance_storage, "f").locks)
350
+ const excludeAmount = (0, balancetypes_1.excludeFromFeePayableLocks)(__classPrivateFieldGet(this, _Balance_storage, "f").locks)
344
351
  .map((lock) => BigInt(lock.amount))
345
- .reduce((max, lock) => BigMath.max(max, lock), BigInt("0"));
352
+ .reduce((max, lock) => util_1.BigMath.max(max, lock), BigInt("0"));
346
353
  // subtract the lock from the free amount (but don't go below 0)
347
- return __classPrivateFieldGet(this, _Balance_format, "f").call(this, BigMath.max(this.free.planck - excludeAmount, BigInt("0")));
354
+ return __classPrivateFieldGet(this, _Balance_format, "f").call(this, util_1.BigMath.max(this.free.planck - excludeAmount, BigInt("0")));
348
355
  }
349
356
  }
350
357
  _Balance_storage = new WeakMap(), _Balance_db = new WeakMap(), _Balance_format = new WeakMap();
351
358
  __decorate([
352
- Memoize()
359
+ (0, typescript_memoize_1.Memoize)()
353
360
  ], Balance.prototype, "total", null);
354
361
  __decorate([
355
- Memoize()
362
+ (0, typescript_memoize_1.Memoize)()
356
363
  ], Balance.prototype, "free", null);
357
364
  __decorate([
358
- Memoize()
365
+ (0, typescript_memoize_1.Memoize)()
359
366
  ], Balance.prototype, "reserved", null);
360
367
  __decorate([
361
- Memoize()
368
+ (0, typescript_memoize_1.Memoize)()
362
369
  ], Balance.prototype, "locked", null);
363
370
  __decorate([
364
- Memoize()
371
+ (0, typescript_memoize_1.Memoize)()
365
372
  ], Balance.prototype, "frozen", null);
366
373
  __decorate([
367
- Memoize()
374
+ (0, typescript_memoize_1.Memoize)()
368
375
  ], Balance.prototype, "transferable", null);
369
376
  __decorate([
370
- Memoize()
377
+ (0, typescript_memoize_1.Memoize)()
371
378
  ], Balance.prototype, "feePayable", null);
372
- export class BalanceFormatter {
379
+ exports.Balance = Balance;
380
+ class BalanceFormatter {
373
381
  constructor(planck, decimals, fiatRatios) {
374
382
  _BalanceFormatter_planck.set(this, void 0);
375
383
  _BalanceFormatter_decimals.set(this, void 0);
@@ -378,13 +386,13 @@ export class BalanceFormatter {
378
386
  __classPrivateFieldSet(this, _BalanceFormatter_planck, typeof planck === "bigint" ? planck.toString() : planck, "f");
379
387
  __classPrivateFieldSet(this, _BalanceFormatter_decimals, decimals || 0, "f");
380
388
  __classPrivateFieldSet(this, _BalanceFormatter_fiatRatios, fiatRatios || null, "f");
381
- this.fiat = memoize(this.fiat);
389
+ this.fiat = (0, memoize_1.default)(this.fiat);
382
390
  }
383
391
  get planck() {
384
392
  return BigInt(__classPrivateFieldGet(this, _BalanceFormatter_planck, "f"));
385
393
  }
386
394
  get tokens() {
387
- return planckToTokens(__classPrivateFieldGet(this, _BalanceFormatter_planck, "f"), __classPrivateFieldGet(this, _BalanceFormatter_decimals, "f"));
395
+ return (0, util_1.planckToTokens)(__classPrivateFieldGet(this, _BalanceFormatter_planck, "f"), __classPrivateFieldGet(this, _BalanceFormatter_decimals, "f"));
388
396
  }
389
397
  fiat(currency) {
390
398
  if (!__classPrivateFieldGet(this, _BalanceFormatter_fiatRatios, "f"))
@@ -397,9 +405,10 @@ export class BalanceFormatter {
397
405
  }
398
406
  _BalanceFormatter_planck = new WeakMap(), _BalanceFormatter_decimals = new WeakMap(), _BalanceFormatter_fiatRatios = new WeakMap();
399
407
  __decorate([
400
- Memoize()
408
+ (0, typescript_memoize_1.Memoize)()
401
409
  ], BalanceFormatter.prototype, "tokens", null);
402
- export class FiatSumBalancesFormatter {
410
+ exports.BalanceFormatter = BalanceFormatter;
411
+ class FiatSumBalancesFormatter {
403
412
  constructor(balances, currency) {
404
413
  _FiatSumBalancesFormatter_balances.set(this, void 0);
405
414
  _FiatSumBalancesFormatter_currency.set(this, void 0);
@@ -422,7 +431,7 @@ export class FiatSumBalancesFormatter {
422
431
  );
423
432
  __classPrivateFieldSet(this, _FiatSumBalancesFormatter_balances, balances, "f");
424
433
  __classPrivateFieldSet(this, _FiatSumBalancesFormatter_currency, currency, "f");
425
- __classPrivateFieldSet(this, _FiatSumBalancesFormatter_sum, memoize(__classPrivateFieldGet(this, _FiatSumBalancesFormatter_sum, "f")), "f");
434
+ __classPrivateFieldSet(this, _FiatSumBalancesFormatter_sum, (0, memoize_1.default)(__classPrivateFieldGet(this, _FiatSumBalancesFormatter_sum, "f")), "f");
426
435
  }
427
436
  /**
428
437
  * The total balance of these tokens. Includes the free and the reserved amount.
@@ -457,34 +466,36 @@ export class FiatSumBalancesFormatter {
457
466
  }
458
467
  _FiatSumBalancesFormatter_balances = new WeakMap(), _FiatSumBalancesFormatter_currency = new WeakMap(), _FiatSumBalancesFormatter_sum = new WeakMap();
459
468
  __decorate([
460
- Memoize()
469
+ (0, typescript_memoize_1.Memoize)()
461
470
  ], FiatSumBalancesFormatter.prototype, "total", null);
462
471
  __decorate([
463
- Memoize()
472
+ (0, typescript_memoize_1.Memoize)()
464
473
  ], FiatSumBalancesFormatter.prototype, "free", null);
465
474
  __decorate([
466
- Memoize()
475
+ (0, typescript_memoize_1.Memoize)()
467
476
  ], FiatSumBalancesFormatter.prototype, "reserved", null);
468
477
  __decorate([
469
- Memoize()
478
+ (0, typescript_memoize_1.Memoize)()
470
479
  ], FiatSumBalancesFormatter.prototype, "locked", null);
471
480
  __decorate([
472
- Memoize()
481
+ (0, typescript_memoize_1.Memoize)()
473
482
  ], FiatSumBalancesFormatter.prototype, "frozen", null);
474
483
  __decorate([
475
- Memoize()
484
+ (0, typescript_memoize_1.Memoize)()
476
485
  ], FiatSumBalancesFormatter.prototype, "transferable", null);
477
486
  __decorate([
478
- Memoize()
487
+ (0, typescript_memoize_1.Memoize)()
479
488
  ], FiatSumBalancesFormatter.prototype, "feePayable", null);
480
- export class SumBalancesFormatter {
489
+ exports.FiatSumBalancesFormatter = FiatSumBalancesFormatter;
490
+ class SumBalancesFormatter {
481
491
  constructor(balances) {
482
492
  _SumBalancesFormatter_balances.set(this, void 0);
483
493
  __classPrivateFieldSet(this, _SumBalancesFormatter_balances, balances, "f");
484
- this.fiat = memoize(this.fiat);
494
+ this.fiat = (0, memoize_1.default)(this.fiat);
485
495
  }
486
496
  fiat(currency) {
487
497
  return new FiatSumBalancesFormatter(__classPrivateFieldGet(this, _SumBalancesFormatter_balances, "f"), currency);
488
498
  }
489
499
  }
500
+ exports.SumBalancesFormatter = SumBalancesFormatter;
490
501
  _SumBalancesFormatter_balances = new WeakMap();
@@ -1,5 +1,8 @@
1
- import { BigMath } from "@talismn/util";
2
- export function excludeFromTransferableAmount(locks) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.includeInTotalExtraAmount = exports.excludeFromFeePayableLocks = exports.excludeFromTransferableAmount = void 0;
4
+ const util_1 = require("@talismn/util");
5
+ function excludeFromTransferableAmount(locks) {
3
6
  if (typeof locks === "string")
4
7
  return BigInt(locks);
5
8
  if (!Array.isArray(locks))
@@ -7,16 +10,18 @@ export function excludeFromTransferableAmount(locks) {
7
10
  return locks
8
11
  .filter((lock) => lock.includeInTransferable !== true)
9
12
  .map((lock) => BigInt(lock.amount))
10
- .reduce((max, lock) => BigMath.max(max, lock), BigInt("0"));
13
+ .reduce((max, lock) => util_1.BigMath.max(max, lock), BigInt("0"));
11
14
  }
12
- export function excludeFromFeePayableLocks(locks) {
15
+ exports.excludeFromTransferableAmount = excludeFromTransferableAmount;
16
+ function excludeFromFeePayableLocks(locks) {
13
17
  if (typeof locks === "string")
14
18
  return [];
15
19
  if (!Array.isArray(locks))
16
20
  locks = [locks];
17
21
  return locks.filter((lock) => lock.excludeFromFeePayable);
18
22
  }
19
- export function includeInTotalExtraAmount(extra) {
23
+ exports.excludeFromFeePayableLocks = excludeFromFeePayableLocks;
24
+ function includeInTotalExtraAmount(extra) {
20
25
  if (!extra)
21
26
  return BigInt("0");
22
27
  if (!Array.isArray(extra))
@@ -26,3 +31,4 @@ export function includeInTotalExtraAmount(extra) {
26
31
  .map((extra) => BigInt(extra.amount))
27
32
  .reduce((a, b) => a + b, BigInt("0"));
28
33
  }
34
+ exports.includeInTotalExtraAmount = includeInTotalExtraAmount;
@@ -1,4 +1,20 @@
1
- export * from "./addresses";
2
- export * from "./balances";
3
- export * from "./balancetypes";
4
- export * from "./subscriptions";
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./addresses"), exports);
18
+ __exportStar(require("./balances"), exports);
19
+ __exportStar(require("./balancetypes"), exports);
20
+ __exportStar(require("./subscriptions"), exports);
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/balances",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "author": "Talisman",
5
5
  "homepage": "https://talisman.xyz",
6
6
  "license": "UNLICENSED",
@@ -31,16 +31,16 @@
31
31
  "clean": "rm -rf dist && rm -rf .turbo rm -rf node_modules"
32
32
  },
33
33
  "dependencies": {
34
- "@talismn/chain-connector": "^0.1.1",
35
- "@talismn/chaindata-provider": "^0.1.1",
36
- "@talismn/token-rates": "^0.1.1",
37
- "@talismn/util": "^0.1.1",
34
+ "@talismn/chain-connector": "^0.1.2",
35
+ "@talismn/chaindata-provider": "^0.1.2",
36
+ "@talismn/token-rates": "^0.1.2",
37
+ "@talismn/util": "^0.1.3",
38
38
  "lodash": "^4.17.21",
39
39
  "typescript-memoize": "^1.1.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@talismn/eslint-config": "^0.0.0",
43
- "@talismn/tsconfig": "^0.0.0",
43
+ "@talismn/tsconfig": "^0.0.1",
44
44
  "@types/jest": "^27.5.1",
45
45
  "eslint": "^8.4.0",
46
46
  "jest": "^28.1.0",