@@ -466,51 +466,60 @@ describe('ERC20Token — check', () => {
466466describe ( 'ERC20Token — write' , ( ) => {
467467 const usdc = createERC20Token ( publicClient , USDC_ADDRESS ) ;
468468
469- it ( 'write(transfer) returns a ComposableCall object' , ( ) => {
470- const call = usdc . write ( { functionName : 'transfer' , args : [ UNISWAP_V3_ROUTER , 1_000_000n ] } ) ;
469+ it ( 'write(transfer) returns a ComposableCall object' , async ( ) => {
470+ const call = await usdc . write ( {
471+ functionName : 'transfer' ,
472+ args : [ UNISWAP_V3_ROUTER , 1_000_000n ] ,
473+ } ) ;
471474 expect ( typeof call ) . toBe ( 'object' ) ;
472475 } ) ;
473476
474- it ( 'write(transfer) has a functionSig' , ( ) => {
475- const call = usdc . write ( { functionName : 'transfer' , args : [ UNISWAP_V3_ROUTER , 1_000_000n ] } ) ;
477+ it ( 'write(transfer) has a functionSig' , async ( ) => {
478+ const call = await usdc . write ( {
479+ functionName : 'transfer' ,
480+ args : [ UNISWAP_V3_ROUTER , 1_000_000n ] ,
481+ } ) ;
476482 expect ( typeof call . functionSig ) . toBe ( 'string' ) ;
477483 expect ( call . functionSig . length ) . toBeGreaterThan ( 0 ) ;
478484 } ) ;
479485
480- it ( 'write(approve) has a functionSig' , ( ) => {
481- const call = usdc . write ( { functionName : 'approve' , args : [ UNISWAP_V3_ROUTER , 1_000_000n ] } ) ;
486+ it ( 'write(approve) has a functionSig' , async ( ) => {
487+ const call = await usdc . write ( {
488+ functionName : 'approve' ,
489+ args : [ UNISWAP_V3_ROUTER , 1_000_000n ] ,
490+ } ) ;
482491 expect ( typeof call . functionSig ) . toBe ( 'string' ) ;
483492 expect ( call . functionSig . length ) . toBeGreaterThan ( 0 ) ;
484493 } ) ;
485494
486- it ( 'write(transfer) and write(approve) produce different functionSigs' , ( ) => {
487- const transfer = usdc . write ( {
488- functionName : 'transfer' ,
489- args : [ UNISWAP_V3_ROUTER , 1_000_000n ] ,
490- } ) ;
491- const approve = usdc . write ( {
492- functionName : 'approve' ,
493- args : [ UNISWAP_V3_ROUTER , 1_000_000n ] ,
494- } ) ;
495+ it ( 'write(transfer) and write(approve) produce different functionSigs' , async ( ) => {
496+ const [ transfer , approve ] = await Promise . all ( [
497+ usdc . write ( { functionName : 'transfer' , args : [ UNISWAP_V3_ROUTER , 1_000_000n ] } ) ,
498+ usdc . write ( { functionName : 'approve' , args : [ UNISWAP_V3_ROUTER , 1_000_000n ] } ) ,
499+ ] ) ;
495500 expect ( transfer . functionSig ) . not . toBe ( approve . functionSig ) ;
496501 } ) ;
497502
498- it ( 'write(transfer) accepts a runtimeBalance() as the amount arg' , ( ) => {
503+ it ( 'write(transfer) accepts a runtimeBalance() as the amount arg' , async ( ) => {
499504 const rv = usdc . runtimeBalance ( { owner : UNISWAP_V3_ROUTER } ) ;
500- const call = usdc . write ( { functionName : 'transfer' , args : [ WETH_ADDRESS , rv ] } ) ;
505+ const call = await usdc . write ( { functionName : 'transfer' , args : [ WETH_ADDRESS , rv ] } ) ;
501506 expect ( typeof call ) . toBe ( 'object' ) ;
502507 expect ( call . functionSig ) . toBeDefined ( ) ;
503508 } ) ;
504509
505- it ( 'write(transfer) produces different inputParams for different amounts' , ( ) => {
506- const a = usdc . write ( { functionName : 'transfer' , args : [ UNISWAP_V3_ROUTER , 1n ] } ) ;
507- const b = usdc . write ( { functionName : 'transfer' , args : [ UNISWAP_V3_ROUTER , 2n ] } ) ;
510+ it ( 'write(transfer) produces different inputParams for different amounts' , async ( ) => {
511+ const [ a , b ] = await Promise . all ( [
512+ usdc . write ( { functionName : 'transfer' , args : [ UNISWAP_V3_ROUTER , 1n ] } ) ,
513+ usdc . write ( { functionName : 'transfer' , args : [ UNISWAP_V3_ROUTER , 2n ] } ) ,
514+ ] ) ;
508515 expect ( JSON . stringify ( a . inputParams ) ) . not . toBe ( JSON . stringify ( b . inputParams ) ) ;
509516 } ) ;
510517
511- it ( 'write(transfer) produces different inputParams for different recipients' , ( ) => {
512- const a = usdc . write ( { functionName : 'transfer' , args : [ UNISWAP_V3_ROUTER , 1n ] } ) ;
513- const b = usdc . write ( { functionName : 'transfer' , args : [ WETH_ADDRESS , 1n ] } ) ;
518+ it ( 'write(transfer) produces different inputParams for different recipients' , async ( ) => {
519+ const [ a , b ] = await Promise . all ( [
520+ usdc . write ( { functionName : 'transfer' , args : [ UNISWAP_V3_ROUTER , 1n ] } ) ,
521+ usdc . write ( { functionName : 'transfer' , args : [ WETH_ADDRESS , 1n ] } ) ,
522+ ] ) ;
514523 expect ( JSON . stringify ( a . inputParams ) ) . not . toBe ( JSON . stringify ( b . inputParams ) ) ;
515524 } ) ;
516525} ) ;
0 commit comments