Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] docs migration #31

Merged
merged 85 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
b268612
refactor: index
nickfrosty Oct 6, 2023
dee008b
refactor: moved into intro
nickfrosty Oct 6, 2023
e1097a5
refactor: moved to advanced
nickfrosty Oct 6, 2023
f10f126
refactor: deleted getstarted
nickfrosty Oct 6, 2023
b9a9773
refactor: moved to core
nickfrosty Oct 6, 2023
17183f3
refactor: renamed to programs
nickfrosty Oct 6, 2023
34dec09
refactor: moved to core
nickfrosty Oct 6, 2023
847da8e
refactor: deleted guide
nickfrosty Oct 6, 2023
c5d0ab7
refactor: moved to the root
nickfrosty Oct 6, 2023
7a56f10
refactor: renamed files
nickfrosty Oct 6, 2023
f45364f
refactor: relocated file
nickfrosty Oct 6, 2023
5b623cf
refactor: renamed transaction docs
nickfrosty Oct 9, 2023
07d8ae7
refactor: renamed
nickfrosty Oct 9, 2023
79a65ea
refactor: sidebar label and formatting
nickfrosty Oct 9, 2023
714916f
refactor: renamed intro docs
nickfrosty Oct 9, 2023
33e031a
refactor: sidebar label and private->secret key
nickfrosty Oct 9, 2023
5771901
refactor: sidebar label
nickfrosty Oct 9, 2023
d13bd2b
refactor: renamed files
nickfrosty Oct 9, 2023
0ec57a1
refactor: sidebar label
nickfrosty Oct 9, 2023
b68329a
refactor: client metadata
nickfrosty Oct 9, 2023
de85419
fix: sorting child sidebar items
nickfrosty Oct 9, 2023
8ead80b
refactor: renamed files
nickfrosty Oct 9, 2023
ce5737f
refactor: sidebar label and heading
nickfrosty Oct 9, 2023
a7da1b9
feat: added multiple category metadata
nickfrosty Oct 9, 2023
ab9e5a4
refactor: renamed filed
nickfrosty Oct 9, 2023
02ad1c9
refactor: sidebar labels and page titles
nickfrosty Oct 9, 2023
2554f00
refactor: sidebar order
nickfrosty Oct 9, 2023
344e99f
refactor: renamed file
nickfrosty Oct 9, 2023
e84c70d
feat: merged cluster docs into one
nickfrosty Oct 9, 2023
bc26b23
refactor: relocated file
nickfrosty Oct 9, 2023
4b2d901
refactor: renamed file
nickfrosty Oct 9, 2023
4af79cc
refactor: relocated files
nickfrosty Oct 9, 2023
de4a67f
refactor: sidebar labels
nickfrosty Oct 9, 2023
e35ef4c
refactor: relocated doc
nickfrosty Oct 9, 2023
4297276
feat: added more section sidebar
nickfrosty Oct 9, 2023
3e52d29
Merge branch 'main' into docs-migration
nickfrosty Oct 10, 2023
e011b46
fix: inflation docs
nickfrosty Oct 16, 2023
772e26c
fix: code block languages
nickfrosty Oct 16, 2023
18ead5a
test: relative nav
nickfrosty Oct 16, 2023
35bca3e
fix: links to terminolgy page
nickfrosty Oct 16, 2023
a1fa277
fix: corrected links
nickfrosty Oct 18, 2023
f9c67dc
fix: removed bad link
nickfrosty Oct 18, 2023
2955362
fix: typos and links
nickfrosty Oct 18, 2023
1c9c6d7
fix: images
nickfrosty Oct 23, 2023
dfca52c
Merge branch 'main' into docs-migration
nickfrosty Oct 25, 2023
fe7fbcb
refactor: removed all docusaurus callouts
nickfrosty Nov 6, 2023
87476c3
refactor: removed get started dir
nickfrosty Nov 6, 2023
5b2d495
refactor: relocated file
nickfrosty Nov 7, 2023
274b72c
chore: catchup commits from Oct 1 - Nov 15
nickfrosty Nov 15, 2023
9b62e23
refactor: removed courses
nickfrosty Nov 15, 2023
858a76d
fix: lower case and mdx
nickfrosty Nov 16, 2023
70aa58c
feat: added basic rpc doc support
nickfrosty Nov 16, 2023
f48e91f
fix: mdx index files
nickfrosty Nov 16, 2023
d81f798
refactor: sidebar details to be general
nickfrosty Nov 16, 2023
e1252f1
feat: added docs/rpc support
nickfrosty Nov 16, 2023
2b49b2d
feat: added hide toc field
nickfrosty Nov 16, 2023
461d56b
feat: added rpc index pages
nickfrosty Nov 16, 2023
aa355f3
fix: missing type
nickfrosty Nov 16, 2023
5b788c4
feat: added rpc docs
nickfrosty Nov 17, 2023
0e3dbac
fix: all lowercase alt routes
nickfrosty Nov 17, 2023
1fa3bb7
feat: added default alt route for all rpc methods
nickfrosty Nov 17, 2023
444d79a
fix: optional value
nickfrosty Nov 17, 2023
11dc2c4
fix: warning callouts
nickfrosty Nov 17, 2023
b3170c4
feat: added cuation callouts
nickfrosty Nov 17, 2023
533ed3c
fix: remaining callouts
nickfrosty Nov 17, 2023
44eda15
refactor: relocated multiple sections
nickfrosty Nov 17, 2023
dd538bd
fix: assorted links
nickfrosty Nov 17, 2023
a4af7fc
fix: internal links
nickfrosty Nov 17, 2023
2d12280
refactor: moved json structures to separate file
nickfrosty Nov 17, 2023
906510b
fix: json structure links
nickfrosty Nov 17, 2023
0a9d19c
refactor: minor adjustments to markdown formatting
nickfrosty Nov 17, 2023
c28eb4f
fix: links
nickfrosty Nov 28, 2023
14af329
fix: removed place holder version
nickfrosty Nov 28, 2023
81d0d01
fix: rpc links
nickfrosty Nov 28, 2023
0c81bcb
fix: corrected js api links
nickfrosty Nov 28, 2023
8f344c0
chore: tsconfig
nickfrosty Nov 30, 2023
f34c155
refactor: removed course
nickfrosty Nov 15, 2023
0449cae
Merge branch 'main' into docs-migration
nickfrosty Nov 30, 2023
2c661d5
fix: merge conflict
nickfrosty Nov 30, 2023
bf28892
Merge branch 'main' into docs-migration
nickfrosty Nov 30, 2023
9adcbd5
fix: links
nickfrosty Dec 2, 2023
08548b8
Merge branch 'main' into docs-migration
nickfrosty Dec 7, 2023
355f22f
feat: redirects
nickfrosty Dec 7, 2023
e629b71
fix: api redirect
nickfrosty Dec 7, 2023
26c5407
refactor: seo title for images
nickfrosty Dec 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/advanced/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
metaOnly: true
title: Advanced Concepts
# sidebarSortOrder: 3
---
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ efficiently load more addresses in a single transaction.
Since each transaction on the Solana blockchain requires a listing of every
address that is interacted with as part of the transaction, this listing would
effectively be capped at 32 addresses per transaction. With the help of
[Address Lookup Tables](./lookup-tables.md), a transaction would now be able to
raise that limit to 256 addresses per transaction.
[Address Lookup Tables](/docs/advanced/lookup-tables.md), a transaction would
now be able to raise that limit to 256 addresses per transaction.

