Skip to content

Commit

Permalink
Merge pull request #321 from AleoHQ/update-docs-new-api-url
Browse files Browse the repository at this point in the history
Replace all references of vm.aleo.org with the new explorer API
  • Loading branch information
a h authored Nov 28, 2023
2 parents 8b2f5eb + 0af5d80 commit 427d480
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion documentation/sdk/create-aleo-app/01_create_aleo_app.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Take your transaction ID from the Discord URL earlier:
at12u62xwfew2rq32xee8nwhtlxghfjz7mm3528yj240nuezue625fqy4lhlp
```
<!-- markdown-link-check-disable -->
Go to “Get Transaction” at [aleo.tools/rest](https://aleo.tools/rest) and insert your transaction ID to look at the JSON object. You can similarly use https://vm.aleo.org/api/testnet3/transaction/[insert-your-transaction-id] to get the same output in your browser.
Go to “Get Transaction” at [aleo.tools/rest](https://aleo.tools/rest) and insert your transaction ID to look at the JSON object. You can similarly use https://api.explorer.aleo.org/v1/testnet3/transaction/[insert-your-transaction-id] to get the same output in your browser.
<!-- markdown-link-check-enable-->

![get-transaction](./images/get-transaction.png)
Expand Down
32 changes: 16 additions & 16 deletions documentation/sdk/typescript/00_sdk_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,12 @@ const keyProvider = new AleoKeyProvider();
keyProvider.useCache = true;
// Create a record provider that will be used to find records and transaction data for Aleo programs
const networkClient = new AleoNetworkClient("https://vm.aleo.org/api");
const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
const recordProvider = new NetworkRecordProvider(account, networkClient);
// Initialize a program manager to talk to the Aleo network with the configured key and record providers
const programName = "hello_hello.aleo";
const programManager = new ProgramManager("https://vm.aleo.org/api", keyProvider, recordProvider);
const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
// Provide a key search parameter to find the correct key for the program if they are stored in a memory cache
const keySearchParams = { "cacheKey": "hello_hello:hello" };
Expand Down Expand Up @@ -332,11 +332,11 @@ const keyProvider = new AleoKeyProvider();
keyProvider.useCache = true;

// Create a record provider that will be used to find records and transaction data for Aleo programs
const networkClient = new AleoNetworkClient("https://vm.aleo.org/api");
const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
const recordProvider = new NetworkRecordProvider(account, networkClient);

// Initialize a program manager to talk to the Aleo network with the configured key and record providers
const programManager = new ProgramManager("https://vm.aleo.org/api", keyProvider, recordProvider);
const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);

// Define an Aleo program to deploy
const program = "program hello_hello.aleo;\n\nfunction hello:\n input r0 as u32.public;\n input r1 as u32.private;\n add r0 r1 into r2;\n output r2 as u32.private;\n";
Expand Down Expand Up @@ -402,9 +402,9 @@ await aleo.initializeWasm();
await aleo.initThreadPool(8);
/// The program manager is initialized with a key provider and a record provider
const defaultHost = "https://vm.aleo.org/api";
const defaultHost = "https://api.explorer.aleo.org/v1";
const keyProvider = new aleo.AleoKeyProvider();
const recordProvider = new aleo.NetworkRecordProvider(new Account(), "https://vm.aleo.org/api");
const recordProvider = new aleo.NetworkRecordProvider(new Account(), "https://api.explorer.aleo.org/v1");
const programManager = new aleo.ProgramManager(
defaultHost,
keyProvider,
Expand Down Expand Up @@ -785,13 +785,13 @@ import { Account, ProgramManager, AleoKeyProvider, NetworkRecordProvider, AleoNe

// Create a new NetworkClient, KeyProvider, and RecordProvider
const account = Account.from_string({privateKey: "user1PrivateKey"});
const networkClient = new AleoNetworkClient("https://vm.aleo.org/api");
const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
const keyProvider = new AleoKeyProvider();
const recordProvider = new NetworkRecordProvider(account, networkClient);

// Initialize a program manager with the key provider to automatically fetch keys for executions
const USER_1_ADDRESS = "user1Address";
const programManager = new ProgramManager("https://vm.aleo.org/api", keyProvider, recordProvider);
const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
programManager.setAccount(account);

// Send a private transfer to yourself
Expand Down Expand Up @@ -826,7 +826,7 @@ assert(public_balance === 0);
As shown above, a public balance of any address can be checked with `getMappingValue` function of the `NetworkClient`.
```typescript
const networkClient = new AleoNetworkClient("https://vm.aleo.org/api");
const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
const USER_1_ADDRESS = "user1Address";
const public_balance = networkClient.getMappingValue("credits.aleo", USER_1_ADDRESS);
```
Expand Down Expand Up @@ -919,13 +919,13 @@ import { Account, ProgramManager, AleoKeyProvider, NetworkRecordProvider, AleoNe

// Create a new NetworkClient, KeyProvider, and RecordProvider
const account = Account.from_string({privateKey: "user1PrivateKey"});
const networkClient = new AleoNetworkClient("https://vm.aleo.org/api");
const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
const keyProvider = new AleoKeyProvider();
const recordProvider = new NetworkRecordProvider(account, networkClient);

// Initialize a program manager with the key provider to automatically fetch keys for executions
const USER_2_ADDRESS = "user2Address";
const programManager = new ProgramManager("https://vm.aleo.org/api", keyProvider, recordProvider);
const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
programManager.setAccount(account);

/// Send private transfer to user 2
Expand All @@ -940,12 +940,12 @@ import { Account, ProgramManager, AleoKeyProvider, NetworkRecordProvider, AleoNe

// Create a new NetworkClient, KeyProvider, and RecordProvider
const account = Account.from_string({privateKey: "user2PrivateKey"});
const networkClient = new AleoNetworkClient("https://vm.aleo.org/api");
const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
const keyProvider = new AleoKeyProvider();
const recordProvider_User2 = new NetworkRecordProvider(account, networkClient);

// Initialize a program manager with the key provider to automatically fetch keys for executions
const programManager = new ProgramManager("https://vm.aleo.org/api", keyProvider, recordProvider);
const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
programManager.setAccount(account);

// Fetch the transaction from the network that user 1 sent
Expand Down Expand Up @@ -1109,7 +1109,7 @@ read the value of a specific key within a mapping.
```typescript
import { AleoNetworkClient } from '@aleo/sdk';

