Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 7e75214

Browse files
authored
Merge pull request #11 from tronprotocol/release/v1.1.3
fix(ledger): fix LedgerError: too many bytes to encode
2 parents 2a7a9c0 + 5975533 commit 7e75214

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "tronwallet-adapter",
33
"description": "wallet adapters for TRON blockchain",
4-
"version": "1.1.2",
4+
"version": "1.1.3",
55
"main": "index.js",
66
"sideEffects": false,
77
"private": true,
@@ -16,7 +16,7 @@
1616
"author": "tronprotocol",
1717
"license": "MIT",
1818
"scripts": {
19-
"nuke": "shx rm -rf packages/*/*/node_modules demos/**/node_modules node_modules pnpm-lock.yaml || true",
19+
"nuke": "shx rm -rf packages/*/*/node_modules demos/**/node_modules node_modules || true",
2020
"reinstall": "pnpm run nuke && pnpm install",
2121
"clean": "pnpm --recursive run clean && shx rm -rf **/*.tsbuildinfo",
2222
"ts": "pnpm run build:ts",

packages/adapters/ledger/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tronweb3/tronwallet-adapter-ledger",
3-
"version": "1.1.2",
3+
"version": "1.1.3",
44
"description": "Wallet adapter for the Ledger wallet.",
55
"keywords": [
66
"TRON",

packages/adapters/ledger/src/LedgerWallet.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,16 @@ export class LedgerWallet {
191191
const index = this.selectedIndex;
192192
const path = this.getPathForIndex(index);
193193
await this.makeApp();
194-
const signedResponse = await this.app!.signTransaction(path, transaction.raw_data_hex, []);
194+
let signedResponse;
195+
try {
196+
signedResponse = await this.app!.signTransaction(path, transaction.raw_data_hex, []);
197+
} catch (e: any) {
198+
if (/Too many bytes to encode/.test(e.message)) {
199+
signedResponse = await this.app!.signTransactionHash(path, transaction.txID);
200+
} else {
201+
throw e;
202+
}
203+
}
195204
if (Array.isArray(transaction.signature)) {
196205
if (!transaction.signature.includes(signedResponse)) transaction.signature.push(signedResponse);
197206
} else {

0 commit comments

Comments
 (0)