@cityofzion/blockchain-service 1.13.0 → 1.13.1
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/dist/functions.d.ts +4 -0
- package/dist/functions.js +8 -1
- package/package.json +1 -1
package/dist/functions.d.ts
CHANGED
|
@@ -5,9 +5,13 @@ export declare function isCalculableFee<BSName extends string = string>(service:
|
|
|
5
5
|
export declare function hasNft<BSName extends string = string>(service: BlockchainService<BSName>): service is BlockchainService<BSName> & BSWithNft;
|
|
6
6
|
export declare function hasExplorerService<BSName extends string = string>(service: BlockchainService<BSName>): service is BlockchainService<BSName> & BSWithExplorerService;
|
|
7
7
|
export declare function hasLedger<BSName extends string = string>(service: BlockchainService<BSName>): service is BlockchainService<BSName> & BSWithLedger<BSName>;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated use `waitForAccountTransaction` instead
|
|
10
|
+
*/
|
|
8
11
|
export declare function waitForTransaction<BSName extends string = string>(service: BlockchainService<BSName>, txId: string): Promise<boolean>;
|
|
9
12
|
export declare function waitForAccountTransaction<BSName extends string = string>(service: BlockchainService<BSName>, txId: string, account: Account<BSName>, maxAttempts?: number): Promise<boolean>;
|
|
10
13
|
export declare function fetchAccountsForBlockchainServices<BSName extends string = string>(blockchainServices: BlockchainService<BSName>[], getAccountCallback: (service: BlockchainService<BSName>, index: number) => Promise<Account<BSName>>): Promise<Map<BSName, Account<BSName>[]>>;
|
|
11
14
|
export declare function normalizeHash(hash: string): string;
|
|
15
|
+
export declare function denormalizeHash(hash: string): string;
|
|
12
16
|
export declare function countDecimals(value: string | number): number;
|
|
13
17
|
export declare function formatNumber(value: string | number, decimals?: number): string;
|
package/dist/functions.js
CHANGED
|
@@ -9,7 +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.normalizeHash = exports.fetchAccountsForBlockchainServices = exports.waitForAccountTransaction = exports.waitForTransaction = exports.hasLedger = exports.hasExplorerService = exports.hasNft = exports.isCalculableFee = exports.isClaimable = exports.hasNameService = void 0;
|
|
12
|
+
exports.formatNumber = exports.countDecimals = exports.denormalizeHash = exports.normalizeHash = exports.fetchAccountsForBlockchainServices = exports.waitForAccountTransaction = exports.waitForTransaction = exports.hasLedger = exports.hasExplorerService = exports.hasNft = exports.isCalculableFee = exports.isClaimable = exports.hasNameService = void 0;
|
|
13
13
|
function hasNameService(service) {
|
|
14
14
|
return 'resolveNameServiceDomain' in service && 'validateNameServiceDomainFormat' in service;
|
|
15
15
|
}
|
|
@@ -37,6 +37,9 @@ exports.hasLedger = hasLedger;
|
|
|
37
37
|
function wait(ms) {
|
|
38
38
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated use `waitForAccountTransaction` instead
|
|
42
|
+
*/
|
|
40
43
|
function waitForTransaction(service, txId) {
|
|
41
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
45
|
const maxAttempts = 30;
|
|
@@ -112,6 +115,10 @@ function normalizeHash(hash) {
|
|
|
112
115
|
return hash.replace('0x', '').toLowerCase();
|
|
113
116
|
}
|
|
114
117
|
exports.normalizeHash = normalizeHash;
|
|
118
|
+
function denormalizeHash(hash) {
|
|
119
|
+
return hash.startsWith('0x') ? hash : `0x${hash}`;
|
|
120
|
+
}
|
|
121
|
+
exports.denormalizeHash = denormalizeHash;
|
|
115
122
|
function countDecimals(value) {
|
|
116
123
|
var _b;
|
|
117
124
|
const [, decimals] = value.toString().split('.');
|