Skip to content

Commit

Permalink
Merge pull request #19 from CityOfZion/CU-86a0ryajp
Browse files Browse the repository at this point in the history
CU-86a0ryajp - General fixes related to Ethereum testing
  • Loading branch information
melanke authored Sep 20, 2023
2 parents e279503 + 11304f4 commit db6bbf6
Show file tree
Hide file tree
Showing 12 changed files with 442 additions and 421 deletions.
813 changes: 413 additions & 400 deletions common/config/rush/npm-shrinkwrap.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/blockchain-service/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cityofzion/blockchain-service",
"version": "0.7.1",
"version": "0.7.2",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": "https://github.com/CityOfZion/blockchain-services",
Expand Down
2 changes: 1 addition & 1 deletion packages/bs-asteroid-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cityofzion/bs-asteroid-sdk",
"version": "0.7.1",
"version": "0.7.2",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": "https://github.com/CityOfZion/blockchain-services",
Expand Down
4 changes: 2 additions & 2 deletions packages/bs-ethereum/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cityofzion/bs-ethereum",
"version": "0.7.1",
"version": "0.7.2",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": "https://github.com/CityOfZion/blockchain-services",
Expand All @@ -11,7 +11,7 @@
"test": "jest --config jest.config.ts"
},
"dependencies": {
"@cityofzion/blockchain-service": "0.7.1",
"@cityofzion/blockchain-service": "0.7.2",
"ethers": "5.7.2",
"@urql/core": "~4.1.1",
"graphql": "~16.8.0",
Expand Down
7 changes: 4 additions & 3 deletions packages/bs-ethereum/src/BitqueryBDSEthereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
TransactionTransferNft,
Network,
} from '@cityofzion/blockchain-service'
import { Client, cacheExchange, fetchExchange, gql } from '@urql/core'
import { Client, fetchExchange } from '@urql/core'
import fetch from 'node-fetch'
import { BITQUERY_API_KEY, BITQUERY_NETWORK_BY_NETWORK_TYPE, BITQUERY_URL, TOKENS } from './constants'
import {
Expand All @@ -34,7 +34,7 @@ export class BitqueryBDSEthereum extends RpcBDSEthereum {

this.client = new Client({
url: BITQUERY_URL,
exchanges: [cacheExchange, fetchExchange],
exchanges: [fetchExchange],
fetch,
fetchOptions: {
headers: {
Expand Down Expand Up @@ -93,7 +93,8 @@ export class BitqueryBDSEthereum extends RpcBDSEthereum {
if (result.error) throw new Error(result.error.message)
if (!result.data) throw new Error('Address does not have transactions')

const totalCount = (result.data.ethereum.sentCount.count ?? 0) + (result.data.ethereum.receiverCount.count ?? 0)
const totalCount =
(result.data.ethereum.sentCount[0].count ?? 0) + (result.data.ethereum.receiverCount[0].count ?? 0)
const mixedTransfers = [...(result?.data?.ethereum?.sent ?? []), ...(result?.data?.ethereum?.received ?? [])]

const transactions = new Map<string, TransactionResponse>()
Expand Down
4 changes: 2 additions & 2 deletions packages/bs-ethereum/src/BitqueryEDSEthereum.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Currency, ExchangeDataService, NetworkType, TokenPricesResponse } from '@cityofzion/blockchain-service'
import { Client, cacheExchange, fetchExchange, gql } from '@urql/core'
import { Client, fetchExchange } from '@urql/core'
import fetch from 'node-fetch'
import { BITQUERY_API_KEY, BITQUERY_URL } from './constants'
import dayjs from 'dayjs'
Expand All @@ -16,7 +16,7 @@ export class BitqueryEDSEthereum implements ExchangeDataService {

this.client = new Client({
url: BITQUERY_URL,
exchanges: [cacheExchange, fetchExchange],
exchanges: [fetchExchange],
fetch,
fetchOptions: {
headers: {
Expand Down
1 change: 1 addition & 0 deletions packages/bs-ethereum/src/__tests__/BDSEthereum.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ describe('BDSEthereum', () => {
async (BDSEthereum: BlockchainDataService) => {
const address = '0x82B5Cd984880C8A821429cFFf89f36D35BaeBE89'
const response = await BDSEthereum.getTransactionsByAddress({ address: address, page: 1 })
expect(response.totalCount).toBeGreaterThan(0)
response.transactions.forEach(transaction => {
expect(transaction).toEqual(
expect.objectContaining({
Expand Down
14 changes: 10 additions & 4 deletions packages/bs-ethereum/src/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ type BitQueryGetTransactionsByAddressResponse = {
received: BitqueryTransaction[]
sentCount: {
count: number
}
}[]
receiverCount: {
count: number
}
}[]
}
}

Expand All @@ -56,7 +56,10 @@ export const bitqueryGetTransactionsByAddressQuery = gql<
>`
query getTransactions($address: String!, $limit: Int!, $offset: Int!, $network: EthereumNetwork!) {
ethereum(network: $network) {
sent: transfers(options: { limit: $limit, offset: $offset }, sender: { is: $address }) {
sent: transfers(
options: { limit: $limit, offset: $offset, desc: "block.timestamp.unixtime" }
sender: { is: $address }
) {
block {
timestamp {
unixtime
Expand All @@ -83,7 +86,10 @@ export const bitqueryGetTransactionsByAddressQuery = gql<
}
entityId
}
received: transfers(options: { limit: $limit, offset: $offset }, receiver: { is: $address }) {
received: transfers(
options: { limit: $limit, offset: $offset, desc: "block.timestamp.unixtime" }
receiver: { is: $address }
) {
block {
timestamp {
unixtime
Expand Down
6 changes: 3 additions & 3 deletions packages/bs-neo-legacy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cityofzion/bs-neo-legacy",
"version": "0.7.1",
"version": "0.7.2",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"author": "Coz",
Expand All @@ -10,8 +10,8 @@
"test": "jest --config jest.config.ts"
},
"dependencies": {
"@cityofzion/blockchain-service": "0.7.1",
"@cityofzion/bs-asteroid-sdk": "0.7.1",
"@cityofzion/blockchain-service": "0.7.2",
"@cityofzion/bs-asteroid-sdk": "0.7.2",
"@cityofzion/dora-ts": "0.0.11",
"@cityofzion/neon-js": "4.8.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/bs-neo-legacy/src/DoraBDSNeoLegacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export class DoraBDSNeoLegacy implements BlockchainDataService, BDSClaimable {
} catch {}

return {
amount: (Number(balance.balance) / 10 ** token.decimals).toFixed(token.decimals),
amount: Number(balance.balance).toFixed(token.decimals),
token,
}
})
Expand Down
6 changes: 3 additions & 3 deletions packages/bs-neo3/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cityofzion/bs-neo3",
"version": "0.7.1",
"version": "0.7.2",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"repository": "https://github.com/CityOfZion/blockchain-services",
Expand All @@ -17,8 +17,8 @@
"@cityofzion/neo3-invoker": "1.6.0",
"@cityofzion/neon-parser": "1.6.2",
"@cityofzion/neo3-parser": "1.6.0",
"@cityofzion/blockchain-service": "0.7.1",
"@cityofzion/bs-asteroid-sdk": "0.7.1",
"@cityofzion/blockchain-service": "0.7.2",
"@cityofzion/bs-asteroid-sdk": "0.7.2",
"@cityofzion/dora-ts": "0.0.11",
"query-string": "7.1.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/bs-react-native-decrypt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cityofzion/bs-react-native-decrypt",
"version": "0.7.1",
"version": "0.7.2",
"description": "Native Decrypt for Neo Blockchain",
"main": "dist/commonjs/index",
"module": "dist/module/index",
Expand Down

0 comments on commit db6bbf6

Please sign in to comment.