@cityofzion/bs-neo-legacy 1.5.0 → 1.6.0
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,8 +1,8 @@
|
|
|
1
1
|
import { Account, BDSClaimable, BlockchainDataService, BlockchainService, BSClaimable, ExchangeDataService, Token, Network, TransferParam, BSWithExplorerService, ExplorerService } from '@cityofzion/blockchain-service';
|
|
2
2
|
import { BSNeoLegacyNetworkId } from '../constants/BSNeoLegacyConstants';
|
|
3
|
-
export declare class BSNeoLegacy<
|
|
3
|
+
export declare class BSNeoLegacy<BSName extends string = string> implements BlockchainService<BSName, BSNeoLegacyNetworkId>, BSClaimable<BSName>, BSWithExplorerService {
|
|
4
4
|
#private;
|
|
5
|
-
readonly
|
|
5
|
+
readonly name: BSName;
|
|
6
6
|
readonly bip44DerivationPath: string;
|
|
7
7
|
feeToken: Token;
|
|
8
8
|
claimToken: Token;
|
|
@@ -13,15 +13,15 @@ export declare class BSNeoLegacy<BSCustomName extends string = string> implement
|
|
|
13
13
|
tokens: Token[];
|
|
14
14
|
network: Network<BSNeoLegacyNetworkId>;
|
|
15
15
|
legacyNetwork: string;
|
|
16
|
-
constructor(
|
|
16
|
+
constructor(name: BSName, network?: Network<BSNeoLegacyNetworkId>);
|
|
17
17
|
testNetwork(network: Network<BSNeoLegacyNetworkId>): Promise<void>;
|
|
18
18
|
setNetwork(network: Network<BSNeoLegacyNetworkId>): void;
|
|
19
19
|
validateAddress(address: string): boolean;
|
|
20
20
|
validateEncrypted(key: string): boolean;
|
|
21
21
|
validateKey(key: string): boolean;
|
|
22
|
-
generateAccountFromMnemonic(mnemonic: string[] | string, index: number): Account
|
|
23
|
-
generateAccountFromKey(key: string): Account
|
|
24
|
-
decrypt(encryptedKey: string, password: string): Promise<Account
|
|
22
|
+
generateAccountFromMnemonic(mnemonic: string[] | string, index: number): Account<BSName>;
|
|
23
|
+
generateAccountFromKey(key: string): Account<BSName>;
|
|
24
|
+
decrypt(encryptedKey: string, password: string): Promise<Account<BSName>>;
|
|
25
25
|
encrypt(key: string, password: string): Promise<string>;
|
|
26
26
|
transfer({ intents, senderAccount, tipIntent, ...params }: TransferParam): Promise<string[]>;
|
|
27
27
|
claim(account: Account): Promise<string>;
|
|
@@ -35,10 +35,10 @@ const CryptoCompareEDSNeoLegacy_1 = require("./exchange-data/CryptoCompareEDSNeo
|
|
|
35
35
|
const DoraBDSNeoLegacy_1 = require("./blockchain-data/DoraBDSNeoLegacy");
|
|
36
36
|
const NeoTubeESNeoLegacy_1 = require("./explorer/NeoTubeESNeoLegacy");
|
|
37
37
|
class BSNeoLegacy {
|
|
38
|
-
constructor(
|
|
38
|
+
constructor(name, network) {
|
|
39
39
|
_BSNeoLegacy_instances.add(this);
|
|
40
40
|
network = network !== null && network !== void 0 ? network : BSNeoLegacyConstants_1.BSNeoLegacyConstants.DEFAULT_NETWORK;
|
|
41
|
-
this.
|
|
41
|
+
this.name = name;
|
|
42
42
|
this.legacyNetwork = BSNeoLegacyConstants_1.BSNeoLegacyConstants.LEGACY_NETWORK_BY_NETWORK_ID[network.id];
|
|
43
43
|
this.bip44DerivationPath = BSNeoLegacyConstants_1.BSNeoLegacyConstants.DEFAULT_BIP44_DERIVATION_PATH;
|
|
44
44
|
this.setNetwork(network);
|
|
@@ -73,14 +73,14 @@ class BSNeoLegacy {
|
|
|
73
73
|
const childKey = bs_asteroid_sdk_1.keychain.generateChildKey('neo', bip44Path);
|
|
74
74
|
const key = childKey.getWIF();
|
|
75
75
|
const { address } = new neon_js_1.wallet.Account(key);
|
|
76
|
-
return { address, key, type: 'wif', bip44Path };
|
|
76
|
+
return { address, key, type: 'wif', bip44Path, blockchain: this.name };
|
|
77
77
|
}
|
|
78
78
|
generateAccountFromKey(key) {
|
|
79
79
|
const type = neon_js_1.wallet.isWIF(key) ? 'wif' : neon_js_1.wallet.isPrivateKey(key) ? 'privateKey' : undefined;
|
|
80
80
|
if (!type)
|
|
81
81
|
throw new Error('Invalid key');
|
|
82
82
|
const { address } = new neon_js_1.wallet.Account(key);
|
|
83
|
-
return { address, key, type };
|
|
83
|
+
return { address, key, type, blockchain: this.name };
|
|
84
84
|
}
|
|
85
85
|
decrypt(encryptedKey, password) {
|
|
86
86
|
return __awaiter(this, void 0, void 0, function* () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neo-legacy",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"author": "Coz",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@cityofzion/dora-ts": "0.0.11",
|
|
13
13
|
"@cityofzion/neon-js": "4.8.3",
|
|
14
|
-
"@cityofzion/
|
|
15
|
-
"@cityofzion/
|
|
14
|
+
"@cityofzion/bs-asteroid-sdk": "0.9.0",
|
|
15
|
+
"@cityofzion/blockchain-service": "1.8.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/jest": "29.5.3",
|