@@ -8,14 +8,14 @@ description:
88
99In the previous section, you learned how to
1010[ read data from the Solana network] ( /docs/intro/quick-start/reading-from-network )
11- with a Kit client and RPC requests . Writing data to the Solana network requires
12- a [ transaction] ( /docs/core/transactions ) . A transaction contains one or more
11+ by fetching accounts . Writing data to the Solana network requires a
12+ [ transaction] ( /docs/core/transactions ) . A transaction contains one or more
1313[ instructions] ( /docs/core/instructions ) , and each instruction invokes a program.
1414
1515Programs define the business logic for each instruction. When you send a
1616transaction, the Solana runtime executes the transaction's instructions in
17- order. The transaction is atomic: either every instruction succeeds, or every
18- instruction fails.
17+ order. Transactions are atomic. Either every instruction in the transaction
18+ succeeds, or the entire transaction fails.
1919
2020The examples in this section show how to:
2121
@@ -24,11 +24,14 @@ The examples in this section show how to:
2424
2525## Transfer SOL
2626
27- The example below transfers SOL from one account to another. Wallet accounts are
28- owned by the [ System Program] ( /docs/core/programs#the-system-program ) . To deduct
29- SOL from a wallet account, the transaction must invoke the System Program's
27+ The example below transfers SOL from one account to another. Only the program
28+ designated as an account's owner can modify the account's data or deduct
29+ lamports from its balance. Wallet accounts are owned by the
30+ [ System Program] ( /docs/core/programs#the-system-program ) , so transferring SOL
31+ between wallet accounts requires an instruction that invokes the System
32+ Program's
3033[ transfer] ( https://github.com/anza-xyz/agave/blob/v2.1.11/programs/system/src/system_processor.rs#L183-L213 )
31- instruction, and the source account must sign the transaction.
34+ instruction. The source account must also sign the transaction.
3235
3336<WithNotes >
3437
@@ -115,9 +118,9 @@ Fetch the sender and receiver balances after the transaction is confirmed.
115118
116119## !!steps
117120
118- Create a Kit client for the local test validator. This is the same plugin-client
119- syntax used in the token docs. The signer plugin is installed before the RPC
120- plugin so the RPC plugin can use the payer when planning transactions .
121+ Create a Kit client for the local test validator. This snippet adds a payer
122+ signer, connects to the local RPC endpoint, enables airdrops, and funds the
123+ payer with test SOL for the transfer .
121124
122125``` ts title="Client setup"
123126const client = await createClient ()
@@ -275,9 +278,7 @@ console.log("Transaction Signature:", result.context.signature);
275278
276279## !!steps
277280
278- After the transaction is confirmed, fetch both balances using ` client.rpc ` . This
279- read uses the same RPC pattern from the
280- [ reading guide] ( /docs/intro/quick-start/reading-from-network ) .
281+ After the transaction is confirmed, fetch both balances using ` client.rpc ` .
281282
282283``` ts title="Fetch balances"
283284const { value : senderBalance } = await client .rpc
@@ -422,8 +423,8 @@ account rent and transaction fees.
422423
423424### !mint
424425
425- Generate a signer for the mint account. The mint signer authorizes the use of
426- the new account address .
426+ Generate a signer to use as the address of the new mint account. The signer
427+ authorizes creation of that account .
427428
428429### !space
429430
@@ -459,9 +460,9 @@ deserializes the mint account's data field into the Mint type.
459460
460461## !!steps
461462
462- Create and fund a Kit client, then generate the mint signer. The client payer
463- funds account creation and pays the transaction fee. The mint signer becomes the
464- address of the new mint account .
463+ Create and fund a Kit client, then generate a signer to use as the address of
464+ the new mint account. The client payer funds account creation and pays the
465+ transaction fee .
465466
466467``` ts title="Client and mint setup"
467468const client = await createClient ()
@@ -507,9 +508,9 @@ const mint = await generateKeyPairSigner();
507508
508509## !!steps
509510
510- Calculate the mint account size, then ask RPC for the rent-exempt balance for
511- that size. The mint account must hold at least this many lamports when the
512- account is created .
511+ Calculate the mint account size in bytes , then make an RPC request to calculate
512+ the lamports required to store that data in the account. This required balance
513+ is referred to as rent .
513514
514515``` ts title="Mint account size and rent"
515516const space = BigInt (getMintSize ());
@@ -559,7 +560,6 @@ allocates the mint account [`space`](mention:space), transfers the rent-exempt
559560[ ` programAddress ` ] ( mention:program-address ) .
560561
561562``` ts title="Create account instruction"
562- // !mark(1:12)
563563const createAccountInstruction = getCreateAccountInstruction ({
564564 // !mention payer
565565 payer: client .payer ,
@@ -623,11 +623,10 @@ The second instruction invokes the Token Extensions Program. The instruction
623623initializes the [ ` mint ` ] ( mention:mint-account ) address with a
624624[ ` decimals ` ] ( mention:decimals ) value, a
625625[ ` mintAuthority ` ] ( mention:mint-authority ) , a
626- [ ` freezeAuthority ` ] ( mention:freeze-authority ) , and the
626+ [ ` freezeAuthority ` ] ( mention:freeze-authority ) , and specifies the
627627[ ` tokenProgram ` ] ( mention:token-program ) that owns the mint account.
628628
629629``` ts title="Initialize mint instruction"
630- // !mark(1:12)
631630const initializeMintInstruction = getInitializeMintInstruction ({
632631 // !mention mint-account
633632 mint: mint .address ,
@@ -761,10 +760,7 @@ console.log("Transaction Signature:", result.context.signature);
761760
762761## !!steps
763762
764- After the transaction is confirmed, fetch the mint account. This final read uses
765- the same account-reading concept from the previous guide: fetch the account at
766- an address, then inspect the deserialized account data returned by the program
767- helper.
763+ After the transaction is confirmed, fetch the mint account.
768764
769765``` ts title="Fetch mint account"
770766const mintAccount = await fetchMint (client .rpc , mint .address );
0 commit comments