@ercworldio/blockchain-shared 1.0.1-dev.4 → 1.0.1-dev.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.
@@ -6,6 +6,7 @@ export declare class DepositAddress {
6
6
  child_index: number;
7
7
  address: string;
8
8
  transaction_count: number;
9
+ expires_at: Date;
9
10
  created_at: Date;
10
11
  updated_at: Date;
11
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DepositAddress.d.ts","sourceRoot":"","sources":["../../src/entities/DepositAddress.ts"],"names":[],"mappings":"AAEA,qBAEa,cAAc;IAEvB,EAAE,EAAG,MAAM,CAAC;IAGZ,OAAO,EAAG,MAAM,CAAC;IAGjB,UAAU,EAAG,MAAM,CAAC;IAGpB,YAAY,EAAG,MAAM,CAAC;IAGtB,WAAW,EAAG,MAAM,CAAC;IAGrB,OAAO,EAAG,MAAM,CAAC;IAGjB,iBAAiB,EAAG,MAAM,CAAC;IAG3B,UAAU,EAAG,IAAI,CAAC;IAGlB,UAAU,EAAG,IAAI,CAAC;CACrB"}
1
+ {"version":3,"file":"DepositAddress.d.ts","sourceRoot":"","sources":["../../src/entities/DepositAddress.ts"],"names":[],"mappings":"AAEA,qBAEa,cAAc;IAEvB,EAAE,EAAG,MAAM,CAAC;IAGZ,OAAO,EAAG,MAAM,CAAC;IAGjB,UAAU,EAAG,MAAM,CAAC;IAGpB,YAAY,EAAG,MAAM,CAAC;IAGtB,WAAW,EAAG,MAAM,CAAC;IAGrB,OAAO,EAAG,MAAM,CAAC;IAGjB,iBAAiB,EAAG,MAAM,CAAC;IAG3B,UAAU,EAAG,IAAI,CAAC;IAGlB,UAAU,EAAG,IAAI,CAAC;IAGlB,UAAU,EAAG,IAAI,CAAC;CACrB"}
@@ -43,11 +43,15 @@ __decorate([
43
43
  __metadata("design:type", Number)
44
44
  ], DepositAddress.prototype, "transaction_count", void 0);
45
45
  __decorate([
46
- (0, typeorm_1.Column)({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }),
46
+ (0, typeorm_1.Column)({ type: 'timestamptz', default: () => 'CURRENT_TIMESTAMP' }),
47
+ __metadata("design:type", Date)
48
+ ], DepositAddress.prototype, "expires_at", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.Column)({ type: 'timestamptz', default: () => 'CURRENT_TIMESTAMP' }),
47
51
  __metadata("design:type", Date)
48
52
  ], DepositAddress.prototype, "created_at", void 0);
49
53
  __decorate([
50
- (0, typeorm_1.Column)({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }),
54
+ (0, typeorm_1.Column)({ type: 'timestamptz', default: () => 'CURRENT_TIMESTAMP' }),
51
55
  __metadata("design:type", Date)
52
56
  ], DepositAddress.prototype, "updated_at", void 0);
