@cityofzion/bs-ethereum 1.2.0 → 1.2.1

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.
@@ -2,7 +2,6 @@ import { Account, AccountWithDerivationPath, BSCalculableFee, BSWithLedger, BSWi
2
2
  import { LedgerServiceEthereum } from './LedgerServiceEthereum';
3
3
  import Transport from '@ledgerhq/hw-transport';
4
4
  export declare class BSEthereum<BSCustomName extends string = string> implements BlockchainService, BSWithNft, BSWithNameService, BSCalculableFee, BSWithLedger {
5
- #private;
6
5
  readonly blockchainName: BSCustomName;
7
6
  readonly feeToken: Token;
8
7
  readonly derivationPath: string;
@@ -12,7 +11,7 @@ export declare class BSEthereum<BSCustomName extends string = string> implements
12
11
  tokens: Token[];
13
12
  nftDataService: NftDataService;
14
13
  network: Network;
15
- constructor(blockchainName: BSCustomName, network: PartialBy<Network, 'url'>, bitqueryApiKey: string, getLedgerTransport?: (account: Account) => Promise<Transport>);
14
+ constructor(blockchainName: BSCustomName, network: PartialBy<Network, 'url'>, getLedgerTransport?: (account: Account) => Promise<Transport>);
16
15
  setNetwork(param: PartialBy<Network, 'url'>): void;
17
16
  validateAddress(address: string): boolean;
18
17
  validateEncrypted(json: string): boolean;
@@ -31,18 +31,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
31
31
  step((generator = generator.apply(thisArg, _arguments || [])).next());
32
32
  });
33
33
  };
34
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
35
- if (kind === "m") throw new TypeError("Private method is not writable");
36
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
37
- 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");
38
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
39
- };
40
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
41
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
42
- 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");
43
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
44
- };
45
- var _BSEthereum_bitqueryApiKey;
46
34
  Object.defineProperty(exports, "__esModule", { value: true });
47
35
  exports.BSEthereum = void 0;
48
36
  const ethers_1 = require("ethers");
@@ -56,13 +44,11 @@ const RpcBDSEthereum_1 = require("./RpcBDSEthereum");
56
44
  const BitqueryBDSEthereum_1 = require("./BitqueryBDSEthereum");
57
45
  const LedgerServiceEthereum_1 = require("./LedgerServiceEthereum");
