2.0.1 • Published 1 year ago

@herajs/ledger-hw-app-aergo v2.0.1

Weekly downloads
26
License
MIT
Repository
github
Last release
1 year ago

Ledger Hardware Wallet Aergo JavaScript bindings

npm

How to use

npm install --save @herajs/ledger-hw-app-aergo

Getting address and signing transaction

import LedgerAppAergo from '@herajs/ledger-hw-app-aergo';
// Pick a transport. See https://github.com/LedgerHQ/ledgerjs
import Transport from '@ledgerhq/hw-transport-node-hid';
import AergoClient, { Tx } from '@herajs/client';

async () => {
    const aergo = new AergoClient();
    const transport = await Transport.create(3000, 1500);
    const app = new LedgerAppAergo(transport);
    const path = "m/44'/441'/0'/0/" + i;
    const address = await app.getWalletAddress(path);
    const tx = {
        from: address,
        to: address,
        chainIdHash: await aergo.getChainIdHash(),
        type: Tx.Type.TRANSFER,
        nonce: await aergo.getNonce(address) + 1,
        limit: 100000,
        nonce: 1,
    };
    const result = await app.signTransaction(tx); // { hash, signature }
    tx.sign = result.signature;
    tx.hash = await hashTransaction(tx, 'bytes');
    const txHash = await aergo.sendSignedTransaction(tx);
    const txReceipt = await aergo.waitForTransactionReceipt(txHash); // { status: 'SUCCESS', blockno: number, ... }
}()
2.0.1

1 year ago

2.0.0

1 year ago

1.2.0

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

0.21.1

3 years ago

0.21.0

4 years ago

0.20.8

4 years ago

0.20.7

4 years ago

0.20.6

4 years ago

0.20.5

4 years ago

0.20.4

4 years ago

0.20.3

4 years ago

0.20.0

4 years ago

0.19.8

4 years ago

0.19.7

4 years ago

0.19.5

4 years ago

0.19.6

4 years ago

0.19.4

4 years ago

0.19.3

4 years ago

0.19.1

4 years ago

0.19.2

4 years ago

0.19.0

4 years ago

0.18.2

4 years ago

0.18.1

4 years ago

0.18.0

4 years ago