0.1.1 • Published 9 months ago

@tensor-oss/ledger-solana-sdk v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

ledger-solana-sdk

NodeJS SDK for signing Solana txs with Ledger.

Installation

npm i '@tensor-oss/ledger-solana-sdk'
yarn add '@tensor-oss/ledger-solana-sdk'

Usage

import { PublicKey, Transaction } from "@solana/web3.js";
import {
    solanaDerivationPath,
    solanaLedgerSignTx,
    Transport,
} from "@tensor-oss/ledger-solana-sdk";

// Lookup addresses corresponding to account + change index
const change = undefined; // most wallets leave this as undefined.
const transport = await Transport.default.open(undefined);
for (let account = 0; account < 10; account++) {
  const deriv = solanaDerivationPath(account, change);
  const pubkey = new PublicKey(solanaLedgerGetPubkey(transport, deriv));
  console.log(`pubkey for account ${account}: ${pubkey.toBase58()}`);
}

// Sign tx
const tx = new Transaction().add(...);
const ledgerAddr = new PublicKey("...");
const ledgerAcc = ...; // From above
const ledgerChange = ...; // From above
await solanaLedgerSignTx({
    tx,
    signer: ledgerAddr,
    account: ledgerAcc,
    change: ledgerChange
});
0.1.1

9 months ago

0.1.0

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago