See https://renproject.github.io/ren-js-docs/ for RenJS's jsdoc/typedoc documentation.
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%).
Each chain class (Bitcoin
, Ethereum
, etc.) provide a common set of helper methods:
await assetDecimals(asset)
- returns the number of decimals used by the asset.
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
.
addressExplorerLink(address)
- returns a link to the address in a chain explorer.
transactionExplorerLink(transaction)
- returns a link to the transaction in a chain explorer.
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:
// Same for Bitcoin forks.​type Address = string;​interface Transaction {readonly txHash: string;readonly vOut: number;readonly amount: number;readonly scriptPubKey?: string;readonly confirmations: number;}
// Same for Binance Smart Chain.​type Transaction = string; // The transaction hash.type Address = string;
interface Address {address: string; // Filecoin addressparams?: string; // base64 params}​interface Transaction {cid: string;amount: string; // 18 decimal placesparams: string; // base64confirmations: number;nonce: number;}
​