@cityofzion/bs-neo3 0.1.0 → 0.3.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/.rush/temp/operation/build/state.json +1 -1
  2. package/.rush/temp/package-deps_build.json +4 -4
  3. package/.rush/temp/shrinkwrap-deps.json +16 -2
  4. package/dist/BSNeo3.d.ts +7 -15
  5. package/dist/BSNeo3.js +51 -31
  6. package/dist/exceptions.d.ts +3 -0
  7. package/dist/exceptions.js +8 -0
  8. package/docs/assets/search.js +1 -1
  9. package/docs/classes/BDSNeo3.html +13 -13
  10. package/docs/classes/BSNeo3.html +60 -49
  11. package/docs/interfaces/DoraNeo3Abi.html +6 -6
  12. package/docs/interfaces/DoraNeo3Asset.html +9 -9
  13. package/docs/interfaces/DoraNeo3AssetState.html +6 -6
  14. package/docs/interfaces/DoraNeo3Balance.html +5 -5
  15. package/docs/interfaces/DoraNeo3ConsensusNode.html +3 -3
  16. package/docs/interfaces/DoraNeo3Contract.html +8 -8
  17. package/docs/interfaces/DoraNeo3Event.html +3 -3
  18. package/docs/interfaces/DoraNeo3Features.html +1 -1
  19. package/docs/interfaces/DoraNeo3HistoryState.html +3 -3
  20. package/docs/interfaces/DoraNeo3Invocation.html +3 -3
  21. package/docs/interfaces/DoraNeo3Item.html +11 -11
  22. package/docs/interfaces/DoraNeo3Manifest.html +9 -9
  23. package/docs/interfaces/DoraNeo3Metadata.html +12 -12
  24. package/docs/interfaces/DoraNeo3Method.html +12 -12
  25. package/docs/interfaces/DoraNeo3Nef.html +7 -7
  26. package/docs/interfaces/DoraNeo3Notification.html +4 -4
  27. package/docs/interfaces/DoraNeo3Parameter.html +3 -3
  28. package/docs/interfaces/DoraNeo3Permission.html +3 -3
  29. package/docs/interfaces/DoraNeo3Signer.html +3 -3
  30. package/docs/interfaces/DoraNeo3Token.html +6 -6
  31. package/docs/interfaces/DoraNeo3Transaction.html +16 -16
  32. package/docs/interfaces/DoraNeo3TransactionHistory.html +3 -3
  33. package/docs/interfaces/DoraNeo3Transfer.html +9 -9
  34. package/docs/interfaces/DoraNeo3Witness.html +3 -3
  35. package/docs/variables/DORA_ASSET.html +1 -1
  36. package/docs/variables/DORA_BALANCE.html +1 -1
  37. package/docs/variables/DORA_CONTRACT.html +1 -1
  38. package/docs/variables/DORA_NODES.html +1 -1
  39. package/docs/variables/DORA_TRANSACTION.html +1 -1
  40. package/docs/variables/DORA_TRANSACTIONS.html +1 -1
  41. package/docs/variables/explorerOptions.html +1 -1
  42. package/docs/variables/gasInfoNeo3.html +1 -1
  43. package/docs/variables/neoInfoNeo3.html +1 -1
  44. package/package.json +7 -8
  45. package/src/BSNeo3.ts +59 -36
  46. /package/src/{excpetions.ts → exceptions.ts} +0 -0
