Skip to content

Commit

Permalink
[integration-guides] Separate out integration guides, add exchange gu…
Browse files Browse the repository at this point in the history
…ide (#633)

* [integration-guides] Separate out integration guides, add exchange guide

* [network] Fix networks page to contain all information

* [faucet] Replace faucet usage with the official SDKs instead

* [refactor] Remove system integrators guide from being referenced elsewhere

* [accounts] fix typo in accounts page

* [exchanges] make final update to exchange guide
  • Loading branch information
gregnazario authored Oct 3, 2024
1 parent bd184b2 commit 4179221
Show file tree
Hide file tree
Showing 19 changed files with 1,410 additions and 402 deletions.
2 changes: 1 addition & 1 deletion apps/nextra/pages/en/build/apis.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ _submitting_ transactions to the Aptos Blockchain. It also supports transaction
## Faucet (Only Testnet/Devnet)

<Cards>
<Card href="./guides/system-integrators-guide#integrating-with-the-faucet">
<Card href="./apis/faucet-api">
<Card.Title>Faucet API</Card.Title>
<Card.Description>
This API provides the ability to receive test tokens on devnet and testnet. Its primary purpose is the development
Expand Down
87 changes: 46 additions & 41 deletions apps/nextra/pages/en/build/apis/faucet-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,66 +6,71 @@ title: "Faucet API"

The faucet allows users to get test `APT` on Devnet and Testnet. It is not available on Mainnet.

## Differences between devnet and testnet

What are the differences between devnet and testnet? Effectively none. In the
past, the testnet faucet had a Captcha in front of it, making it unqueryable
by
normal means. This is no longer true.

The endpoints for each faucet are:

- Devnet: https://faucet.devnet.aptoslabs.com
- Testnet: https://faucet.testnet.aptoslabs.com

## Integrating with the faucet
## Using the faucet

See the [System Integrators Guide](../guides/system-integrators-guide.mdx) for more information on how to use the faucet with your project.
Each SDK has integration for devnet and testnet to use the faucet. Below are a few examples, but you can
see more information on each individual [SDK's documentation](../sdks.mdx).

### Calling the faucet via Terminal
### Using the faucet in a wallet

If you are trying to call the faucet in other languages, you have two options:
Most wallets, such as [Petra](https://aptosfoundation.org/ecosystem/project/petra) or [Pontem](https://aptosfoundation.org/ecosystem/project/pontem-wallet)
will have a faucet button for devnet and testnet. See full list of [Aptos Wallets](https://aptosfoundation.org/ecosystem/projects/wallets).

1. Generate a client from
the [OpenAPI spec](https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-faucet/doc/spec.yaml).
2. Call the faucet on your own.
### Using the faucet in the Aptos CLI

For the latter, you will want to build a query similar to this:
Once you've [set up your CLI](../cli/setup-cli.mdx), you can simply call fund-with-faucet. The amount used is in Octas (1 APT = 1,000,000,000 Octas).

```bash filename="Terminal"
curl -X POST
'https://faucet.devnet.aptoslabs.com/mint?amount=10000&address=0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6'
aptos account fund-with-faucet --account 0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6 --amount 100000000
```

This means mint 10000 [Octas](../../network/glossary.mdx#Octa) to
address `0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6`.
### Using the faucet in the TypeScript SDK

Here is an example funding the account `0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6` with 1 APT in Devnet. The amount used is in Octas (1 APT = 1,000,000,000 Octas).

```ts filename="index.ts"
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";

const aptos = new Aptos(new AptosConfig({network: Network.Devnet}));
aptos.fundAccount({accountAddress: "0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6", amount: 100000000});
```

### Using the faucet in the Go SDK

### Calling the faucet: JavaScript / TypeScript
Here is an example funding the account `0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6` with 1 APT in Devnet. The amount used is in Octas (1 APT = 1,000,000,000 Octas).

If you are building a client in JavaScript or TypeScript, you should make use
of the [@aptos-labs/aptos-faucet-client](https://www.npmjs.com/package/@aptos-labs/aptos-faucet-client)
package. This client is generated based on the OpenAPI spec published by the
faucet service.
```go filename="index.go"
import "github.com/aptos-labs/aptos-go-sdk"

Example use:
func main() {
client, err := aptos.NewClient(aptos.LocalnetConfig)
if err != nil {
panic(err)
}

```ts filename="index.ts"
import {
AptosFaucetClient,
FundRequest,
} from "@aptos-labs/aptos-faucet-client";

async function callFaucet(amount: number, address: string): Promise<string []> {
const faucetClient = new AptosFaucetClient({
BASE: "https://faucet.devnet.aptoslabs.com",
});
const request: FundRequest = {
amount,
address,
};
const response = await faucetClient.fund.fund({ requestBody: request });
return response.txn_hashes;
client.Fund("0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6", 100000000)
}
```

### Calling the faucet: Other languages not supported by SDKs

If you are trying to call the faucet in other languages, you have two options:

1. Generate a client from
the [OpenAPI spec](https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-faucet/doc/spec.yaml).
2. Call the faucet on your own.

For the latter, you will want to build a query similar to this:

```bash filename="Terminal"
curl -X POST
'https://faucet.devnet.aptoslabs.com/mint?amount=10000&address=0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6'
```

This means mint 10000 [octas](../../network/glossary.mdx#Octa) to
address `0xd0f523c9e73e6f3d68c16ae883a9febc616e484c4998a72d8899a1009e5a89d6`.
6 changes: 1 addition & 5 deletions apps/nextra/pages/en/build/apis/fullnode-rest-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import { Card, Cards } from '@components/index'
This API - embedded into Fullnodes - provides a simple, low latency, yet low-level way of reading state and submitting transactions to the Aptos Blockchain. It also supports transaction simulation.
For more advanced queries, we recommend using the [Indexer GraphQL API](../indexer.mdx).

<Callout type="info">
Also see the [System Integrators Guide](../guides/system-integrators-guide.mdx) for a thorough walkthrough of Aptos integration.
</Callout>

## Fullnode REST API Explorer

<Cards>
Expand Down Expand Up @@ -86,7 +82,7 @@ View functions do not modify blockchain state when called from the API. A [View
- related [Move](https://github.com/aptos-labs/aptos-core/blob/90c33dc7a18662839cd50f3b70baece0e2dbfc71/aptos-move/framework/aptos-framework/sources/coin.move#L226) code
- [specification](https://github.com/aptos-labs/aptos-core/blob/90c33dc7a18662839cd50f3b70baece0e2dbfc71/api/doc/spec.yaml#L8513).

The view function operates like the [Aptos Simulation API](../guides/system-integrators-guide.mdx),
The view function operates like the Aptos simulation API,
though with no side effects and an accessible output path. View functions can be called via the `/view` endpoint. Calls
to view functions require the module and function names along with input type parameters and values.

Expand Down
2 changes: 1 addition & 1 deletion apps/nextra/pages/en/build/cli/running-a-local-network.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ As you can see from the example output in step 4, once the local network is runn
- [Indexer API](../indexer/aptos-hosted.mdx): This is a [GraphQL](https://graphql.org/) API that provides rich read access to indexed blockchain data. If you click on the URL for the Indexer API above, by default [http://127.0.0.1:8090](http://127.0.0.1:8090/), it will open the Hasura Console, a web UI that will help you query the Indexer GraphQL API.
- [Transaction Stream Service](../indexer/txn-stream.mdx): This is a gRPC stream of transactions used by the Indexer API. This is only relevant to you if you are developing a [custom processor](../indexer/custom-processors.mdx).
- [Postgres](https://www.postgresql.org/): This is the database that the Indexer processors write to. The Indexer API reads from this database.
- [Faucet](../guides/system-integrators-guide.mdx#integrating-with-the-faucet): You can use this to fund accounts on your local network.
- [Faucet](../apis/faucet-api.mdx): You can use this to fund accounts on your local network.
If you do not want to run any of these sub-components of a network, there are flags to disable them.
Expand Down
10 changes: 8 additions & 2 deletions apps/nextra/pages/en/build/guides/_meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@ export default {
"key-rotation": {
title: "Account Key Rotation",
},

"---integration---": {
type: "separator",
title: "Integration Guides",
},
exchanges: {
title: "Exchanges",
},
"system-integrators-guide": {
title: "Integrate with the Aptos Blockchain",
title: "Applications",
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const aptos = new Aptos();
This will initialize a `Aptos` instance for us.

<Callout type="info">
By default, `Aptos` will interact with the `devnet` network, to set up a [different network](../../guides/system-integrators-guide.mdx#choose-a-network), we can use `AptosConfig` class.
By default, `Aptos` will interact with the `devnet` network, to set up a [different network](../../../network/nodes/networks.mdx), we can use `AptosConfig` class.

```tsx filename="App.tsx"
import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
Expand Down
Loading

0 comments on commit 4179221

Please sign in to comment.