You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/v3/guidelines/smart-contracts/get-methods.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Before proceeding, it is recommended that readers have a basic understanding of
6
6
7
7
## Introduction
8
8
9
-
Get methods are special functions in smart contracts that are made for querying specific data from them. Their execution doesn't cost any fees and happens outside of the blockchain.
9
+
Get methods are special functions in smart contracts designed for querying specific data. Their execution doesn't cost any fees and happens outside of the blockchain.
10
10
11
11
These functions are very common in most smart contracts. For example, the default [Wallet contract](/v3/documentation/smart-contracts/contracts-specs/wallet-contracts) has several get methods, such as `seqno()`, `get_subwallet_id()` and `get_public_key()`. They are used by wallets, SDKs, and APIs to fetch data about wallets.
12
12
@@ -47,7 +47,7 @@ These functions are very common in most smart contracts. For example, the defaul
47
47
}
48
48
```
49
49
50
-
2. **Conditional data retrieval**: Sometimes, the data that needs to be retrieved depends on certain conditions, such as the current time.
50
+
2. **Conditional data retrieval**: In some cases, the data retrieved depends on specific conditions, such as the current time.
51
51
52
52
Example:
53
53
@@ -256,7 +256,7 @@ async function main() {
256
256
main();
257
257
```
258
258
259
-
This code will result`Total: 123`output. The number can be different, this is just an example.
259
+
This code will output`Total: 123` The number may vary, as this is just an example.
It executed the get method and fetches the resulting stack. The stack in case with get methods is basically what it did return. In this snippet, we read a single number from it. In more complex cases with several values returned at once, you can just call the `readSomething` type of methods several times to parse the whole execution result from stack.
274
+
It executes the get method and retrieves the resulting stack. The stack in case with get methods is basically what it did return. In this snippet, we read a single number from it. In more complex cases with several values returned at once, you can just call the `readSomething` type of methods several times to parse the whole execution result from stack.
275
275
276
276
Finally, we can use this method in our tests. Navigate to the `tests/Counter.spec.ts` and add a new test:
277
277
@@ -287,7 +287,7 @@ Check it by running `npx blueprint test` in your terminal and if you did everyth
287
287
288
288
## Invoking get methods from other contracts
289
289
290
-
Contrary to what might seem intuitive, invoking get methods from other contracts is not possible on-chain, primarily due to the nature of blockchain technology and the need for consensus.
290
+
Although it may seem intuitive, invoking get methods from other contracts is not possible on-chaindue to blockchain technology's nature and the need for consensus.
291
291
292
292
Firstly, acquiring data from another shardchain may require time. Such latency could easily disrupt contract execution flow, as blockchain operations are expected to execute in a deterministic and timely manner.
293
293
@@ -301,7 +301,7 @@ These limitations imply that one contract cannot directly access the state of an
301
301
302
302
### Solutions and Workarounds
303
303
304
-
In the TON Blockchain, smart contracts communicate via messages, instead of directly invoking methods from another contract. A message requesting execution of a specific method can be sent to a targeted contract. These requests typically start with special [operation codes](/v3/documentation/smart-contracts/message-management/internal-messages).
304
+
In the TON Blockchain, smart contracts communicate via messages, instead of directly invoking methods from another contract. A message can be sent to a targeted contract requesting the execution of a specific method. These requests typically start with special [operation codes](/v3/documentation/smart-contracts/message-management/internal-messages).
305
305
306
306
A contract designed to accept these requests will execute the desired method and send the results back in a separate message. While this might seem complex, it actually streamlines communication between contracts, and enhances the blockchain network's scalability and performance.
0 commit comments