- Install
node
andyarn
- Install
script
as global command - Confirm the solana wallet preparation. ex:
wallet.json
- Main script source for all functionality is here:
/lib/script.ts
- Program account types are declared here:
/lib/types.ts
Able to test the script functions working in this way.
- Change commands properly in the main functions of the
script.ts
file to call the other functions - Run
yarn script
with parameters
First of all, you have to git clone in your PC.
In the folder nft_staking-staking
, in the terminal
-
yarn
-
anchor build
In the last sentence you can see:
To deploy this program:
$ solana program deploy ./target/deploy/nft_staking.so
The program address will default to this keypair (override with --program-id):
./target/deploy/nft_staking-keypair.json
solana-keygen pubkey ./target/deploy/nft_staking.json
- You can get the pubkey of the
program ID : ex."5N...x6k"
- Please add this pubkey to the lib.rs
declare_id!("5N...x6k");
- Please add this pubkey to the Anchor.toml
nft_staking = "5N...x6k"
anchor build
againsolana program deploy ./target/deploy/nft_staking.so
Then, you can enjoy this program
First of all, open the directory and yarn
yarn script init
yarn script stake -m <MINT ADDRESS>
yarn script unstake -m <MINT ADDRESS>
yarn script user-status -a <USER_ADDRESS>
Get status of user <USER_ADDRESS>.
yarn script get-users
Get all users stake info