@cityofzion/blockchain-service 1.16.0 → 1.16.2

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.
@@ -1,7 +1,6 @@
1
- import { Account, BlockchainService, BSCalculableFee, BSClaimable, BSMigrationNeo3, BSWithExplorerService, BSWithLedger, BSWithNameService, BSWithNft, UntilIndexRecord } from './interfaces';
1
+ import { Account, BlockchainService, BSCalculableFee, BSClaimable, BSWithExplorerService, BSWithLedger, BSWithNameService, BSWithNft, UntilIndexRecord } from './interfaces';
2
2
  export declare function hasNameService<BSName extends string = string>(service: BlockchainService<BSName>): service is BlockchainService<BSName> & BSWithNameService;
3
3
  export declare function isClaimable<BSName extends string = string>(service: BlockchainService<BSName>): service is BlockchainService<BSName> & BSClaimable<BSName>;
4
- export declare function hasMigrationNeo3<BSName extends string = string>(service: BlockchainService<BSName>): service is BlockchainService<BSName> & BSMigrationNeo3<BSName>;
5
4
  export declare function isCalculableFee<BSName extends string = string>(service: BlockchainService<BSName>): service is BlockchainService<BSName> & BSCalculableFee<BSName>;
6
5
  export declare function hasNft<BSName extends string = string>(service: BlockchainService<BSName>): service is BlockchainService<BSName> & BSWithNft;
7
6
  export declare function hasExplorerService<BSName extends string = string>(service: BlockchainService<BSName>): service is BlockchainService<BSName> & BSWithExplorerService;
@@ -17,15 +16,6 @@ export declare function waitForAccountTransaction<BSName extends string = string
17
16
  address: string;
18
17
  maxAttempts?: number;
19
18
  }): Promise<boolean>;
20
- export declare function waitForMigration(params: {
21
- service: BlockchainService & BSMigrationNeo3;
22
- neo3Service: BlockchainService;
23
- neo3Address: string;
24
- txId: string;
25
- }): Promise<{
26
- isTransactionConfirmed: boolean;
27
- isNeo3TransactionConfirmed: boolean;
28
- }>;
29
19
  export declare function fetchAccounts<BSName extends string = string>(blockchainServices: BlockchainService<BSName>, initialIndex: number, getAccountCallback: (service: BlockchainService<BSName>, index: number) => Promise<Account<BSName>>): Promise<Account<BSName>[]>;
30
20
  export declare function generateAccount<BSName extends string = string>(blockchainServices: BlockchainService<BSName>, initialIndex: number, untilIndex: number, getAccountCallback: (service: BlockchainService<BSName>, index: number) => Promise<Account<BSName>>): Promise<Account<BSName>[]>;
31
21
  export declare function generateAccountForBlockchainService<BSName extends string = string>(blockchainServices: BlockchainService<BSName>[], getAccountCallback: (service: BlockchainService<BSName>, index: number) => Promise<Account<BSName>>, untilIndexByBlockchainService?: UntilIndexRecord<BSName>): Promise<Map<BSName, Account<BSName>[]>>;
package/dist/functions.js CHANGED
@@ -9,8 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.formatNumber = exports.countDecimals = exports.denormalizeHash = exports.normalizeHash = exports.generateAccountForBlockchainService = exports.generateAccount = exports.fetchAccounts = exports.waitForMigration = exports.waitForAccountTransaction = exports.waitForTransaction = exports.wait = exports.hasLedger = exports.hasExplorerService = exports.hasNft = exports.isCalculableFee = exports.hasMigrationNeo3 = exports.isClaimable = exports.hasNameService = void 0;
13
- const constants_1 = require("./constants");
12
+ exports.formatNumber = exports.countDecimals = exports.denormalizeHash = exports.normalizeHash = exports.generateAccountForBlockchainService = exports.generateAccount = exports.fetchAccounts = exports.waitForAccountTransaction = exports.waitForTransaction = exports.wait = exports.hasLedger = exports.hasExplorerService = exports.hasNft = exports.isCalculableFee = exports.isClaimable = exports.hasNameService = void 0;
14
13
  function hasNameService(service) {
15
14
  return 'resolveNameServiceDomain' in service && 'validateNameServiceDomainFormat' in service;
16
15
  }
@@ -19,10 +18,6 @@ function isClaimable(service) {
19
18
  return 'claim' in service && 'claimToken' in service && 'getUnclaimed' in service.blockchainDataService;
20
19
  }
21
20
  exports.isClaimable = isClaimable;
22
- function hasMigrationNeo3(service) {
23
- return 'migrateToNeo3' in service && 'calculateToMigrateToNeo3Values' in service;
24
- }
25
- exports.hasMigrationNeo3 = hasMigrationNeo3;
26
21
  function isCalculableFee(service) {
27
22
  return 'calculateTransferFee' in service;
28
23
  }
