@cityofzion/bs-ethereum 0.8.0 → 0.8.2
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/.rush/temp/operation/build/all.log +1 -1
- package/.rush/temp/operation/build/state.json +1 -1
- package/.rush/temp/package-deps_build.json +4 -6
- package/.rush/temp/shrinkwrap-deps.json +2 -1
- package/bs-ethereum.build.log +1 -1
- package/dist/BSEthereum.d.ts +23 -23
- package/dist/BSEthereum.js +178 -178
- package/dist/BitqueryBDSEthereum.d.ts +14 -14
- package/dist/BitqueryBDSEthereum.js +197 -186
- package/dist/BitqueryEDSEthereum.d.ts +8 -8
- package/dist/BitqueryEDSEthereum.js +73 -73
- package/dist/GhostMarketNDSEthereum.d.ts +10 -10
- package/dist/GhostMarketNDSEthereum.js +77 -77
- package/dist/RpcBDSEthereum.d.ts +12 -12
- package/dist/RpcBDSEthereum.js +89 -89
- package/dist/assets/tokens/common.json +8 -8
- package/dist/constants.d.ts +16 -16
- package/dist/constants.js +33 -33
- package/dist/graphql.d.ts +124 -123
- package/dist/graphql.js +163 -162
- package/dist/index.d.ts +6 -6
- package/dist/index.js +22 -22
- package/jest.config.ts +13 -13
- package/jest.setup.ts +1 -1
- package/package.json +34 -34
- package/src/BSEthereum.ts +184 -184
- package/src/BitqueryBDSEthereum.ts +230 -220
- package/src/BitqueryEDSEthereum.ts +67 -67
- package/src/GhostMarketNDSEthereum.ts +122 -122
- package/src/RpcBDSEthereum.ts +88 -88
- package/src/__tests__/BDSEthereum.spec.ts +123 -123
- package/src/__tests__/BSEthereum.spec.ts +123 -123
- package/src/__tests__/BitqueryEDSEthereum.spec.ts +49 -49
- package/src/__tests__/GhostMarketNDSEthereum.spec.ts +45 -45
- package/src/assets/tokens/common.json +7 -7
- package/src/constants.ts +37 -37
- package/src/graphql.ts +291 -289
- package/src/index.ts +6 -6
- package/tsconfig.build.json +4 -4
- package/tsconfig.json +15 -15
- package/CHANGELOG.json +0 -22
- package/CHANGELOG.md +0 -11
|
@@ -1,77 +1,77 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.GhostMarketNDSEthereum = void 0;
|
|
16
|
-
const query_string_1 = __importDefault(require("query-string"));
|
|
17
|
-
const constants_1 = require("./constants");
|
|
18
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
19
|
-
class GhostMarketNDSEthereum {
|
|
20
|
-
constructor(networkType) {
|
|
21
|
-
this.networkType = networkType;
|
|
22
|
-
}
|
|
23
|
-
getNftsByAddress({ address, size = 18, cursor, page }) {
|
|
24
|
-
var _a;
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const url = this.getUrlWithParams({
|
|
27
|
-
size,
|
|
28
|
-
owners: [address],
|
|
29
|
-
cursor: cursor,
|
|
30
|
-
});
|
|
31
|
-
const request = yield (0, node_fetch_1.default)(url, { method: 'GET' });
|
|
32
|
-
const data = (yield request.json());
|
|
33
|
-
const nfts = (_a = data.assets) !== null && _a !== void 0 ? _a : [];
|
|
34
|
-
return { nextCursor: data.next, items: nfts.map(this.parse.bind(this)) };
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
getNft({ contractHash, tokenId }) {
|
|
38
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
const url = this.getUrlWithParams({
|
|
40
|
-
contract: contractHash,
|
|
41
|
-
tokenIds: [tokenId],
|
|
42
|
-
});
|
|
43
|
-
const request = yield (0, node_fetch_1.default)(url, { method: 'GET' });
|
|
44
|
-
const data = (yield request.json());
|
|
45
|
-
return this.parse(data.assets[0]);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
treatGhostMarketImage(srcImage) {
|
|
49
|
-
if (!srcImage) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
if (srcImage.startsWith('ipfs://')) {
|
|
53
|
-
const [, imageId] = srcImage.split('://');
|
|
54
|
-
return `https://ghostmarket.mypinata.cloud/ipfs/${imageId}`;
|
|
55
|
-
}
|
|
56
|
-
return srcImage;
|
|
57
|
-
}
|
|
58
|
-
getUrlWithParams(params) {
|
|
59
|
-
const parameters = query_string_1.default.stringify(Object.assign({ chain: constants_1.GHOSTMARKET_CHAIN_BY_NETWORK_TYPE[this.networkType] }, params), { arrayFormat: 'bracket' });
|
|
60
|
-
return `${constants_1.GHOSTMARKET_URL_BY_NETWORK_TYPE[this.networkType]}/assets?${parameters}`;
|
|
61
|
-
}
|
|
62
|
-
parse(data) {
|
|
63
|
-
var _a, _b;
|
|
64
|
-
const nftResponse = {
|
|
65
|
-
collectionImage: this.treatGhostMarketImage((_a = data.collection) === null || _a === void 0 ? void 0 : _a.logoUrl),
|
|
66
|
-
id: data.tokenId,
|
|
67
|
-
contractHash: data.contract.hash,
|
|
68
|
-
symbol: data.contract.symbol,
|
|
69
|
-
collectionName: (_b = data.collection) === null || _b === void 0 ? void 0 : _b.name,
|
|
70
|
-
image: this.treatGhostMarketImage(data.metadata.mediaUri),
|
|
71
|
-
isSVG: String(data.metadata.mediaType).includes('svg+xml'),
|
|
72
|
-
name: data.metadata.name,
|
|
73
|
-
};
|
|
74
|
-
return nftResponse;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.GhostMarketNDSEthereum = GhostMarketNDSEthereum;
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.GhostMarketNDSEthereum = void 0;
|
|
16
|
+
const query_string_1 = __importDefault(require("query-string"));
|
|
17
|
+
const constants_1 = require("./constants");
|
|
18
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
19
|
+
class GhostMarketNDSEthereum {
|
|
20
|
+
constructor(networkType) {
|
|
21
|
+
this.networkType = networkType;
|
|
22
|
+
}
|
|
23
|
+
getNftsByAddress({ address, size = 18, cursor, page }) {
|
|
24
|
+
var _a;
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const url = this.getUrlWithParams({
|
|
27
|
+
size,
|
|
28
|
+
owners: [address],
|
|
29
|
+
cursor: cursor,
|
|
30
|
+
});
|
|
31
|
+
const request = yield (0, node_fetch_1.default)(url, { method: 'GET' });
|
|
32
|
+
const data = (yield request.json());
|
|
33
|
+
const nfts = (_a = data.assets) !== null && _a !== void 0 ? _a : [];
|
|
34
|
+
return { nextCursor: data.next, items: nfts.map(this.parse.bind(this)) };
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
getNft({ contractHash, tokenId }) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const url = this.getUrlWithParams({
|
|
40
|
+
contract: contractHash,
|
|
41
|
+
tokenIds: [tokenId],
|
|
42
|
+
});
|
|
43
|
+
const request = yield (0, node_fetch_1.default)(url, { method: 'GET' });
|
|
44
|
+
const data = (yield request.json());
|
|
45
|
+
return this.parse(data.assets[0]);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
treatGhostMarketImage(srcImage) {
|
|
49
|
+
if (!srcImage) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (srcImage.startsWith('ipfs://')) {
|
|
53
|
+
const [, imageId] = srcImage.split('://');
|
|
54
|
+
return `https://ghostmarket.mypinata.cloud/ipfs/${imageId}`;
|
|
55
|
+
}
|
|
56
|
+
return srcImage;
|
|
57
|
+
}
|
|
58
|
+
getUrlWithParams(params) {
|
|
59
|
+
const parameters = query_string_1.default.stringify(Object.assign({ chain: constants_1.GHOSTMARKET_CHAIN_BY_NETWORK_TYPE[this.networkType] }, params), { arrayFormat: 'bracket' });
|
|
60
|
+
return `${constants_1.GHOSTMARKET_URL_BY_NETWORK_TYPE[this.networkType]}/assets?${parameters}`;
|
|
61
|
+
}
|
|
62
|
+
parse(data) {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
const nftResponse = {
|
|
65
|
+
collectionImage: this.treatGhostMarketImage((_a = data.collection) === null || _a === void 0 ? void 0 : _a.logoUrl),
|
|
66
|
+
id: data.tokenId,
|
|
67
|
+
contractHash: data.contract.hash,
|
|
68
|
+
symbol: data.contract.symbol,
|
|
69
|
+
collectionName: (_b = data.collection) === null || _b === void 0 ? void 0 : _b.name,
|
|
70
|
+
image: this.treatGhostMarketImage(data.metadata.mediaUri),
|
|
71
|
+
isSVG: String(data.metadata.mediaType).includes('svg+xml'),
|
|
72
|
+
name: data.metadata.name,
|
|
73
|
+
};
|
|
74
|
+
return nftResponse;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.GhostMarketNDSEthereum = GhostMarketNDSEthereum;
|
package/dist/RpcBDSEthereum.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { BalanceResponse, BlockchainDataService, ContractResponse, Network, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse } from '@cityofzion/blockchain-service';
|
|
2
|
-
export declare class RpcBDSEthereum implements BlockchainDataService {
|
|
3
|
-
private readonly network;
|
|
4
|
-
maxTimeToConfirmTransactionInMs: number;
|
|
5
|
-
constructor(network: Network);
|
|
6
|
-
getTransaction(hash: string): Promise<TransactionResponse>;
|
|
7
|
-
getTransactionsByAddress(_params: TransactionsByAddressParams): Promise<TransactionsByAddressResponse>;
|
|
8
|
-
getContract(): Promise<ContractResponse>;
|
|
9
|
-
getTokenInfo(hash: string): Promise<Token>;
|
|
10
|
-
getBalance(address: string): Promise<BalanceResponse[]>;
|
|
11
|
-
getBlockHeight(): Promise<number>;
|
|
12
|
-
}
|
|
1
|
+
import { BalanceResponse, BlockchainDataService, ContractResponse, Network, Token, TransactionResponse, TransactionsByAddressParams, TransactionsByAddressResponse } from '@cityofzion/blockchain-service';
|
|
2
|
+
export declare class RpcBDSEthereum implements BlockchainDataService {
|
|
3
|
+
private readonly network;
|
|
4
|
+
maxTimeToConfirmTransactionInMs: number;
|
|
5
|
+
constructor(network: Network);
|
|
6
|
+
getTransaction(hash: string): Promise<TransactionResponse>;
|
|
7
|
+
getTransactionsByAddress(_params: TransactionsByAddressParams): Promise<TransactionsByAddressResponse>;
|
|
8
|
+
getContract(): Promise<ContractResponse>;
|
|
9
|
+
getTokenInfo(hash: string): Promise<Token>;
|
|
10
|
+
getBalance(address: string): Promise<BalanceResponse[]>;
|
|
11
|
+
getBlockHeight(): Promise<number>;
|
|
12
|
+
}
|
package/dist/RpcBDSEthereum.js
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.RpcBDSEthereum = void 0;
|
|
13
|
-
const ethers_1 = require("ethers");
|
|
14
|
-
const constants_1 = require("./constants");
|
|
15
|
-
class RpcBDSEthereum {
|
|
16
|
-
constructor(network) {
|
|
17
|
-
this.maxTimeToConfirmTransactionInMs = 1000 * 60 * 5;
|
|
18
|
-
this.network = network;
|
|
19
|
-
}
|
|
20
|
-
getTransaction(hash) {
|
|
21
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const provider = new ethers_1.ethers.providers.JsonRpcProvider(this.network.url);
|
|
23
|
-
const transaction = yield provider.getTransaction(hash);
|
|
24
|
-
if (!transaction || !transaction.blockHash || !transaction.to)
|
|
25
|
-
throw new Error('Transaction not found');
|
|
26
|
-
const block = yield provider.getBlock(transaction.blockHash);
|
|
27
|
-
if (!block)
|
|
28
|
-
throw new Error('Block not found');
|
|
29
|
-
const tokens = constants_1.TOKENS[this.network.type];
|
|
30
|
-
const token = tokens.find(token => token.symbol === 'ETH');
|
|
31
|
-
return {
|
|
32
|
-
block: block.number,
|
|
33
|
-
time: block.timestamp,
|
|
34
|
-
hash: transaction.hash,
|
|
35
|
-
transfers: [
|
|
36
|
-
{
|
|
37
|
-
type: 'token',
|
|
38
|
-
amount: ethers_1.ethers.utils.formatEther(transaction.value),
|
|
39
|
-
contractHash: '-',
|
|
40
|
-
from: transaction.from,
|
|
41
|
-
to: transaction.to,
|
|
42
|
-
token,
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
notifications: [],
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
getTransactionsByAddress(_params) {
|
|
50
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
throw new Error("RPC doesn't support get transactions history of address");
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
getContract() {
|
|
55
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
throw new Error("RPC doesn't support contract info");
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
getTokenInfo(hash) {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const tokens = constants_1.TOKENS[this.network.type];
|
|
62
|
-
const token = tokens.find(token => token.hash === hash);
|
|
63
|
-
if (!token)
|
|
64
|
-
throw new Error('Token not found');
|
|
65
|
-
return token;
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
getBalance(address) {
|
|
69
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const provider = new ethers_1.ethers.providers.JsonRpcProvider(this.network.url);
|
|
71
|
-
const balance = yield provider.getBalance(address);
|
|
72
|
-
const tokens = constants_1.TOKENS[this.network.type];
|
|
73
|
-
const token = tokens.find(token => token.symbol === 'ETH');
|
|
74
|
-
return [
|
|
75
|
-
{
|
|
76
|
-
amount: ethers_1.ethers.utils.formatEther(balance),
|
|
77
|
-
token,
|
|
78
|
-
},
|
|
79
|
-
];
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
getBlockHeight() {
|
|
83
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
const provider = new ethers_1.ethers.providers.JsonRpcProvider(this.network.url);
|
|
85
|
-
return yield provider.getBlockNumber();
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
exports.RpcBDSEthereum = RpcBDSEthereum;
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RpcBDSEthereum = void 0;
|
|
13
|
+
const ethers_1 = require("ethers");
|
|
14
|
+
const constants_1 = require("./constants");
|
|
15
|
+
class RpcBDSEthereum {
|
|
16
|
+
constructor(network) {
|
|
17
|
+
this.maxTimeToConfirmTransactionInMs = 1000 * 60 * 5;
|
|
18
|
+
this.network = network;
|
|
19
|
+
}
|
|
20
|
+
getTransaction(hash) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const provider = new ethers_1.ethers.providers.JsonRpcProvider(this.network.url);
|
|
23
|
+
const transaction = yield provider.getTransaction(hash);
|
|
24
|
+
if (!transaction || !transaction.blockHash || !transaction.to)
|
|
25
|
+
throw new Error('Transaction not found');
|
|
26
|
+
const block = yield provider.getBlock(transaction.blockHash);
|
|
27
|
+
if (!block)
|
|
28
|
+
throw new Error('Block not found');
|
|
29
|
+
const tokens = constants_1.TOKENS[this.network.type];
|
|
30
|
+
const token = tokens.find(token => token.symbol === 'ETH');
|
|
31
|
+
return {
|
|
32
|
+
block: block.number,
|
|
33
|
+
time: block.timestamp,
|
|
34
|
+
hash: transaction.hash,
|
|
35
|
+
transfers: [
|
|
36
|
+
{
|
|
37
|
+
type: 'token',
|
|
38
|
+
amount: ethers_1.ethers.utils.formatEther(transaction.value),
|
|
39
|
+
contractHash: '-',
|
|
40
|
+
from: transaction.from,
|
|
41
|
+
to: transaction.to,
|
|
42
|
+
token,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
notifications: [],
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
getTransactionsByAddress(_params) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
throw new Error("RPC doesn't support get transactions history of address");
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
getContract() {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
throw new Error("RPC doesn't support contract info");
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
getTokenInfo(hash) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const tokens = constants_1.TOKENS[this.network.type];
|
|
62
|
+
const token = tokens.find(token => token.hash === hash);
|
|
63
|
+
if (!token)
|
|
64
|
+
throw new Error('Token not found');
|
|
65
|
+
return token;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
getBalance(address) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
const provider = new ethers_1.ethers.providers.JsonRpcProvider(this.network.url);
|
|
71
|
+
const balance = yield provider.getBalance(address);
|
|
72
|
+
const tokens = constants_1.TOKENS[this.network.type];
|
|
73
|
+
const token = tokens.find(token => token.symbol === 'ETH');
|
|
74
|
+
return [
|
|
75
|
+
{
|
|
76
|
+
amount: ethers_1.ethers.utils.formatEther(balance),
|
|
77
|
+
token,
|
|
78
|
+
},
|
|
79
|
+
];
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
getBlockHeight() {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
const provider = new ethers_1.ethers.providers.JsonRpcProvider(this.network.url);
|
|
85
|
+
return yield provider.getBlockNumber();
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.RpcBDSEthereum = RpcBDSEthereum;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"symbol": "ETH",
|
|
4
|
-
"name": "Ethereum",
|
|
5
|
-
"hash": "-",
|
|
6
|
-
"decimals": 16
|
|
7
|
-
}
|
|
8
|
-
]
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"symbol": "ETH",
|
|
4
|
+
"name": "Ethereum",
|
|
5
|
+
"hash": "-",
|
|
6
|
+
"decimals": 16
|
|
7
|
+
}
|
|
8
|
+
]
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { NetworkType, Token } from '@cityofzion/blockchain-service';
|
|
2
|
-
export type BitqueryNetwork = 'ethereum' | 'goerli';
|
|
3
|
-
export declare const TOKENS: Record<NetworkType, Token[]>;
|
|
4
|
-
export declare const NATIVE_ASSETS: {
|
|
5
|
-
symbol: string;
|
|
6
|
-
name: string;
|
|
7
|
-
hash: string;
|
|
8
|
-
decimals: number;
|
|
9
|
-
}[];
|
|
10
|
-
export declare const DEFAULT_URL_BY_NETWORK_TYPE: Record<NetworkType, string>;
|
|
11
|
-
export declare const BITQUERY_API_KEY = "BQYMp76Ny15C8ORbI2BOstFUhoMCahLI";
|
|
12
|
-
export declare const BITQUERY_URL = "https://graphql.bitquery.io";
|
|
13
|
-
export declare const BITQUERY_NETWORK_BY_NETWORK_TYPE: Record<Exclude<NetworkType, 'custom'>, BitqueryNetwork>;
|
|
14
|
-
export declare const GHOSTMARKET_URL_BY_NETWORK_TYPE: Partial<Record<NetworkType, string>>;
|
|
15
|
-
export declare const GHOSTMARKET_CHAIN_BY_NETWORK_TYPE: Partial<Record<NetworkType, string>>;
|
|
16
|
-
export declare const DERIVATION_PATH = "m/44'/60'/0'/0/?";
|
|
1
|
+
import { NetworkType, Token } from '@cityofzion/blockchain-service';
|
|
2
|
+
export type BitqueryNetwork = 'ethereum' | 'goerli';
|
|
3
|
+
export declare const TOKENS: Record<NetworkType, Token[]>;
|
|
4
|
+
export declare const NATIVE_ASSETS: {
|
|
5
|
+
symbol: string;
|
|
6
|
+
name: string;
|
|
7
|
+
hash: string;
|
|
8
|
+
decimals: number;
|
|
9
|
+
}[];
|
|
10
|
+
export declare const DEFAULT_URL_BY_NETWORK_TYPE: Record<NetworkType, string>;
|
|
11
|
+
export declare const BITQUERY_API_KEY = "BQYMp76Ny15C8ORbI2BOstFUhoMCahLI";
|
|
12
|
+
export declare const BITQUERY_URL = "https://graphql.bitquery.io";
|
|
13
|
+
export declare const BITQUERY_NETWORK_BY_NETWORK_TYPE: Record<Exclude<NetworkType, 'custom'>, BitqueryNetwork>;
|
|
14
|
+
export declare const GHOSTMARKET_URL_BY_NETWORK_TYPE: Partial<Record<NetworkType, string>>;
|
|
15
|
+
export declare const GHOSTMARKET_CHAIN_BY_NETWORK_TYPE: Partial<Record<NetworkType, string>>;
|
|
16
|
+
export declare const DERIVATION_PATH = "m/44'/60'/0'/0/?";
|
package/dist/constants.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
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.DERIVATION_PATH = exports.GHOSTMARKET_CHAIN_BY_NETWORK_TYPE = exports.GHOSTMARKET_URL_BY_NETWORK_TYPE = exports.BITQUERY_NETWORK_BY_NETWORK_TYPE = exports.BITQUERY_URL = exports.BITQUERY_API_KEY = exports.DEFAULT_URL_BY_NETWORK_TYPE = exports.NATIVE_ASSETS = exports.TOKENS = void 0;
|
|
7
|
-
const common_json_1 = __importDefault(require("./assets/tokens/common.json"));
|
|
8
|
-
exports.TOKENS = {
|
|
9
|
-
mainnet: [...common_json_1.default],
|
|
10
|
-
testnet: common_json_1.default,
|
|
11
|
-
custom: common_json_1.default,
|
|
12
|
-
};
|
|
13
|
-
exports.NATIVE_ASSETS = common_json_1.default;
|
|
14
|
-
exports.DEFAULT_URL_BY_NETWORK_TYPE = {
|
|
15
|
-
mainnet: 'https://ethereum-mainnet-rpc.allthatnode.com',
|
|
16
|
-
testnet: 'https://ethereum-goerli-rpc.allthatnode.com',
|
|
17
|
-
custom: 'http://127.0.0.1:8545',
|
|
18
|
-
};
|
|
19
|
-
exports.BITQUERY_API_KEY = 'BQYMp76Ny15C8ORbI2BOstFUhoMCahLI';
|
|
20
|
-
exports.BITQUERY_URL = 'https://graphql.bitquery.io';
|
|
21
|
-
exports.BITQUERY_NETWORK_BY_NETWORK_TYPE = {
|
|
22
|
-
mainnet: 'ethereum',
|
|
23
|
-
testnet: 'goerli',
|
|
24
|
-
};
|
|
25
|
-
exports.GHOSTMARKET_URL_BY_NETWORK_TYPE = {
|
|
26
|
-
mainnet: 'https://api.ghostmarket.io/api/v2',
|
|
27
|
-
testnet: 'https://api-testnet.ghostmarket.io/api/v2',
|
|
28
|
-
};
|
|
29
|
-
exports.GHOSTMARKET_CHAIN_BY_NETWORK_TYPE = {
|
|
30
|
-
mainnet: 'eth',
|
|
31
|
-
testnet: 'etht',
|
|
32
|
-
};
|
|
33
|
-
exports.DERIVATION_PATH = "m/44'/60'/0'/0/?";
|
|
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.DERIVATION_PATH = exports.GHOSTMARKET_CHAIN_BY_NETWORK_TYPE = exports.GHOSTMARKET_URL_BY_NETWORK_TYPE = exports.BITQUERY_NETWORK_BY_NETWORK_TYPE = exports.BITQUERY_URL = exports.BITQUERY_API_KEY = exports.DEFAULT_URL_BY_NETWORK_TYPE = exports.NATIVE_ASSETS = exports.TOKENS = void 0;
|
|
7
|
+
const common_json_1 = __importDefault(require("./assets/tokens/common.json"));
|
|
8
|
+
exports.TOKENS = {
|
|
9
|
+
mainnet: [...common_json_1.default],
|
|
10
|
+
testnet: common_json_1.default,
|
|
11
|
+
custom: common_json_1.default,
|
|
12
|
+
};
|
|
13
|
+
exports.NATIVE_ASSETS = common_json_1.default;
|
|
14
|
+
exports.DEFAULT_URL_BY_NETWORK_TYPE = {
|
|
15
|
+
mainnet: 'https://ethereum-mainnet-rpc.allthatnode.com',
|
|
16
|
+
testnet: 'https://ethereum-goerli-rpc.allthatnode.com',
|
|
17
|
+
custom: 'http://127.0.0.1:8545',
|
|
18
|
+
};
|
|
19
|
+
exports.BITQUERY_API_KEY = 'BQYMp76Ny15C8ORbI2BOstFUhoMCahLI';
|
|
20
|
+
exports.BITQUERY_URL = 'https://graphql.bitquery.io';
|
|
21
|
+
exports.BITQUERY_NETWORK_BY_NETWORK_TYPE = {
|
|
22
|
+
mainnet: 'ethereum',
|
|
23
|
+
testnet: 'goerli',
|
|
24
|
+
};
|
|
25
|
+
exports.GHOSTMARKET_URL_BY_NETWORK_TYPE = {
|
|
26
|
+
mainnet: 'https://api.ghostmarket.io/api/v2',
|
|
27
|
+
testnet: 'https://api-testnet.ghostmarket.io/api/v2',
|
|
28
|
+
};
|
|
29
|
+
exports.GHOSTMARKET_CHAIN_BY_NETWORK_TYPE = {
|
|
30
|
+
mainnet: 'eth',
|
|
31
|
+
testnet: 'etht',
|
|
32
|
+
};
|
|
33
|
+
exports.DERIVATION_PATH = "m/44'/60'/0'/0/?";
|