@cityofzion/bs-neo-legacy 1.0.3 → 1.1.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/BSNeoLegacy.d.ts +5 -5
- package/dist/BSNeoLegacy.js +4 -2
- package/dist/BSNeoLegacyHelper.d.ts +14 -12
- package/dist/BSNeoLegacyHelper.js +9 -0
- package/dist/CryptoCompareEDSNeoLegacy.d.ts +5 -5
- package/dist/CryptoCompareEDSNeoLegacy.js +11 -10
- package/dist/DoraBDSNeoLegacy.d.ts +2 -2
- package/dist/NeoTubeESNeoLegacy.d.ts +3 -4
- package/dist/NeoTubeESNeoLegacy.js +11 -11
- package/package.json +2 -2
package/dist/BSNeoLegacy.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Account, BDSClaimable, BlockchainDataService, BlockchainService, BSClaimable, ExchangeDataService, Token, Network, TransferParam, AccountWithDerivationPath, BSWithExplorerService, ExplorerService } from '@cityofzion/blockchain-service';
|
|
2
|
-
import {
|
|
3
|
-
export declare class BSNeoLegacy<BSCustomName extends string = string> implements BlockchainService<BSCustomName,
|
|
2
|
+
import { BSNeoLegacyNetworkId } from './BSNeoLegacyHelper';
|
|
3
|
+
export declare class BSNeoLegacy<BSCustomName extends string = string> implements BlockchainService<BSCustomName, BSNeoLegacyNetworkId>, BSClaimable, BSWithExplorerService {
|
|
4
4
|
#private;
|
|
5
5
|
readonly blockchainName: BSCustomName;
|
|
6
6
|
readonly derivationPath: string;
|
|
@@ -11,10 +11,10 @@ export declare class BSNeoLegacy<BSCustomName extends string = string> implement
|
|
|
11
11
|
exchangeDataService: ExchangeDataService;
|
|
12
12
|
explorerService: ExplorerService;
|
|
13
13
|
tokens: Token[];
|
|
14
|
-
network: Network<
|
|
14
|
+
network: Network<BSNeoLegacyNetworkId>;
|
|
15
15
|
legacyNetwork: string;
|
|
16
|
-
constructor(blockchainName: BSCustomName, network?: Network<
|
|
17
|
-
setNetwork(network: Network<
|
|
16
|
+
constructor(blockchainName: BSCustomName, network?: Network<BSNeoLegacyNetworkId>);
|
|
17
|
+
setNetwork(network: Network<BSNeoLegacyNetworkId>): void;
|
|
18
18
|
validateAddress(address: string): boolean;
|
|
19
19
|
validateEncrypted(key: string): boolean;
|
|
20
20
|
validateKey(key: string): boolean;
|
package/dist/BSNeoLegacy.js
CHANGED
|
@@ -43,11 +43,13 @@ class BSNeoLegacy {
|
|
|
43
43
|
this.setNetwork(network);
|
|
44
44
|
}
|
|
45
45
|
setNetwork(network) {
|
|
46
|
+
if (!BSNeoLegacyHelper_1.BSNeoLegacyHelper.ALL_NETWORK_IDS.includes(network.id))
|
|
47
|
+
throw new Error('Custom network is not supported');
|
|
46
48
|
__classPrivateFieldGet(this, _BSNeoLegacy_instances, "m", _BSNeoLegacy_setTokens).call(this, network);
|
|
47
49
|
this.network = network;
|
|
48
50
|
this.blockchainDataService = new DoraBDSNeoLegacy_1.DoraBDSNeoLegacy(network, this.feeToken, this.claimToken, this.tokens);
|
|
49
|
-
this.exchangeDataService = new CryptoCompareEDSNeoLegacy_1.CryptoCompareEDSNeoLegacy(network
|
|
50
|
-
this.explorerService = new NeoTubeESNeoLegacy_1.NeoTubeESNeoLegacy(network
|
|
51
|
+
this.exchangeDataService = new CryptoCompareEDSNeoLegacy_1.CryptoCompareEDSNeoLegacy(network);
|
|
52
|
+
this.explorerService = new NeoTubeESNeoLegacy_1.NeoTubeESNeoLegacy(network);
|
|
51
53
|
}
|
|
52
54
|
validateAddress(address) {
|
|
53
55
|
return neon_js_1.wallet.isAddress(address);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Network } from '@cityofzion/blockchain-service';
|
|
2
|
-
export type
|
|
1
|
+
import { Network, NetworkId } from '@cityofzion/blockchain-service';
|
|
2
|
+
export type BSNeoLegacyNetworkId = NetworkId<'mainnet' | 'testnet'>;
|
|
3
3
|
export declare class BSNeoLegacyHelper {
|
|
4
4
|
#private;
|
|
5
5
|
static NATIVE_ASSETS: {
|
|
@@ -8,20 +8,22 @@ export declare class BSNeoLegacyHelper {
|
|
|
8
8
|
hash: string;
|
|
9
9
|
decimals: number;
|
|
10
10
|
}[];
|
|
11
|
-
static LEGACY_NETWORK_BY_NETWORK_ID: Record<
|
|
12
|
-
static MAINNET_NETWORK_IDS:
|
|
13
|
-
static TESTNET_NETWORK_IDS:
|
|
14
|
-
static ALL_NETWORK_IDS:
|
|
15
|
-
static MAINNET_NETWORKS: Network<
|
|
16
|
-
static TESTNET_NETWORKS: Network<
|
|
17
|
-
static ALL_NETWORKS: Network<
|
|
11
|
+
static LEGACY_NETWORK_BY_NETWORK_ID: Record<BSNeoLegacyNetworkId, string>;
|
|
12
|
+
static MAINNET_NETWORK_IDS: BSNeoLegacyNetworkId[];
|
|
13
|
+
static TESTNET_NETWORK_IDS: BSNeoLegacyNetworkId[];
|
|
14
|
+
static ALL_NETWORK_IDS: BSNeoLegacyNetworkId[];
|
|
15
|
+
static MAINNET_NETWORKS: Network<BSNeoLegacyNetworkId>[];
|
|
16
|
+
static TESTNET_NETWORKS: Network<BSNeoLegacyNetworkId>[];
|
|
17
|
+
static ALL_NETWORKS: Network<BSNeoLegacyNetworkId>[];
|
|
18
18
|
static DERIVATION_PATH: string;
|
|
19
|
-
static DEFAULT_NETWORK: Network<
|
|
20
|
-
static
|
|
19
|
+
static DEFAULT_NETWORK: Network<BSNeoLegacyNetworkId>;
|
|
20
|
+
static getLegacyNetwork(network: Network<BSNeoLegacyNetworkId>): string;
|
|
21
|
+
static getTokens(network: Network<BSNeoLegacyNetworkId>): {
|
|
21
22
|
symbol: string;
|
|
22
23
|
name: string;
|
|
23
24
|
hash: string;
|
|
24
25
|
decimals: number;
|
|
25
26
|
}[];
|
|
26
|
-
static getRpcList(network: Network<
|
|
27
|
+
static getRpcList(network: Network<BSNeoLegacyNetworkId>): string[];
|
|
28
|
+
static isMainnet(network: Network<BSNeoLegacyNetworkId>): boolean;
|
|
27
29
|
}
|
|
@@ -13,6 +13,12 @@ exports.BSNeoLegacyHelper = void 0;
|
|
|
13
13
|
const common_json_1 = __importDefault(require("./assets/tokens/common.json"));
|
|
14
14
|
const mainnet_json_1 = __importDefault(require("./assets/tokens/mainnet.json"));
|
|
15
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
|
+
}
|
|
16
22
|
static getTokens(network) {
|
|
17
23
|
var _b;
|
|
18
24
|
const extraTokens = (_b = __classPrivateFieldGet(this, _a, "f", _BSNeoLegacyHelper_EXTRA_TOKENS_BY_NETWORK_ID)[network.id]) !== null && _b !== void 0 ? _b : [];
|
|
@@ -22,6 +28,9 @@ class BSNeoLegacyHelper {
|
|
|
22
28
|
var _b;
|
|
23
29
|
return (_b = __classPrivateFieldGet(this, _a, "f", _BSNeoLegacyHelper_RPC_LIST_BY_NETWORK_ID)[network.id]) !== null && _b !== void 0 ? _b : [];
|
|
24
30
|
}
|
|
31
|
+
static isMainnet(network) {
|
|
32
|
+
return this.MAINNET_NETWORK_IDS.includes(network.id);
|
|
33
|
+
}
|
|
25
34
|
}
|
|
26
35
|
exports.BSNeoLegacyHelper = BSNeoLegacyHelper;
|
|
27
36
|
_a = BSNeoLegacyHelper;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CryptoCompareEDS,
|
|
2
|
-
import {
|
|
1
|
+
import { CryptoCompareEDS, ExchangeDataService, GetTokenPriceHistoryParams, GetTokenPricesParams, Network, TokenPricesHistoryResponse, TokenPricesResponse } from '@cityofzion/blockchain-service';
|
|
2
|
+
import { BSNeoLegacyNetworkId } from './BSNeoLegacyHelper';
|
|
3
3
|
export declare class CryptoCompareEDSNeoLegacy extends CryptoCompareEDS implements ExchangeDataService {
|
|
4
4
|
#private;
|
|
5
|
-
constructor(
|
|
6
|
-
getTokenPriceHistory(params:
|
|
7
|
-
getTokenPrices(
|
|
5
|
+
constructor(network: Network<BSNeoLegacyNetworkId>);
|
|
6
|
+
getTokenPriceHistory(params: GetTokenPriceHistoryParams): Promise<TokenPricesHistoryResponse[]>;
|
|
7
|
+
getTokenPrices(params: GetTokenPricesParams): Promise<TokenPricesResponse[]>;
|
|
8
8
|
}
|
|
@@ -19,36 +19,37 @@ 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
|
|
22
|
+
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("./BSNeoLegacyHelper");
|
|
26
27
|
class CryptoCompareEDSNeoLegacy extends blockchain_service_1.CryptoCompareEDS {
|
|
27
|
-
constructor(
|
|
28
|
-
super(
|
|
29
|
-
|
|
30
|
-
__classPrivateFieldSet(this,
|
|
28
|
+
constructor(network) {
|
|
29
|
+
super();
|
|
30
|
+
_CryptoCompareEDSNeoLegacy_network.set(this, void 0);
|
|
31
|
+
__classPrivateFieldSet(this, _CryptoCompareEDSNeoLegacy_network, network, "f");
|
|
31
32
|
}
|
|
32
33
|
getTokenPriceHistory(params) {
|
|
33
34
|
const _super = Object.create(null, {
|
|
34
35
|
getTokenPriceHistory: { get: () => super.getTokenPriceHistory }
|
|
35
36
|
});
|
|
36
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
if (__classPrivateFieldGet(this,
|
|
38
|
+
if (!BSNeoLegacyHelper_1.BSNeoLegacyHelper.isMainnet(__classPrivateFieldGet(this, _CryptoCompareEDSNeoLegacy_network, "f")))
|
|
38
39
|
throw new Error('Exchange is only available on mainnet');
|
|
39
40
|
return yield _super.getTokenPriceHistory.call(this, params);
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
|
-
getTokenPrices(
|
|
43
|
+
getTokenPrices(params) {
|
|
43
44
|
const _super = Object.create(null, {
|
|
44
45
|
getTokenPrices: { get: () => super.getTokenPrices }
|
|
45
46
|
});
|
|
46
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
if (__classPrivateFieldGet(this,
|
|
48
|
+
if (!BSNeoLegacyHelper_1.BSNeoLegacyHelper.isMainnet(__classPrivateFieldGet(this, _CryptoCompareEDSNeoLegacy_network, "f")))
|
|
48
49
|
throw new Error('Exchange is only available on mainnet');
|
|
49
|
-
return yield _super.getTokenPrices.call(this,
|
|
50
|
+
return yield _super.getTokenPrices.call(this, params);
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
exports.CryptoCompareEDSNeoLegacy = CryptoCompareEDSNeoLegacy;
|
|
54
|
-
|
|
55
|
+
_CryptoCompareEDSNeoLegacy_network = new WeakMap();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BalanceResponse, BlockchainDataService, ContractResponse, TransactionsByAddressParams, TransactionsByAddressResponse, TransactionResponse, BDSClaimable, Token, Network, RpcResponse } from '@cityofzion/blockchain-service';
|
|
2
|
-
import {
|
|
2
|
+
import { BSNeoLegacyNetworkId } from './BSNeoLegacyHelper';
|
|
3
3
|
export declare class DoraBDSNeoLegacy implements BlockchainDataService, BDSClaimable {
|
|
4
4
|
#private;
|
|
5
5
|
maxTimeToConfirmTransactionInMs: number;
|
|
6
|
-
constructor(network: Network<
|
|
6
|
+
constructor(network: Network<BSNeoLegacyNetworkId>, 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>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { BuildNftUrlParams, ExplorerService } from '@cityofzion/blockchain-service';
|
|
2
|
-
import {
|
|
1
|
+
import { BuildNftUrlParams, ExplorerService, Network } from '@cityofzion/blockchain-service';
|
|
2
|
+
import { BSNeoLegacyNetworkId } from './BSNeoLegacyHelper';
|
|
3
3
|
export declare class NeoTubeESNeoLegacy implements ExplorerService {
|
|
4
4
|
#private;
|
|
5
|
-
|
|
6
|
-
constructor(networkId: AvailableNetworkIds);
|
|
5
|
+
constructor(network: Network<BSNeoLegacyNetworkId>);
|
|
7
6
|
buildTransactionUrl(hash: string): string;
|
|
8
7
|
buildContractUrl(contractHash: string): string;
|
|
9
8
|
buildNftUrl(_params: BuildNftUrlParams): string;
|
|
@@ -10,28 +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_network;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.NeoTubeESNeoLegacy = void 0;
|
|
16
|
+
const BSNeoLegacyHelper_1 = require("./BSNeoLegacyHelper");
|
|
16
17
|
class NeoTubeESNeoLegacy {
|
|
17
|
-
constructor(
|
|
18
|
-
|
|
19
|
-
__classPrivateFieldSet(this,
|
|
18
|
+
constructor(network) {
|
|
19
|
+
_NeoTubeESNeoLegacy_network.set(this, void 0);
|
|
20
|
+
__classPrivateFieldSet(this, _NeoTubeESNeoLegacy_network, network, "f");
|
|
20
21
|
}
|
|
21
22
|
buildTransactionUrl(hash) {
|
|
22
|
-
if (!
|
|
23
|
-
throw new Error('
|
|
23
|
+
if (!BSNeoLegacyHelper_1.BSNeoLegacyHelper.isMainnet(__classPrivateFieldGet(this, _NeoTubeESNeoLegacy_network, "f")))
|
|
24
|
+
throw new Error('NeoTube is only available on mainnet');
|
|
24
25
|
return `https://neo2.neotube.io/transaction/${hash}`;
|
|
25
26
|
}
|
|
26
27
|
buildContractUrl(contractHash) {
|
|
27
|
-
if (!
|
|
28
|
-
throw new Error('
|
|
28
|
+
if (!BSNeoLegacyHelper_1.BSNeoLegacyHelper.isMainnet(__classPrivateFieldGet(this, _NeoTubeESNeoLegacy_network, "f")))
|
|
29
|
+
throw new Error('NeoTube is only available on mainnet');
|
|
29
30
|
return `https://neo2.neotube.io/asset/${contractHash}/page/1`;
|
|
30
31
|
}
|
|
31
32
|
buildNftUrl(_params) {
|
|
32
|
-
throw new Error('
|
|
33
|
+
throw new Error('NeoTube does not support nft');
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
exports.NeoTubeESNeoLegacy = NeoTubeESNeoLegacy;
|
|
36
|
-
|
|
37
|
-
NeoTubeESNeoLegacy.SUPPORTED_NETWORKS = ['mainnet'];
|
|
37
|
+
_NeoTubeESNeoLegacy_network = new WeakMap();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neo-legacy",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
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.1.0",
|
|
15
15
|
"@cityofzion/bs-asteroid-sdk": "0.9.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|