Fetching wBTC, Factory, and Router Addresses on OP_NET
This guide walks you through how to retrieve the wBTC, Factory, and Router addresses, which are essential for interacting with the OP_NET metaprotocol. These addresses are used for token swaps, liquidity pool interactions, and wrapping/unwrapping BTC.
Step 1: Install Required Packages
Ensure that you have the required dependencies installed:
Step 2: Fetch the wBTC Address
The wBTC
address represents the Wrapped Bitcoin contract on the OP_NET metaprotocol. You can fetch the wBTC address using the wBTC
class provided by the @btc-vision/transaction
package which is included in the opnet
package.
Step 3: Fetch the Factory and Router Addresses
The Factory and Router addresses are used for interacting with decentralized exchanges (DEXes) and liquidity pools. You can directly import the constants for these addresses depending on the network (Regtest, Fractal Testnet).
Step 4: Example Output
When running this code, you'll see the addresses for wBTC, Factory, and Router for the respective networks. Example output on Regtest might look like this:
Last updated