Snowflake SDK is open-sourced and public on Github now. Discover and contribute to the SDK: https://github.com/snowflake-so/snowflake-sdk
Installation
Install Snowflake SDK for your web3 project.
npm i @snowflake-so/snowflake-sdk
Setting up the SDK configuration
Configure environment variables
Set these environment variables in .env of your project directory.
ANCHOR_WALLET=<PATH_TO_KEYPAIR>
ANCHOR_PROVIDER_URL=<SOLANA_RPC_URL>
Replace the <PATH_TO_KEYPAIR> with the keypair stored on your local machine and <SOLANA_RPC_URL> with the endpoint to the Solana RPC cluster.
Initialize Snowflake
If you don't want to use environment variables, you can follow this approach. To create a new Snowflake service, we would need to initialize with the Provider.
let provider: Provider = Provider.local(API_URL);
The API_URL
is the endpoint to the Solana cluster. Empty API_URL is pointed to the local testnet
Mainnet Beta:
https://api.mainnet-beta.solana.com
Testnet:
https://api.testnet.solana.com
Devnet:
https://api.devnet.solana.com
let snowflake: Snowflake = new Snowflake(provider);