Documentation ¶
Index ¶
- type Client
- func (c *Client) Close()
- func (c *Client) Create(ctx context.Context, schema string, opts ...CreateOption) (TableID, string, error)
- func (c *Client) Hash(ctx context.Context, statement string) (string, error)
- func (c *Client) List(ctx context.Context) ([]TableInfo, error)
- func (c *Client) Read(ctx context.Context, query string, target interface{}, opts ...ReadOption) error
- func (c *Client) Receipt(ctx context.Context, txnHash string, options ...ReceiptOption) (*TxnReceipt, bool, error)
- func (c *Client) SetController(ctx context.Context, controller common.Address, tableID TableID) (string, error)
- func (c *Client) Validate(ctx context.Context, statement string) (TableID, error)
- func (c *Client) Write(ctx context.Context, query string, opts ...WriteOption) (string, error)
- type CreateOption
- type NewClientOption
- func NewClientAlchemyAPIKey(key string) NewClientOption
- func NewClientChain(chain client.Chain) NewClientOption
- func NewClientContractBackend(backend bind.ContractBackend) NewClientOption
- func NewClientInfuraAPIKey(key string) NewClientOption
- func NewClientLocal() NewClientOption
- func NewClientRelayWrites(relay bool) NewClientOption
- type Output
- type ReadOption
- type ReceiptOption
- type TableID
- type TableInfo
- type TxnReceipt
- type WriteOption
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) 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) 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.
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.
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 ¶
TableID is the ID of a Table.
func NewTableID ¶
NewTableID creates a TableID from a string representation of the uint256.
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.