Socket
Book a DemoInstallSign in
Socket

@coolwallets/icx

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coolwallets/icx

ICON (ICX) sdk for CoolWalletS

latest
npmnpm
Version
0.0.2
Version published
Weekly downloads
2
Maintainers
3
Weekly downloads
 
Created
Source

CoolWalletS ICX App

ICON API of CoolWalletS.

version

Install

npm install @coolwallets/icx

Usage

import cwsICX from '@coolwallets/icx'
const ICON = new cwsICX(transport, appPrivateKey, appId)

getAddress

Get address by address index.

const address = await ICON.getAddress(0)
console.log(address)

// hx76f46307b53686f2dd4a2c8ca2f22492e842c4bf

The address generated is compatible to BIP44 with account and change set to 0, which means calling getAddress(i) will get the address of folllowing BIP44 path:

m/44'/60'/0'/0/{i}

In the design of current hardware, we only support path m/44'/60'/0'/0/{i} for speed optimization. This might change in the future and we will then open a more general interface to deal with custom path.

signTransaction

Sign ICON Transaction. We suggest you to use Icon Official SDK to build an unsigned transaction.


const txObj = new IconBuilder.IcxTransactionBuilder()
    .from('hx76f46307b53686f2dd4a2c8ca2f22492e842c4bf')
    .to('hxe86b015c06145965931aff551d4958256a86226e')
    .value(IconAmount.of('0.023', IconAmount.Unit.ICX).toLoop())
    .stepLimit(IconConverter.toBigNumber(100000))
    .nid(IconConverter.toBigNumber(1))
    .version(IconConverter.toBigNumber(3))
    .timestamp(timestamp)
    .build();

// Returns raw transaction object
const rawTx = IconConverter.toRawTransaction(txObj);

// sign with address index 0
const signedTx = await ETH.signTransaction(rawTx, 0)

The signed transaction will be in form of Object, which you can use the official sdk to broadcast.

Keywords

icx

FAQs

Package last updated on 05 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts