Skip to content

Commit

Permalink
Feat: add benfen chain (#383)
Browse files Browse the repository at this point in the history
* feat: add benfen chain

* fix: remove publickey, add benfen big data transaction

* fix: delete benfen skipForceUpdateCheck

* fix: delete support detection

* chore: delete unuse code

* fix: lint
  • Loading branch information
wabicai authored Nov 28, 2024
1 parent 50078eb commit 7c4ba81
Show file tree
Hide file tree
Showing 32 changed files with 828 additions and 39 deletions.
2 changes: 1 addition & 1 deletion packages/connect-examples/electron-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "hardware-example",
"productName": "HardwareExample",
"executableName": "onekey-hardware-example",
"version": "1.0.14",
"version": "1.0.15-alpha.0",
"author": "OneKey",
"description": "End-to-end encrypted workspaces for teams",
"main": "dist/index.js",
Expand Down
10 changes: 5 additions & 5 deletions packages/connect-examples/expo-example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "expo-example",
"version": "1.0.14",
"version": "1.0.15-alpha.0",
"scripts": {
"start": "CONNECT_SRC=https://localhost:8087/ yarn expo start --dev-client",
"android": "yarn expo run:android",
Expand All @@ -19,10 +19,10 @@
"@noble/ed25519": "^2.1.0",
"@noble/hashes": "^1.3.3",
"@noble/secp256k1": "^1.7.1",
"@onekeyfe/hd-ble-sdk": "^1.0.14",
"@onekeyfe/hd-common-connect-sdk": "^1.0.14",
"@onekeyfe/hd-core": "^1.0.14",
"@onekeyfe/hd-web-sdk": "^1.0.14",
"@onekeyfe/hd-ble-sdk": "^1.0.15-alpha.0",
"@onekeyfe/hd-common-connect-sdk": "^1.0.15-alpha.0",
"@onekeyfe/hd-core": "^1.0.15-alpha.0",
"@onekeyfe/hd-web-sdk": "^1.0.15-alpha.0",
"@onekeyfe/react-native-ble-plx": "3.0.0",
"@polkadot/util-crypto": "13.1.1",
"@react-native-async-storage/async-storage": "1.21.0",
Expand Down
5 changes: 5 additions & 0 deletions packages/connect-examples/expo-example/src/data/allnetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ const api: PlaygroundProps[] = [
path: "m/44'/784'/0'/0'/0'",
showOnOneKey: false,
},
{
network: 'benfen',
path: "m/44'/728'/0'/0'/0'",
showOnOneKey: false,
},
{
network: 'tron',
path: "m/44'/195'/0'/0/0",
Expand Down
113 changes: 113 additions & 0 deletions packages/connect-examples/expo-example/src/data/benfen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import { type PlaygroundProps } from '../components/Playground';

const api: PlaygroundProps[] = [
{
method: 'benfenGetAddress',
description: 'Get address',
presupposes: [
{
title: 'Get address',
value: {
path: "m/44'/728'/0'/0'/0'",
showOnOneKey: false,
},
},
{
title: 'Batch Get Address',
value: {
bundle: [
{
path: "m/44'/728'/0'/0'/0'",
showOnOneKey: false,
},
{
path: "m/44'/728'/1'/0'/0'",
showOnOneKey: false,
},
{
path: "m/44'/728'/2'/0'/0'",
showOnOneKey: false,
},
],
},
},
],
},
{
method: 'benfenGetPublicKey',
description: 'Get PublicKey',
presupposes: [
{
title: 'Get PublicKey',
value: {
path: "m/44'/728'/0'/0'/0'",
showOnOneKey: false,
},
},
{
title: 'Batch Get PublicKey',
value: {
bundle: [
{
path: "m/44'/728'/0'/0'/0'",
showOnOneKey: false,
},
{
path: "m/44'/728'/1'/0'/0'",
showOnOneKey: false,
},
{
path: "m/44'/728'/2'/0'/0'",
showOnOneKey: false,
},
],
},
},
],
},
{
method: 'benfenSignMessage',
description: 'Sign Message',
presupposes: [
{
title: 'Sign Message',
value: {
path: "m/44'/728'/0'/0'/0'",
// hello, world 的hex 格式
messageHex: '48656c6c6f2c20576f726c6421',
},
},
],
},
{
method: 'benfenSignTransaction',
description: 'Sign Transaction',
presupposes: [
{
title: 'Sign Transaction',
value: {
path: "m/44'/728'/0'/0'/0'",
rawTx:
'0x00000000000200088096980000000000002017f3a9bd36da0639153d3c38032217ea298eb1991e0a62cc5924e2dd712937350202000101000001010300000000010100b4ced58018b75d7ba72a10fa97c09b7bf66533ff104bf9db1bfdb004b17d8eaa0183006eb3c5499c3cb4b022f20955f387312ed312389c552fa39e35d6423d0c74f785b7000000000020497f41fdfb22d2ae32111dcdc21c16d27f48f47b7ca7aba240b684db5ca74c0fb4ced58018b75d7ba72a10fa97c09b7bf66533ff104bf9db1bfdb004b17d8eaa640000000000000060ad38000000000000',
// coinType: '3078323a3a6266633a3a424643',
// coinType:'42464330303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030306338653330613a3a627573643a3a42555344'
// coinType:'42464330303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030306338653330613a3a626a70793a3a424a5059'
// coinType:'42464337303263306439363736386366353964323563396462616532313862303637386665316565353939616637613234333766373737306465643735326439613161333930393a3a6c6f6e673a3a4c4f4e47'
coinType:
'42464364393037326533366563626136336236306437323439373832393636373736303162313637316336303639336166333466373761383665663934643637643165383231303a3a62665f757364633a3a42465f55534443',
},
},
{
title: 'Sign Transaction(Big 7K)',
value: {
path: "m/44'/728'/0'/0'/0'",
coinType: '3078323a3a6266633a3a424643',
rawTx:
'0000000000340100027e179b5d888d95a9852e5503dd0730ab78f35412c9065f7df1c5c3acd874a0e273b9000000000020793e8072a90e63db0efa50b37834671aed7640c10bfa01994d0363679d5bf11501000358128f4617c9cf8446cc597b0b34c34ade63f3d0709c8ab088de66f14a496de273b90000000000209ebfc4f3eafd4065ea2c3e9ed775335e96ae04e6ae8706aa5537b508ee3492c8010004009983de3452c5876fed1eb2e4c5280dc650b76d852301b20ec0e92972dfa4e273b9000000000020530b7457e63ba4bab6845836f937813ab3d8b5ce16d194a5ab6fdb8fcd3067840100042f3df005ddedf662428dd90c5e673be607e9c21b4b4250c51b46ceb81c8412e273b9000000000020d5fde14f91325f4d6a19dce5f6707947eea55fcbac92a011405f89ac54c79b3b010005d298d667e608d100ebba1ae5f4972e0c9f3c1f6c72dc44c42890ffd3f938a6e273b9000000000020237b4fa3c15ac6719a08afb4ecb86a8ecd407cc4f31a4204f498c97f461b34a001000698cbcbc5ea23f2bacd1e13d3354fa618069fa718268c15b7fd8f71171364fce273b9000000000020d033e3f0583e1a8b24fbb56a3c6ecc83af490abcdbd1ff994825884ee302751001000b33a803b5f130a75abb315f442298de353aa42c601d0e4b9adfda9b38dbfb81e273b90000000000207c06ff991eba0ae44e21322756aaffef2c1338099556cefb0d68b7bf589475c501000c9e5bf27ccc253d1efab83a71effa3b861f364a889b224e133c5ca793038fabe273b90000000000203e0d9f4c3700bd9a6cf8296b9450b7916a932f21faa1c0d7eb50d79a3d36feee01000e1f77b40a60207d1581c2e1fd8e86b7c01971d0e63aa1a667388eae70ee68d2e273b9000000000020895c6c7d89a13c0d83f7fa8586b047bda112717f2852c1cc48a1f43141a1b56901000f226eab7f4b603c678ed99f535b2f19046c070e86f7d642f1b51bb6b482504ae273b9000000000020bff05f3301abdcd654a18cf5840e0fb2fd6c40f09ff3319c4071422aafc43c190100128faa41a63dd4f06713011be96438c77374ad64e98aaf1de209103f310442aae273b9000000000020fc4d72254ecd63aaf55c2c8de8dec8c96864705dd0f8bb1646702bf550ae3685010013dac3b35caa38198b2d8e718b875002fe8c0281bd843bbba0a36fb75ae102a0e273b9000000000020f2a3538920917503a54569fb2746c299b9e3f2ffe4584b011263efd99d8b4c87010015789455d7b055ecdfb5829fb61d403853c27638b81caf487ded28c8f6996273e273b9000000000020bb3d0ee3786a7117f7d27b89f9254c1ebf2a7fd2332ff8f44d4a7a17332092d4010015b5f497001ef7bb58bb6979c1b6ab4616d33ff217fd11ba14c91ef446bb473fe273b90000000000201d17f049ddffe45a186ba982c2edadc075b073d6cfa762c018f7a4a53d41ea0b010015e3f573e6342a7cbaf55bada270589ebf4d2510436209e794e537315a18ad9be273b9000000000020b577d4d1771c5c80811a422d4476e5048c5c28536894c64a99ca9f9e33c5bb9301001623a6b745769cf9655ea2076671c32b76e71802b410d0ddfe84dda7082acc5de273b9000000000020e444e22d3cea6691cc7a79e83127e82bb5857925d80fbf786f513688531dd01f0100186cb833953d0e691b11701aec483fab4b40234d65c831b3086166ce824dc0b3e273b900000000002043bb814ae1fc409ec1ee06c9e6b60ced084b50146f7ef06af4595157143800f70100212f3db5c4979cbb9bd8ebbada41814cf00776380c15dc1ec4e34f9c6b7dc563e273b90000000000201a4d27ee8ace85f9939ed3896e7774eb858056275d08c3dc333aed6319a8b3030100293e3fcacfb6d605c28408f3498df2271d99e289168d2f3599e6d97274377c4ce273b90000000000206a26e8cf00d7941424b111bf98790d4056d9b2d5d1c9fa72e7bda61041b6321301002952997d8174dcdd166685c031cac390e799a3ceda17e4ea817ce514fadc555ce273b90000000000204725ba6978cdc83f353dcdd9c15015011e0f11828bd6540abe313649776fae3e01002b3b3797d15b9852828d908603056fa5a80cb00b1da6ed0c4645ad1bd3a3d6b6e273b9000000000020fcff637e481a0bbdcecfec84290f2e23b531cca2bb661a73e69de16e28c5e23a01002c221e14b6533b4162babe18f963de27006e321eea4f9205251c4795d373170fe273b9000000000020028a00e881a3f32438ae753df6810b91a90d19f9a941033d3a9fb5468cb9de8801002da1ee19f20a5ea20d5d9ea102d813d0c933aac2ac9b3e2800f9aca093cd36fbe273b9000000000020004b4fb4c2f1f4348f96b64e6c90779af3a5ecbecc5bf98b849e5726394e83e701002fe45725a5ecd03e32ab4d757be0eaca09efa69acf304aa51141b2905dbd974fe273b9000000000020fe2759c7921d88e8d097c7800d6c69a33f012a114a7e0e9f0e4f9eaf0456142101003574ba403edcabd7a9d7c0863e1114a663d671a9c8d1fab1f84e876e377175eee273b90000000000203b300da63687034548e825b85eebc16478736da946a7ede0999c8c257399094b010035a91b4e477dae85fb1e37de096ef59c89c983f3a4c438da5dae39d1ab2d2b1be273b9000000000020672302b843ba690de34b519db7ff770978c4376b49d7c8c7f489fe5b85ceec59010038bb12f11c9e6447214277ad0f248f284faf5d44e86729bf6c2fcbad12713702e273b900000000002021913542bc4fea33b764664135e03b0015b91507c761af3bfb6af9737334742f0100474e05d02af596bcdf82ca2b86c186d2969bb8c18aebcf01a9080a9a3bb90574e273b900000000002026d26d0ea7b84a03e79e478eec1dee75423617660d01d6d25c7251ff27f1724e010049925c1511bd7fc50f00165000259f1b1da15eb8c3e3884055874fc5beea90f6e273b9000000000020e7a587f8263b1b57d5da4c261957de77636b6e2804fc0e225f2f6209202b2f9201004bf4b3524d31425d1d6d433bfc3f253e79fdac086b6fb48846bbffc7f25d035de273b9000000000020442c0ca1bc3e28862fd903ccaea3b99b4f1a450c6b3717a594259c0fe960693401004e472d7321d02ba73ec083f0a643839ed0165f46bf54b0b25876f0a7a3af3b08e273b9000000000020ee36bccf8c285ef88e3bbd98502f6b49390cfd1aad8255d1de01654691bd5b00010052e063cd1118874019aac418672f65a27d06e017bd62082e21320071247f009ce273b9000000000020225869d4ba6d33b960420ae129da71525cdb41eb8801a857e1f975f167381d9301005366bd23401ed7c877e6485d4d8ab449cefc22c4d496dc791b55d44cb66e8c91e273b90000000000201f25937e0bf0437dcab239a9f25d5e5aae8f657d38c28dc0cca73bc5e4e656ac0100568ba56d14dd9213727bd02885cfd259c7ef945d49411dddd0b3a859d88eb5ade273b900000000002053d638e8aa16ebb81725453faa18f3354d1d61dedcec63134a05672e7d6700980100585191234b8949f3747b39513c0a23065f325137ab617888e52532683c148ec2e273b9000000000020f859811059a1f247b54893ba47811fd6c0898e73fb194b848e9bb603238a402b01005e83f4463ffab97d063a57e105b780cdfd47c7661dfc404ffbe67df0f08589f5e273b90000000000205958a0e72bacd618b93a6c9759f91471d734c8a82e86e79a3fc9ae5c3cc3ab4501005f9ab3544276860e67fc5abc413b8efdab6b2c5bb50d1c012d1fef0ce775e802e273b9000000000020da0f17909301e4615157f84dfee88fa5a3beefffaaca82c29f7b34e9706f9f37010060a9c9cdc052f1b11eb294d3bd401c092e457cd87942a3c4e226eae035862f5de273b9000000000020a3f19cfa4642881c8115cab006f98a736da24bfc7644a9e69dc04769a9ab03bd0100634d47cb70bb95d50dcbbf3925664ffce3add3de12d3528f8f99b7a1968df99de273b90000000000201f33640c725bc3bcbe3db47a4faf99d82c4017086f684d805aaa8fa50f778ac7010063d08ebe3ae73d0de9488f68a509f7c431416a943624bea4812c89347dacc3a7e273b900000000002006aa44f56271039f32cdaec4881ae45c0b9946c8ae6346b8258458480f80b3d301006b8ae976f5a425ae0c042ac3e1b8cb318a19933a1e60e04901f9b1486a66c552e273b900000000002061d7db3d1e7fe7bdcf58dbbe92c554246d67ee406bcbb2a6e0b0e40445392b8101006c0f706931d5da9f19e23412c425fbdea70e5b3416f1e2210f283c3347d9f8fee273b90000000000209a63f2e6ea804fa307cdf5ca1faf212fcdd4a5f45a731711c45669a40dc3d7aa010071685038f12b2cdda527521b6227b1e4ea5bf37a64e5e8afeac03db00ddd010be273b9000000000020138206a1bcdf4614f38ecd4b1110368f8a0f957961f346c8762a9c9d45a755800100745d53ec4e5d31d368f3e1873ef1566bd8c4eda89975e198461bbb797a1e48f9e273b9000000000020b5276852c344be0a47b1ba32b5007bba018b247d91a7614484fea181d423665e0100746b5c4732a096773985e3e4ea043757bb30afd09175cc185ca97686f27bff7be273b9000000000020650c9d4b2ff086f6e9027a126007b235789833da5734c2a3a6cb36e294ca1911010076ec74eba40aacd18446c95459ad8a8a7125106bd0ecb237eaf26152be5d5f21e273b9000000000020cff4549a2e23ecba7c0db3b51c744712429ad4901689abf145737c377ee40189010078be0fd6761aca67fcd1a6e3efe0b57665628908b2496619a3bbad85a3ab5a87e273b9000000000020168c57e1f6aede8d9fe2b1c6bbb832e29e5f1d8149ff79e6e40e92f17efb29f0010079cdd7bdca5cc6da211db3c479edc3ef0b8d551d7ddc6b7fd78494413ff5ed49e273b90000000000204474d30207b91fb6eca9b9c233a7087d8b4e7855768d1e76c48c33c0f64b9faf0100020189fad2c9fe78631fd61eb5c980ca6714bb5c1315fa406991fa10b69baed3e173b9000000000020bda2eb813d1e942886398e77db0dd860f7e769daf38fc9030870d4bddbdfc4b100080a00000000000000010000b800b7fef1f3c18eeac265b8eebee9e65bee6ee435af02453bf39b58a8f452e273b9000000000020e1b441b0b5b4cdaf46f7acba2b7e0262620fd5b2ceb6e2ca7ef9d45cbb47e3c1002017f3a9bd36da0639153d3c38032217ea298eb1991e0a62cc5924e2dd71293735030301300030010000010100010200010300010400010500010600010700010800010900010a00010b00010c00010d00010e00010f00011000011100011200011300011400011500011600011700011800011900011a00011b00011c00011d00011e00011f00012000012100012200012300012400012500012600012700012800012900012a00012b00012c00012d00012e00012f00020132000101310001010301000000013300b4ced58018b75d7ba72a10fa97c09b7bf66533ff104bf9db1bfdb004b17d8eaa0183006eb3c5499c3cb4b022f20955f387312ed312389c552fa39e35d6423d0c74e273b90000000000208c1c43b2ac96240becd2db8f69b348109a0cf3604af4ac2bbf1d43e88d1196deb4ced58018b75d7ba72a10fa97c09b7bf66533ff104bf9db1bfdb004b17d8eaa6400000000000000004461000000000000',
},
},
],
},
];

export default api;
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ const playgroundConfig = [
title: 'Bitcoin API',
data: require('../data/bitcoin').default,
},
{
title: 'Benfen API',
data: require('../data/benfen').default,
},
{
title: 'Ethereum API',
data: require('../data/ethereum').default,
Expand Down
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onekeyfe/hd-core",
"version": "1.0.14",
"version": "1.0.15-alpha.0",
"description": "> TODO: description",
"author": "OneKey",
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
Expand All @@ -25,8 +25,8 @@
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
},
"dependencies": {
"@onekeyfe/hd-shared": "^1.0.14",
"@onekeyfe/hd-transport": "^1.0.14",
"@onekeyfe/hd-shared": "^1.0.15-alpha.0",
"@onekeyfe/hd-transport": "^1.0.15-alpha.0",
"axios": "^0.27.2",
"bignumber.js": "^9.0.2",
"bytebuffer": "^5.0.1",
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/api/allnetwork/AllNetworkGetAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ const networkConfigMap: NetworkConfigMap = {
sui: {
methodName: 'suiGetAddress',
},
benfen: {
methodName: 'benfenGetAddress',
},
fil: {
methodName: 'filecoinGetAddress',
getParams: (baseParams: AllNetworkAddressParams, chainName?: string) => {
Expand Down
119 changes: 119 additions & 0 deletions packages/core/src/api/benfen/BenfenGetAddress.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import { BenfenGetAddress as HardwareBenfenGetAddress } from '@onekeyfe/hd-transport';

import { BaseMethod } from '../BaseMethod';
import { validateParams, validateResult } from '../helpers/paramsValidator';
import { serializedPath, validatePath } from '../helpers/pathUtils';
import { UI_REQUEST } from '../../constants/ui-request';
import { publicKeyToAddress } from './normalize';
import { BenfenAddress, BenfenGetAddressParams } from '../../types';
import { supportBatchPublicKey } from '../../utils/deviceFeaturesUtils';

export default class BenfenGetAddress extends BaseMethod<HardwareBenfenGetAddress[]> {
hasBundle = false;

shouldConfirm = false;

init() {
this.checkDeviceId = true;
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];

this.hasBundle = !!this.payload?.bundle;
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };

this.shouldConfirm =
this.payload.showOnOneKey ||
this.payload.bundle?.some((i: BenfenGetAddressParams) => !!i.showOnOneKey);

validateParams(payload, [{ name: 'bundle', type: 'array' }]);

this.params = [];
payload.bundle.forEach((batch: BenfenGetAddressParams) => {
const addressN = validatePath(batch.path, 3);

validateParams(batch, [
{ name: 'path', required: true },
{ name: 'showOnOneKey', type: 'boolean' },
]);

const showOnOneKey = batch.showOnOneKey ?? true;

this.params.push({
address_n: addressN,
show_display: showOnOneKey,
});
});
}

getVersionRange() {
return {
model_touch: {
min: '4.10.3',
},
};
}

async run() {
const supportsBatchPublicKey = supportBatchPublicKey(this.device?.features);
let responses: BenfenAddress[] = [];

if (supportsBatchPublicKey) {
const publicKeyRes = await this.device.commands.typedCall(
'BatchGetPublickeys',
'EcdsaPublicKeys',
{
paths: this.params,
ecdsa_curve_name: 'ed25519',
}
);

for (let i = 0; i < this.params.length; i++) {
const param = this.params[i];
const publicKey = publicKeyRes.message.public_keys[i];
let address: string;

if (this.shouldConfirm) {
const addressRes = await this.device.commands.typedCall(
'BenfenGetAddress',
'Address',
param
);
address = addressRes.message.address?.toLowerCase() ?? '';
} else {
address = publicKeyToAddress(publicKey);
}

const result = {
path: serializedPath(param.address_n),
address,
pub: publicKey,
};

if (this.shouldConfirm) {
this.postPreviousAddressMessage(result);
}

responses.push(result);
}
} else {
responses = await Promise.all(
this.params.map(async param => {
const res = await this.device.commands.typedCall('BenfenGetAddress', 'Address', param);
const result = {
path: serializedPath(param.address_n),
address: res.message.address?.toLowerCase() ?? '',
};
if (this.shouldConfirm) {
this.postPreviousAddressMessage(result);
}
return result;
})
);
}

validateResult(responses, ['address'], {
expectedLength: this.params.length,
});

return this.hasBundle ? responses : responses[0];
}
}
64 changes: 64 additions & 0 deletions packages/core/src/api/benfen/BenfenGetPublicKey.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { BaseMethod } from '../BaseMethod';
import { validateParams, validateResult } from '../helpers/paramsValidator';
import { serializedPath, validatePath } from '../helpers/pathUtils';
import { UI_REQUEST } from '../../constants/ui-request';
import { BenfenPublicKey, BenfenGetPublicKeyParams } from '../../types';

export default class BenfenGetPublicKey extends BaseMethod<any> {
hasBundle = false;

init() {
this.checkDeviceId = true;
this.notAllowDeviceMode = [...this.notAllowDeviceMode, UI_REQUEST.INITIALIZE];

this.hasBundle = !!this.payload?.bundle;
const payload = this.hasBundle ? this.payload : { bundle: [this.payload] };

validateParams(payload, [{ name: 'bundle', type: 'array' }]);

this.params = [];
payload.bundle.forEach((batch: BenfenGetPublicKeyParams) => {
const addressN = validatePath(batch.path, 3);

validateParams(batch, [
{ name: 'path', required: true },
{ name: 'showOnOneKey', type: 'boolean' },
]);

const showOnOneKey = batch.showOnOneKey ?? true;

this.params.push({
address_n: addressN,
show_display: showOnOneKey,
});
});
}

getVersionRange() {
return {
model_touch: {
min: '4.10.3',
},
};
}

async run() {
const res = await this.device.commands.typedCall('BatchGetPublickeys', 'EcdsaPublicKeys', {
paths: this.params,
ecdsa_curve_name: 'ed25519',
});

const responses: BenfenPublicKey[] = res.message.public_keys.map(
(publicKey: string, index: number) => ({
path: serializedPath((this.params as any[])[index].address_n),
pub: publicKey,
})
);

validateResult(responses, ['pub'], {
expectedLength: this.params.length,
});

return Promise.resolve(this.hasBundle ? responses : responses[0]);
}
}
Loading

0 comments on commit 7c4ba81

Please sign in to comment.