File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -83,17 +83,24 @@ export class ContractClient implements IContractClient {
8383
8484 private async approveToken ( token : string , amount : bigint ) : Promise < void > {
8585 try {
86- await this . writeContract ( {
86+ const hash = await this . writeContract ( {
8787 address : token as Address ,
8888 abi : erc20Abi ,
89- functionName : 'approve' ,
90- args : [ this . contractAddress , amount ]
91- } )
89+ functionName : "approve" ,
90+ args : [ this . contractAddress , amount ] ,
91+ } ) ;
92+
93+ if ( ! this . publicClient ) {
94+ throw new Error ( "Public client is not available" ) ;
95+ }
96+
97+ await this . publicClient . waitForTransactionReceipt ( { hash } ) ;
9298 } catch ( error ) {
9399 throw new Error ( `Token approval failed: ${ ( error as Error ) . message } ` ) ;
94100 }
95101 }
96102
103+
97104 async isPoolInstantiated ( token : Address ) : Promise < boolean > {
98105 return this . safeRead ( "isPoolInstantiated" , false , async ( ) => {
99106 const data = await this . publicClient ! . readContract ( {
@@ -898,4 +905,4 @@ export class ContractClient implements IContractClient {
898905 const totalTime = ( feeEvents [ feeEvents . length - 1 ] . timestamp - feeEvents [ 0 ] . timestamp ) / ( 60 * 60 * 24 ) ; //days
899906 return totalFees / ( totalTime * Number ( totalLiquidity ) ) ;
900907 }
901- }
908+ }
You can’t perform that action at this time.
0 commit comments