Skip to content

Eclipse-Laboratories-Inc/devnet-faucet

Repository files navigation

HOW TO GET TOKENS

Configure your file system wallet and run this script.

ANCHOR_WALLET=~/.config/solana/id.json ANCHOR_PROVIDER_URL=https://staging-rpc.dev.eclipsenetwork.xyz  node setup/token_airdrop.js

SPL token faucet

This project aims at implementing an SPL token faucet in its simplest form using Anchor. Faucets are a must-have when developing dApps to test out token flows. A faucet allows you to receive an arbitrary amount of tokens; always coming from the same Mint. This program is deployoned on the eclipse testnet as 9XXyjMZtennyC1fRSLvUpiq9UuAfFpCS1a8RSzcg8rMH and the mint is 6tyZgRJkMcqqKAVt26xc25tv5HK7ZGFNrYB3aGgpyEQA

Program

Running the program on Localnet

Swith to localnet.

solana config set --url http://127.0.0.1:8899

Run

rm -rf test-ledger && solana-test-validator

This will spin up a local validator that our client interacts with. More info on setting up a local validator can be found here.

Anchor program building and deployment

Follow this tutorial for an in depth-explanation on how to build your anchor program and deploy it to the different clusters.

In order to build the program use following command.

anchor build

Now you can deploy it.

anchor deploy
ANCHOR_WALLET=~/.config/solana/id.json ANCHOR_PROVIDER_URL=https://staging-rpc.dev.eclipsenetwork.xyz  node setup/token_airdrop.js

Running program tests

Before it's possible to run tests, all packages need to be installed and mocha-ts and typescript need to be globally installed.

npm install -g ts-mocha typescript
npm install

Run all tests by using following command.

anchor test

Client

Running the client locally

Go to the app directory and run following command.

npm start

Running client tests

Before it's possible to run tests, all packages need to be installed. Make sure you are in the app directory.

npm install

Now it's possible to run UI tests.

npm test