このページの内容
evmGetPublicKey
Ethereum: 公開鍵を取得
指定パスから導出した公開鍵を返します。showOnOneKey を使用すると、デバイス上での確認を要求できます。
const result = await HardwareSDK.evmGetPublicKey(connectId, deviceId, params);パラメーター
単一の公開鍵
path- 必須string | Array<number>SDK の最小長は3. 詳細を読むshowOnOneKey- 任意boolean公開鍵をデバイスに表示するかどうか。デフォルトはtrue.chainId- 任意numberETH の ChainId は、特定の Ethereum ネットワークを一意に識別し、ブロックチェーンの異なるバージョンを区別するための識別子です。 リファレンス .
複数の公開鍵
bundle-path,chainId,showOnOneKeyフィールドを持つオブジェクトの配列
例
最初の ethereum アカウントの公開鍵を返します:
HardwareSDK.evmGetPublicKey(connectId, deviceId, {
path: "m/44'/60'/0'/0/0",
showOnOneKey: true,
chainId: 1
});複数の ethereum アカウントの公開鍵をまとめて返します:
HardwareSDK.evmGetPublicKey(connectId, deviceId, {
bundle: [
{ path: "m/44'/60'/0'/0/0", chainId: 1 }, // account 1
{ path: "m/44'/60'/1'/0/0", chainId: 1 }, // account 2
{ path: "m/44'/60'/2'/0/0", chainId: 1 } // account 3
]
});結果
単一公開鍵のレスポンス
{
success: true,
payload: {
path: string, // serialized BIP32 path
xpub?: string, // xpub in legacy format
pub: string, // hexadecimal public key
publicKey: string, // alias of pub
}
}公開鍵のバッチレスポンス
{
success: true,
payload: [
{ path, xpub, pub }, // account 1
{ path, xpub, pub }, // account 2
{ path, xpub, pub }, // account 3
]
}エラー
{
success: false,
payload: {
error: string, // error message
code?: string | number // error code
}
}useBatch: true を指定した bundle リクエストでは、対応するバッチ処理は { path, pub, publicKey } を返し、xpub や node は返しません。通常の経路は拡張公開鍵とノードを返します。バッチレスポンスではこれらのフィールドを必須にしないでください。
最終更新日