Documentation ¶
Index ¶
- Constants
- func FindProgramAddress(seeds []byte, program address.RawAddress) (address.Address, error)
- func ProgramDerivedAddress(seeds pack.Bytes, program address.Address) address.Address
- func SendRawPost(data []byte, url string) (*http.Response, error)
- func SendRequest(request Request, url string) (*http.Response, error)
- func SendRequestWithRetry(request Request, url string, timeoutInSecs int, retries int) (response *http.Response, err error)
- func UniquePubkey() address.Address
- type AccountContext
- type AccountValue
- type AddressDecoder
- type AddressEncodeDecoder
- type AddressEncoder
- type Client
- type ClientOptions
- type Error
- type Request
- type Response
- type ResponseGetAccountInfo
Constants ¶
const DefaultClientRPCURL = "http://localhost:8899"
DefaultClientRPCURL is the default RPC URL for the Solana cluster.
Variables ¶
This section is empty.
Functions ¶
func FindProgramAddress ¶ added in v0.3.0
FindProgramAddress is a wrapper function that calls the Solana FFI to find the deterministic program-derived address using the program and seeds.
func ProgramDerivedAddress ¶ added in v0.3.0
ProgramDerivedAddress derives an address for an account that only the given program has the authority to sign. The address is of the same form as a Solana pubkey, except they are ensured to not be on the es25519 curve and thus have no associated private key. This address is deterministic, based upon the program and the seeds slice.
func SendRawPost ¶
SendRawPost sends a raw bytes as a POST request to the URL specified
func SendRequest ¶
SendRequest sends the JSON-2.0 request to the target url and returns the response and any error.
func SendRequestWithRetry ¶
func SendRequestWithRetry(request Request, url string, timeoutInSecs int, retries int) (response *http.Response, err error)
SendRequestWithRetry calls SendRequest but with configurable retry logic
func UniquePubkey ¶ added in v0.3.0
UniquePubkey creates an atomically incrementing pubkey used for tests and benchmarking purposes.
Types ¶
type AccountContext ¶
type AccountContext struct {
Slot int `json:"slot"`
}
AccountContext is the JSON-interface of the account's context representing what slot the account's value has been returned for.
type AccountValue ¶
type AccountValue struct { Data [2]string `json:"data"` Executable bool `json:"executable"` Lamports int `json:"lamports"` Owner string `json:"owner"` RentEpoch int `json:"rentEpoch"` }
AccountValue is the JSON-interface of the account's information.
type AddressDecoder ¶
type AddressDecoder struct{}
AddressDecoder implements the address.Decoder interface.
func (AddressDecoder) DecodeAddress ¶
func (AddressDecoder) DecodeAddress(encoded address.Address) (address.RawAddress, error)
DecodeAddress consumes a human-readable Base58 format and decodes it into a raw byte-representation.
type AddressEncodeDecoder ¶ added in v0.3.0
type AddressEncodeDecoder struct { AddressEncoder AddressDecoder }
AddressEncodeDecoder implements the address.EncodeDecoder interface.
func NewAddressEncodeDecoder ¶ added in v0.3.0
func NewAddressEncodeDecoder() AddressEncodeDecoder
NewAddressEncodeDecoder constructs and returns a new AddressEncodeDecoder.
type AddressEncoder ¶ added in v0.3.0
type AddressEncoder struct{}
AddressEncoder implements the address.Encoder interface.
func (AddressEncoder) EncodeAddress ¶ added in v0.3.0
func (AddressEncoder) EncodeAddress(rawAddress address.RawAddress) (address.Address, error)
EncodeAddress consumes a raw byte-representation of an address and encodes it to the human-readable Base58 format.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a Solana client that implements the multichain Contract API.
func NewClient ¶
func NewClient(opts ClientOptions) *Client
NewClient returns a new solana.Client interface that implements the multichain Contract API.
func (*Client) CallContract ¶
func (client *Client) CallContract( ctx context.Context, program address.Address, calldata contract.CallData, ) (pack.Bytes, error)
CallContract implements the multichain Contract API. In the case of Solana, it is used to fetch burn logs associated with a particular burn nonce.
type ClientOptions ¶
ClientOptions define the options to instantiate a new Solana client.
func DefaultClientOptions ¶
func DefaultClientOptions() ClientOptions
DefaultClientOptions return the client options used to instantiate a Solana client by default.
func (ClientOptions) WithRPCURL ¶ added in v0.3.0
func (opts ClientOptions) WithRPCURL(rpcURL pack.String) ClientOptions
WithRPCURL returns a modified version of the options with the given API rpc-url
type Error ¶
type Error struct { Code int `json:"code"` Message string `json:"message"` Data *json.RawMessage `json:"data"` }
Error defines a JSON-RPC 2.0 error object. See https://www.jsonrpc.org/specification for more information.
type Request ¶
type Request struct { Version string `json:"jsonrpc"` ID interface{} `json:"id"` Method string `json:"method"` Params json.RawMessage `json:"params,omitempty"` }
Request defines a JSON-RPC 2.0 request object. See https://www.jsonrpc.org/specification for more information. A Request should not be explicitly created, but instead unmarshaled from JSON.
type Response ¶
type Response struct { Version string `json:"jsonrpc"` ID interface{} `json:"id"` Result *json.RawMessage `json:"result,omitempty"` Error *Error `json:"error,omitempty"` }
Response defines a JSON-RPC 2.0 response object. See https://www.jsonrpc.org/specification for more information. A Response is usually marshaled into bytes and returned in response to a Request.
type ResponseGetAccountInfo ¶
type ResponseGetAccountInfo struct { Context AccountContext `json:"context"` Value AccountValue `json:"value"` }
ResponseGetAccountInfo is the JSON-interface of the response for the getAccountInfo query.