@cityofzion/bs-ethereum 0.7.1 → 0.7.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.
@@ -2,23 +2,23 @@
2
2
  "files": {
3
3
  "packages/bs-ethereum/jest.config.ts": "d944475db93cbe41a9339187fd94b9962e411c43",
4
4
  "packages/bs-ethereum/jest.setup.ts": "9a1976a32050616d4d2ee95b1aa21041bc4daca3",
5
- "packages/bs-ethereum/package.json": "bc413e80daf25edafffbc30138ce3900d4bcfa5c",
5
+ "packages/bs-ethereum/package.json": "00abfb87cbc8ce01504511abff875edec226e059",
6
6
  "packages/bs-ethereum/src/BSEthereum.ts": "ea8070202977445b77ff67135f7fc7093f0ed2b9",
7
- "packages/bs-ethereum/src/BitqueryBDSEthereum.ts": "811c83c0610f64e44318ea8edce5ac9d1390ebc4",
8
- "packages/bs-ethereum/src/BitqueryEDSEthereum.ts": "69c8a010389fa636fbbfb6eb2772daa0bde910a7",
7
+ "packages/bs-ethereum/src/BitqueryBDSEthereum.ts": "08abbfa7b39f842b722cf58953bfb1e73745fcc9",
8
+ "packages/bs-ethereum/src/BitqueryEDSEthereum.ts": "c04aa2be223166140f3b98e01390a6f5f7ded8df",
9
9
  "packages/bs-ethereum/src/GhostMarketNDSEthereum.ts": "145273284b3c27494eea0e80c0c1de8001b11c57",
10
10
  "packages/bs-ethereum/src/RpcBDSEthereum.ts": "d5e1ec436231894672fee3e677a8dc2f56628b0e",
11
- "packages/bs-ethereum/src/__tests__/BDSEthereum.spec.ts": "ef43b385d3a26181ed0ebf8ef07c643476d5d364",
11
+ "packages/bs-ethereum/src/__tests__/BDSEthereum.spec.ts": "8b66ba80d8457601fac69819cc1fae4d7bc7b08a",
12
12
  "packages/bs-ethereum/src/__tests__/BSEthereum.spec.ts": "0da33cb4c9f89a3b6c2c8445d800ff4ddb41d161",
13
13
  "packages/bs-ethereum/src/__tests__/BitqueryEDSEthereum.spec.ts": "8e26084a00916be48eeeb65d3918e5eed6368f0c",
14
14
  "packages/bs-ethereum/src/__tests__/GhostMarketNDSEthereum.spec.ts": "f5c9ba8f6c866b97bcf647d105bfa2d5f140180d",
15
15
  "packages/bs-ethereum/src/assets/tokens/common.json": "4dbbf3a3b38422e743cf631ffb6c39231777b88d",
16
16
  "packages/bs-ethereum/src/constants.ts": "40862a7cc04298a21e380ecdf02e09349897a6f5",
17
- "packages/bs-ethereum/src/graphql.ts": "06c16fa064a6b0ec523e6917f142ed4abb5214e0",
17
+ "packages/bs-ethereum/src/graphql.ts": "aadff73a44a9d12cc65ebe1b0b161f1ecc4f6021",
18
18
  "packages/bs-ethereum/src/index.ts": "69ca9c23acdd0afd70f7eaa0a840b07b62bdb07a",
19
19
  "packages/bs-ethereum/tsconfig.build.json": "4dc23fb9c4c5e4d19a9bc3947a47c523f4bd967c",
20
20
  "packages/bs-ethereum/tsconfig.json": "93e09769572b58e642d4990e9552c70a8b85e142",
21
- "common/config/rush/npm-shrinkwrap.json": "4994dce94cedd11a678400d92e08741ac7bc9d3f"
21
+ "common/config/rush/npm-shrinkwrap.json": "c7f58d681afa54f5c08d809a1ace9947b56fb633"
22
22
  },
23
23
  "arguments": "tsc --project tsconfig.build.json "
24
24
  }
@@ -26,7 +26,7 @@ class BitqueryBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
26
26
  this.networkType = network.type;
