@cityofzion/bs-neo3 0.3.2 → 0.4.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.
Files changed (46) hide show
  1. package/bs-neo3.build.error.log +84 -0
  2. package/bs-neo3.build.log +86 -1
  3. package/dist/BSNeo3.d.ts +12 -22
  4. package/dist/BSNeo3.js +58 -85
  5. package/dist/constants.d.ts +3 -10
  6. package/docs/assets/search.js +1 -1
  7. package/docs/classes/BDSNeo3.html +13 -13
  8. package/docs/classes/BSNeo3.html +36 -80
  9. package/docs/interfaces/DoraNeo3Abi.html +6 -6
  10. package/docs/interfaces/DoraNeo3Asset.html +9 -9
  11. package/docs/interfaces/DoraNeo3AssetState.html +6 -6
  12. package/docs/interfaces/DoraNeo3Balance.html +5 -5
  13. package/docs/interfaces/DoraNeo3ConsensusNode.html +3 -3
  14. package/docs/interfaces/DoraNeo3Contract.html +8 -8
  15. package/docs/interfaces/DoraNeo3Event.html +3 -3
  16. package/docs/interfaces/DoraNeo3Features.html +1 -1
  17. package/docs/interfaces/DoraNeo3HistoryState.html +3 -3
  18. package/docs/interfaces/DoraNeo3Invocation.html +3 -3
  19. package/docs/interfaces/DoraNeo3Item.html +11 -11
  20. package/docs/interfaces/DoraNeo3Manifest.html +9 -9
  21. package/docs/interfaces/DoraNeo3Metadata.html +12 -12
  22. package/docs/interfaces/DoraNeo3Method.html +12 -12
  23. package/docs/interfaces/DoraNeo3Nef.html +7 -7
  24. package/docs/interfaces/DoraNeo3Notification.html +4 -4
  25. package/docs/interfaces/DoraNeo3Parameter.html +3 -3
  26. package/docs/interfaces/DoraNeo3Permission.html +3 -3
  27. package/docs/interfaces/DoraNeo3Signer.html +3 -3
  28. package/docs/interfaces/DoraNeo3Token.html +6 -6
  29. package/docs/interfaces/DoraNeo3Transaction.html +16 -16
  30. package/docs/interfaces/DoraNeo3TransactionHistory.html +3 -3
  31. package/docs/interfaces/DoraNeo3Transfer.html +9 -9
  32. package/docs/interfaces/DoraNeo3Witness.html +3 -3
  33. package/docs/variables/DORA_ASSET.html +1 -1
  34. package/docs/variables/DORA_BALANCE.html +1 -1
  35. package/docs/variables/DORA_CONTRACT.html +1 -1
  36. package/docs/variables/DORA_NODES.html +1 -1
  37. package/docs/variables/DORA_TRANSACTION.html +1 -1
  38. package/docs/variables/DORA_TRANSACTIONS.html +1 -1
  39. package/docs/variables/explorerOptions.html +1 -1
  40. package/docs/variables/gasInfoNeo3.html +2 -11
  41. package/docs/variables/neoInfoNeo3.html +2 -11
  42. package/package.json +6 -7
  43. package/src/BSNeo3.ts +63 -65
  44. package/src/constants.ts +4 -2
  45. package/tsconfig.json +6 -1
  46. 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 src/index.ts
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
- derivationPath: string;
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 keychain;
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
- validateNNSFormat(domainName: string): boolean;
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,7 @@ 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"));
18
+ const wallet_sdk_1 = require("@cityofzion/wallet-sdk");
42
19
  const constants_1 = require("./constants");
43
20
  const exceptions_1 = require("./exceptions");
44
21
  const explorer_1 = require("./explorer");
