client

package
v0.1.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialContext

func DialContext(ctx Context) (*types.NubitClient, error)

DialContext creates a new RPC client, just like Dial.

The context is used to cancel or time out the initial connection establishment. It does not affect subsequent interactions with the client.

func DialHTTP

func DialHTTP(ctx Context) (*types.NubitClient, error)

DialHTTP creates a new RPC client that connects to an RPC server over HTTP.

func DialHTTPWithClient

func DialHTTPWithClient(ctx Context) (*types.NubitClient, error)

DialHTTPWithClient creates a new RPC client that connects to an RPC server over HTTP using the provided HTTP Client.

Types

type Client

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

func Dial

func Dial(ctx Context) (*Client, error)

func NewClient

func NewClient(ctx Context, c *types.NubitClient) *Client

func (*Client) CountDatasize

func (c *Client) CountDatasize(ctx context.Context) (data *types2.CountRsp, err error)

CountDatasize indexer-countDatasize

func (*Client) CountNamespace

func (c *Client) CountNamespace(ctx context.Context) (data *types.CountRsp, err error)

CountNamespace indexer-countNamespace

func (*Client) CountTransactions

func (c *Client) CountTransactions(ctx context.Context) (data *types.CountRsp, err error)

CountTransactions indexer-countTransactions

func (*Client) CountUsers

func (c *Client) CountUsers(ctx context.Context) (data *types.CountRsp, err error)

CountUsers indexer-countUsers

func (*Client) CreateNamespace

func (c *Client) CreateNamespace(ctx context.Context, req *types.CreateNameSpaceReq, privateKey *ecdsa.PrivateKey, payParams *types.PaymentParams) (data *types.DataUploadRsp, err error)

func (*Client) GetBlockHeaderByNumber

func (c *Client) GetBlockHeaderByNumber(ctx context.Context, req *types.GetBlockHeaderByNumberReq) (data *types.GetBlockHeaderByNumberRsp, err error)

func (*Client) GetDAIDByTxID

func (c *Client) GetDAIDByTxID(ctx context.Context, req *types2.QueryTxReq) (data *types2.GetDAIDRsp, err error)

func (*Client) GetData

func (c *Client) GetData(ctx context.Context, req *types2.GetDataReq) (data *types2.GetDataRsp, err error)

func (*Client) GetDataByDAID

func (c *Client) GetDataByDAID(ctx context.Context, req *types2.GetDataReq) (data *types2.GetDataCallRsp, err error)

func (*Client) GetDataIDByUser

func (c *Client) GetDataIDByUser(ctx context.Context, req *types2.GetDataByUserReq) (data *types2.GetDataByUserRsp, err error)

func (*Client) GetDataInNamespace

func (c *Client) GetDataInNamespace(ctx context.Context, req *types.GetDataInNamespaceReq) (data *types.GetDataInNamespaceRsp, err error)

func (*Client) GetDataStatus

func (c *Client) GetDataStatus(ctx context.Context, req *types2.GetDataStatusReq) (data *types2.GetDataStatusRsp, err error)

func (*Client) GetDatas

func (c *Client) GetDatas(ctx context.Context, req *types.GetDatasReq) (data *types.GetDatasRsp, err error)

func (*Client) GetEstimateFee

func (c *Client) GetEstimateFee(ctx context.Context, req any, privateKey *ecdsa.PrivateKey, method string, nid string) (data *types2.EstimateFee, err error)

func (*Client) GetInvoice

func (c *Client) GetInvoice(ctx context.Context, req *types.GetInvoiceReq) (data *types.Invoice, err error)

func (*Client) GetLastNamespaceID

func (c *Client) GetLastNamespaceID(ctx context.Context, req *types.GetLastNamespaceIDReq) (data *types.GetLastNamespaceIDRsp, err error)

func (*Client) GetLatestBlockNumber

func (c *Client) GetLatestBlockNumber(ctx context.Context) (data *types.GetLatestBlockNumberRsp, err error)

func (*Client) GetNIDByTxID

func (c *Client) GetNIDByTxID(ctx context.Context, req *types.QueryTxReq) (data *types.GetNIDRsp, err error)

func (*Client) GetNamespace

func (c *Client) GetNamespace(ctx context.Context, req *types.GetNamespaceReq) (data *types.GetNamespaceRsp, err error)

func (*Client) GetNamespaceByUser

func (c *Client) GetNamespaceByUser(ctx context.Context, req *types.GetNamespaceByUserReq) (data *types.GetNamespaceByUserRsp, err error)

GetNamespaceByUser Deprecated: use GetTransactions instead.

func (*Client) GetNamespaceStatus

func (c *Client) GetNamespaceStatus(ctx context.Context, req *types.GetNamespaceStatusReq) (data *types.GetNamespaceStatusRsp, err error)

func (*Client) GetNamespaces

func (c *Client) GetNamespaces(ctx context.Context, req *types.GetNamespacesReq) (data *types.GetNamespacesRsp, err error)