53
57
  exports.DepositAddress = DepositAddress = __decorate([
@@ -0,0 +1,14 @@
1
+ export declare class DepositAddressArchive {
2
+ id: number;
3
+ original_id: number;
4
+ user_id: number;
5
+ blockchain: string;
6
+ parent_index: number | null;
7
+ child_index: number | null;
8
+ address: string;
9
+ transaction_count: number;
10
+ expires_at: Date;
11
+ archived_at: Date;
12
+ archived_reason: 'expired' | 'revoked' | 'renewed';
13
+ }
14
+ //# sourceMappingURL=DepositAddressArchive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DepositAddressArchive.d.ts","sourceRoot":"","sources":["../../src/entities/DepositAddressArchive.ts"],"names":[],"mappings":"AAEA,qBAEa,qBAAqB;IAE9B,EAAE,EAAG,MAAM,CAAC;IAGZ,WAAW,EAAG,MAAM,CAAC;IAIrB,OAAO,EAAG,MAAM,CAAC;IAGjB,UAAU,EAAG,MAAM,CAAC;IAGpB,YAAY,EAAG,MAAM,GAAG,IAAI,CAAC;IAG7B,WAAW,EAAG,MAAM,GAAG,IAAI,CAAC;IAI5B,OAAO,EAAG,MAAM,CAAC;IAGjB,iBAAiB,EAAG,MAAM,CAAC;IAG3B,UAAU,EAAG,IAAI,CAAC;IAGlB,WAAW,EAAG,IAAI,CAAC;IAGnB,eAAe,EAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;CACvD"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.DepositAddressArchive = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ let DepositAddressArchive = class DepositAddressArchive {
15
+ };
16
+ exports.DepositAddressArchive = DepositAddressArchive;
17
+ __decorate([
18
+ (0, typeorm_1.PrimaryGeneratedColumn)({ type: 'bigint' }),
19
+ __metadata("design:type", Number)
20
+ ], DepositAddressArchive.prototype, "id", void 0);
21
+ __decorate([
22
+ (0, typeorm_1.Column)({ type: 'bigint', name: 'original_id' }),
23
+ __metadata("design:type", Number)
24
+ ], DepositAddressArchive.prototype, "original_id", void 0);
25
+ __decorate([
26
+ (0, typeorm_1.Column)({ type: 'bigint', name: 'user_id' }),
27
+ (0, typeorm_1.Index)(),
28
+ __metadata("design:type", Number)
29
+ ], DepositAddressArchive.prototype, "user_id", void 0);
30
+ __decorate([
31
+ (0, typeorm_1.Column)(),
32
+ __metadata("design:type", String)
33
+ ], DepositAddressArchive.prototype, "blockchain", void 0);
34
+ __decorate([
35
+ (0, typeorm_1.Column)({ nullable: true, name: 'parent_index' }),
36
+ __metadata("design:type", Object)
37
+ ], DepositAddressArchive.prototype, "parent_index", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.Column)({ nullable: true, name: 'child_index' }),
40
+ __metadata("design:type", Object)
41
+ ], DepositAddressArchive.prototype, "child_index", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)(),
44
+ (0, typeorm_1.Index)(),
45
+ __metadata("design:type", String)
46
+ ], DepositAddressArchive.prototype, "address", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.Column)({ name: 'transaction_count' }),
49
+ __metadata("design:type", Number)
50
+ ], DepositAddressArchive.prototype, "transaction_count", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Column)({ type: 'timestamptz', name: 'expires_at' }),
53
+ __metadata("design:type", Date)
54
+ ], DepositAddressArchive.prototype, "expires_at", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.CreateDateColumn)({ type: 'timestamptz', name: 'archived_at' }),
57
+ __metadata("design:type", Date)
58
+ ], DepositAddressArchive.prototype, "archived_at", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.Column)({ name: 'archived_reason', default: 'expired' }),
61
+ __metadata("design:type", String)
62
+ ], DepositAddressArchive.prototype, "archived_reason", void 0);
63
+ exports.DepositAddressArchive = DepositAddressArchive = __decorate([
64
+ (0, typeorm_1.Entity)({ name: "deposit_addresses_archive", schema: "usersmanagement" }),
65
+ (0, typeorm_1.Unique)(['original_id'])
66
+ ], DepositAddressArchive);
package/build/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export { default as ChainManager } from './services/ChainManager';
11
11
  export { default as ClaimHistoryService } from './services/ClaimHistoryService';
12
12
  export { default as ClaimJobService } from './services/ClaimJobService';
13
13
  export { default as DepositAddressService } from './services/DepositAddressService';
14
+ export { default as DepositAddressArchiveService } from './services/DepositAddressArchiveService';
14
15
  export { default as ElasticSearch } from './services/ElasticSearch';
15
16
  export { default as EventsHandler } from './services/EventsHandler';
16
17
  export { default as EventsService } from './services/EventsService';
@@ -61,6 +62,7 @@ export * from './entities/Checkpoint';
61
62
  export * from './entities/ClaimHistory';
62
63
  export * from './entities/ClaimJob';
63
64
  export * from './entities/DepositAddress';
65
+ export * from './entities/DepositAddressArchive';
64
66
  export * from './entities/DepositWalletBalance';
65
67
  export * from './entities/SweepHistory';
66
68
  export * from './entities/SweepJob';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AAClG,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AACxF,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI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,IAAI,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACjG,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAEnF,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAChF,cAAc,uCAAuC,CAAC;AACtD,cAAc,yBAAyB,CAAC;AAIxC,cAAc,0BAA0B,CAAC;AAGzC,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAG/I,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AAEvC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGtD,cAAc,cAAc,CAAC;AAG7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC"}
package/build/index.js CHANGED
@@ -40,8 +40,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
40
40
  return (mod && mod.__esModule) ? mod : { "default": mod };
41
41
  };
