@cityofzion/bs-ethereum 1.2.3 → 1.2.4
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.js +1 -1
- package/dist/BitqueryEDSEthereum.d.ts +2 -2
- package/dist/BitqueryEDSEthereum.js +3 -1
- package/dist/GhostMarketNDSEthereum.d.ts +4 -3
- package/dist/GhostMarketNDSEthereum.js +5 -3
- package/dist/RpcNDSEthereum.d.ts +8 -0
- package/dist/RpcNDSEthereum.js +49 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +2 -2
package/dist/BSEthereum.js
CHANGED
|
@@ -66,7 +66,7 @@ class BSEthereum {
|
|
|
66
66
|
this.blockchainDataService = new BitqueryBDSEthereum_1.BitqueryBDSEthereum(network);
|
|
67
67
|
}
|
|
68
68
|
this.exchangeDataService = new BitqueryEDSEthereum_1.BitqueryEDSEthereum(network.type);
|
|
69
|
-
this.nftDataService = new GhostMarketNDSEthereum_1.GhostMarketNDSEthereum(network
|
|
69
|
+
this.nftDataService = new GhostMarketNDSEthereum_1.GhostMarketNDSEthereum(network);
|
|
70
70
|
}
|
|
71
71
|
validateAddress(address) {
|
|
72
72
|
return ethers_1.ethers.utils.isAddress(address);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Currency, ExchangeDataService, NetworkType, TokenPricesResponse } from '@cityofzion/blockchain-service';
|
|
2
|
-
export declare class BitqueryEDSEthereum implements ExchangeDataService {
|
|
1
|
+
import { CryptoCompareEDS, Currency, ExchangeDataService, NetworkType, TokenPricesResponse } from '@cityofzion/blockchain-service';
|
|
2
|
+
export declare class BitqueryEDSEthereum extends CryptoCompareEDS implements ExchangeDataService {
|
|
3
3
|
#private;
|
|
4
4
|
constructor(networkType: NetworkType);
|
|
5
5
|
getTokenPrices(currency: Currency): Promise<TokenPricesResponse[]>;
|
|
@@ -25,13 +25,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
25
|
var _BitqueryEDSEthereum_client, _BitqueryEDSEthereum_networkType;
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
27
|
exports.BitqueryEDSEthereum = void 0;
|
|
28
|
+
const blockchain_service_1 = require("@cityofzion/blockchain-service");
|
|
28
29
|
const axios_1 = __importDefault(require("axios"));
|
|
29
30
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
30
31
|
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
31
32
|
const constants_1 = require("./constants");
|
|
32
33
|
dayjs_1.default.extend(utc_1.default);
|
|
33
|
-
class BitqueryEDSEthereum {
|
|
34
|
+
class BitqueryEDSEthereum extends blockchain_service_1.CryptoCompareEDS {
|
|
34
35
|
constructor(networkType) {
|
|
36
|
+
super(networkType, constants_1.TOKENS[networkType]);
|
|
35
37
|
_BitqueryEDSEthereum_client.set(this, void 0);
|
|
36
38
|
_BitqueryEDSEthereum_networkType.set(this, void 0);
|
|
37
39
|
__classPrivateFieldSet(this, _BitqueryEDSEthereum_networkType, networkType, "f");
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { NftResponse, NftsResponse,
|
|
2
|
-
|
|
1
|
+
import { NftResponse, NftsResponse, GetNftParam, GetNftsByAddressParams, Network } from '@cityofzion/blockchain-service';
|
|
2
|
+
import { RpcNDSEthereum } from './RpcNDSEthereum';
|
|
3
|
+
export declare class GhostMarketNDSEthereum extends RpcNDSEthereum {
|
|
3
4
|
#private;
|
|
4
|
-
constructor(
|
|
5
|
+
constructor(network: Network);
|
|
5
6
|
getNftsByAddress({ address, size, cursor }: GetNftsByAddressParams): Promise<NftsResponse>;
|
|
6
7
|
getNft({ contractHash, tokenId }: GetNftParam): Promise<NftResponse>;
|
|
7
8
|
private treatGhostMarketImage;
|
|
@@ -28,10 +28,12 @@ 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 constants_1 = require("./constants");
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const RpcNDSEthereum_1 = require("./RpcNDSEthereum");
|
|
32
|
+
class GhostMarketNDSEthereum extends RpcNDSEthereum_1.RpcNDSEthereum {
|
|
33
|
+
constructor(network) {
|
|
34
|
+
super(network);
|
|
33
35
|
_GhostMarketNDSEthereum_networkType.set(this, void 0);
|
|
34
|
-
__classPrivateFieldSet(this, _GhostMarketNDSEthereum_networkType,
|
|
36
|
+
__classPrivateFieldSet(this, _GhostMarketNDSEthereum_networkType, network.type, "f");
|
|
35
37
|
}
|
|
36
38
|
getNftsByAddress({ address, size = 18, cursor }) {
|
|
37
39
|
var _a;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GetNftParam, GetNftsByAddressParams, HasTokenParam, Network, NftDataService, NftResponse, NftsResponse } from '@cityofzion/blockchain-service';
|
|
2
|
+
export declare abstract class RpcNDSEthereum implements NftDataService {
|
|
3
|
+
#private;
|
|
4
|
+
protected constructor(network: Network);
|
|
5
|
+
abstract getNftsByAddress(params: GetNftsByAddressParams): Promise<NftsResponse>;
|
|
6
|
+
abstract getNft(params: GetNftParam): Promise<NftResponse>;
|
|
7
|
+
hasToken({ contractHash, address }: HasTokenParam): Promise<boolean>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
12
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
13
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
14
|
+
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");
|
|
15
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
16
|
+
};
|
|
17
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
18
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
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
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
21
|
+
};
|
|
22
|
+
var _RpcNDSEthereum_network;
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.RpcNDSEthereum = void 0;
|
|
25
|
+
const ethers_1 = require("ethers");
|
|
26
|
+
class RpcNDSEthereum {
|
|
27
|
+
constructor(network) {
|
|
28
|
+
_RpcNDSEthereum_network.set(this, void 0);
|
|
29
|
+
__classPrivateFieldSet(this, _RpcNDSEthereum_network, network, "f");
|
|
30
|
+
}
|
|
31
|
+
hasToken({ contractHash, address }) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
try {
|
|
34
|
+
const provider = new ethers_1.ethers.providers.JsonRpcProvider(__classPrivateFieldGet(this, _RpcNDSEthereum_network, "f").url);
|
|
35
|
+
const contract = new ethers_1.ethers.Contract(contractHash, ['function balanceOf(address _owner) external view returns (uint256)'], provider);
|
|
36
|
+
const response = yield contract.balanceOf(address);
|
|
37
|
+
if (!response)
|
|
38
|
+
throw new Error();
|
|
39
|
+
const parsedResponse = response;
|
|
40
|
+
return parsedResponse.gt(0);
|
|
41
|
+
}
|
|
42
|
+
catch (_a) {
|
|
43
|
+
throw new Error(`Token not found: ${contractHash}`);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.RpcNDSEthereum = RpcNDSEthereum;
|
|
49
|
+
_RpcNDSEthereum_network = new WeakMap();
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -20,3 +20,4 @@ __exportStar(require("./constants"), exports);
|
|
|
20
20
|
__exportStar(require("./BitqueryBDSEthereum"), exports);
|
|
21
21
|
__exportStar(require("./BitqueryEDSEthereum"), exports);
|
|
22
22
|
__exportStar(require("./RpcBDSEthereum"), exports);
|
|
23
|
+
__exportStar(require("./RpcNDSEthereum"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-ethereum",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"repository": "https://github.com/CityOfZion/blockchain-services",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@ledgerhq/hw-transport-node-hid": "~6.28.5",
|
|
22
22
|
"@ledgerhq/hw-transport": "~6.30.5",
|
|
23
23
|
"@ledgerhq/hw-app-eth": "~6.35.7",
|
|
24
|
-
"@cityofzion/blockchain-service": "0.11.
|
|
24
|
+
"@cityofzion/blockchain-service": "0.11.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/jest": "29.5.3",
|