Skip to content

Commit

Permalink
Merge pull request #116 from Zondax/update-peaq
Browse files Browse the repository at this point in the history
Update peaq
  • Loading branch information
chcmedeiros authored Jul 12, 2024
2 parents 607b781 + e09c0ea commit cc988ae
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const enum SCHEME {
* @deprecated This is deprecated and will be removed in future versions.
*/
SR25519 = 0x01,
ECDSA = 0x02,
}

export const enum ERROR_CODE {
Expand Down
9 changes: 7 additions & 2 deletions src/substrate_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,14 @@ export class SubstrateApp implements ISubstrateAppLegacy {
const errorCodeData = response.subarray(-2)
const errorCode = errorCodeData[0] * 256 + errorCodeData[1]

let pubkeyLen = 32
if (scheme == SCHEME.ECDSA) {
pubkeyLen = 33
}

return {
pubKey: response.subarray(0, 32).toString('hex'),
address: response.subarray(32, response.length - 2).toString('ascii'),
pubKey: response.subarray(0, pubkeyLen).toString('hex'),
address: response.subarray(pubkeyLen, response.length - 2).toString('ascii'),
return_code: errorCode,
error_message: errorCodeToString(errorCode),
}
Expand Down
2 changes: 1 addition & 1 deletion src/supported_apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ export const supportedApps: SubstrateAppParams[] = [
{
name: 'Peaq',
cla: 0x61,
slip0044: 0x80000d0a,
slip0044: 0x8000003c,
ss58_addr_type: 42,
},
]

0 comments on commit cc988ae

Please sign in to comment.