npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jadepool/saas-sdk

v1.3.2

Published

hashkey custody api sdk

Downloads

13

Readme

hashkey custody node.js sdk

Installing

Using npm:

npm install @jadepool/saas-sdk

Example

const API = require('@jadepool/saas-sdk')

const appKey = 'TyTLvCnHINbWZQag88hhmMz1'
const appSecret = 'uf0rPlTluGnIllGqx0X1os4hQ6rOdXDxStiN4qGd79lS6yeHZaOK4ldvRv1TBqr6'
const apiAddr = 'http://127.0.0.1:8092'

async function main () {
    const api = new API(appKey, appSecret, apiAddr)
    let result
    
    // create a new address
    try {
        result = await api.createAddress("ETH")
        console.log(result)
    } catch(e) {
        // do something
        console.log(e.response)
    }
    
    // vefify address
    try {
        result = await api.verifyAddress("ETH", result.address) 
        console.log(result)
    } catch(e) {
        // do something
        console.log(e)
    }
    
    // get coin balance
    try {
        result = await api.getBalance("ETH")
        console.log(result)
        /* { balance: '0.0082000000',
            inLocked: '0.0000000000',
            inLockedFee: '0.0000000000',
            outLocked: '0.0800000000',
            outLockedFee: '0.0400000000' 
        }*/
    } catch(e) {
        // do something
        console.log(e)
    }
    
    // get all coin list
    try {
        result = await api.getAssets()
        console.log(result)
    } catch(e) {
        // do something
        console.log(e)
    }
    
    // withdraw
    try {
        let id = ''+new Date().valueOf()
        let coinType = 'ETH'
        let to = '0x56204b988844b20160035273fD98Dbb2A54C85F5'
        let value = '0.01'
        let memo = ''
        result = await api.withdraw(id, coinType, to, value, memo)
        console.log(result)
    } catch(e) {
        // do something
        console.log(e)
    }
    

    try {
        let id = ''+new Date().valueOf()
        let coinType = 'ATOM'
        let value = '0.06'
        result = await api.delegate(id, coinType, value)
        console.log(result)
    } catch(e) {
        // do something
        console.log(e)
    }

    try {
        let id = ''+new Date().valueOf()
        let coinType = 'ATOM'
        let value = '0.01'
        result = await api.undelegate(id, coinType, value)
        console.log(result)
    } catch(e) {
        // do something
        console.log(e)
    }
    
    // get a order info
    try {
        result = await api.getOrder("6reZqDxXwa2pBQ7AmV2K")
        console.log(result)
    } catch(e) {
        // do something
        console.log(e)
    }

    // get wallets' balance
    try {
        result = await api.getFundingWallets()
        console.dir(result, {depth: null})
    } catch(e) {
        // do something
        console.log(e)
    }

    // funding transfer
    try {
        const from = 'L6RayqPn4jXExW0'
        const to = 'e5dJyVp8R3B1m4o'
        const coinType = 'ETH'
        const value = '0.01'
        result = await api.fundingTransfer(from, to, coinType, value)
        console.log(result)
    } catch(e) {
        // do something
        console.log(e)
    }

    // get funding transfer records
    try {
        result = await api.getFundingRecords()
        console.log(result)
    } catch(e) {
        // do something
        console.log(e)
    }

    // add urgent staking funding
    try {
        let id = ''+new Date().valueOf()
        let coinType = 'ATOM'
        let value = '0.06'
        let expiredAt = parseInt(new Date().valueOf()/1000) + 86400 * 21
        result = await api.addUrgentStakingFunding(id, coinType, value, expiredAt)
        console.log(result)
    } catch(e) {
        // do something
        console.log(e)
    }
}

main()

订单通知示例:

{ id: '9J6NzaoL13lj85ZqE0YO',
  bizType: 'DEPOSIT',
  coinName: 'ATOM',
  type: 'ATOM',
  state: 'DONE',
  memo: '',
  value: '10.000000000000000000',
  fee: '0.000000000000000000',
  from: 'cosmos1z7jw2deueg37nd6v3flmn4wy2v3nhz55wyjqgk',
  to: 'cosmos1q0fskv7x737mx5ma7ts8n25l6tudf36jr2x2rl',
  txid: 'AF6660242D98767322E75B40A49CFDD3578D5AC02F52411B5FAD523AAB7F6E64',
  n: 0,
  block: -1,
  confirmations: 0,
  sign: '62d90927ce1fbdac2eeaf117facae55005678ed0016e3c57c0ca1148a027b570' 
}

License

MIT