@@ -1,3 +1,3 @@
1
1
  {
2
- "nonCachedDurationMs": 3947.6233999729156
2
+ "nonCachedDurationMs": 3786.9914999604225
3
3
  }
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "files": {
3
- "packages/bs-neo3/package.json": "4f772ecf839f2c56ee7744028077d9daabe402d6",
3
+ "packages/bs-neo3/package.json": "54aba173943515c54592587ac01ac264e0f33ddf",
4
4
  "packages/bs-neo3/src/BDSNeo3.ts": "6de6c505219ad5404357ba195b9b59b368fc574f",
5
- "packages/bs-neo3/src/BSNeo3.ts": "187db0f6339efff2bb15820727a845b26cf02436",
5
+ "packages/bs-neo3/src/BSNeo3.ts": "39c473d9be67c3cd0ccf253fd037d1c9ea881027",
6
6
  "packages/bs-neo3/src/assets/blockchain_icon_neo.png": "3b3c8c019cc3ab191648acd69b07663006abf495",
7
7
  "packages/bs-neo3/src/assets/blockchain_icon_neo_white.png": "feaec214f1374496e428254d8d014a8aa39b7067",
8
8
  "packages/bs-neo3/src/assets/tokens.json": "33d65a4a123ae414a95b0caf031c6d62eb715349",
9
9
  "packages/bs-neo3/src/constants.ts": "39993e77862b88d771441980cf39a091ae5dee3a",
10
- "packages/bs-neo3/src/excpetions.ts": "c7b6401d197e363dca8241b92a4304c227e7800f",
10
+ "packages/bs-neo3/src/exceptions.ts": "c7b6401d197e363dca8241b92a4304c227e7800f",
11
11
  "packages/bs-neo3/src/explorer/dora/DoraNeo3Responses.ts": "6ccd07c95af63d966ef370ae8861cb37783cc4da",
12
12
  "packages/bs-neo3/src/explorer/dora/DoraNeo3Routes.ts": "b6b4b85492e1a9611f0f88c2d9836371f1fba20b",
13
13
  "packages/bs-neo3/src/explorer/index.ts": "4e892cff669a805bf2f9cc29554bdfc4e43af6c1",
14
14
  "packages/bs-neo3/src/index.ts": "53f10ade66205f959dca69e06c4d2b73d045424a",
15
15
  "packages/bs-neo3/tsconfig.json": "9c0d05b4a1620310c7310c1d18e7b1afb1977ff9",
16
16
  "packages/bs-neo3/yarn.lock": "5bb25dd89095cbb23ce0906458c1234eb7da3ba2",
17
- "packages/bs-neo3/.rush/temp/shrinkwrap-deps.json": "7eadb1f0ea78db7c2c2b2cc2e6aed45a98730229"
17
+ "packages/bs-neo3/.rush/temp/shrinkwrap-deps.json": "c56f11cf68d0bf25f6473b16dd3792c70ec77912"
18
18
  },
19
19
  "arguments": "tsc && typedoc src/index.ts "
20
20
  }