const networkClient = new AleoNetworkClient("https://vm.aleo.org/api");
const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
const creditsMappings = networkClient.getMappings("credits.aleo");
assert(creditsMappings === ["account"]);

Expand Down Expand Up @@ -1156,13 +1156,13 @@ import { Account, ProgramManager, AleoKeyProvider, NetworkRecordProvider, AleoNe

// Create a new NetworkClient, KeyProvider, and RecordProvider
const account = Account.from_string({privateKey: "user1PrivateKey"});
const networkClient = new AleoNetworkClient("https://vm.aleo.org/api");
const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
const keyProvider = new AleoKeyProvider();
const recordProvider = new NetworkRecordProvider(account, networkClient);

// Initialize a program manager with the key provider to automatically fetch keys for executions
const RECIPIENT_ADDRESS = "user1Address";
const programManager = new ProgramManager("https://vm.aleo.org/api", keyProvider, recordProvider);
const programManager = new ProgramManager("https://api.explorer.aleo.org/v1", keyProvider, recordProvider);
programManager.setAccount(account);

// Update or initialize a public balance
Expand Down
2 changes: 1 addition & 1 deletion documentation/sdk/typescript/02_aleo_network_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The methods provided in this class provide information on the Aleo Blockchain</p
let local_connection = new AleoNetworkClient("http://localhost:3030");

// Connection to a public beacon node
let public_connection = new AleoNetworkClient("https://vm.aleo.org/api");
let public_connection = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
```
<a name="AleoNetworkClient+setAccount"></a>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ To deploy and execute programs on Testnet3
<!-- markdown-link-check-disable -->

1. Replace [step 3](#3-scan-the-node-for-spendable-records) with the Aleo faucet to obtain spendable credits. You can request credits from [the faucet](https://faucet.aleo.org/)
2. Replace the use of `http://localhost:3030` with `https://vm.aleo.org/api`
2. Replace the use of `http://localhost:3030` with `https://api.explorer.aleo.org/v1`

<!-- markdown-link-check-enable -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ RECORD=""
* Deploy your Leo application (if all your variables were assigned correctly, you should be able to copy/paste the following

```
snarkos developer deploy "${APPNAME}.aleo" --private-key "${PRIVATEKEY}" --query "https://vm.aleo.org/api" --path "./${APPNAME}/build/" --broadcast "https://vm.aleo.org/api/testnet3/transaction/broadcast" --fee 1000000 --record "${RECORD}"
snarkos developer deploy "${APPNAME}.aleo" --private-key "${PRIVATEKEY}" --query "https://api.explorer.aleo.org/v1" --path "./${APPNAME}/build/" --broadcast "https://api.explorer.aleo.org/v1/testnet3/transaction/broadcast" --fee 1000000 --record "${RECORD}"
```

You should have seen a confirmation that your Aleo application was deployed in the form of a transaction ID that looks like the following `at1rkkpqu5k4rt86zzccczw6cxeyvrl7hxydvvv7dhl7zr7p9w40c8s70kwm8`. Make sure to copy this string as you'll need it for the last step.
Expand All @@ -149,8 +149,8 @@ You should have seen a confirmation that your Aleo application was deployed in t

Finally, it is time to execute the application you just deployed!

* You'll need to update the `--record` flag with the latest transaction linked to your wallet balance. In this case, you can obtain that by going to the following URL: https://vm.aleo.org/api/testnet3/transaction/$DEPLOY_TX_ID but replace $DEPLOY_TX_ID with the transaction ID provided to you once your application was deployed (or from the most recent transaction linked to your wallet address). An example URL looks like so: https://vm.aleo.org/api/testnet3/transaction/at1rkkpqu5k4rt86zzccczw6cxeyvrl7hxydvvv7dhl7zr7p9w40c8s70kwm8
* In the JSON object provided at https://vm.aleo.org/api/testnet3/transaction/$DEPLOY_TX_ID, navigate to: `object.fee.transition.outputs[0].value` and copy the record ciphertext value.
* You'll need to update the `--record` flag with the latest transaction linked to your wallet balance. In this case, you can obtain that by going to the following URL: https://api.explorer.aleo.org/v1/testnet3/transaction/$DEPLOY_TX_ID but replace $DEPLOY_TX_ID with the transaction ID provided to you once your application was deployed (or from the most recent transaction linked to your wallet address). An example URL looks like so: https://api.explorer.aleo.org/v1/testnet3/transaction/at1rkkpqu5k4rt86zzccczw6cxeyvrl7hxydvvv7dhl7zr7p9w40c8s70kwm8
* In the JSON object provided at https://api.explorer.aleo.org/v1/testnet3/transaction/$DEPLOY_TX_ID, navigate to: `object.fee.transition.outputs[0].value` and copy the record ciphertext value.
* Head to [aleo.tools](https://aleo.tools/) and navigate to the **Record** tab and paste the record ciphertext you just copied as well as your wallet's view key
* Similar to the steps we followed for a deploy transaction, update your `RECORD` variable with the record plaintext you just decrypted by doing the following:

Expand All @@ -165,7 +165,7 @@ RECORD=""
Then just paste the following command in your terminal

```
snarkos developer execute "${APPNAME}.aleo" "main" "1u32" "2u32" --private-key "${PRIVATEKEY}" --query "https://vm.aleo.org/api" --broadcast "https://vm.aleo.org/api/testnet3/transaction/broadcast" --fee 1000000 --record "${RECORD}"
snarkos developer execute "${APPNAME}.aleo" "main" "1u32" "2u32" --private-key "${PRIVATEKEY}" --query "https://api.explorer.aleo.org/v1" --broadcast "https://api.explorer.aleo.org/v1/testnet3/transaction/broadcast" --fee 1000000 --record "${RECORD}"
```

Awesome! You have successfully deployed and executed a Leo application to Testnet III, how exciting 🎉

0 comments on commit 427d480

Please sign in to comment.