Documentation ¶
Index ¶
- Constants
- func DecodeFelts(felts []*big.Int) ([]byte, error)
- func EncodeFelts(data []byte) (felts []*big.Int)
- func ExponentialBackoff(wait time.Duration) time.Duration
- func FeltsToBig(in []*felt.Felt) (out []*big.Int)
- func Min[T cmp.Ordered](a, b T) T
- func NewTestFeederServer() *httptest.Server
- func NilResultError(funcName string) error
- func NopBackoff(d time.Duration) time.Duration
- func PadBytes(a []byte, length int) []byte
- func XXXMustHexDecodeString(data string) []byte
- type Backoff
- type BatchBuilder
- type CallOps
- type ChainClient
- type Client
- func (c *Client) AccountNonce(ctx context.Context, accountAddress *felt.Felt) (*felt.Felt, error)
- func (c *Client) Batch(ctx context.Context, builder BatchBuilder) ([]gethrpc.BatchElem, error)
- func (c *Client) BlockByHash(ctx context.Context, h *felt.Felt) (FinalizedBlock, error)
- func (c *Client) BlockByNumber(ctx context.Context, id uint64) (FinalizedBlock, error)
- func (c *Client) BlockWithTxHashes(ctx context.Context, blockID starknetrpc.BlockID) (*starknetrpc.Block, error)
- func (c *Client) Call(ctx context.Context, calls starknetrpc.FunctionCall, ...) ([]*felt.Felt, error)
- func (c *Client) CallContract(ctx context.Context, ops CallOps) (data []*felt.Felt, err error)
- func (c *Client) ChainID(ctx context.Context) (string, error)
- func (c *Client) Events(ctx context.Context, input starknetrpc.EventsInput) (*starknetrpc.EventChunk, error)
- func (c *Client) EventsByFilter(ctx context.Context, f starknetrpc.EventsInput) (starknetrpc.EventChunk, error)
- func (c *Client) LatestBlockHashAndNumber(ctx context.Context) (starknetrpc.BlockHashAndNumberOutput, error)
- func (c *Client) LatestBlockHeight(ctx context.Context) (uint64, error)
- func (c *Client) TransactionByHash(ctx context.Context, hash *felt.Felt) (starknetrpc.Transaction, error)
- func (c *Client) TransactionReceipt(ctx context.Context, hash *felt.Felt) (starknetrpc.TransactionReceipt, error)
- type FeederClient
- func (c *FeederClient) TransactionFailure(ctx context.Context, transactionHash *felt.Felt) (*TransactionFailureReason, error)
- func (c *FeederClient) WithBackoff(b Backoff) *FeederClient
- func (c *FeederClient) WithLogger(log utils.SimpleLogger) *FeederClient
- func (c *FeederClient) WithMaxRetries(num int) *FeederClient
- func (c *FeederClient) WithMaxWait(d time.Duration) *FeederClient
- func (c *FeederClient) WithMinWait(d time.Duration) *FeederClient
- type FinalizedBlock
- type Reader
- type ReaderWriter
- type RejectedTransaction
- type TransactionFailureReason
- type Writer
Constants ¶
View Source
const (
FeltLength = 32
)
Variables ¶
This section is empty.
Functions ¶
func DecodeFelts ¶
DecodeFelts is the reverse of EncodeFelts
func EncodeFelts ¶
EncodeFelts takes a byte slice and splits as bunch of felts. First felt indicates the total byte size.
func NewTestFeederServer ¶
Only responds on valid /get_transaction?transactionHash=<TRANSACTION_HASH> requests. fails otherwise
func NilResultError ¶
func XXXMustHexDecodeString ¶
Types ¶
type BatchBuilder ¶
type BatchBuilder interface { RequestBlockByHash(h *felt.Felt) BatchBuilder RequestBlockByNumber(id uint64) BatchBuilder RequestChainID() BatchBuilder // RequestLatestPendingBlock() (BatchBuilder) RequestLatestBlockHashAndNumber() BatchBuilder RequestEventsByFilter(f starknetrpc.EventsInput) BatchBuilder // RequestTxReceiptByHash(h *felt.Felt) (BatchBuilder) Build() []gethrpc.BatchElem }
used to create batch requests
func NewBatchBuilder ¶
func NewBatchBuilder() BatchBuilder
type ChainClient ¶
type ChainClient interface { // only finalized blocks have a block hashes BlockByHash(ctx context.Context, h *felt.Felt) (FinalizedBlock, error) // only finalized blocks have numbers BlockByNumber(ctx context.Context, id uint64) (FinalizedBlock, error) ChainID(ctx context.Context) (string, error) // only way to get the latest pending block (only 1 pending block exists at a time) // LatestPendingBlock(ctx context.Context) (starknetrpc.PendingBlock, error) // returns block number and block has of latest finalized block LatestBlockHashAndNumber(ctx context.Context) (starknetrpc.BlockHashAndNumberOutput, error) // get block logs, event logs, etc. EventsByFilter(ctx context.Context, f starknetrpc.EventsInput) (starknetrpc.EventChunk, error) // TxReceiptByHash(ctx context.Context, h *felt.Felt) (starknetrpc.TransactionReceipt, error) Batch(ctx context.Context, builder BatchBuilder) ([]gethrpc.BatchElem, error) }
type Client ¶
type Client struct { Provider starknetrpc.RpcProvider EthClient *ethrpc.Client // contains filtered or unexported fields }
func NewClient ¶
func NewClient(chainID string, baseURL string, apiKey string, lggr logger.Logger, timeout *time.Duration) (*Client, error)
pass nil or 0 to timeout to not use built in default timeout
func (*Client) AccountNonce ¶
func (*Client) BlockByHash ¶
func (*Client) BlockByNumber ¶
func (*Client) BlockWithTxHashes ¶
func (c *Client) BlockWithTxHashes(ctx context.Context, blockID starknetrpc.BlockID) (*starknetrpc.Block, error)
func (*Client) Call ¶
func (c *Client) Call(ctx context.Context, calls starknetrpc.FunctionCall, blockHashOrTag starknetrpc.BlockID) ([]*felt.Felt, error)
func (*Client) CallContract ¶
func (*Client) Events ¶
func (c *Client) Events(ctx context.Context, input starknetrpc.EventsInput) (*starknetrpc.EventChunk, error)
func (*Client) EventsByFilter ¶
func (c *Client) EventsByFilter(ctx context.Context, f starknetrpc.EventsInput) (starknetrpc.EventChunk, error)
func (*Client) LatestBlockHashAndNumber ¶
func (c *Client) LatestBlockHashAndNumber(ctx context.Context) (starknetrpc.BlockHashAndNumberOutput, error)
func (*Client) LatestBlockHeight ¶
func (*Client) TransactionByHash ¶
func (c *Client) TransactionByHash(ctx context.Context, hash *felt.Felt) (starknetrpc.Transaction, error)
func (*Client) TransactionReceipt ¶
func (c *Client) TransactionReceipt(ctx context.Context, hash *felt.Felt) (starknetrpc.TransactionReceipt, error)
type FeederClient ¶
type FeederClient struct {
// contains filtered or unexported fields
}
func NewFeederClient ¶
func NewFeederClient(clientURL string) *FeederClient
func NewTestFeederClient ¶
func NewTestFeederClient(t *testing.T) *FeederClient
NewTestFeederClient returns a client and a function to close a test server.
func (*FeederClient) TransactionFailure ¶
func (c *FeederClient) TransactionFailure(ctx context.Context, transactionHash *felt.Felt) (*TransactionFailureReason, error)
func (*FeederClient) WithBackoff ¶
func (c *FeederClient) WithBackoff(b Backoff) *FeederClient
func (*FeederClient) WithLogger ¶
func (c *FeederClient) WithLogger(log utils.SimpleLogger) *FeederClient
func (*FeederClient) WithMaxRetries ¶
func (c *FeederClient) WithMaxRetries(num int) *FeederClient
func (*FeederClient) WithMaxWait ¶
func (c *FeederClient) WithMaxWait(d time.Duration) *FeederClient
func (*FeederClient) WithMinWait ¶
func (c *FeederClient) WithMinWait(d time.Duration) *FeederClient
type Reader ¶
type Reader interface { CallContract(context.Context, CallOps) ([]*felt.Felt, error) LatestBlockHeight(context.Context) (uint64, error) // provider interface BlockWithTxHashes(ctx context.Context, blockID starknetrpc.BlockID) (*starknetrpc.Block, error) Call(context.Context, starknetrpc.FunctionCall, starknetrpc.BlockID) ([]*felt.Felt, error) Events(ctx context.Context, input starknetrpc.EventsInput) (*starknetrpc.EventChunk, error) TransactionByHash(context.Context, *felt.Felt) (starknetrpc.Transaction, error) TransactionReceipt(context.Context, *felt.Felt) (starknetrpc.TransactionReceipt, error) AccountNonce(context.Context, *felt.Felt) (*felt.Felt, error) }
type ReaderWriter ¶
type RejectedTransaction ¶
type RejectedTransaction struct {
FailureReason string `json:"transaction_failure_reason"`
}
Click to show internal directories.
Click to hide internal directories.