File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { getAddressWithoutPrefix } from '@/providers/ecash/libs/utils' ;
21import ActivityState from '.' ;
32import { ActivityHandlerType } from './types' ;
43
@@ -9,11 +8,8 @@ export default (activityHandler: ActivityHandlerType): ActivityHandlerType => {
98 const returnFunction : ActivityHandlerType = async ( network , address ) => {
109 const activityState = new ActivityState ( ) ;
1110
12- const cacheAddress =
13- typeof address === 'string' ? getAddressWithoutPrefix ( address ) : address ;
14-
1511 const options = {
16- address : cacheAddress ,
12+ address : address ,
1713 network : network . name ,
1814 } ;
1915
@@ -27,7 +23,7 @@ export default (activityHandler: ActivityHandlerType): ActivityHandlerType => {
2723 ] ) ;
2824
2925 if ( cacheTime + cacheTTL < new Date ( ) . getTime ( ) ) {
30- const liveActivities = await activityHandler ( network , cacheAddress ) ;
26+ const liveActivities = await activityHandler ( network , address ) ;
3127 if ( ! activities . length ) {
3228 await activityState . addActivities ( liveActivities , options ) ;
3329 await activityState . setCacheTime ( options ) ;
Original file line number Diff line number Diff line change @@ -64,15 +64,15 @@ export const chronikHandler: ActivityHandlerType = async (
6464 isReceive || isSend
6565 ? calculateTransactionValue (
6666 tx . outputs ,
67- normalizedAddress ,
67+ [ normalizedAddress ] ,
6868 isReceive ,
6969 cashAddrPrefix ,
7070 )
7171 : '0' ;
7272
7373 const { fromAddress, toAddress } = getTransactionAddresses (
7474 tx ,
75- normalizedAddress ,
75+ [ normalizedAddress ] ,
7676 isReceive ,
7777 isSend ,
7878 cashAddrPrefix ,
Original file line number Diff line number Diff line change @@ -66,7 +66,9 @@ export class ChronikAPI extends ProviderAPIInterface {
6666 return this . withErrorHandling (
6767 'getBalance' ,
6868 async ( ) => {
69- const address = getAddress ( pubkey ) ;
69+ const address = this . ensurePrefix (
70+ getAddress ( pubkey , this . networkInfo . cashAddrPrefix ) ,
71+ ) ;
7072 const wallet = WatchOnlyWallet . fromAddress ( address , this . chronik ) ;
7173 await wallet . sync ( ) ;
7274 return wallet . balanceSats . toString ( ) ;
You can’t perform that action at this time.
0 commit comments