@permaswap/halo-js
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

halo-js

Installation

Using yarn

yarn add @permaswap/halo-js

Using npm

npm install @permaswap/halo-js

Configuration

params Description
debug Used for development and production environment selection
account everPay account string
everpay Everpay instance, please flow everpay-js docs

Example

import Halo from '@permaswap/halo-js'
import { ethers } from 'ethers'
import Everpay from 'everpay'

const wallet = {
  address: '0x26361130d5d6E798E9319114643AF8c868412859',
  privateKey: '94c97d4cc865d77afaf2d64147f7c067890e1485eb5d8e2c15cc0b7528a08b47'
}

const provider = new ethers.providers.InfuraProvider('goerli')
const signer = new ethers.Wallet(wallet.privateKey, provider)
const everpay = new Everpay({
  debug: true,
  account: wallet.address,
  ethConnectedSigner: signer
})

const halo = new Halo({
  debug: true,
  account: wallet.address,
  everpay
})

Methods

halo.info()

{
  "dapp": "halo_test",
  "chainID": "5",
  "govern": "0x61EbF673c200646236B2c53465bcA0699455d5FA",
  "feeRecipient": "0x61EbF673c200646236B2c53465bcA0699455d5FA",
  "routerMinStake": "1000000000000000000",
  "routers": [
    "0xd27a90Cba2c67Db4B5F7eEFc16A1E0Acc278106a",
    "0x61EbF673c200646236B2c53465bcA0699455d5FA",
    "0x1DF611aec4065801f416c67d2c3bC9466228Ea57"
  ],
  "routerState": {
    "0x1DF611aec4065801f416c67d2c3bC9466228Ea57": {
      "router": "0x1DF611aec4065801f416c67d2c3bC9466228Ea57",
      "name": "perma-dev",
      "logo": "",
      "desc": "",
      "domain": "router-dev.permaswap.network",
      "ip": "",
      "swapFeeRatio": "0.0005",
      "swapFeeRecipient": "0x61EbF673c200646236B2c53465bcA0699455d5FA",
      "pools": {
        "0x196ca0c5e44d776e1d7ee1e6485030ea43ee4bad225e3312685048827eaf2a92": {
          "tokenXTag": "bsc-tar-0xf1458ee7e9a2096bce7a21c160840a3a291bcb55",
          "tokenYTag": "bsc-tardrive-0xf4233b165f1b8da4f9aa94abc35c9ad2a7612979",
          "feeRatio": "0.003"
        },
        "0xb57de84c67306cc740021ba9ec328d9b2e351b2196caf96d8a6117a6e6bc680a": {
          "tokenXTag": "bsc-tar-0xf1458ee7e9a2096bce7a21c160840a3a291bcb55",
          "tokenYTag": "bsc-tusdc-0xf17a50ecc5fe5f476de2da5481cdd0f0ffef7712",
          "feeRatio": "0.003"
        }
      },
      "lpMinStake": "",
      "lpPenalty": ""
    },
    "0x61EbF673c200646236B2c53465bcA0699455d5FA": {
      "router": "0x61EbF673c200646236B2c53465bcA0699455d5FA",
      "name": "perma-ip-dev",
      "logo": "",
      "desc": "",
      "domain": "",
      "ip": "103.61.38.209:10001",
      "swapFeeRatio": "0.0005",
      "swapFeeRecipient": "0x61EbF673c200646236B2c53465bcA0699455d5FA",
      "pools": {
        "0x2b28a8b713121ede469686735c3771085afe7162e29a8da41a18555a73991a63": {
          "tokenXTag": "bsc-tusdc-0xf17a50ecc5fe5f476de2da5481cdd0f0ffef7712",
          "tokenYTag": "everpay-acnh-0xac4cbc2009cf9ad96c2e1a4b34b1c8cb312fbce4",
          "feeRatio": "0.003"
        }
      },
      "lpMinStake": "",
      "lpPenalty": ""
    },
    "0xd27a90Cba2c67Db4B5F7eEFc16A1E0Acc278106a": {
      "router": "0xd27a90Cba2c67Db4B5F7eEFc16A1E0Acc278106a",
      "name": "halo-dev",
      "logo": "",
      "desc": "",
      "domain": "halo-dev.halonode.com",
      "ip": "",
      "swapFeeRatio": "0.001",
      "swapFeeRecipient": "0x61EbF673c200646236B2c53465bcA0699455d5FA",
      "pools": {

      },
      "lpMinStake": "",
      "lpPenalty": ""
    }
  },
  "account": {
    "0x1DF611aec4065801f416c67d2c3bC9466228Ea57": {
      "ID": "0x1DF611aec4065801f416c67d2c3bC9466228Ea57",
      "Type": "ethereum",
      "Nonce": 1711005491583
    },
    "0x2ca81e1253f9426c62Df68b39a22A377164eeC92": {
      "ID": "0x2ca81e1253f9426c62Df68b39a22A377164eeC92",
      "Type": "ethereum",
      "Nonce": 1711534747172
    },
    "0x4002ED1a1410aF1b4930cF6c479ae373dEbD6223": {
      "ID": "0x4002ED1a1410aF1b4930cF6c479ae373dEbD6223",
      "Type": "ethereum",
      "Nonce": 1711017201291
    },
    "0x61EbF673c200646236B2c53465bcA0699455d5FA": {
      "ID": "0x61EbF673c200646236B2c53465bcA0699455d5FA",
      "Type": "ethereum",
      "Nonce": 1711534494094
    },
    "5NPqYBdIsIpJzPeYixuz7BEH_W7BEk_mb8HxBD3OHXo": {
      "ID": "5NPqYBdIsIpJzPeYixuz7BEH_W7BEk_mb8HxBD3OHXo",
      "Type": "arweave",
      "Nonce": 1711534748190
    },
    "FyINHRSrHW0teUhvJzd6R33Tl50qxLnSj8LJCP5puiI": {
      "ID": "FyINHRSrHW0teUhvJzd6R33Tl50qxLnSj8LJCP5puiI",
      "Type": "arweave",
      "Nonce": 1711022516199
    }
  },
  "proposals": [],
  "stakePools": [
    "basic",
    "dev",
    "admin"
  ],
  "onlyUnStakePools": [
    "dev",
    "admin"
  ],
  "executed": [],
  "validity": {

  },
  "latestTxHash": "0x35e49bef49328b01766bbf1a1f85d9787beaeb9a53191c6464070a1c0f443401",
  "latestTxEverHash": "0xbcf20acb514759ed3d9a477b5d78c748bb781b0cdf383f62962f0054413cb1bc",
  "stateHash": "",
  "proposalIds": [],
  "genesisTxEverHash": "0x845414ee13b73c3a9bb2236a8878c7cb13ef67aa082ab796d25654a7395af56e",
  "haloAddr": "0x1e47EA48c09Cd62b5ECf2b665Cf080671020d928"
}

