@cityofzion/blockchain-service 1.13.0 → 1.13.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.
- package/dist/functions.d.ts +5 -0
- package/dist/functions.js +9 -1
- package/dist/interfaces.d.ts +4 -0
- package/package.json +1 -1
package/dist/functions.d.ts
CHANGED
|
@@ -5,9 +5,14 @@ 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
|
+
export declare function wait(ms: number): Promise<unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated use `waitForAccountTransaction` instead
|
|
11
|
+
*/
|
|
8
12
|
export declare function waitForTransaction<BSName extends string = string>(service: BlockchainService<BSName>, txId: string): Promise<boolean>;
|
|
9
13
|
export declare function waitForAccountTransaction<BSName extends string = string>(service: BlockchainService<BSName>, txId: string, account: Account<BSName>, maxAttempts?: number): Promise<boolean>;
|
|
10
14
|
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
15
|
export declare function normalizeHash(hash: string): string;
|
|
16
|
+
export declare function denormalizeHash(hash: string): string;
|
|
12
17
|
export declare function countDecimals(value: string | number): number;
|
|
13
18
|
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.wait = 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,10 @@ exports.hasLedger = hasLedger;
|
|
|
37
37
|
function wait(ms) {
|
|
38
38
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
39
39
|
}
|
|
40
|
+
exports.wait = wait;
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated use `waitForAccountTransaction` instead
|
|
43
|
+
*/
|
|
40
44
|
function waitForTransaction(service, txId) {
|
|
41
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
46
|
const maxAttempts = 30;
|
|
@@ -112,6 +116,10 @@ function normalizeHash(hash) {
|
|
|
112
116
|
return hash.replace('0x', '').toLowerCase();
|
|
113
117
|
}
|
|
114
118
|
exports.normalizeHash = normalizeHash;
|
|
119
|
+
function denormalizeHash(hash) {
|
|
120
|
+
return hash.startsWith('0x') ? hash : `0x${hash}`;
|
|
121
|
+
}
|
|
122
|
+
exports.denormalizeHash = denormalizeHash;
|
|
115
123
|
function countDecimals(value) {
|
|
116
124
|
var _b;
|
|
117
125
|
const [, decimals] = value.toString().split('.');
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -215,6 +215,8 @@ export interface ExplorerService {
|
|
|
215
215
|
buildTransactionUrl(hash: string): string;
|
|
216
216
|
buildContractUrl(contractHash: string): string;
|
|
217
217
|
buildNftUrl(params: BuildNftUrlParams): string;
|
|
218
|
+
getAddressTemplateUrl(): string | undefined;
|
|
219
|
+
getTxTemplateUrl(): string | undefined;
|
|
218
220
|
}
|
|
219
221
|
export type LedgerServiceEmitter = TypedEmitter<{
|
|
220
222
|
getSignatureStart(): void | Promise<void>;
|
|
@@ -235,6 +237,8 @@ export type SwapServiceToken<BSName extends string = string> = {
|
|
|
235
237
|
name: string;
|
|
236
238
|
hash?: string;
|
|
237
239
|
decimals?: number;
|
|
240
|
+
addressTemplateUrl?: string;
|
|
241
|
+
txTemplateUrl?: string;
|
|
238
242
|
};
|
|
239
243
|
export type SwapServiceLoadableValue<T> = {
|
|
240
244
|
loading: boolean;
|