@@ -1,18 +1,30 @@
1
1
  {
2
- "../../packages/bs-neo3": "../../packages/bs-neo3:Xdx01diIRcmuWHlhjR1JwIGb85ZPtb6Jo2gA4G/yP1U=:",
3
- "/@cityofzion/blockchain-service/0.1.1": "sha512-2b0zWzyhi8/7aeIsL1m/MaiFyUN/IVkZaFKtGH1OFD7vi45+GUXgyzKTFSGM7q0nP12kU7xNP7iKsghjc1oPJg==",
2
+ "../../packages/bs-neo3": "../../packages/bs-neo3:4iC1pNbhPlRxR19i6GFgYaV/adWmRqfb8O6vbxL01WE=:",
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
+ "/@cityofzion/neo3-invoker/1.4.0": "sha512-BOqJA2e6Kq3QPL/kaMYEjpPCeh9fdKTzRjEi9oIxi0MY5B7nj4rhAVl4l2A06jGNboi+VhToo/gJ/ZVzW/GaeQ==",
6
+ "/@cityofzion/neo3-parser/1.6.0": "sha512-K+j3qaZEuq1cxit+fFziwAAc0hMQTdACbtllU1HUKJZ89dw7z/FY3Bmg12cyZ8tXuiktCloXvUT0Mg/IzoYqdg==",
5
7
  "/@cityofzion/neon-api/4.9.0_@cityofzion+neon-core@4.9.0": "sha512-8eN3N3sGgd4L7qFaFATKr94kA/65626eo6hB7fHL+S8OGCVCrrl3tfh8GAOv50vLxd2YyoDu9pBY/0NPKY8tsQ==",
6
8
  "/@cityofzion/neon-api/5.2.2_@cityofzion+neon-core@5.3.0": "sha512-zNaGI+0C3r/w0olV6cpbdl1OarvX/Qen8bnEO3Xlqybc8uswu0AoL/mhfjXPFd75UkWmQTC7JCziKQULTfLblg==",
9
+ "/@cityofzion/neon-api/5.4.0_@cityofzion+neon-core@5.4.0": "sha512-FHjdq2RnZLK37Hpd71yhVMkmbhl/iyPrmmAiEKb4mf5/rLtbNaKEEEJsxRkSNasio9+14cd7+BecIZ/35L1Sbg==",
7
10
  "/@cityofzion/neon-core/4.9.0": "sha512-z4UgEIjAS9E2QP6HSTzri02DFY++nYmfzbspi1818mvnTst6Lf8bDNYYxG/686wdYN2dEF3RuccMXraw2Bm31g==",
8
11
  "/@cityofzion/neon-core/5.3.0": "sha512-iOHY7rFuDZavH87klFIxOYpu3PnPm6pS1xY7qhkFrRtcuTqRBMzhoZstE70XLDh01ujC5y2+gXvgz4OOpzgdXQ==",
12
+ "/@cityofzion/neon-core/5.4.0": "sha512-m5B0X71KXDY1WJPMu9oM7lyKp0b5qkLaLyYC+68LgV7/f0wlnA3BQ/40rYutb2b5p+NKlEElm3IRPbdA3INcrA==",
13
+ "/@cityofzion/neon-invoker/1.4.0": "sha512-lopkzz3/lCFylzK3n5RoUR5H2CbIXLQK+GnRvzrCFk/fLF24uGVB2GrKwdnVJgvNXRUXjziRABtB5WC6iLgmlA==",
9
14
  "/@cityofzion/neon-js/4.9.0": "sha512-YYeMbQGZJkC8Wq2UQt98OUys8f8tPCaXMplbV8GwiJEdG+PJJOFGg3NkvrDGUfcuasff0dcn8LWjXTPKPp+Gyw==",
10
15
  "/@cityofzion/neon-js/5.3.0": "sha512-mtKBtYJoTJjJFnGw6Lrlo0OU2XGfPR4w71XIFfDfmoroadbRrZdVDn8KLhuJRXJP+atYJB3f0DmW6e6Ptp0M6g==",
16
+ "/@cityofzion/neon-js/5.4.0": "sha512-PeK5F4xSQyiqkrq/0TvBUl08wdim4ZPVD+XrUUNCIDuyJGeFkaleKlVsSqR5ZY2kofLNpdHsgXXMjiu/HrEdzQ==",
11
17
  "/@cityofzion/neon-nep5/4.9.0": "sha512-MSRXHl+UGYnh8f9FC7zZvMNRblnl496VxG3tjA+GIShtLR6u75/FK7syVXua9h8/khljL7qqSfnNqA+sy7q+eg==",
18
+ "/@cityofzion/neon-parser/1.6.2": "sha512-1wG6qfRR3PNYm3eFqf0/sRSjLBJLVYDnXFnaWvgc31PzTrcCifUUR9ZJr2YWINmV9qnGuGCKlL2Cz+vkFfOA1g==",
12
19
  "/@cspotcode/source-map-support/0.8.1": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
13
20
  "/@jridgewell/resolve-uri/3.1.0": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==",
14
21
  "/@jridgewell/sourcemap-codec/1.4.14": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==",
15
22
  "/@jridgewell/trace-mapping/0.3.9": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
23
+ "/@noble/curves/1.0.0": "sha512-2upgEu0iLiDVDZkNLeFV2+ht0BAVgQnEmCk6JsOch9Rp8xfkMCbvbAZlA2pBHQc73dbl+vFOXfqkf4uemdn0bw==",
24
+ "/@noble/hashes/1.3.0": "sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==",
25
+ "/@scure/base/1.1.1": "sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==",
26
+ "/@scure/bip32/1.3.0": "sha512-bcKpo1oj54hGholplGLpqPHRbIsnbixFtc06nwuNM5/dwSXOq/AAYoIBRsBmnZJSdfeNW5rnff7NTAz3ZCqR9Q==",
27
+ "/@scure/bip39/1.2.0": "sha512-SX/uKq52cuxm4YFXWFaVByaSHJh2w3BnokVSeUJVCv6K7WulT9u2BuNRBhuFl8vAuYnzx9bEu9WgpcNYTrYieg==",
16
28
  "/@tsconfig/node10/1.0.9": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==",
17
29
  "/@tsconfig/node12/1.0.11": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
18
30
  "/@tsconfig/node14/1.0.3": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
@@ -42,6 +54,7 @@
42
54
  "/bip39/3.0.4": "sha512-YZKQlb752TrUWqHWj7XAwCSjYEgGAk+/Aas3V7NyjQeZYsztO8JnQUaCWhcnL4T+jL8nvB8typ2jRPzTlgugNw==",
43
55
  "/bn.js/4.12.0": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==",
44
56
  "/bn.js/5.2.0": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==",
57
+ "/bn.js/5.2.1": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==",
45
58
  "/brace-expansion/2.0.1": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
46
59
  "/brorand/1.1.0": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==",
47
60
  "/bs58/4.0.1": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==",
@@ -62,6 +75,7 @@
62
75
  "/delayed-stream/1.0.0": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
63
76
  "/diff/4.0.2": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
64
77
  "/elliptic/6.5.4": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",
78
+ "/ethereum-cryptography/2.0.0": "sha512-g25m4EtfQGjstWgVE1aIz7XYYjf3kH5kG17ULWVB5dH6uLahsoltOhACzSxyDV+fhn4gbR4xRrOXGe6r2uh4Bg==",
65
79
  "/event-target-shim/5.0.1": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
66
80
  "/follow-redirects/1.15.2": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==",
67
81
  "/follow-redirects/1.5.10": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
package/dist/BSNeo3.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { BlockchainDataService, BlockchainService, CalculateTransferFeeDetails, SendTransactionParam, Claimable, Account, Exchange, BDSClaimable, Token, NeoNameService, NNSRecordTypes } from '@cityofzion/blockchain-service';
1
+ import { BlockchainDataService, BlockchainService, SendTransactionParam, 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;
@@ -22,27 +22,19 @@ export declare class BSNeo3<BSCustomName extends string = string> implements Blo
22
22
  private signTransfer;
23
23
  generateMnemonic(): string;
24
24
  generateWif(mnemonic: string, index: number): string;
25
- generateAccount(mnemonic: string, index: number): {
26
- wif: string;
27
- address: string;
28
- };
25
+ generateAccount(mnemonic: string, index: number): Account;
29
26
  generateAccountFromWif(wif: string): string;
30
- decryptKey(encryptedKey: string, password: string): Promise<{
31
- wif: string;
32
- address: string;
33
- }>;
27
+ decryptKey(encryptedKey: string, password: string): Promise<Account>;
34
28
  validateAddress(address: string): boolean;
35
29
  validateEncryptedKey(encryptedKey: string): boolean;
36
30
  validateWif(wif: string): boolean;
37
- calculateTransferFee(param: SendTransactionParam): Promise<{
38
- result: number;
39
- details?: CalculateTransferFeeDetails | undefined;
40
- }>;
31
+ calculateTransferFee(param: SendTransactionParam): Promise<CalculateTransferFeeResponse>;
41
32
  claim(account: Account): Promise<{
42
33
  txid: string;
43
34
  symbol: string;
44
35
  hash: string;
45
36
  }>;
46
- getNeoNsRecord(domainName: string, type: typeof NNSRecordTypes): Promise<any>;
47
- getOwnerOfNeoNsRecord(domainName: string): Promise<any>;
37
+ getNNSRecord(domainName: string, type: NNSRecordTypes): Promise<any>;
38
+ getOwnerOfNNS(domainName: string): Promise<any>;
39
+ validateNNSFormat(domainName: string): boolean;
48
40
  }
package/dist/BSNeo3.js CHANGED
@@ -40,9 +40,12 @@ const blockchain_service_1 = require("@cityofzion/blockchain-service");
40
40
  const neon_js_1 = require("@cityofzion/neon-js");
41
41
  const AsteroidSDK = __importStar(require("@moonlight-io/asteroid-sdk-js"));
42
42
  const constants_1 = require("./constants");
43
- const excpetions_1 = require("./excpetions");
43
+ const exceptions_1 = require("./exceptions");
44
44
  const explorer_1 = require("./explorer");
45
45
  const tokens_json_1 = __importDefault(require("./assets/tokens.json"));
46
+ const neon_invoker_1 = require("@cityofzion/neon-invoker");
47
+ const neon_parser_1 = require("@cityofzion/neon-parser");
48
+ const neo3_parser_1 = require("@cityofzion/neo3-parser");
46
49
  const NEO_NS_HASH = "0x50ac1c37690cc2cfc594472833cf57505d5f46de";
47
50
  class BSNeo3 {
48
51
  constructor(blockchainName) {
@@ -73,7 +76,7 @@ class BSNeo3 {
73
76
  }
74
77
  buildTransfer(transactionIntents, account) {
75
78
  const intents = [];
76
- const neoAccount = new neon_js_1.wallet.Account(account.getWif());
79
+ const neoAccount = new neon_js_1.wallet.Account(account.wif);
77
80
  for (const transactionIntent of transactionIntents) {
78
81
  const { amount, receiverAddress, tokenHash } = transactionIntent;
79
82
  intents.push({
@@ -86,7 +89,7 @@ class BSNeo3 {
86
89
  return intents;
87
90
  }
88
91
  signTransfer(account) {
89
- const neoAccount = new neon_js_1.wallet.Account(account.getWif());
92
+ const neoAccount = new neon_js_1.wallet.Account(account.address);
90
93
  const result = {
91
94
  signingCallback: neon_js_1.api.signWithAccount(neoAccount)
92
95
  };
@@ -145,7 +148,7 @@ class BSNeo3 {
145
148
  }
146
149
  }
147
150
  const txn = txBuilder.build();
148
- const accountScriptHash = neon_js_1.wallet.getScriptHashFromAddress(param.senderAccount.getAddress());
151
+ const accountScriptHash = neon_js_1.wallet.getScriptHashFromAddress(param.senderAccount.address);
149
152
  const invokeFunctionResponse = yield rpcClient.invokeScript(neon_js_1.u.HexString.fromHex(txn.script), [
150
153
  {
151
154
  account: accountScriptHash,
@@ -169,20 +172,20 @@ class BSNeo3 {
169
172
  //Claimable interface implementation
170
173
  claim(account) {
171
174
  return __awaiter(this, void 0, void 0, function* () {
172
- const balance = yield this.dataService.getBalance(account.getAddress());
175
+ const balance = yield this.dataService.getBalance(account.address);
173
176
  const neoHash = constants_1.neoInfoNeo3.hash;
174
177
  const neoBalance = balance.find(balance => balance.hash === neoHash);
175
178
  const gasBalance = balance.find(balance => balance.hash === constants_1.gasInfoNeo3.hash);
176
- const neoAccount = new neon_js_1.wallet.Account(account.getWif());
179
+ const neoAccount = new neon_js_1.wallet.Account(account.wif);
177
180
  if (!neoBalance || !gasBalance)
178
181
  throw new Error(`Problem to claim`);
179
182
  const dataToClaim = {
180
- transactionIntents: [{ amount: neoBalance.amount, receiverAddress: account.getAddress(), tokenHash: neoBalance.hash }],
183
+ transactionIntents: [{ amount: neoBalance.amount, receiverAddress: account.address, tokenHash: neoBalance.hash }],
181
184
  senderAccount: account
182
185
  };
183
186
  const feeToClaim = yield this.calculateTransferFee(dataToClaim);
184
187
  if (gasBalance.amount < feeToClaim.result) {
185
- excpetions_1.claimGasExceptions.InsuficientGas(String(gasBalance.amount), String(feeToClaim.result));
188
+ exceptions_1.claimGasExceptions.InsuficientGas(String(gasBalance.amount), String(feeToClaim.result));
186
189
  }
187
190
  const url = (yield this.dataService.getHigherNode()).url;
188
191
  const facade = yield neon_js_1.api.NetworkFacade.fromConfig({ node: url });
@@ -197,34 +200,51 @@ class BSNeo3 {
197
200
  });
198
201
  }
199
202
  // Gets the record of a second-level domain or its subdomains with the specific type.
200
- getNeoNsRecord(domainName, type) {
203
+ getNNSRecord(domainName, type) {
204
+ var _a;
201
205
  return __awaiter(this, void 0, void 0, function* () {
202
- const url = (yield this.dataService.getHigherNode()).url;
203
- const rpcClient = new neon_js_1.rpc.NeoServerRpcClient(url);
204
- return rpcClient.invokeFunction(NEO_NS_HASH, "getRecord", [
205
- {
206
- type: "String",
207
- value: domainName,
208
- },
209
- {
210
- type: "Integer",
211
- value: type,
212
- },
213
- ]);
206
+ const higherNode = yield this.dataService.getHigherNode();
207
+ const parser = neon_parser_1.NeonParser;
208
+ const invoker = yield neon_invoker_1.NeonInvoker.init(higherNode.url);
209
+ const response = yield invoker.testInvoke({
210
+ invocations: [{
211
+ scriptHash: NEO_NS_HASH,
212
+ operation: "getRecord",
213
+ args: [{ type: "String", value: domainName }, { type: "Integer", value: type }]
214
+ }]
215
+ });
216
+ if (response.stack.length === 0) {
217
+ throw new Error((_a = response.exception) !== null && _a !== void 0 ? _a : 'unrecognized response');
218
+ }
219
+ const parsed = parser.parseRpcResponse(response.stack[0]);
220
+ return parsed;
214
221
  });
215
222
  }
216
- // Gets the domain owner. If the domain has expired, an error message is returned instead of the owner.
217
- getOwnerOfNeoNsRecord(domainName) {
223
+ getOwnerOfNNS(domainName) {
224
+ var _a;
218
225
  return __awaiter(this, void 0, void 0, function* () {
219
- const url = (yield this.dataService.getHigherNode()).url;
220
- const rpcClient = new neon_js_1.rpc.NeoServerRpcClient(url);
221
- return rpcClient.invokeFunction(NEO_NS_HASH, "ownerOf", [
222
- {
223
- type: "ByteArray",
224
- value: domainName,
225
- },
226
- ]);
226
+ const higherNode = yield this.dataService.getHigherNode();
227
+ const parser = neon_parser_1.NeonParser;
228
+ const invoker = yield neon_invoker_1.NeonInvoker.init(higherNode.url);
229
+ const response = yield invoker.testInvoke({
230
+ invocations: [{
231
+ scriptHash: NEO_NS_HASH,
232
+ operation: "ownerOf",
233
+ args: [{ type: "String", value: domainName }]
234
+ }]
235
+ });
236
+ if (response.stack.length === 0) {
237
+ throw new Error((_a = response.exception) !== null && _a !== void 0 ? _a : 'unrecognized response');
238
+ }
239
+ const parsed = parser.parseRpcResponse(response.stack[0], { type: neo3_parser_1.ABI_TYPES.HASH160.name });
240
+ const address = parser.accountInputToAddress(parsed.replace("0x", ""));
241
+ return address;
227
242
  });
228
243
  }
244
+ validateNNSFormat(domainName) {
245
+ if (!domainName.endsWith('.neo'))
246
+ return false;
247
+ return true;
248
+ }
229
249
  }
230
250
  exports.BSNeo3 = BSNeo3;
@@ -0,0 +1,3 @@
1
+ export declare const claimGasExceptions: {
2
+ InsuficientGas: (gasAmount: string, gasFee: string) => never;
3
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.claimGasExceptions = void 0;
4
+ exports.claimGasExceptions = {
5
+ InsuficientGas: (gasAmount, gasFee) => {
6
+ throw new Error(`Insuficient GAS to complete transaction, the fee it's ${gasFee} and you have ${gasAmount}`);
7
+ }
8
+ };