dubiex-ethers-helpers v0.0.25
Dubiex Ethers Helpers
This package contains wrappers a
Installation
To install helpers, compatible with React,Vue or Node.js
Note: ethers is a peer dependency of this package and needs to be installed separately.
npm install dubiex-ethers-helpers
or
yarn add dubiex-ethers-helpers
Usage
To try out all the available funcionallity, checkout the Dubiex Hardhat Node with a gitpodified playground and documentation.
Examples
Creating a Purpose Sell Order
import { contract, makeOrder } from 'dubiex-ethers-helpers'
try {
// To get the contract instances, a provider and the supported
// networkId must be passed into the helper functions
const dubiex = await contract.getDubiexDeployedContract(provider, networkId)
const purpose = await contract.getPurposeDeployedContract(provider, networkId)
// This will create a sell order of 100 PRPS for a total price
// of 0.5 ETH
const orderTransaction = await makeOrder.dubiexMakeNewPurposeSellOrder(
dubiex,
purpose,
ethersBigNumberAmount(makeOrderData.batch),
ethersBigNumberAmount(makeOrderData.batchPriceInEth),
{
gasLimit: 200000,
gasPrice: ethers.BigNumber.from(85400000000)
}
)
// do something with the ethers transaction
// https://docs.ethers.io/v5/api/providers/types/#providers-TransactionResponse
// orderTransaction.wait(), orderTransaction.hash ...
} catch (error) {
// handle transaction fail
}
API
Contract Contains helper functions for obtaining the deployed Contract Instances.
import { contract } from 'dubiex-ethers-helpers'
await contract.getDubiexDeployedContract(...)
Make Order Contains helper functions for creating Orders on the Dubiex contract.
import { makeOrder } from 'dubiex-ethers-helpers'
await makeOrder.dubiexMakeNewPurposeSellOrder(...)
Cancel Order
Utilities The utilities are used extensively within the library, but are intended to also be used outside
import { util } from 'dubiex-ethers-helpers'
const purposeAddress = util.getDeployedContractAddress(...)
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago