Skip to Content

@cfxdevkit/core


@cfxdevkit/core / TestClient

Interface: TestClient

Defined in: packages/core/src/types/clients.ts:100

Test client interface for development operations

Extends

Properties

address

readonly address: string

Defined in: packages/core/src/types/clients.ts:38

Inherited from

ChainClient.address


chainId

readonly chainId: number

Defined in: packages/core/src/types/clients.ts:37

Inherited from

ChainClient.chainId


chainType

readonly chainType: ChainType

Defined in: packages/core/src/types/clients.ts:36

Inherited from

ChainClient.chainType

Methods

callContract()

callContract<T>(address, abi, functionName, args?): Promise<T>

Defined in: packages/core/src/types/clients.ts:56

Type Parameters

T

T = unknown

Parameters

address

string

abi

unknown[]

functionName

string

args?

unknown[]

Returns

Promise<T>

Inherited from

ChainClient.callContract


estimateGas()

estimateGas(tx): Promise<bigint>

Defined in: packages/core/src/types/clients.ts:46

Parameters

tx

BaseTransaction

Returns

Promise<bigint>

Inherited from

ChainClient.estimateGas


formatAmount()

formatAmount(amount): string

Defined in: packages/core/src/types/clients.ts:75

Parameters

amount

bigint

Returns

string

Inherited from

ChainClient.formatAmount


getBalance()

getBalance(address): Promise<string>

Defined in: packages/core/src/types/clients.ts:42

Parameters

address

string

Returns

Promise<string>

Inherited from

ChainClient.getBalance


getBalanceRaw()

getBalanceRaw(address): Promise<bigint>

Defined in: packages/core/src/types/clients.ts:43

Parameters

address

string

Returns

Promise<bigint>

Inherited from

ChainClient.getBalanceRaw


getBlockNumber()

getBlockNumber(): Promise<bigint>

Defined in: packages/core/src/types/clients.ts:41

Returns

Promise<bigint>

Inherited from

ChainClient.getBlockNumber


getChainId()

getChainId(): Promise<number>

Defined in: packages/core/src/types/clients.ts:45

Returns

Promise<number>

Inherited from

ChainClient.getChainId


getGasPrice()

getGasPrice(): Promise<bigint>

Defined in: packages/core/src/types/clients.ts:44

Returns

Promise<bigint>

Inherited from

ChainClient.getGasPrice


getInternalClient()

getInternalClient(): unknown

Defined in: packages/core/src/types/clients.ts:79

Returns

unknown

Inherited from

ChainClient.getInternalClient


getStorageAt()

getStorageAt(address, slot): Promise<string>

Defined in: packages/core/src/types/clients.ts:114

Parameters

address

string

slot

string

Returns

Promise<string>


getTokenBalance()

getTokenBalance(tokenAddress, holderAddress?): Promise<string>

Defined in: packages/core/src/types/clients.ts:64

Parameters

tokenAddress

string

holderAddress?

string

Returns

Promise<string>

Inherited from

ChainClient.getTokenBalance


impersonateAccount()

impersonateAccount(address): Promise<void>

Defined in: packages/core/src/types/clients.ts:107

Parameters

address

string

Returns

Promise<void>


increaseTime()

increaseTime(seconds): Promise<void>

Defined in: packages/core/src/types/clients.ts:104

Parameters

seconds

number

Returns

Promise<void>


isValidAddress()

isValidAddress(address): boolean

Defined in: packages/core/src/types/clients.ts:74

Parameters

address

string

Returns

boolean

Inherited from

ChainClient.isValidAddress


mine()

mine(blocks?): Promise<void>

Defined in: packages/core/src/types/clients.ts:102

Parameters

blocks?

number

Returns

Promise<void>


parseAmount()

parseAmount(amount): bigint

Defined in: packages/core/src/types/clients.ts:76

Parameters

amount

string

Returns

bigint

Inherited from

ChainClient.parseAmount


sendTransaction()

sendTransaction(tx): Promise<string>

Defined in: packages/core/src/types/clients.ts:49

Parameters

tx

BaseTransaction

Returns

Promise<string>

Inherited from

ChainClient.sendTransaction


setBalance()

setBalance(address, balance): Promise<void>

Defined in: packages/core/src/types/clients.ts:111

Parameters

address

string

balance

bigint

Returns

Promise<void>


setNextBlockTimestamp()

setNextBlockTimestamp(timestamp): Promise<void>

Defined in: packages/core/src/types/clients.ts:103

Parameters

timestamp

number

Returns

Promise<void>


setStorageAt()

setStorageAt(address, slot, value): Promise<void>

Defined in: packages/core/src/types/clients.ts:115

Parameters

address

string

slot

string

value

string

Returns

Promise<void>


stopImpersonatingAccount()

stopImpersonatingAccount(address): Promise<void>

Defined in: packages/core/src/types/clients.ts:108

Parameters

address

string

Returns

Promise<void>


waitForTransaction()

waitForTransaction(hash, timeout?): Promise<TransactionReceipt>

Defined in: packages/core/src/types/clients.ts:50

Parameters

hash

string

timeout?

number

Returns

Promise<TransactionReceipt>

Inherited from

ChainClient.waitForTransaction


watchBlocks()

watchBlocks(callback): UnwatchFunction

Defined in: packages/core/src/types/clients.ts:70

Parameters

callback

EventCallback<BlockEvent>

Returns

UnwatchFunction

Inherited from

ChainClient.watchBlocks


watchTransactions()

watchTransactions(callback): UnwatchFunction

Defined in: packages/core/src/types/clients.ts:71

Parameters

callback

EventCallback<TransactionEvent>

Returns

UnwatchFunction

Inherited from

ChainClient.watchTransactions