@cityofzion/bs-neo-legacy 0.4.1 → 0.7.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.
- package/.rush/temp/shrinkwrap-deps.json +2 -2
- package/bs-neo-legacy.build.error.log +2 -82
- package/bs-neo-legacy.build.log +3 -84
- package/dist/BSNeoLegacy.d.ts +23 -13
- package/dist/BSNeoLegacy.js +98 -69
- package/dist/constants.d.ts +5 -2
- package/docs/assets/search.js +1 -1
- package/docs/classes/BDSNeoLegacy.html +13 -13
- package/docs/classes/BSNeoLegacy.html +81 -37
- package/docs/interfaces/DoraNeoLegacyAsset.html +7 -7
- package/docs/interfaces/DoraNeoLegacyAssetResponse.html +9 -9
- package/docs/interfaces/DoraNeoLegacyBalance.html +5 -5
- package/docs/interfaces/DoraNeoLegacyConsensusNode.html +3 -3
- package/docs/interfaces/DoraNeoLegacyDetails.html +12 -12
- package/docs/interfaces/DoraNeoLegacyEntriesEntity.html +8 -8
- package/docs/interfaces/DoraNeoLegacyNameEntity.html +3 -3
- package/docs/interfaces/DoraNeoLegacyScriptsEntity.html +3 -3
- package/docs/interfaces/DoraNeoLegacyTransaction.html +14 -14
- package/docs/interfaces/DoraNeoLegacyTransactionsHistory.html +6 -6
- package/docs/interfaces/DoraNeoLegacyUnclaimed.html +4 -4
- package/docs/interfaces/DoraNeoLegacyVinEntity.html +3 -3
- package/docs/interfaces/DoraNeoLegacyVoutEntity.html +5 -5
- package/docs/variables/DORA_NEO_LEGACY_ASSET.html +1 -1
- package/docs/variables/DORA_NEO_LEGACY_BALANCE.html +1 -1
- package/docs/variables/DORA_NEO_LEGACY_CONTRACT.html +1 -1
- package/docs/variables/DORA_NEO_LEGACY_HISTORY_TRANSACTIONS.html +1 -1
- package/docs/variables/DORA_NEO_LEGACY_NODES.html +1 -1
- package/docs/variables/DORA_NEO_LEGACY_TRANSACTION.html +1 -1
- package/docs/variables/DORA_NEO_LEGACY_UNCLAIMED.html +1 -1
- package/docs/variables/explorerNeoLegacyOption.html +1 -1
- package/jest.config.ts +13 -0
- package/jest.setup.ts +1 -0
- package/package.json +10 -6
- package/src/BSNeoLegacy.ts +184 -152
- package/src/CryptoCompareEDSNeoLegacy.ts +40 -0
- package/src/DoraBDSNeoLegacy.ts +171 -0
- package/src/__tests__/BDSNeoLegacy.spec.ts +120 -0
- package/src/__tests__/BSNeoLegacy.spec.ts +127 -0
- package/src/__tests__/CryptoCompareExchange.spec.ts +46 -0
- package/src/assets/tokens/common.json +18 -0
- package/src/assets/tokens/mainnet.json +620 -0
- package/src/constants.ts +20 -17
- package/src/index.ts +3 -2
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +3 -7
- package/src/BDSNeoLegacy.ts +0 -163
- package/src/asset/blockchain_icon_neo_legacy.png +0 -0
- package/src/asset/blockchain_icon_neo_legacy_white.png +0 -0
- package/src/asset/tokens.json +0 -481
- package/src/explorer/dora/DoraResponsesNeoLegacy.ts +0 -107
- package/src/explorer/dora/DoraRoutesNeoLegacy.ts +0 -7
- package/src/explorer/index.ts +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"../../packages/bs-neo-legacy": "../../packages/bs-neo-legacy:
|
|
3
|
-
"/@cityofzion/blockchain-service/0.3.
|
|
2
|
+
"../../packages/bs-neo-legacy": "../../packages/bs-neo-legacy:IOE6x0Jg1o1QcNEwF2rtSNHgOZi7/+bAniT1hAF6CJI=:",
|
|
3
|
+
"/@cityofzion/blockchain-service/0.3.0": "sha512-Qe/lVI8tCAAVZZNeBglZEFrqS9khjihc5jkiiEobi6CY4l1z6uFj/xSGQ7Nnz2QlTNQ8DjUqN05iDjKuy+4LLA==",
|
|
4
4
|
"/@cityofzion/dora-ts/0.0.11": "sha512-LJWGU29BHPTHkt0i/OwhNdMfUGM/rgAa4rqlDwBy95spxSoUHGSoAtOD5k4aSVKmLFwq77ghNna0Lpc7lEuHBA==",
|
|
5
5
|
"/@cityofzion/neon-api/4.9.0_@cityofzion+neon-core@4.9.0": "sha512-8eN3N3sGgd4L7qFaFATKr94kA/65626eo6hB7fHL+S8OGCVCrrl3tfh8GAOv50vLxd2YyoDu9pBY/0NPKY8tsQ==",
|
|
6
6
|
"/@cityofzion/neon-core/4.9.0": "sha512-z4UgEIjAS9E2QP6HSTzri02DFY++nYmfzbspi1818mvnTst6Lf8bDNYYxG/686wdYN2dEF3RuccMXraw2Bm31g==",
|
|
@@ -1,84 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
./src/BSNeoLegacy.ts:87:8 - warning TransactionIntentResponse is referenced by BSNeoLegacy.setTypeIntents.setTypeIntents but not included in the documentation.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:137:0 - warning BDSClaimable is referenced by BDSNeoLegacy but not included in the documentation.
|
|
6
|
-
|
|
7
|
-
137 export interface BDSClaimable {
|
|
8
|
-
|
|
9
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:60:0 - warning BlockchainService is referenced by BSNeoLegacy but not included in the documentation.
|
|
10
|
-
|
|
11
|
-
60 export interface BlockchainService<BSCustomName extends string = string> {
|
|
12
|
-
|
|
13
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:30:0 - warning Claimable is referenced by BSNeoLegacy but not included in the documentation.
|
|
14
|
-
|
|
15
|
-
30 export interface Claimable {
|
|
16
|
-
|
|
17
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:126:0 - warning BlockchainNetwork is referenced by BDSNeoLegacy.network but not included in the documentation.
|
|
18
|
-
|
|
19
|
-
126 export type BlockchainNetwork = "mainnet" | "testnet" | "privatenet";
|
|
20
|
-
|
|
21
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:156:0 - warning Exchange is referenced by BSNeoLegacy.exchange but not included in the documentation.
|
|
22
|
-
|
|
23
|
-
156 export interface Exchange {
|
|
24
|
-
|
|
25
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:11:0 - warning TokenInfo is referenced by BSNeoLegacy.feeToken but not included in the documentation.
|
|
26
|
-
|
|
27
|
-
11 export type TokenInfo = {
|
|
28
|
-
|
|
29
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:46:0 - warning Token is referenced by BSNeoLegacy.tokens but not included in the documentation.
|
|
30
|
-
|
|
31
|
-
46 export type Token = {
|
|
32
|
-
|
|
33
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:118:0 - warning ConsensusNodeResponse is referenced by BDSNeoLegacy.getAllNodes.getAllNodes but not included in the documentation.
|
|
34
|
-
|
|
35
|
-
118 export type ConsensusNodeResponse = {
|
|
36
|
-
|
|
37
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:127:0 - warning BalanceResponse is referenced by BDSNeoLegacy.getBalance.getBalance but not included in the documentation.
|
|
38
|
-
|
|
39
|
-
127 export type BalanceResponse = {
|
|
40
|
-
|
|
41
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:113:0 - warning ContractResponse is referenced by BDSNeoLegacy.getContract.getContract but not included in the documentation.
|
|
42
|
-
|
|
43
|
-
113 export type ContractResponse = {
|
|
44
|
-
|
|
45
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:105:0 - warning TransactionHistoryResponse is referenced by BDSNeoLegacy.getHistoryTransactions.getHistoryTransactions but not included in the documentation.
|
|
46
|
-
|
|
47
|
-
105 export type TransactionHistoryResponse = {
|
|
48
|
-
|
|
49
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:122:0 - warning TokenInfoResponse is referenced by BDSNeoLegacy.getTokenInfo.getTokenInfo but not included in the documentation.
|
|
50
|
-
|
|
51
|
-
122 export type TokenInfoResponse = {
|
|
52
|
-
|
|
53
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:84:0 - warning TransactionResponse is referenced by BDSNeoLegacy.getTransaction.getTransaction but not included in the documentation.
|
|
54
|
-
|
|
55
|
-
84 export type TransactionResponse = {
|
|
56
|
-
|
|
57
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:133:0 - warning UnclaimedResponse is referenced by BDSNeoLegacy.getUnclaimed.getUnclaimed but not included in the documentation.
|
|
58
|
-
|
|
59
|
-
133 export type UnclaimedResponse = {
|
|
60
|
-
|
|
61
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:56:0 - warning CalculateTransferFeeResponse is referenced by BSNeoLegacy.calculateTransferFee.calculateTransferFee but not included in the documentation.
|
|
62
|
-
|
|
63
|
-
56 export type CalculateTransferFeeResponse = {
|
|
64
|
-
|
|
65
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:25:0 - warning ClaimResponse is referenced by BSNeoLegacy.claim.claim but not included in the documentation.
|
|
66
|
-
|
|
67
|
-
25 export type ClaimResponse = {
|
|
68
|
-
|
|
69
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:52:0 - warning Account is referenced by BSNeoLegacy.decryptKey.decryptKey but not included in the documentation.
|
|
70
|
-
|
|
71
|
-
52 export type Account = {
|
|
72
|
-
|
|
73
|
-
./src/BSNeoLegacy.ts:149:8 - warning TransactionIntentResponse is referenced by BSNeoLegacy.setTypeIntents.setTypeIntents but not included in the documentation.
|
|
74
|
-
|
|
75
|
-
149 type TransactionIntentResponse = IntentTransactionParam & { type: 'native' | 'nep5' }
|
|
76
|
-
|
|
77
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:6:0 - warning IntentTransactionParam is referenced by BSNeoLegacy.buildNativeTransaction.buildNativeTransaction.transactionIntents but not included in the documentation.
|
|
78
|
-
|
|
79
|
-
6 export type IntentTransactionParam = {
|
|
80
|
-
|
|
81
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:1:0 - warning SendTransactionParam is referenced by BSNeoLegacy.sendTransaction.sendTransaction.param but not included in the documentation.
|
|
82
|
-
|
|
83
|
-
1 export type SendTransactionParam = {
|
|
3
|
+
87 type TransactionIntentResponse = IntentTransactionParam & { type: 'native' | 'nep5' }
|
|
84
4
|
|
package/bs-neo-legacy.build.log
CHANGED
|
@@ -1,87 +1,6 @@
|
|
|
1
|
-
Invoking: tsc && typedoc
|
|
1
|
+
Invoking: tsc && typedoc src/index.ts
|
|
2
|
+
./src/BSNeoLegacy.ts:87:8 - warning TransactionIntentResponse is referenced by BSNeoLegacy.setTypeIntents.setTypeIntents but not included in the documentation.
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
140 export interface BlockchainDataService {
|
|
6
|
-
|
|
7
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:137:0 - warning BDSClaimable is referenced by BDSNeoLegacy but not included in the documentation.
|
|
8
|
-
|
|
9
|
-
137 export interface BDSClaimable {
|
|
10
|
-
|
|
11
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:60:0 - warning BlockchainService is referenced by BSNeoLegacy but not included in the documentation.
|
|
12
|
-
|
|
13
|
-
60 export interface BlockchainService<BSCustomName extends string = string> {
|
|
14
|
-
|
|
15
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:30:0 - warning Claimable is referenced by BSNeoLegacy but not included in the documentation.
|
|
16
|
-
|
|
17
|
-
30 export interface Claimable {
|
|
18
|
-
|
|
19
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:126:0 - warning BlockchainNetwork is referenced by BDSNeoLegacy.network but not included in the documentation.
|
|
20
|
-
|
|
21
|
-
126 export type BlockchainNetwork = "mainnet" | "testnet" | "privatenet";
|
|
22
|
-
|
|
23
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:156:0 - warning Exchange is referenced by BSNeoLegacy.exchange but not included in the documentation.
|
|
24
|
-
|
|
25
|
-
156 export interface Exchange {
|
|
26
|
-
|
|
27
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:11:0 - warning TokenInfo is referenced by BSNeoLegacy.feeToken but not included in the documentation.
|
|
28
|
-
|
|
29
|
-
11 export type TokenInfo = {
|
|
30
|
-
|
|
31
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:46:0 - warning Token is referenced by BSNeoLegacy.tokens but not included in the documentation.
|
|
32
|
-
|
|
33
|
-
46 export type Token = {
|
|
34
|
-
|
|
35
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:118:0 - warning ConsensusNodeResponse is referenced by BDSNeoLegacy.getAllNodes.getAllNodes but not included in the documentation.
|
|
36
|
-
|
|
37
|
-
118 export type ConsensusNodeResponse = {
|
|
38
|
-
|
|
39
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:127:0 - warning BalanceResponse is referenced by BDSNeoLegacy.getBalance.getBalance but not included in the documentation.
|
|
40
|
-
|
|
41
|
-
127 export type BalanceResponse = {
|
|
42
|
-
|
|
43
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:113:0 - warning ContractResponse is referenced by BDSNeoLegacy.getContract.getContract but not included in the documentation.
|
|
44
|
-
|
|
45
|
-
113 export type ContractResponse = {
|
|
46
|
-
|
|
47
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:105:0 - warning TransactionHistoryResponse is referenced by BDSNeoLegacy.getHistoryTransactions.getHistoryTransactions but not included in the documentation.
|
|
48
|
-
|
|
49
|
-
105 export type TransactionHistoryResponse = {
|
|
50
|
-
|
|
51
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:122:0 - warning TokenInfoResponse is referenced by BDSNeoLegacy.getTokenInfo.getTokenInfo but not included in the documentation.
|
|
52
|
-
|
|
53
|
-
122 export type TokenInfoResponse = {
|
|
54
|
-
|
|
55
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:84:0 - warning TransactionResponse is referenced by BDSNeoLegacy.getTransaction.getTransaction but not included in the documentation.
|
|
56
|
-
|
|
57
|
-
84 export type TransactionResponse = {
|
|
58
|
-
|
|
59
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:133:0 - warning UnclaimedResponse is referenced by BDSNeoLegacy.getUnclaimed.getUnclaimed but not included in the documentation.
|
|
60
|
-
|
|
61
|
-
133 export type UnclaimedResponse = {
|
|
62
|
-
|
|
63
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:56:0 - warning CalculateTransferFeeResponse is referenced by BSNeoLegacy.calculateTransferFee.calculateTransferFee but not included in the documentation.
|
|
64
|
-
|
|
65
|
-
56 export type CalculateTransferFeeResponse = {
|
|
66
|
-
|
|
67
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:25:0 - warning ClaimResponse is referenced by BSNeoLegacy.claim.claim but not included in the documentation.
|
|
68
|
-
|
|
69
|
-
25 export type ClaimResponse = {
|
|
70
|
-
|
|
71
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:52:0 - warning Account is referenced by BSNeoLegacy.decryptKey.decryptKey but not included in the documentation.
|
|
72
|
-
|
|
73
|
-
52 export type Account = {
|
|
74
|
-
|
|
75
|
-
./src/BSNeoLegacy.ts:149:8 - warning TransactionIntentResponse is referenced by BSNeoLegacy.setTypeIntents.setTypeIntents but not included in the documentation.
|
|
76
|
-
|
|
77
|
-
149 type TransactionIntentResponse = IntentTransactionParam & { type: 'native' | 'nep5' }
|
|
78
|
-
|
|
79
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:6:0 - warning IntentTransactionParam is referenced by BSNeoLegacy.buildNativeTransaction.buildNativeTransaction.transactionIntents but not included in the documentation.
|
|
80
|
-
|
|
81
|
-
6 export type IntentTransactionParam = {
|
|
82
|
-
|
|
83
|
-
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:1:0 - warning SendTransactionParam is referenced by BSNeoLegacy.sendTransaction.sendTransaction.param but not included in the documentation.
|
|
84
|
-
|
|
85
|
-
1 export type SendTransactionParam = {
|
|
4
|
+
87 type TransactionIntentResponse = IntentTransactionParam & { type: 'native' | 'nep5' }
|
|
86
5
|
|
|
87
6
|
Documentation generated at ./docs
|
package/dist/BSNeoLegacy.d.ts
CHANGED
|
@@ -1,26 +1,36 @@
|
|
|
1
|
-
import { Account, BDSClaimable, BlockchainDataService, BlockchainService, CalculateTransferFeeResponse, ClaimResponse, Claimable, Exchange, SendTransactionParam, Token
|
|
1
|
+
import { Account, BDSClaimable, BlockchainDataService, BlockchainService, CalculateTransferFeeResponse, ClaimResponse, Claimable, Exchange, SendTransactionParam, Token } from '@cityofzion/blockchain-service';
|
|
2
2
|
export declare class BSNeoLegacy<BSCustomName extends string = string> implements BlockchainService, Claimable {
|
|
3
3
|
dataService: BlockchainDataService & BDSClaimable;
|
|
4
4
|
blockchainName: BSCustomName;
|
|
5
|
-
|
|
5
|
+
derivationPath: string;
|
|
6
|
+
feeToken: {
|
|
7
|
+
hash: string;
|
|
8
|
+
symbol: string;
|
|
9
|
+
decimals: number;
|
|
10
|
+
};
|
|
6
11
|
exchange: Exchange;
|
|
7
|
-
tokenClaim:
|
|
12
|
+
tokenClaim: {
|
|
13
|
+
hash: string;
|
|
14
|
+
symbol: string;
|
|
15
|
+
decimals: number;
|
|
16
|
+
};
|
|
8
17
|
tokens: Token[];
|
|
18
|
+
private keychain;
|
|
9
19
|
private nativeAssets;
|
|
10
|
-
private derivationPath;
|
|
11
20
|
constructor(blockchainName: BSCustomName);
|
|
12
|
-
validateAddress(address: string): boolean;
|
|
13
|
-
validateEncryptedKey(encryptedKey: string): boolean;
|
|
14
|
-
validateWif(wif: string): boolean;
|
|
15
|
-
generateMnemonic(): string[];
|
|
16
|
-
generateAccount(mnemonic: string[], index: number): Account;
|
|
17
|
-
generateAccountFromWif(wif: string): Account;
|
|
18
|
-
decryptKey(encryptedKey: string, password: string): Promise<Account>;
|
|
19
|
-
calculateTransferFee(): Promise<CalculateTransferFeeResponse>;
|
|
20
21
|
sendTransaction(param: SendTransactionParam): Promise<string>;
|
|
21
|
-
claim(account: Account): Promise<ClaimResponse>;
|
|
22
22
|
private buildNativeTransaction;
|
|
23
23
|
private buildNep5Transaction;
|
|
24
24
|
private setTypeIntents;
|
|
25
25
|
private isNativeTransaction;
|
|
26
|
+
generateMnemonic(): string;
|
|
27
|
+
generateWif(mnemonic: string, index: number): string;
|
|
28
|
+
generateAccount(mnemonic: string, index: number): Account;
|
|
29
|
+
generateAccountFromWif(wif: string): string;
|
|
30
|
+
decryptKey(encryptedKey: string, password: string): Promise<Account>;
|
|
31
|
+
validateAddress(address: string): boolean;
|
|
32
|
+
validateEncryptedKey(encryptedKey: string): boolean;
|
|
33
|
+
validateWif(wif: string): boolean;
|
|
34
|
+
calculateTransferFee(): Promise<CalculateTransferFeeResponse>;
|
|
35
|
+
claim(account: Account): Promise<ClaimResponse>;
|
|
26
36
|
}
|
package/dist/BSNeoLegacy.js
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -24,58 +47,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
47
|
};
|
|
25
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
49
|
exports.BSNeoLegacy = void 0;
|
|
27
|
-
const
|
|
50
|
+
const AsteroidSDK = __importStar(require("@moonlight-io/asteroid-sdk-js"));
|
|
28
51
|
const neon_js_1 = require("@cityofzion/neon-js");
|
|
29
52
|
const explorer_1 = require("./explorer");
|
|
30
53
|
const constants_1 = require("./constants");
|
|
31
|
-
const [, neoToken] = constants_1.nativeAssetsNeoLegacy;
|
|
54
|
+
const [gasToken, neoToken] = constants_1.nativeAssetsNeoLegacy;
|
|
32
55
|
const tokens_json_1 = __importDefault(require("./asset/tokens.json"));
|
|
33
56
|
class BSNeoLegacy {
|
|
34
57
|
constructor(blockchainName) {
|
|
35
58
|
this.dataService = explorer_1.explorerNeoLegacyOption.dora;
|
|
59
|
+
this.derivationPath = "m/44'/888'/0'/0/?";
|
|
36
60
|
this.tokenClaim = neoToken;
|
|
37
61
|
this.tokens = tokens_json_1.default;
|
|
62
|
+
this.keychain = new AsteroidSDK.Keychain();
|
|
38
63
|
this.nativeAssets = constants_1.nativeAssetsNeoLegacy;
|
|
39
|
-
this.derivationPath = "m/44'/888'/0'/0/?";
|
|
40
64
|
this.blockchainName = blockchainName;
|
|
41
65
|
}
|
|
42
|
-
validateAddress(address) {
|
|
43
|
-
return neon_js_1.wallet.isAddress(address);
|
|
44
|
-
}
|
|
45
|
-
validateEncryptedKey(encryptedKey) {
|
|
46
|
-
return neon_js_1.wallet.isNEP2(encryptedKey);
|
|
47
|
-
}
|
|
48
|
-
validateWif(wif) {
|
|
49
|
-
return neon_js_1.wallet.isWIF(wif);
|
|
50
|
-
}
|
|
51
|
-
generateMnemonic() {
|
|
52
|
-
blockchain_service_1.keychain.generateMnemonic(128);
|
|
53
|
-
if (!blockchain_service_1.keychain.mnemonic)
|
|
54
|
-
throw new Error("Failed to generate mnemonic");
|
|
55
|
-
return blockchain_service_1.keychain.mnemonic.toString().split(' ');
|
|
56
|
-
}
|
|
57
|
-
generateAccount(mnemonic, index) {
|
|
58
|
-
blockchain_service_1.keychain.importMnemonic(mnemonic.join(' '));
|
|
59
|
-
const childKey = blockchain_service_1.keychain.generateChildKey("neo", this.derivationPath.replace('?', index.toString()));
|
|
60
|
-
const wif = childKey.getWIF();
|
|
61
|
-
const { address } = new neon_js_1.wallet.Account(wif);
|
|
62
|
-
return { address, wif };
|
|
63
|
-
}
|
|
64
|
-
generateAccountFromWif(wif) {
|
|
65
|
-
const { address } = new neon_js_1.wallet.Account(wif);
|
|
66
|
-
return { address, wif };
|
|
67
|
-
}
|
|
68
|
-
decryptKey(encryptedKey, password) {
|
|
69
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const wif = yield neon_js_1.wallet.decrypt(encryptedKey, password);
|
|
71
|
-
const { address } = new neon_js_1.wallet.Account(wif);
|
|
72
|
-
const result = { address, wif };
|
|
73
|
-
return result;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
calculateTransferFee() {
|
|
77
|
-
throw new Error(`Doesn't have fee to make a transaction on ${this.blockchainName}`);
|
|
78
|
-
}
|
|
79
66
|
sendTransaction(param) {
|
|
80
67
|
var _a;
|
|
81
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -120,35 +107,6 @@ class BSNeoLegacy {
|
|
|
120
107
|
return result.tx.hash;
|
|
121
108
|
});
|
|
122
109
|
}
|
|
123
|
-
//Implementation Claim interface
|
|
124
|
-
claim(account) {
|
|
125
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
-
const neoAccount = new neon_js_1.wallet.Account(account.wif);
|
|
127
|
-
const balances = yield this.dataService.getBalance(account.address);
|
|
128
|
-
const neoBalance = balances.find(balance => balance.symbol === 'NEO');
|
|
129
|
-
const apiProvider = new neon_js_1.api.neoscan.instance("MainNet");
|
|
130
|
-
const neoNativeAsset = this.nativeAssets.find(nativeAsset => nativeAsset.symbol === (neoBalance === null || neoBalance === void 0 ? void 0 : neoBalance.symbol));
|
|
131
|
-
if (!neoNativeAsset || !neoBalance)
|
|
132
|
-
throw new Error("Neo it's necessary to do a claim");
|
|
133
|
-
const hasClaim = yield this.dataService.getUnclaimed(account.address);
|
|
134
|
-
if (hasClaim.unclaimed <= 0)
|
|
135
|
-
throw new Error(`Doesn't have gas to claim`);
|
|
136
|
-
const url = (yield this.dataService.getHigherNode()).url;
|
|
137
|
-
const claims = yield neon_js_1.api.neoCli.getClaims(url, account.address);
|
|
138
|
-
const claimGasResponse = yield neon_js_1.api.claimGas({
|
|
139
|
-
claims,
|
|
140
|
-
api: apiProvider,
|
|
141
|
-
account: neoAccount,
|
|
142
|
-
url
|
|
143
|
-
});
|
|
144
|
-
const result = {
|
|
145
|
-
txid: claimGasResponse.response.txid,
|
|
146
|
-
hash: constants_1.unclaimedTokenNeoLegacy.hash,
|
|
147
|
-
symbol: constants_1.unclaimedTokenNeoLegacy.symbol
|
|
148
|
-
};
|
|
149
|
-
return result;
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
110
|
buildNativeTransaction(transactionIntents) {
|
|
153
111
|
let intents = [];
|
|
154
112
|
transactionIntents.forEach(transaction => {
|
|
@@ -184,5 +142,76 @@ class BSNeoLegacy {
|
|
|
184
142
|
isNativeTransaction(transactionParam) {
|
|
185
143
|
return this.nativeAssets.some(asset => asset.hash === transactionParam.tokenHash);
|
|
186
144
|
}
|
|
145
|
+
generateMnemonic() {
|
|
146
|
+
var _a;
|
|
147
|
+
this.keychain.generateMnemonic(128);
|
|
148
|
+
const list = (_a = this.keychain.mnemonic) === null || _a === void 0 ? void 0 : _a.toString();
|
|
149
|
+
if (!list)
|
|
150
|
+
throw new Error("Failed to generate mnemonic");
|
|
151
|
+
return list;
|
|
152
|
+
}
|
|
153
|
+
generateWif(mnemonic, index) {
|
|
154
|
+
this.keychain.importMnemonic(mnemonic);
|
|
155
|
+
const childKey = this.keychain.generateChildKey('neo', this.derivationPath.replace('?', index.toString()));
|
|
156
|
+
return childKey.getWIF();
|
|
157
|
+
}
|
|
158
|
+
generateAccount(mnemonic, index) {
|
|
159
|
+
const wif = this.generateWif(mnemonic, index);
|
|
160
|
+
const { address } = new neon_js_1.wallet.Account(wif);
|
|
161
|
+
const result = { address, wif };
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
164
|
+
generateAccountFromWif(wif) {
|
|
165
|
+
return new neon_js_1.wallet.Account(wif).address;
|
|
166
|
+
}
|
|
167
|
+
decryptKey(encryptedKey, password) {
|
|
168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
const wif = yield neon_js_1.wallet.decrypt(encryptedKey, password);
|
|
170
|
+
const { address } = new neon_js_1.wallet.Account(wif);
|
|
171
|
+
const result = { address, wif };
|
|
172
|
+
return result;
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
validateAddress(address) {
|
|
176
|
+
return neon_js_1.wallet.isAddress(address);
|
|
177
|
+
}
|
|
178
|
+
validateEncryptedKey(encryptedKey) {
|
|
179
|
+
return neon_js_1.wallet.isNEP2(encryptedKey);
|
|
180
|
+
}
|
|
181
|
+
validateWif(wif) {
|
|
182
|
+
return neon_js_1.wallet.isWIF(wif);
|
|
183
|
+
}
|
|
184
|
+
calculateTransferFee() {
|
|
185
|
+
throw new Error(`Doesn't have fee to make a transaction on ${this.blockchainName}`);
|
|
186
|
+
}
|
|
187
|
+
//Implementation Claim interface
|
|
188
|
+
claim(account) {
|
|
189
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
+
const neoAccount = new neon_js_1.wallet.Account(account.wif);
|
|
191
|
+
const balances = yield this.dataService.getBalance(account.address);
|
|
192
|
+
const neoBalance = balances.find(balance => balance.symbol === 'NEO');
|
|
193
|
+
const apiProvider = new neon_js_1.api.neoscan.instance("MainNet");
|
|
194
|
+
const neoNativeAsset = this.nativeAssets.find(nativeAsset => nativeAsset.symbol === (neoBalance === null || neoBalance === void 0 ? void 0 : neoBalance.symbol));
|
|
195
|
+
if (!neoNativeAsset || !neoBalance)
|
|
196
|
+
throw new Error("Neo it's necessary to do a claim");
|
|
197
|
+
const hasClaim = yield this.dataService.getUnclaimed(account.address);
|
|
198
|
+
if (hasClaim.unclaimed <= 0)
|
|
199
|
+
throw new Error(`Doesn't have gas to claim`);
|
|
200
|
+
const url = (yield this.dataService.getHigherNode()).url;
|
|
201
|
+
const claims = yield neon_js_1.api.neoCli.getClaims(url, account.address);
|
|
202
|
+
const claimGasResponse = yield neon_js_1.api.claimGas({
|
|
203
|
+
claims,
|
|
204
|
+
api: apiProvider,
|
|
205
|
+
account: neoAccount,
|
|
206
|
+
url
|
|
207
|
+
});
|
|
208
|
+
const result = {
|
|
209
|
+
txid: claimGasResponse.response.txid,
|
|
210
|
+
hash: constants_1.unclaimedTokenNeoLegacy.hash,
|
|
211
|
+
symbol: constants_1.unclaimedTokenNeoLegacy.symbol
|
|
212
|
+
};
|
|
213
|
+
return result;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
187
216
|
}
|
|
188
217
|
exports.BSNeoLegacy = BSNeoLegacy;
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { TokenInfo } from "@cityofzion/blockchain-service";
|
|
2
1
|
export declare const unclaimedTokenNeoLegacy: {
|
|
3
2
|
symbol: string;
|
|
4
3
|
name: string;
|
|
5
4
|
hash: string;
|
|
6
5
|
};
|
|
7
|
-
export declare const nativeAssetsNeoLegacy:
|
|
6
|
+
export declare const nativeAssetsNeoLegacy: {
|
|
7
|
+
symbol: string;
|
|
8
|
+
hash: string;
|
|
9
|
+
decimals: number;
|
|
10
|
+
}[];
|