GetNamespaces indexer-getNamespaces

func (*Client) GetNonce

func (c *Client) GetNonce(ctx context.Context, req *types.GetNonceReq) (data *types.GetNonceRsp, err error)

func (*Client) GetPayee

func (c *Client) GetPayee(ctx context.Context) (data *types.Payee, err error)

func (*Client) GetTotalDataIDsInNamesapce

func (c *Client) GetTotalDataIDsInNamesapce(ctx context.Context, req *types.GetTotalDataIDsInNamesapceReq) (data *types.GetTotalDataIDsInNamesapceRsp, err error)

func (*Client) GetTransaction

func (c *Client) GetTransaction(ctx context.Context, req *types.GetTransactionReq) (data *types.GetTransactionRsp, err error)

func (*Client) GetTransactions

func (c *Client) GetTransactions(ctx context.Context, req *types.GetTransactionsReq) (data *types.GetTransactionsRsp, err error)

GetTransactions indexer-getTransactions

func (*Client) GetTxIDByDataID

func (c *Client) GetTxIDByDataID(ctx context.Context, req *types.GetTransactionsReq) (data *types.GetTransactionsRsp, err error)

GetTxIDByDataID indexer-getTxIDByDataID

func (*Client) SubmitTransaction

func (c *Client) SubmitTransaction(ctx context.Context, req *types.TxReq) (data *types.TxRsp, err error)

func (*Client) TransferNamespace

func (c *Client) TransferNamespace(ctx context.Context, req *types.TransferNamespaceReq, privateKey *ecdsa.PrivateKey, payParams *types.PaymentParams) (data *types.DataUploadRsp, err error)

func (*Client) UpdateNamespace

func (c *Client) UpdateNamespace(ctx context.Context, req *types.UpdateNamespaceReq, privateKey *ecdsa.PrivateKey, payParams *types.PaymentParams) (data *types.DataUploadRsp, err error)

func (*Client) Upload

func (c *Client) Upload(ctx context.Context, data *types2.DataUploadReq, privateKey *ecdsa.PrivateKey, payParams *types2.PaymentParams) (target *types2.DataUploadRsp, err error)

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

ClientOption is a configuration option for the RPC client.

func WithBatchItemLimit

func WithBatchItemLimit(limit int) ClientOption

WithBatchItemLimit changes the maximum number of items allowed in batch requests.

Note: this option applies when processing incoming batch requests. It does not affect batch requests sent by the client.

func WithBatchResponseSizeLimit

func WithBatchResponseSizeLimit(sizeLimit int) ClientOption

WithBatchResponseSizeLimit changes the maximum number of response bytes that can be generated for batch requests. When this limit is reached, further calls in the batch will not be processed.

Note: this option applies when processing incoming batch requests. It does not affect batch requests sent by the client.

func WithHTTPAuth

func WithHTTPAuth(a HTTPAuth) ClientOption

WithHTTPAuth configures HTTP request authentication. The given provider will be called whenever a request is made. Note that only one authentication provider can be active at any time.

func WithHTTPClient

func WithHTTPClient(c *http.Client) ClientOption

WithHTTPClient configures the http.Client used by the RPC client.

func WithHeader

func WithHeader(key, value string) ClientOption

WithHeader configures HTTP headers set by the RPC client. Headers set using this option will be used for both HTTP and WebSocket connections.

func WithHeaders

func WithHeaders(headers http.Header) ClientOption

WithHeaders configures HTTP headers set by the RPC client. Headers set using this option will be used for both HTTP and WebSocket connections.

func WithWebsocketDialer

func WithWebsocketDialer(dialer websocket.Dialer) ClientOption

WithWebsocketDialer configures the websocket.Dialer used by the RPC client.

func WithWebsocketMessageSizeLimit

func WithWebsocketMessageSizeLimit(messageSizeLimit int64) ClientOption

WithWebsocketMessageSizeLimit configures the websocket message size limit used by the RPC client. Passing a limit of 0 means no limit.

type Context

type Context struct {
	context.Context
	NubitRpc string
	ProxyRpc string
	UriMap   map[string]string
}

func Background

func Background() Context

func UrlCtx

func UrlCtx(url string) Context

func WithMoc

func WithMoc(ctx Context) Context

func WithRelease

func WithRelease(ctx Context) Context

type HTTPAuth

type HTTPAuth func(h http.Header) error

A HTTPAuth function is called by the client whenever a HTTP request is sent. The function must be safe for concurrent use.

Usually, HTTPAuth functions will call h.Set("authorization", "...") to add auth information to the request.

type ID

type ID string

ID defines a pseudo random number that is used to identify RPC subscriptions.

func NewID

func NewID() ID

NewID returns a new, random ID.

type Uri

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

func NewUri

func NewUri(ctx Context) *Uri

func (*Uri) GetUri

func (u *Uri) GetUri(name string) string

Jump to

Keyboard shortcuts

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