clientlegacy

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT, Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the Tableland client.

func NewClient

func NewClient(ctx context.Context, wallet *wallet.Wallet, opts ...NewClientOption) (*Client, error)

NewClient creates a new Client.

func (*Client) Close

func (c *Client) Close()

Close implements Close.

func (*Client) Create

func (c *Client) Create(ctx context.Context, schema string, opts ...CreateOption) (TableID, string, error)

Create creates a new table on the Tableland.

func (*Client) Hash

func (c *Client) Hash(ctx context.Context, statement string) (string, error)

Hash validates the provided create table statement and returns its hash.

func (*Client) List

func (c *Client) List(ctx context.Context) ([]TableInfo, error)

List lists something.

func (*Client) Read

func (c *Client) Read(ctx context.Context, query string, target interface{}, opts ...ReadOption) error

Read runs a read query with the provided opts and unmarshals the results into target.

func (*Client) Receipt

func (c *Client) Receipt(
	ctx context.Context,
	txnHash string,
	options ...ReceiptOption,
) (*TxnReceipt, bool, error)

Receipt gets a transaction receipt.

func (*Client) SetController

func (c *Client) SetController(
	ctx context.Context,
	controller common.Address,
	tableID TableID,
) (string, error)

SetController sets the controller address for the specified table.

func (*Client) Validate

func (c *Client) Validate(ctx context.Context, statement string) (TableID, error)

Validate validates a write query, returning the table id.

func (*Client) Write

func (c *Client) Write(ctx context.Context, query string, opts ...WriteOption) (string, error)

Write initiates a write query, returning the txn hash.

type CreateOption

type CreateOption func(*createConfig)

CreateOption controls the behavior of Create.

func WithPrefix

func WithPrefix(prefix string) CreateOption

WithPrefix allows you to specify an optional table name prefix where the final table name will be <prefix>_<chain-id>_<tableid>.

func WithReceiptTimeout

func WithReceiptTimeout(timeout time.Duration) CreateOption

WithReceiptTimeout specifies how long to wait for the Tableland receipt that contains the table id.

type NewClientOption

type NewClientOption func(*config)

NewClientOption controls the behavior of NewClient.

func NewClientAlchemyAPIKey

func NewClientAlchemyAPIKey(key string) NewClientOption

NewClientAlchemyAPIKey specifies an Alchemy API to use when creating an EVM backend.

func NewClientChain

func NewClientChain(chain client.Chain) NewClientOption

NewClientChain specifies chaininfo.

func NewClientContractBackend

func NewClientContractBackend(backend bind.ContractBackend) NewClientOption

NewClientContractBackend specifies a custom EVM backend to use.

func NewClientInfuraAPIKey

func NewClientInfuraAPIKey(key string) NewClientOption

NewClientInfuraAPIKey specifies an Infura API to use when creating an EVM backend.

func NewClientLocal

func NewClientLocal() NewClientOption

NewClientLocal specifies that a local EVM backend should be used.

func NewClientRelayWrites

func NewClientRelayWrites(relay bool) NewClientOption

NewClientRelayWrites specifies whether or not to relay write queries through the Tableland validator.

type Output

type Output string

Output is used to control the output format of a Read using the ReadOutput option.

const (
	// Table returns the query results as a JSON object with columns and rows properties.
	Table Output = "table"
	// Objects returns the query results as a JSON array of JSON objects. This is the default.
	Objects Output = "objects"
)

type ReadOption

type ReadOption func(*legacy.RunReadQueryRequest)

ReadOption controls the behavior of Read.

func ReadExtract

func ReadExtract() ReadOption

ReadExtract specifies whether or not to extract the JSON object from the single property of the surrounding JSON object. Default is false.

func ReadOutput

func ReadOutput(output Output) ReadOption

ReadOutput sets the output format. Default is Objects.

func ReadUnwrap

func ReadUnwrap() ReadOption

ReadUnwrap specifies whether or not to unwrap the returned JSON objects from their surrounding array. Default is false.

type ReceiptOption

type ReceiptOption func(*receiptConfig)

ReceiptOption controls the behavior of calls to Receipt.

func WaitFor

func WaitFor(timeout time.Duration) ReceiptOption

WaitFor causes calls to Receipt to wait for the specified duration.

type TableID

type TableID big.Int

TableID is the ID of a Table.

func NewTableID

func NewTableID(strID string) (TableID, error)

NewTableID creates a TableID from a string representation of the uint256.

func (TableID) String

func (tid TableID) String() string

String returns a string representation of the TableID.

func (TableID) ToBigInt

func (tid TableID) ToBigInt() *big.Int

ToBigInt returns a *big.Int representation of the TableID.

type TableInfo

type TableInfo struct {
	Controller string    `json:"controller"`
	Name       string    `json:"name"`
	Structure  string    `json:"structure"`
	CreatedAt  time.Time `json:"created_at"`
}

TableInfo summarizes information about a table.

type TxnReceipt

type TxnReceipt struct {
	ChainID       client.ChainID `json:"chain_id"`
	TxnHash       string         `json:"txn_hash"`
	BlockNumber   int64          `json:"block_number"`
	Error         string         `json:"error"`
	ErrorEventIdx int            `json:"error_event_idx"`
	TableID       *string        `json:"table_id,omitempty"`
}

TxnReceipt is a Tableland event processing receipt. TODO(json-rpc): remove client_legacy package when support is dropped.

type WriteOption

type WriteOption func(*writeConfig)

WriteOption controls the behavior of Write.

func WriteRelay

func WriteRelay(relay bool) WriteOption

WriteRelay specifies whether or not to relay write queries through the Tableland validator. Default behavior is false for main net EVM chains, true for all others.

Jump to

Keyboard shortcuts

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