@cityofzion/bs-neo3 0.11.1 → 0.11.3
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/dist/RpcBDSNeo3.d.ts +2 -1
- package/dist/RpcBDSNeo3.js +26 -0
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +30 -6
- package/package.json +3 -3
package/dist/RpcBDSNeo3.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BDSClaimable, BalanceResponse, BlockchainDataService, ContractResponse, Network, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse } from '@cityofzion/blockchain-service';
|
|
1
|
+
import { BDSClaimable, BalanceResponse, BlockchainDataService, ContractResponse, Network, RpcResponse, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse } from '@cityofzion/blockchain-service';
|
|
2
2
|
export declare class RPCBDSNeo3 implements BlockchainDataService, BDSClaimable {
|
|
3
3
|
readonly _tokenCache: Map<string, Token>;
|
|
4
4
|
readonly _feeToken: Token;
|
|
@@ -13,4 +13,5 @@ export declare class RPCBDSNeo3 implements BlockchainDataService, BDSClaimable {
|
|
|
13
13
|
getBalance(address: string): Promise<BalanceResponse[]>;
|
|
14
14
|
getBlockHeight(): Promise<number>;
|
|
15
15
|
getUnclaimed(address: string): Promise<string>;
|
|
16
|
+
getRpcList(): Promise<RpcResponse[]>;
|
|
16
17
|
}
|
package/dist/RpcBDSNeo3.js
CHANGED
|
@@ -155,5 +155,31 @@ class RPCBDSNeo3 {
|
|
|
155
155
|
return neon_core_1.u.BigInteger.fromNumber(response).toDecimal(this._claimToken.decimals);
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
+
getRpcList() {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
const list = [];
|
|
161
|
+
const promises = constants_1.RPC_LIST_BY_NETWORK_TYPE[this._network.type].map(url => {
|
|
162
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
163
|
+
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
const timeout = setTimeout(() => {
|
|
165
|
+
resolve();
|
|
166
|
+
}, 5000);
|
|
167
|
+
try {
|
|
168
|
+
const rpcClient = new neon_core_1.rpc.RPCClient(url);
|
|
169
|
+
const timeStart = Date.now();
|
|
170
|
+
const height = yield rpcClient.getBlockCount();
|
|
171
|
+
const latency = Date.now() - timeStart;
|
|
172
|
+
list.push({ url, latency, height });
|
|
173
|
+
}
|
|
174
|
+
finally {
|
|
175
|
+
resolve();
|
|
176
|
+
clearTimeout(timeout);
|
|
177
|
+
}
|
|
178
|
+
}));
|
|
179
|
+
});
|
|
180
|
+
yield Promise.allSettled(promises);
|
|
181
|
+
return list;
|
|
182
|
+
});
|
|
183
|
+
}
|
|
158
184
|
}
|
|
159
185
|
exports.RPCBDSNeo3 = RPCBDSNeo3;
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { NetworkType, Token } from '@cityofzion/blockchain-service';
|
|
2
2
|
export declare const TOKENS: Record<NetworkType, Token[]>;
|
|
3
3
|
export declare const NEO_NS_HASH = "0x50ac1c37690cc2cfc594472833cf57505d5f46de";
|
|
4
|
-
export declare const DEFAULT_URL_BY_NETWORK_TYPE: Record<NetworkType, string>;
|
|
5
4
|
export declare const GHOSTMARKET_URL_BY_NETWORK_TYPE: Partial<Record<NetworkType, string>>;
|
|
6
5
|
export declare const GHOSTMARKET_CHAIN_BY_NETWORK_TYPE: Partial<Record<NetworkType, string>>;
|
|
7
6
|
export declare const DERIVATION_PATH = "m/44'/888'/0'/0/?";
|
|
7
|
+
export declare const RPC_LIST_BY_NETWORK_TYPE: Record<NetworkType, string[]>;
|
|
8
|
+
export declare const DEFAULT_URL_BY_NETWORK_TYPE: Record<NetworkType, string>;
|
package/dist/constants.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.DEFAULT_URL_BY_NETWORK_TYPE = exports.RPC_LIST_BY_NETWORK_TYPE = exports.DERIVATION_PATH = exports.GHOSTMARKET_CHAIN_BY_NETWORK_TYPE = exports.GHOSTMARKET_URL_BY_NETWORK_TYPE = exports.NEO_NS_HASH = exports.TOKENS = void 0;
|
|
7
7
|
const common_json_1 = __importDefault(require("./assets/tokens/common.json"));
|
|
8
8
|
const mainnet_json_1 = __importDefault(require("./assets/tokens/mainnet.json"));
|
|
9
9
|
exports.TOKENS = {
|
|
@@ -12,11 +12,6 @@ exports.TOKENS = {
|
|
|
12
12
|
custom: common_json_1.default,
|
|
13
13
|
};
|
|
14
14
|
exports.NEO_NS_HASH = '0x50ac1c37690cc2cfc594472833cf57505d5f46de';
|
|
15
|
-
exports.DEFAULT_URL_BY_NETWORK_TYPE = {
|
|
16
|
-
mainnet: 'https://mainnet1.neo.coz.io:443',
|
|
17
|
-
testnet: 'https://testnet1.neo.coz.io:443',
|
|
18
|
-
custom: 'http://127.0.0.1:50012',
|
|
19
|
-
};
|
|
20
15
|
exports.GHOSTMARKET_URL_BY_NETWORK_TYPE = {
|
|
21
16
|
mainnet: 'https://api.ghostmarket.io/api/v2',
|
|
22
17
|
testnet: 'https://api-testnet.ghostmarket.io/api/v2',
|
|
@@ -26,3 +21,32 @@ exports.GHOSTMARKET_CHAIN_BY_NETWORK_TYPE = {
|
|
|
26
21
|
testnet: 'n3t',
|
|
27
22
|
};
|
|
28
23
|
exports.DERIVATION_PATH = "m/44'/888'/0'/0/?";
|
|
24
|
+
exports.RPC_LIST_BY_NETWORK_TYPE = {
|
|
25
|
+
mainnet: [
|
|
26
|
+
'https://mainnet1.neo.coz.io:443',
|
|
27
|
+
'https://mainnet4.neo.coz.io:443',
|
|
28
|
+
'http://seed1.neo.org:10332',
|
|
29
|
+
'http://seed2.neo.org:10332',
|
|
30
|
+
'https://mainnet2.neo.coz.io:443',
|
|
31
|
+
'https://mainnet5.neo.coz.io:443',
|
|
32
|
+
'https://mainnet3.neo.coz.io:443',
|
|
33
|
+
'https://rpc10.n3.nspcc.ru:10331',
|
|
34
|
+
'https://neo1-nodes.ghostmarket.io:443',
|
|
35
|
+
],
|
|
36
|
+
testnet: [
|
|
37
|
+
'https://testnet1.neo.coz.io:443',
|
|
38
|
+
'https://testnet2.neo.coz.io:443',
|
|
39
|
+
'https://rpc.t5.n3.nspcc.ru:20331',
|
|
40
|
+
'http://seed1t5.neo.org:20332',
|
|
41
|
+
'http://seed2t5.neo.org:20332',
|
|
42
|
+
'http://seed3t5.neo.org:20332',
|
|
43
|
+
'http://seed4t5.neo.org:20332',
|
|
44
|
+
'http://seed5t5.neo.org:20332',
|
|
45
|
+
],
|
|
46
|
+
custom: ['http://127.0.0.1:50012'],
|
|
47
|
+
};
|
|
48
|
+
exports.DEFAULT_URL_BY_NETWORK_TYPE = {
|
|
49
|
+
mainnet: exports.RPC_LIST_BY_NETWORK_TYPE.mainnet[0],
|
|
50
|
+
testnet: exports.RPC_LIST_BY_NETWORK_TYPE.testnet[0],
|
|
51
|
+
custom: exports.RPC_LIST_BY_NETWORK_TYPE.custom[0],
|
|
52
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neo3",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"@cityofzion/neon-dappkit": "0.4.1",
|
|
20
20
|
"@cityofzion/neon-dappkit-types": "~0.3.1",
|
|
21
21
|
"@ledgerhq/hw-transport-node-hid": "~6.28.5",
|
|
22
|
-
"@cityofzion/blockchain-service": "0.11.
|
|
23
|
-
"@cityofzion/bs-asteroid-sdk": "0.8.
|
|
22
|
+
"@cityofzion/blockchain-service": "0.11.1",
|
|
23
|
+
"@cityofzion/bs-asteroid-sdk": "0.8.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/jest": "29.5.3",
|