halo.tokenInfo()

{
  "symbol": "halo",
  "decimals": 18,
  "totalSupply": "1000000000000000000000000000",
  "balances": {
    "0x2ca81e1253f9426c62Df68b39a22A377164eeC92": "11000000000000000000",
    "0x4002ED1a1410aF1b4930cF6c479ae373dEbD6223": "5000000000000000000",
    "0x61EbF673c200646236B2c53465bcA0699455d5FA": "68000000000000000000",
    "0x6e06EEDb83A25e3DA5E4FF8bAAC29bADeeB6548C": "2000000000000000000",
    "0x7759cb78EaF06c470165F0B57af7Ffd737407D56": "1000000000000000000",
    "0xf392A4e8DDbfBD7782407561B8Beab911c36d59A": "1000000000000000000",
    "FyINHRSrHW0teUhvJzd6R33Tl50qxLnSj8LJCP5puiI": "10000000000000000000",
    "cSYOy8-p1QFenktkDBFyRM3cwZSTrQ_J4EsELLho_UE": "2000000000000000000",
    "ecosystem": "199990000000000000000000000",
    "incentive": "500000000000000000000000000",
    "investor": "150000000000000000000000000",
    "team": "150000000000000000000000000"
  },
  "stakes": {
    "0x1DF611aec4065801f416c67d2c3bC9466228Ea57": {
      "basic": [
        {
          "stakedAt": 1709798114,
          "amount": "3000000000000000000000"
        }
      ]
    },
    "0x61EbF673c200646236B2c53465bcA0699455d5FA": {
      "basic": [
        {
          "stakedAt": 1709798114,
          "amount": "2900000000000000000000"
        }
      ]
    },
    "0x7759cb78EaF06c470165F0B57af7Ffd737407D56": {
      "basic": [
        {
          "stakedAt": 1709798114,
          "amount": "3000000000000000000000"
        }
      ]
    },
    "0xd27a90Cba2c67Db4B5F7eEFc16A1E0Acc278106a": {
      "basic": [
        {
          "stakedAt": 1709798114,
          "amount": "1000000000000000000000"
        }
      ]
    }
  }
}

halo.balance(address?: string)

{
  "balance":"1",
  "stakes": {
    "basic":[{
      "stakedAt": 1709798114,
      "amount": "3000"
    }]
  }
}

The quantity represented by the balance field and amount field is processed by the decimals format. Developers can easily integrate with everPay without caring about decimals.

halo.tx(haloHash | everHash)

{
  "createdAt": "2024-03-27T10:36:04.708Z",
  "everHash": "0x72faebd9bc8352a6df1b6d02840474e81af5bddbc42ca7ef4b6eef527d1a3752",
  "haloHash": "0x971806ce3139c9a4f83407f20a7a319cdb4b80f0a6872e72d53929d3139f93fc",
  "dapp": "halo_test",
  "chainID": "5",
  "router": "0x1DF611aec4065801f416c67d2c3bC9466228Ea57",
  "action": "transfer",
  "from": "0x2ca81e1253f9426c62Df68b39a22A377164eeC92",
  "fee": "0",
  "feeRecipient": "0x61EbF673c200646236B2c53465bcA0699455d5FA",
  "nonce": "1711535763063",
  "version": "v1",
  "params": "{\"to\":\"5NPqYBdIsIpJzPeYixuz7BEH_W7BEk_mb8HxBD3OHXo\",\"amount\":\"1000000000000000000\"}",
  "sig": "0xb982a6179c6cbb9003160a72c3f87a6a4e984e781cedf3c9f1646fe8bf088f7c01a1bafbf4dc5102816d45fc8c6ff9247e84124963f47919732a622b4074e68d1b",
  "error": ""
}

halo.transfer({ to, amount })

halo.transfer({ to: '5NPqYBdIsIpJzPeYixuz7BEH_W7BEk_mb8HxBD3OHXo', amount: '1' })

The quantity represented by the amount field is processed by the decimals format. Developers can easily integrate with everPay without caring about decimals.

{
  everHash: '0x72faebd9bc8352a6df1b6d02840474e81af5bddbc42ca7ef4b6eef527d1a3752',
  haloHash: '0x971806ce3139c9a4f83407f20a7a319cdb4b80f0a6872e72d53929d3139f93fc'
}

Package Sidebar

Install

npm i @permaswap/halo-js

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

226 kB

Total Files

28

Last publish

Collaborators

  • xaber