Crates.io | pitchtalk-solana |
lib.rs | pitchtalk-solana |
version | 0.1.0 |
source | src |
created_at | 2024-06-06 12:42:41.840776 |
updated_at | 2024-06-06 12:42:41.840776 |
description | Created with Anchor |
homepage | https://pitchtalk.com |
repository | https://gitlab.com/hapi_p/pitchtalk/pichtalk-solana-contract |
max_upload_size | |
id | 1263663 |
size | 119,104 |
This is a PitchTalk contract for Solana blockchain.
To install everything you need to work with this project, you'll need to install dependencies as described in Anchor documentation.
The source code of pitchtalk program is in ./programs/pitchtalk-solana. To build the pitchtalk-solana program, you need to execute this command:
anchor build
You'll get the following output:
To deploy the program, run this command:
anchor deploy \
--provider.cluster $ANCHOR_PROVIDER_URL \
--program-keypair $KEYPAIR \
--program-name pitchtalk_solana \
--provider.wallet $ANCHOR_WALLET
Before start setup env file with corresponding variables:
Available scripts:
npm run initialize-state <DONATION_FEE> <GRANT_FEE> <INVESTMENT_FEE> <EVENT_FEE>
npm run update-state <DONATION_FEE> <GRANT_FEE> <INVESTMENT_FEE> <EVENT_FEE>
npm run create-admin <ID> <ACCOUNT> <NAME>
npm run update-admin <ID> <ACCOUNT> <NAME>
npm run remove-admin <ID>
npm run add-whitelist-token <ADMIN_ID> <MINT> <DECIMALS> <AUTHORITY_ADDRESS>
To test the pitchtalk-solana program, you need to execute this command:
./tests/test_script.sh
This command starts a local validator, sets up the program on chain and runs a suite of Jest tests against it.
The Javascript/Typescript client for this program.
It's published by this command:
npm publish
Please view the test suite (./tests/**.spec.ts) to see how can this client be used in NodeJS context.
import { Connection, PublicKey } from "@solana/web3.js";
import { Provider } from "@coral-xyz/anchor";
import { PitchTalkProgram } from "@pitchtalk/pitchtalk-solana-cli";
// Setup web3 Connection
const connection = new Connection("https://api.mainnet-beta.solana.com");
// Use Phantom wallet provider
const wallet = window.solana;
// Setup Anchor provider
const provider = new Provider(connection, wallet as any);
// pitchtalk program ID is a well-known public key
const program = new PitchTalkProgram(
new web3.PublicKey(PITCH_TALK_ID),
provider
);