58
46
  class BSEthereum {
59
- constructor(blockchainName, network, bitqueryApiKey, getLedgerTransport) {
60
- _BSEthereum_bitqueryApiKey.set(this, void 0);
47
+ constructor(blockchainName, network, getLedgerTransport) {
61
48
  this.blockchainName = blockchainName;
62
49
  this.ledgerService = new LedgerServiceEthereum_1.LedgerServiceEthereum(getLedgerTransport);
63
50
  this.derivationPath = constants_1.DERIVATION_PATH;
64
51
  this.tokens = constants_1.TOKENS[network.type];
65
- __classPrivateFieldSet(this, _BSEthereum_bitqueryApiKey, bitqueryApiKey, "f");
66
52
  this.feeToken = this.tokens.find(token => token.symbol === 'ETH');
67
53
  this.setNetwork(network);
68
54
  }
@@ -77,9 +63,9 @@ class BSEthereum {
77
63
  this.blockchainDataService = new RpcBDSEthereum_1.RpcBDSEthereum(network);
78
64
  }
79
65
  else {
80
- this.blockchainDataService = new BitqueryBDSEthereum_1.BitqueryBDSEthereum(network, __classPrivateFieldGet(this, _BSEthereum_bitqueryApiKey, "f"));
66
+ this.blockchainDataService = new BitqueryBDSEthereum_1.BitqueryBDSEthereum(network);
81
67
  }
82
- this.exchangeDataService = new BitqueryEDSEthereum_1.BitqueryEDSEthereum(network.type, __classPrivateFieldGet(this, _BSEthereum_bitqueryApiKey, "f"));
68
+ this.exchangeDataService = new BitqueryEDSEthereum_1.BitqueryEDSEthereum(network.type);
83
69
  this.nftDataService = new GhostMarketNDSEthereum_1.GhostMarketNDSEthereum(network.type);
84
70
  }
85
71
  validateAddress(address) {
@@ -217,4 +203,3 @@ class BSEthereum {
217
203
  }
218
204
  }
219
205
  exports.BSEthereum = BSEthereum;
220
- _BSEthereum_bitqueryApiKey = new WeakMap();
@@ -3,7 +3,7 @@ import { RpcBDSEthereum } from './RpcBDSEthereum';
3
3
  export declare class BitqueryBDSEthereum extends RpcBDSEthereum {
4
4
  #private;
5
5
  maxTimeToConfirmTransactionInMs: number;
6
- constructor(network: Network, apiKey: string);
6
+ constructor(network: Network);
7
7
  getTransaction(hash: string): Promise<TransactionResponse>;
8
8
  getTransactionsByAddress({ address, page, }: TransactionsByAddressParams): Promise<TransactionsByAddressResponse>;
9
9
  getContract(): Promise<ContractResponse>;
@@ -25,13 +25,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
25
25
  var _BitqueryBDSEthereum_client, _BitqueryBDSEthereum_networkType;
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.BitqueryBDSEthereum = void 0;
28
- const core_1 = require("@urql/core");
29
- const node_fetch_1 = __importDefault(require("node-fetch"));
30
28
  const constants_1 = require("./constants");
31
- const graphql_1 = require("./graphql");
32
29
  const RpcBDSEthereum_1 = require("./RpcBDSEthereum");
30
+ const axios_1 = __importDefault(require("axios"));
33
31
  class BitqueryBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
34
- constructor(network, apiKey) {
32
+ constructor(network) {
35
33
  super(network);
36
34
  _BitqueryBDSEthereum_client.set(this, void 0);
37
35
  _BitqueryBDSEthereum_networkType.set(this, void 0);
@@ -39,27 +37,15 @@ class BitqueryBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
39
37
  if (network.type === 'custom')
40
38
  throw new Error('Custom network not supported');
41
39
  __classPrivateFieldSet(this, _BitqueryBDSEthereum_networkType, network.type, "f");
42
- __classPrivateFieldSet(this, _BitqueryBDSEthereum_client, new core_1.Client({
43
- url: constants_1.BITQUERY_URL,
44
- exchanges: [core_1.fetchExchange],
45
- fetch: node_fetch_1.default,
46
- fetchOptions: {
47
- headers: {
48
- 'X-API-KEY': apiKey,
49
- },
50
- },
40
+ __classPrivateFieldSet(this, _BitqueryBDSEthereum_client, axios_1.default.create({
41
+ baseURL: constants_1.BITQUERY_MIRROR_URL,
51
42
  }), "f");
52
43
  }
53
44
  getTransaction(hash) {
54
45
  return __awaiter(this, void 0, void 0, function* () {
55
- const result = yield __classPrivateFieldGet(this, _BitqueryBDSEthereum_client, "f")
56
- .query(graphql_1.bitqueryGetTransactionQuery, {
57
- hash,
58
- network: constants_1.BITQUERY_NETWORK_BY_NETWORK_TYPE[__classPrivateFieldGet(this, _BitqueryBDSEthereum_networkType, "f")],
59
- })
60
- .toPromise();
61
- if (result.error)
62
- throw new Error(result.error.message);
46
+ const result = yield __classPrivateFieldGet(this, _BitqueryBDSEthereum_client, "f").get(`/get-transaction/${hash}`, {
47
+ params: { network: constants_1.BITQUERY_MIRROR_NETWORK_BY_NETWORK_TYPE[__classPrivateFieldGet(this, _BitqueryBDSEthereum_networkType, "f")] },
48
+ });
63
49
  if (!result.data || !result.data.ethereum.transfers.length)
64
50
  throw new Error('Transaction not found');
65
51
  const transfers = result.data.ethereum.transfers.map(this.parseTransactionTransfer);
@@ -79,16 +65,9 @@ class BitqueryBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
79
65
  return __awaiter(this, void 0, void 0, function* () {
80
66
  const limit = 10;
81
67
  const offset = limit * (page - 1);
82
- const result = yield __classPrivateFieldGet(this, _BitqueryBDSEthereum_client, "f")
83
- .query(graphql_1.bitqueryGetTransactionsByAddressQuery, {
84
- address,
85
- limit,
86
- offset,
87
- network: constants_1.BITQUERY_NETWORK_BY_NETWORK_TYPE[__classPrivateFieldGet(this, _BitqueryBDSEthereum_networkType, "f")],
88
- })
89
- .toPromise();
90
- if (result.error)
91
- throw new Error(result.error.message);
68
+ const result = yield __classPrivateFieldGet(this, _BitqueryBDSEthereum_client, "f").get(`/get-transactions/${address}`, {
69
+ params: { network: constants_1.BITQUERY_MIRROR_NETWORK_BY_NETWORK_TYPE[__classPrivateFieldGet(this, _BitqueryBDSEthereum_networkType, "f")], limit, offset },
70
+ });
92
71
  if (!result.data)
93
72
  throw new Error('Address does not have transactions');
94
73
  const totalCount = ((_a = result.data.ethereum.sentCount[0].count) !== null && _a !== void 0 ? _a : 0) + ((_b = result.data.ethereum.receiverCount[0].count) !== null && _b !== void 0 ? _b : 0);
@@ -127,14 +106,9 @@ class BitqueryBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
127
106
  const localToken = constants_1.TOKENS[__classPrivateFieldGet(this, _BitqueryBDSEthereum_networkType, "f")].find(token => token.hash === hash);
128
107
  if (localToken)
129
108
  return localToken;
130
- const result = yield __classPrivateFieldGet(this, _BitqueryBDSEthereum_client, "f")
131
- .query(graphql_1.bitqueryGetTokenInfoQuery, {
132
- hash,
133
- network: constants_1.BITQUERY_NETWORK_BY_NETWORK_TYPE[__classPrivateFieldGet(this, _BitqueryBDSEthereum_networkType, "f")],
134
- })
135
- .toPromise();
136
- if (result.error)
137
- throw new Error(result.error.message);
109
+ const result = yield __classPrivateFieldGet(this, _BitqueryBDSEthereum_client, "f").get(`/get-token-info/${hash}`, {
110
+ params: { network: constants_1.BITQUERY_MIRROR_NETWORK_BY_NETWORK_TYPE[__classPrivateFieldGet(this, _BitqueryBDSEthereum_networkType, "f")] },
111
+ });
138
112
  if (!result.data || result.data.ethereum.smartContractCalls.length <= 0)
139
113
  throw new Error('Token not found');
140
114
  const { address: { address }, currency: { decimals, name, symbol, tokenType }, } = result.data.ethereum.smartContractCalls[0].smartContract;
@@ -151,14 +125,9 @@ class BitqueryBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
151
125
  getBalance(address) {
152
126
  var _a, _b, _c, _d;
153
127
  return __awaiter(this, void 0, void 0, function* () {
154
- const result = yield __classPrivateFieldGet(this, _BitqueryBDSEthereum_client, "f")
155
- .query(graphql_1.bitqueryGetBalanceQuery, {
156
- address,
157
- network: constants_1.BITQUERY_NETWORK_BY_NETWORK_TYPE[__classPrivateFieldGet(this, _BitqueryBDSEthereum_networkType, "f")],
158
- })
159
- .toPromise();
160
- if (result.error)
161
- throw new Error(result.error.message);
128
+ const result = yield __classPrivateFieldGet(this, _BitqueryBDSEthereum_client, "f").get(`/get-balance/${address}`, {
129
+ params: { network: constants_1.BITQUERY_MIRROR_NETWORK_BY_NETWORK_TYPE[__classPrivateFieldGet(this, _BitqueryBDSEthereum_networkType, "f")] },
130
+ });
162
131
  const data = (_b = (_a = result.data) === null || _a === void 0 ? void 0 : _a.ethereum.address[0].balances) !== null && _b !== void 0 ? _b : [];
163
132
  const ethBalance = (_d = (_c = result.data) === null || _c === void 0 ? void 0 : _c.ethereum.address[0].balance) !== null && _d !== void 0 ? _d : 0;
164
133
  const ethToken = constants_1.NATIVE_ASSETS.find(asset => asset.symbol === 'ETH');
@@ -1,7 +1,7 @@
1
1
  import { Currency, ExchangeDataService, NetworkType, TokenPricesResponse } from '@cityofzion/blockchain-service';
2
2
  export declare class BitqueryEDSEthereum implements ExchangeDataService {
3
3
  #private;
4
- constructor(networkType: NetworkType, apiKey: string);
4
+ constructor(networkType: NetworkType);
5
5
  getTokenPrices(currency: Currency): Promise<TokenPricesResponse[]>;
6
6
  private getCurrencyRatio;
7
7
  }
@@ -25,27 +25,18 @@ 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 core_1 = require("@urql/core");
29
- const node_fetch_1 = __importDefault(require("node-fetch"));
30
- const constants_1 = require("./constants");
28
+ const axios_1 = __importDefault(require("axios"));
31
29
  const dayjs_1 = __importDefault(require("dayjs"));
32
30
  const utc_1 = __importDefault(require("dayjs/plugin/utc"));
33
- const graphql_1 = require("./graphql");
31
+ const constants_1 = require("./constants");
34
32
  dayjs_1.default.extend(utc_1.default);
35
33
  class BitqueryEDSEthereum {
36
- constructor(networkType, apiKey) {
34
+ constructor(networkType) {
37
35
  _BitqueryEDSEthereum_client.set(this, void 0);
38
36
  _BitqueryEDSEthereum_networkType.set(this, void 0);
39
37
  __classPrivateFieldSet(this, _BitqueryEDSEthereum_networkType, networkType, "f");
40
- __classPrivateFieldSet(this, _BitqueryEDSEthereum_client, new core_1.Client({
41
- url: constants_1.BITQUERY_URL,
42
- exchanges: [core_1.fetchExchange],
43
- fetch: node_fetch_1.default,
44
- fetchOptions: {
45
- headers: {
46
- 'X-API-KEY': apiKey,
47
- },
48
- },
38
+ __classPrivateFieldSet(this, _BitqueryEDSEthereum_client, axios_1.default.create({
39
+ baseURL: constants_1.BITQUERY_MIRROR_URL,
49
40
  }), "f");
50
41
  }
51
42
  getTokenPrices(currency) {
@@ -53,12 +44,9 @@ class BitqueryEDSEthereum {
53
44
  if (__classPrivateFieldGet(this, _BitqueryEDSEthereum_networkType, "f") !== 'mainnet')
54
45
  throw new Error('Exchange is only available on mainnet');
55
46
  const twoDaysAgo = dayjs_1.default.utc().subtract(2, 'day').startOf('date').toISOString();
56
- const result = yield __classPrivateFieldGet(this, _BitqueryEDSEthereum_client, "f")
57
- .query(graphql_1.bitqueryGetPricesQuery, { after: twoDaysAgo, network: 'ethereum' })
58
- .toPromise();
59
- if (result.error) {
60
- throw new Error(result.error.message);
61
- }
47
+ const result = yield __classPrivateFieldGet(this, _BitqueryEDSEthereum_client, "f").get(`/get-price`, {
48
+ params: { network: constants_1.BITQUERY_MIRROR_NETWORK_BY_NETWORK_TYPE[__classPrivateFieldGet(this, _BitqueryEDSEthereum_networkType, "f")], after: twoDaysAgo },
49
+ });
62
50
  if (!result.data) {
63
51
  throw new Error('There is no price data');
64
52
  }
@@ -76,10 +64,7 @@ class BitqueryEDSEthereum {
76
64
  }
77
65
  getCurrencyRatio(currency) {
78
66
  return __awaiter(this, void 0, void 0, function* () {
79
- const request = yield (0, node_fetch_1.default)(`https://api.flamingo.finance/fiat/exchange-rate?pair=USD_${currency}`, {
80
- method: 'GET',
81
- });
82
- const data = yield request.json();
67
+ const { data } = yield axios_1.default.get(`https://api.flamingo.finance/fiat/exchange-rate?pair=USD_${currency}`);
83
68
  return data;
84
69
  });
85
70
  }
@@ -26,8 +26,8 @@ var _GhostMarketNDSEthereum_networkType;
26
26
  Object.defineProperty(exports, "__esModule", { value: true });
27
27
  exports.GhostMarketNDSEthereum = void 0;
28
28
  const query_string_1 = __importDefault(require("query-string"));
29
+ const axios_1 = __importDefault(require("axios"));
29
30
  const constants_1 = require("./constants");
30
- const node_fetch_1 = __importDefault(require("node-fetch"));
31
31
  class GhostMarketNDSEthereum {
32
32
  constructor(networkType) {
33
33
  _GhostMarketNDSEthereum_networkType.set(this, void 0);
@@ -41,10 +41,9 @@ class GhostMarketNDSEthereum {
41
41
  owners: [address],
42
42
  cursor: cursor,
43
43
  });
44
- const request = yield (0, node_fetch_1.default)(url, { method: 'GET' });
45
- const data = (yield request.json());
46
- const nfts = (_a = data.assets) !== null && _a !== void 0 ? _a : [];
47
- return { nextCursor: data.next, items: nfts.map(this.parse.bind(this)) };
44
+ const request = yield axios_1.default.get(url);
45
+ const nfts = (_a = request.data.assets) !== null && _a !== void 0 ? _a : [];
46
+ return { nextCursor: request.data.next, items: nfts.map(this.parse.bind(this)) };
48
47
  });
49
48
  }
50
49
  getNft({ contractHash, tokenId }) {
@@ -53,9 +52,8 @@ class GhostMarketNDSEthereum {
53
52
  contract: contractHash,
54
53
  tokenIds: [tokenId],
55
54
  });
56
- const request = yield (0, node_fetch_1.default)(url, { method: 'GET' });
57
- const data = (yield request.json());
58
- return this.parse(data.assets[0]);
55
+ const request = yield axios_1.default.get(url);
56
+ return this.parse(request.data.assets[0]);
59
57
  });
60
58
  }
61
59
  treatGhostMarketImage(srcImage) {
@@ -8,8 +8,8 @@ export declare const NATIVE_ASSETS: {
8
8
  decimals: number;
9
9
  }[];
10
10
  export declare const DEFAULT_URL_BY_NETWORK_TYPE: Record<NetworkType, string>;
11
- export declare const BITQUERY_URL = "https://graphql.bitquery.io";
12
- export declare const BITQUERY_NETWORK_BY_NETWORK_TYPE: Record<Exclude<NetworkType, 'custom'>, BitqueryNetwork>;
11
+ export declare const BITQUERY_MIRROR_URL = "https://i4l7kcg43c.execute-api.us-east-1.amazonaws.com/production/";
12
+ export declare const BITQUERY_MIRROR_NETWORK_BY_NETWORK_TYPE: Record<Exclude<NetworkType, 'custom'>, BitqueryNetwork>;
13
13
  export declare const GHOSTMARKET_URL_BY_NETWORK_TYPE: Partial<Record<NetworkType, string>>;
14
14
  export declare const GHOSTMARKET_CHAIN_BY_NETWORK_TYPE: Partial<Record<NetworkType, string>>;
15
15
  export declare const DERIVATION_PATH = "m/44'/60'/0'/0/?";
package/dist/constants.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
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.DEFAULT_URL_BY_NETWORK_TYPE = exports.NATIVE_ASSETS = exports.TOKENS = void 0;
6
+ exports.DERIVATION_PATH = exports.GHOSTMARKET_CHAIN_BY_NETWORK_TYPE = exports.GHOSTMARKET_URL_BY_NETWORK_TYPE = exports.BITQUERY_MIRROR_NETWORK_BY_NETWORK_TYPE = exports.BITQUERY_MIRROR_URL = exports.DEFAULT_URL_BY_NETWORK_TYPE = exports.NATIVE_ASSETS = exports.TOKENS = void 0;
7
7
  const common_json_1 = __importDefault(require("./assets/tokens/common.json"));
8
8
  exports.TOKENS = {
9
9
  mainnet: [...common_json_1.default],
@@ -16,8 +16,8 @@ exports.DEFAULT_URL_BY_NETWORK_TYPE = {
16
16
  testnet: 'https://ethereum-sepolia-rpc.publicnode.com',
17
17
  custom: 'http://127.0.0.1:8545',
18
18
  };
19
- exports.BITQUERY_URL = 'https://graphql.bitquery.io';
20
- exports.BITQUERY_NETWORK_BY_NETWORK_TYPE = {
19
+ exports.BITQUERY_MIRROR_URL = 'https://i4l7kcg43c.execute-api.us-east-1.amazonaws.com/production/';
20
+ exports.BITQUERY_MIRROR_NETWORK_BY_NETWORK_TYPE = {
21
21
  mainnet: 'ethereum',
22
22
  testnet: 'goerli',
23
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/bs-ethereum",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": "https://github.com/CityOfZion/blockchain-services",
@@ -10,10 +10,9 @@
10
10
  "/dist"
11
11
  ],
12
12
  "dependencies": {
13
+ "axios": "1.5.1",
13
14
  "ethers": "5.7.2",
14
- "@urql/core": "~4.1.1",
15
15
  "graphql": "~16.8.0",
16
- "node-fetch": "2.6.4",
17
16
  "dayjs": "~1.11.9",
18
17
  "query-string": "7.1.3",
19
18
  "@ethersproject/json-wallets": "5.7.0",
@@ -26,7 +25,6 @@
26
25
  },
27
26
  "devDependencies": {
28
27
  "@types/jest": "29.5.3",
29
- "@types/node-fetch": "2.6.4",
30
28
  "@typescript-eslint/eslint-plugin": "^6.5.0",
31
29
  "@typescript-eslint/parser": "^6.5.0",
32
30
  "dotenv": "16.3.1",
package/dist/graphql.d.ts DELETED
@@ -1,124 +0,0 @@
1
- type BitqueryNetwork = 'ethereum' | 'goerli';
2
- export type BitqueryTransaction = {
3
- block: {
4
- timestamp: {
5
- unixtime: number;
6
- };
7
- height: number;
8
- };
9
- transaction: {
10
- gasValue: number;
11
- hash: string;
12
- };
13
- amount: number;
14
- currency: {
15
- address: string;
16
- tokenType: string;
17
- decimals: number;
18
- symbol: string;
19
- name: string;
20
- };
21
- sender: {
22
- address: string;
23
- };
24
- receiver: {
25
- address: string;
26
- };
27
- entityId: string;
28
- };
29
- type BitQueryGetTransactionsByAddressResponse = {
30
- ethereum: {
31
- sent: BitqueryTransaction[];
32
- received: BitqueryTransaction[];
33
- sentCount: {
34
- count: number;
35
- }[];
36
- receiverCount: {
37
- count: number;
38
- }[];
39
- };
40
- };
41
- type BitQueryGetTransactionsByAddressVariables = {
42
- address: string;
43
- limit: number;
44
- offset: number;
45
- network: BitqueryNetwork;
46
- };
47
- export declare const bitqueryGetTransactionsByAddressQuery: import("@urql/core/dist/urql-core-chunk").TypedDocumentNode<BitQueryGetTransactionsByAddressResponse, BitQueryGetTransactionsByAddressVariables>;
48
- type BitQueryGetTransactionResponse = {
49
- ethereum: {
50
- transfers: BitqueryTransaction[];
51
- };
52
- };
53
- type BitQueryGetTransactionVariables = {
54
- hash: string;
55
- network: BitqueryNetwork;
56
- };
57
- export declare const bitqueryGetTransactionQuery: import("@urql/core/dist/urql-core-chunk").TypedDocumentNode<BitQueryGetTransactionResponse, BitQueryGetTransactionVariables>;
58
- type BitQueryGetContractResponse = {
59
- ethereum: {
60
- smartContractCalls: {
61
- smartContract: {
62
- address: {
63
- address: string;
64
- };
65
- currency: {
66
- symbol: string;
67
- name: string;
68
- decimals: number;
69
- tokenType: string;
70
- };
71
- };
72
- }[];
73
- };
74
- };
75
- type BitQueryGetTokenInfoVariables = {
76
- hash: string;
77
- network: BitqueryNetwork;
78
- };
79
- export declare const bitqueryGetTokenInfoQuery: import("@urql/core/dist/urql-core-chunk").TypedDocumentNode<BitQueryGetContractResponse, BitQueryGetTokenInfoVariables>;
80
- type BitQueryGetBalanceResponse = {
81
- ethereum: {
82
- address: {
83
- balance: number;
84
- balances: {
85
- currency: {
86
- address: string;
87
- symbol: string;
88
- name: string;
89
- decimals: number;
90
- };
91
- value: number;
92
- }[] | null;
93
- }[];
94
- };
95
- };
96
- type BitQueryGetBalanceVariables = {
97
- address: string;
98
- network: BitqueryNetwork;
99
- };
100
- export declare const bitqueryGetBalanceQuery: import("@urql/core/dist/urql-core-chunk").TypedDocumentNode<BitQueryGetBalanceResponse, BitQueryGetBalanceVariables>;
101
- type BitQueryGetTokenPricesResponse = {
102
- ethereum: {
103
- dexTrades: {
104
- baseCurrency: {
105
- address: string;
106
- symbol: string;
107
- };
108
- quoteCurrency: {
109
- address: string;
110
- symbol: string;
111
- };
112
- date: {
113
- date: string;
114
- };
115
- quotePrice: number;
116
- }[];
117
- };
118
- };
119
- export type BitQueryGetTokenPricesVariables = {
120
- after: string;
121
- network: BitqueryNetwork;
122
- };
123
- export declare const bitqueryGetPricesQuery: import("@urql/core/dist/urql-core-chunk").TypedDocumentNode<BitQueryGetTokenPricesResponse, BitQueryGetTokenPricesVariables>;
124
- export {};
package/dist/graphql.js DELETED
@@ -1,160 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bitqueryGetPricesQuery = exports.bitqueryGetBalanceQuery = exports.bitqueryGetTokenInfoQuery = exports.bitqueryGetTransactionQuery = exports.bitqueryGetTransactionsByAddressQuery = void 0;
4
- const core_1 = require("@urql/core");
5
- exports.bitqueryGetTransactionsByAddressQuery = (0, core_1.gql) `
6
- query getTransactions($address: String!, $limit: Int!, $offset: Int!, $network: EthereumNetwork!) {
7
- ethereum(network: $network) {
8
- sent: transfers(
9
- options: { limit: $limit, offset: $offset, desc: "block.timestamp.unixtime" }
10
- sender: { is: $address }
11
- ) {
12
- block {
13
- timestamp {
14
- unixtime
15
- }
16
- height
17
- }
18
- amount
19
- currency {
20
- address
21
- tokenType
22
- symbol
23
- decimals
24
- name
25
- }
26
- sender {
27
- address
28
- }
29
- receiver {
30
- address
31
- }
32
- transaction {
33
- gasValue
34
- hash
35
- }
36
- entityId
37
- }
38
- received: transfers(
39
- options: { limit: $limit, offset: $offset, desc: "block.timestamp.unixtime" }
40
- receiver: { is: $address }
41
- ) {
42
- block {
43
- timestamp {
44
- unixtime
45
- }
46
- height
47
- }
48
- amount
49
- currency {
50
- address
51
- tokenType
52
- }
53
- sender {
54
- address
55
- }
56
- receiver {
57
- address
58
- }
59
- transaction {
60
- gasValue
61
- hash
62
- }
63
- entityId
64
- }
65
- sentCount: transfers(sender: { is: $address }) {
66
- count
67
- }
68
- receiverCount: transfers(receiver: { is: $address }) {
69
- count
70
- }
71
- }
72
- }
73
- `;
74
- exports.bitqueryGetTransactionQuery = (0, core_1.gql) `
75
- query getTransaction($hash: String!, $network: EthereumNetwork!) {
76
- ethereum(network: $network) {
77
- transfers(txHash: { is: $hash }) {
78
- block {
79
- timestamp {
80
- unixtime
81
- }
82
- height
83
- }
84
- amount
85
- currency {
86
- address
87
- tokenType
88
- }
89
- sender {
90
- address
91
- }
92
- receiver {
93
- address
94
- }
95
- transaction {
96
- gasValue
97
- hash
98
- }
99
- entityId
100
- }
101
- }
102
- }
103
- `;
104
- exports.bitqueryGetTokenInfoQuery = (0, core_1.gql) `
105
- query getTokenInfo($hash: String!, $network: EthereumNetwork!) {
106
- ethereum(network: $network) {
107
- smartContractCalls(smartContractAddress: { is: $hash }, options: { limit: 1 }) {
108
- smartContract {
109
- address {
110
- address
111
- }
112
- currency {
113
- symbol
114
- name
115
- decimals
116
- tokenType
117
- }
118
- }
119
- }
120
- }
121
- }
122
- `;
123
- exports.bitqueryGetBalanceQuery = (0, core_1.gql) `
124
- query getBalance($address: String!, $network: EthereumNetwork!) {
125
- ethereum(network: $network) {
126
- address(address: { is: $address }) {
127
- balance
128
- balances {
129
- currency {
130
- address
131
- symbol
132
- name
133
- decimals
134
- }
135
- value
136
- }
137
- }
138
- }
139
- }
140
- `;
141
- exports.bitqueryGetPricesQuery = (0, core_1.gql) `
142
- query getPrice($after: ISO8601DateTime!, $network: EthereumNetwork!) {
143
- ethereum(network: $network) {
144
- dexTrades(options: { desc: "date.date" }, time: { after: $after }) {
145
- quoteCurrency(quoteCurrency: { is: "0xdac17f958d2ee523a2206206994597c13d831ec7" }) {
146
- symbol
147
- address
148
- }
149
- baseCurrency {
150
- symbol
151
- address
152
- }
153
- date {
154
- date
155
- }
156
- quotePrice
157
- }
158
- }
159
- }
160
- `;