@@ -87,50 +82,6 @@ function waitForAccountTransaction(params) {
87
82
  });
88
83
  }
89
84
  exports.waitForAccountTransaction = waitForAccountTransaction;
90
- function waitForMigration(params) {
91
- return __awaiter(this, void 0, void 0, function* () {
92
- const { neo3Address, neo3Service, service, txId } = params;
93
- const MAX_ATTEMPTS = 10;
94
- const NEO3_MAX_ATTEMPTS = 20;
95
- const response = {
96
- isTransactionConfirmed: false,
97
- isNeo3TransactionConfirmed: false,
98
- };
99
- let transactionResponse;
100
- for (let i = 0; i < MAX_ATTEMPTS; i++) {
101
- yield wait(30000);
102
- try {
103
- transactionResponse = yield service.blockchainDataService.getTransaction(txId);
104
- response.isTransactionConfirmed = true;
105
- break;
106
- }
107
- catch (_b) {
108
- // Empty block
109
- }
110
- }
111
- if (!response.isTransactionConfirmed)
112
- return response;
113
- for (let i = 0; i < NEO3_MAX_ATTEMPTS; i++) {
114
- yield wait(60000);
115
- try {
116
- const neo3Response = yield neo3Service.blockchainDataService.getTransactionsByAddress({
117
- address: neo3Address,
118
- });
119
- const isTransactionConfirmed = neo3Response.transactions.some(transaction => transaction.time > transactionResponse.time &&
120
- transaction.transfers.some(transfer => transfer.from === constants_1.BlockchainServiceConstants.COZ_NEO3_MIGRATION_ADDRESS));
121
- if (isTransactionConfirmed) {
122
- response.isNeo3TransactionConfirmed = true;
123
- break;
124
- }
125
- }
126
- catch (_c) {
127
- // Empty block
128
- }
129
- }
130
- return response;
131
- });
132
- }
133
- exports.waitForMigration = waitForMigration;
134
85
  function fetchAccounts(blockchainServices, initialIndex, getAccountCallback) {
135
86
  return __awaiter(this, void 0, void 0, function* () {
136
87
  const accounts = [];
@@ -40,6 +40,7 @@ export interface BlockchainService<BSName extends string = string, BSAvailableNe
40
40
  exchangeDataService: ExchangeDataService;
41
41
  blockchainDataService: BlockchainDataService;
42
42
  tokens: Token[];
43
+ nativeTokens: Token[];
43
44
  network: Network<BSAvailableNetworks>;
44
45
  testNetwork: (network: Network<BSAvailableNetworks>) => Promise<void>;
45
46
  setNetwork: (partialNetwork: Network<BSAvailableNetworks>) => void;
@@ -61,23 +62,6 @@ export interface BSClaimable<BSName extends string = string> {
61
62
  blockchainDataService: BlockchainDataService & BDSClaimable;
62
63
  claim(account: Account<BSName>): Promise<string>;
63
64
  }
64
- export type MigrateToNeo3Params<BSName extends string = string> = {
65
- account: Account<BSName>;
66
- address: string;
67
- };
68
- export type CalculateToMigrateToNeo3ValuesParams<BSName extends string = string> = {
69
- account: Account<BSName>;
70
- };
71
- export type CalculateToMigrateToNeo3ValuesResponse = {
72
- gasMigrationTotalFees?: string;
73
- neoMigrationTotalFees?: string;
74
- gasMigrationAmount?: string;
75
- neoMigrationAmount?: string;
76
- };
77
- export interface BSMigrationNeo3<BSName extends string = string> {
78
- migrateToNeo3(params: MigrateToNeo3Params<BSName>): Promise<string>;
79
- calculateToMigrateToNeo3Values(params: CalculateToMigrateToNeo3ValuesParams<BSName>): Promise<CalculateToMigrateToNeo3ValuesResponse>;
80
- }
81
65
  export interface BSWithNameService {
82
66
  resolveNameServiceDomain(domainName: string): Promise<string>;
83
67
  validateNameServiceDomainFormat(domainName: string): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/blockchain-service",
3
- "version": "1.16.0",
3
+ "version": "1.16.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": "https://github.com/CityOfZion/blockchain-services",
@@ -1,3 +0,0 @@
1
- export declare class BlockchainServiceConstants {
2
- static COZ_NEO3_MIGRATION_ADDRESS: string;
3
- }
package/dist/constants.js DELETED
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BlockchainServiceConstants = void 0;
4
- class BlockchainServiceConstants {
5
- }
6
- exports.BlockchainServiceConstants = BlockchainServiceConstants;
7
- BlockchainServiceConstants.COZ_NEO3_MIGRATION_ADDRESS = 'NLMsicDapULKFDmAzTsbhwrZjYZ83j53Ty';