diff --git a/README-tech.md b/README-tech.md index d4cf71e..1b55606 100644 --- a/README-tech.md +++ b/README-tech.md @@ -75,3 +75,100 @@ npm run lint:fix ## Localnet to Devnet +### Switch to Devnet + +Change your Solana CLI to use the Devnet: + +```bash +solana config set --url https://api.devnet.solana.com +``` + +### Fund Your Wallet + +Airdrop SOL to your Devnet wallet: + +```bash +solana airdrop +``` + +### Update Anchor Configuration + +Modify your `Anchor.toml` file: + +Replace: +```bash +[provider] +cluster = "localnet" +``` +By: +```bash +[provider] +cluster = "devnet" +``` + +Add : +```bash +[programs.devnet] +nft_ticketing = "" +``` + +### Environment Variables + +In `/app/front/.env` (Next.js App): +Replace: +```bash +NEXT_PUBLIC_REACT_APP_SOLANA_NETWORK="localnet" +``` +By: +```bash +NEXT_PUBLIC_REACT_APP_SOLANA_NETWORK="devnet" +``` + +### Phantom Wallet + +In your Phantom settings, switch **Solana Localnet** to **Solana Devnet**. + +### Build and Deploy the Anchor Program + +Build: + +```bash +anchor build +``` + +Deploy on the Devnet: + +```bash +anchor deploy --provider.cluster devnet +``` +### Update Program ID + +Automatically update the Program ID in the necessary files: + +```bash +npm run update-program-id +``` + +// anchor build && anchor deploy ??? + +### IDL Setup + +Copy the IDL (Interface Definition Language) file into the Next.js App: + +```bash +npm run copy-idl +``` + +### Run Front-End (Next.js App) + +Go to the Next.js App Directory: + +```bash +cd //anchor-nft-ticketing/app/front +``` + +Start the development server: + +```bash +npm run dev +``` diff --git a/README.md b/README.md index 38f1969..171addd 100644 --- a/README.md +++ b/README.md @@ -120,10 +120,12 @@ Start the Solana local validator (solana-test-validator) with Metaplex: npm run ledger ``` -after starting the Solana local validator, you will probably need to do an airdrop(s): +### Fund Your Wallet + +After starting the Solana local validator, you will probably need to airdrop SOL to your Localnet wallet: ```bash -solana airdrop +solana airdrop ``` ### Build and Deploy the Anchor Program @@ -142,7 +144,7 @@ anchor deploy > **PS**: `anchor deploy` will create your `target/idl/nft_ticketing.json` file. -### Change Program ID +### Update Program ID Automatically update the Program ID in the necessary files: diff --git a/sh/update-program-id.sh b/sh/update-program-id.sh index d063769..2982129 100755 --- a/sh/update-program-id.sh +++ b/sh/update-program-id.sh @@ -11,7 +11,7 @@ for PROGRAM in "${PROGRAMS[@]}"; do PROGRAM_PATH=${PROGRAM//_/-} # Mise à jour de Anchor.toml pour chaque programme - sed -i "s/${PROGRAM} = \"[^\"]*\"/${PROGRAM} = \"$PROGRAM_ID\"/" Anchor.toml + sed -i "/^\[programs\./,/^\[/ s/^$PROGRAM = \"[^\"]*\"/$PROGRAM = \"$PROGRAM_ID\"/" Anchor.toml # Mise à jour de lib.rs pour chaque programme sed -i "s/declare_id!(\"[^\"]*\")/declare_id!(\"$PROGRAM_ID\")/" programs/${PROGRAM_PATH}/src/lib.rs