diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a7aa26..c73febb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/network/send/DeeplinkProvider.ts b/src/network/send/DeeplinkProvider.ts index b267cd2..49d8b41 100644 --- a/src/network/send/DeeplinkProvider.ts +++ b/src/network/send/DeeplinkProvider.ts @@ -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 {