@cityofzion/bs-neo3 0.4.2 → 0.7.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/.rush/temp/operation/build/state.json +1 -1
- package/.rush/temp/package-deps_build.json +25 -0
- package/.rush/temp/shrinkwrap-deps.json +2 -2
- package/bs-neo3.build.log +1 -86
- package/dist/BSNeo3.d.ts +24 -27
- package/dist/BSNeo3.js +124 -162
- package/dist/DoraBDSNeo3.d.ts +12 -0
- package/dist/DoraBDSNeo3.js +169 -0
- package/dist/FlamingoEDSNeo3.d.ts +8 -0
- package/dist/FlamingoEDSNeo3.js +44 -0
- package/dist/GhostMarketNDSNeo3.d.ts +10 -0
- package/dist/GhostMarketNDSNeo3.js +75 -0
- package/dist/RpcBDSNeo3.d.ts +15 -0
- package/dist/RpcBDSNeo3.js +152 -0
- package/dist/assets/tokens/common.json +14 -0
- package/dist/assets/tokens/mainnet.json +116 -0
- package/dist/constants.d.ts +7 -3
- package/dist/constants.js +24 -9
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/docs/assets/search.js +1 -1
- package/docs/classes/BDSNeo3.html +13 -13
- package/docs/classes/BSNeo3.html +80 -36
- 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 +11 -2
- package/docs/variables/neoInfoNeo3.html +11 -2
- package/jest.config.ts +13 -0
- package/jest.setup.ts +1 -0
- package/package.json +14 -6
- package/src/BSNeo3.ts +221 -221
- package/src/DoraBDSNeo3.ts +180 -0
- package/src/FlamingoEDSNeo3.ts +45 -0
- package/src/GhostMarketNDSNeo3.ts +117 -0
- package/src/RpcBDSNeo3.ts +155 -0
- package/src/__tests__/BDSNeo3.spec.ts +126 -0
- package/src/__tests__/BSNeo3.spec.ts +142 -0
- package/src/__tests__/FlamingoEDSNeo3.spec.ts +45 -0
- package/src/__tests__/GhostMarketNDSNeo3.spec.ts +43 -0
- package/src/__tests__/utils/sleep.ts +1 -0
- package/src/assets/tokens/common.json +14 -0
- package/src/assets/tokens/mainnet.json +116 -0
- package/src/constants.ts +26 -10
- package/src/index.ts +4 -2
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +3 -7
- package/bs-neo3.build.error.log +0 -84
- package/dist/excpetions.d.ts +0 -3
- package/dist/excpetions.js +0 -8
- package/src/BDSNeo3.ts +0 -168
- package/src/assets/blockchain_icon_neo.png +0 -0
- package/src/assets/blockchain_icon_neo_white.png +0 -0
- package/src/assets/tokens.json +0 -129
- package/src/exceptions.ts +0 -5
- package/src/explorer/dora/DoraNeo3Responses.ts +0 -207
- package/src/explorer/dora/DoraNeo3Routes.ts +0 -6
- package/src/explorer/index.ts +0 -8
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"symbol": "LRB",
|
|
4
|
+
"name": "LyrebirdToken",
|
|
5
|
+
"hash": "0x8c07b4c9f5bc170a3922eac4f5bb7ef17b0acc8b",
|
|
6
|
+
"decimals": 8
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"symbol": "USDL",
|
|
10
|
+
"name": "LyrebirdUSDToken",
|
|
11
|
+
"hash": "0xa8c51aa0c177187aeed3db88bdfa908ccbc9b1a5",
|
|
12
|
+
"decimals": 8
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"symbol": "FLM",
|
|
16
|
+
"name": "FLM",
|
|
17
|
+
"hash": "0xf0151f528127558851b39c2cd8aa47da7418ab28",
|
|
18
|
+
"decimals": 8
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"symbol": "fCAKE",
|
|
22
|
+
"name": "fCAKE",
|
|
23
|
+
"hash": "0xe65b462b90516012826f8a9c4c285d8c750e3a77",
|
|
24
|
+
"decimals": 18
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"symbol": "WING",
|
|
28
|
+
"name": "WING",
|
|
29
|
+
"hash": "0xeeccd60ed722111f8400434dac3ba42c14d8beb1",
|
|
30
|
+
"decimals": 9
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"symbol": "fWETH",
|
|
34
|
+
"name": "fWETH",
|
|
35
|
+
"hash": "0xc14b601252aa5dfa6166cf35fe5ccd2e35f3fdf5",
|
|
36
|
+
"decimals": 18
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"symbol": "fWBTC",
|
|
40
|
+
"name": "fWBTC",
|
|
41
|
+
"hash": "0xd6abe115ecb75e1fa0b42f5e85934ce8c1ae2893",
|
|
42
|
+
"decimals": 8
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"symbol": "SWTH",
|
|
46
|
+
"name": "SWTHToken",
|
|
47
|
+
"hash": "0x78e1330db47634afdb5ea455302ba2d12b8d549f",
|
|
48
|
+
"decimals": 8
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"symbol": "pONT",
|
|
52
|
+
"name": "pONT",
|
|
53
|
+
"hash": "0x8122bc2212ec971690a044b37a6f52a9349b702b",
|
|
54
|
+
"decimals": 9
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"symbol": "fUSDT",
|
|
58
|
+
"name": "fUSDT",
|
|
59
|
+
"hash": "0xcd48b160c1bbc9d74997b803b9a7ad50a4bef020",
|
|
60
|
+
"decimals": 6
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"symbol": "FLUND",
|
|
64
|
+
"name": "FLUND",
|
|
65
|
+
"hash": "0xa9603a59e21d29e37ac39cf1b5f5abf5006b22a3",
|
|
66
|
+
"decimals": 8
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"symbol": "GM",
|
|
70
|
+
"name": "GhostMarketToken",
|
|
71
|
+
"hash": "0x9b049f1283515eef1d3f6ac610e1595ed25ca3e9",
|
|
72
|
+
"decimals": 8
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"symbol": "NUDES",
|
|
76
|
+
"name": "Nudes",
|
|
77
|
+
"hash": "0x340720c7107ef5721e44ed2ea8e314cce5c130fa",
|
|
78
|
+
"decimals": 8
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"symbol": "CANDY",
|
|
82
|
+
"name": "NeoCandy",
|
|
83
|
+
"hash": "0x88da18a5bca86ec8206d9b4960a7d0c4355a432f",
|
|
84
|
+
"decimals": 9
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"symbol": "DOGER",
|
|
88
|
+
"name": "DogeRift",
|
|
89
|
+
"hash": "0x322b5a366ca724801a1aa01e669b5f3d7f8c7f6f",
|
|
90
|
+
"decimals": 8
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"symbol": "DOGEF",
|
|
94
|
+
"name": "DogeFood",
|
|
95
|
+
"hash": "0xa3291b66f70d4687fc0e41977d8acb0699f235ae",
|
|
96
|
+
"decimals": 8
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"symbol": "SOM",
|
|
100
|
+
"name": "Som",
|
|
101
|
+
"hash": "0x2d4c6cf0417209a7eb410160344e224e74f87195",
|
|
102
|
+
"decimals": 8
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"symbol": "LAMBO",
|
|
106
|
+
"name": "BoomerFund",
|
|
107
|
+
"hash": "0xafdd6abedf066ff8c5fbc868cc89f80eac467142",
|
|
108
|
+
"decimals": 8
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"symbol": "bNEO",
|
|
112
|
+
"hash": "0x48c40d4666f93408be1bef038b6722404d9a4c2a",
|
|
113
|
+
"decimals": 8,
|
|
114
|
+
"name": "BurgerNEO"
|
|
115
|
+
}
|
|
116
|
+
]
|
package/src/constants.ts
CHANGED
|
@@ -1,13 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NetworkType, Token } from '@cityofzion/blockchain-service'
|
|
2
|
+
import commom from './assets/tokens/common.json'
|
|
3
|
+
import mainnet from './assets/tokens/mainnet.json'
|
|
2
4
|
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
export const TOKENS: Record<NetworkType, Token[]> = {
|
|
6
|
+
mainnet: [...commom, ...mainnet],
|
|
7
|
+
testnet: commom,
|
|
8
|
+
custom: commom,
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
export const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
export const NEO_NS_HASH = '0x50ac1c37690cc2cfc594472833cf57505d5f46de'
|
|
12
|
+
|
|
13
|
+
export const DEFAULT_URL_BY_NETWORK_TYPE: Record<NetworkType, string> = {
|
|
14
|
+
mainnet: 'https://mainnet1.neo.coz.io:443',
|
|
15
|
+
testnet: 'https://testnet1.neo.coz.io:443',
|
|
16
|
+
custom: 'http://127.0.0.1:50012',
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const GHOSTMARKET_URL_BY_NETWORK_TYPE: Partial<Record<NetworkType, string>> = {
|
|
20
|
+
mainnet: 'https://api.ghostmarket.io/api/v2',
|
|
21
|
+
testnet: 'https://api-testnet.ghostmarket.io/api/v2',
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const GHOSTMARKET_CHAIN_BY_NETWORK_TYPE: Partial<Record<NetworkType, string>> = {
|
|
25
|
+
mainnet: 'n3',
|
|
26
|
+
testnet: 'n3t',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const DERIVATION_PATH = "m/44'/888'/0'/0/?"
|
package/src/index.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -4,15 +4,11 @@
|
|
|
4
4
|
"lib": ["ESNext"],
|
|
5
5
|
"outDir": "./dist"
|
|
6
6
|
},
|
|
7
|
-
"include": [
|
|
8
|
-
|
|
9
|
-
],
|
|
10
|
-
"exclude": [
|
|
11
|
-
"node_modules"
|
|
12
|
-
],
|
|
7
|
+
"include": ["src"],
|
|
8
|
+
"exclude": ["node_modules"],
|
|
13
9
|
"typedocOptions": {
|
|
14
10
|
"entryPoints": ["./src/index.ts"],
|
|
15
11
|
"out": "docs",
|
|
16
12
|
"exclude": "**/node_modules/**"
|
|
17
13
|
}
|
|
18
|
-
}
|
|
14
|
+
}
|
package/bs-neo3.build.error.log
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
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/dist/excpetions.d.ts
DELETED
package/dist/excpetions.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
};
|
package/src/BDSNeo3.ts
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { BalanceResponse, BlockchainNetwork, BlockchainDataService, ConsensusNodeResponse, ContractResponse, TokenInfoResponse, TransactionHistoryResponse, TransactionResponse, TransactionTransfer, BDSClaimable, UnclaimedResponse, TransactionNotifications, } from "@cityofzion/blockchain-service";
|
|
2
|
-
import { rpc } from "@cityofzion/neon-js";
|
|
3
|
-
import { api } from '@cityofzion/dora-ts'
|
|
4
|
-
import { TypedResponse } from "@cityofzion/dora-ts/dist/interfaces/api/common";
|
|
5
|
-
export class BDSNeo3 implements BlockchainDataService, BDSClaimable {
|
|
6
|
-
explorer: string = 'https://dora.coz.io'
|
|
7
|
-
network: BlockchainNetwork = 'mainnet'
|
|
8
|
-
setNetwork(network: BlockchainNetwork): void {
|
|
9
|
-
this.network = network
|
|
10
|
-
}
|
|
11
|
-
async getTransaction(txid: string): Promise<TransactionResponse> {
|
|
12
|
-
try {
|
|
13
|
-
const data = await api.NeoRest.transaction(txid, this.network)
|
|
14
|
-
const transaction = await this.findTransactionByTxid(txid, data.sender)
|
|
15
|
-
if (!data || !transaction) throw new Error("query getTransaction failed");
|
|
16
|
-
const result: TransactionResponse = {
|
|
17
|
-
block: data.block,
|
|
18
|
-
time: data.time,
|
|
19
|
-
txid: data.hash,
|
|
20
|
-
netfee: data.netfee,
|
|
21
|
-
sysfee: data.sysfee,
|
|
22
|
-
totfee: (Number(data.netfee) + Number(data.sysfee)).toString(),
|
|
23
|
-
notifications: transaction.notifications,
|
|
24
|
-
transfers: transaction.transfers
|
|
25
|
-
}
|
|
26
|
-
return result
|
|
27
|
-
} catch (error) {
|
|
28
|
-
throw error;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
private async findTransactionByTxid(txid: string, address: string) {
|
|
32
|
-
try {
|
|
33
|
-
let transaction: TransactionResponse | undefined = undefined
|
|
34
|
-
let page: number = 1
|
|
35
|
-
let stop: boolean = false
|
|
36
|
-
while (!stop) {
|
|
37
|
-
const transactionHistory = await this.getHistoryTransactions(address, page)
|
|
38
|
-
transaction = transactionHistory.transactions.find(tx => tx.txid === txid)
|
|
39
|
-
if (transaction) {
|
|
40
|
-
stop = true
|
|
41
|
-
} else {
|
|
42
|
-
page++
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (!transaction) throw new Error(`Problem to build the transfers of transaction => ${txid}`);
|
|
46
|
-
|
|
47
|
-
return transaction
|
|
48
|
-
} catch (error) {
|
|
49
|
-
throw new Error(`Problem to build the transfers of transaction => ${txid}`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async getHistoryTransactions(address: string, page: number = 1): Promise<TransactionHistoryResponse> {
|
|
53
|
-
try {
|
|
54
|
-
const data = await api.NeoRest.addressTXFull(address, page, this.network)
|
|
55
|
-
if (!data) throw new Error("query getHistoryTransactions failed");
|
|
56
|
-
const result: TransactionHistoryResponse = {
|
|
57
|
-
totalCount: data.totalCount,
|
|
58
|
-
transactions: data.items.map<TransactionResponse>(item => ({
|
|
59
|
-
block: item.block,
|
|
60
|
-
time: item.time,
|
|
61
|
-
txid: item.hash,
|
|
62
|
-
netfee: item.netfee,
|
|
63
|
-
sysfee: item.sysfee,
|
|
64
|
-
totfee: (Number(item.sysfee) + Number(item.netfee)).toString(),
|
|
65
|
-
transfers: item.transfers.map<Omit<TransactionTransfer, "txid">>(transfer => {
|
|
66
|
-
return {
|
|
67
|
-
amount: transfer.amount,
|
|
68
|
-
from: transfer.from,
|
|
69
|
-
to: transfer.to,
|
|
70
|
-
hash: transfer.scripthash
|
|
71
|
-
};
|
|
72
|
-
}),
|
|
73
|
-
notifications: item.notifications.map<TransactionNotifications>(notification => ({
|
|
74
|
-
contract: notification.contract,
|
|
75
|
-
event_name: notification.event_name,
|
|
76
|
-
state: notification.state as any as TypedResponse[]
|
|
77
|
-
}))
|
|
78
|
-
}))
|
|
79
|
-
}
|
|
80
|
-
data.items.forEach(item => {
|
|
81
|
-
item.transfers
|
|
82
|
-
})
|
|
83
|
-
return result
|
|
84
|
-
} catch (error) {
|
|
85
|
-
throw error;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
async getContract(contractHash: string): Promise<ContractResponse> {
|
|
89
|
-
try {
|
|
90
|
-
const data = await api.NeoRest.contract(contractHash, this.network)
|
|
91
|
-
if (!data) throw new Error("query getContract failed");
|
|
92
|
-
const result: ContractResponse = {
|
|
93
|
-
hash: data.hash,
|
|
94
|
-
methods: data.manifest.abi.methods,
|
|
95
|
-
name: data.manifest.name
|
|
96
|
-
}
|
|
97
|
-
return result
|
|
98
|
-
} catch (error) {
|
|
99
|
-
throw error;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
async getTokenInfo(tokenHash: string): Promise<TokenInfoResponse> {
|
|
104
|
-
try {
|
|
105
|
-
const data = await api.NeoRest.asset(tokenHash, this.network)
|
|
106
|
-
if (!data) throw new Error("query getTokenInfo failed");
|
|
107
|
-
const result: TokenInfoResponse = {
|
|
108
|
-
decimals: Number(data.decimals),
|
|
109
|
-
symbol: data.symbol
|
|
110
|
-
}
|
|
111
|
-
return result
|
|
112
|
-
} catch (error) {
|
|
113
|
-
throw error;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
async getBalance(address: string): Promise<BalanceResponse[]> {
|
|
117
|
-
try {
|
|
118
|
-
const data = await api.NeoRest.balance(address, this.network)
|
|
119
|
-
if (!data) throw new Error("query getBalance failed");
|
|
120
|
-
const result: BalanceResponse[] = data.map<BalanceResponse>(balance => {
|
|
121
|
-
return {
|
|
122
|
-
amount: Number(balance.balance),
|
|
123
|
-
hash: balance.asset,
|
|
124
|
-
name: balance.asset_name,
|
|
125
|
-
symbol: balance.symbol,
|
|
126
|
-
}
|
|
127
|
-
})
|
|
128
|
-
return result
|
|
129
|
-
} catch (error) {
|
|
130
|
-
throw error;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
async getAllNodes(): Promise<ConsensusNodeResponse[]> {
|
|
134
|
-
try {
|
|
135
|
-
const data = await api.NeoRest.getAllNodes()
|
|
136
|
-
const result: ConsensusNodeResponse[] = data
|
|
137
|
-
return result
|
|
138
|
-
} catch (error) {
|
|
139
|
-
throw error;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
async getHigherNode(): Promise<ConsensusNodeResponse> {
|
|
143
|
-
const nodes = await this.getAllNodes()
|
|
144
|
-
const node = nodes.reduce((bestNode, node) => {
|
|
145
|
-
if (bestNode.height >= node.height) {
|
|
146
|
-
return bestNode
|
|
147
|
-
}
|
|
148
|
-
return node
|
|
149
|
-
})
|
|
150
|
-
return node
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
//Implementation of BDSClaimable
|
|
154
|
-
async getUnclaimed(address: string): Promise<UnclaimedResponse> {
|
|
155
|
-
try {
|
|
156
|
-
const url = (await this.getHigherNode()).url
|
|
157
|
-
const rpcClient = new rpc.RPCClient(url)
|
|
158
|
-
const response = await rpcClient.getUnclaimedGas(address)
|
|
159
|
-
const result: UnclaimedResponse = {
|
|
160
|
-
address,
|
|
161
|
-
unclaimed: Number(response),
|
|
162
|
-
}
|
|
163
|
-
return result;
|
|
164
|
-
} catch (error) {
|
|
165
|
-
throw error;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
Binary file
|
|
Binary file
|
package/src/assets/tokens.json
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"symbol": "GAS",
|
|
4
|
-
"name": "GASToken",
|
|
5
|
-
"hash": "d2a4cff31913016155e38e474a2c06d08be276cf",
|
|
6
|
-
"decimals": 8
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
"symbol": "NEO",
|
|
10
|
-
"name": "NeoToken",
|
|
11
|
-
"hash": "ef4073a0f2b305a38ec4050e4d3d28bc40ea63f5",
|
|
12
|
-
"decimals": 0
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"symbol": "LRB",
|
|
16
|
-
"name": "LyrebirdToken",
|
|
17
|
-
"hash": "8c07b4c9f5bc170a3922eac4f5bb7ef17b0acc8b",
|
|
18
|
-
"decimals": 8
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"symbol": "USDL",
|
|
22
|
-
"name": "LyrebirdUSDToken",
|
|
23
|
-
"hash": "a8c51aa0c177187aeed3db88bdfa908ccbc9b1a5",
|
|
24
|
-
"decimals": 8
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"symbol": "FLM",
|
|
28
|
-
"name": "FLM",
|
|
29
|
-
"hash": "0xf0151f528127558851b39c2cd8aa47da7418ab28",
|
|
30
|
-
"decimals": 8
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"symbol": "fCAKE",
|
|
34
|
-
"name": "fCAKE",
|
|
35
|
-
"hash": "0xe65b462b90516012826f8a9c4c285d8c750e3a77",
|
|
36
|
-
"decimals": 18
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"symbol": "WING",
|
|
40
|
-
"name": "WING",
|
|
41
|
-
"hash": "0xeeccd60ed722111f8400434dac3ba42c14d8beb1",
|
|
42
|
-
"decimals": 9
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"symbol": "fWETH",
|
|
46
|
-
"name": "fWETH",
|
|
47
|
-
"hash": "0xc14b601252aa5dfa6166cf35fe5ccd2e35f3fdf5",
|
|
48
|
-
"decimals": 18
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"symbol": "fWBTC",
|
|
52
|
-
"name": "fWBTC",
|
|
53
|
-
"hash": "0xd6abe115ecb75e1fa0b42f5e85934ce8c1ae2893",
|
|
54
|
-
"decimals": 8
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"symbol": "SWTH",
|
|
58
|
-
"name": "SWTHToken",
|
|
59
|
-
"hash": "0x78e1330db47634afdb5ea455302ba2d12b8d549f",
|
|
60
|
-
"decimals": 8
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"symbol": "pONT",
|
|
64
|
-
"name": "pONT",
|
|
65
|
-
"hash": "0x8122bc2212ec971690a044b37a6f52a9349b702b",
|
|
66
|
-
"decimals": 9
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"symbol": "fUSDT",
|
|
70
|
-
"name": "fUSDT",
|
|
71
|
-
"hash": "0xcd48b160c1bbc9d74997b803b9a7ad50a4bef020",
|
|
72
|
-
"decimals": 6
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"symbol": "FLUND",
|
|
76
|
-
"name": "FLUND",
|
|
77
|
-
"hash": "0xa9603a59e21d29e37ac39cf1b5f5abf5006b22a3",
|
|
78
|
-
"decimals": 8
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"symbol": "GM",
|
|
82
|
-
"name": "GhostMarketToken",
|
|
83
|
-
"hash": "0x9b049f1283515eef1d3f6ac610e1595ed25ca3e9",
|
|
84
|
-
"decimals": 8
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"symbol": "NUDES",
|
|
88
|
-
"name": "Nudes",
|
|
89
|
-
"hash": "0x340720c7107ef5721e44ed2ea8e314cce5c130fa",
|
|
90
|
-
"decimals": 8
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
"symbol": "CANDY",
|
|
94
|
-
"name": "NeoCandy",
|
|
95
|
-
"hash": "0x88da18a5bca86ec8206d9b4960a7d0c4355a432f",
|
|
96
|
-
"decimals": 9
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
"symbol": "DOGER",
|
|
100
|
-
"name": "DogeRift",
|
|
101
|
-
"hash": "0x322b5a366ca724801a1aa01e669b5f3d7f8c7f6f",
|
|
102
|
-
"decimals": 8
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
"symbol": "DOGEF",
|
|
106
|
-
"name": "DogeFood",
|
|
107
|
-
"hash": "0xa3291b66f70d4687fc0e41977d8acb0699f235ae",
|
|
108
|
-
"decimals": 8
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
"symbol": "SOM",
|
|
112
|
-
"name": "Som",
|
|
113
|
-
"hash": "0x2d4c6cf0417209a7eb410160344e224e74f87195",
|
|
114
|
-
"decimals": 8
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
"symbol": "LAMBO",
|
|
118
|
-
"name": "BoomerFund",
|
|
119
|
-
"hash": "0xafdd6abedf066ff8c5fbc868cc89f80eac467142",
|
|
120
|
-
"decimals": 8
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
"symbol": "bNEO",
|
|
124
|
-
"hash": "0x48c40d4666f93408be1bef038b6722404d9a4c2a",
|
|
125
|
-
"decimals": 8,
|
|
126
|
-
"name": "BurgerNEO"
|
|
127
|
-
}
|
|
128
|
-
]
|
|
129
|
-
|