27
27
  this.client = new core_1.Client({
28
28
  url: constants_1.BITQUERY_URL,
29
- exchanges: [core_1.cacheExchange, core_1.fetchExchange],
29
+ exchanges: [core_1.fetchExchange],
30
30
  fetch: node_fetch_1.default,
31
31
  fetchOptions: {
32
32
  headers: {
@@ -76,7 +76,7 @@ class BitqueryBDSEthereum extends RpcBDSEthereum_1.RpcBDSEthereum {
76
76
  throw new Error(result.error.message);
77
77
  if (!result.data)
78
78
  throw new Error('Address does not have transactions');
79
- const totalCount = ((_a = result.data.ethereum.sentCount.count) !== null && _a !== void 0 ? _a : 0) + ((_b = result.data.ethereum.receiverCount.count) !== null && _b !== void 0 ? _b : 0);
79
+ 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);
80
80
  const mixedTransfers = [...((_e = (_d = (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c.ethereum) === null || _d === void 0 ? void 0 : _d.sent) !== null && _e !== void 0 ? _e : []), ...((_h = (_g = (_f = result === null || result === void 0 ? void 0 : result.data) === null || _f === void 0 ? void 0 : _f.ethereum) === null || _g === void 0 ? void 0 : _g.received) !== null && _h !== void 0 ? _h : [])];
81
81
  const transactions = new Map();
82
82
  mixedTransfers.forEach(transfer => {
@@ -25,7 +25,7 @@ class BitqueryEDSEthereum {
25
25
  this.networkType = networkType;
26
26
  this.client = new core_1.Client({
27
27
  url: constants_1.BITQUERY_URL,
28
- exchanges: [core_1.cacheExchange, core_1.fetchExchange],
28
+ exchanges: [core_1.fetchExchange],
29
29
  fetch: node_fetch_1.default,
30
30
  fetchOptions: {
31
31
  headers: {
package/dist/graphql.d.ts CHANGED
@@ -32,10 +32,10 @@ type BitQueryGetTransactionsByAddressResponse = {
32
32
  received: BitqueryTransaction[];
33
33
  sentCount: {
34
34
  count: number;
35
- };
35
+ }[];
36
36
  receiverCount: {
37
37
  count: number;
38
- };
38
+ }[];
39
39
  };
40
40
  };
41
41
  type BitQueryGetTransactionsByAddressVariables = {
package/dist/graphql.js CHANGED
@@ -5,7 +5,10 @@ const core_1 = require("@urql/core");
5
5
  exports.bitqueryGetTransactionsByAddressQuery = (0, core_1.gql) `
6
6
  query getTransactions($address: String!, $limit: Int!, $offset: Int!, $network: EthereumNetwork!) {
7
7
  ethereum(network: $network) {
8
- sent: transfers(options: { limit: $limit, offset: $offset }, sender: { is: $address }) {
8
+ sent: transfers(
9
+ options: { limit: $limit, offset: $offset, desc: "block.timestamp.unixtime" }
10
+ sender: { is: $address }
11
+ ) {
9
12
  block {
10
13
  timestamp {
11
14
  unixtime
@@ -32,7 +35,10 @@ exports.bitqueryGetTransactionsByAddressQuery = (0, core_1.gql) `
32
35
  }
33
36
  entityId
34
37
  }
35
- received: transfers(options: { limit: $limit, offset: $offset }, receiver: { is: $address }) {
38
+ received: transfers(
39
+ options: { limit: $limit, offset: $offset, desc: "block.timestamp.unixtime" }
40
+ receiver: { is: $address }
41
+ ) {
36
42
  block {
37
43
  timestamp {
38
44
  unixtime
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cityofzion/bs-ethereum",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": "https://github.com/CityOfZion/blockchain-services",
@@ -11,7 +11,7 @@
11
11
  "test": "jest --config jest.config.ts"
12
12
  },
13
13
  "dependencies": {
14
- "@cityofzion/blockchain-service": "0.7.1",
14
+ "@cityofzion/blockchain-service": "0.7.2",
15
15
  "ethers": "5.7.2",
16
16
  "@urql/core": "~4.1.1",
17
17
  "graphql": "~16.8.0",
@@ -10,7 +10,7 @@ import {
10
10
  TransactionTransferNft,
11
11
  Network,
12
12
  } from '@cityofzion/blockchain-service'
13
- import { Client, cacheExchange, fetchExchange, gql } from '@urql/core'
13
+ import { Client, fetchExchange } from '@urql/core'
14
14
  import fetch from 'node-fetch'
15
15
  import { BITQUERY_API_KEY, BITQUERY_NETWORK_BY_NETWORK_TYPE, BITQUERY_URL, TOKENS } from './constants'
16
16
  import {
@@ -34,7 +34,7 @@ export class BitqueryBDSEthereum extends RpcBDSEthereum {
34
34
 
35
35
  this.client = new Client({
36
36
  url: BITQUERY_URL,
37
- exchanges: [cacheExchange, fetchExchange],
37
+ exchanges: [fetchExchange],
38
38
  fetch,
39
39
  fetchOptions: {
40
40
  headers: {
@@ -93,7 +93,8 @@ export class BitqueryBDSEthereum extends RpcBDSEthereum {
93
93
  if (result.error) throw new Error(result.error.message)
94
94
  if (!result.data) throw new Error('Address does not have transactions')
95
95
 
96
- const totalCount = (result.data.ethereum.sentCount.count ?? 0) + (result.data.ethereum.receiverCount.count ?? 0)
96
+ const totalCount =
97
+ (result.data.ethereum.sentCount[0].count ?? 0) + (result.data.ethereum.receiverCount[0].count ?? 0)
97
98
  const mixedTransfers = [...(result?.data?.ethereum?.sent ?? []), ...(result?.data?.ethereum?.received ?? [])]
98
99
 
99
100
  const transactions = new Map<string, TransactionResponse>()
@@ -1,5 +1,5 @@
1
1
  import { Currency, ExchangeDataService, NetworkType, TokenPricesResponse } from '@cityofzion/blockchain-service'
2
- import { Client, cacheExchange, fetchExchange, gql } from '@urql/core'
2
+ import { Client, fetchExchange } from '@urql/core'
3
3
  import fetch from 'node-fetch'
4
4
  import { BITQUERY_API_KEY, BITQUERY_URL } from './constants'
5
5
  import dayjs from 'dayjs'
@@ -16,7 +16,7 @@ export class BitqueryEDSEthereum implements ExchangeDataService {
16
16
 
17
17
  this.client = new Client({
18
18
  url: BITQUERY_URL,
19
- exchanges: [cacheExchange, fetchExchange],
19
+ exchanges: [fetchExchange],
20
20
  fetch,
21
21
  fetchOptions: {
22
22
  headers: {
@@ -41,6 +41,7 @@ describe('BDSEthereum', () => {
41
41
  async (BDSEthereum: BlockchainDataService) => {
42
42
  const address = '0x82B5Cd984880C8A821429cFFf89f36D35BaeBE89'
43
43
  const response = await BDSEthereum.getTransactionsByAddress({ address: address, page: 1 })
44
+ expect(response.totalCount).toBeGreaterThan(0)
44
45
  response.transactions.forEach(transaction => {
45
46
  expect(transaction).toEqual(
46
47
  expect.objectContaining({
package/src/graphql.ts CHANGED
@@ -36,10 +36,10 @@ type BitQueryGetTransactionsByAddressResponse = {
36
36
  received: BitqueryTransaction[]
37
37
  sentCount: {
38
38
  count: number
39
- }
39
+ }[]
40
40
  receiverCount: {
41
41
  count: number
42
- }
42
+ }[]
43
43
  }
44
44
  }
45
45
 
@@ -56,7 +56,10 @@ export const bitqueryGetTransactionsByAddressQuery = gql<
56
56
  >`
57
57
  query getTransactions($address: String!, $limit: Int!, $offset: Int!, $network: EthereumNetwork!) {
58
58
  ethereum(network: $network) {
59
- sent: transfers(options: { limit: $limit, offset: $offset }, sender: { is: $address }) {
59
+ sent: transfers(
60
+ options: { limit: $limit, offset: $offset, desc: "block.timestamp.unixtime" }
61
+ sender: { is: $address }
62
+ ) {
60
63
  block {
61
64
  timestamp {
62
65
  unixtime
@@ -83,7 +86,10 @@ export const bitqueryGetTransactionsByAddressQuery = gql<
83
86
  }
84
87
  entityId
85
88
  }
86
- received: transfers(options: { limit: $limit, offset: $offset }, receiver: { is: $address }) {
89
+ received: transfers(
90
+ options: { limit: $limit, offset: $offset, desc: "block.timestamp.unixtime" }
91
+ receiver: { is: $address }
92
+ ) {
87
93
  block {
88
94
  timestamp {
89
95
  unixtime