@cityofzion/bs-neo3 0.3.2 → 0.4.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/bs-neo3.build.error.log +84 -0
- package/bs-neo3.build.log +86 -1
- package/dist/BSNeo3.d.ts +12 -22
- package/dist/BSNeo3.js +55 -85
- package/dist/constants.d.ts +3 -10
- package/docs/assets/search.js +1 -1
- package/docs/classes/BDSNeo3.html +13 -13
- package/docs/classes/BSNeo3.html +36 -80
- package/docs/interfaces/DoraNeo3Abi.html +6 -6
- package/docs/interfaces/DoraNeo3Asset.html +9 -9
- package/docs/interfaces/DoraNeo3AssetState.html +6 -6
- package/docs/interfaces/DoraNeo3Balance.html +5 -5
- package/docs/interfaces/DoraNeo3ConsensusNode.html +3 -3
- package/docs/interfaces/DoraNeo3Contract.html +8 -8
- package/docs/interfaces/DoraNeo3Event.html +3 -3
- package/docs/interfaces/DoraNeo3Features.html +1 -1
- package/docs/interfaces/DoraNeo3HistoryState.html +3 -3
- package/docs/interfaces/DoraNeo3Invocation.html +3 -3
- package/docs/interfaces/DoraNeo3Item.html +11 -11
- package/docs/interfaces/DoraNeo3Manifest.html +9 -9
- package/docs/interfaces/DoraNeo3Metadata.html +12 -12
- package/docs/interfaces/DoraNeo3Method.html +12 -12
- package/docs/interfaces/DoraNeo3Nef.html +7 -7
- package/docs/interfaces/DoraNeo3Notification.html +4 -4
- package/docs/interfaces/DoraNeo3Parameter.html +3 -3
- package/docs/interfaces/DoraNeo3Permission.html +3 -3
- package/docs/interfaces/DoraNeo3Signer.html +3 -3
- package/docs/interfaces/DoraNeo3Token.html +6 -6
- package/docs/interfaces/DoraNeo3Transaction.html +16 -16
- package/docs/interfaces/DoraNeo3TransactionHistory.html +3 -3
- package/docs/interfaces/DoraNeo3Transfer.html +9 -9
- package/docs/interfaces/DoraNeo3Witness.html +3 -3
- package/docs/variables/DORA_ASSET.html +1 -1
- package/docs/variables/DORA_BALANCE.html +1 -1
- package/docs/variables/DORA_CONTRACT.html +1 -1
- package/docs/variables/DORA_NODES.html +1 -1
- package/docs/variables/DORA_TRANSACTION.html +1 -1
- package/docs/variables/DORA_TRANSACTIONS.html +1 -1
- package/docs/variables/explorerOptions.html +1 -1
- package/docs/variables/gasInfoNeo3.html +2 -11
- package/docs/variables/neoInfoNeo3.html +2 -11
- package/package.json +3 -5
- package/src/BSNeo3.ts +59 -64
- package/src/constants.ts +4 -2
- package/tsconfig.json +6 -1
- package/.rush/temp/package-deps_build.json +0 -20
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:140:0 - warning BlockchainDataService is referenced by BDSNeo3 but not included in the documentation.
|
|
2
|
+
|
|
3
|
+
140 export interface BlockchainDataService {
|
|
4
|
+
|
|
5
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:137:0 - warning BDSClaimable is referenced by BDSNeo3 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 BSNeo3 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 BSNeo3 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:41:0 - warning NeoNameService is referenced by BSNeo3 but not included in the documentation.
|
|
18
|
+
|
|
19
|
+
41 export interface NeoNameService {
|
|
20
|
+
|
|
21
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:11:0 - warning TokenInfo is referenced by gasInfoNeo3 but not included in the documentation.
|
|
22
|
+
|
|
23
|
+
11 export type TokenInfo = {
|
|
24
|
+
|
|
25
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:126:0 - warning BlockchainNetwork is referenced by BDSNeo3.network but not included in the documentation.
|
|
26
|
+
|
|
27
|
+
126 export type BlockchainNetwork = "mainnet" | "testnet" | "privatenet";
|
|
28
|
+
|
|
29
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:156:0 - warning Exchange is referenced by BSNeo3.exchange but not included in the documentation.
|
|
30
|
+
|
|
31
|
+
156 export interface Exchange {
|
|
32
|
+
|
|
33
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:46:0 - warning Token is referenced by BSNeo3.tokens but not included in the documentation.
|
|
34
|
+
|
|
35
|
+
46 export type Token = {
|
|
36
|
+
|
|
37
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:84:0 - warning TransactionResponse is referenced by BDSNeo3.findTransactionByTxid.findTransactionByTxid but not included in the documentation.
|
|
38
|
+
|
|
39
|
+
84 export type TransactionResponse = {
|
|
40
|
+
|
|
41
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:118:0 - warning ConsensusNodeResponse is referenced by BDSNeo3.getAllNodes.getAllNodes but not included in the documentation.
|
|
42
|
+
|
|
43
|
+
118 export type ConsensusNodeResponse = {
|
|
44
|
+
|
|
45
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:127:0 - warning BalanceResponse is referenced by BDSNeo3.getBalance.getBalance but not included in the documentation.
|
|
46
|
+
|
|
47
|
+
127 export type BalanceResponse = {
|
|
48
|
+
|
|
49
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:113:0 - warning ContractResponse is referenced by BDSNeo3.getContract.getContract but not included in the documentation.
|
|
50
|
+
|
|
51
|
+
113 export type ContractResponse = {
|
|
52
|
+
|
|
53
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:105:0 - warning TransactionHistoryResponse is referenced by BDSNeo3.getHistoryTransactions.getHistoryTransactions but not included in the documentation.
|
|
54
|
+
|
|
55
|
+
105 export type TransactionHistoryResponse = {
|
|
56
|
+
|
|
57
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:122:0 - warning TokenInfoResponse is referenced by BDSNeo3.getTokenInfo.getTokenInfo but not included in the documentation.
|
|
58
|
+
|
|
59
|
+
122 export type TokenInfoResponse = {
|
|
60
|
+
|
|
61
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:133:0 - warning UnclaimedResponse is referenced by BDSNeo3.getUnclaimed.getUnclaimed but not included in the documentation.
|
|
62
|
+
|
|
63
|
+
133 export type UnclaimedResponse = {
|
|
64
|
+
|
|
65
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:56:0 - warning CalculateTransferFeeResponse is referenced by BSNeo3.calculateTransferFee.calculateTransferFee but not included in the documentation.
|
|
66
|
+
|
|
67
|
+
56 export type CalculateTransferFeeResponse = {
|
|
68
|
+
|
|
69
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:52:0 - warning Account is referenced by BSNeo3.decryptKey.decryptKey but not included in the documentation.
|
|
70
|
+
|
|
71
|
+
52 export type Account = {
|
|
72
|
+
|
|
73
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:6:0 - warning IntentTransactionParam is referenced by BSNeo3.buildTransfer.buildTransfer.transactionIntents but not included in the documentation.
|
|
74
|
+
|
|
75
|
+
6 export type IntentTransactionParam = {
|
|
76
|
+
|
|
77
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:1:0 - warning SendTransactionParam is referenced by BSNeo3.calculateTransferFee.calculateTransferFee.param but not included in the documentation.
|
|
78
|
+
|
|
79
|
+
1 export type SendTransactionParam = {
|
|
80
|
+
|
|
81
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:35:0 - warning NNSRecordTypes is referenced by BSNeo3.getNNSRecord.getNNSRecord.type but not included in the documentation.
|
|
82
|
+
|
|
83
|
+
35 export declare enum NNSRecordTypes {
|
|
84
|
+
|
package/bs-neo3.build.log
CHANGED
|
@@ -1,2 +1,87 @@
|
|
|
1
|
-
Invoking: tsc && typedoc
|
|
1
|
+
Invoking: tsc && typedoc
|
|
2
|
+
|
|
3
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:140:0 - warning BlockchainDataService is referenced by BDSNeo3 but not included in the documentation.
|
|
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 BDSNeo3 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 BSNeo3 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 BSNeo3 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:41:0 - warning NeoNameService is referenced by BSNeo3 but not included in the documentation.
|
|
20
|
+
|
|
21
|
+
41 export interface NeoNameService {
|
|
22
|
+
|
|
23
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:11:0 - warning TokenInfo is referenced by gasInfoNeo3 but not included in the documentation.
|
|
24
|
+
|
|
25
|
+
11 export type TokenInfo = {
|
|
26
|
+
|
|
27
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:126:0 - warning BlockchainNetwork is referenced by BDSNeo3.network but not included in the documentation.
|
|
28
|
+
|
|
29
|
+
126 export type BlockchainNetwork = "mainnet" | "testnet" | "privatenet";
|
|
30
|
+
|
|
31
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:156:0 - warning Exchange is referenced by BSNeo3.exchange but not included in the documentation.
|
|
32
|
+
|
|
33
|
+
156 export interface Exchange {
|
|
34
|
+
|
|
35
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:46:0 - warning Token is referenced by BSNeo3.tokens but not included in the documentation.
|
|
36
|
+
|
|
37
|
+
46 export type Token = {
|
|
38
|
+
|
|
39
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:84:0 - warning TransactionResponse is referenced by BDSNeo3.findTransactionByTxid.findTransactionByTxid but not included in the documentation.
|
|
40
|
+
|
|
41
|
+
84 export type TransactionResponse = {
|
|
42
|
+
|
|
43
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:118:0 - warning ConsensusNodeResponse is referenced by BDSNeo3.getAllNodes.getAllNodes but not included in the documentation.
|
|
44
|
+
|
|
45
|
+
118 export type ConsensusNodeResponse = {
|
|
46
|
+
|
|
47
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:127:0 - warning BalanceResponse is referenced by BDSNeo3.getBalance.getBalance but not included in the documentation.
|
|
48
|
+
|
|
49
|
+
127 export type BalanceResponse = {
|
|
50
|
+
|
|
51
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:113:0 - warning ContractResponse is referenced by BDSNeo3.getContract.getContract but not included in the documentation.
|
|
52
|
+
|
|
53
|
+
113 export type ContractResponse = {
|
|
54
|
+
|
|
55
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:105:0 - warning TransactionHistoryResponse is referenced by BDSNeo3.getHistoryTransactions.getHistoryTransactions but not included in the documentation.
|
|
56
|
+
|
|
57
|
+
105 export type TransactionHistoryResponse = {
|
|
58
|
+
|
|
59
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:122:0 - warning TokenInfoResponse is referenced by BDSNeo3.getTokenInfo.getTokenInfo but not included in the documentation.
|
|
60
|
+
|
|
61
|
+
122 export type TokenInfoResponse = {
|
|
62
|
+
|
|
63
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:133:0 - warning UnclaimedResponse is referenced by BDSNeo3.getUnclaimed.getUnclaimed but not included in the documentation.
|
|
64
|
+
|
|
65
|
+
133 export type UnclaimedResponse = {
|
|
66
|
+
|
|
67
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:56:0 - warning CalculateTransferFeeResponse is referenced by BSNeo3.calculateTransferFee.calculateTransferFee but not included in the documentation.
|
|
68
|
+
|
|
69
|
+
56 export type CalculateTransferFeeResponse = {
|
|
70
|
+
|
|
71
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:52:0 - warning Account is referenced by BSNeo3.decryptKey.decryptKey but not included in the documentation.
|
|
72
|
+
|
|
73
|
+
52 export type Account = {
|
|
74
|
+
|
|
75
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:6:0 - warning IntentTransactionParam is referenced by BSNeo3.buildTransfer.buildTransfer.transactionIntents but not included in the documentation.
|
|
76
|
+
|
|
77
|
+
6 export type IntentTransactionParam = {
|
|
78
|
+
|
|
79
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:1:0 - warning SendTransactionParam is referenced by BSNeo3.calculateTransferFee.calculateTransferFee.param but not included in the documentation.
|
|
80
|
+
|
|
81
|
+
1 export type SendTransactionParam = {
|
|
82
|
+
|
|
83
|
+
C:/Workspace/blockchain-services/packages/blockchain-service/dist/interfaces.d.ts:35:0 - warning NNSRecordTypes is referenced by BSNeo3.getNNSRecord.getNNSRecord.type but not included in the documentation.
|
|
84
|
+
|
|
85
|
+
35 export declare enum NNSRecordTypes {
|
|
86
|
+
|
|
2
87
|
Documentation generated at ./docs
|
package/dist/BSNeo3.d.ts
CHANGED
|
@@ -1,34 +1,23 @@
|
|
|
1
|
-
import { BlockchainDataService, BlockchainService, SendTransactionParam, Claimable, Account, Exchange, BDSClaimable, Token, NeoNameService, NNSRecordTypes, CalculateTransferFeeResponse } from '@cityofzion/blockchain-service';
|
|
1
|
+
import { BlockchainDataService, BlockchainService, SendTransactionParam, TokenInfo, Claimable, Account, Exchange, BDSClaimable, Token, NeoNameService, NNSRecordTypes, CalculateTransferFeeResponse } from '@cityofzion/blockchain-service';
|
|
2
2
|
export declare class BSNeo3<BSCustomName extends string = string> implements BlockchainService, Claimable, NeoNameService {
|
|
3
3
|
blockchainName: BSCustomName;
|
|
4
4
|
dataService: BlockchainDataService & BDSClaimable;
|
|
5
|
-
|
|
6
|
-
feeToken: {
|
|
7
|
-
hash: string;
|
|
8
|
-
symbol: string;
|
|
9
|
-
decimals: number;
|
|
10
|
-
};
|
|
5
|
+
feeToken: TokenInfo;
|
|
11
6
|
exchange: Exchange;
|
|
12
|
-
tokenClaim:
|
|
13
|
-
hash: string;
|
|
14
|
-
symbol: string;
|
|
15
|
-
decimals: number;
|
|
16
|
-
};
|
|
7
|
+
tokenClaim: TokenInfo;
|
|
17
8
|
tokens: Token[];
|
|
18
|
-
private
|
|
9
|
+
private derivationPath;
|
|
19
10
|
constructor(blockchainName: BSCustomName);
|
|
20
|
-
sendTransaction(param: SendTransactionParam): Promise<string>;
|
|
21
|
-
private buildTransfer;
|
|
22
|
-
private signTransfer;
|
|
23
|
-
generateMnemonic(): string;
|
|
24
|
-
generateWif(mnemonic: string, index: number): string;
|
|
25
|
-
generateAccount(mnemonic: string, index: number): Account;
|
|
26
|
-
generateAccountFromWif(wif: string): string;
|
|
27
|
-
decryptKey(encryptedKey: string, password: string): Promise<Account>;
|
|
28
11
|
validateAddress(address: string): boolean;
|
|
29
12
|
validateEncryptedKey(encryptedKey: string): boolean;
|
|
30
13
|
validateWif(wif: string): boolean;
|
|
14
|
+
validateNNSFormat(domainName: 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>;
|
|
31
19
|
calculateTransferFee(param: SendTransactionParam): Promise<CalculateTransferFeeResponse>;
|
|
20
|
+
sendTransaction(param: SendTransactionParam): Promise<string>;
|
|
32
21
|
claim(account: Account): Promise<{
|
|
33
22
|
txid: string;
|
|
34
23
|
symbol: string;
|
|
@@ -36,5 +25,6 @@ export declare class BSNeo3<BSCustomName extends string = string> implements Blo
|
|
|
36
25
|
}>;
|
|
37
26
|
getNNSRecord(domainName: string, type: NNSRecordTypes): Promise<any>;
|
|
38
27
|
getOwnerOfNNS(domainName: string): Promise<any>;
|
|
39
|
-
|
|
28
|
+
private buildTransfer;
|
|
29
|
+
private signTransfer;
|
|
40
30
|
}
|
package/dist/BSNeo3.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
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
|
-
};
|
|
25
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -38,7 +15,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
38
15
|
exports.BSNeo3 = void 0;
|
|
39
16
|
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
40
17
|
const neon_js_1 = require("@cityofzion/neon-js");
|
|
41
|
-
const AsteroidSDK = __importStar(require("@moonlight-io/asteroid-sdk-js"));
|
|
42
18
|
const constants_1 = require("./constants");
|
|
43
19
|
const exceptions_1 = require("./exceptions");
|
|
44
20
|
const explorer_1 = require("./explorer");
|
|
@@ -50,72 +26,43 @@ const NEO_NS_HASH = "0x50ac1c37690cc2cfc594472833cf57505d5f46de";
|
|
|
50
26
|
class BSNeo3 {
|
|
51
27
|
constructor(blockchainName) {
|
|
52
28
|
this.dataService = explorer_1.explorerOptions.dora;
|
|
53
|
-
this.derivationPath = "m/44'/888'/0'/0/?";
|
|
54
29
|
this.feeToken = constants_1.gasInfoNeo3;
|
|
55
30
|
this.exchange = blockchain_service_1.exchangeOptions.flamingo;
|
|
56
31
|
this.tokenClaim = constants_1.neoInfoNeo3;
|
|
57
32
|
this.tokens = tokens_json_1.default;
|
|
58
|
-
this.
|
|
33
|
+
this.derivationPath = "m/44'/888'/0'/0/?";
|
|
59
34
|
this.blockchainName = blockchainName;
|
|
60
35
|
}
|
|
61
|
-
|
|
62
|
-
return
|
|
63
|
-
try {
|
|
64
|
-
const { senderAccount, transactionIntents } = param;
|
|
65
|
-
const node = yield this.dataService.getHigherNode();
|
|
66
|
-
const facade = yield neon_js_1.api.NetworkFacade.fromConfig({ node: node.url });
|
|
67
|
-
const intents = this.buildTransfer(transactionIntents, senderAccount);
|
|
68
|
-
const signing = this.signTransfer(senderAccount);
|
|
69
|
-
const result = yield facade.transferToken(intents, signing);
|
|
70
|
-
return result;
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
throw error;
|
|
74
|
-
}
|
|
75
|
-
});
|
|
36
|
+
validateAddress(address) {
|
|
37
|
+
return neon_js_1.wallet.isAddress(address);
|
|
76
38
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const neoAccount = new neon_js_1.wallet.Account(account.wif);
|
|
80
|
-
for (const transactionIntent of transactionIntents) {
|
|
81
|
-
const { amount, receiverAddress, tokenHash } = transactionIntent;
|
|
82
|
-
intents.push({
|
|
83
|
-
to: receiverAddress,
|
|
84
|
-
contractHash: tokenHash,
|
|
85
|
-
from: neoAccount,
|
|
86
|
-
decimalAmt: amount,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
return intents;
|
|
39
|
+
validateEncryptedKey(encryptedKey) {
|
|
40
|
+
return neon_js_1.wallet.isNEP2(encryptedKey);
|
|
90
41
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
42
|
+
validateWif(wif) {
|
|
43
|
+
return neon_js_1.wallet.isWIF(wif);
|
|
44
|
+
}
|
|
45
|
+
validateNNSFormat(domainName) {
|
|
46
|
+
if (!domainName.endsWith('.neo'))
|
|
47
|
+
return false;
|
|
48
|
+
return true;
|
|
97
49
|
}
|
|
98
50
|
generateMnemonic() {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const list = (_a = this.keychain.mnemonic) === null || _a === void 0 ? void 0 : _a.toString();
|
|
102
|
-
if (!list)
|
|
51
|
+
blockchain_service_1.keychain.generateMnemonic(128);
|
|
52
|
+
if (!blockchain_service_1.keychain.mnemonic)
|
|
103
53
|
throw new Error("Failed to generate mnemonic");
|
|
104
|
-
return
|
|
105
|
-
}
|
|
106
|
-
generateWif(mnemonic, index) {
|
|
107
|
-
this.keychain.importMnemonic(mnemonic);
|
|
108
|
-
const childKey = this.keychain.generateChildKey('neo', this.derivationPath.replace('?', index.toString()));
|
|
109
|
-
return childKey.getWIF();
|
|
54
|
+
return blockchain_service_1.keychain.mnemonic.toString().split(' ');
|
|
110
55
|
}
|
|
111
56
|
generateAccount(mnemonic, index) {
|
|
112
|
-
|
|
57
|
+
blockchain_service_1.keychain.importMnemonic(mnemonic.join(' '));
|
|
58
|
+
const childKey = blockchain_service_1.keychain.generateChildKey("neo", this.derivationPath.replace('?', index.toString()));
|
|
59
|
+
const wif = childKey.getWIF();
|
|
113
60
|
const { address } = new neon_js_1.wallet.Account(wif);
|
|
114
61
|
return { address, wif };
|
|
115
62
|
}
|
|
116
63
|
generateAccountFromWif(wif) {
|
|
117
64
|
const { address } = new neon_js_1.wallet.Account(wif);
|
|
118
|
-
return address;
|
|
65
|
+
return { address, wif };
|
|
119
66
|
}
|
|
120
67
|
decryptKey(encryptedKey, password) {
|
|
121
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -124,15 +71,6 @@ class BSNeo3 {
|
|
|
124
71
|
return { address, wif };
|
|
125
72
|
});
|
|
126
73
|
}
|
|
127
|
-
validateAddress(address) {
|
|
128
|
-
return neon_js_1.wallet.isAddress(address);
|
|
129
|
-
}
|
|
130
|
-
validateEncryptedKey(encryptedKey) {
|
|
131
|
-
return neon_js_1.wallet.isNEP2(encryptedKey);
|
|
132
|
-
}
|
|
133
|
-
validateWif(wif) {
|
|
134
|
-
return neon_js_1.wallet.isWIF(wif);
|
|
135
|
-
}
|
|
136
74
|
calculateTransferFee(param) {
|
|
137
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
138
76
|
const node = yield this.dataService.getHigherNode();
|
|
@@ -169,6 +107,22 @@ class BSNeo3 {
|
|
|
169
107
|
return result;
|
|
170
108
|
});
|
|
171
109
|
}
|
|
110
|
+
sendTransaction(param) {
|
|
111
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
try {
|
|
113
|
+
const { senderAccount, transactionIntents } = param;
|
|
114
|
+
const node = yield this.dataService.getHigherNode();
|
|
115
|
+
const facade = yield neon_js_1.api.NetworkFacade.fromConfig({ node: node.url });
|
|
116
|
+
const intents = this.buildTransfer(transactionIntents, senderAccount);
|
|
117
|
+
const signing = this.signTransfer(senderAccount);
|
|
118
|
+
const result = yield facade.transferToken(intents, signing);
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
172
126
|
//Claimable interface implementation
|
|
173
127
|
claim(account) {
|
|
174
128
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -241,10 +195,26 @@ class BSNeo3 {
|
|
|
241
195
|
return address;
|
|
242
196
|
});
|
|
243
197
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
198
|
+
buildTransfer(transactionIntents, account) {
|
|
199
|
+
const intents = [];
|
|
200
|
+
const neoAccount = new neon_js_1.wallet.Account(account.wif);
|
|
201
|
+
for (const transactionIntent of transactionIntents) {
|
|
202
|
+
const { amount, receiverAddress, tokenHash } = transactionIntent;
|
|
203
|
+
intents.push({
|
|
204
|
+
to: receiverAddress,
|
|
205
|
+
contractHash: tokenHash,
|
|
206
|
+
from: neoAccount,
|
|
207
|
+
decimalAmt: amount,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
return intents;
|
|
211
|
+
}
|
|
212
|
+
signTransfer(account) {
|
|
213
|
+
const neoAccount = new neon_js_1.wallet.Account(account.address);
|
|
214
|
+
const result = {
|
|
215
|
+
signingCallback: neon_js_1.api.signWithAccount(neoAccount)
|
|
216
|
+
};
|
|
217
|
+
return result;
|
|
248
218
|
}
|
|
249
219
|
}
|
|
250
220
|
exports.BSNeo3 = BSNeo3;
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
decimals: number;
|
|
5
|
-
};
|
|
6
|
-
export declare const neoInfoNeo3: {
|
|
7
|
-
hash: string;
|
|
8
|
-
symbol: string;
|
|
9
|
-
decimals: number;
|
|
10
|
-
};
|
|
1
|
+
import { TokenInfo } from '@cityofzion/blockchain-service';
|
|
2
|
+
export declare const gasInfoNeo3: TokenInfo;
|
|
3
|
+
export declare const neoInfoNeo3: TokenInfo;
|