@cityofzion/bs-ethereum 2.2.12 → 2.2.13
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/BSEthereum.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Account, AccountWithDerivationPath, BSCalculableFee, BSWithLedger, BSWithNameService, BSWithNft, BlockchainDataService, BlockchainService, ExchangeDataService, Network, NftDataService, Token, TransferParam } from '@cityofzion/blockchain-service';
|
|
1
|
+
import { Account, AccountWithDerivationPath, BSCalculableFee, BSWithExplorerService, BSWithLedger, BSWithNameService, BSWithNft, BlockchainDataService, BlockchainService, ExchangeDataService, ExplorerService, Network, NftDataService, Token, TransferParam } from '@cityofzion/blockchain-service';
|
|
2
2
|
import { EthersLedgerServiceEthereum } from './EthersLedgerServiceEthereum';
|
|
3
3
|
import Transport from '@ledgerhq/hw-transport';
|
|
4
4
|
import { BSEthereumNetworkId } from './BSEthereumHelper';
|
|
5
|
-
export declare class BSEthereum<BSCustomName extends string = string> implements BlockchainService<BSCustomName, BSEthereumNetworkId>, BSWithNft, BSWithNameService, BSCalculableFee, BSWithLedger {
|
|
5
|
+
export declare class BSEthereum<BSCustomName extends string = string> implements BlockchainService<BSCustomName, BSEthereumNetworkId>, BSWithNft, BSWithNameService, BSCalculableFee, BSWithLedger, BSWithExplorerService {
|
|
6
6
|
#private;
|
|
7
7
|
readonly blockchainName: BSCustomName;
|
|
8
8
|
readonly derivationPath: string;
|
|
@@ -13,6 +13,7 @@ export declare class BSEthereum<BSCustomName extends string = string> implements
|
|
|
13
13
|
tokens: Token[];
|
|
14
14
|
nftDataService: NftDataService;
|
|
15
15
|
network: Network<BSEthereumNetworkId>;
|
|
16
|
+
explorerService: ExplorerService;
|
|
16
17
|
constructor(blockchainName: BSCustomName, network?: Network<BSEthereumNetworkId>, getLedgerTransport?: (account: Account) => Promise<Transport>);
|
|
17
18
|
setNetwork(network: Network<BSEthereumNetworkId>): void;
|
|
18
19
|
validateAddress(address: string): boolean;
|
package/dist/BSEthereum.js
CHANGED
|
@@ -50,6 +50,7 @@ const MoralisBDSEthereum_1 = require("./MoralisBDSEthereum");
|
|
|
50
50
|
const MoralisEDSEthereum_1 = require("./MoralisEDSEthereum");
|
|
51
51
|
const BlockscoutNeoXBDSEthereum_1 = require("./BlockscoutNeoXBDSEthereum");
|
|
52
52
|
const BlockscoutNeoXEDSEthereum_1 = require("./BlockscoutNeoXEDSEthereum");
|
|
53
|
+
const BlockscoutNeoXESEthereum_1 = require("./BlockscoutNeoXESEthereum");
|
|
53
54
|
class BSEthereum {
|
|
54
55
|
constructor(blockchainName, network, getLedgerTransport) {
|
|
55
56
|
_BSEthereum_instances.add(this);
|
|
@@ -71,6 +72,7 @@ class BSEthereum {
|
|
|
71
72
|
this.blockchainDataService = new MoralisBDSEthereum_1.MoralisBDSEthereum(network);
|
|
72
73
|
}
|
|
73
74
|
this.nftDataService = new GhostMarketNDSEthereum_1.GhostMarketNDSEthereum(network);
|
|
75
|
+
this.explorerService = new BlockscoutNeoXESEthereum_1.BlockscoutNeoXESEthereum(network);
|
|
74
76
|
}
|
|
75
77
|
validateAddress(address) {
|
|
76
78
|
return ethers_1.ethers.utils.isAddress(address);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BuildNftUrlParams, ExplorerService, Network } from '@cityofzion/blockchain-service';
|
|
2
|
+
import { BSEthereumNetworkId } from './BSEthereumHelper';
|
|
3
|
+
export declare class BlockscoutNeoXESEthereum implements ExplorerService {
|
|
4
|
+
#private;
|
|
5
|
+
static BASE_URL_BY_CHAIN_ID: Partial<Record<BSEthereumNetworkId, string>>;
|
|
6
|
+
static isSupported(network: Network<BSEthereumNetworkId>): boolean;
|
|
7
|
+
constructor(network: Network<BSEthereumNetworkId>);
|
|
8
|
+
buildTransactionUrl(hash: string): string;
|
|
9
|
+
buildContractUrl(contractHash: string): string;
|
|
10
|
+
buildNftUrl(params: BuildNftUrlParams): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
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
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _BlockscoutNeoXESEthereum_network;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.BlockscoutNeoXESEthereum = void 0;
|
|
16
|
+
class BlockscoutNeoXESEthereum {
|
|
17
|
+
static isSupported(network) {
|
|
18
|
+
return !!BlockscoutNeoXESEthereum.BASE_URL_BY_CHAIN_ID[network.id];
|
|
19
|
+
}
|
|
20
|
+
constructor(network) {
|
|
21
|
+
_BlockscoutNeoXESEthereum_network.set(this, void 0);
|
|
22
|
+
__classPrivateFieldSet(this, _BlockscoutNeoXESEthereum_network, network, "f");
|
|
23
|
+
}
|
|
24
|
+
buildTransactionUrl(hash) {
|
|
25
|
+
if (!BlockscoutNeoXESEthereum.isSupported(__classPrivateFieldGet(this, _BlockscoutNeoXESEthereum_network, "f"))) {
|
|
26
|
+
throw new Error('Network not supported');
|
|
27
|
+
}
|
|
28
|
+
const baseURL = BlockscoutNeoXESEthereum.BASE_URL_BY_CHAIN_ID[__classPrivateFieldGet(this, _BlockscoutNeoXESEthereum_network, "f").id];
|
|
29
|
+
return `${baseURL}/tx/${hash}`;
|
|
30
|
+
}
|
|
31
|
+
buildContractUrl(contractHash) {
|
|
32
|
+
if (!BlockscoutNeoXESEthereum.isSupported(__classPrivateFieldGet(this, _BlockscoutNeoXESEthereum_network, "f"))) {
|
|
33
|
+
throw new Error('Network not supported');
|
|
34
|
+
}
|
|
35
|
+
const baseURL = BlockscoutNeoXESEthereum.BASE_URL_BY_CHAIN_ID[__classPrivateFieldGet(this, _BlockscoutNeoXESEthereum_network, "f").id];
|
|
36
|
+
return `${baseURL}/address/${contractHash}`;
|
|
37
|
+
}
|
|
38
|
+
buildNftUrl(params) {
|
|
39
|
+
if (!BlockscoutNeoXESEthereum.isSupported(__classPrivateFieldGet(this, _BlockscoutNeoXESEthereum_network, "f"))) {
|
|
40
|
+
throw new Error('Network not supported');
|
|
41
|
+
}
|
|
42
|
+
const baseURL = BlockscoutNeoXESEthereum.BASE_URL_BY_CHAIN_ID[__classPrivateFieldGet(this, _BlockscoutNeoXESEthereum_network, "f").id];
|
|
43
|
+
return `${baseURL}/token/${params.contractHash}/instance/${params.tokenId}`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.BlockscoutNeoXESEthereum = BlockscoutNeoXESEthereum;
|
|
47
|
+
_BlockscoutNeoXESEthereum_network = new WeakMap();
|
|
48
|
+
BlockscoutNeoXESEthereum.BASE_URL_BY_CHAIN_ID = {
|
|
49
|
+
'12227332': 'https://xt4scan.ngd.network',
|
|
50
|
+
'47763': 'https://xexplorer.neo.org',
|
|
51
|
+
};
|