Skip to content

Commit

Permalink
fix: code overflow (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelplex authored Jun 24, 2024
1 parent 4a705d1 commit e87aa04
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Added support for scripts in subdirectories, for example `scripts/counter/deploy.ts`

### Fixed

- Fixed `code overflow` error when generating QR code for ton:// link

## [0.21.0] - 2024-05-27

### Changed
Expand Down
23 changes: 17 additions & 6 deletions src/network/send/DeeplinkProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,24 @@ export class DeeplinkProvider implements SendProvider {
stateInit ? beginCell().storeWritable(storeStateInit(stateInit)).endCell() : undefined,
);

this.#ui.write('\n');
qrcode.generate(deepLink, { small: true }, (qr) => this.#ui.write(qr));
this.#ui.write('\n');
this.#ui.write(deepLink);
this.#ui.write('\nScan the QR code above, or open the ton:// link to send this transaction');
try {
this.#ui.write('\n');
qrcode.generate(deepLink, { small: true }, (qr) => this.#ui.write(qr));
this.#ui.write('\n');
this.#ui.write(deepLink);
this.#ui.write('\nScan the QR code above, or open the ton:// link to send this transaction');

await this.#ui.prompt('Press enter when transaction was issued');
await this.#ui.prompt('Press enter when transaction was issued');
} catch (err: unknown) {
this.#ui.write(deepLink);
this.#ui.write('\n');

if (err instanceof Error && err.message.includes('code length overflow')) {
this.#ui.write('Message is too large to be sent via QR code. Please use the ton:// link or another method.');
process.exit(1);
}
throw err;
}
}

address(): Address | undefined {
Expand Down

0 comments on commit e87aa04

Please sign in to comment.