diff --git a/.remarkrc.mjs b/.remarkrc.mjs index c0615e344..f81dad4de 100644 --- a/.remarkrc.mjs +++ b/.remarkrc.mjs @@ -4,6 +4,7 @@ import remarkMath from 'remark-math'; import remarkMdx from 'remark-mdx'; import unifiedConsistency from 'unified-consistency'; import stringWidth from 'string-width'; +import remarkLintNoTrailingSpaces from 'remark-lint-no-trailing-spaces'; /** * @import {} from 'remark-stringify' @@ -34,6 +35,7 @@ const remarkConfig = { }, ], unifiedConsistency, + remarkLintNoTrailingSpaces, ], }; diff --git a/contract-dev/gas.mdx b/contract-dev/gas.mdx index 8662aac0c..3b4605b21 100644 --- a/contract-dev/gas.mdx +++ b/contract-dev/gas.mdx @@ -137,7 +137,7 @@ let sizeMsg = computeDataSize( ); let fwdFee = getForwardFee( - sizeMsg.cells - 1, + sizeMsg.cells - 1, sizeMsg.bits - msg.toCell().bits(), isAccountInMasterchain ); diff --git a/contract-dev/ide/jetbrains.mdx b/contract-dev/ide/jetbrains.mdx index f58db7859..623499593 100644 --- a/contract-dev/ide/jetbrains.mdx +++ b/contract-dev/ide/jetbrains.mdx @@ -248,27 +248,15 @@ The plugin integrates with: Follow news of TON plugin development in the [`@intellijton` Telegram channel](https://t.me/intellijton). [Code completion]: https://www.jetbrains.com/help/idea/auto-completing-code.html - [Parameter info]: https://www.jetbrains.com/help/idea/viewing-reference-information.html#view-parameter-info - [Quick documentation]: https://www.jetbrains.com/help/idea/viewing-reference-information.html#inline-quick-documentation - [Intention actions]: https://www.jetbrains.com/help/idea/intention-actions.html - [Declarations]: https://www.jetbrains.com/help/idea/navigating-through-the-source-code.html#go_to_declaration - [Usages]: https://www.jetbrains.com/help/idea/find-highlight-usages.html - [Inlay hints]: https://www.jetbrains.com/help/idea/inlay-hints.html - [Inspections]: https://www.jetbrains.com/help/idea/code-inspection.html - [Formatting]: https://www.jetbrains.com/help/idea/reformat-and-rearrange-code.html - [Rename refactorings]: https://www.jetbrains.com/help/idea/rename-refactorings.html - [Code fragment surrounding]: https://www.jetbrains.com/help/idea/surrounding-blocks-of-code-with-language-constructs.html - [Navigation bar]: https://www.jetbrains.com/help/idea/guided-tour-around-the-user-interface.html#navigation-bar - [File structure]: https://www.jetbrains.com/help/idea/viewing-structure-of-a-source-file.html diff --git a/contract-dev/security.mdx b/contract-dev/security.mdx index bcc7de186..5fe8d9d2e 100644 --- a/contract-dev/security.mdx +++ b/contract-dev/security.mdx @@ -14,10 +14,10 @@ Improper handling of signed integers can allow attackers to exploit overflow/und (cell,()) transfer_voting_power(cell votes, slice from, slice to, int amount) impure { int from_votes = get_voting_power(votes, from); int to_votes = get_voting_power(votes, to); - + from_votes -= amount; // Can become negative! to_votes += amount; - + votes~set_voting_power(from, from_votes); votes~set_voting_power(to, to_votes); return (votes,()); @@ -30,12 +30,12 @@ Improper handling of signed integers can allow attackers to exploit overflow/und (cell,()) transfer_voting_power(cell votes, slice from, slice to, int amount) impure { int from_votes = get_voting_power(votes, from); int to_votes = get_voting_power(votes, to); - + throw_unless(998, from_votes >= amount); // Validate sufficient balance - + from_votes -= amount; to_votes += amount; - + votes~set_voting_power(from, from_votes); votes~set_voting_power(to, to_votes); return (votes,()); @@ -67,7 +67,7 @@ Destroying accounts using [send mode](/foundations/messages/modes) `128 + 32` wi if (in_msg_body.slice_empty?()) { return (); ;; Dangerous: empty message handling } - + ;; Process and destroy account send_raw_message(msg, 128 + 32); ;; Destroys account } @@ -79,10 +79,10 @@ Destroying accounts using [send mode](/foundations/messages/modes) `128 + 32` wi () recv_internal(msg_value, in_msg_full, in_msg_body) { ;; Proper validation before any destruction throw_unless(error::unauthorized, authorized_sender?(sender)); - + ;; Ensure no pending operations throw_unless(error::pending_operations, safe_to_destroy?()); - + ;; Then proceed with destruction if really needed } ``` @@ -98,11 +98,11 @@ Replay protection is a security mechanism that prevents an attacker from [reusin slice ds = get_data().begin_parse(); int stored_seqno = ds~load_uint(32); int msg_seqno = in_msg~load_uint(32); - + throw_unless(33, msg_seqno == stored_seqno); ;; Prevent replay - + accept_message(); - + ;; Update sequence number set_data(begin_cell().store_uint(stored_seqno + 1, 32).end_cell()); } @@ -454,7 +454,7 @@ Contracts can be updated if not properly protected, changing their behavior unex () update_code(cell new_code) impure { throw_unless(error::unauthorized, authorized_admin?(sender())); throw_unless(error::invalid_code, validate_code?(new_code)); - + set_code(new_code); } ``` diff --git a/contract-dev/testing/overview.mdx b/contract-dev/testing/overview.mdx index 1ae40b61b..3a6765578 100644 --- a/contract-dev/testing/overview.mdx +++ b/contract-dev/testing/overview.mdx @@ -56,15 +56,15 @@ describe('MyContract', () => { beforeEach(async () => { blockchain = await Blockchain.create(); - + myContract = blockchain.openContract( MyContract.createFromConfig({}, code) ); - + deployer = await blockchain.treasury('deployer'); - + const deployResult = await myContract.sendDeploy( - deployer.getSender(), + deployer.getSender(), toNano('0.05') ); @@ -103,7 +103,7 @@ Each test should include a fresh `Blockchain` instance to ensure: beforeEach(async () => { // Fresh blockchain for each test blockchain = await Blockchain.create(); - + // Each test gets clean treasuries deployer = await blockchain.treasury('deployer'); user = await blockchain.treasury('user'); @@ -154,7 +154,7 @@ npx blueprint test MyContract # Run with coverage npx blueprint test --coverage -# Run with gas reporting +# Run with gas reporting npx blueprint test --gas-report ``` diff --git a/contract-dev/upgrades.mdx b/contract-dev/upgrades.mdx index ef4bfdee6..f9bcba1f7 100644 --- a/contract-dev/upgrades.mdx +++ b/contract-dev/upgrades.mdx @@ -77,8 +77,8 @@ fun onInternalMessage(in: InMessage) { } } - else => { - // just accept TON + else => { + // just accept TON } } } @@ -171,7 +171,7 @@ fun onInternalMessage(in: InMessage) { ApproveUpgrade => { var storage = lazy Storage.load(); - + assert (in.senderAddress == storage.adminAddress) throw 100; assert (storage.CurrentRequest != null) throw 301; assert (storage.CurrentRequest!.timestamp + storage.timeout < blockchain.now()) throw 302; @@ -189,8 +189,8 @@ fun onInternalMessage(in: InMessage) { } } - else => { - // just accepted tons + else => { + // just accepted tons } } } @@ -260,7 +260,7 @@ type AllowedMessages = | HotUpgrade | IncreaseCounter -// migration function must have method_id +// migration function must have method_id @method_id(2121) fun hotUpgradeData(additionalData: cell?) { return null; } @@ -273,12 +273,12 @@ fun onInternalMessage(in: InMessage) { HotUpgrade => { var storage = lazy Storage.load(); assert (in.senderAddress == storage.adminAddress) throw 1111; - + contract.setCodePostponed(msg.code); setTvmRegisterC3(transformSliceToContinuation(msg.code.beginParse())); hotUpgradeData(msg.additionalData); - } + } IncreaseCounter => { var storage = lazy Storage.load(); @@ -286,8 +286,8 @@ fun onInternalMessage(in: InMessage) { storage.save(); } - else => { - // just accept TON + else => { + // just accept TON } } } @@ -333,13 +333,13 @@ type AllowedMessages = | HotUpgrade | IncreaseCounter -// migration function must have method_id +// migration function must have method_id @method_id(2121) -fun hotUpgradeData(additionalData: cell?) { +fun hotUpgradeData(additionalData: cell?) { var oldStorage = lazy oldStorage.load(); assert (additionalData != null) throw 1112; - + var storage = Storage { adminAddress: oldStorage.adminAddress, counter: oldStorage.counter, @@ -368,12 +368,12 @@ fun onInternalMessage(in: InMessage) { HotUpgrade => { var storage = lazy Storage.load(); assert (in.senderAddress == storage.adminAddress) throw 1111; - + contract.setCodePostponed(msg.code); setTvmRegisterC3(transformSliceToContinuation(msg.code.beginParse())); hotUpgradeData(msg.additionalData); - } + } IncreaseCounter => { var storage = lazy Storage.load(); @@ -381,8 +381,8 @@ fun onInternalMessage(in: InMessage) { storage.save(); } - else => { - // just accept TON + else => { + // just accept TON } } } diff --git a/contract-dev/vanity.mdx b/contract-dev/vanity.mdx index d707ec714..d47b1e606 100644 --- a/contract-dev/vanity.mdx +++ b/contract-dev/vanity.mdx @@ -147,7 +147,7 @@ export class VanityContract implements Contract { } static createFromConfig( - config: VanityContractConfig, + config: VanityContractConfig, workchain = 0 ) { const data = vanityContractConfigToCell(config); diff --git a/contribute/snippets/filetree.mdx b/contribute/snippets/filetree.mdx index 996a82619..4e8baec5d 100644 --- a/contribute/snippets/filetree.mdx +++ b/contribute/snippets/filetree.mdx @@ -77,11 +77,11 @@ import { FileTree } from '/snippets/filetree.jsx'; "file-name-1", { kind: "file", name: "file-name-2", note: "very important file" }, { - kind: "folder", - name: "best-folder", - note: "not really", - open: false, - items: ["file-name-3-within-subfolder"], +kind: "folder", +name: "best-folder", +note: "not really", +open: false, +items: ["file-name-3-within-subfolder"], }, ]} /> diff --git a/ecosystem/status.mdx b/ecosystem/status.mdx index 717c0dcd0..dc9061cdd 100644 --- a/ecosystem/status.mdx +++ b/ecosystem/status.mdx @@ -4,12 +4,12 @@ title: "Network status" This page lists websites that show if specific parts of TON blockchain are working normally. -| | | -|--------------------------------|---------------------------------------------------------------| -| https://tonstat.us/ | HTTP and ADNL server availability and performance. | -| https://status.toncenter.com/ | Low-level metrics, such as latencies, rates, and loads. | -| https://validators.ton.org/ | Official validation dashboard. | -| https://tonscan.com/validation | Pretty validation dashboard. | -| https://t.me/tonstatus | Notifications and requests for action for mainnet validators. | -| https://t.me/testnetstatus | Notifications and requests for action for testnet validators. | -| https://t.me/validators | Bot for validator owners to track their status. | +| | | +| ---------------------------------------------------------------- | ------------------------------------------------------------- | +| [https://tonstat.us/](https://tonstat.us/) | HTTP and ADNL server availability and performance. | +| [https://status.toncenter.com/](https://status.toncenter.com/) | Low-level metrics, such as latencies, rates, and loads. | +| [https://validators.ton.org/](https://validators.ton.org/) | Official validation dashboard. | +| [https://tonscan.com/validation](https://tonscan.com/validation) | Pretty validation dashboard. | +| [https://t.me/tonstatus](https://t.me/tonstatus) | Notifications and requests for action for mainnet validators. | +| [https://t.me/testnetstatus](https://t.me/testnetstatus) | Notifications and requests for action for testnet validators. | +| [https://t.me/validators](https://t.me/validators) | Bot for validator owners to track their status. | diff --git a/ecosystem/tma/analytics/install-via-npm.mdx b/ecosystem/tma/analytics/install-via-npm.mdx index 1bd4377b2..187c9ab4e 100644 --- a/ecosystem/tma/analytics/install-via-npm.mdx +++ b/ecosystem/tma/analytics/install-via-npm.mdx @@ -34,4 +34,5 @@ TelegramAnalytics.init({ ### Supported events After initializing the **Telegram analytics**, you are all set to transfer the data, gain insights, and improve user engagement. (99% of them will be tracked **automatically** without manual control) + - [Supported events](/ecosystem/tma/analytics/supported-events) diff --git a/ecosystem/tma/analytics/install-via-script.mdx b/ecosystem/tma/analytics/install-via-script.mdx index 6cb9a2bf3..f5431dfb7 100644 --- a/ecosystem/tma/analytics/install-via-script.mdx +++ b/ecosystem/tma/analytics/install-via-script.mdx @@ -4,7 +4,7 @@ title: "Installation via script tag" ## How to install it? -### 1.Add Telegram Mini Apps Analytics to your project** +### 1.Add Telegram Mini Apps Analytics to your project\*\* Include the Telegram Mini Apps Analytics script in the header of your HTML document. This script will allow you to track and analyze user interactions effectively. diff --git a/ecosystem/tma/analytics/supported-events.mdx b/ecosystem/tma/analytics/supported-events.mdx index 55ac55ee5..a7c609ae3 100644 --- a/ecosystem/tma/analytics/supported-events.mdx +++ b/ecosystem/tma/analytics/supported-events.mdx @@ -17,4 +17,4 @@ Events from TON Connect will be sent only if `@tonconnect/ui-react@2.0.3`, `@ton | `transaction-sent-for-signature` | The user submits the transaction for signature | true | | `transaction-signed` | The user successfully signs the transaction | true | | `transaction-signing-failed` | The user cancels the transaction signature or an error occurs during the signing process | true | -| `disconnection user-initiated` | Disconnection events, specifying scope (dApp or wallet) | true | +| `disconnection user-initiated` | Disconnection events, specifying scope (dApp or wallet) | true | diff --git a/ecosystem/tma/mate/telegram-apps-mate.mdx b/ecosystem/tma/mate/telegram-apps-mate.mdx index 950bfbc11..ec383f6da 100644 --- a/ecosystem/tma/mate/telegram-apps-mate.mdx +++ b/ecosystem/tma/mate/telegram-apps-mate.mdx @@ -31,4 +31,3 @@ Not to install the package, you can also use the package using `pnpm` or `npx`: ```sh icon="npm" npx @telegram-apps/mate@latest --help ``` - diff --git a/ecosystem/tma/overview.mdx b/ecosystem/tma/overview.mdx index 6037f2219..c1ca79d3d 100644 --- a/ecosystem/tma/overview.mdx +++ b/ecosystem/tma/overview.mdx @@ -4,13 +4,18 @@ title: "Overview" Telegram Mini Apps (TMAs) are web applications that run within the Telegram messenger. They are built using web technologies — HTML, CSS, and JavaScript. -