@@ -50,72 +27,45 @@ const NEO_NS_HASH = "0x50ac1c37690cc2cfc594472833cf57505d5f46de";
50
27
  class BSNeo3 {
51
28
  constructor(blockchainName) {
52
29
  this.dataService = explorer_1.explorerOptions.dora;
53
- this.derivationPath = "m/44'/888'/0'/0/?";
54
30
  this.feeToken = constants_1.gasInfoNeo3;
55
31
  this.exchange = blockchain_service_1.exchangeOptions.flamingo;
56
32
  this.tokenClaim = constants_1.neoInfoNeo3;
57
33
  this.tokens = tokens_json_1.default;
58
- this.keychain = new AsteroidSDK.Keychain();
34
+ this.derivationPath = "m/44'/888'/0'/0/?";
59
35
  this.blockchainName = blockchainName;
60
36
  }
61
- sendTransaction(param) {
62
- return __awaiter(this, void 0, void 0, function* () {
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
- });
37
+ validateAddress(address) {
38
+ return neon_js_1.wallet.isAddress(address);
76
39
  }
77
- buildTransfer(transactionIntents, account) {
78
- const intents = [];
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;
40
+ validateEncryptedKey(encryptedKey) {
41
+ return neon_js_1.wallet.isNEP2(encryptedKey);
90
42
  }
91
- signTransfer(account) {
92
- const neoAccount = new neon_js_1.wallet.Account(account.address);
93
- const result = {
94
- signingCallback: neon_js_1.api.signWithAccount(neoAccount)
95
- };
96
- return result;
43
+ validateWif(wif) {
44
+ return neon_js_1.wallet.isWIF(wif);
45
+ }
46
+ validateNNSFormat(domainName) {
47
+ if (!domainName.endsWith('.neo'))
48
+ return false;
49
+ return true;
97
50
  }
98
51
  generateMnemonic() {
99
- var _a;
100
- this.keychain.generateMnemonic(128);
101
- const list = (_a = this.keychain.mnemonic) === null || _a === void 0 ? void 0 : _a.toString();
102
- if (!list)
52
+ const bip39 = new wallet_sdk_1.BIP39Encoded();
53
+ const { phonetic } = bip39.generateMnemonic({ length: 12 });
54
+ if (!phonetic)
103
55
  throw new Error("Failed to generate mnemonic");
104
- return list;
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();
56
+ return phonetic;
110
57
  }
111
58
  generateAccount(mnemonic, index) {
112
- const wif = this.generateWif(mnemonic, index);
59
+ const bip39 = new wallet_sdk_1.BIP39Encoded({ mnemonic });
60
+ const keychain = bip39.getKeychain('neo');
61
+ const childKey = keychain.generateChildKey(this.derivationPath.replace('?', index.toString()));
62
+ const wif = childKey.getWIF();
113
63
  const { address } = new neon_js_1.wallet.Account(wif);
114
64
  return { address, wif };
115
65
  }
116
66
  generateAccountFromWif(wif) {
117
67
  const { address } = new neon_js_1.wallet.Account(wif);
118
- return address;
68
+ return { address, wif };
119
69
  }
120
70
  decryptKey(encryptedKey, password) {
121
71
  return __awaiter(this, void 0, void 0, function* () {
@@ -124,15 +74,6 @@ class BSNeo3 {
124
74
  return { address, wif };
125
75
  });
126
76
  }
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
77
  calculateTransferFee(param) {
137
78
  return __awaiter(this, void 0, void 0, function* () {
138
79
  const node = yield this.dataService.getHigherNode();
@@ -169,6 +110,22 @@ class BSNeo3 {
169
110
  return result;
170
111
  });
171
112
  }
113
+ sendTransaction(param) {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ try {
116
+ const { senderAccount, transactionIntents } = param;
117
+ const node = yield this.dataService.getHigherNode();
118
+ const facade = yield neon_js_1.api.NetworkFacade.fromConfig({ node: node.url });
119
+ const intents = this.buildTransfer(transactionIntents, senderAccount);
120
+ const signing = this.signTransfer(senderAccount);
121
+ const result = yield facade.transferToken(intents, signing);
122
+ return result;
123
+ }
124
+ catch (error) {
125
+ throw error;
126
+ }
127
+ });
128
+ }
172
129
  //Claimable interface implementation
173
130
  claim(account) {
174
131
  return __awaiter(this, void 0, void 0, function* () {
@@ -241,10 +198,26 @@ class BSNeo3 {
241
198
  return address;
242
199
  });
243
200
  }
244
- validateNNSFormat(domainName) {
245
- if (!domainName.endsWith('.neo'))
246
- return false;
247
- return true;
201
+ buildTransfer(transactionIntents, account) {
202
+ const intents = [];
203
+ const neoAccount = new neon_js_1.wallet.Account(account.wif);
204
+ for (const transactionIntent of transactionIntents) {
205
+ const { amount, receiverAddress, tokenHash } = transactionIntent;
206
+ intents.push({
207
+ to: receiverAddress,
208
+ contractHash: tokenHash,
209
+ from: neoAccount,
210
+ decimalAmt: amount,
211
+ });
212
+ }
213
+ return intents;
214
+ }
215
+ signTransfer(account) {
216
+ const neoAccount = new neon_js_1.wallet.Account(account.address);
217
+ const result = {
218
+ signingCallback: neon_js_1.api.signWithAccount(neoAccount)
219
+ };
220
+ return result;
248
221
  }
249
222
  }
250
223
  exports.BSNeo3 = BSNeo3;
@@ -1,10 +1,3 @@
1
- export declare const gasInfoNeo3: {
2
- hash: string;
3
- symbol: string;
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;