@cfxdevkit/core / EspaceClient
Class: EspaceClient
Defined in: packages/core/src/clients/evm.ts:80
EVM Space (eSpace) Client Implementation Provides unified interface for Ethereum-compatible operations on Conflux eSpace
Extended by
Implements
Constructors
Constructor
new EspaceClient(
config):EspaceClient
Defined in: packages/core/src/clients/evm.ts:88
Parameters
config
Returns
EspaceClient
Properties
address
address:
`0x${string}`
Defined in: packages/core/src/clients/evm.ts:86
Implementation of
chain
protectedreadonlychain:Chain
Defined in: packages/core/src/clients/evm.ts:85
chainId
readonlychainId:number
Defined in: packages/core/src/clients/evm.ts:81
Implementation of
chainType
readonlychainType:"evm"
Defined in: packages/core/src/clients/evm.ts:82
Implementation of
Methods
callContract()
callContract<
T>(address,abi,functionName,args?):Promise<T>
Defined in: packages/core/src/clients/evm.ts:292
Read a contract function (view/pure). Available on the public client — no wallet / private key required.
Type Parameters
T
T = unknown
Parameters
address
string
abi
unknown[]
functionName
string
args?
unknown[] = []
Returns
Promise<T>
Implementation of
estimateGas()
estimateGas(
tx):Promise<bigint>
Defined in: packages/core/src/clients/evm.ts:152
Parameters
tx
Returns
Promise<bigint>
Implementation of
formatAmount()
formatAmount(
amount):string
Defined in: packages/core/src/clients/evm.ts:398
Parameters
amount
bigint
Returns
string
Implementation of
getBalance()
getBalance(
address):Promise<string>
Defined in: packages/core/src/clients/evm.ts:130
Parameters
address
`0x${string}`
Returns
Promise<string>
Implementation of
getBalanceRaw()
getBalanceRaw(
address):Promise<bigint>
Defined in: packages/core/src/clients/evm.ts:268
Get the raw balance as a bigint (in wei). Use this when you need the exact value for arithmetic.
Parameters
address
`0x${string}`
Returns
Promise<bigint>
Implementation of
getBlockNumber()
getBlockNumber():
Promise<bigint>
Defined in: packages/core/src/clients/evm.ts:116
Returns
Promise<bigint>
Implementation of
getChainId()
getChainId():
Promise<number>
Defined in: packages/core/src/clients/evm.ts:229
Get the current chain ID from the network
Returns
Promise<number>
Implementation of
getGasPrice()
getGasPrice():
Promise<bigint>
Defined in: packages/core/src/clients/evm.ts:212
Returns
Promise<bigint>
Implementation of
getTokenBalance()
getTokenBalance(
_address,_tokenAddress):Promise<string>
Defined in: packages/core/src/clients/evm.ts:316
Parameters
_address
string
_tokenAddress
string
Returns
Promise<string>
Implementation of
isConnected()
isConnected():
Promise<boolean>
Defined in: packages/core/src/clients/evm.ts:246
Check if the client is connected to the network
Returns
Promise<boolean>
isValidAddress()
isValidAddress(
address):boolean
Defined in: packages/core/src/clients/evm.ts:394
Parameters
address
string
Returns
boolean
Implementation of
parseAmount()
parseAmount(
amount):bigint
Defined in: packages/core/src/clients/evm.ts:402
Parameters
amount
string
Returns
bigint
Implementation of
sendTransaction()
sendTransaction(
_tx):Promise<string>
Defined in: packages/core/src/clients/evm.ts:256
Parameters
_tx
Returns
Promise<string>
Implementation of
waitForTransaction()
waitForTransaction(
hash,timeout?):Promise<TransactionReceipt>
Defined in: packages/core/src/clients/evm.ts:175
Wait for a transaction to be confirmed.
Parameters
hash
string
Transaction hash.
timeout?
number
Timeout in milliseconds (default: 30 000).
Returns
Promise<TransactionReceipt>
Implementation of
ChainClient.waitForTransaction
watchBlocks()
watchBlocks(
callback): () =>void
Defined in: packages/core/src/clients/evm.ts:346
Parameters
callback
Returns
():
void
Returns
void
Implementation of
watchTransaction()
watchTransaction(
_hash,_callback):Promise<() =>void>
Defined in: packages/core/src/clients/evm.ts:360
Parameters
_hash
string
_callback
(receipt) => void
Returns
Promise<() => void>
watchTransactions()
watchTransactions(
_callback): () =>void
Defined in: packages/core/src/clients/evm.ts:386
Parameters
_callback
EventCallback<TransactionEvent>
Returns
():
void
Returns
void