@heliofi/common 0.1.239 → 0.1.241

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.
@@ -0,0 +1 @@
1
+ export declare type Override<T1, T2> = Omit<T1, keyof T2> & T2;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Override.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Override.js","sourceRoot":"","sources":["../../../../src/domain/data-structures/Override.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export * from './Override';
@@ -0,0 +1,18 @@
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("./Override"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/domain/data-structures/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B"}
@@ -2,3 +2,4 @@ export * from './model';
2
2
  export * from './constants';
3
3
  export * from './services';
4
4
  export * from './decorators';
5
+ export * from './data-structures';
@@ -18,4 +18,5 @@ __exportStar(require("./model"), exports);
18
18
  __exportStar(require("./constants"), exports);
19
19
  __exportStar(require("./services"), exports);
20
20
  __exportStar(require("./decorators"), exports);
21
+ __exportStar(require("./data-structures"), exports);
21
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,8CAA4B;AAC5B,6CAA2B;AAC3B,+CAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,8CAA4B;AAC5B,6CAA2B;AAC3B,+CAA6B;AAC7B,oDAAkC"}
@@ -10,7 +10,8 @@ export declare class ReportItem extends Entity {
10
10
  paymentRequestName: string;
11
11
  quantity: number;
12
12
  time: string;
13
- amount: number;
13
+ amount: bigint;
14
+ decimalAmount: string;
14
15
  convertedAmount: number;
15
16
  currency: string;
16
17
  blockchain: BlockchainSymbol;
@@ -1 +1 @@
1
- {"version":3,"file":"ReportItem.entity.js","sourceRoot":"","sources":["../../../../../../src/domain/model/report/entities/ReportItem.entity.ts"],"names":[],"mappings":";;;AACA,yCAAsC;AAGtC,MAAa,UAAW,SAAQ,eAAM;CAoErC;AApED,gCAoEC"}
1
+ {"version":3,"file":"ReportItem.entity.js","sourceRoot":"","sources":["../../../../../../src/domain/model/report/entities/ReportItem.entity.ts"],"names":[],"mappings":";;;AACA,yCAAsC;AAGtC,MAAa,UAAW,SAAQ,eAAM;CAyErC;AAzED,gCAyEC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createWallet.dto.js","sourceRoot":"","sources":["../../../../../../src/domain/model/user/dtos/createWallet.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AAEvD,MAAa,eAAe;CAc3B;AAXC;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;6CACC;AAEd;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;kDACK;AAElB;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;yDACY;AAb3B,0CAcC"}
1
+ {"version":3,"file":"createWallet.dto.js","sourceRoot":"","sources":["../../../../../../src/domain/model/user/dtos/createWallet.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAuD;AAEvD,MAAa,eAAe;CAY3B;AAXC;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;6CACC;AAEd;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;kDACK;AAElB;IAAC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;yDACY;AAX3B,0CAYC"}
@@ -1,3 +1,2 @@
1
1
  export * from './updateUser.dto';
2
2
  export * from './createUser.dto';
3
- export * from './createWallet.dto';
@@ -16,5 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./updateUser.dto"), exports);
18
18
  __exportStar(require("./createUser.dto"), exports);
19
- __exportStar(require("./createWallet.dto"), exports);
20
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/domain/model/user/dtos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,mDAAiC;AACjC,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/domain/model/user/dtos/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,mDAAiC"}
@@ -0,0 +1,9 @@
1
+ import BigNumber from 'bignumber.js';
2
+ export declare class AmountService {
3
+ static decimalFromMinimalUnits(minimalAmount: string, decimals: number): BigNumber;
4
+ static decimalFromMinimalUnits(minimalAmount: bigint, decimals: number): BigNumber;
5
+ static minimalUnitsFromDecimal(decimalAmount: string, decimals: number): bigint;
6
+ static minimalUnitsFromDecimal(decimalAmount: BigNumber, decimals: number): bigint;
7
+ private static minimalUnitAmountFromDecimalString;
8
+ private static getBigintMultiplierFromDecimals;
9
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AmountService = void 0;
7
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
+ class AmountService {
9
+ static decimalFromMinimalUnits(minimalAmount, decimals) {
10
+ const units = this.getBigintMultiplierFromDecimals(decimals);
11
+ return (0, bignumber_js_1.default)(String(minimalAmount)).dividedBy(String(units));
12
+ }
13
+ static minimalUnitsFromDecimal(decimalAmount, decimals) {
14
+ return this.minimalUnitAmountFromDecimalString(String(decimalAmount), decimals);
15
+ }
16
+ static minimalUnitAmountFromDecimalString(decimalAmount, currencyDecimals) {
17
+ const [integerPart, fractionalPart] = decimalAmount.split('.');
18
+ const normalizedFractionalPart = fractionalPart?.slice(0, currencyDecimals);
19
+ const stringFractionalDigits = normalizedFractionalPart?.length;
20
+ if (stringFractionalDigits == null) {
21
+ return (BigInt(decimalAmount) *
22
+ this.getBigintMultiplierFromDecimals(currencyDecimals));
23
+ }
24
+ const minimalUnitAmountFromDecimalString = BigInt(integerPart.concat(normalizedFractionalPart));
25
+ return (this.getBigintMultiplierFromDecimals(currencyDecimals - stringFractionalDigits) * BigInt(minimalUnitAmountFromDecimalString));
26
+ }
27
+ }
28
+ exports.AmountService = AmountService;
29
+ AmountService.getBigintMultiplierFromDecimals = (decimals) => {
30
+ return BigInt(1 + new Array(decimals).fill(0).join(''));
31
+ };
32
+ //# sourceMappingURL=AmountService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AmountService.js","sourceRoot":"","sources":["../../../../src/domain/services/AmountService.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAErC,MAAa,aAAa;IAWxB,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AAE,CAAC,CAAC,CAAC;AAC1D,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CurrencyService.js","sourceRoot":"","sources":["../../../../src/domain/services/CurrencyService.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAe;IAC1B,MAAM,CAAC,gBAAgB,CAAC,QAAgB,EAAE,MAAc;QACtD,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC5D,OAAO,UAAU,CAAC,CAAC,MAAM,GAAG,EAAE,IAAI,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,CAAC;CACF;AALD,0CAKC"}
1
+ {"version":3,"file":"CurrencyService.js","sourceRoot":"","sources":["../../../../src/domain/services/CurrencyService.ts"],"names":[],"mappings":";;;AAGA,MAAa,eAAe;IAC1B,MAAM,CAAC,gBAAgB,CAAC,QAAgB,EAAE,MAAc;QACtD,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC5D,OAAO,UAAU,CAAC,CAAC,MAAM,GAAG,EAAE,IAAI,aAAa,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,CAAC;CACF;AALD,0CAKC"}
@@ -9,3 +9,4 @@ export * from './SplitWalletService';
9
9
  export * from './PolygonExplorerService';
10
10
  export * from './ExplorerAggregateService';
11
11
  export * from './ClusterService';
12
+ export * from './AmountService';
@@ -25,4 +25,5 @@ __exportStar(require("./SplitWalletService"), exports);
25
25
  __exportStar(require("./PolygonExplorerService"), exports);
26
26
  __exportStar(require("./ExplorerAggregateService"), exports);
27
27
  __exportStar(require("./ClusterService"), exports);
28
+ __exportStar(require("./AmountService"), exports);
28
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/domain/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,oDAAkC;AAClC,mDAAiC;AACjC,mDAAiC;AACjC,+CAA6B;AAC7B,iEAA+C;AAC/C,2DAAyC;AACzC,uDAAqC;AACrC,2DAAyC;AACzC,6DAA2C;AAC3C,mDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/domain/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C;AAC1C,oDAAkC;AAClC,mDAAiC;AACjC,mDAAiC;AACjC,+CAA6B;AAC7B,iEAA+C;AAC/C,2DAAyC;AACzC,uDAAqC;AACrC,2DAAyC;AACzC,6DAA2C;AAC3C,mDAAiC;AACjC,kDAAgC"}