Documentation
¶
Overview ¶
Package blockchain provides infrastructure for interacting with the blockchain.
Index ¶
- Constants
- Variables
- func IsUint96(v *big.Int) bool
- func NewNodeRegistryAdmin(logger *zap.Logger, client *ethclient.Client, signer TransactionSigner, ...) (*nodeRegistryAdmin, error)
- func NewRPCClient(ctx context.Context, rpcURL string) (*ethclient.Client, error)
- func NewWebsocketClient(ctx context.Context, wsURL string, opts ...WebsocketClientOption) (*ethclient.Client, error)
- type BlockchainError
- type BlockchainPublisher
- func (m *BlockchainPublisher) BootstrapGroupMessages(ctx context.Context, groupIDs [][16]byte, messages [][]byte, ...) ([]*gm.GroupMessageBroadcasterMessageSent, error)
- func (m *BlockchainPublisher) BootstrapIdentityUpdates(ctx context.Context, inboxIDs [][32]byte, identityUpdates [][]byte, ...) ([]*iu.IdentityUpdateBroadcasterIdentityUpdateCreated, error)
- func (m *BlockchainPublisher) Close()
- func (m *BlockchainPublisher) PublishGroupMessage(ctx context.Context, groupID [16]byte, message []byte) (*gm.GroupMessageBroadcasterMessageSent, error)
- func (m *BlockchainPublisher) PublishIdentityUpdate(ctx context.Context, inboxID [32]byte, identityUpdate []byte) (*iu.IdentityUpdateBroadcasterIdentityUpdateCreated, error)
- type ChainClient
- type FundsAdminAppOpts
- type FundsAdminOpts
- type FundsAdminSettlementOpts
- type IAppChainAdmin
- type IBlockchainPublisher
- type IFundsAdmin
- type INodeRegistryAdmin
- type INodeRegistryCaller
- type IParameterAdmin
- func NewAppChainParameterAdmin(logger *zap.Logger, client *ethclient.Client, signer TransactionSigner, ...) (IParameterAdmin, error)
- func NewParameterAdminWithRegistry(logger *zap.Logger, client *ethclient.Client, signer TransactionSigner, ...) IParameterAdmin
- func NewSettlementParameterAdmin(logger *zap.Logger, client *ethclient.Client, signer TransactionSigner, ...) (IParameterAdmin, error)
- type IParameterRegistry
- type IRatesAdmin
- type ISettlementChainAdmin
- type LogStreamBuilder
- type LogStreamer
- type ParameterAdmin
- func (n *ParameterAdmin) GetParameterAddress(ctx context.Context, paramName string) (common.Address, ProtocolError)
- func (n *ParameterAdmin) GetParameterBool(ctx context.Context, paramName string) (bool, ProtocolError)
- func (n *ParameterAdmin) GetParameterUint8(ctx context.Context, paramName string) (uint8, ProtocolError)
- func (n *ParameterAdmin) GetParameterUint16(ctx context.Context, paramName string) (uint16, ProtocolError)
- func (n *ParameterAdmin) GetParameterUint32(ctx context.Context, paramName string) (uint32, ProtocolError)
- func (n *ParameterAdmin) GetParameterUint64(ctx context.Context, paramName string) (uint64, ProtocolError)
- func (n *ParameterAdmin) GetParameterUint96(ctx context.Context, paramName string) (*big.Int, ProtocolError)
- func (n *ParameterAdmin) GetRawParameter(ctx context.Context, paramName string) ([32]byte, ProtocolError)
- func (n *ParameterAdmin) SetAddressParameter(ctx context.Context, paramName string, paramValue common.Address) ProtocolError
- func (n *ParameterAdmin) SetBoolParameter(ctx context.Context, paramName string, paramValue bool) ProtocolError
- func (n *ParameterAdmin) SetManyUint64Parameters(ctx context.Context, items []Uint64Param) ProtocolError
- func (n *ParameterAdmin) SetRawParameter(ctx context.Context, paramName string, value [32]byte) ProtocolError
- func (n *ParameterAdmin) SetUint8Parameter(ctx context.Context, paramName string, paramValue uint8) ProtocolError
- func (n *ParameterAdmin) SetUint16Parameter(ctx context.Context, paramName string, paramValue uint16) ProtocolError
- func (n *ParameterAdmin) SetUint32Parameter(ctx context.Context, paramName string, paramValue uint32) ProtocolError
- func (n *ParameterAdmin) SetUint64Parameter(ctx context.Context, paramName string, paramValue uint64) ProtocolError
- func (n *ParameterAdmin) SetUint96Parameter(ctx context.Context, paramName string, v *big.Int) ProtocolError
- type PayerReportsManager
- type PrivateKeySigner
- type ProtocolError
- type RatesAdmin
- type ReportsManager
- func (r *ReportsManager) GetDomainSeparator(ctx context.Context) (common.Hash, error)
- func (r *ReportsManager) GetReport(ctx context.Context, originatorNodeID uint32, index uint64) (*payerreport.PayerReport, error)
- func (r *ReportsManager) GetReportID(ctx context.Context, payerReport *payerreport.PayerReportWithStatus) (payerreport.ReportID, error)
- func (r *ReportsManager) SettleReport(ctx context.Context, originatorNodeID uint32, index uint64, ...) error
- func (r *ReportsManager) SettlementSummary(ctx context.Context, originatorNodeID uint32, index uint64) (*SettlementSummary, error)
- func (r *ReportsManager) SubmitPayerReport(ctx context.Context, report *payerreport.PayerReportWithStatus) (int32, ProtocolError)
- type SettlementSummary
- type TransactionSigner
- type Uint64Param
- type WebsocketClientOption
Constants ¶
const ( AppChainGatewayPausedKey = "xmtp.appChainGateway.paused" DistributionManagerPausedKey = "xmtp.distributionManager.paused" DistributionManagerProtocolFeesRecipientKey = "xmtp.distributionManager.protocolFeesRecipient" GroupMessageBroadcasterMaxPayloadSizeKey = "xmtp.groupMessageBroadcaster.maxPayloadSize" GroupMessageBroadcasterMinPayloadSizeKey = "xmtp.groupMessageBroadcaster.minPayloadSize" GroupMessageBroadcasterPausedKey = "xmtp.groupMessageBroadcaster.paused" GroupMessagePayloadBootstrapperKey = "xmtp.groupMessageBroadcaster.payloadBootstrapper" IdentityUpdateBroadcasterMaxPayloadSizeKey = "xmtp.identityUpdateBroadcaster.maxPayloadSize" IdentityUpdateBroadcasterMinPayloadSizeKey = "xmtp.identityUpdateBroadcaster.minPayloadSize" IdentityUpdateBroadcasterPausedKey = "xmtp.identityUpdateBroadcaster.paused" IdentityUpdatePayloadBootstrapperKey = "xmtp.identityUpdateBroadcaster.payloadBootstrapper" NodeRegistryAdminKey = "xmtp.nodeRegistry.admin" NodeRegistryMaxCanonicalNodesKey = "xmtp.nodeRegistry.maxCanonicalNodes" PayerRegistryMinimumDepositKey = "xmtp.payerRegistry.minimumDeposit" PayerRegistryPausedKey = "xmtp.payerRegistry.paused" PayerRegistryWithdrawLockPeriodKey = "xmtp.payerRegistry.withdrawLockPeriod" PayerReportManagerProtocolFeeRateKey = "xmtp.payerReportManager.protocolFeeRate" RateRegistryCongestionFeeKey = "xmtp.rateRegistry.congestionFee" RateRegistryMessageFeeKey = "xmtp.rateRegistry.messageFee" RateRegistryMigratorKey = "xmtp.rateRegistry.migrator" RateRegistryStorageFeeKey = "xmtp.rateRegistry.storageFee" RateRegistryTargetRatePerMinuteKey = "xmtp.rateRegistry.targetRatePerMinute" SettlementChainGatewayPausedKey = "xmtp.settlementChainGateway.paused" )
Variables ¶
var ( ErrAlreadyClaimed = fmt.Errorf( "AlreadyClaimed(uint32,uint256)", ) ErrPayerReportAlreadySubmitted = fmt.Errorf( "PayerReportAlreadySubmitted(uint32,uint64,uint64)", ) ErrArrayLengthMismatch = fmt.Errorf("ArrayLengthMismatch()") ErrDeployFailed = fmt.Errorf("DeployFailed()") ErrEmptyAdmins = fmt.Errorf("EmptyAdmins()") ErrEmptyArray = fmt.Errorf("EmptyArray()") ErrEmptyBytecode = fmt.Errorf("EmptyBytecode()") ErrEmptyCode = fmt.Errorf("EmptyCode(address)") ErrEndIndexOutOfRange = fmt.Errorf("EndIndexOutOfRange()") ErrERC721IncorrectOwner = fmt.Errorf( "ERC721IncorrectOwner(address,uint256,address)", ) ErrERC721InsufficientApproval = fmt.Errorf( "ERC721InsufficientApproval(address,uint256)", ) ErrERC721InvalidApprover = fmt.Errorf("ERC721InvalidApprover(address)") ErrERC721InvalidOperator = fmt.Errorf("ERC721InvalidOperator(address)") ErrERC721InvalidOwner = fmt.Errorf("ERC721InvalidOwner(address)") ErrERC721InvalidReceiver = fmt.Errorf("ERC721InvalidReceiver(address)") ErrERC721InvalidSender = fmt.Errorf("ERC721InvalidSender(address)") ErrFailedToAddNodeToCanonicalNetwork = fmt.Errorf( "FailedToAddNodeToCanonicalNetwork()", ) ErrFailedToRemoveNodeFromCanonicalNetwork = fmt.Errorf( "FailedToRemoveNodeFromCanonicalNetwork()", ) ErrFromIndexOutOfRange = fmt.Errorf("FromIndexOutOfRange()") ErrInitializationFailed = fmt.Errorf("InitializationFailed(bytes)") ErrInsufficientBalance = fmt.Errorf("InsufficientBalance()") ErrInsufficientDeposit = fmt.Errorf( "InsufficientDeposit(uint96,uint96)", ) ErrInsufficientSignatures = fmt.Errorf( "InsufficientSignatures(uint8,uint8)", ) ErrInvalidBitCount32Input = fmt.Errorf("InvalidBitCount32Input()") ErrInvalidHTTPAddress = fmt.Errorf("InvalidHttpAddress()") ErrInvalidImplementation = fmt.Errorf("InvalidImplementation()") ErrInvalidLeafCount = fmt.Errorf("InvalidLeafCount()") ErrInvalidMaxPayloadSize = fmt.Errorf("InvalidMaxPayloadSize()") ErrInvalidMinPayloadSize = fmt.Errorf("InvalidMinPayloadSize()") ErrInvalidOwner = fmt.Errorf("InvalidOwner()") ErrInvalidPayloadSize = fmt.Errorf( "InvalidPayloadSize(uint256,uint256,uint256)", ) ErrInvalidProof = fmt.Errorf("InvalidProof()") ErrInvalidProtocolFeeRate = fmt.Errorf("InvalidProtocolFeeRate()") ErrInvalidSequenceIDs = fmt.Errorf("InvalidSequenceIds()") ErrInvalidSigningPublicKey = fmt.Errorf("InvalidSigningPublicKey()") ErrInvalidStartSequenceID = fmt.Errorf( "InvalidStartSequenceId(uint64,uint64)", ) ErrInvalidURI = fmt.Errorf("InvalidURI()") ErrMaxCanonicalNodesBelowCurrentCount = fmt.Errorf( "MaxCanonicalNodesBelowCurrentCount()", ) ErrMaxCanonicalNodesReached = fmt.Errorf("MaxCanonicalNodesReached()") ErrMaxNodesReached = fmt.Errorf("MaxNodesReached()") ErrMigrationFailed = fmt.Errorf( "MigrationFailed(address,bytes)", ) ErrNoChainIds = fmt.Errorf("NoChainIds()") ErrNoChange = fmt.Errorf("NoChange()") ErrNoExcess = fmt.Errorf("NoExcess()") ErrNoFeesOwed = fmt.Errorf("NoFeesOwed()") ErrNoKeyComponents = fmt.Errorf("NoKeyComponents()") ErrNoKeys = fmt.Errorf("NoKeys()") ErrNoLeaves = fmt.Errorf("NoLeaves()") ErrNoPendingWithdrawal = fmt.Errorf("NoPendingWithdrawal()") ErrNoProofElements = fmt.Errorf("NoProofElements()") ErrNotAdmin = fmt.Errorf("NotAdmin()") ErrNotInPayerReport = fmt.Errorf( "NotInPayerReport(uint32,uint256)", ) ErrNotNodeOwner = fmt.Errorf("NotNodeOwner()") ErrNotPaused = fmt.Errorf("NotPaused()") ErrNotPayloadBootstrapper = fmt.Errorf("NotPayloadBootstrapper()") ErrNotSettlementChainGateway = fmt.Errorf("NotSettlementChainGateway()") ErrNotSettler = fmt.Errorf("NotSettler()") ErrParameterOutOfTypeBounds = fmt.Errorf("ParameterOutOfTypeBounds()") ErrPaused = fmt.Errorf("Paused()") ErrPayerFeesLengthTooLong = fmt.Errorf("PayerFeesLengthTooLong()") ErrPayerInDebt = fmt.Errorf("PayerInDebt()") ErrPayerReportEntirelySettled = fmt.Errorf("PayerReportEntirelySettled()") ErrPayerReportIndexOutOfBounds = fmt.Errorf("PayerReportIndexOutOfBounds()") ErrPayerReportNotSettled = fmt.Errorf( "PayerReportNotSettled(uint32,uint256)", ) ErrPendingWithdrawalExists = fmt.Errorf("PendingWithdrawalExists()") ErrTransferFailed = fmt.Errorf("TransferFailed()") ErrTransferFromFailed = fmt.Errorf("TransferFromFailed()") ErrUnorderedNodeIDs = fmt.Errorf("UnorderedNodeIds()") ErrUnsupportedChainID = fmt.Errorf("UnsupportedChainId(uint256)") ErrWithdrawalNotReady = fmt.Errorf( "WithdrawalNotReady(uint32,uint32)", ) ErrZeroAdmin = fmt.Errorf("ZeroAdmin()") ErrZeroAmount = fmt.Errorf("ZeroAmount()") ErrZeroAppChainID = fmt.Errorf("ZeroAppChainId()") ErrZeroAppChainGateway = fmt.Errorf("ZeroAppChainGateway()") ErrZeroAvailableBalance = fmt.Errorf("ZeroAvailableBalance()") ErrZeroBalance = fmt.Errorf("ZeroBalance()") ErrZeroCount = fmt.Errorf("ZeroCount()") ErrZeroFeeDistributor = fmt.Errorf("ZeroFeeDistributor()") ErrZeroFeeToken = fmt.Errorf("ZeroFeeToken()") ErrZeroImplementation = fmt.Errorf("ZeroImplementation()") ErrZeroMigrator = fmt.Errorf("ZeroMigrator()") ErrZeroMinimumDeposit = fmt.Errorf("ZeroMinimumDeposit()") ErrZeroNodeRegistry = fmt.Errorf("ZeroNodeRegistry()") ErrZeroPayer = fmt.Errorf("ZeroPayer()") ErrZeroPayerRegistry = fmt.Errorf("ZeroPayerRegistry()") ErrZeroPayerReportManager = fmt.Errorf("ZeroPayerReportManager()") ErrZeroParameterRegistry = fmt.Errorf("ZeroParameterRegistry()") ErrZeroRecipient = fmt.Errorf("ZeroRecipient()") ErrZeroSettlementChainGateway = fmt.Errorf("ZeroSettlementChainGateway()") ErrZeroSettler = fmt.Errorf("ZeroSettler()") ErrZeroTotalAmount = fmt.Errorf("ZeroTotalAmount()") ErrZeroUnderlying = fmt.Errorf("ZeroUnderlying()") ErrZeroWithdrawalAmount = fmt.Errorf("ZeroWithdrawalAmount()") ErrCodeNotFound = fmt.Errorf("error message does not contain a valid error code") ErrCodeNotInDic = fmt.Errorf("code not found in protocol errors dictionary") ErrCompileRegex = fmt.Errorf("error compiling regex") )
var ErrNoLogsFound = errors.New("no logs found")
var ErrTxFailed = fmt.Errorf("transaction failed")
Functions ¶
func NewNodeRegistryAdmin ¶
func NewNodeRegistryAdmin( logger *zap.Logger, client *ethclient.Client, signer TransactionSigner, contractsOptions *config.ContractsOptions, parameterAdmin IParameterAdmin, ) (*nodeRegistryAdmin, error)
func NewRPCClient ¶ added in v0.5.0
NewRPCClient creates a new RPC client that can be used for JSON-RPC calls. RPC providers usually implement middleware with optimizations for HTTP JSON-RPC requests.
func NewWebsocketClient ¶ added in v0.5.0
func NewWebsocketClient( ctx context.Context, wsURL string, opts ...WebsocketClientOption, ) (*ethclient.Client, error)
NewWebsocketClient creates a new websocket client that can be configured with dialer options. It's used mostly for subscriptions.
Types ¶
type BlockchainError ¶ added in v0.5.1
type BlockchainError struct {
// contains filtered or unexported fields
}
func NewBlockchainError ¶ added in v0.5.1
func NewBlockchainError(originalErr error) *BlockchainError
func (BlockchainError) Error ¶ added in v0.5.1
func (e BlockchainError) Error() string
func (BlockchainError) IsErrInvalidSequenceIDs ¶ added in v1.0.0
func (e BlockchainError) IsErrInvalidSequenceIDs() bool
IsErrInvalidSequenceIDs returns true if the error is an invalid sequence ID error. That can happen because the report: - Was submitted with a wrong start sequence ID. - The end sequence ID is smaller than the start sequence ID.
func (BlockchainError) IsErrPayerReportAlreadySubmitted ¶ added in v1.0.0
func (e BlockchainError) IsErrPayerReportAlreadySubmitted() bool
IsErrPayerReportAlreadySubmitted returns true if the error is a payer report already submitted error.
func (BlockchainError) IsNoChange ¶ added in v0.5.1
func (e BlockchainError) IsNoChange() bool
func (*BlockchainError) Unwrap ¶ added in v1.0.0
func (e *BlockchainError) Unwrap() error
Unwrap returns the protocol error for errors.Is() checks
type BlockchainPublisher ¶
type BlockchainPublisher struct {
// contains filtered or unexported fields
}
BlockchainPublisher can publish to the blockchain, signing messages using the provided signer.
func NewBlockchainPublisher ¶
func NewBlockchainPublisher( ctx context.Context, logger *zap.Logger, client *ethclient.Client, signer TransactionSigner, contractOptions *config.ContractsOptions, nonceManager noncemanager.NonceManager, oracle oracle.BlockchainOracle, ) (*BlockchainPublisher, error)
func (*BlockchainPublisher) BootstrapGroupMessages ¶ added in v0.5.0
func (m *BlockchainPublisher) BootstrapGroupMessages( ctx context.Context, groupIDs [][16]byte, messages [][]byte, sequenceIDs []uint64, ) ([]*gm.GroupMessageBroadcasterMessageSent, error)
func (*BlockchainPublisher) BootstrapIdentityUpdates ¶ added in v0.5.0
func (m *BlockchainPublisher) BootstrapIdentityUpdates( ctx context.Context, inboxIDs [][32]byte, identityUpdates [][]byte, sequenceIDs []uint64, ) ([]*iu.IdentityUpdateBroadcasterIdentityUpdateCreated, error)
func (*BlockchainPublisher) Close ¶ added in v0.3.0
func (m *BlockchainPublisher) Close()
func (*BlockchainPublisher) PublishGroupMessage ¶
func (m *BlockchainPublisher) PublishGroupMessage( ctx context.Context, groupID [16]byte, message []byte, ) (*gm.GroupMessageBroadcasterMessageSent, error)
func (*BlockchainPublisher) PublishIdentityUpdate ¶
func (m *BlockchainPublisher) PublishIdentityUpdate( ctx context.Context, inboxID [32]byte, identityUpdate []byte, ) (*iu.IdentityUpdateBroadcasterIdentityUpdateCreated, error)
type ChainClient ¶
type ChainClient interface {
ethereum.BlockNumberReader
ethereum.LogFilterer
ethereum.ChainIDReader
ethereum.ChainReader
}
type FundsAdminAppOpts ¶ added in v1.0.0
type FundsAdminAppOpts struct {
Client *ethclient.Client
Signer TransactionSigner
}
type FundsAdminOpts ¶ added in v1.0.0
type FundsAdminOpts struct {
Logger *zap.Logger
ContractOptions *config.ContractsOptions
Settlement FundsAdminSettlementOpts
App FundsAdminAppOpts
}
type FundsAdminSettlementOpts ¶ added in v1.0.0
type FundsAdminSettlementOpts struct {
Client *ethclient.Client
Signer TransactionSigner
}
type IAppChainAdmin ¶ added in v0.5.1
type IAppChainAdmin interface {
GetIdentityUpdateBootstrapper(ctx context.Context) (common.Address, error)
UpdateIdentityUpdateBootstrapper(ctx context.Context) error
GetGroupMessageBootstrapper(ctx context.Context) (common.Address, error)
UpdateGroupMessageBootstrapper(ctx context.Context) error
GetGroupMessagePauseStatus(ctx context.Context) (bool, error)
UpdateGroupMessagePauseStatus(ctx context.Context) error
GetIdentityUpdatePauseStatus(ctx context.Context) (bool, error)
UpdateIdentityUpdatePauseStatus(ctx context.Context) error
GetAppChainGatewayPauseStatus(ctx context.Context) (bool, error)
UpdateAppChainGatewayPauseStatus(ctx context.Context) error
GetGroupMessageMaxPayloadSize(ctx context.Context) (uint32, error)
UpdateGroupMessageMaxPayloadSize(ctx context.Context) error
GetGroupMessageMinPayloadSize(ctx context.Context) (uint32, error)
UpdateGroupMessageMinPayloadSize(ctx context.Context) error
GetIdentityUpdateMaxPayloadSize(ctx context.Context) (uint32, error)
UpdateIdentityUpdateMaxPayloadSize(ctx context.Context) error
GetIdentityUpdateMinPayloadSize(ctx context.Context) (uint32, error)
UpdateIdentityUpdateMinPayloadSize(ctx context.Context) error
GetRawParameter(ctx context.Context, key string) ([32]byte, error)
GetAppChainGatewayVersion(ctx context.Context) (string, error)
GetAppParameterRegistryVersion(ctx context.Context) (string, error)
GetGroupMessageBroadcasterVersion(ctx context.Context) (string, error)
GetIdentityUpdateBroadcasterVersion(ctx context.Context) (string, error)
}
func NewAppChainAdmin ¶ added in v0.5.1
func NewAppChainAdmin( logger *zap.Logger, client *ethclient.Client, signer TransactionSigner, contractsOptions *config.ContractsOptions, parameterAdmin IParameterAdmin, ) (IAppChainAdmin, error)
type IBlockchainPublisher ¶
type IBlockchainPublisher interface {
Close()
PublishIdentityUpdate(
ctx context.Context,
inboxID [32]byte,
identityUpdate []byte,
) (*iu.IdentityUpdateBroadcasterIdentityUpdateCreated, error)
BootstrapIdentityUpdates(
ctx context.Context,
inboxIDs [][32]byte,
identityUpdates [][]byte,
sequenceIDs []uint64,
) ([]*iu.IdentityUpdateBroadcasterIdentityUpdateCreated, error)
PublishGroupMessage(
ctx context.Context,
groupID [16]byte,
message []byte,
) (*gm.GroupMessageBroadcasterMessageSent, error)
BootstrapGroupMessages(
ctx context.Context,
groupIDs [][16]byte,
messages [][]byte,
sequenceIDs []uint64,
) ([]*gm.GroupMessageBroadcasterMessageSent, error)
}
type IFundsAdmin ¶ added in v1.0.0
type IFundsAdmin interface {
MintMockUSDC(ctx context.Context, addr common.Address, amount *big.Int) error
Balances(ctx context.Context) error
Deposit(ctx context.Context, amount *big.Int, gasLimit *big.Int, gasPrice *big.Int) error
Withdraw(ctx context.Context, amount *big.Int) error
ReceiveWithdrawal(ctx context.Context) error
}
func NewFundsAdmin ¶ added in v1.0.0
func NewFundsAdmin( opts FundsAdminOpts, ) (IFundsAdmin, error)
type INodeRegistryAdmin ¶ added in v0.3.0
type INodeRegistryAdmin interface {
AddNode(
ctx context.Context,
ownerAddress common.Address,
signingKeyPub *ecdsa.PublicKey,
httpAddress string,
) (uint32, error)
AddToNetwork(ctx context.Context, nodeID uint32) error
RemoveFromNetwork(ctx context.Context, nodeID uint32) error
SetHTTPAddress(ctx context.Context, nodeID uint32, httpAddress string) error
SetMaxCanonical(ctx context.Context, limit uint8) error
}
type INodeRegistryCaller ¶ added in v0.3.0
type INodeRegistryCaller interface {
GetAllNodes(ctx context.Context) ([]noderegistry.INodeRegistryNodeWithId, error)
GetNode(ctx context.Context, nodeID uint32) (noderegistry.INodeRegistryNode, error)
OwnerOf(ctx context.Context, nodeID uint32) (common.Address, error)
GetMaxCanonicalNodes(
ctx context.Context,
) (uint8, error)
}
func NewNodeRegistryCaller ¶
func NewNodeRegistryCaller( logger *zap.Logger, client *ethclient.Client, contractsOptions *config.ContractsOptions, ) (INodeRegistryCaller, error)
type IParameterAdmin ¶ added in v1.0.0
type IParameterAdmin interface {
// Reads
GetRawParameter(ctx context.Context, paramName string) ([32]byte, ProtocolError)
GetParameterAddress(ctx context.Context, paramName string) (common.Address, ProtocolError)
GetParameterUint8(ctx context.Context, paramName string) (uint8, ProtocolError)
GetParameterUint16(ctx context.Context, paramName string) (uint16, ProtocolError)
GetParameterUint32(ctx context.Context, paramName string) (uint32, ProtocolError)
GetParameterUint64(ctx context.Context, paramName string) (uint64, ProtocolError)
GetParameterUint96(ctx context.Context, paramName string) (*big.Int, ProtocolError)
GetParameterBool(ctx context.Context, paramName string) (bool, ProtocolError)
// Writes
SetRawParameter(ctx context.Context, paramName string, value [32]byte) ProtocolError
SetUint8Parameter(ctx context.Context, paramName string, v uint8) ProtocolError
SetUint16Parameter(ctx context.Context, paramName string, v uint16) ProtocolError
SetUint32Parameter(ctx context.Context, paramName string, v uint32) ProtocolError
SetUint64Parameter(ctx context.Context, paramName string, v uint64) ProtocolError
SetUint96Parameter(ctx context.Context, paramName string, v *big.Int) ProtocolError
SetAddressParameter(ctx context.Context, paramName string, v common.Address) ProtocolError
SetBoolParameter(ctx context.Context, paramName string, v bool) ProtocolError
// Batch helpers
SetManyUint64Parameters(ctx context.Context, items []Uint64Param) ProtocolError
}
func NewAppChainParameterAdmin ¶ added in v1.0.0
func NewAppChainParameterAdmin( logger *zap.Logger, client *ethclient.Client, signer TransactionSigner, contractsOptions *config.ContractsOptions, ) (IParameterAdmin, error)
NewAppChainParameterAdmin builds a ParameterAdmin for the AppChain registry.
func NewParameterAdminWithRegistry ¶ added in v1.0.0
func NewParameterAdminWithRegistry( logger *zap.Logger, client *ethclient.Client, signer TransactionSigner, reg IParameterRegistry, chainID int64, ) IParameterAdmin
func NewSettlementParameterAdmin ¶ added in v1.0.0
func NewSettlementParameterAdmin( logger *zap.Logger, client *ethclient.Client, signer TransactionSigner, contractsOptions *config.ContractsOptions, ) (IParameterAdmin, error)
type IParameterRegistry ¶ added in v1.0.0
type IParameterRegistry interface {
Get(opts *bind.CallOpts, key string) ([32]byte, error)
Set(opts *bind.TransactOpts, key string, value [32]byte) (*types.Transaction, error)
SetMany(opts *bind.TransactOpts, keys []string, values [][32]byte) (*types.Transaction, error)
ParseParameterSet(log types.Log) (string, [32]byte, error)
}
IParameterRegistry abstracts the minimal surface used by ParameterAdmin. It is implemented for both SettlementChainParameterRegistry and AppChainParameterRegistry.
func NewAppChainRegistryAdapter ¶ added in v1.0.0
func NewAppChainRegistryAdapter( client *ethclient.Client, addressHex string, ) (IParameterRegistry, error)
func NewSettlementRegistryAdapter ¶ added in v1.0.0
func NewSettlementRegistryAdapter( client *ethclient.Client, addressHex string, ) (IParameterRegistry, error)
type IRatesAdmin ¶ added in v1.0.0
type IRatesAdmin interface {
AddRates(ctx context.Context, rates fees.Rates) ProtocolError
}
func NewRatesAdmin ¶ added in v0.3.0
func NewRatesAdmin( logger *zap.Logger, client *ethclient.Client, signer TransactionSigner, paramAdmin IParameterAdmin, contractsOptions *config.ContractsOptions, ) (IRatesAdmin, error)
type ISettlementChainAdmin ¶ added in v0.5.1
type ISettlementChainAdmin interface {
GetSettlementChainGatewayPauseStatus(ctx context.Context) (bool, error)
UpdateSettlementChainGatewayPauseStatus(ctx context.Context) error
GetPayerRegistryPauseStatus(ctx context.Context) (bool, error)
UpdatePayerRegistryPauseStatus(ctx context.Context) error
GetDistributionManagerPauseStatus(ctx context.Context) (bool, error)
UpdateDistributionManagerPauseStatus(ctx context.Context) error
GetNodeRegistryAdmin(ctx context.Context) (common.Address, error)
UpdateNodeRegistryAdmin(ctx context.Context) error
GetDistributionManagerProtocolFeesRecipient(ctx context.Context) (common.Address, error)
UpdateDistributionManagerProtocolFeesRecipient(ctx context.Context) error
GetPayerRegistryMinimumDeposit(ctx context.Context) (*big.Int, error)
UpdatePayerRegistryMinimumDeposit(ctx context.Context) error
GetPayerRegistryWithdrawLockPeriod(ctx context.Context) (uint32, error)
UpdatePayerRegistryWithdrawLockPeriod(ctx context.Context) error
GetPayerReportManagerProtocolFeeRate(ctx context.Context) (uint16, error)
UpdatePayerReportManagerProtocolFeeRate(ctx context.Context) error
GetRateRegistryMigrator(ctx context.Context) (common.Address, error)
UpdateRateRegistryMigrator(ctx context.Context) error
GetRawParameter(ctx context.Context, key string) ([32]byte, error)
SetRawParameter(ctx context.Context, key string, value [32]byte) error
BridgeParameters(ctx context.Context, keys []string) error
GetSettlementChainGatewayVersion(ctx context.Context) (string, error)
GetSettlementParameterRegistryVersion(ctx context.Context) (string, error)
GetPayerReportManagerVersion(ctx context.Context) (string, error)
GetRateRegistryVersion(ctx context.Context) (string, error)
GetPayerRegistryVersion(ctx context.Context) (string, error)
GetNodeRegistryVersion(ctx context.Context) (string, error)
GetDistributionManagerVersion(ctx context.Context) (string, error)
}
func NewSettlementChainAdmin ¶ added in v0.5.1
func NewSettlementChainAdmin( logger *zap.Logger, client *ethclient.Client, signer TransactionSigner, contractsOptions *config.ContractsOptions, parameterAdmin IParameterAdmin, ) (ISettlementChainAdmin, error)
type LogStreamBuilder ¶
type LogStreamBuilder interface {
ListenForContractEvent(
fromBlock uint64,
contractAddress common.Address,
topic common.Hash,
) <-chan types.Log
Build() (LogStreamer, error)
}
LogStreamBuilder constructs a raw blockchain listener that can be used to listen for events across many contract event types.
type LogStreamer ¶
type ParameterAdmin ¶ added in v0.5.1
type ParameterAdmin struct {
// contains filtered or unexported fields
}
func (*ParameterAdmin) GetParameterAddress ¶ added in v0.5.1
func (n *ParameterAdmin) GetParameterAddress( ctx context.Context, paramName string, ) (common.Address, ProtocolError)
func (*ParameterAdmin) GetParameterBool ¶ added in v0.5.1
func (n *ParameterAdmin) GetParameterBool( ctx context.Context, paramName string, ) (bool, ProtocolError)
func (*ParameterAdmin) GetParameterUint8 ¶ added in v0.5.1
func (n *ParameterAdmin) GetParameterUint8( ctx context.Context, paramName string, ) (uint8, ProtocolError)
func (*ParameterAdmin) GetParameterUint16 ¶ added in v0.5.1
func (n *ParameterAdmin) GetParameterUint16( ctx context.Context, paramName string, ) (uint16, ProtocolError)
func (*ParameterAdmin) GetParameterUint32 ¶ added in v0.5.1
func (n *ParameterAdmin) GetParameterUint32( ctx context.Context, paramName string, ) (uint32, ProtocolError)
func (*ParameterAdmin) GetParameterUint64 ¶ added in v0.5.1
func (n *ParameterAdmin) GetParameterUint64( ctx context.Context, paramName string, ) (uint64, ProtocolError)
func (*ParameterAdmin) GetParameterUint96 ¶ added in v0.5.1
func (n *ParameterAdmin) GetParameterUint96( ctx context.Context, paramName string, ) (*big.Int, ProtocolError)
func (*ParameterAdmin) GetRawParameter ¶ added in v1.0.0
func (n *ParameterAdmin) GetRawParameter( ctx context.Context, paramName string, ) ([32]byte, ProtocolError)
func (*ParameterAdmin) SetAddressParameter ¶ added in v0.5.1
func (n *ParameterAdmin) SetAddressParameter( ctx context.Context, paramName string, paramValue common.Address, ) ProtocolError
func (*ParameterAdmin) SetBoolParameter ¶ added in v0.5.1
func (n *ParameterAdmin) SetBoolParameter( ctx context.Context, paramName string, paramValue bool, ) ProtocolError
func (*ParameterAdmin) SetManyUint64Parameters ¶ added in v0.5.1
func (n *ParameterAdmin) SetManyUint64Parameters( ctx context.Context, items []Uint64Param, ) ProtocolError
func (*ParameterAdmin) SetRawParameter ¶ added in v1.0.0
func (n *ParameterAdmin) SetRawParameter( ctx context.Context, paramName string, value [32]byte, ) ProtocolError
func (*ParameterAdmin) SetUint8Parameter ¶ added in v0.5.1
func (n *ParameterAdmin) SetUint8Parameter( ctx context.Context, paramName string, paramValue uint8, ) ProtocolError
func (*ParameterAdmin) SetUint16Parameter ¶ added in v0.5.1
func (n *ParameterAdmin) SetUint16Parameter( ctx context.Context, paramName string, paramValue uint16, ) ProtocolError
func (*ParameterAdmin) SetUint32Parameter ¶ added in v0.5.1
func (n *ParameterAdmin) SetUint32Parameter( ctx context.Context, paramName string, paramValue uint32, ) ProtocolError
func (*ParameterAdmin) SetUint64Parameter ¶ added in v0.5.1
func (n *ParameterAdmin) SetUint64Parameter( ctx context.Context, paramName string, paramValue uint64, ) ProtocolError
func (*ParameterAdmin) SetUint96Parameter ¶ added in v0.5.1
func (n *ParameterAdmin) SetUint96Parameter( ctx context.Context, paramName string, v *big.Int, ) ProtocolError
type PayerReportsManager ¶ added in v0.5.0
type PayerReportsManager interface {
SubmitPayerReport(
ctx context.Context,
report *payerreport.PayerReportWithStatus,
) (int32, ProtocolError)
GetReport(
ctx context.Context,
originatorNodeID uint32,
index uint64,
) (*payerreport.PayerReport, error)
GetDomainSeparator(ctx context.Context) (common.Hash, error)
GetReportID(
ctx context.Context,
payerReport *payerreport.PayerReportWithStatus,
) (payerreport.ReportID, error)
SettleReport(
ctx context.Context,
originatorNodeID uint32,
index uint64,
proof *merkle.MultiProof,
) error
SettlementSummary(
ctx context.Context,
originatorNodeID uint32,
index uint64,
) (*SettlementSummary, error)
}
type PrivateKeySigner ¶
type PrivateKeySigner struct {
// contains filtered or unexported fields
}
PrivateKeySigner is a naive and not secure implementation of the TransactionSigner interface. It is meant to be used in tests only
func NewPrivateKeySigner ¶
func NewPrivateKeySigner(privateKeyString string, chainID int64) (*PrivateKeySigner, error)
func (*PrivateKeySigner) FromAddress ¶
func (s *PrivateKeySigner) FromAddress() common.Address
func (*PrivateKeySigner) SignerFunc ¶
func (s *PrivateKeySigner) SignerFunc() bind.SignerFn
type ProtocolError ¶ added in v0.5.1
type ProtocolError interface {
error
Unwrap() error
IsNoChange() bool
IsErrInvalidSequenceIDs() bool
IsErrPayerReportAlreadySubmitted() bool
}
func ExecuteTransaction ¶ added in v0.3.0
func ExecuteTransaction( ctx context.Context, signer TransactionSigner, logger *zap.Logger, client *ethclient.Client, txFunc func(*bind.TransactOpts) (*types.Transaction, error), eventParser func(*types.Log) (any, error), logHandler func(any), ) ProtocolError
ExecuteTransaction is a helper function that: - checks if the sender has enough balance. - executes a transaction. - waits for it to be mined. - if the transaction fails, it tries to get the error code from the transaction receipt. - processes the event logs.
func WaitForTransaction ¶
func WaitForTransaction( ctx context.Context, logger *zap.Logger, client *ethclient.Client, timeout time.Duration, pollSleep time.Duration, hash common.Hash, ) (receipt *types.Receipt, err ProtocolError)
WaitForTransaction waits for the given transaction hash to have been submitted to the chain and soft confirmed.
type RatesAdmin ¶ added in v0.3.0
type RatesAdmin struct {
// contains filtered or unexported fields
}
func (*RatesAdmin) AddRates ¶ added in v0.3.0
func (r *RatesAdmin) AddRates(ctx context.Context, rates fees.Rates) ProtocolError
AddRates adds a new rate to the rates manager. The new rate must have a later start time than the last rate in the contract.
type ReportsManager ¶ added in v0.5.0
type ReportsManager struct {
// contains filtered or unexported fields
}
func NewReportsManager ¶ added in v0.5.0
func NewReportsManager( logger *zap.Logger, client *ethclient.Client, signer TransactionSigner, options config.SettlementChainOptions, ) (*ReportsManager, error)
func (*ReportsManager) GetDomainSeparator ¶ added in v0.5.0
func (*ReportsManager) GetReport ¶ added in v0.5.0
func (r *ReportsManager) GetReport( ctx context.Context, originatorNodeID uint32, index uint64, ) (*payerreport.PayerReport, error)
func (*ReportsManager) GetReportID ¶ added in v0.5.0
func (r *ReportsManager) GetReportID( ctx context.Context, payerReport *payerreport.PayerReportWithStatus, ) (payerreport.ReportID, error)
func (*ReportsManager) SettleReport ¶ added in v1.0.0
func (r *ReportsManager) SettleReport( ctx context.Context, originatorNodeID uint32, index uint64, proof *merkle.MultiProof, ) error
func (*ReportsManager) SettlementSummary ¶ added in v1.0.0
func (r *ReportsManager) SettlementSummary( ctx context.Context, originatorNodeID uint32, index uint64, ) (*SettlementSummary, error)
func (*ReportsManager) SubmitPayerReport ¶ added in v0.5.0
func (r *ReportsManager) SubmitPayerReport( ctx context.Context, report *payerreport.PayerReportWithStatus, ) (int32, ProtocolError)
type SettlementSummary ¶ added in v1.0.0
type TransactionSigner ¶
type Uint64Param ¶ added in v0.5.1
type WebsocketClientOption ¶ added in v0.5.0
type WebsocketClientOption func(*websocketClientConfig)
func WithKeepAliveConfig ¶ added in v0.5.0
func WithKeepAliveConfig(cfg net.KeepAliveConfig) WebsocketClientOption
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package noncemanager provides interfaces and implementations for managing transaction nonces in a blockchain environment.
|
Package noncemanager provides interfaces and implementations for managing transaction nonces in a blockchain environment. |
|
redis
Package redis provides a Redis-backed implementation of the NonceManager interface.
|
Package redis provides a Redis-backed implementation of the NonceManager interface. |
|
sql
Package sql provides a SQL database-backed implementation of the NonceManager interface.
|
Package sql provides a SQL database-backed implementation of the NonceManager interface. |
|
Package oracle provides a blockchain oracle for gas price queries.
|
Package oracle provides a blockchain oracle for gas price queries. |