@keystonehq/hw-app-sol
v0.1.1
Published
Keystone Hardware Wallet Solana JavaScript bindings. this package is compitiable with Ledger js solana sdk on the api level.
Downloads
1,333
Readme
@keystonehq/hw-app-solana
Keystone Hardware Wallet Solana JavaScript bindings. this package is compitiable with Ledger js solana sdk on the api level.
API
Table of Contents
constructor
Constructs a new instance of the class.
Parameters
transportTransportWebUSB An object of type TransportWebUSBmfpstring? Optional parameter of type string, default is undefined, but the mfp should exist in the signing process.
getAddress
Retrieves the public key (address) for a given derivation path from the hardware device.
This method sends a request to the connected hardware device to derive the public key for the specified path using the ED25519 curve and SLIP-10 derivation algorithm. It also updates the master fingerprint (mfp) of the instance.
Parameters
pathstring The derivation path for the desired public key, e.g., "m/44'/501'/0'"dislayboolean A boolean flag to indicate whether to display the address on the device (not used in current implementation due to compitable with ledger js sdk) (optional, defaultfalse)
Examples
solana.getAddress("44'/501'/0'").then(r => r.address)- Throws any Will throw an error if the device communication fails or if the response is incomplete
Returns Promise<{address: Buffer, mfp: string}> A Promise that resolves to an object containing: - address: A Buffer containing the derived public key - mfp: A string representing the master fingerprint of the wallet
signTransaction
Signs a Solana transaction using the specified derivation path.
This method sends the transaction to the hardware device for signing using the private key derived from the given path.
Parameters
pathstring The derivation path of the private key to use for signing, e.g., "m/44'/501'/0'/0'"txBufferBuffer A Buffer containing the serialized transaction to be signed
Examples
solana.signTransaction("44'/501'/0'", txBuffer).then(r => r.signature)- Throws any Will throw an error if the signing process fails or if the device is not properly initialized
Returns Promise<{signature: Buffer}> A Promise that resolves to an object containing: - signature: A Buffer containing the transaction signature
signOffchainMessage
Signs an off-chain message using the specified derivation path.
This method sends the message to the hardware device for signing using the private key derived from the given path.
Parameters
pathstring The derivation path of the private key to use for signing, e.g., "m/44'/501'/0'"msgBufferBuffer A Buffer containing the off-chain message to be signed
- Throws any Will throw an error if the signing process fails or if the device is not properly initialized
Returns Promise<{signature: Buffer}> A Promise that resolves to an object containing: - signature: A Buffer containing the message signature
getAppConfig
Retrieves the configuration information of the connected hardware device.
This method sends a request to the device to get its version information, then parses the response to extract the firmware version and wallet master fingerprint.
- Throws any Will throw an error if the device communication fails or if the response cannot be parsed
Returns Promise<any> A Promise that resolves to an object containing: - version: A string representing the firmware version of the device - mfp: A string representing the master fingerprint of the wallet
