ソースを参照

Fix broken links

armaniferrante 4 年 前
コミット
16b5d751eb

+ 0 - 10
Cargo.lock

@@ -559,16 +559,6 @@ version = "0.1.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
 
-[[package]]
-name = "constraints-program"
-version = "0.1.0"
-dependencies = [
- "anchor",
- "borsh",
- "solana-program",
- "solana-sdk",
-]
-
 [[package]]
 name = "core-foundation"
 version = "0.9.1"

+ 0 - 1
Cargo.toml

@@ -24,5 +24,4 @@ members = [
     "syn",
     "attributes/*",
     "derive",
-    "examples/basic",
 ]

+ 1 - 1
cli/src/template.rs

@@ -72,7 +72,7 @@ describe('{}', () => {{
   it('Is initialized!', async () => {{
     // Add your test here.
     const program = anchor.workspace.{};
-  	const tx = await program.rpc.initialize();
+    const tx = await program.rpc.initialize();
     console.log("Your transaction signature", tx);
   }});
 }});

+ 1 - 1
docs/src/getting-started/introduction.md

@@ -10,7 +10,7 @@ Anchor is a framework for Solana's [Sealevel](https://medium.com/solana-labs/sea
 If you're familiar with developing in Ethereum's [Solidity](https://docs.soliditylang.org/en/v0.7.4/), [Truffle](https://www.trufflesuite.com/), [web3.js](https://github.com/ethereum/web3.js) or Parity's [Ink!](https://github.com/paritytech/ink), then the experience will be familiar. Although the DSL syntax and semantics are targeted at Solana, the high level flow of writing RPC request handlers, emitting an IDL, and generating clients from IDL is the same.
 
 Here, we'll walkthrough several tutorials demonstrating how to use Anchor. To skip the tutorials and jump straight to a full example, checkout the
-[quickstart](./quick-start.md) or go [here](https://github.com/project-serum/anchor/tree/master/examples/basic/src/lib.rs). For an introduction to Solana, see the [docs](https://docs.solana.com/developing/programming-model/overview).
+[quickstart](./quick-start.md) or go [here](https://github.com/project-serum/anchor/blob/master/examples/tutorial/basic-2/programs/basic-2/src/lib.rs). For an introduction to Solana, see the [docs](https://docs.solana.com/developing/programming-model/overview).
 
 ::: tip NOTE
 Anchor is in active development, so all APIs are subject to change. If you are one of the early developers to try it out and have feedback, please reach out by [filing an issue](https://github.com/project-serum/anchor/issues/new). This documentation is a work in progress and is expected to change dramatically as features continue to be built out. If you have any problems, consult the [source](https://github.com/project-serum/anchor) or feel free to ask questions on the [Serum Discord](https://discord.com/channels/739225212658122886/752530209848295555).

+ 11 - 3
docs/src/tutorials/tutorial-0.md

@@ -1,7 +1,7 @@
 # Tutorial 0: A Minimal Example
 
 Here, we introduce Anchor's core syntax elements and project workflow. This tutorial assumes all
-[prerequisites](./prerequisites.md) are installed.
+[prerequisites](../getting-started/installation.md) are installed.
 
 ## Clone the Repo
 
@@ -19,12 +19,17 @@ cd anchor/examples/tutorial/basic-0
 
 ## Starting a Localnet
 
-In a seprate terminal, start a local network for testing.
+In a separate terminal, start a local network for testing.
 
 ```
 solana-test-validator
 ```
 
+::: details
+As you'll see later, starting a localnet manually like this is not necessary when testing with Anchor,
+but is done for educational purposes in this tutorial.
+:::
+
 ## Defining a Program
 
 We define the minimum viable program as follows.
@@ -108,12 +113,15 @@ see [client.js](https://github.com/project-serum/anchor/tree/master/examples/tut
 Notice how we dynamically created the `initialize` method under
 the `rpc` namespace.
 
-Before running, make sure to plugin your program's address into `<YOUR-PROGRAM-ID>`.
+Now, make sure to plugin your program's address into `<YOUR-PROGRAM-ID>` (a mild
+annoyance that we'll address next), and run
 
 ```bash
 node client.js
 ```
 
+You just successfully created a client and executed a transaction on your localnet.
+
 ## Workspaces
 
 So far we've seen the basics of how to create, deploy, and make RPCs to a program, but

+ 2 - 2
docs/src/tutorials/tutorial-1.md

@@ -2,7 +2,7 @@
 
 This tutorial covers the basics of creating and mutating accounts using Anchor.
 It's recommended to read [Tutorial 0](./tutorial-0.md) first, as this tutorial will
-build on top of it. The full example can be found [here](https://github.com/project-serum/anchor/tree/master/examples/basic-1).
+build on top of it.
 
 ## Clone the Repo
 
@@ -51,7 +51,7 @@ we can invoke the above `initialize` instruction as follows.
 
 The last element passed into the method is common amongst all dynamically generated
 methods on the `rpc` namespace, containing several options for a transaction. Here,
-we specifiy the `accounts` field, an object of all the addresses the transaction
+we specify the `accounts` field, an object of all the addresses the transaction
 needs to touch.
 
 ::: details

+ 3 - 3
docs/src/tutorials/tutorial-2.md

@@ -1,7 +1,7 @@
 # Tutorial 2: Account Constraints and Access Control
 
-Building on the previous two, this tutorial covers how to speciy constraints and access control
-on accounts. The full example can be found [here](https://github.com/project-serum/anchor/tree/master/examples/basic-2).
+Building on the previous two, this tutorial covers how to specify constraints and access control
+on accounts.
 
 Because Solana programs are stateless, a transaction must specify accounts to be executed. And because an untrusted client specifies those accounts, a program must responsibily validate all input to the program to ensure it is what it claims to be--in addition to any instruction specific access control the program needs to do. This is particularly burdensome when there are lots of dependencies between accounts, leading to repetitive [boilerplate](https://github.com/project-serum/serum-dex/blob/master/registry/src/access_control.rs) code for account validation along with the ability to easily shoot oneself in the foot by forgetting to validate any particular account.
 
@@ -15,7 +15,7 @@ To get started, clone the repo.
 git clone https://github.com/project-serum/anchor
 ```
 
-And change directories to the [example](https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-1).
+And change directories to the [example](https://github.com/project-serum/anchor/tree/master/examples/tutorial/basic-2).
 
 ```bash
 cd anchor/examples/tutorial/basic-2

+ 4 - 0
examples/tutorial/basic-0/client.js

@@ -1,3 +1,7 @@
+// client.js is used to introduce the reader to generating clients from IDLs.
+// It is not expected users directly test with this example. For a more
+// ergonomic example, see `tests/basic-0.js` in this workspace.
+
 const anchor = require('@project-serum/anchor');
 
 // Configure the local cluster.