Interacting with Accounts

Methods for interacting with Accounts.

exportSeedPhraseAsync(password)

Export an account wallet seed phrase.

Parameters:

Name

Type

Description

password

string

The plaintext password

Returns: Promise<string>

exportAddressPrivateKeyAsync(password)

Export a wallet address private key.

Parameters:

Name

Type

Description

password

string

The plaintext password

Returns: Promise<string>

getAvailableAddressesAsync(address)

Get available addresses for this account.

No parameters.

Returns: Promise<string[]>

setAddressAsync(address)

Set the current address in use.

Parameters:

Name

Type

Description

address

string|number

The address or address index

Returns: Promise<void>

getFillsAsync(page?, perPage?)

Get fills for the selected address that have been executed on Radar.

Parameters:

Name

Type

Description

page

number

[Optional] The page to fetch

perPage

number

[Optional] The number of fills per page

Returns: Promise<RadarFill>

getOrdersAsync(page?, perPage?)

Get orders for the selected address that have been placed on Radar.

Parameters:

Name

Type

Description

page

number

[Optional] The page to fetch

perPage

number

[Optional] The number of fills per page

Returns: Promise<RadarSignedOrder[]>

getEthBalanceAsync()

Get ETH balance for the current selected address.

No parameters.

Returns: Promise<BigNumber>

transferEthAsync(toAddress, perPage, opts?)

Transfer ETH to another address.

Parameters:

Name

Type

Description

toAddress

string

The address to transfer to

amount

number

The amount of ETH to transfer

opts

Opts

[Optional] The transaction options

Returns: Promise<TransactionReceiptWithDecodedLogs | string>

wrapEthAsync(amount, opts?)

Wrap ETH to convert it to WETH.

Parameters:

Name

Type

Description

amount

number

The amount of ETH to wrap

opts

Opts

[Optional] The transaction options

Returns: Promise<TransactionReceiptWithDecodedLogs | string>

unwrapEthAsync(amount, opts?)

Unwrap WETH to convert it to ETH.

Parameters:

Name

Type

Description

amount

number

The amount of ETH to unwrap

opts

Opts

[Optional] The transaction options

Returns: Promise<TransactionReceiptWithDecodedLogs | string>

getTokenBalanceAsync(tokenAddress)

Get balance of a token for the current selected address.

Parameters:

Name

Type

Description

address

string

The token address

Returns: Promise<BigNumber>

getTokenAllowanceAsync(tokenAddress)

Get a token allowance.

Parameters:

Name

Type

Description

address

string

The token address

Returns: Promise<BigNumber>

setTokenAllowanceAsync(tokenAddress, amount, opts?)

Set a token allowance.

Parameters:

Name

Type

Description

tokenAddress

string

The token address

amount

number

The allowance amount

opts

Opts

[Optional] The transaction options

Returns: Promise<TransactionReceiptWithDecodedLogs | string>

transferTokenAsync(tokenAddress, toAddress, amount, opts?)

Set a token allowance.

Parameters:

Name

Type

Description

tokenAddress

string

The token address

toAddress

string

The address to transfer to

amount

number

The amount of token to transfer

opts

Opts

[Optional] The transaction options

Returns: Promise<TransactionReceiptWithDecodedLogs | string>