42
42
  Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.BalanceErrors = exports.AdminErrors = exports.TransactionsErrors = exports.EscrowInteraction = exports.QnWebhookAddressManager = exports.SetupNotifications = exports.QnNotificationsApi = exports.QuicknodeWebhookSignature = exports.Worker = exports.WithdrawalManager = exports.WalletManagerHelper = exports.WalletManager = exports.WalletIndexService = exports.SweepHistoryService = exports.SweepJobService = exports.StorageService = exports.ProviderManager = exports.Provider = exports.TronFundingWallet = exports.TronCustodialWallet = exports.TronHotWallet = exports.TronHelper = exports.TronTransaction = exports.TronSigner = exports.TimerManager = exports.RedisPubSub = exports.RedisListQueue = exports.RedisQueue = exports.Redis = exports.MemoryMonitor = exports.Logger = exports.KeyVaultHandler = exports.InvoiceQueue = exports.EscrowService = exports.EventsService = exports.EventsHandler = exports.ElasticSearch = exports.DepositAddressService = exports.ClaimJobService = exports.ClaimHistoryService = exports.ChainManager = exports.BalanceService = exports.AlchemyWebhookSignature = exports.AlchemyWebhooks = exports.AlchemyWebhookAddressManager = exports.AlchemyService = exports.AccountingService = exports.AzureEventHubHandler = exports.AsyncTTLCache = exports.AsyncRateLimiter = void 0;
44
- exports.AppErrors = exports.EscrowIdl = exports.CoverageInfo = exports.EscrowEvents = exports.Erc20Events = exports.AccessControlEvents = exports.ERC20Abi = exports.ErrorAbi = exports.EscrowAbi = exports.ERC20MockAbi = exports.BaseErrors = exports.VoltageErrors = exports.AlchemyErrors = exports.WalletErrors = exports.DatabaseErrors = void 0;
43
+ exports.AdminErrors = exports.TransactionsErrors = exports.EscrowInteraction = exports.QnWebhookAddressManager = exports.SetupNotifications = exports.QnNotificationsApi = exports.QuicknodeWebhookSignature = exports.Worker = exports.WithdrawalManager = exports.WalletManagerHelper = exports.WalletManager = exports.WalletIndexService = exports.SweepHistoryService = exports.SweepJobService = exports.StorageService = exports.ProviderManager = exports.Provider = exports.TronFundingWallet = exports.TronCustodialWallet = exports.TronHotWallet = exports.TronHelper = exports.TronTransaction = exports.TronSigner = exports.TimerManager = exports.RedisPubSub = exports.RedisListQueue = exports.RedisQueue = exports.Redis = exports.MemoryMonitor = exports.Logger = exports.KeyVaultHandler = exports.InvoiceQueue = exports.EscrowService = exports.EventsService = exports.EventsHandler = exports.ElasticSearch = exports.DepositAddressArchiveService = exports.DepositAddressService = exports.ClaimJobService = exports.ClaimHistoryService = exports.ChainManager = exports.BalanceService = exports.AlchemyWebhookSignature = exports.AlchemyWebhooks = exports.AlchemyWebhookAddressManager = exports.AlchemyService = exports.AccountingService = exports.AzureEventHubHandler = exports.AsyncTTLCache = exports.AsyncRateLimiter = void 0;
44
+ exports.AppErrors = exports.EscrowIdl = exports.CoverageInfo = exports.EscrowEvents = exports.Erc20Events = exports.AccessControlEvents = exports.ERC20Abi = exports.ErrorAbi = exports.EscrowAbi = exports.ERC20MockAbi = exports.BaseErrors = exports.VoltageErrors = exports.AlchemyErrors = exports.WalletErrors = exports.DatabaseErrors = exports.BalanceErrors = void 0;
45
45
  // Services
46
46
  var AsyncRateLimiter_1 = require("./utils/AsyncRateLimiter");
47
47
  Object.defineProperty(exports, "AsyncRateLimiter", { enumerable: true, get: function () { return __importDefault(AsyncRateLimiter_1).default; } });
@@ -69,6 +69,8 @@ var ClaimJobService_1 = require("./services/ClaimJobService");
69
69
  Object.defineProperty(exports, "ClaimJobService", { enumerable: true, get: function () { return __importDefault(ClaimJobService_1).default; } });
70
70
  var DepositAddressService_1 = require("./services/DepositAddressService");
71
71
  Object.defineProperty(exports, "DepositAddressService", { enumerable: true, get: function () { return __importDefault(DepositAddressService_1).default; } });
