CoolWalletS EOS App
EOS API of CoolWalletS.
![version](https://img.shields.io/npm/v/@coolwallets/eos)
Install
npm install @coolwallets/eos
Usage
import cwsEOS from '@coolwallets/eos';
const chainId = 'e70aaab8997e1dfce58fbfac80cbbb8fecec7b99cf982a9444273cbc64c41473';
const EOS = new cwsEOS(transport, appPrivateKey, appId, chainId);
The chain id is default to mainnet: aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906
.
Get EOS PublicKey
Before broadcasting a transaction, you may need to get the public keys from CoolWalletS and use them to crate a EOS account.
let rawPublicKey = cwsEOS.getPublicKey(0)
You have to use eosjs-ecc to convert the raw public key to the EOS-prefixed format.
import { PublicKey } from 'eosjs-ecc'
const EOSPublicKey = await PublicKey.fromHex(rawPublicKey).toString();
console.log(EOSPublicKey)
Sign Transaction
CoolWalletS currently only support signing transaction with single eos transfer action.
const tx = {
expiration: 1555921263,
ref_block_num: 25384,
ref_block_prefix: 3136891093,
max_net_usage_words: 0,
max_cpu_usage_ms: 0,
delay_sec: 0,
data: {
from: "coolbitxeos1",
to: "ilovechicago",
quantity: "0.0011 EOS",
memo: "no memo",
}
}
let signature = await cwsEOS.signTransaction(tx, 0)