Wrappers

Overview

Wrapped Ether, or WETH, refers to the ERC-20 compatible version of ether. WETH can be created by sending ether to a smart contract where the ether is placed on hold, in turn receiving the WETH ERC-20 token at a 1:1 ratio. This WETH can afterward be sent back into the same smart contract to be "unwrapped" or redeemed back for the original ether at a 1:1 ratio.

Operations

Wrap ETH

In Assets: ETH Out Assets: WETH
Wraps ETH into WETH.
JavaScript & Node
1
const operation = new defire.Operations.Wrappers.Wrap.ETH({
2
amountETH: "5000000000000000000" //5 ETH
3
});
Copied!
Constructor object fields
amountETHrequired string | number | JSBI
Amount of ETH to wrap
Returns
Creates a new operation object

Unwrap ETH

In Assets: WETH Out Assets: ETH
Unwraps WETH into ETH.
JavaScript & Node
1
const operation = new defire.Operations.Wrappers.Unwrap.ETH({
2
amountWETH: "5000000000000000000" //5 WETH
3
});
Copied!
Constructor object fields
amountWETH required string | number | JSBI
Amount of WETH to unwrap
Returns
Creates a new operation object
Last modified 1yr ago