72
+ var DepositAddressArchiveService_1 = require("./services/DepositAddressArchiveService");
73
+ Object.defineProperty(exports, "DepositAddressArchiveService", { enumerable: true, get: function () { return __importDefault(DepositAddressArchiveService_1).default; } });
72
74
  var ElasticSearch_1 = require("./services/ElasticSearch");
73
75
  Object.defineProperty(exports, "ElasticSearch", { enumerable: true, get: function () { return __importDefault(ElasticSearch_1).default; } });
74
76
  var EventsHandler_1 = require("./services/EventsHandler");
@@ -156,6 +158,7 @@ __exportStar(require("./entities/Checkpoint"), exports);
156
158
  __exportStar(require("./entities/ClaimHistory"), exports);
157
159
  __exportStar(require("./entities/ClaimJob"), exports);
158
160
  __exportStar(require("./entities/DepositAddress"), exports);
161
+ __exportStar(require("./entities/DepositAddressArchive"), exports);
159
162
  __exportStar(require("./entities/DepositWalletBalance"), exports);
160
163
  __exportStar(require("./entities/SweepHistory"), exports);
161
164
  __exportStar(require("./entities/SweepJob"), exports);
@@ -1,6 +1,7 @@
1
1
  import { DataSource, Repository } from "typeorm";
2
2
  import { DepositWalletBalance } from "../entities/DepositWalletBalance";
3
3
  import { DepositAddress } from "../entities/DepositAddress";
4
+ import { DepositAddressArchive } from "../entities/DepositAddressArchive";
4
5
  import { WalletIndex } from "../entities/WalletIndex";
5
6
  import { SweepJob } from "../entities/SweepJob";
6
7
  import { SweepHistory } from "../entities/SweepHistory";
