solana_jsonrpc

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

solana jsonrpc

A HTTP and Websocket client for Solana's JSON RPC API methods. #
import 'dart:convert' show jsonEncode;
import 'package:solana_jsonrpc/jsonrpc.dart';

void main() async {
final client = JsonRpcHttpClient(Cluster.devnet.uri);
final method = GetBalance('83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri');
final response = await client.send(method.request(), method.response);
print(jsonEncode(response)); // {"jsonrpc":"2.0","result":{"context":{"slot":1},"value":0},"id":1}
}

class GetBalance extends JsonRpcContextMethod<int, int> {
GetBalance(final String pubkey): super('getBalance', values: [pubkey]);
@override int valueDecoder(final int value) => value;
}
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.