fairy

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package fairy provides a Go client for Neo Fairy RPC.

Index

Constants

View Source
const (
	DefaultRPCURL  = "http://127.0.0.1:16868"
	DefaultTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a Neo Fairy RPC client.

func NewClient

func NewClient(url string) *Client

NewClient creates a new Fairy client.

func (*Client) DeleteSession

func (c *Client) DeleteSession(sessionID string) error

DeleteSession deletes a session.

func (*Client) FundTEEAccount

func (c *Client) FundTEEAccount(sessionID, teeAccountHash string, gasAmount int64) error

FundTEEAccount funds a TEE account with GAS in the session. teeAccount is the script hash of the TEE account.

func (*Client) HelloFairy

func (c *Client) HelloFairy() (map[string]interface{}, error)

HelloFairy tests connectivity to Fairy.

func (*Client) InvokeFunctionWithSession

func (c *Client) InvokeFunctionWithSession(sessionID string, writeSnapshot bool, contractAddress, method string, args []interface{}) (*chain.InvokeResult, error)

InvokeFunctionWithSession invokes a contract method in a session.

func (*Client) IsAvailable

func (c *Client) IsAvailable() bool

IsAvailable checks if Fairy is available.

func (*Client) NewSession

func (c *Client) NewSession() (string, error)

NewSession creates a new testing session.

func (*Client) SetGasBalance

func (c *Client) SetGasBalance(sessionID, account string, balance int64) error

SetGasBalance sets GAS balance for an account in a session.

func (*Client) SetTime

func (c *Client) SetTime(sessionID string, timestamp uint64) error

SetTime sets the virtual time for a session.

func (*Client) SetupSessionWithGas

func (c *Client) SetupSessionWithGas(gasAmount int64) (sessionID, accountHash string, err error)

SetupSessionWithGas creates a session and funds the wallet with GAS. Reads NEO_TESTNET_WIF from environment.

func (*Client) VirtualDeploy

func (c *Client) VirtualDeploy(sessionID, nefPath, manifestPath string) (*VirtualDeployResult, error)

VirtualDeploy deploys a contract virtually in a session.

type VirtualDeployResult

type VirtualDeployResult struct {
	ContractAddress string `json:"contracthash"`
	GasConsumed     string `json:"gasconsumed"`
	State           string `json:"state"`
}

VirtualDeployResult represents the result of VirtualDeploy.

Jump to

Keyboard shortcuts

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