@@ -13,6 +14,7 @@ export interface IDatabasePool {
13
14
  appDataSource: DataSource | null;
14
15
  balancesRepo: Repository<DepositWalletBalance> | null;
15
16
  accountsRepo: Repository<DepositAddress> | null;
17
+ depositAddressArchiveRepo: Repository<DepositAddressArchive> | null;
16
18
  walletIndexRepo: Repository<WalletIndex> | null;
17
19
  sweepJobRepo: Repository<SweepJob> | null;
18
20
  sweepHistoryRepo: Repository<SweepHistory> | null;
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/interfaces/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,MAAM,WAAW,aAAa;IAC1B,qBAAqB,EAAE,UAAU,GAAG,IAAI,CAAC;IACzC,aAA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B,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAE9E,MAAM,WAAW,aAAa;IAC1B,qBAAqB,EAAE,UAAU,GAAG,IAAI,CAAC;IACzC,aAAa,EAAE,UAAU,GAAG,IAAI,CAAC;IACjC,YAAY,EAAE,UAAU,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC;IACtD,YAAY,EAAE,UAAU,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;IAChD,yBAAyB,EAAE,UAAU,CAAC,qBAAqB,CAAC,GAAG,IAAI,CAAC;IACpE,eAAe,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;IAChD,YAAY,EAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IAC1C,gBAAgB,EAAE,UAAU,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;IAClD,gBAAgB,EAAE,UAAU,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAC/C,gBAAgB,EAAE,UAAU,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;IACtD,2BAA2B,CAAC,EAAE,UAAU,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAAC;IACzE,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,UAAU,CAAC;IAChC,SAAS,EAAE,MAAM,IAAI,CAAC;CACzB;AAGD,MAAM,WAAW,qBAAqB;IAClC,WAAW,IAAI,aAAa,CAAC;CAChC"}
@@ -0,0 +1,33 @@
1
+ import { DepositAddress } from "../entities/DepositAddress";
2
+ import { DepositAddressArchive } from "../entities/DepositAddressArchive";
3
+ import { IDatabasePool } from "../interfaces/database";
4
+ import { Paginated } from "./types/claim_job_service";
5
+ export interface DepositAddressArchiveFilters {
6
+ userId?: number;
7
+ blockchain?: string;
8
+ address?: string;
9
+ archivedReason?: 'expired' | 'revoked' | 'renewed';
10
+ }
11
+ declare class DepositAddressArchiveService {
12
+ private dbPool;
13
+ constructor(dbPool: IDatabasePool);
14
+ private getRepo;
15
+ /**
16
+ * Archive an expired/revoked/renewed deposit address.
17
+ * Call this before replacing the live deposit_addresses row.
18
+ */
19
+ archive(address: DepositAddress, reason?: 'expired' | 'revoked' | 'renewed'): Promise<DepositAddressArchive>;
20
+ /**
21
+ * Idempotent archive — safe to call from multiple workers concurrently.
22
+ * Uses ON CONFLICT DO NOTHING on original_id so duplicate calls are no-ops.
23
+ * Returns the existing row if already archived, or the newly inserted row.
24
+ */
25
+ archiveIdempotent(address: DepositAddress, reason?: 'expired' | 'revoked' | 'renewed'): Promise<DepositAddressArchive>;
26
+ findById(id: number): Promise<DepositAddressArchive | null>;
27
+ findByOriginalId(originalId: number): Promise<DepositAddressArchive[]>;
28
+ findByUserId(userId: number, blockchain?: string): Promise<DepositAddressArchive[]>;
29
+ findByAddress(address: string): Promise<DepositAddressArchive[]>;
30
+ getPaginated(page: number, page_size?: number, filters?: DepositAddressArchiveFilters): Promise<Paginated<DepositAddressArchive[]>>;
31
+ }
32
+ export default DepositAddressArchiveService;
33
+ //# sourceMappingURL=DepositAddressArchiveService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DepositAddressArchiveService.d.ts","sourceRoot":"","sources":["../../src/services/DepositAddressArchiveService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,MAAM,WAAW,4BAA4B;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;CACtD;AAED,cAAM,4BAA4B;IAC9B,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,aAAa;IAIjC,OAAO,CAAC,OAAO;IAMf;;;OAGG;IACG,OAAO,CACT,OAAO,EAAE,cAAc,EACvB,MAAM,GAAE,SAAS,GAAG,SAAS,GAAG,SAAqB,GACtD,OAAO,CAAC,qBAAqB,CAAC;IAgBjC;;;;OAIG;IACG,iBAAiB,CACnB,OAAO,EAAE,cAAc,EACvB,MAAM,GAAE,SAAS,GAAG,SAAS,GAAG,SAAqB,GACtD,OAAO,CAAC,qBAAqB,CAAC;IA+B3B,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;IAI3D,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAOtE,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAMnF,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAOhE,YAAY,CACd,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,MAAW,EACtB,OAAO,GAAE,4BAAiC,GAC3C,OAAO,CAAC,SAAS,CAAC,qBAAqB,EAAE,CAAC,CAAC;CA4BjD;AAED,eAAe,4BAA4B,CAAC"}
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ class DepositAddressArchiveService {
13
+ constructor(dbPool) {
14
+ this.dbPool = dbPool;
15
+ }
16
+ getRepo() {
17
+ const repo = this.dbPool.depositAddressArchiveRepo;
18
+ if (!repo)
19
+ throw new Error('depositAddressArchiveRepo is not initialized.');
20
+ return repo;
21
+ }
22
+ /**
23
+ * Archive an expired/revoked/renewed deposit address.
24
+ * Call this before replacing the live deposit_addresses row.
25
+ */
26
+ archive(address_1) {
27
+ return __awaiter(this, arguments, void 0, function* (address, reason = 'expired') {
28
+ var _a, _b;
29
+ const repo = this.getRepo();
30
+ const entry = repo.create({
31
+ original_id: address.id,
32
+ user_id: address.user_id,
33
+ blockchain: address.blockchain,
34
+ parent_index: (_a = address.parent_index) !== null && _a !== void 0 ? _a : null,
35
+ child_index: (_b = address.child_index) !== null && _b !== void 0 ? _b : null,
36
+ address: address.address,
37
+ transaction_count: address.transaction_count,
38
+ expires_at: address.expires_at,
39
+ archived_reason: reason,
40
+ });
41
+ return repo.save(entry);
42
+ });
43
+ }
44
+ /**
45
+ * Idempotent archive — safe to call from multiple workers concurrently.
46
+ * Uses ON CONFLICT DO NOTHING on original_id so duplicate calls are no-ops.
47
+ * Returns the existing row if already archived, or the newly inserted row.
48
+ */
49
+ archiveIdempotent(address_1) {
50
+ return __awaiter(this, arguments, void 0, function* (address, reason = 'expired') {
51
+ var _a, _b;
52
+ const repo = this.getRepo();
53
+ const dataSource = this.dbPool.appDataSource;
54
+ if (!dataSource)
55
+ throw new Error('appDataSource is not initialized.');
56
+ const rows = yield dataSource.query(`
57
+ INSERT INTO usersmanagement.deposit_addresses_archive
58
+ (original_id, user_id, blockchain, parent_index, child_index, address, transaction_count, expires_at, archived_at, archived_reason)
59
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, now(), $9)
60
+ ON CONFLICT (original_id) DO NOTHING
61
+ RETURNING *
62
+ `, [
63
+ address.id,
64
+ address.user_id,
65
+ address.blockchain,
66
+ (_a = address.parent_index) !== null && _a !== void 0 ? _a : null,
67
+ (_b = address.child_index) !== null && _b !== void 0 ? _b : null,
68
+ address.address,
69
+ address.transaction_count,
70
+ address.expires_at,
71
+ reason,
72
+ ]);
73
+ // If conflict (already archived), return the existing record
74
+ if (rows.length === 0) {
75
+ return repo.findOneOrFail({ where: { original_id: address.id } });
76
+ }
77
+ return rows[0];
78
+ });
79
+ }
80
+ findById(id) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ return this.getRepo().findOne({ where: { id } });
83
+ });
84
+ }
85
+ findByOriginalId(originalId) {
86
+ return __awaiter(this, void 0, void 0, function* () {
87
+ return this.getRepo().find({
88
+ where: { original_id: originalId },
89
+ order: { archived_at: 'DESC' },
90
+ });
91
+ });
92
+ }
93
+ findByUserId(userId, blockchain) {
94
+ return __awaiter(this, void 0, void 0, function* () {
95
+ const where = { userId };
96
+ if (blockchain)
97
+ where.blockchain = blockchain;
98
+ return this.getRepo().find({ where, order: { archived_at: 'DESC' } });
99
+ });
100
+ }
101
+ findByAddress(address) {
102
+ return __awaiter(this, void 0, void 0, function* () {
103
+ return this.getRepo().find({
104
+ where: { address },
105
+ order: { archived_at: 'DESC' },
106
+ });
107
+ });
108
+ }
109
+ getPaginated(page_1) {
110
+ return __awaiter(this, arguments, void 0, function* (page, page_size = 20, filters = {}) {
111
+ const repo = this.getRepo();
112
+ if (page === 0)
113
+ page = 1;
114
+ const where = {};
115
+ if (filters.userId)
116
+ where.userId = filters.userId;
117
+ if (filters.blockchain)
118
+ where.blockchain = filters.blockchain;
119
+ if (filters.address)
120
+ where.address = filters.address;
121
+ if (filters.archivedReason)
122
+ where.archivedReason = filters.archivedReason;
123
+ const [items, totalCount] = yield Promise.all([
124
+ repo.find({
125
+ where,
126
+ order: { archived_at: 'DESC' },
127
+ take: page_size,
128
+ skip: (page - 1) * page_size,
129
+ }),
130
+ repo.count({ where }),
131
+ ]);
132
+ return {
133
+ total_count: totalCount,
134
+ pages_count: Math.ceil(totalCount / page_size),
135
+ has_next: totalCount > page * page_size,
136
+ current_page: page,
137
+ items,
138
+ };
139
+ });
140
+ }
141
+ }
142
+ exports.default = DepositAddressArchiveService;
@@ -15,6 +15,7 @@ interface CreateDepositResult {
15
15
  childIndex: number;
16
16
  transactionCount: number;
17
17
  blockchain: string;
18
+ expiresAt: Date;
18
19
  updatedAt: Date;
19
20
  createdAt: Date;
20
21
  }
