Documentation
¶
Index ¶
- func ComputeBlockNumberToAttestTo(epochInfo *types.EpochInfo, attestWindow uint64) types.BlockNumber
- func FetchAttestWindow[S Signer](ctx context.Context, signer S) (uint64, error)
- func FetchBalance[S Signer](ctx context.Context, signer S, address *types.Address) (types.Balance, error)
- func FetchEpochAndAttestInfo[S Signer](ctx context.Context, signer S, logger log.Logger) (types.EpochInfo, types.AttestInfo, error)
- func FetchEpochInfo[S Signer](ctx context.Context, signer S) (types.EpochInfo, error)
- func HashAndSignTx(ctx context.Context, bTx *rpc.BroadcastInvokeTxnV3, chainID *felt.Felt, ...) (signer.Response, error)
- func ReadableContractError(err error) error
- func SignInvokeTx(ctx context.Context, invokeTxnV3 *rpc.BroadcastInvokeTxnV3, chainID *felt.Felt, ...) error
- type ExternalSigner
- func (s *ExternalSigner) Address() *types.Address
- func (s *ExternalSigner) BlockWithTxHashes(ctx context.Context, blockID rpc.BlockID) (any, error)
- func (s *ExternalSigner) BuildAttestTransaction(ctx context.Context, blockhash *types.BlockHash) (rpc.BroadcastInvokeTxnV3, error)
- func (s *ExternalSigner) Call(ctx context.Context, call rpc.FunctionCall, blockID rpc.BlockID) ([]*felt.Felt, error)
- func (s *ExternalSigner) EstimateFee(ctx context.Context, txn *rpc.BroadcastInvokeTxnV3) (rpc.FeeEstimation, error)
- func (s *ExternalSigner) InvokeTransaction(ctx context.Context, txn *rpc.BroadcastInvokeTxnV3) (rpc.AddInvokeTransactionResponse, error)
- func (s *ExternalSigner) Nonce(ctx context.Context) (*felt.Felt, error)
- func (s *ExternalSigner) SignTransaction(ctx context.Context, txn *rpc.BroadcastInvokeTxnV3) (*rpc.BroadcastInvokeTxnV3, error)
- func (s *ExternalSigner) TransactionStatus(ctx context.Context, transactionHash *felt.Felt) (*rpc.TxnStatusResult, error)
- func (s *ExternalSigner) ValidationContracts() *types.ValidationContracts
- type InternalSigner
- func (s *InternalSigner) Address() *types.Address
- func (s *InternalSigner) BlockWithTxHashes(ctx context.Context, blockID rpc.BlockID) (any, error)
- func (s *InternalSigner) BuildAttestTransaction(ctx context.Context, blockhash *types.BlockHash) (rpc.BroadcastInvokeTxnV3, error)
- func (s *InternalSigner) Call(ctx context.Context, call rpc.FunctionCall, blockID rpc.BlockID) ([]*felt.Felt, error)
- func (s *InternalSigner) EstimateFee(ctx context.Context, txn *rpc.BroadcastInvokeTxnV3) (rpc.FeeEstimation, error)
- func (s *InternalSigner) InvokeTransaction(ctx context.Context, txn *rpc.BroadcastInvokeTxnV3) (rpc.AddInvokeTransactionResponse, error)
- func (s *InternalSigner) Nonce(ctx context.Context) (*felt.Felt, error)
- func (s *InternalSigner) SignTransaction(ctx context.Context, txn *rpc.BroadcastInvokeTxnV3) (*rpc.BroadcastInvokeTxnV3, error)
- func (s *InternalSigner) TransactionStatus(ctx context.Context, transactionHash *felt.Felt) (*rpc.TxnStatusResult, error)
- func (s *InternalSigner) ValidationContracts() *types.ValidationContracts
- type RewardSigner
- type Signer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeBlockNumberToAttestTo ¶
func ComputeBlockNumberToAttestTo( epochInfo *types.EpochInfo, attestWindow uint64, ) types.BlockNumber
func FetchAttestWindow ¶
func FetchBalance ¶ added in v0.4.0
func FetchBalance[S Signer]( ctx context.Context, signer S, address *types.Address, ) (types.Balance, error)
Fetches the STRK balance of any account, using the signer only to perform the call
func FetchEpochAndAttestInfo ¶
func FetchEpochInfo ¶
func HashAndSignTx ¶
func ReadableContractError ¶ added in v0.4.0
func SignInvokeTx ¶
Types ¶
type ExternalSigner ¶
type ExternalSigner struct {
Provider rpc.RPCProvider
// contains filtered or unexported fields
}
Used as a wrapper around an exgernal signer implementation
func NewExternalSigner ¶
func NewExternalSigner( ctx context.Context, provider rpc.RPCProvider, logger log.Logger, sig *config.Signer, addresses *config.ContractAddresses, ) (ExternalSigner, error)
func (*ExternalSigner) Address ¶
func (s *ExternalSigner) Address() *types.Address
func (*ExternalSigner) BlockWithTxHashes ¶ added in v0.2.4
func (*ExternalSigner) BuildAttestTransaction ¶ added in v0.2.4
func (s *ExternalSigner) BuildAttestTransaction( ctx context.Context, blockhash *types.BlockHash, ) (rpc.BroadcastInvokeTxnV3, error)
func (*ExternalSigner) Call ¶ added in v0.2.4
func (s *ExternalSigner) Call( ctx context.Context, call rpc.FunctionCall, blockID rpc.BlockID, ) ([]*felt.Felt, error)
func (*ExternalSigner) EstimateFee ¶ added in v0.2.4
func (s *ExternalSigner) EstimateFee( ctx context.Context, txn *rpc.BroadcastInvokeTxnV3, ) (rpc.FeeEstimation, error)
func (*ExternalSigner) InvokeTransaction ¶ added in v0.2.4
func (s *ExternalSigner) InvokeTransaction( ctx context.Context, txn *rpc.BroadcastInvokeTxnV3, ) (rpc.AddInvokeTransactionResponse, error)
func (*ExternalSigner) SignTransaction ¶ added in v0.2.4
func (s *ExternalSigner) SignTransaction( ctx context.Context, txn *rpc.BroadcastInvokeTxnV3, ) (*rpc.BroadcastInvokeTxnV3, error)
func (*ExternalSigner) TransactionStatus ¶ added in v0.3.0
func (s *ExternalSigner) TransactionStatus( ctx context.Context, transactionHash *felt.Felt, ) ( *rpc.TxnStatusResult, error, )
func (*ExternalSigner) ValidationContracts ¶
func (s *ExternalSigner) ValidationContracts() *types.ValidationContracts
type InternalSigner ¶
func NewInternalSigner ¶
func NewInternalSigner( ctx context.Context, provider rpc.RPCProvider, logger log.Logger, signer *config.Signer, addresses *config.ContractAddresses, ) (InternalSigner, error)
func (*InternalSigner) Address ¶
func (s *InternalSigner) Address() *types.Address
func (*InternalSigner) BlockWithTxHashes ¶
func (*InternalSigner) BuildAttestTransaction ¶ added in v0.2.4
func (s *InternalSigner) BuildAttestTransaction( ctx context.Context, blockhash *types.BlockHash, ) (rpc.BroadcastInvokeTxnV3, error)
func (*InternalSigner) Call ¶
func (s *InternalSigner) Call( ctx context.Context, call rpc.FunctionCall, blockID rpc.BlockID, ) ([]*felt.Felt, error)
func (*InternalSigner) EstimateFee ¶ added in v0.2.4
func (s *InternalSigner) EstimateFee( ctx context.Context, txn *rpc.BroadcastInvokeTxnV3, ) (rpc.FeeEstimation, error)
func (*InternalSigner) InvokeTransaction ¶ added in v0.2.4
func (s *InternalSigner) InvokeTransaction( ctx context.Context, txn *rpc.BroadcastInvokeTxnV3, ) (rpc.AddInvokeTransactionResponse, error)
func (*InternalSigner) SignTransaction ¶ added in v0.2.4
func (s *InternalSigner) SignTransaction( ctx context.Context, txn *rpc.BroadcastInvokeTxnV3, ) (*rpc.BroadcastInvokeTxnV3, error)
func (*InternalSigner) TransactionStatus ¶ added in v0.3.0
func (s *InternalSigner) TransactionStatus( ctx context.Context, transactionHash *felt.Felt, ) ( *rpc.TxnStatusResult, error, )
func (*InternalSigner) ValidationContracts ¶
func (s *InternalSigner) ValidationContracts() *types.ValidationContracts
type RewardSigner ¶ added in v0.4.0
type RewardSigner interface {
Address() *types.Address
ClaimRewards(ctx context.Context, tracer metrics.Tracer)
}
RewardSigner is a signer that can claim rewards from the staking contract. It is used for the validator to claim rewards automatically, an optional feature that can be enabled by setting the corresponding flags in the config.
func NewRewardSigner ¶ added in v0.4.0
func NewRewardSigner( ctx context.Context, provider rpc.RPCProvider, logger log.Logger, rewardConfig *config.Reward, contractAddresses *config.ContractAddresses, stakerAddress *types.Address, isExternal bool, ) (RewardSigner, error)
Creates a new RewardSigner and verifies that the configured reward account is allowed to claim the staker rewards, i.e. it's either the staker address or its reward address. When using an external signer, it also verifies that the signer is able to sign.
type Signer ¶
type Signer interface {
// Methods from Starknet.go Account implementation
TransactionStatus(
ctx context.Context, transactionHash *felt.Felt,
) (*rpc.TxnStatusResult, error)
BuildAttestTransaction(
ctx context.Context, blockHash *types.BlockHash,
) (rpc.BroadcastInvokeTxnV3, error)
EstimateFee(ctx context.Context, txn *rpc.BroadcastInvokeTxnV3) (rpc.FeeEstimation, error)
SignTransaction(
ctx context.Context, txn *rpc.BroadcastInvokeTxnV3,
) (*rpc.BroadcastInvokeTxnV3, error)
InvokeTransaction(
ctx context.Context, txn *rpc.BroadcastInvokeTxnV3,
) (rpc.AddInvokeTransactionResponse, error)
Call(ctx context.Context, call rpc.FunctionCall, blockID rpc.BlockID) ([]*felt.Felt, error)
BlockWithTxHashes(ctx context.Context, blockID rpc.BlockID) (any, error)
// Property Access
Nonce(ctx context.Context) (*felt.Felt, error)
Address() *types.Address
ValidationContracts() *types.ValidationContracts
}
Click to show internal directories.
Click to hide internal directories.