Additional methods

See https://renproject.github.io/ren-js-docs/ for RenJS's jsdoc/typedoc documentation.

getFees

To fetch the estimated fees of a burn or mint, you can call renJS.getFees, passing in the same asset and chain details:

await renJS.getFees({
asset: "BTC",
from: Bitcoin(),
to: Ethereum(provider, "testnet"),
});

The returned value will have four fields - lock and release, in the asset's smallest unit, are the transaction fees subtracted from the transaction amount when RenVM is moving the asset into or out of the network's custody. mint and burn are the portion of the transaction amount charged by RenVM, in BPS (1 BPS equals 0.01%).

Chain helper methods

Each chain class (Bitcoin, Ethereum, etc.) provide a common set of helper methods:

  1. await assetDecimals(asset) - returns the number of decimals used by the asset.

  2. addressIsValid("8...") - returns whether the the parameter is a valid address.

The parameters to the following depend on how the chain defines an Address and a Transaction.

  1. addressExplorerLink(address) - returns a link to the address in a chain explorer.

  2. transactionExplorerLink(transaction) - returns a link to the transaction in a chain explorer.

  3. transactionID(transaction) - returns the hash or ID of the transaction as a string.

Transactions can be retrieved from a deposit object by taking deposit.depositDetails.transaction.

The Address and Transaction formats for various chains are:

Bitcoin
Ethereum
Filecoin
Bitcoin
// Same for Bitcoin forks.
type Address = string;
interface Transaction {
readonly txHash: string;
readonly vOut: number;
readonly amount: number;
readonly scriptPubKey?: string;
readonly confirmations: number;
}
Ethereum
// Same for Binance Smart Chain.
type Transaction = string; // The transaction hash.
type Address = string;
Filecoin
interface Address {
address: string; // Filecoin address
params?: string; // base64 params
}
interface Transaction {
cid: string;
amount: string; // 18 decimal places
params: string; // base64
confirmations: number;
nonce: number;
}