@@ -23,6 +24,7 @@ export interface UpdateDepositAddressValues {
23
24
  parentIndex: number;
24
25
  childIndex: number;
25
26
  address: string;
27
+ expiresAt: Date;
26
28
  }
27
29
  interface UpdateDepositResult extends CreateDepositResult {
28
30
  }
@@ -35,7 +37,7 @@ declare class DepositAddressService {
35
37
  findByUserId(userId: number, blockchain: string): Promise<DepositAddress>;
36
38
  findByBlockchainAndParentIndex(blockchain: BlockchainType, parentIndex: number): Promise<null>;
37
39
  private findByBlockchainAndUserId;
38
- createDepositAddress(userId: number, blockchain: string, parentIndex: number, address: string): Promise<CreateDepositResult>;
40
+ createDepositAddress(userId: number, blockchain: string, parentIndex: number, address: string, expiry_duration_s: number): Promise<CreateDepositResult>;
39
41
  updateDepositAddress(userId: number, values: UpdateDepositAddressValues): Promise<UpdateDepositResult>;
40
42
  deleteDepositAddress(userId: number, blockchain: string): Promise<{
41
43
  status: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"DepositAddressService.d.ts","sourceRoot":"","sources":["../../src/services/DepositAddressService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAI5D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,MAAM,WAAW,2BAA2B;IACxC,OAAO,CA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AS,EAAE,MAAM,YAAK,EAAE,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC,CAAC;IAI9I,0BAA0B,CAAC,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAkBvG,6BAA6B,CAAC,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;CAanH;AAED,eAAe,qBAAqB,CAAC"}
@@ -121,7 +121,7 @@ class DepositAddressService {
121
121
  }
122
122
  });
