Skip to content

Commit 424b47d

Browse files
committed
Clarity, headings, tagged links, etc.
1 parent a30fe64 commit 424b47d

File tree

3 files changed

+13
-20
lines changed

3 files changed

+13
-20
lines changed

.husky/pre-commit

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
G='\033[0;32m'
2-
P='\033[0;35m'
3-
CLEAN='\033[0;0m'
4-
5-
yarn run check:mdx || (echo -e "${G}Hint:${CLEAN} execute ${P}yarn run format:mdx${CLEAN} to format files" && exit 1)
1+
G='\033[0;32m'
2+
P='\033[0;35m'
3+
CLEAN='\033[0;0m'
4+
5+
yarn run check:mdx || (echo -e "${G}Hint:${CLEAN} execute ${P}yarn run format:mdx${CLEAN} to format files" && exit 1)

docs/build/guides/testing/unit-tests.mdx

-9
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,4 @@ The `Env` created at the beginning of the test is not a simulation of the Soroba
7171

7272
:::
7373

74-
It's a simple test, but it's a complete test. There's a full environment setup, used, and torn down in the test, and it happens fast. The Rust test harness runs all the tests for a contract in parallel and each will have its own isolated contract environment.
75-
76-
Most tests, even integration tests and fuzz tests, will look very similar to this unit test. They'll do four things:
77-
78-
1. Create an environment, the `Env`.
79-
2. Register the contract(s) to be tested.
80-
3. Invoke functions using a client.
81-
4. Assert the outcome.
82-
8374
[increment contract]: https://github.com/stellar/soroban-examples/blob/main/increment/src/lib.rs

docs/data/rpc/api-reference/methods/getLedgerEntries.mdx

+8-6
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ import rpcSpec from "@site/static/stellar-rpc.openrpc.json";
1111
method={rpcSpec.methods.filter((meth) => meth.name === "getLedgerEntries")[0]}
1212
/>
1313

14-
The Stellar ledger is, on some level, essentially a key-value store. The keys are `LedgerKey`s and the values are `LedgerEntryData`s in the XDR. An interesting product of the store's internal design is that the key is a _subset_ of the entry: we'll see more of this later.
14+
# Building ledger keys
1515

16-
The `getLedgerEntries` method returns the "values" (or "entries") for a given set of "keys". `LedgerKey`s come in a lot of forms, and we'll go over the valuable ones on this page alongside tutorials on how to build and use them.
16+
The Stellar ledger is, on some level, essentially a key-value store. The keys are `LedgerKey`s and the values are `LedgerEntry`s in the XDR. An interesting product of the store's internal design is that the key is a _subset_ of the entry: we'll see more of this later.
17+
18+
The `getLedgerEntries` method returns the "values" (or "entries") for a given set of "keys". `LedgerKey`s come in a lot of forms, and we'll go over the commonly used ones on this page alongside tutorials on how to build and use them.
1719

1820
## Types of `LedgerKey`s
1921

20-
The source of truth should always be the XDR defined in the protocol. `LedgerKey`s are a union type defined in [Stellar-ledger-entries.x](https://github.com/stellar/stellar-xdr/blob/529d5176f24c73eeccfa5eba481d4e89c19b1181/Stellar-ledger-entries.x#L600). There are 10 different forms a ledger key can take:
22+
The source of truth should always be the XDR defined in the protocol. `LedgerKey`s are a union type defined in [Stellar-ledger-entries.x](https://github.com/stellar/stellar-xdr/blob/v22.0/Stellar-ledger-entries.x#L600). There are 10 different forms a ledger key can take:
2123

2224
1. **Account:** holistically defines a Stellar account, including its balance, signers, etc. (see [Accounts](https://developers.stellar.org/docs/learn/fundamentals/stellar-data-structures/accounts))
2325
2. **Trustline:** defines a balance line to a non-native asset issued on the network (see [`changeTrustOp`](https://developers.stellar.org/docs/learn/fundamentals/transactions/list-of-operations#change-trust))
@@ -119,7 +121,7 @@ console.log(
119121

120122
### Contract Data
121123

122-
Suppose we've deployed the [`increment` example contract] and want to find out what value is stored in the `COUNTER` ledger key. To build the key,
124+
Suppose we've deployed the [`increment` example contract] and want to find out what value is stored in the `COUNTER` ledger key. To build the key:
123125

124126
<CodeExample>
125127

@@ -307,14 +309,14 @@ Now, finally we have a `LedgerKey` that correspond to the Wasm byte-code that ha
307309
}
308310
```
309311

310-
Then you can inspect them accordingly. Each of the above entries follows the XDR for that `LedgerEntryData` structure precisely. For example, the `AccountEntry` is in [`Stellar-ledger-entries.x#L191`](https://github.com/stellar/stellar-xdr/blob/529d5176f24c73eeccfa5eba481d4e89c19b1181/Stellar-ledger-entries.x#L191) and you can use `.seqNum()` to access its current sequence number, as we've shown. In JavaScript, you can see the appropriate methods in the [type definition](https://github.com/stellar/js-stellar-base/blob/6930a70d7fbde675514b5933baff605d97453ba7/types/curr.d.ts#L3034).
312+
Then you can inspect them accordingly. Each of the above entries follows the XDR for that `LedgerEntryData` structure precisely. For example, the `AccountEntry` is in [`Stellar-ledger-entries.x#L191`](https://github.com/stellar/stellar-xdr/blob/v22.0/Stellar-ledger-entries.x#L191) and you can use `.seqNum()` to access its current sequence number, as we've shown. In JavaScript, you can see the appropriate methods in the [type definition](https://github.com/stellar/js-stellar-base/blob/6930a70d7fbde675514b5933baff605d97453ba7/types/curr.d.ts#L3034).
311313

312314
## Viewing and understanding XDR
313315

314316
If you don't want to parse the XDR out programmatically, you can also leverage both the [Stellar CLI](https://developers.stellar.org/docs/tools/developer-tools/cli/stellar-cli) and the [Stellar Lab](https://lab.stellar.org/xdr/view) to get a human-readable view of ledger keys and entries. For example,
315317

316318
```bash
317-
echo 'AAAAAAAAAAAL76GC5jcgEGfLG9+nptaB9m+R44oweeN3EcqhstdzhQ==' | stellar xdr decode --type LedgerKey | jq
319+
echo 'AAAAAAAAAAAL76GC5jcgEGfLG9+nptaB9m+R44oweeN3EcqhstdzhQ==' | stellar xdr decode --type LedgerKey --output json-formatted
318320
{
319321
"account": {
320322
"account_id": "GAF67IMC4Y3SAEDHZMN57J5G22A7M34R4OFDA6PDO4I4VINS25ZYLBZZ"

0 commit comments

Comments
 (0)