BridgeJS

BridgeJS

The SDK works with TomoChain protocols

Constructor

new BridgeJS(endpoint, pkey)

Source:
Parameters:
Name Type Description
endpoint string

The Url to the node

pkey string

The private key of the wallet

Methods

(static) setProvider(endpointopt, pkeyopt)

Source:

Initial the SDK

Parameters:
Name Type Attributes Default Description
endpoint string <optional>
https://bridge.tomochain.com

The Url to the node

pkey string <optional>
random

The private key of the coinbase

(async) getDepositTransaction(wrap) → {Object}

Source:

Get latest deposit transaction

Parameters:
Name Type Description
wrap Object

The wrap information

Properties
Name Type Description
tokenSymbol string

The token symbol

userAddress string

The user address

Returns:

Transaction object(inner and outter networks)

Type
Object

(async) getTransactions(object) → {Object}

Source:

Get depositing and withdrawal transactions filtering by tokenSymbol

Parameters:
Name Type Description
object Object

Input object

Properties
Name Type Description
tokenSymbol String

Token symbol

limit Number

Limit number of records per page

page Number

Page number

Returns:

Transaction object(inner and outter networks)

Type
Object

(async) getUnwrapTransactions(object) → {Object}

Source:

Get withdrawal transactions

Parameters:
Name Type Description
object Object

Input object

Properties
Name Type Description
limit Number

Limit number of records per page

page Number

Page number

wrap.userAddress string

The user address

Returns:

Transaction object(inner and outter networks)

Type
Object

(async) getWithdrawTransaction(unwrap) → {Object}

Source:

Get latest withdraw transaction

Parameters:
Name Type Description
unwrap Object

The unwrap information

Properties
Name Type Description
tokenSymbol String

Token symbol

wrap.userAddress string

The user address

Returns:

Transaction object(inner and outter networks)

Type
Object

(async) getWrapTransactions(object) → {Object}

Source:

Get depositing transactions

Parameters:
Name Type Description
object Object

Input object

Properties
Name Type Description
limit Number

Limit number of records per page

page Number

Page number

wrap.userAddress string

The user address

Returns:

Transaction object(inner and outter networks)

Type
Object

(async) unwrap(unwrap)

Source:

Unwrap TRC21 TOKEN

Parameters:
Name Type Description
unwrap object

The unwrap information

Properties
Name Type Description
tokenSymbol string

The token symbol

amount string

The amount for unwrapping

dest string

The destination address

(async) unwrapWatch(object) → {Object}

Source:

Watch withdrawal transaction

Parameters:
Name Type Description
object Object

Input object

Properties
Name Type Description
tokenSymbol String

Token symbol

Returns:

Transaction object(inner and outter networks)

Type
Object

(async) wrapGetAddress(wrap) → {Object}

Source:

Get depositing address

Parameters:
Name Type Description
wrap object

The wrap information

Properties
Name Type Description
tokenSymbol string

The token symbol

userAddress string

The user address

Returns:

Depositing information object

Type
Object

(async) wrapWatch(object) → {Object}

Source:

Watch depositing transaction

Parameters:
Name Type Description
object Object

Input object

Properties
Name Type Description
tokenSymbol String

Token symbol

Returns:

Transaction object(inner and outter networks)

Type
Object