@cityofzion/bs-neo-legacy 1.2.2 → 1.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.
- package/dist/{BSNeoLegacyHelper.d.ts → constants/BSNeoLegacyConstants.d.ts} +5 -14
- package/dist/constants/BSNeoLegacyConstants.js +60 -0
- package/dist/helpers/BSNeoLegacyHelper.d.ts +14 -0
- package/dist/helpers/BSNeoLegacyHelper.js +32 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.js +6 -5
- package/dist/{BSNeoLegacy.d.ts → services/BSNeoLegacy.d.ts} +5 -5
- package/dist/{BSNeoLegacy.js → services/BSNeoLegacy.js} +17 -16
- package/dist/{DoraBDSNeoLegacy.d.ts → services/blockchain-data/DoraBDSNeoLegacy.d.ts} +1 -1
- package/dist/{DoraBDSNeoLegacy.js → services/blockchain-data/DoraBDSNeoLegacy.js} +1 -1
- package/dist/{CryptoCompareEDSNeoLegacy.d.ts → services/exchange-data/CryptoCompareEDSNeoLegacy.d.ts} +1 -1
- package/dist/{CryptoCompareEDSNeoLegacy.js → services/exchange-data/CryptoCompareEDSNeoLegacy.js} +1 -1
- package/dist/{NeoTubeESNeoLegacy.d.ts → services/explorer/NeoTubeESNeoLegacy.d.ts} +1 -1
- package/dist/{NeoTubeESNeoLegacy.js → services/explorer/NeoTubeESNeoLegacy.js} +1 -1
- package/package.json +3 -3
- package/dist/BSNeoLegacyHelper.js +0 -86
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { Network, NetworkId } from '@cityofzion/blockchain-service';
|
|
1
|
+
import { Network, NetworkId, Token } from '@cityofzion/blockchain-service';
|
|
2
2
|
export type BSNeoLegacyNetworkId = NetworkId<'mainnet' | 'testnet'>;
|
|
3
|
-
export declare class
|
|
4
|
-
|
|
3
|
+
export declare class BSNeoLegacyConstants {
|
|
4
|
+
static EXTRA_TOKENS_BY_NETWORK_ID: Partial<Record<BSNeoLegacyNetworkId, Token[]>>;
|
|
5
5
|
static NATIVE_ASSETS: {
|
|
6
6
|
symbol: string;
|
|
7
7
|
name: string;
|
|
8
8
|
hash: string;
|
|
9
9
|
decimals: number;
|
|
10
10
|
}[];
|
|
11
|
+
static RPC_LIST_BY_NETWORK_ID: Record<BSNeoLegacyNetworkId, string[]>;
|
|
11
12
|
static LEGACY_NETWORK_BY_NETWORK_ID: Record<BSNeoLegacyNetworkId, string>;
|
|
12
13
|
static MAINNET_NETWORK_IDS: BSNeoLegacyNetworkId[];
|
|
13
14
|
static TESTNET_NETWORK_IDS: BSNeoLegacyNetworkId[];
|
|
@@ -15,16 +16,6 @@ export declare class BSNeoLegacyHelper {
|
|
|
15
16
|
static MAINNET_NETWORKS: Network<BSNeoLegacyNetworkId>[];
|
|
16
17
|
static TESTNET_NETWORKS: Network<BSNeoLegacyNetworkId>[];
|
|
17
18
|
static ALL_NETWORKS: Network<BSNeoLegacyNetworkId>[];
|
|
18
|
-
static
|
|
19
|
+
static DEFAULT_BIP44_DERIVATION_PATH: string;
|
|
19
20
|
static DEFAULT_NETWORK: Network<BSNeoLegacyNetworkId>;
|
|
20
|
-
static getLegacyNetwork(network: Network<BSNeoLegacyNetworkId>): string;
|
|
21
|
-
static getTokens(network: Network<BSNeoLegacyNetworkId>): {
|
|
22
|
-
symbol: string;
|
|
23
|
-
name: string;
|
|
24
|
-
hash: string;
|
|
25
|
-
decimals: number;
|
|
26
|
-
}[];
|
|
27
|
-
static getRpcList(network: Network<BSNeoLegacyNetworkId>): string[];
|
|
28
|
-
static isMainnet(network: Network<BSNeoLegacyNetworkId>): boolean;
|
|
29
|
-
static normalizeHash(hash: string): string;
|
|
30
21
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
var _a;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.BSNeoLegacyConstants = void 0;
|
|
8
|
+
const mainnet_json_1 = __importDefault(require("../assets/tokens/mainnet.json"));
|
|
9
|
+
const common_json_1 = __importDefault(require("../assets/tokens/common.json"));
|
|
10
|
+
class BSNeoLegacyConstants {
|
|
11
|
+
}
|
|
12
|
+
exports.BSNeoLegacyConstants = BSNeoLegacyConstants;
|
|
13
|
+
_a = BSNeoLegacyConstants;
|
|
14
|
+
BSNeoLegacyConstants.EXTRA_TOKENS_BY_NETWORK_ID = {
|
|
15
|
+
mainnet: mainnet_json_1.default,
|
|
16
|
+
};
|
|
17
|
+
BSNeoLegacyConstants.NATIVE_ASSETS = common_json_1.default;
|
|
18
|
+
BSNeoLegacyConstants.RPC_LIST_BY_NETWORK_ID = {
|
|
19
|
+
mainnet: [
|
|
20
|
+
'http://seed9.ngd.network:10332',
|
|
21
|
+
'https://mainnet1.neo2.coz.io:443',
|
|
22
|
+
'https://mainnet2.neo2.coz.io:443',
|
|
23
|
+
'https://mainnet3.neo2.coz.io:443',
|
|
24
|
+
'http://seed1.ngd.network:10332',
|
|
25
|
+
'http://seed2.ngd.network:10332',
|
|
26
|
+
'http://seed3.ngd.network:10332',
|
|
27
|
+
'http://seed4.ngd.network:10332',
|
|
28
|
+
'http://seed5.ngd.network:10332',
|
|
29
|
+
],
|
|
30
|
+
testnet: [
|
|
31
|
+
'http://seed5.ngd.network:20332',
|
|
32
|
+
'http://seed1.ngd.network:20332',
|
|
33
|
+
'http://seed2.ngd.network:20332',
|
|
34
|
+
'https://testnet1.neo2.coz.io:443',
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
BSNeoLegacyConstants.LEGACY_NETWORK_BY_NETWORK_ID = {
|
|
38
|
+
mainnet: 'MainNet',
|
|
39
|
+
testnet: 'TestNet',
|
|
40
|
+
};
|
|
41
|
+
BSNeoLegacyConstants.MAINNET_NETWORK_IDS = ['mainnet'];
|
|
42
|
+
BSNeoLegacyConstants.TESTNET_NETWORK_IDS = ['testnet'];
|
|
43
|
+
BSNeoLegacyConstants.ALL_NETWORK_IDS = [..._a.MAINNET_NETWORK_IDS, ..._a.TESTNET_NETWORK_IDS];
|
|
44
|
+
BSNeoLegacyConstants.MAINNET_NETWORKS = [
|
|
45
|
+
{
|
|
46
|
+
id: 'mainnet',
|
|
47
|
+
name: 'Mainnet',
|
|
48
|
+
url: _a.RPC_LIST_BY_NETWORK_ID['mainnet'][0],
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
BSNeoLegacyConstants.TESTNET_NETWORKS = [
|
|
52
|
+
{
|
|
53
|
+
id: 'testnet',
|
|
54
|
+
name: 'Testnet',
|
|
55
|
+
url: _a.RPC_LIST_BY_NETWORK_ID['testnet'][0],
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
BSNeoLegacyConstants.ALL_NETWORKS = [..._a.MAINNET_NETWORKS, ..._a.TESTNET_NETWORKS];
|
|
59
|
+
BSNeoLegacyConstants.DEFAULT_BIP44_DERIVATION_PATH = "m/44'/888'/0'/0/?";
|
|
60
|
+
BSNeoLegacyConstants.DEFAULT_NETWORK = _a.MAINNET_NETWORKS[0];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Network } from '@cityofzion/blockchain-service';
|
|
2
|
+
import { BSNeoLegacyNetworkId } from '../constants/BSNeoLegacyConstants';
|
|
3
|
+
export declare class BSNeoLegacyHelper {
|
|
4
|
+
static getLegacyNetwork(network: Network<BSNeoLegacyNetworkId>): string;
|
|
5
|
+
static getTokens(network: Network<BSNeoLegacyNetworkId>): {
|
|
6
|
+
symbol: string;
|
|
7
|
+
name: string;
|
|
8
|
+
hash: string;
|
|
9
|
+
decimals: number;
|
|
10
|
+
}[];
|
|
11
|
+
static getRpcList(network: Network<BSNeoLegacyNetworkId>): string[];
|
|
12
|
+
static isMainnet(network: Network<BSNeoLegacyNetworkId>): boolean;
|
|
13
|
+
static normalizeHash(hash: string): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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.BSNeoLegacyHelper = void 0;
|
|
7
|
+
const common_json_1 = __importDefault(require("../assets/tokens/common.json"));
|
|
8
|
+
const BSNeoLegacyConstants_1 = require("../constants/BSNeoLegacyConstants");
|
|
9
|
+
class BSNeoLegacyHelper {
|
|
10
|
+
static getLegacyNetwork(network) {
|
|
11
|
+
const legacyNetwork = BSNeoLegacyConstants_1.BSNeoLegacyConstants.LEGACY_NETWORK_BY_NETWORK_ID[network.id];
|
|
12
|
+
if (!legacyNetwork)
|
|
13
|
+
throw new Error('Unsupported network');
|
|
14
|
+
return legacyNetwork;
|
|
15
|
+
}
|
|
16
|
+
static getTokens(network) {
|
|
17
|
+
var _a;
|
|
18
|
+
const extraTokens = (_a = BSNeoLegacyConstants_1.BSNeoLegacyConstants.EXTRA_TOKENS_BY_NETWORK_ID[network.id]) !== null && _a !== void 0 ? _a : [];
|
|
19
|
+
return [...extraTokens, ...common_json_1.default];
|
|
20
|
+
}
|
|
21
|
+
static getRpcList(network) {
|
|
22
|
+
var _a;
|
|
23
|
+
return (_a = BSNeoLegacyConstants_1.BSNeoLegacyConstants.RPC_LIST_BY_NETWORK_ID[network.id]) !== null && _a !== void 0 ? _a : [];
|
|
24
|
+
}
|
|
25
|
+
static isMainnet(network) {
|
|
26
|
+
return BSNeoLegacyConstants_1.BSNeoLegacyConstants.MAINNET_NETWORK_IDS.includes(network.id);
|
|
27
|
+
}
|
|
28
|
+
static normalizeHash(hash) {
|
|
29
|
+
return hash.startsWith('0x') ? hash.slice(2) : hash;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.BSNeoLegacyHelper = BSNeoLegacyHelper;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export * from './BSNeoLegacy';
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './DoraBDSNeoLegacy';
|
|
5
|
-
export * from './
|
|
1
|
+
export * from './services/BSNeoLegacy';
|
|
2
|
+
export * from './constants/BSNeoLegacyConstants';
|
|
3
|
+
export * from './helpers/BSNeoLegacyHelper';
|
|
4
|
+
export * from './services/blockchain-data/DoraBDSNeoLegacy';
|
|
5
|
+
export * from './services/exchange-data/CryptoCompareEDSNeoLegacy';
|
|
6
|
+
export * from './services/explorer/NeoTubeESNeoLegacy';
|
package/dist/index.js
CHANGED
|
@@ -14,8 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./BSNeoLegacy"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
__exportStar(require("./
|
|
20
|
-
__exportStar(require("./DoraBDSNeoLegacy"), exports);
|
|
21
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./services/BSNeoLegacy"), exports);
|
|
18
|
+
__exportStar(require("./constants/BSNeoLegacyConstants"), exports);
|
|
19
|
+
__exportStar(require("./helpers/BSNeoLegacyHelper"), exports);
|
|
20
|
+
__exportStar(require("./services/blockchain-data/DoraBDSNeoLegacy"), exports);
|
|
21
|
+
__exportStar(require("./services/exchange-data/CryptoCompareEDSNeoLegacy"), exports);
|
|
22
|
+
__exportStar(require("./services/explorer/NeoTubeESNeoLegacy"), exports);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Account, BDSClaimable, BlockchainDataService, BlockchainService, BSClaimable, ExchangeDataService, Token, Network, TransferParam,
|
|
2
|
-
import { BSNeoLegacyNetworkId } from '
|
|
1
|
+
import { Account, BDSClaimable, BlockchainDataService, BlockchainService, BSClaimable, ExchangeDataService, Token, Network, TransferParam, BSWithExplorerService, ExplorerService } from '@cityofzion/blockchain-service';
|
|
2
|
+
import { BSNeoLegacyNetworkId } from '../constants/BSNeoLegacyConstants';
|
|
3
3
|
export declare class BSNeoLegacy<BSCustomName extends string = string> implements BlockchainService<BSCustomName, BSNeoLegacyNetworkId>, BSClaimable, BSWithExplorerService {
|
|
4
4
|
#private;
|
|
5
5
|
readonly blockchainName: BSCustomName;
|
|
6
|
-
readonly
|
|
6
|
+
readonly bip44DerivationPath: string;
|
|
7
7
|
feeToken: Token;
|
|
8
8
|
claimToken: Token;
|
|
9
9
|
burnToken: Token;
|
|
@@ -18,10 +18,10 @@ export declare class BSNeoLegacy<BSCustomName extends string = string> implement
|
|
|
18
18
|
validateAddress(address: string): boolean;
|
|
19
19
|
validateEncrypted(key: string): boolean;
|
|
20
20
|
validateKey(key: string): boolean;
|
|
21
|
-
generateAccountFromMnemonic(mnemonic: string[] | string, index: number):
|
|
21
|
+
generateAccountFromMnemonic(mnemonic: string[] | string, index: number): Account;
|
|
22
22
|
generateAccountFromKey(key: string): Account;
|
|
23
23
|
decrypt(encryptedKey: string, password: string): Promise<Account>;
|
|
24
24
|
encrypt(key: string, password: string): Promise<string>;
|
|
25
|
-
transfer({
|
|
25
|
+
transfer({ intents, senderAccount, tipIntent, ...params }: TransferParam): Promise<string[]>;
|
|
26
26
|
claim(account: Account): Promise<string>;
|
|
27
27
|
}
|
|
@@ -28,22 +28,23 @@ var _BSNeoLegacy_instances, _BSNeoLegacy_setTokens;
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.BSNeoLegacy = void 0;
|
|
30
30
|
const neon_js_1 = require("@cityofzion/neon-js");
|
|
31
|
-
const DoraBDSNeoLegacy_1 = require("./DoraBDSNeoLegacy");
|
|
32
|
-
const CryptoCompareEDSNeoLegacy_1 = require("./CryptoCompareEDSNeoLegacy");
|
|
33
31
|
const bs_asteroid_sdk_1 = require("@cityofzion/bs-asteroid-sdk");
|
|
34
|
-
const
|
|
35
|
-
const
|
|
32
|
+
const BSNeoLegacyConstants_1 = require("../constants/BSNeoLegacyConstants");
|
|
33
|
+
const BSNeoLegacyHelper_1 = require("../helpers/BSNeoLegacyHelper");
|
|
34
|
+
const CryptoCompareEDSNeoLegacy_1 = require("./exchange-data/CryptoCompareEDSNeoLegacy");
|
|
35
|
+
const DoraBDSNeoLegacy_1 = require("./blockchain-data/DoraBDSNeoLegacy");
|
|
36
|
+
const NeoTubeESNeoLegacy_1 = require("./explorer/NeoTubeESNeoLegacy");
|
|
36
37
|
class BSNeoLegacy {
|
|
37
38
|
constructor(blockchainName, network) {
|
|
38
39
|
_BSNeoLegacy_instances.add(this);
|
|
39
|
-
network = network !== null && network !== void 0 ? network :
|
|
40
|
+
network = network !== null && network !== void 0 ? network : BSNeoLegacyConstants_1.BSNeoLegacyConstants.DEFAULT_NETWORK;
|
|
40
41
|
this.blockchainName = blockchainName;
|
|
41
|
-
this.legacyNetwork =
|
|
42
|
-
this.
|
|
42
|
+
this.legacyNetwork = BSNeoLegacyConstants_1.BSNeoLegacyConstants.LEGACY_NETWORK_BY_NETWORK_ID[network.id];
|
|
43
|
+
this.bip44DerivationPath = BSNeoLegacyConstants_1.BSNeoLegacyConstants.DEFAULT_BIP44_DERIVATION_PATH;
|
|
43
44
|
this.setNetwork(network);
|
|
44
45
|
}
|
|
45
46
|
setNetwork(network) {
|
|
46
|
-
if (!
|
|
47
|
+
if (!BSNeoLegacyConstants_1.BSNeoLegacyConstants.ALL_NETWORK_IDS.includes(network.id))
|
|
47
48
|
throw new Error('Custom network is not supported');
|
|
48
49
|
__classPrivateFieldGet(this, _BSNeoLegacy_instances, "m", _BSNeoLegacy_setTokens).call(this, network);
|
|
49
50
|
this.network = network;
|
|
@@ -62,11 +63,11 @@ class BSNeoLegacy {
|
|
|
62
63
|
}
|
|
63
64
|
generateAccountFromMnemonic(mnemonic, index) {
|
|
64
65
|
bs_asteroid_sdk_1.keychain.importMnemonic(Array.isArray(mnemonic) ? mnemonic.join(' ') : mnemonic);
|
|
65
|
-
const
|
|
66
|
-
const childKey = bs_asteroid_sdk_1.keychain.generateChildKey('neo',
|
|
66
|
+
const bip44Path = this.bip44DerivationPath.replace('?', index.toString());
|
|
67
|
+
const childKey = bs_asteroid_sdk_1.keychain.generateChildKey('neo', bip44Path);
|
|
67
68
|
const key = childKey.getWIF();
|
|
68
69
|
const { address } = new neon_js_1.wallet.Account(key);
|
|
69
|
-
return { address, key, type: 'wif',
|
|
70
|
+
return { address, key, type: 'wif', bip44Path };
|
|
70
71
|
}
|
|
71
72
|
generateAccountFromKey(key) {
|
|
72
73
|
const type = neon_js_1.wallet.isWIF(key) ? 'wif' : neon_js_1.wallet.isPrivateKey(key) ? 'privateKey' : undefined;
|
|
@@ -86,17 +87,17 @@ class BSNeoLegacy {
|
|
|
86
87
|
}
|
|
87
88
|
transfer(_a) {
|
|
88
89
|
var _b, _c;
|
|
89
|
-
var {
|
|
90
|
+
var { intents, senderAccount, tipIntent } = _a, params = __rest(_a, ["intents", "senderAccount", "tipIntent"]);
|
|
90
91
|
return __awaiter(this, void 0, void 0, function* () {
|
|
91
92
|
const apiProvider = new neon_js_1.api.neoCli.instance(this.network.url);
|
|
92
93
|
const account = new neon_js_1.wallet.Account(senderAccount.key);
|
|
93
94
|
const priorityFee = Number((_b = params.priorityFee) !== null && _b !== void 0 ? _b : 0);
|
|
94
95
|
const nativeIntents = [];
|
|
95
96
|
const nep5ScriptBuilder = new neon_js_1.sc.ScriptBuilder();
|
|
96
|
-
const
|
|
97
|
-
for (const intent of
|
|
97
|
+
const concatIntents = [...intents, ...(tipIntent ? [tipIntent] : [])];
|
|
98
|
+
for (const intent of concatIntents) {
|
|
98
99
|
const tokenHashFixed = BSNeoLegacyHelper_1.BSNeoLegacyHelper.normalizeHash(intent.tokenHash);
|
|
99
|
-
const nativeAsset =
|
|
100
|
+
const nativeAsset = BSNeoLegacyConstants_1.BSNeoLegacyConstants.NATIVE_ASSETS.find(asset => BSNeoLegacyHelper_1.BSNeoLegacyHelper.normalizeHash(asset.hash) === tokenHashFixed);
|
|
100
101
|
if (nativeAsset) {
|
|
101
102
|
nativeIntents.push(...neon_js_1.api.makeIntent({ [nativeAsset.symbol]: Number(intent.amount) }, intent.receiverAddress));
|
|
102
103
|
continue;
|
|
@@ -132,7 +133,7 @@ class BSNeoLegacy {
|
|
|
132
133
|
}
|
|
133
134
|
if (!response.tx)
|
|
134
135
|
throw new Error('Failed to send transaction');
|
|
135
|
-
return response.tx.hash;
|
|
136
|
+
return [response.tx.hash];
|
|
136
137
|
});
|
|
137
138
|
}
|
|
138
139
|
claim(account) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BalanceResponse, BlockchainDataService, ContractResponse, TransactionsByAddressParams, TransactionsByAddressResponse, TransactionResponse, BDSClaimable, Token, Network, RpcResponse } from '@cityofzion/blockchain-service';
|
|
2
|
-
import { BSNeoLegacyNetworkId } from '
|
|
2
|
+
import { BSNeoLegacyNetworkId } from '../../constants/BSNeoLegacyConstants';
|
|
3
3
|
export declare class DoraBDSNeoLegacy implements BlockchainDataService, BDSClaimable {
|
|
4
4
|
#private;
|
|
5
5
|
maxTimeToConfirmTransactionInMs: number;
|
|
@@ -24,7 +24,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
24
24
|
exports.DoraBDSNeoLegacy = void 0;
|
|
25
25
|
const dora_ts_1 = require("@cityofzion/dora-ts");
|
|
26
26
|
const neon_js_1 = require("@cityofzion/neon-js");
|
|
27
|
-
const BSNeoLegacyHelper_1 = require("
|
|
27
|
+
const BSNeoLegacyHelper_1 = require("../../helpers/BSNeoLegacyHelper");
|
|
28
28
|
class DoraBDSNeoLegacy {
|
|
29
29
|
constructor(network, feeToken, claimToken, tokens) {
|
|
30
30
|
_DoraBDSNeoLegacy_network.set(this, void 0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CryptoCompareEDS, ExchangeDataService, GetTokenPriceHistoryParams, GetTokenPricesParams, Network, TokenPricesHistoryResponse, TokenPricesResponse } from '@cityofzion/blockchain-service';
|
|
2
|
-
import { BSNeoLegacyNetworkId } from '
|
|
2
|
+
import { BSNeoLegacyNetworkId } from '../../constants/BSNeoLegacyConstants';
|
|
3
3
|
export declare class CryptoCompareEDSNeoLegacy extends CryptoCompareEDS implements ExchangeDataService {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(network: Network<BSNeoLegacyNetworkId>);
|
package/dist/{CryptoCompareEDSNeoLegacy.js → services/exchange-data/CryptoCompareEDSNeoLegacy.js}
RENAMED
|
@@ -23,7 +23,7 @@ var _CryptoCompareEDSNeoLegacy_network;
|
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
exports.CryptoCompareEDSNeoLegacy = void 0;
|
|
25
25
|
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
26
|
-
const BSNeoLegacyHelper_1 = require("
|
|
26
|
+
const BSNeoLegacyHelper_1 = require("../../helpers/BSNeoLegacyHelper");
|
|
27
27
|
class CryptoCompareEDSNeoLegacy extends blockchain_service_1.CryptoCompareEDS {
|
|
28
28
|
constructor(network) {
|
|
29
29
|
super();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BuildNftUrlParams, ExplorerService, Network } from '@cityofzion/blockchain-service';
|
|
2
|
-
import { BSNeoLegacyNetworkId } from '
|
|
2
|
+
import { BSNeoLegacyNetworkId } from '../../constants/BSNeoLegacyConstants';
|
|
3
3
|
export declare class NeoTubeESNeoLegacy implements ExplorerService {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(network: Network<BSNeoLegacyNetworkId>);
|
|
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
13
|
var _NeoTubeESNeoLegacy_network;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.NeoTubeESNeoLegacy = void 0;
|
|
16
|
-
const BSNeoLegacyHelper_1 = require("
|
|
16
|
+
const BSNeoLegacyHelper_1 = require("../../helpers/BSNeoLegacyHelper");
|
|
17
17
|
class NeoTubeESNeoLegacy {
|
|
18
18
|
constructor(network) {
|
|
19
19
|
_NeoTubeESNeoLegacy_network.set(this, void 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neo-legacy",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"author": "Coz",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@cityofzion/dora-ts": "0.0.11",
|
|
13
13
|
"@cityofzion/neon-js": "4.8.3",
|
|
14
|
-
"@cityofzion/
|
|
15
|
-
"@cityofzion/
|
|
14
|
+
"@cityofzion/blockchain-service": "1.4.0",
|
|
15
|
+
"@cityofzion/bs-asteroid-sdk": "0.9.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/jest": "29.5.3",
|
|
@@ -1,86 +0,0 @@
|
|
|
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 getLegacyNetwork(network) {
|
|
17
|
-
const legacyNetwork = this.LEGACY_NETWORK_BY_NETWORK_ID[network.id];
|
|
18
|
-
if (!legacyNetwork)
|
|
19
|
-
throw new Error('Unsupported network');
|
|
20
|
-
return legacyNetwork;
|
|
21
|
-
}
|
|
22
|
-
static getTokens(network) {
|
|
23
|
-
var _b;
|
|
24
|
-
const extraTokens = (_b = __classPrivateFieldGet(this, _a, "f", _BSNeoLegacyHelper_EXTRA_TOKENS_BY_NETWORK_ID)[network.id]) !== null && _b !== void 0 ? _b : [];
|
|
25
|
-
return [...extraTokens, ...common_json_1.default];
|
|
26
|
-
}
|
|
27
|
-
static getRpcList(network) {
|
|
28
|
-
var _b;
|
|
29
|
-
return (_b = __classPrivateFieldGet(this, _a, "f", _BSNeoLegacyHelper_RPC_LIST_BY_NETWORK_ID)[network.id]) !== null && _b !== void 0 ? _b : [];
|
|
30
|
-
}
|
|
31
|
-
static isMainnet(network) {
|
|
32
|
-
return this.MAINNET_NETWORK_IDS.includes(network.id);
|
|
33
|
-
}
|
|
34
|
-
static normalizeHash(hash) {
|
|
35
|
-
return hash.startsWith('0x') ? hash.slice(2) : hash;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
exports.BSNeoLegacyHelper = BSNeoLegacyHelper;
|
|
39
|
-
_a = BSNeoLegacyHelper;
|
|
40
|
-
_BSNeoLegacyHelper_EXTRA_TOKENS_BY_NETWORK_ID = { value: {
|
|
41
|
-
mainnet: mainnet_json_1.default,
|
|
42
|
-
} };
|
|
43
|
-
BSNeoLegacyHelper.NATIVE_ASSETS = common_json_1.default;
|
|
44
|
-
_BSNeoLegacyHelper_RPC_LIST_BY_NETWORK_ID = { value: {
|
|
45
|
-
mainnet: [
|
|
46
|
-
'http://seed9.ngd.network:10332',
|
|
47
|
-
'https://mainnet1.neo2.coz.io:443',
|
|
48
|
-
'https://mainnet2.neo2.coz.io:443',
|
|
49
|
-
'https://mainnet3.neo2.coz.io:443',
|
|
50
|
-
'http://seed1.ngd.network:10332',
|
|
51
|
-
'http://seed2.ngd.network:10332',
|
|
52
|
-
'http://seed3.ngd.network:10332',
|
|
53
|
-
'http://seed4.ngd.network:10332',
|
|
54
|
-
'http://seed5.ngd.network:10332',
|
|
55
|
-
],
|
|
56
|
-
testnet: [
|
|
57
|
-
'http://seed5.ngd.network:20332',
|
|
58
|
-
'http://seed1.ngd.network:20332',
|
|
59
|
-
'http://seed2.ngd.network:20332',
|
|
60
|
-
'https://testnet1.neo2.coz.io:443',
|
|
61
|
-
],
|
|
62
|
-
} };
|
|
63
|
-
BSNeoLegacyHelper.LEGACY_NETWORK_BY_NETWORK_ID = {
|
|
64
|
-
mainnet: 'MainNet',
|
|
65
|
-
testnet: 'TestNet',
|
|
66
|
-
};
|
|
67
|
-
BSNeoLegacyHelper.MAINNET_NETWORK_IDS = ['mainnet'];
|
|
68
|
-
BSNeoLegacyHelper.TESTNET_NETWORK_IDS = ['testnet'];
|
|
69
|
-
BSNeoLegacyHelper.ALL_NETWORK_IDS = [..._a.MAINNET_NETWORK_IDS, ..._a.TESTNET_NETWORK_IDS];
|
|
70
|
-
BSNeoLegacyHelper.MAINNET_NETWORKS = [
|
|
71
|
-
{
|
|
72
|
-
id: 'mainnet',
|
|
73
|
-
name: 'Mainnet',
|
|
74
|
-
url: __classPrivateFieldGet(_a, _a, "f", _BSNeoLegacyHelper_RPC_LIST_BY_NETWORK_ID)['mainnet'][0],
|
|
75
|
-
},
|
|
76
|
-
];
|
|
77
|
-
BSNeoLegacyHelper.TESTNET_NETWORKS = [
|
|
78
|
-
{
|
|
79
|
-
id: 'testnet',
|
|
80
|
-
name: 'Testnet',
|
|
81
|
-
url: __classPrivateFieldGet(_a, _a, "f", _BSNeoLegacyHelper_RPC_LIST_BY_NETWORK_ID)['testnet'][0],
|
|
82
|
-
},
|
|
83
|
-
];
|
|
84
|
-
BSNeoLegacyHelper.ALL_NETWORKS = [..._a.MAINNET_NETWORKS, ..._a.TESTNET_NETWORKS];
|
|
85
|
-
BSNeoLegacyHelper.DERIVATION_PATH = "m/44'/888'/0'/0/?";
|
|
86
|
-
BSNeoLegacyHelper.DEFAULT_NETWORK = _a.MAINNET_NETWORKS[0];
|