Documentation ¶
Index ¶
- Constants
- func CompareAddress(a, b string) bool
- func DecodeFelts(felts []*big.Int) ([]byte, error)
- func EncodeFelts(data []byte) (felts []*big.Int)
- func FeltToUnsignedBig(felt *caigotypes.Felt) (num *big.Int, err error)
- func FeltsToBig(in []*caigotypes.Felt) (out []*big.Int)
- func HexToUnsignedBig(str string) (num *big.Int, err error)
- func IsEventFromContract(event *caigogw.Event, address caigotypes.Hash, eventName string) bool
- func Min[T constraints.Ordered](a, b T) T
- func NilResultError(funcName string) error
- func PadBytes(a []byte, length int) []byte
- func StringsToFelt(in []string) (out []*caigotypes.Felt, _ error)
- func XXXMustHexDecodeString(data string) []byte
- type CallOps
- type Client
- func (c *Client) AccountNonce(ctx context.Context, address caigotypes.Hash) (*big.Int, error)
- func (c *Client) BlockByHash(ctx context.Context, hash string, _ string) (*caigogw.Block, error)
- func (c *Client) BlockByNumber(ctx context.Context, num *big.Int, _ string) (*caigogw.Block, error)
- func (c *Client) BlockByNumberGateway(ctx context.Context, blockNum uint64) (block *caigogw.Block, err error)
- func (c *Client) Call(ctx context.Context, calls caigotypes.FunctionCall, blockHashOrTag string) ([]string, error)
- func (c *Client) CallContract(ctx context.Context, ops CallOps) (res []string, err error)
- func (c *Client) ChainID(ctx context.Context) (string, error)
- func (c *Client) EstimateFee(ctx context.Context, call caigotypes.FunctionInvoke, hash string) (*caigotypes.FeeEstimate, error)
- func (c *Client) Invoke(ctx context.Context, invoke caigotypes.FunctionInvoke) (*caigotypes.AddInvokeTransactionOutput, error)
- func (c *Client) LatestBlockHeight(ctx context.Context) (height uint64, err error)
- func (c *Client) TransactionByHash(ctx context.Context, hash string) (*caigogw.Transaction, error)
- func (c *Client) TransactionReceipt(ctx context.Context, hash string) (*caigogw.TransactionReceipt, error)
- type Reader
- type ReaderWriter
- type Writer
Constants ¶
View Source
const (
FeltLength = 32
)
Variables ¶
This section is empty.
Functions ¶
func CompareAddress ¶
CompareAddress compares different hex starknet addresses with potentially different 0 padding
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 FeltToUnsignedBig ¶
func FeltToUnsignedBig(felt *caigotypes.Felt) (num *big.Int, err error)
func FeltsToBig ¶
func FeltsToBig(in []*caigotypes.Felt) (out []*big.Int)
func IsEventFromContract ¶
func Min ¶
func Min[T constraints.Ordered](a, b T) T
func NilResultError ¶
func StringsToFelt ¶
func StringsToFelt(in []string) (out []*caigotypes.Felt, _ error)
StringsToFelt maps felts from 'string' (hex) representation to 'caigo.Felt' representation
func XXXMustHexDecodeString ¶
Types ¶
type CallOps ¶
type CallOps struct { ContractAddress caigotypes.Hash Selector string Calldata []string }
type Client ¶
type Client struct { Gw *caigogw.GatewayProvider // contains filtered or unexported fields }
func NewClient ¶
func NewClient(chainID string, baseURL 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) BlockByNumberGateway ¶
func (*Client) Call ¶
func (c *Client) Call(ctx context.Context, calls caigotypes.FunctionCall, blockHashOrTag string) ([]string, error)
func (*Client) CallContract ¶
func (*Client) EstimateFee ¶
func (c *Client) EstimateFee(ctx context.Context, call caigotypes.FunctionInvoke, hash string) (*caigotypes.FeeEstimate, error)
func (*Client) Invoke ¶
func (c *Client) Invoke(ctx context.Context, invoke caigotypes.FunctionInvoke) (*caigotypes.AddInvokeTransactionOutput, error)
func (*Client) LatestBlockHeight ¶
func (*Client) TransactionByHash ¶
func (*Client) TransactionReceipt ¶
type Reader ¶
type Reader interface { CallContract(context.Context, CallOps) ([]string, error) LatestBlockHeight(context.Context) (uint64, error) BlockByNumberGateway(context.Context, uint64) (*caigogw.Block, error) // provider interface BlockByHash(context.Context, string, string) (*caigogw.Block, error) BlockByNumber(context.Context, *big.Int, string) (*caigogw.Block, error) Call(context.Context, caigotypes.FunctionCall, string) ([]string, error) ChainID(context.Context) (string, error) }
type ReaderWriter ¶
type Writer ¶
type Writer interface { AccountNonce(context.Context, caigotypes.Hash) (*big.Int, error) Invoke(context.Context, caigotypes.FunctionInvoke) (*caigotypes.AddInvokeTransactionOutput, error) TransactionByHash(context.Context, string) (*caigogw.Transaction, error) TransactionReceipt(context.Context, string) (*caigogw.TransactionReceipt, error) EstimateFee(context.Context, caigotypes.FunctionInvoke, string) (*caigotypes.FeeEstimate, error) }
Click to show internal directories.
Click to hide internal directories.