123
123
  }
124
- createDepositAddress(userId, blockchain, parentIndex, address) {
124
+ createDepositAddress(userId, blockchain, parentIndex, address, expiry_duration_s) {
125
125
  return __awaiter(this, void 0, void 0, function* () {
126
126
  try {
127
127
  const dbDriver = this.dbPool;
@@ -146,6 +146,7 @@ class DepositAddressService {
146
146
  entity.transaction_count = 0;
147
147
  entity.blockchain = blockchain;
148
148
  entity.parent_index = parentIndex;
149
+ entity.expires_at = new Date(new Date().getTime() + expiry_duration_s * 1000);
149
150
  entity.child_index = 0;
150
151
  entity.address = this.normalizeAddress(address, blockchain);
151
152
  const depositAddress = yield dbDriver.accountsRepo.save(entity);
@@ -160,6 +161,7 @@ class DepositAddressService {
160
161
  childIndex: updatedDepositAddress.child_index,
161
162
  address: this.normalizeAddress(updatedDepositAddress.address, updatedDepositAddress.blockchain),
162
163
  transactionCount: updatedDepositAddress.transaction_count,
164
+ expiresAt: updatedDepositAddress.expires_at,
163
165
  updatedAt: updatedDepositAddress.updated_at,
164
166
  createdAt: updatedDepositAddress.created_at
165
167
  };
@@ -199,6 +201,7 @@ class DepositAddressService {
199
201
  }
200
202
  // Update address renewal date
201
203
  entity.updated_at = new Date();
204
+ entity.expires_at = values.expiresAt;
202
205
  // Insert the entity into the database
203
206
  const insertedDepositAddress = yield dbDriver.accountsRepo.update(entity.id, entity);
204
207
  return {
@@ -209,6 +212,7 @@ class DepositAddressService {
209
212
  childIndex: entity.child_index,
210
213
  transactionCount: entity.transaction_count,
211
214
  blockchain: entity.blockchain,
215
+ expiresAt: entity.expires_at,
212
216
  createdAt: entity.created_at,
213
217
  updatedAt: entity.updated_at
214
218
  };
@@ -22,7 +22,7 @@ declare class WalletManager extends BaseErrors {
22
22
  getEscrowFundsManagerWallet: (blockchain: BlockchainType) => ethers.Wallet | Keypair | TronNodeWallet;
23
23
  fund_wallets_evm: (chainId: ChainId, wallets: string[], estimation_type: TransactionType) => Promise<string>;
24
24
  private get_wallet_service_mnemonic;
25
- createWallet: (userId: number, blockchain: BlockchainType) => Promise<IWallet>;
25
+ createWallet: (userId: number, blockchain: BlockchainType, expiry_duration_s: number) => Promise<IWallet>;
26
26
  isAddressExpired(blockchain: BlockchainType, address: string): Promise<boolean>;
27
27
  calculate_expiry(wallet: IWallet): {
28
28
  is_expired: boolean;
@@ -35,7 +35,7 @@ declare class WalletManager extends BaseErrors {
35
35
  status: boolean;
36
36
  address: string;
37
37
  }>;
38
- renewWallet: (subscription: AlchemyWebhookEnvironment, userId: number, blockchain: BlockchainType, expired_address: string) => Promise<IWallet>;
38
+ renewWallet: (subscription: AlchemyWebhookEnvironment, userId: number, blockchain: BlockchainType, expired_address: string, expiry_duration_s: number) => Promise<IWallet>;
39
39
  updateWebhookAddress: (subscription: AlchemyWebhookEnvironment, blockchain: BlockchainType, old_wallet: IWallet, new_wallet: IWallet, limiter: AsyncRateLimiter) => Promise<boolean>;
40
40
  handleRenewWallet: (old_wallet: IWallet, new_wallet: IWallet) => Promise<IWallet>;
41
41
  deriveWallet: (parentIndex: number, childIndex: number, blockchain: BlockchainType, _mnemonic?: string) => BtcWallet;
@@ -1 +1 @@
1
- {"version":3,"file":"WalletManager.d.ts","sourceRoot":"","sources":["../../src/services/WalletManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAoC,MAAM,QAAQ,CAAC;AAClE,OAAO,EAAE,OAAO,EA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AY,cAAc,EAAE,YAAY,MAAM,eA4E7G;CAIJ;AAED,eAAe,aAAa,CAAC"}
@@ -82,6 +82,7 @@ class WalletManager extends errors_1.default {
82
82
  childIndex: existingWallet.child_index,
83
83
  transactionCount: existingWallet.transaction_count,
84
84
  blockchain: existingWallet.blockchain,
85
+ expiresAt: existingWallet.expires_at,
85
86
  updatedAt: existingWallet.updated_at,
86
87
  createdAt: existingWallet.created_at
87
88
  };
@@ -150,7 +151,7 @@ class WalletManager extends errors_1.default {
150
151
  throw new Error("Failed to fund wallets.");
151
152
  return response.transactionHash;
152
153
  });
153
- this.createWallet = (userId, blockchain) => __awaiter(this, void 0, void 0, function* () {
154
+ this.createWallet = (userId, blockchain, expiry_duration_s) => __awaiter(this, void 0, void 0, function* () {
154
155
  try {
155
156
  // User main wallet mnemonic
156
157
  const mnemonic = this.get_wallet_service_mnemonic(blockchain);
@@ -167,7 +168,7 @@ class WalletManager extends errors_1.default {
167
168
  throw new Error(`Failed to derive child wallet.`);
168
169
  }
169
170
  // Create new entity in db
170
- const newEntity = yield depositAddressService.createDepositAddress(userId, blockchain, parentIndex, derivedWallet.address);
171
+ const newEntity = yield depositAddressService.createDepositAddress(userId, blockchain, parentIndex, derivedWallet.address, expiry_duration_s);
171
172
  return newEntity;
172
173
  }
173
174
  catch (error) {
@@ -178,7 +179,7 @@ class WalletManager extends errors_1.default {
178
179
  const depositAddressService = new DepositAddressService_1.default(this.dbPool);
179
180
  return yield depositAddressService.deleteDepositAddress(userId, blockchain);
180
181
  });
181
- this.renewWallet = (subscription, userId, blockchain, expired_address) => __awaiter(this, void 0, void 0, function* () {
182
+ this.renewWallet = (subscription, userId, blockchain, expired_address, expiry_duration_s) => __awaiter(this, void 0, void 0, function* () {
182
183
  const wallet = yield this.getWallet(userId, blockchain);
183
184
  if (!wallet) {
184
185
  throw new Error(`Wallet not found`);
@@ -196,6 +197,7 @@ class WalletManager extends errors_1.default {
196
197
  childIndex: newChildIndex,
197
198
  blockchain,
198
199
  address: newWallet.address,
200
+ expiresAt: new Date(new Date().getTime() + expiry_duration_s * 1000)
199
201
  });
200
202
  const balanceService = new BalanceService_1.default(this.dbPool, this.config);
201
203
  const deleteBalancesAndDispatchSweep = yield balanceService.removeWalletBalances(updatedWallet.id, blockchain);
@@ -8,6 +8,7 @@ export interface IWallet {
8
8
  childIndex: number;
9
9
  transactionCount: number;
10
10
  blockchain: string;
11
+ expiresAt: Date;
11
12
  updatedAt: Date;
12
13
  createdAt: Date;
13
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"wallet_manager.d.ts","sourceRoot":"","sources":["../../../src/services/types/wallet_manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,WAAW,OAAO;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IACxB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,UAAU;IACvB,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,CAAC,EAAE,EAAE,GAAG,KAAK,GAAG,CAAC;CAC1B;AAED,MAAM,WAAW,SAAS;IACtB,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACnB"}
1
+ {"version":3,"file":"wallet_manager.d.ts","sourceRoot":"","sources":["../../../src/services/types/wallet_manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,WAAW,OAAO;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IACxB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,UAAU;IACvB,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,CAAC,EAAE,EAAE,GAAG,KAAK,GAAG,CAAC;CAC1B;AAED,MAAM,WAAW,SAAS;IACtB,MAAM,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ercworldio/blockchain-shared",
3
- "version": "1.0.1-dev.4",
3
+ "version": "1.0.1-dev.5",
4
4
  "description": "Shared library for blockchain projects",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",