@cityofzion/bs-ethereum 2.4.0 → 2.6.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/BSEthereum.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare class BSEthereum<BSCustomName extends string = string> implements
|
|
|
14
14
|
network: Network<BSEthereumNetworkId>;
|
|
15
15
|
explorerService: ExplorerService;
|
|
16
16
|
constructor(blockchainName: BSCustomName, network?: Network<BSEthereumNetworkId>, getLedgerTransport?: GetLedgerTransport);
|
|
17
|
-
|
|
17
|
+
testNetwork(network: Network<BSEthereumNetworkId>): Promise<void>;
|
|
18
18
|
setNetwork(network: Network<BSEthereumNetworkId>): void;
|
|
19
19
|
validateAddress(address: string): boolean;
|
|
20
20
|
validateEncrypted(json: string): boolean;
|
package/dist/BSEthereum.js
CHANGED
|
@@ -58,6 +58,7 @@ const MoralisBDSEthereum_1 = require("./services/blockchain-data/MoralisBDSEther
|
|
|
58
58
|
const MoralisEDSEthereum_1 = require("./services/exchange-data/MoralisEDSEthereum");
|
|
59
59
|
const GhostMarketNDSEthereum_1 = require("./services/nft-data/GhostMarketNDSEthereum");
|
|
60
60
|
const BlockscoutESEthereum_1 = require("./services/explorer/BlockscoutESEthereum");
|
|
61
|
+
const RpcBDSEthereum_1 = require("./services/blockchain-data/RpcBDSEthereum");
|
|
61
62
|
class BSEthereum {
|
|
62
63
|
constructor(blockchainName, network, getLedgerTransport) {
|
|
63
64
|
_BSEthereum_instances.add(this);
|
|
@@ -69,8 +70,11 @@ class BSEthereum {
|
|
|
69
70
|
this.bip44DerivationPath = BSEthereumConstants_1.BSEthereumConstants.DEFAULT_BIP44_DERIVATION_PATH;
|
|
70
71
|
this.setNetwork(network);
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
-
return
|
|
73
|
+
testNetwork(network) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
const blockchainDataServiceClone = new RpcBDSEthereum_1.RpcBDSEthereum(network);
|
|
76
|
+
yield blockchainDataServiceClone.getBlockHeight();
|
|
77
|
+
});
|
|
74
78
|
}
|
|
75
79
|
setNetwork(network) {
|
|
76
80
|
__classPrivateFieldGet(this, _BSEthereum_instances, "m", _BSEthereum_setTokens).call(this, network);
|
|
@@ -97,18 +101,14 @@ class BSEthereum {
|
|
|
97
101
|
if (!key.startsWith('0x')) {
|
|
98
102
|
key = '0x' + key;
|
|
99
103
|
}
|
|
100
|
-
|
|
101
|
-
return false;
|
|
102
|
-
return true;
|
|
104
|
+
return ethersBytes.hexDataLength(key) === 32;
|
|
103
105
|
}
|
|
104
106
|
catch (error) {
|
|
105
107
|
return false;
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
validateNameServiceDomainFormat(domainName) {
|
|
109
|
-
|
|
110
|
-
return false;
|
|
111
|
-
return true;
|
|
111
|
+
return domainName.endsWith('.eth');
|
|
112
112
|
}
|
|
113
113
|
generateAccountFromMnemonic(mnemonic, index) {
|
|
114
114
|
const bip44Path = this.bip44DerivationPath.replace('?', index.toString());
|
|
@@ -3,10 +3,8 @@ import { RpcNDSEthereum } from './RpcNDSEthereum';
|
|
|
3
3
|
import { BSEthereumNetworkId } from '../../constants/BSEthereumConstants';
|
|
4
4
|
export declare class GhostMarketNDSEthereum extends RpcNDSEthereum {
|
|
5
5
|
#private;
|
|
6
|
-
static
|
|
7
|
-
|
|
8
|
-
chain: string;
|
|
9
|
-
}>>;
|
|
6
|
+
static readonly BASE_URL = "https://api.ghostmarket.io/api/v2";
|
|
7
|
+
static CONFIG_BY_NETWORK_ID: Partial<Record<BSEthereumNetworkId, string>>;
|
|
10
8
|
constructor(network: Network<BSEthereumNetworkId>);
|
|
11
9
|
getNftsByAddress({ address, size, cursor }: GetNftsByAddressParams): Promise<NftsResponse>;
|
|
12
10
|
getNft({ contractHash, tokenId }: GetNftParam): Promise<NftResponse>;
|
|
@@ -28,6 +28,7 @@ exports.GhostMarketNDSEthereum = void 0;
|
|
|
28
28
|
const query_string_1 = __importDefault(require("query-string"));
|
|
29
29
|
const axios_1 = __importDefault(require("axios"));
|
|
30
30
|
const RpcNDSEthereum_1 = require("./RpcNDSEthereum");
|
|
31
|
+
const BSEthereumConstants_1 = require("../../constants/BSEthereumConstants");
|
|
31
32
|
class GhostMarketNDSEthereum extends RpcNDSEthereum_1.RpcNDSEthereum {
|
|
32
33
|
constructor(network) {
|
|
33
34
|
super(network);
|
|
@@ -69,11 +70,11 @@ class GhostMarketNDSEthereum extends RpcNDSEthereum_1.RpcNDSEthereum {
|
|
|
69
70
|
return srcImage;
|
|
70
71
|
}
|
|
71
72
|
getUrlWithParams(params) {
|
|
72
|
-
const
|
|
73
|
-
if (!
|
|
73
|
+
const chain = GhostMarketNDSEthereum.CONFIG_BY_NETWORK_ID[__classPrivateFieldGet(this, _GhostMarketNDSEthereum_network, "f").id];
|
|
74
|
+
if (!chain)
|
|
74
75
|
throw new Error('Unsupported network');
|
|
75
|
-
const parameters = query_string_1.default.stringify(Object.assign({ chain
|
|
76
|
-
return `${
|
|
76
|
+
const parameters = query_string_1.default.stringify(Object.assign({ chain }, params), { arrayFormat: 'bracket' });
|
|
77
|
+
return `${GhostMarketNDSEthereum.BASE_URL}/assets?${parameters}`;
|
|
77
78
|
}
|
|
78
79
|
parse(data) {
|
|
79
80
|
var _a, _b;
|
|
@@ -96,9 +97,8 @@ class GhostMarketNDSEthereum extends RpcNDSEthereum_1.RpcNDSEthereum {
|
|
|
96
97
|
}
|
|
97
98
|
exports.GhostMarketNDSEthereum = GhostMarketNDSEthereum;
|
|
98
99
|
_GhostMarketNDSEthereum_network = new WeakMap();
|
|
100
|
+
GhostMarketNDSEthereum.BASE_URL = 'https://api.ghostmarket.io/api/v2';
|
|
99
101
|
GhostMarketNDSEthereum.CONFIG_BY_NETWORK_ID = {
|
|
100
|
-
'1':
|
|
101
|
-
|
|
102
|
-
chain: 'eth',
|
|
103
|
-
},
|
|
102
|
+
'1': 'eth',
|
|
103
|
+
[BSEthereumConstants_1.BSEthereumConstants.NEOX_MAINNET_NETWORK_ID]: 'neox',
|
|
104
104
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-ethereum",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@ledgerhq/hw-app-eth": "~6.35.7",
|
|
21
21
|
"@ethersproject/abstract-signer": "~5.7.0",
|
|
22
22
|
"@ethersproject/properties": "~5.7.0",
|
|
23
|
-
"@cityofzion/blockchain-service": "1.
|
|
23
|
+
"@cityofzion/blockchain-service": "1.6.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@ledgerhq/hw-transport-node-hid": "~6.28.5",
|