@cityofzion/bs-neo-legacy 1.0.0 → 1.0.2
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/BSNeoLegacy.d.ts +8 -7
- package/dist/BSNeoLegacy.js +25 -19
- package/dist/BSNeoLegacyHelper.d.ts +27 -0
- package/dist/BSNeoLegacyHelper.js +74 -0
- package/dist/CryptoCompareEDSNeoLegacy.d.ts +3 -3
- package/dist/CryptoCompareEDSNeoLegacy.js +2 -3
- package/dist/DoraBDSNeoLegacy.d.ts +2 -2
- package/dist/DoraBDSNeoLegacy.js +9 -7
- package/dist/{DoraESNeoLegacy.d.ts → NeoTubeESNeoLegacy.d.ts} +4 -2
- package/dist/{DoraESNeoLegacy.js → NeoTubeESNeoLegacy.js} +16 -8
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/package.json +2 -2
- package/dist/constants.d.ts +0 -13
- package/dist/constants.js +0 -41
package/dist/BSNeoLegacy.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { Account, BDSClaimable, BlockchainDataService, BlockchainService, BSClaimable, ExchangeDataService, Token, Network, TransferParam, AccountWithDerivationPath, BSWithExplorerService, ExplorerService
|
|
2
|
-
import { AvailableNetworkIds } from './
|
|
1
|
+
import { Account, BDSClaimable, BlockchainDataService, BlockchainService, BSClaimable, ExchangeDataService, Token, Network, TransferParam, AccountWithDerivationPath, BSWithExplorerService, ExplorerService } from '@cityofzion/blockchain-service';
|
|
2
|
+
import { AvailableNetworkIds } from './BSNeoLegacyHelper';
|
|
3
3
|
export declare class BSNeoLegacy<BSCustomName extends string = string> implements BlockchainService<BSCustomName, AvailableNetworkIds>, BSClaimable, BSWithExplorerService {
|
|
4
|
+
#private;
|
|
4
5
|
readonly blockchainName: BSCustomName;
|
|
5
|
-
readonly feeToken: Token;
|
|
6
|
-
readonly claimToken: Token;
|
|
7
|
-
readonly burnToken: Token;
|
|
8
6
|
readonly derivationPath: string;
|
|
7
|
+
feeToken: Token;
|
|
8
|
+
claimToken: Token;
|
|
9
|
+
burnToken: Token;
|
|
9
10
|
blockchainDataService: BlockchainDataService & BDSClaimable;
|
|
10
11
|
exchangeDataService: ExchangeDataService;
|
|
11
12
|
explorerService: ExplorerService;
|
|
12
13
|
tokens: Token[];
|
|
13
14
|
network: Network<AvailableNetworkIds>;
|
|
14
15
|
legacyNetwork: string;
|
|
15
|
-
constructor(blockchainName: BSCustomName, network
|
|
16
|
-
setNetwork(
|
|
16
|
+
constructor(blockchainName: BSCustomName, network?: Network<AvailableNetworkIds>);
|
|
17
|
+
setNetwork(network: Network<AvailableNetworkIds>): void;
|
|
17
18
|
validateAddress(address: string): boolean;
|
|
18
19
|
validateEncrypted(key: string): boolean;
|
|
19
20
|
validateKey(key: string): boolean;
|
package/dist/BSNeoLegacy.js
CHANGED
|
@@ -8,6 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
11
16
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
17
|
var t = {};
|
|
13
18
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -19,36 +24,30 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
19
24
|
}
|
|
20
25
|
return t;
|
|
21
26
|
};
|
|
27
|
+
var _BSNeoLegacy_instances, _BSNeoLegacy_setTokens;
|
|
22
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
29
|
exports.BSNeoLegacy = void 0;
|
|
24
30
|
const neon_js_1 = require("@cityofzion/neon-js");
|
|
25
|
-
const constants_1 = require("./constants");
|
|
26
31
|
const DoraBDSNeoLegacy_1 = require("./DoraBDSNeoLegacy");
|
|
27
32
|
const CryptoCompareEDSNeoLegacy_1 = require("./CryptoCompareEDSNeoLegacy");
|
|
28
33
|
const bs_asteroid_sdk_1 = require("@cityofzion/bs-asteroid-sdk");
|
|
29
|
-
const
|
|
34
|
+
const BSNeoLegacyHelper_1 = require("./BSNeoLegacyHelper");
|
|
35
|
+
const NeoTubeESNeoLegacy_1 = require("./NeoTubeESNeoLegacy");
|
|
30
36
|
class BSNeoLegacy {
|
|
31
37
|
constructor(blockchainName, network) {
|
|
38
|
+
_BSNeoLegacy_instances.add(this);
|
|
39
|
+
network = network !== null && network !== void 0 ? network : BSNeoLegacyHelper_1.BSNeoLegacyHelper.DEFAULT_NETWORK;
|
|
32
40
|
this.blockchainName = blockchainName;
|
|
33
|
-
this.legacyNetwork =
|
|
34
|
-
this.derivationPath =
|
|
35
|
-
this.tokens = constants_1.TOKENS[network.id];
|
|
36
|
-
this.claimToken = this.tokens.find(token => token.symbol === 'GAS');
|
|
37
|
-
this.burnToken = this.tokens.find(token => token.symbol === 'NEO');
|
|
38
|
-
this.feeToken = this.tokens.find(token => token.symbol === 'GAS');
|
|
41
|
+
this.legacyNetwork = BSNeoLegacyHelper_1.BSNeoLegacyHelper.LEGACY_NETWORK_BY_NETWORK_ID[network.id];
|
|
42
|
+
this.derivationPath = BSNeoLegacyHelper_1.BSNeoLegacyHelper.DERIVATION_PATH;
|
|
39
43
|
this.setNetwork(network);
|
|
40
44
|
}
|
|
41
|
-
setNetwork(
|
|
42
|
-
|
|
43
|
-
const network = {
|
|
44
|
-
id: param.id,
|
|
45
|
-
name: (_a = param.name) !== null && _a !== void 0 ? _a : param.id,
|
|
46
|
-
url: (_b = param.url) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_URL_BY_NETWORK_TYPE[param.id],
|
|
47
|
-
};
|
|
45
|
+
setNetwork(network) {
|
|
46
|
+
__classPrivateFieldGet(this, _BSNeoLegacy_instances, "m", _BSNeoLegacy_setTokens).call(this, network);
|
|
48
47
|
this.network = network;
|
|
49
|
-
this.blockchainDataService = new DoraBDSNeoLegacy_1.DoraBDSNeoLegacy(network, this.feeToken, this.claimToken);
|
|
50
|
-
this.exchangeDataService = new CryptoCompareEDSNeoLegacy_1.CryptoCompareEDSNeoLegacy(network.id);
|
|
51
|
-
this.explorerService = new
|
|
48
|
+
this.blockchainDataService = new DoraBDSNeoLegacy_1.DoraBDSNeoLegacy(network, this.feeToken, this.claimToken, this.tokens);
|
|
49
|
+
this.exchangeDataService = new CryptoCompareEDSNeoLegacy_1.CryptoCompareEDSNeoLegacy(network.id, this.tokens);
|
|
50
|
+
this.explorerService = new NeoTubeESNeoLegacy_1.NeoTubeESNeoLegacy(network.id);
|
|
52
51
|
}
|
|
53
52
|
validateAddress(address) {
|
|
54
53
|
return neon_js_1.wallet.isAddress(address);
|
|
@@ -95,7 +94,7 @@ class BSNeoLegacy {
|
|
|
95
94
|
const intents = [transferIntent, ...(tipIntent ? [tipIntent] : [])];
|
|
96
95
|
for (const intent of intents) {
|
|
97
96
|
const tokenHashFixed = intent.tokenHash.replace('0x', '');
|
|
98
|
-
const nativeAsset =
|
|
97
|
+
const nativeAsset = BSNeoLegacyHelper_1.BSNeoLegacyHelper.NATIVE_ASSETS.find(asset => asset.hash === tokenHashFixed);
|
|
99
98
|
if (nativeAsset) {
|
|
100
99
|
nativeIntents.push(...neon_js_1.api.makeIntent({ [nativeAsset.symbol]: Number(intent.amount) }, intent.receiverAddress));
|
|
101
100
|
continue;
|
|
@@ -159,3 +158,10 @@ class BSNeoLegacy {
|
|
|
159
158
|
}
|
|
160
159
|
}
|
|
161
160
|
exports.BSNeoLegacy = BSNeoLegacy;
|
|
161
|
+
_BSNeoLegacy_instances = new WeakSet(), _BSNeoLegacy_setTokens = function _BSNeoLegacy_setTokens(network) {
|
|
162
|
+
const tokens = BSNeoLegacyHelper_1.BSNeoLegacyHelper.getTokens(network);
|
|
163
|
+
this.tokens = tokens;
|
|
164
|
+
this.feeToken = tokens.find(token => token.symbol === 'GAS');
|
|
165
|
+
this.burnToken = tokens.find(token => token.symbol === 'NEO');
|
|
166
|
+
this.claimToken = tokens.find(token => token.symbol === 'GAS');
|
|
167
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Network } from '@cityofzion/blockchain-service';
|
|
2
|
+
export type AvailableNetworkIds = 'mainnet' | 'testnet';
|
|
3
|
+
export declare class BSNeoLegacyHelper {
|
|
4
|
+
#private;
|
|
5
|
+
static NATIVE_ASSETS: {
|
|
6
|
+
symbol: string;
|
|
7
|
+
name: string;
|
|
8
|
+
hash: string;
|
|
9
|
+
decimals: number;
|
|
10
|
+
}[];
|
|
11
|
+
static LEGACY_NETWORK_BY_NETWORK_ID: Record<AvailableNetworkIds, string>;
|
|
12
|
+
static MAINNET_NETWORK_IDS: AvailableNetworkIds[];
|
|
13
|
+
static TESTNET_NETWORK_IDS: AvailableNetworkIds[];
|
|
14
|
+
static ALL_NETWORK_IDS: AvailableNetworkIds[];
|
|
15
|
+
static MAINNET_NETWORKS: Network<AvailableNetworkIds>[];
|
|
16
|
+
static TESTNET_NETWORKS: Network<AvailableNetworkIds>[];
|
|
17
|
+
static ALL_NETWORKS: Network<AvailableNetworkIds>[];
|
|
18
|
+
static DERIVATION_PATH: string;
|
|
19
|
+
static DEFAULT_NETWORK: Network<AvailableNetworkIds>;
|
|
20
|
+
static getTokens(network: Network<AvailableNetworkIds>): {
|
|
21
|
+
symbol: string;
|
|
22
|
+
name: string;
|
|
23
|
+
hash: string;
|
|
24
|
+
decimals: number;
|
|
25
|
+
}[];
|
|
26
|
+
static getRpcList(network: Network<AvailableNetworkIds>): string[];
|
|
27
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
5
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
|
+
};
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
10
|
+
var _a, _BSNeoLegacyHelper_EXTRA_TOKENS_BY_NETWORK_ID, _BSNeoLegacyHelper_RPC_LIST_BY_NETWORK_ID;
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BSNeoLegacyHelper = void 0;
|
|
13
|
+
const common_json_1 = __importDefault(require("./assets/tokens/common.json"));
|
|
14
|
+
const mainnet_json_1 = __importDefault(require("./assets/tokens/mainnet.json"));
|
|
15
|
+
class BSNeoLegacyHelper {
|
|
16
|
+
static getTokens(network) {
|
|
17
|
+
var _b;
|
|
18
|
+
const extraTokens = (_b = __classPrivateFieldGet(this, _a, "f", _BSNeoLegacyHelper_EXTRA_TOKENS_BY_NETWORK_ID)[network.id]) !== null && _b !== void 0 ? _b : [];
|
|
19
|
+
return [...extraTokens, ...common_json_1.default];
|
|
20
|
+
}
|
|
21
|
+
static getRpcList(network) {
|
|
22
|
+
var _b;
|
|
23
|
+
return (_b = __classPrivateFieldGet(this, _a, "f", _BSNeoLegacyHelper_RPC_LIST_BY_NETWORK_ID)[network.id]) !== null && _b !== void 0 ? _b : [];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.BSNeoLegacyHelper = BSNeoLegacyHelper;
|
|
27
|
+
_a = BSNeoLegacyHelper;
|
|
28
|
+
_BSNeoLegacyHelper_EXTRA_TOKENS_BY_NETWORK_ID = { value: {
|
|
29
|
+
mainnet: mainnet_json_1.default,
|
|
30
|
+
} };
|
|
31
|
+
BSNeoLegacyHelper.NATIVE_ASSETS = common_json_1.default;
|
|
32
|
+
_BSNeoLegacyHelper_RPC_LIST_BY_NETWORK_ID = { value: {
|
|
33
|
+
mainnet: [
|
|
34
|
+
'http://seed9.ngd.network:10332',
|
|
35
|
+
'https://mainnet1.neo2.coz.io:443',
|
|
36
|
+
'https://mainnet2.neo2.coz.io:443',
|
|
37
|
+
'https://mainnet3.neo2.coz.io:443',
|
|
38
|
+
'http://seed1.ngd.network:10332',
|
|
39
|
+
'http://seed2.ngd.network:10332',
|
|
40
|
+
'http://seed3.ngd.network:10332',
|
|
41
|
+
'http://seed4.ngd.network:10332',
|
|
42
|
+
'http://seed5.ngd.network:10332',
|
|
43
|
+
],
|
|
44
|
+
testnet: [
|
|
45
|
+
'http://seed5.ngd.network:20332',
|
|
46
|
+
'http://seed1.ngd.network:20332',
|
|
47
|
+
'http://seed2.ngd.network:20332',
|
|
48
|
+
'https://testnet1.neo2.coz.io:443',
|
|
49
|
+
],
|
|
50
|
+
} };
|
|
51
|
+
BSNeoLegacyHelper.LEGACY_NETWORK_BY_NETWORK_ID = {
|
|
52
|
+
mainnet: 'MainNet',
|
|
53
|
+
testnet: 'TestNet',
|
|
54
|
+
};
|
|
55
|
+
BSNeoLegacyHelper.MAINNET_NETWORK_IDS = ['mainnet'];
|
|
56
|
+
BSNeoLegacyHelper.TESTNET_NETWORK_IDS = ['testnet'];
|
|
57
|
+
BSNeoLegacyHelper.ALL_NETWORK_IDS = [..._a.MAINNET_NETWORK_IDS, ..._a.TESTNET_NETWORK_IDS];
|
|
58
|
+
BSNeoLegacyHelper.MAINNET_NETWORKS = [
|
|
59
|
+
{
|
|
60
|
+
id: 'mainnet',
|
|
61
|
+
name: 'Mainnet',
|
|
62
|
+
url: __classPrivateFieldGet(_a, _a, "f", _BSNeoLegacyHelper_RPC_LIST_BY_NETWORK_ID)['mainnet'][0],
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
BSNeoLegacyHelper.TESTNET_NETWORKS = [
|
|
66
|
+
{
|
|
67
|
+
id: 'testnet',
|
|
68
|
+
name: 'Testnet',
|
|
69
|
+
url: __classPrivateFieldGet(_a, _a, "f", _BSNeoLegacyHelper_RPC_LIST_BY_NETWORK_ID)['testnet'][0],
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
BSNeoLegacyHelper.ALL_NETWORKS = [..._a.MAINNET_NETWORKS, ..._a.TESTNET_NETWORKS];
|
|
73
|
+
BSNeoLegacyHelper.DERIVATION_PATH = "m/44'/888'/0'/0/?";
|
|
74
|
+
BSNeoLegacyHelper.DEFAULT_NETWORK = _a.MAINNET_NETWORKS[0];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CryptoCompareEDS, Currency, ExchangeDataService, GetTokenPriceHistory, TokenPricesHistoryResponse, TokenPricesResponse } from '@cityofzion/blockchain-service';
|
|
2
|
-
import { AvailableNetworkIds } from './
|
|
1
|
+
import { CryptoCompareEDS, Currency, ExchangeDataService, GetTokenPriceHistory, Token, TokenPricesHistoryResponse, TokenPricesResponse } from '@cityofzion/blockchain-service';
|
|
2
|
+
import { AvailableNetworkIds } from './BSNeoLegacyHelper';
|
|
3
3
|
export declare class CryptoCompareEDSNeoLegacy extends CryptoCompareEDS implements ExchangeDataService {
|
|
4
4
|
#private;
|
|
5
|
-
constructor(networkId: AvailableNetworkIds);
|
|
5
|
+
constructor(networkId: AvailableNetworkIds, tokens: Token[]);
|
|
6
6
|
getTokenPriceHistory(params: GetTokenPriceHistory): Promise<TokenPricesHistoryResponse[]>;
|
|
7
7
|
getTokenPrices(currency: Currency): Promise<TokenPricesResponse[]>;
|
|
8
8
|
}
|
|
@@ -14,10 +14,9 @@ var _CryptoCompareEDSNeoLegacy_networkId;
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.CryptoCompareEDSNeoLegacy = void 0;
|
|
16
16
|
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
17
|
-
const constants_1 = require("./constants");
|
|
18
17
|
class CryptoCompareEDSNeoLegacy extends blockchain_service_1.CryptoCompareEDS {
|
|
19
|
-
constructor(networkId) {
|
|
20
|
-
super(
|
|
18
|
+
constructor(networkId, tokens) {
|
|
19
|
+
super(tokens);
|
|
21
20
|
_CryptoCompareEDSNeoLegacy_networkId.set(this, void 0);
|
|
22
21
|
__classPrivateFieldSet(this, _CryptoCompareEDSNeoLegacy_networkId, networkId, "f");
|
|
23
22
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BalanceResponse, BlockchainDataService, ContractResponse, TransactionsByAddressParams, TransactionsByAddressResponse, TransactionResponse, BDSClaimable, Token, Network, RpcResponse } from '@cityofzion/blockchain-service';
|
|
2
|
-
import { AvailableNetworkIds } from './
|
|
2
|
+
import { AvailableNetworkIds } from './BSNeoLegacyHelper';
|
|
3
3
|
export declare class DoraBDSNeoLegacy implements BlockchainDataService, BDSClaimable {
|
|
4
4
|
#private;
|
|
5
5
|
maxTimeToConfirmTransactionInMs: number;
|
|
6
|
-
constructor(network: Network<AvailableNetworkIds>, feeToken: Token, claimToken: Token);
|
|
6
|
+
constructor(network: Network<AvailableNetworkIds>, feeToken: Token, claimToken: Token, tokens: Token[]);
|
|
7
7
|
getTransaction(hash: string): Promise<TransactionResponse>;
|
|
8
8
|
getTransactionsByAddress({ address, page, }: TransactionsByAddressParams): Promise<TransactionsByAddressResponse>;
|
|
9
9
|
getContract(contractHash: string): Promise<ContractResponse>;
|
package/dist/DoraBDSNeoLegacy.js
CHANGED
|
@@ -19,22 +19,24 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
19
19
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
20
20
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
21
21
|
};
|
|
22
|
-
var _DoraBDSNeoLegacy_network, _DoraBDSNeoLegacy_claimToken, _DoraBDSNeoLegacy_feeToken, _DoraBDSNeoLegacy_tokenCache;
|
|
22
|
+
var _DoraBDSNeoLegacy_network, _DoraBDSNeoLegacy_claimToken, _DoraBDSNeoLegacy_feeToken, _DoraBDSNeoLegacy_tokens, _DoraBDSNeoLegacy_tokenCache;
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
exports.DoraBDSNeoLegacy = void 0;
|
|
25
25
|
const dora_ts_1 = require("@cityofzion/dora-ts");
|
|
26
|
-
const constants_1 = require("./constants");
|
|
27
26
|
const neon_js_1 = require("@cityofzion/neon-js");
|
|
27
|
+
const BSNeoLegacyHelper_1 = require("./BSNeoLegacyHelper");
|
|
28
28
|
class DoraBDSNeoLegacy {
|
|
29
|
-
constructor(network, feeToken, claimToken) {
|
|
29
|
+
constructor(network, feeToken, claimToken, tokens) {
|
|
30
30
|
_DoraBDSNeoLegacy_network.set(this, void 0);
|
|
31
31
|
_DoraBDSNeoLegacy_claimToken.set(this, void 0);
|
|
32
32
|
_DoraBDSNeoLegacy_feeToken.set(this, void 0);
|
|
33
|
+
_DoraBDSNeoLegacy_tokens.set(this, void 0);
|
|
33
34
|
_DoraBDSNeoLegacy_tokenCache.set(this, new Map());
|
|
34
35
|
this.maxTimeToConfirmTransactionInMs = 1000 * 60 * 2;
|
|
35
36
|
__classPrivateFieldSet(this, _DoraBDSNeoLegacy_network, network, "f");
|
|
36
37
|
__classPrivateFieldSet(this, _DoraBDSNeoLegacy_claimToken, claimToken, "f");
|
|
37
38
|
__classPrivateFieldSet(this, _DoraBDSNeoLegacy_feeToken, feeToken, "f");
|
|
39
|
+
__classPrivateFieldSet(this, _DoraBDSNeoLegacy_tokens, tokens, "f");
|
|
38
40
|
}
|
|
39
41
|
getTransaction(hash) {
|
|
40
42
|
var _a, _b, _c;
|
|
@@ -118,7 +120,7 @@ class DoraBDSNeoLegacy {
|
|
|
118
120
|
}
|
|
119
121
|
getTokenInfo(tokenHash) {
|
|
120
122
|
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
-
const localToken =
|
|
123
|
+
const localToken = __classPrivateFieldGet(this, _DoraBDSNeoLegacy_tokens, "f").find(token => token.hash === tokenHash);
|
|
122
124
|
if (localToken)
|
|
123
125
|
return localToken;
|
|
124
126
|
if (__classPrivateFieldGet(this, _DoraBDSNeoLegacy_tokenCache, "f").has(tokenHash)) {
|
|
@@ -178,8 +180,8 @@ class DoraBDSNeoLegacy {
|
|
|
178
180
|
getRpcList() {
|
|
179
181
|
return __awaiter(this, void 0, void 0, function* () {
|
|
180
182
|
const list = [];
|
|
181
|
-
const
|
|
182
|
-
const promises =
|
|
183
|
+
const urls = BSNeoLegacyHelper_1.BSNeoLegacyHelper.getRpcList(__classPrivateFieldGet(this, _DoraBDSNeoLegacy_network, "f"));
|
|
184
|
+
const promises = urls.map(url => {
|
|
183
185
|
// eslint-disable-next-line no-async-promise-executor
|
|
184
186
|
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
185
187
|
const timeout = setTimeout(() => {
|
|
@@ -204,4 +206,4 @@ class DoraBDSNeoLegacy {
|
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
208
|
exports.DoraBDSNeoLegacy = DoraBDSNeoLegacy;
|
|
207
|
-
_DoraBDSNeoLegacy_network = new WeakMap(), _DoraBDSNeoLegacy_claimToken = new WeakMap(), _DoraBDSNeoLegacy_feeToken = new WeakMap(), _DoraBDSNeoLegacy_tokenCache = new WeakMap();
|
|
209
|
+
_DoraBDSNeoLegacy_network = new WeakMap(), _DoraBDSNeoLegacy_claimToken = new WeakMap(), _DoraBDSNeoLegacy_feeToken = new WeakMap(), _DoraBDSNeoLegacy_tokens = new WeakMap(), _DoraBDSNeoLegacy_tokenCache = new WeakMap();
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { BuildNftUrlParams, ExplorerService } from '@cityofzion/blockchain-service';
|
|
2
|
-
import { AvailableNetworkIds } from './
|
|
3
|
-
export declare class
|
|
2
|
+
import { AvailableNetworkIds } from './BSNeoLegacyHelper';
|
|
3
|
+
export declare class NeoTubeESNeoLegacy implements ExplorerService {
|
|
4
4
|
#private;
|
|
5
|
+
static SUPPORTED_NETWORKS: AvailableNetworkIds[];
|
|
5
6
|
constructor(networkId: AvailableNetworkIds);
|
|
6
7
|
buildTransactionUrl(hash: string): string;
|
|
8
|
+
buildContractUrl(contractHash: string): string;
|
|
7
9
|
buildNftUrl(_params: BuildNftUrlParams): string;
|
|
8
10
|
}
|
|
@@ -10,20 +10,28 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
11
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
12
|
};
|
|
13
|
-
var
|
|
13
|
+
var _NeoTubeESNeoLegacy_networkId;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
16
|
-
class
|
|
15
|
+
exports.NeoTubeESNeoLegacy = void 0;
|
|
16
|
+
class NeoTubeESNeoLegacy {
|
|
17
17
|
constructor(networkId) {
|
|
18
|
-
|
|
19
|
-
__classPrivateFieldSet(this,
|
|
18
|
+
_NeoTubeESNeoLegacy_networkId.set(this, void 0);
|
|
19
|
+
__classPrivateFieldSet(this, _NeoTubeESNeoLegacy_networkId, networkId, "f");
|
|
20
20
|
}
|
|
21
21
|
buildTransactionUrl(hash) {
|
|
22
|
-
|
|
22
|
+
if (!NeoTubeESNeoLegacy.SUPPORTED_NETWORKS.includes(__classPrivateFieldGet(this, _NeoTubeESNeoLegacy_networkId, "f")))
|
|
23
|
+
throw new Error('Unsupported network');
|
|
24
|
+
return `https://neo2.neotube.io/transaction/${hash}`;
|
|
25
|
+
}
|
|
26
|
+
buildContractUrl(contractHash) {
|
|
27
|
+
if (!NeoTubeESNeoLegacy.SUPPORTED_NETWORKS.includes(__classPrivateFieldGet(this, _NeoTubeESNeoLegacy_networkId, "f")))
|
|
28
|
+
throw new Error('Unsupported network');
|
|
29
|
+
return `https://neo2.neotube.io/asset/${contractHash}/page/1`;
|
|
23
30
|
}
|
|
24
31
|
buildNftUrl(_params) {
|
|
25
32
|
throw new Error('DoraESNeoLegacy does not support nft');
|
|
26
33
|
}
|
|
27
34
|
}
|
|
28
|
-
exports.
|
|
29
|
-
|
|
35
|
+
exports.NeoTubeESNeoLegacy = NeoTubeESNeoLegacy;
|
|
36
|
+
_NeoTubeESNeoLegacy_networkId = new WeakMap();
|
|
37
|
+
NeoTubeESNeoLegacy.SUPPORTED_NETWORKS = ['mainnet'];
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -16,5 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./BSNeoLegacy"), exports);
|
|
18
18
|
__exportStar(require("./DoraBDSNeoLegacy"), exports);
|
|
19
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./BSNeoLegacyHelper"), exports);
|
|
20
|
+
__exportStar(require("./NeoTubeESNeoLegacy"), exports);
|
|
20
21
|
__exportStar(require("./CryptoCompareEDSNeoLegacy"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neo-legacy",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"author": "Coz",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@cityofzion/dora-ts": "0.0.11",
|
|
13
13
|
"@cityofzion/neon-js": "4.8.3",
|
|
14
|
-
"@cityofzion/blockchain-service": "1.0.
|
|
14
|
+
"@cityofzion/blockchain-service": "1.0.1",
|
|
15
15
|
"@cityofzion/bs-asteroid-sdk": "0.9.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
package/dist/constants.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Token } from '@cityofzion/blockchain-service';
|
|
2
|
-
export type AvailableNetworkIds = 'mainnet' | 'testnet';
|
|
3
|
-
export declare const TOKENS: Record<AvailableNetworkIds, Token[]>;
|
|
4
|
-
export declare const LEGACY_NETWORK_BY_NETWORK_TYPE: Record<Exclude<AvailableNetworkIds, 'custom'>, string>;
|
|
5
|
-
export declare const NATIVE_ASSETS: {
|
|
6
|
-
symbol: string;
|
|
7
|
-
name: string;
|
|
8
|
-
hash: string;
|
|
9
|
-
decimals: number;
|
|
10
|
-
}[];
|
|
11
|
-
export declare const DERIVATION_PATH = "m/44'/888'/0'/0/?";
|
|
12
|
-
export declare const RPC_LIST_BY_NETWORK_TYPE: Record<Exclude<AvailableNetworkIds, 'custom'>, string[]>;
|
|
13
|
-
export declare const DEFAULT_URL_BY_NETWORK_TYPE: Record<Exclude<AvailableNetworkIds, 'custom'>, string>;
|
package/dist/constants.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DEFAULT_URL_BY_NETWORK_TYPE = exports.RPC_LIST_BY_NETWORK_TYPE = exports.DERIVATION_PATH = exports.NATIVE_ASSETS = exports.LEGACY_NETWORK_BY_NETWORK_TYPE = exports.TOKENS = void 0;
|
|
7
|
-
const common_json_1 = __importDefault(require("./assets/tokens/common.json"));
|
|
8
|
-
const mainnet_json_1 = __importDefault(require("./assets/tokens/mainnet.json"));
|
|
9
|
-
exports.TOKENS = {
|
|
10
|
-
mainnet: [...common_json_1.default, ...mainnet_json_1.default],
|
|
11
|
-
testnet: common_json_1.default,
|
|
12
|
-
};
|
|
13
|
-
exports.LEGACY_NETWORK_BY_NETWORK_TYPE = {
|
|
14
|
-
mainnet: 'MainNet',
|
|
15
|
-
testnet: 'TestNet',
|
|
16
|
-
};
|
|
17
|
-
exports.NATIVE_ASSETS = common_json_1.default;
|
|
18
|
-
exports.DERIVATION_PATH = "m/44'/888'/0'/0/?";
|
|
19
|
-
exports.RPC_LIST_BY_NETWORK_TYPE = {
|
|
20
|
-
mainnet: [
|
|
21
|
-
'http://seed9.ngd.network:10332',
|
|
22
|
-
'https://mainnet1.neo2.coz.io:443',
|
|
23
|
-
'https://mainnet2.neo2.coz.io:443',
|
|
24
|
-
'https://mainnet3.neo2.coz.io:443',
|
|
25
|
-
'http://seed1.ngd.network:10332',
|
|
26
|
-
'http://seed2.ngd.network:10332',
|
|
27
|
-
'http://seed3.ngd.network:10332',
|
|
28
|
-
'http://seed4.ngd.network:10332',
|
|
29
|
-
'http://seed5.ngd.network:10332',
|
|
30
|
-
],
|
|
31
|
-
testnet: [
|
|
32
|
-
'http://seed5.ngd.network:20332',
|
|
33
|
-
'http://seed1.ngd.network:20332',
|
|
34
|
-
'http://seed2.ngd.network:20332',
|
|
35
|
-
'https://testnet1.neo2.coz.io:443',
|
|
36
|
-
],
|
|
37
|
-
};
|
|
38
|
-
exports.DEFAULT_URL_BY_NETWORK_TYPE = {
|
|
39
|
-
mainnet: exports.RPC_LIST_BY_NETWORK_TYPE.mainnet[0],
|
|
40
|
-
testnet: exports.RPC_LIST_BY_NETWORK_TYPE.testnet[0],
|
|
41
|
-
};
|