@cityofzion/blockchain-service 1.0.1 → 1.0.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,5 +1,5 @@
1
1
  import { AccountWithDerivationPath, BlockchainService } from './interfaces';
2
- export declare class BSAggregator<BSCustomName extends string = string, BSCustom extends BlockchainService<BSCustomName> = BlockchainService<BSCustomName>> {
2
+ export declare class BSAggregator<BSCustomName extends string = string, BSCustom extends BlockchainService<BSCustomName, string> = BlockchainService<BSCustomName, string>> {
3
3
  #private;
4
4
  readonly blockchainServicesByName: Record<BSCustomName, BSCustom>;
5
5
  constructor(blockchainServices: Record<BSCustomName, BSCustom>);
@@ -8,8 +8,8 @@ export declare class BSAggregator<BSCustomName extends string = string, BSCustom
8
8
  validateTextAllBlockchains(text: string): boolean;
9
9
  validateKeyAllBlockchains(wif: string): boolean;
10
10
  validateEncryptedAllBlockchains(keyOrJson: string): boolean;
11
- getBlockchainNameByAddress(address: string): BSCustomName | undefined;
12
- getBlockchainNameByKey(wif: string): BSCustomName | undefined;
13
- getBlockchainNameByEncrypted(keyOrJson: string): BSCustomName | undefined;
11
+ getBlockchainNameByAddress(address: string): BSCustomName[];
12
+ getBlockchainNameByKey(wif: string): BSCustomName[];
13
+ getBlockchainNameByEncrypted(keyOrJson: string): BSCustomName[];
14
14
  generateAccountFromMnemonicAllBlockchains(mnemonic: string, skippedAddresses?: string[]): Promise<Map<BSCustomName, AccountWithDerivationPath[]>>;
15
15
  }
@@ -47,16 +47,13 @@ class BSAggregator {
47
47
  return __classPrivateFieldGet(this, _BSAggregator_blockchainServices, "f").some(bs => bs.validateEncrypted(keyOrJson));
48
48
  }
49
49
  getBlockchainNameByAddress(address) {
50
- var _a;
51
- return (_a = __classPrivateFieldGet(this, _BSAggregator_blockchainServices, "f").find(bs => bs.validateAddress(address))) === null || _a === void 0 ? void 0 : _a.blockchainName;
50
+ return __classPrivateFieldGet(this, _BSAggregator_blockchainServices, "f").filter(bs => bs.validateAddress(address)).map(bs => bs.blockchainName);
52
51
  }
53
52
  getBlockchainNameByKey(wif) {
54
- var _a;
55
- return (_a = __classPrivateFieldGet(this, _BSAggregator_blockchainServices, "f").find(bs => bs.validateKey(wif))) === null || _a === void 0 ? void 0 : _a.blockchainName;
53
+ return __classPrivateFieldGet(this, _BSAggregator_blockchainServices, "f").filter(bs => bs.validateKey(wif)).map(bs => bs.blockchainName);
56
54
  }
57
55
  getBlockchainNameByEncrypted(keyOrJson) {
58
- var _a;
59
- return (_a = __classPrivateFieldGet(this, _BSAggregator_blockchainServices, "f").find(bs => bs.validateEncrypted(keyOrJson))) === null || _a === void 0 ? void 0 : _a.blockchainName;
56
+ return __classPrivateFieldGet(this, _BSAggregator_blockchainServices, "f").filter(bs => bs.validateEncrypted(keyOrJson)).map(bs => bs.blockchainName);
60
57
  }
61
58
  generateAccountFromMnemonicAllBlockchains(mnemonic, skippedAddresses) {
62
59
  return __awaiter(this, void 0, void 0, function* () {
@@ -14,8 +14,9 @@ export interface Token {
14
14
  hash: string;
15
15
  decimals: number;
16
16
  }
17
+ export type NetworkId<T extends string = string> = T | (string & {});
17
18
  export type Network<T extends string = string> = {
18
- id: T;
19
+ id: NetworkId<T>;
19
20
  name: string;
20
21
  url: string;
21
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/blockchain-service",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": "https://github.com/CityOfZion/blockchain-services",