solana_web3 0.0.1 copy "solana_web3: ^0.0.1" to clipboard
solana_web3: ^0.0.1 copied to clipboard

outdated

Solana Dart API built on the Solana JSON RPC API.

example/main.dart

import 'package:solana_web3/solana_web3.dart' as web3;

void main(final List<String> arguments) async {
  // Create a connection to the devnet cluster.
  final cluster = web3.Cluster.devnet;
  final connection = web3.Connection(cluster);
  
  // Create a new wallet.
  final wallet = web3.Keypair.generate();
  final address = wallet.publicKey;

  // Airdrop some test tokens to the wallet address.
  // NOTE: Airdrops cannot be performed on the mainnet.
  const amount = web3.lamportsPerSol * 2; // Keep this value low.
  print('Airdrop $amount lamports to account $address...');
  final transactionSignature = await connection.requestAirdrop(address, amount);
  await connection.confirmTransaction(transactionSignature);

  // Check the account balance.
  final balance = await connection.getBalance(address);
  print('The account $address has a balance of $balance lamports');
}
15
likes
0
points
879
downloads

Publisher

verified publishermerigolabs.com

Weekly Downloads

Solana Dart API built on the Solana JSON RPC API.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

async, base_codecs, connectivity_plus, crypto, flutter, http, pinenacl

More

Packages that depend on solana_web3