## Compressing on chain addresses

Expand All @@ -27,7 +27,7 @@ table for use inside any given transaction.

To utilize an Address Lookup Table inside a transaction, developers must use v0
transactions that were introduced with the new
[Versioned Transaction format](./versioned-transactions.md).
[Versioned Transaction format](/docs/core/transactions/versions.md).

## How to create an address lookup table

Expand Down Expand Up @@ -65,7 +65,7 @@ console.log("lookup table address:", lookupTableAddress.toBase58());
> NOTE: Address lookup tables can be **created** with either a `v0` transaction
> or a `legacy` transaction. But the Solana runtime can only retrieve and handle
> the additional addresses within a lookup table while using
> [v0 Versioned Transactions](./versioned-transactions.md#current-transaction-versions).
> [v0 Versioned Transactions](/docs/core/transactions/versions.md#current-transaction-versions).

## Add addresses to a lookup table

Expand Down Expand Up @@ -141,9 +141,9 @@ chain (via extending the lookup table), you can create a `v0` transaction to
utilize the on chain lookup capabilities.

Just like older `legacy` transactions, you can create all the
[instructions](./../terminology.md#instruction) your transaction will execute on
chain. You can then provide an array of these instructions to the
[Message](./../terminology.md#message) used in the `v0 transaction.
[instructions](/docs/terminology.md#instruction) your transaction will execute
on chain. You can then provide an array of these instructions to the
[Message](/docs/terminology.md#message) used in the `v0 transaction.

> NOTE: The instructions used inside a `v0` transaction can be constructed using
> the same methods and functions used to create the instructions in the past.
Expand Down Expand Up @@ -183,6 +183,7 @@ console.log(

## More Resources

- Read the [proposal](./../proposals/versioned-transactions.md) for Address
Lookup Tables and Versioned transactions
- Read the
[proposal](https://docs.solanalabs.com/proposals/versioned-transactions) for
Address Lookup Tables and Versioned transactions
- [Example Rust program using Address Lookup Tables](https://github.com/TeamRaccoons/address-lookup-table-multi-swap)
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ description:
accounts.'
---

On Solana, [State Compression](./state-compression.md) is the method of creating
a "fingerprint" (or hash) of off-chain data and storing this fingerprint
on-chain for secure verification. Effectively using the security of the Solana
ledger to securely validate off-chain data, verifying it has not been tampered
with.
On Solana, [State Compression](/docs/advanced/state-compression.md) is the
method of creating a "fingerprint" (or hash) of off-chain data and storing this
fingerprint on-chain for secure verification. Effectively using the security of
the Solana ledger to securely validate off-chain data, verifying it has not been
tampered with.

This method of "compression" allows Solana programs and dApps to use cheap
blockchain [ledger](./../terminology.md#ledger) space, instead of the more
expensive [account](./../terminology.md#account) space, to securely store data.
blockchain [ledger](/docs/terminology.md#ledger) space, instead of the more
expensive [account](/docs/terminology.md#account) space, to securely store data.

This is accomplished by using a special binary tree structure, known as a
[concurrent merkle tree](#what-is-a-concurrent-merkle-tree), to create a hash of
Expand Down Expand Up @@ -82,19 +82,15 @@ and effectively invalidates the previous root hash and previous proof.
Therefore, each change to these _traditional merkle trees_ are required to be
performed in series.

:::info

This process of changing leaf data, and computing a new root hash can be a
**very common** thing when using merkle trees! While it is one of the design
points of the tree, it can result in one of the most notable drawbacks: rapid
changes.

:::
> This process of changing leaf data, and computing a new root hash can be a
> **very common** thing when using merkle trees! While it is one of the design
> points of the tree, it can result in one of the most notable drawbacks: rapid
> changes.

### What is a Concurrent merkle tree?

In high throughput applications, like within the
[Solana runtime](/src/validator/runtime.md), requests to change an on-chain
[Solana runtime](/docs/core/runtime.md), requests to change an on-chain
_traditional merkle tree_ could be received by validators in relatively rapid
succession (e.g. within the same slot). Each leaf data change would still be
required to performed in series. Resulting in each subsequent request for change
Expand Down Expand Up @@ -136,7 +132,7 @@ Therefore, the `maxDepth` of a tree is used to determine the maximum number of
nodes (aka pieces of data or `leafs`) to store within the tree using a simple
calculation:

```
```text
nodes_count = 2 ^ maxDepth
```

Expand All @@ -149,7 +145,7 @@ above, you can determine the lowest `maxDepth` to store your data.
If you wanted to create a tree to store 100 compressed nfts, we will need a
minimum of "100 leafs" or "100 nodes".

```
```text
// maxDepth=6 -> 64 nodes
2^6 = 64

Expand All @@ -164,7 +160,7 @@ We must use a `maxDepth` of `7` to ensure we can store all of our data.
If you wanted to create a tree to store 15000 compressed nfts, we will need a
minimum of "15000 leafs" or "15000 nodes".

```
```text
// maxDepth=13 -> 8192 nodes
2^13 = 8192

Expand Down Expand Up @@ -257,7 +253,7 @@ used to calculate the on-chain storage (in bytes) required for a tree to exist
on chain.

Once the required space (in bytes) has been calculated, and using the
[`getMinimumBalanceForRentExemption`](/api/http#getminimumbalanceforrentexemption)
[`getMinimumBalanceForRentExemption`](/docs/rpc/http/getminimumbalanceforrentexemption)
RPC method, request the cost (in lamports) to allocate this amount of bytes
on-chain.

Expand Down Expand Up @@ -325,9 +321,6 @@ Compressed NFTs are one of the most popular use cases for State Compression on
Solana. With compression, a one million NFT collection could be minted for
`~50 SOL`, vice `~12,000 SOL` for its uncompressed equivalent collection.

:::info Developer Guide

Read our developer guide for
[minting and transferring compressed NFTs](./../developing/guides/compressed-nfts).

:::
If you are interested in creating compressed NFTs yourself, read our developer
guide for
[minting and transferring compressed NFTs](/content/guides/javascript/compressed-nfts.md).
5 changes: 5 additions & 0 deletions docs/clients/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
metaOnly: true
title: Solana Clients
# sidebarSortOrder: 3
---
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
title: Web3 API Reference
title: Web3.js API Examples
---

## Web3 API Reference Guide

The `@solana/web3.js` library is a package that has coverage over the
[Solana JSON RPC API](/api).
[Solana JSON RPC API](/docs/rpc).

You can find the full documentation for the `@solana/web3.js` library
[here](https://solana-labs.github.io/solana-web3.js/).
Expand All @@ -16,8 +16,8 @@ You can find the full documentation for the `@solana/web3.js` library

[Source Documentation](https://solana-labs.github.io/solana-web3.js/classes/Connection.html)

Connection is used to interact with the [Solana JSON RPC](/api). You can use
Connection to confirm transactions, get account info, and more.
Connection is used to interact with the [Solana JSON RPC](/docs/rpc). You can
use Connection to confirm transactions, get account info, and more.

You create a connection by defining the JSON RPC cluster endpoint and the
desired commitment. Once this is complete, you can use this connection object to
Expand Down Expand Up @@ -64,7 +64,7 @@ for the full list.

### Transaction

[SourceDocumentation](https://solana-labs.github.io/solana-web3.js/classes/Transaction.html)
[Source Documentation](https://solana-labs.github.io/solana-web3.js/classes/Transaction.html)

A transaction is used to interact with programs on the Solana blockchain. These
transactions are constructed with TransactionInstructions, containing all the
Expand Down Expand Up @@ -257,7 +257,7 @@ console.log(`Valid Program Address: ${validProgramAddress}`);

### SystemProgram

[SourceDocumentation](https://solana-labs.github.io/solana-web3.js/classes/SystemProgram.html)
[Source Documentation](https://solana-labs.github.io/solana-web3.js/classes/SystemProgram.html)

The SystemProgram grants the ability to create accounts, allocate account data,
assign an account to programs, work with nonce accounts, and transfer lamports.
Expand Down Expand Up @@ -422,8 +422,8 @@ await web3.sendAndConfirmTransaction(connection, transaction, [fromPublicKey]);

Message is used as another way to construct transactions. You can construct a
message using the accounts, header, instructions, and recentBlockhash that are a
part of a transaction. A [Transaction](javascript-api.md#Transaction) is a
Message plus the list of required signatures required to execute the
part of a transaction. A [Transaction](/docs/clients/javascript.md#Transaction)
is a Message plus the list of required signatures required to execute the
transaction.

#### Example Usage
Expand Down Expand Up @@ -484,7 +484,7 @@ await web3.sendAndConfirmTransaction(connection, transaction, [fromPublicKey]);

### Struct

[SourceDocumentation](https://solana-labs.github.io/solana-web3.js/classes/Struct.html)
[Source Documentation](https://solana-labs.github.io/solana-web3.js/classes/Struct.html)

The struct class is used to create Rust compatible structs in javascript. This
class is only compatible with Borsh encoded Rust structs.
Expand Down Expand Up @@ -519,8 +519,8 @@ export class Fee extends Struct {
The Enum class is used to represent a Rust compatible Enum in javascript. The
enum will just be a string representation if logged but can be properly
encoded/decoded when used in conjunction with
[Struct](javascript-api.md#Struct). This class is only compatible with Borsh
encoded Rust enumerations.
[Struct](/docs/clients/javascript.md#Struct). This class is only compatible with
Borsh encoded Rust enumerations.

#### Example Usage

Expand Down Expand Up @@ -634,7 +634,7 @@ offline with the nonce in place of the `recentBlockhash`.

### VoteAccount

[SourceDocumentation](https://solana-labs.github.io/solana-web3.js/classes/VoteAccount.html)
[Source Documentation](https://solana-labs.github.io/solana-web3.js/classes/VoteAccount.html)

Vote account is an object that grants the capability of decoding vote accounts
from the native vote account program on the network.
Expand Down Expand Up @@ -708,7 +708,7 @@ VoteAccount {

### StakeProgram

[SourceDocumentation](https://solana-labs.github.io/solana-web3.js/classes/StakeProgram.html)
[Source Documentation](https://solana-labs.github.io/solana-web3.js/classes/StakeProgram.html)

The StakeProgram facilitates staking SOL and delegating them to any validators
on the network. You can use StakeProgram to create a stake account, stake some
Expand Down Expand Up @@ -815,17 +815,17 @@ within Solana. You can designate a `staker` and `withdrawer` separately,
allowing for a different account to withdraw other than the staker.

You can find more usage of the `Authorized` object under
[`StakeProgram`](javascript-api.md#StakeProgram)
[`StakeProgram`](/docs/clients/javascript.md#StakeProgram)

### Lockup

[Source Documentation](https://solana-labs.github.io/solana-web3.js/classes/Lockup.html)

Lockup is used in conjunction with the
[StakeProgram](javascript-api.md#StakeProgram) to create an account. The Lockup
is used to determine how long the stake will be locked, or unable to be
retrieved. If the Lockup is set to 0 for both epoch and the Unix timestamp, the
lockup will be disabled for the stake account.
[StakeProgram](/docs/clients/javascript.md#StakeProgram) to create an account.
The Lockup is used to determine how long the stake will be locked, or unable to
be retrieved. If the Lockup is set to 0 for both epoch and the Unix timestamp,
the lockup will be disabled for the stake account.

#### Example Usage

Expand Down Expand Up @@ -855,4 +855,4 @@ The above code creates a `createStakeAccountInstruction` to be used when
creating an account with the `StakeProgram`. The Lockup is set to 0 for both the
epoch and Unix timestamp, disabling lockup for the account.

See [StakeProgram](javascript-api.md#StakeProgram) for more.
See [StakeProgram](/docs/clients/javascript.md#StakeProgram) for more.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
---
title: Web3 JavaScript API
sidebarLabel: JavaScript / TypeScript
title: JavaScript Client for Solana
sidebarSortOrder: 2
---

## What is Solana-Web3.js?

The Solana-Web3.js library aims to provide complete coverage of Solana. The
library was built on top of the [Solana JSON RPC API](/api).
library was built on top of the [Solana JSON RPC API](/docs/rpc).

You can find the full documentation for the `@solana/web3.js` library
[here](https://solana-labs.github.io/solana-web3.js/).
Expand All @@ -19,7 +21,7 @@ You can find the full documentation for the `@solana/web3.js` library
| Transaction | One or more instructions signed by the client using one or more Keypairs and executed atomically with only two possible outcomes: success or failure. |

For the full list of terms, see
[Solana terminology](../../terminology#cross-program-invocation)
[Solana terminology](/docs/terminology.md#cross-program-invocation-cpi)

## Getting Started

Expand All @@ -28,13 +30,13 @@ For the full list of terms, see
#### yarn

```bash
$ yarn add @solana/web3.js
yarn add @solana/web3.js
```

#### npm

```bash
$ npm install --save @solana/web3.js
npm install --save @solana/web3.js
```

#### Bundle
Expand Down Expand Up @@ -125,8 +127,8 @@ order that instructions exist in a transaction determines the order they are
executed.

A transaction in Solana-Web3.js is created using the
[`Transaction`](javascript-api.md#Transaction) object and adding desired
messages, addresses, or instructions.
[`Transaction`](/docs/clients/javascript.md#Transaction) object and adding
desired messages, addresses, or instructions.

Take the example of a transfer transaction:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Rust API
sidebarLabel: Rust
title: Rust Client for Solana
sidebarSortOrder: 1
---

Solana's Rust crates are [published to crates.io][crates.io] and can be found
Expand All @@ -19,7 +21,7 @@ Some important crates:
that do not run on-chain will import this.

- [`solana-client`] — For interacting with a Solana node via the
[JSON RPC API](/api).
[JSON RPC API](/docs/rpc).

- [`solana-cli-config`] — Loading and saving the Solana CLI configuration
file.
Expand Down
Loading
Loading