2424 * they require real network access (Conflux eSpace testnet).
2525 */
2626
27- import { describe , it , expect } from 'vitest' ;
27+ import { describe , expect , it } from 'vitest' ;
2828import {
29+ deriveAccount ,
30+ deriveAccounts ,
31+ ERC20_ABI ,
2932 EspaceClient ,
3033 EVM_TESTNET ,
31- ERC20_ABI ,
3234 formatUnits ,
3335 generateMnemonic ,
3436 validateMnemonic ,
35- deriveAccounts ,
36- deriveAccount ,
3737} from '../index.js' ;
3838
3939// ── Shared client ─────────────────────────────────────────────────────────────
@@ -68,9 +68,12 @@ describe('playground: espace-block-number', () => {
6868 expect ( typeof gasPrice ) . toBe ( 'bigint' ) ;
6969
7070 const block = await client . publicClient . getBlock ( { blockTag : 'latest' } ) ;
71- console . log ( 'Hash :' , ( block . hash ?. slice ( 0 , 20 ) ?? 'n/a' ) + ' ...' ) ;
71+ console . log ( 'Hash :' , ` ${ block . hash ?. slice ( 0 , 20 ) ?? 'n/a' } ...` ) ;
7272 console . log ( 'Gas Used :' , block . gasUsed . toString ( ) ) ;
73- console . log ( 'Timestamp :' , new Date ( Number ( block . timestamp ) * 1000 ) . toUTCString ( ) ) ;
73+ console . log (
74+ 'Timestamp :' ,
75+ new Date ( Number ( block . timestamp ) * 1000 ) . toUTCString ( )
76+ ) ;
7477
7578 expect ( block . gasUsed ) . toBeGreaterThanOrEqual ( 0n ) ;
7679 expect ( block . timestamp ) . toBeGreaterThan ( 0n ) ;
@@ -87,9 +90,21 @@ describe('playground: read-balance', () => {
8790
8891 it ( 'reads ERC-20 token balance via readContract' , async ( ) => {
8992 const [ name , symbol , decimals , raw ] = await Promise . all ( [
90- client . publicClient . readContract ( { address : WCFX , abi : ERC20_ABI , functionName : 'name' } ) ,
91- client . publicClient . readContract ( { address : WCFX , abi : ERC20_ABI , functionName : 'symbol' } ) ,
92- client . publicClient . readContract ( { address : WCFX , abi : ERC20_ABI , functionName : 'decimals' } ) ,
93+ client . publicClient . readContract ( {
94+ address : WCFX ,
95+ abi : ERC20_ABI ,
96+ functionName : 'name' ,
97+ } ) ,
98+ client . publicClient . readContract ( {
99+ address : WCFX ,
100+ abi : ERC20_ABI ,
101+ functionName : 'symbol' ,
102+ } ) ,
103+ client . publicClient . readContract ( {
104+ address : WCFX ,
105+ abi : ERC20_ABI ,
106+ functionName : 'decimals' ,
107+ } ) ,
93108 client . publicClient . readContract ( {
94109 address : WCFX ,
95110 abi : ERC20_ABI ,
@@ -117,10 +132,26 @@ describe('playground: erc20-info', () => {
117132 const SPENDER = '0x33e5E5B262e5d8eBC443E1c6c9F14215b020554d' ;
118133
119134 const [ name , symbol , decimals , totalSupply ] = await Promise . all ( [
120- client . publicClient . readContract ( { address : WCFX , abi : ERC20_ABI , functionName : 'name' } ) ,
121- client . publicClient . readContract ( { address : WCFX , abi : ERC20_ABI , functionName : 'symbol' } ) ,
122- client . publicClient . readContract ( { address : WCFX , abi : ERC20_ABI , functionName : 'decimals' } ) ,
123- client . publicClient . readContract ( { address : WCFX , abi : ERC20_ABI , functionName : 'totalSupply' } ) ,
135+ client . publicClient . readContract ( {
136+ address : WCFX ,
137+ abi : ERC20_ABI ,
138+ functionName : 'name' ,
139+ } ) ,
140+ client . publicClient . readContract ( {
141+ address : WCFX ,
142+ abi : ERC20_ABI ,
143+ functionName : 'symbol' ,
144+ } ) ,
145+ client . publicClient . readContract ( {
146+ address : WCFX ,
147+ abi : ERC20_ABI ,
148+ functionName : 'decimals' ,
149+ } ) ,
150+ client . publicClient . readContract ( {
151+ address : WCFX ,
152+ abi : ERC20_ABI ,
153+ functionName : 'totalSupply' ,
154+ } ) ,
124155 ] ) ;
125156
126157 console . log ( 'Name :' , name ) ;
0 commit comments