From 459c55bbadc39963f36123ecfe240d067b2efea4 Mon Sep 17 00:00:00 2001 From: nazreen Date: Fri, 22 Nov 2024 13:18:54 +0800 Subject: [PATCH 1/6] elaborate on setup instructions --- examples/oft-solana/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/oft-solana/README.md b/examples/oft-solana/README.md index 77c91f459..ecb8a1274 100644 --- a/examples/oft-solana/README.md +++ b/examples/oft-solana/README.md @@ -16,6 +16,8 @@ We recommend using `pnpm` as a package manager (but you can of course use a pack Docker is required to build using anchor. We highly recommend that you use the most up-to-date Docker version to avoid any issues with anchor builds. +Ensure that you have Rust, Solana and Anchor installed. If not, follow the instructions in the [official Solana guide](https://solana.com/docs/intro/installation#install-dependencies). On the page as well are instructions on creating a wallet and getting devnet SOL. For the `solana airdrop` command, we recommend that you run `solana airdrop 5 -ud` (`-ud` is a flag shorthand for using the Devnet RPC URL) to request 5 devnet SOL, which should be sufficient for this walkthrough. For the example here, we will be using Solana Devnet. If you are hitting rate limits after, you can also use the [official Solana faucet](https://faucet.solana.com/). + ### Get the code ```bash From 76842ee85047ea97e48f3dd8a9575d52f1c2ef67 Mon Sep 17 00:00:00 2001 From: nazreen Date: Fri, 22 Nov 2024 15:08:33 +0800 Subject: [PATCH 2/6] add missing boolean --- examples/oft-solana/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/oft-solana/README.md b/examples/oft-solana/README.md index ecb8a1274..30546162c 100644 --- a/examples/oft-solana/README.md +++ b/examples/oft-solana/README.md @@ -87,7 +87,7 @@ pnpm hardhat lz:oft:solana:create --eid 40168 --program-id ``` :important: You may specify the `--additional-minters` flag to add a CSV of additional minter keys to the mint -multisig. If you do not want to, you must sepcify `--only-oft-store`. If you choose the latter approach, you can never +multisig. If you do not want to, you must specify `--only-oft-store true`. If you choose the latter approach, you can never substitute in a different mint authority. For OFTAdapter: @@ -103,7 +103,7 @@ pnpm hardhat lz:oft:solana:create --eid 40168 --program-id --mint < ``` :important: You may specify the `--additional-minters` flag to add a CSV of additional minter keys to the mint -multisig. If you do not want to, you must sepcify `--only-oft-store`. If you choose the latter approach, you can never +multisig. If you do not want to, you must specify `--only-oft-store store`. If you choose the latter approach, you can never substitute in a different mint authority. Make sure to update [layerzero.config.ts](./layerzero.config.ts) and set `solanaContract.address` with the `oftStore` address. From fc0c5f26fe49a6e4beb5e049e6cd3d51a334ab72 Mon Sep 17 00:00:00 2001 From: nazreen Date: Fri, 22 Nov 2024 15:13:32 +0800 Subject: [PATCH 3/6] info on -u flag --- examples/oft-solana/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/oft-solana/README.md b/examples/oft-solana/README.md index 30546162c..d08ad80b2 100644 --- a/examples/oft-solana/README.md +++ b/examples/oft-solana/README.md @@ -16,7 +16,9 @@ We recommend using `pnpm` as a package manager (but you can of course use a pack Docker is required to build using anchor. We highly recommend that you use the most up-to-date Docker version to avoid any issues with anchor builds. -Ensure that you have Rust, Solana and Anchor installed. If not, follow the instructions in the [official Solana guide](https://solana.com/docs/intro/installation#install-dependencies). On the page as well are instructions on creating a wallet and getting devnet SOL. For the `solana airdrop` command, we recommend that you run `solana airdrop 5 -ud` (`-ud` is a flag shorthand for using the Devnet RPC URL) to request 5 devnet SOL, which should be sufficient for this walkthrough. For the example here, we will be using Solana Devnet. If you are hitting rate limits after, you can also use the [official Solana faucet](https://faucet.solana.com/). +Ensure that you have Rust, Solana and Anchor installed. If not, follow the instructions in the [official Solana guide](https://solana.com/docs/intro/installation#install-dependencies). On the page as well are instructions on creating a wallet and getting devnet SOL. + +For the `solana airdrop` command, we recommend that you run `solana airdrop 5 -u devnet` to request 5 devnet SOL, which should be sufficient for this walkthrough. For the example here, we will be using Solana Devnet. If you are hitting rate limits after, you can also use the [official Solana faucet](https://faucet.solana.com/). ### Get the code @@ -75,9 +77,11 @@ Ensure you have Docker running before running the build command. ```bash anchor build -v # verification flag enabled -solana program deploy --program-id target/deploy/oft-keypair.json target/verifiable/oft.so -u mainnet-beta +solana program deploy --program-id target/deploy/oft-keypair.json target/verifiable/oft.so -u devnet ``` +:information_source: the `-u` flag specifies the RPC URL that should be used. The options are `mainnet-beta, devnet, testnet, localhost`, which also have their respective shorthands: `-um, -ud, -ut, -ul` + ### Create the OFT For OFT: From aeae75d352cabd6f2909e240bb521c1895da52ad Mon Sep 17 00:00:00 2001 From: nazreen Date: Fri, 22 Nov 2024 15:59:02 +0800 Subject: [PATCH 4/6] private key instructions --- examples/oft-solana/README.md | 41 +++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/examples/oft-solana/README.md b/examples/oft-solana/README.md index d08ad80b2..25995d186 100644 --- a/examples/oft-solana/README.md +++ b/examples/oft-solana/README.md @@ -12,14 +12,12 @@ ## Setup +Ensure that you have Rust, Solana and Anchor installed. If not, follow the instructions in the [official Solana guide](https://solana.com/docs/intro/installation#install-dependencies). On the page as well are instructions on creating a wallet and getting devnet SOL. + We recommend using `pnpm` as a package manager (but you can of course use a package manager of your choice). Docker is required to build using anchor. We highly recommend that you use the most up-to-date Docker version to avoid any issues with anchor builds. -Ensure that you have Rust, Solana and Anchor installed. If not, follow the instructions in the [official Solana guide](https://solana.com/docs/intro/installation#install-dependencies). On the page as well are instructions on creating a wallet and getting devnet SOL. - -For the `solana airdrop` command, we recommend that you run `solana airdrop 5 -u devnet` to request 5 devnet SOL, which should be sufficient for this walkthrough. For the example here, we will be using Solana Devnet. If you are hitting rate limits after, you can also use the [official Solana faucet](https://faucet.solana.com/). - ### Get the code ```bash @@ -38,6 +36,41 @@ pnpm install pnpm test ``` +### Get Devnet SOL + +```bash +solana airdrop 5 -u devnet +``` + +We recommend that you request 5 devnet SOL, which should be sufficient for this walkthrough. For the example here, we will be using Solana Devnet. If you are hitting rate limits after, you can also use the [official Solana faucet](https://faucet.solana.com/). + +### Prepare `.env` + +```bash +cp .env.example .env +``` + +In the `.env` just created, set `SOLANA_PRIVATE_KEY` to your private key value in base58 format. Since the locally stored keypair is in an integer array format, we'd need to encode it into base58 first. You can create a temporary script called `getBase58Pk.js` in your project root with the following contents: + +```js +import fs from "fs"; +import { Keypair } from "@solana/web3.js"; +import bs58 from "bs58"; + +const keypairFilePath = ``; // you can view this by running `solana config get` + +const data = fs.readFileSync(keypairFilePath, "utf8"); +const keypairJson = JSON.parse(data); +const keypair = Keypair.fromSecretKey(Uint8Array.from(keypairJson)); +const base58EncodedPrivateKey = bs58.encode(keypair.secretKey); + +console.log(base58EncodedPrivateKey); +``` + +Then, run `node getBase58Pk.js` + +Also set the `RPC_URL_SOLANA_TESTNET` value. Note that while the naming used here is `TESTNET`, it refers to the Solana Devnet. We use `TESTNET` to keep it consistent with the existing EVM testnets. + ## Deploy ### Prepare the OFT Program ID From c5d31cb7a16c6da13bea3fa6cbaccf12a68daae4 Mon Sep 17 00:00:00 2001 From: nazreen Date: Fri, 22 Nov 2024 17:56:00 +0800 Subject: [PATCH 5/6] docs: requested changes - links, emoji --- examples/oft-solana/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/oft-solana/README.md b/examples/oft-solana/README.md index 25995d186..814c00f46 100644 --- a/examples/oft-solana/README.md +++ b/examples/oft-solana/README.md @@ -12,10 +12,10 @@ ## Setup -Ensure that you have Rust, Solana and Anchor installed. If not, follow the instructions in the [official Solana guide](https://solana.com/docs/intro/installation#install-dependencies). On the page as well are instructions on creating a wallet and getting devnet SOL. +Ensure that you have Rust, Solana, and Anchor installed. If not, follow the instructions in the [official Solana guide](https://solana.com/docs/intro/installation#install-dependencies). On the page as well are instructions on creating a wallet and getting devnet SOL. We recommend using `pnpm` as a package manager (but you can of course use a package manager of your choice). -Docker is required to build using anchor. We highly recommend that you use the most up-to-date Docker version to avoid any issues with anchor +[Docker](https://docs.docker.com/get-started/get-docker/) is required to build using anchor. We highly recommend that you use the most up-to-date Docker version to avoid any issues with anchor builds. ### Get the code @@ -69,7 +69,7 @@ console.log(base58EncodedPrivateKey); Then, run `node getBase58Pk.js` -Also set the `RPC_URL_SOLANA_TESTNET` value. Note that while the naming used here is `TESTNET`, it refers to the Solana Devnet. We use `TESTNET` to keep it consistent with the existing EVM testnets. +Also set the `RPC_URL_SOLANA_TESTNET` value. Note that while the naming used here is `TESTNET`, it refers to the [Solana Devnet](https://docs.layerzero.network/v2/developers/evm/technical-reference/deployed-contracts#solana-testnet). We use `TESTNET` to keep it consistent with the existing EVM testnets. ## Deploy @@ -123,7 +123,7 @@ For OFT: pnpm hardhat lz:oft:solana:create --eid 40168 --program-id ``` -:important: You may specify the `--additional-minters` flag to add a CSV of additional minter keys to the mint +:warning: You may specify the `--additional-minters` flag to add a CSV of additional minter keys to the mint multisig. If you do not want to, you must specify `--only-oft-store true`. If you choose the latter approach, you can never substitute in a different mint authority. @@ -139,7 +139,7 @@ For OFT Mint-And-Burn Adapter (MABA): pnpm hardhat lz:oft:solana:create --eid 40168 --program-id --mint --token-program ``` -:important: You may specify the `--additional-minters` flag to add a CSV of additional minter keys to the mint +:warning: You may specify the `--additional-minters` flag to add a CSV of additional minter keys to the mint multisig. If you do not want to, you must specify `--only-oft-store store`. If you choose the latter approach, you can never substitute in a different mint authority. From 4b36db53ffaa55cb6f24b632895fc6d414872d6c Mon Sep 17 00:00:00 2001 From: nazreen Date: Fri, 22 Nov 2024 18:22:53 +0800 Subject: [PATCH 6/6] docs: simplify phrase --- examples/oft-solana/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/oft-solana/README.md b/examples/oft-solana/README.md index 814c00f46..ad3116952 100644 --- a/examples/oft-solana/README.md +++ b/examples/oft-solana/README.md @@ -42,7 +42,7 @@ pnpm test solana airdrop 5 -u devnet ``` -We recommend that you request 5 devnet SOL, which should be sufficient for this walkthrough. For the example here, we will be using Solana Devnet. If you are hitting rate limits after, you can also use the [official Solana faucet](https://faucet.solana.com/). +We recommend that you request 5 devnet SOL, which should be sufficient for this walkthrough. For the example here, we will be using Solana Devnet. If you hit RPC rate limits after, you can also use the [official Solana faucet](https://faucet.solana.com/). ### Prepare `.env`