go-solana

module
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2024 License: MIT

README

go-solana

Example
package main

import (
	"context"
	"fmt"
	"github.com/cielu/go-solana/common"
	"github.com/cielu/go-solana/core"
	"github.com/cielu/go-solana/rpc"
	"github.com/cielu/go-solana/solclient"
	"math/big"
)

func main() {
	var (
		ctx = context.Background()
	)
	c, err := solclient.Dial(rpc.DevnetRPCEndpoint)
	// err
	if err != nil {
		panic("Failed Dial Solana RPC")
	}
	// account
	account := common.Base58ToAddress("So11111111111111111111111111111111111111112")
	// get AccountInfo
	res, err := c.GetAccountInfo(ctx, account)
	// has err
	if err != nil {
		fmt.Errorf("GetAccountInfo Failed: %w", err)
		return
	}
	
	core.BeautifyConsole("AccountInfo:", res)

	// request Airdrop
	signature, err := c.RequestAirdrop(ctx, account, big.NewInt(1000000000))
	// has err
	if err != nil {
		fmt.Errorf("RequestAirdrop Failed: %w", err)
		return
	}

	core.BeautifyConsole("signature:", signature)
}



Directories

Path Synopsis
pkg
base
Package field implements fast arithmetic modulo 2^255-19.
Package field implements fast arithmetic modulo 2^255-19.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL