@@ -4,7 +4,12 @@ import {
4
4
ChainPriceListener ,
5
5
PriceItem ,
6
6
} from "../interface" ;
7
- import { addLeading0x , DurationInSeconds , removeLeading0x } from "../utils" ;
7
+ import {
8
+ addLeading0x ,
9
+ assertDefined ,
10
+ DurationInSeconds ,
11
+ removeLeading0x ,
12
+ } from "../utils" ;
8
13
import { PythAbi } from "./pyth-abi" ;
9
14
import { Logger } from "pino" ;
10
15
import { isWsEndpoint } from "../utils" ;
@@ -53,8 +58,8 @@ type PythContract = GetContractReturnType<
53
58
54
59
export type SuperWalletClient <
55
60
transport extends Transport = Transport ,
56
- chain extends Chain | undefined = Chain | undefined ,
57
- account extends Account | undefined = Account | undefined
61
+ chain extends Chain | undefined = Chain ,
62
+ account extends Account | undefined = Account
58
63
> = Client <
59
64
transport ,
60
65
chain ,
@@ -120,20 +125,20 @@ export class EvmPriceListener extends ChainPriceListener {
120
125
private async startWatching ( ) {
121
126
this . pythContract . watchEvent . PriceFeedUpdate (
122
127
{ id : this . priceItems . map ( ( item ) => addLeading0x ( item . id ) ) } ,
123
- { onLogs : this . onPriceFeedUpdate . bind ( this ) }
128
+ { strict : true , onLogs : this . onPriceFeedUpdate . bind ( this ) }
124
129
) ;
125
130
}
126
131
127
132
private onPriceFeedUpdate (
128
133
logs : WatchContractEventOnLogsParameter < typeof PythAbi , "PriceFeedUpdate" >
129
134
) {
130
135
for ( const log of logs ) {
131
- const priceId = removeLeading0x ( log . args . id ! ) ;
136
+ const priceId = removeLeading0x ( assertDefined ( log . args . id ) ) ;
132
137
133
138
const priceInfo : PriceInfo = {
134
- conf : log . args . conf ! . toString ( ) ,
135
- price : log . args . price ! . toString ( ) ,
136
- publishTime : Number ( log . args . publishTime ! ) ,
139
+ conf : assertDefined ( log . args . conf ) . toString ( ) ,
140
+ price : assertDefined ( log . args . price ) . toString ( ) ,
141
+ publishTime : Number ( assertDefined ( log . args . publishTime ) ) ,
137
142
} ;
138
143
139
144
this . logger . debug (
@@ -248,7 +253,7 @@ export class EvmPricePusher implements IPricePusher {
248
253
249
254
// Try to re-use the same nonce and increase the gas if the last tx is not landed yet.
250
255
if ( this . pusherAddress === undefined ) {
251
- this . pusherAddress = this . client . account ! . address ;
256
+ this . pusherAddress = this . client . account . address ;
252
257
}
253
258
254
259
const lastExecutedNonce =
0 commit comments