@ledgerhq/hw-app-helium
Version:
Ledger Hardware Wallet Helium Application API
151 lines • 5.09 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
import Transport from "@ledgerhq/hw-transport";
import { PaymentV2, SecurityExchangeV1, StakeValidatorV1, TokenBurnV1, TransferValidatorStakeV1, UnstakeValidatorV1 } from "@helium/transactions";
/**
* Helium API
*
* @param transport a transport for sending commands to a device
* @param scrambleKey a scramble key
*
* @example
* import Helium from "@ledgerhq/hw-app-helium";
* const helium = new Helium(transport);
*/
export default class Helium {
private transport;
constructor(transport: Transport, scrambleKey?: string);
/**
* Get application version.
*
* @returns version object
*
* @example
* helium.getVersion().then(r => r.version)
*/
getVersion(): Promise<{
version: string;
}>;
/**
* Get Helium address (public key) for a BIP32 path.
*
* @param path a BIP32 path
* @param display flag to show display
* @param accountIndex index of account address
* @returns an object with the address field
*
* @example
* helium.getAddress("44'/904'/0'/0'/0'").then(r => r.address)
*/
getAddress(path: string, display?: boolean, accountIndex?: number): Promise<{
index: number;
address: string;
publicKey: string;
}>;
/**
* Sign a Helium `PaymentV2` transaction.
*
* @param txn a PaymentV2 transaction
* @param accountIndex index of account address
*
* @returns an object with the signed transaction and signature
*
* @example
* import { PaymentV2 } from '@helium/transactions'
* const txn = new PaymentV2({ ... })
* helium.signTransaction(txn).then(r => r.signature)
*/
signPaymentV2(txn: PaymentV2, accountIndex?: number): Promise<{
signature: Buffer;
txn: PaymentV2;
}>;
/**
* Sign a Helium `TokenBurnV1` transaction.
*
* @param txn a TokenBurnV1 transaction
* @param accountIndex index of account address
*
* @returns an object with the signed transaction and signature
*
* @example
* import { TokenBurnV1 } from '@helium/transactions'
* const txn = new TokenBurnV1({ ... })
* helium.signTransaction(txn).then(r => r.signature)
*/
signTokenBurnV1(txn: TokenBurnV1, accountIndex?: number): Promise<{
signature: Buffer;
txn: TokenBurnV1;
}>;
/**
* Sign a Helium `StakeValidatorV1` transaction.
*
* @param txn a StakeValidatorV1 transaction
* @param accountIndex index of account address
*
* @returns an object with the signed transaction and signature
*
* @example
* import { StakeValidatorV1 } from '@helium/transactions'
* const txn = new StakeValidatorV1({ ... })
* helium.signTransaction(txn).then(r => r.signature)
*/
signStakeValidatorV1(txn: StakeValidatorV1, accountIndex?: number): Promise<{
signature: Buffer;
txn: StakeValidatorV1;
}>;
/**
* Sign a Helium `UnstakeValidatorV1` transaction.
*
* @param txn a UnstakeValidatorV1 transaction
* @param accountIndex index of account address
*
* @returns an object with the signed transaction and signature
*
* @example
* import { UnstakeValidatorV1 } from '@helium/transactions'
* const txn = new UnstakeValidatorV1({ ... })
* helium.signTransaction(txn).then(r => r.signature)
*/
signUnstakeValidatorV1(txn: UnstakeValidatorV1, accountIndex?: number): Promise<{
signature: Buffer;
txn: UnstakeValidatorV1;
}>;
/**
* Sign a Helium `TransferValidatorStakeV1` transaction.
*
* @param txn a TransferValidatorStakeV1 transaction
* @param ownerType whether to sign as the old or new owner in the transfer
* @param accountIndex index of account address
*
* @returns an object with the signed transaction and signature
*
* @example
* import { TransferValidatorStakeV1 } from '@helium/transactions'
* const txn = new TransferValidatorStakeV1({ ... }, 'old')
* helium.signTransaction(txn).then(r => r.signature)
*/
signTransferValidatorStakeV1(txn: TransferValidatorStakeV1, ownerType: "old" | "new", accountIndex?: number): Promise<{
signature: Buffer;
txn: TransferValidatorStakeV1;
}>;
/**
* Sign a Helium `SecurityExchangeV1` transaction.
*
* @param txn a SecurityExchangeV1 transaction
* @param accountIndex index of account address
*
* @returns an object with the signed transaction and signature
*
* @example
* import { SecurityExchangeV1 } from '@helium/transactions'
* const txn = new SecurityExchangeV1({ ... })
* helium.signTransaction(txn).then(r => r.signature)
*/
signSecurityExchangeV1(txn: SecurityExchangeV1, accountIndex?: number): Promise<{
signature: Buffer;
txn: SecurityExchangeV1;
}>;
private sendToDevice;
private throwOnFailure;
}
//# sourceMappingURL=Helium.d.ts.map