0.0.25 • Published 2 years ago

dubiex-ethers-helpers v0.0.25

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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(...)
0.0.25

2 years ago

0.0.20

2 years ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.23

2 years ago

0.0.24

2 years ago

0.0.15

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.1

3 years ago