JSPM

  • Created
  • Published
  • Downloads 68
  • Score
    100M100P100Q75024F
  • License ISC

Orion Protocol contracts typings

Package Exports

  • @orionprotocol/contracts/lib/ethers-v5
  • @orionprotocol/contracts/lib/ethers-v5/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@orionprotocol/contracts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Examples

// ethers V5
import {
  Exchange__factory,
  ERC20__factory,
} from "@orionprotocol/contracts/lib/ethers-v5";
import { ethers } from "ethers";

const provider = new ethers.providers.StaticJsonRpcProvider(
  "https://bsc-dataseed.binance.org/"
);
const exchangeContractAddress = "0xe9d1d2a27458378dd6c6f0b2c390807aed2217ca";
const exchangeContract = Exchange__factory.connect(
  exchangeContractAddress,
  provider
);

exchangeContract
  .getBalance(
    "0xe4ca1f75eca6214393fce1c1b316c237664eaa8e",
    "0x000000000000000000000000000000000000dead"
  )
  .then((howMuchORNOnDeadAddress) => {
    console.log(howMuchORNOnDeadAddress);
  });

const erc20Contract = ERC20__factory.connect(tokenAddress, provider);
// web3
import Web3 from "web3";
import { Exchange } from "@orionprotocol/contracts/lib/web3";
import ExchangeContractABI from "@orionprotocol/contracts/abis/Exchange.json";

const web3 = new Web3("https://bsc-dataseed.binance.org/");
const exchangeContractAddress = "0xe9d1d2a27458378dd6c6f0b2c390807aed2217ca";

const exchangeContract = new web3.eth.Contract(
  ExchangeContractABI,
  exchangeContractAddress
) as unknown as Exchange;

exchangeContract.methods
  .getBalance(
    "0xe4ca1f75eca6214393fce1c1b316c237664eaa8e",
    "0x000000000000000000000000000000000000dead"
  )
  .call()
  .then((howMuchORNOnDeadAddress) => {
    console.log(howMuchORNOnDeadAddress);
  });