ETHSignRequest
The EthSignRequest class handles Ethereum signing requests.
Used to send a signing request to the device.
enum DataType {
transaction = 1, // For the legacy transaction, the rlp encoding of the unsigned data.
typedData = 2, // For the EIP-712 typed data. Bytes of the json string.
personalMessage = 3, // For the personal message signing.
typedTransaction = 4 // For the typed transaction, like the EIP-1559 transaction.
}Parameters
requestId:BufferThe request ID. uuid randomsignData:BufferThe data to be signed.dataType:DataTypeThe type of signing data.chainId:numberThe chain ID. optionalderivationPath:CryptoKeypathThe derivation path.address:BufferThe address for request this signing. optionalorigin:stringSource of the request. optional
URL Example
UR:ETH-SIGN-REQUEST/ONADTPDAGDSWNNYAHGTOKPFPIAPANNROLNSAVYDTHHAOHDECAOWFLYLDLFAAUELPATAEGWSOLALPBAVYGUYTHNLFGMAYMWSGBYZOIYHTRDCFBANBFPBNDSPRJPNSDLGLBYIMJELTCNLNWZJLSEAEAELARTAXAAAACSLDAHTAADDYOEADLECSDWYKCSFNYKAEYKAEWKADWKAOCYTIZSYLCNSSDKGOCAEIP‑1559 transaction (high‑level)
import { KeystoneEthereumSDK } from '@keystonehq/keystone-sdk';
const eth = new KeystoneEthereumSDK();
const ur = eth.generateSignRequest({
requestId, // uuid string
signData: unsignedTxHex, // hex without 0x
dataType: 4, // typedTransaction
path: "m/44'/60'/0'/0/0",
xfp: '12345678',
chainId: 1,
origin: 'your-app',
});
// Encode UR into animated QR frames and displayLegacy transaction (high‑level)
const ur = eth.generateSignRequest({
requestId,
signData: unsignedLegacyHex,
dataType: 1, // transaction
path: "m/44'/60'/0'/0/0",
xfp: '12345678',
chainId: 1,
origin: 'your-app',
});EIP‑712 TypedData (high‑level)
const dataHex = Buffer.from(typedDataJson, 'utf8').toString('hex');
const ur = eth.generateSignRequest({
requestId,
signData: dataHex,
dataType: 2, // typedData
path: "m/44'/60'/0'/0/0",
xfp: '12345678',
origin: 'your-app',
});Message sign (high‑level)
const dataHex = Buffer.from(message, 'utf8').toString('hex');
const ur = eth.generateSignRequest({
requestId,
signData: dataHex,
dataType: 3, // personalMessage
path: "m/44'/60'/0'/0/0",
xfp: '12345678',
origin: 'your-app',
});Obtaining a signature requires viewing.
ETHSignatureLast updated
Was this helpful?