Skip to content

Commit

Permalink
Merge pull request #11 from tronprotocol/release/v1.1.3
Browse files Browse the repository at this point in the history
fix(ledger): fix LedgerError: too many bytes to encode
  • Loading branch information
unicornonea authored Feb 21, 2023
2 parents 2a7a9c0 + 5975533 commit 7e75214
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tronwallet-adapter",
"description": "wallet adapters for TRON blockchain",
"version": "1.1.2",
"version": "1.1.3",
"main": "index.js",
"sideEffects": false,
"private": true,
Expand All @@ -16,7 +16,7 @@
"author": "tronprotocol",
"license": "MIT",
"scripts": {
"nuke": "shx rm -rf packages/*/*/node_modules demos/**/node_modules node_modules pnpm-lock.yaml || true",
"nuke": "shx rm -rf packages/*/*/node_modules demos/**/node_modules node_modules || true",
"reinstall": "pnpm run nuke && pnpm install",
"clean": "pnpm --recursive run clean && shx rm -rf **/*.tsbuildinfo",
"ts": "pnpm run build:ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/adapters/ledger/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tronweb3/tronwallet-adapter-ledger",
"version": "1.1.2",
"version": "1.1.3",
"description": "Wallet adapter for the Ledger wallet.",
"keywords": [
"TRON",
Expand Down
11 changes: 10 additions & 1 deletion packages/adapters/ledger/src/LedgerWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,16 @@ export class LedgerWallet {
const index = this.selectedIndex;
const path = this.getPathForIndex(index);
await this.makeApp();
const signedResponse = await this.app!.signTransaction(path, transaction.raw_data_hex, []);
let signedResponse;
try {
signedResponse = await this.app!.signTransaction(path, transaction.raw_data_hex, []);
} catch (e: any) {
if (/Too many bytes to encode/.test(e.message)) {
signedResponse = await this.app!.signTransactionHash(path, transaction.txID);
} else {
throw e;
}
}
if (Array.isArray(transaction.signature)) {
if (!transaction.signature.includes(signedResponse)) transaction.signature.push(signedResponse);
} else {
Expand Down

0 comments on commit 7e75214

Please sign in to comment.