Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: BCH using chronik #843

Merged
merged 18 commits into from
Aug 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: address obj instead of string
chedieck committed Aug 8, 2024
commit da11b2557d4ef52441004b5fd7fbf2346c9dd915
4 changes: 2 additions & 2 deletions services/addressService.ts
Original file line number Diff line number Diff line change
@@ -184,7 +184,7 @@ export async function fetchAllAddressesForNetworkId (networkId: number): Promise
})
}

export async function fetchAddressesInList (prefixedAddressList: string[]): Promise<AddressWithTransactionsAndNetwork[]> {
export async function fetchAddressesArray (prefixedAddressList: string[]): Promise<AddressWithTransactionsAndNetwork[]> {
return await prisma.address.findMany({
where: {
address: {
@@ -321,4 +321,4 @@ export async function fetchAddressesByPaybuttonId(paybuttonId: string): Promise<
}

return addressesIds
}
}
5 changes: 3 additions & 2 deletions services/chronikService.ts
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ import {
import { Address, Prisma } from '@prisma/client'
import xecaddr from 'xecaddrjs'
import { groupAddressesByNetwork, satoshisToUnit } from 'utils'
import { fetchAddressBySubstring, fetchAllAddressesForNetworkId, getLatestTxTimestampForAddress, setSyncing, updateLastSynced } from './addressService'
import { fetchAddressBySubstring, fetchAddressesArray, fetchAllAddressesForNetworkId, getLatestTxTimestampForAddress, setSyncing, updateLastSynced } from './addressService'
import * as ws from 'ws'
import { BroadcastTxData } from 'ws-service/types'
import config from 'config'
@@ -406,7 +406,8 @@ export class ChronikBlockchainClient implements BlockchainClient {
}

private async getAddressesForTransaction (transaction: Tx_InNode): Promise<AddressWithTransaction[]> {
const addressesWithTransactions: AddressWithTransaction[] = await Promise.all(Object.values(this.getSubscribedAddresses()).map(
const addressesFromStringArray = await fetchAddressesArray(this.getSubscribedAddresses())
const addressesWithTransactions: AddressWithTransaction[] = await Promise.all(addressesFromStringArray.map(
async address => {
return {
address,