Documentation ¶
Index ¶
- Constants
- type Address
- type Asset
- type Balance
- type Client
- func (c *Client) BuildClaimStakeOperation(ctx context.Context, amount *big.Float, assetID string, address *Address, ...) (*StakingOperation, error)
- func (c *Client) BuildStakeOperation(ctx context.Context, amount *big.Float, assetID string, address *Address, ...) (*StakingOperation, error)
- func (c *Client) BuildStakingOperation(ctx context.Context, address *Address, assetID string, action string, ...) (*StakingOperation, error)
- func (c *Client) BuildUnstakeOperation(ctx context.Context, amount *big.Float, assetID string, address *Address, ...) (*StakingOperation, error)
- func (c *Client) FetchStakingOperation(ctx context.Context, networkID, addressID, stakingOperationID string) (*StakingOperation, error)
- func (c *Client) GetClaimableBalance(ctx context.Context, assetId string, address *Address, ...) (*Balance, error)
- func (c *Client) GetStakeableBalance(ctx context.Context, assetId string, address *Address, ...) (*Balance, error)
- func (c *Client) GetUnstakeableBalance(ctx context.Context, assetId string, address *Address, ...) (*Balance, error)
- func (c *Client) GetValidator(ctx context.Context, networkId string, assetId string, validatorId string) (Validator, error)
- func (c *Client) ListHistoricalStakingBalances(ctx context.Context, assetId string, address *Address, startTime time.Time, ...) ([]*StakingBalance, error)
- func (c *Client) ListStakingRewards(ctx context.Context, assetId string, addresses []Address, startTime time.Time, ...) ([]StakingReward, error)
- func (c *Client) ListValidators(ctx context.Context, networkId string, assetId string, ...) ([]Validator, error)
- func (c *Client) ReloadStakingOperation(ctx context.Context, stakingOperation *StakingOperation) error
- func (c *Client) Wait(ctx context.Context, stakingOperation *StakingOperation, o ...WaitOption) error
- type ClientOption
- type EthereumSignable
- type ListValidatorsOption
- type Signable
- type SolanaSignable
- type StakingBalance
- type StakingBalanceOption
- type StakingContextBalance
- type StakingOperation
- func (s *StakingOperation) AddressID() string
- func (s *StakingOperation) GetSignedVoluntaryExitMessages() ([]string, error)
- func (s *StakingOperation) ID() string
- func (s *StakingOperation) IsCompleteState() bool
- func (s *StakingOperation) IsFailedState() bool
- func (s *StakingOperation) IsTerminalState() bool
- func (s *StakingOperation) NetworkID() string
- func (s *StakingOperation) Sign(k crypto.Signer) error
- func (s *StakingOperation) Status() string
- func (s *StakingOperation) Transactions() []*Transaction
- type StakingOperationOption
- type StakingReward
- func (s StakingReward) AddressId() string
- func (s StakingReward) Amount() (*big.Float, error)
- func (s StakingReward) ConversionPrice() (*big.Float, error)
- func (s StakingReward) ConversionTime() time.Time
- func (s StakingReward) Date() (time.Time, error)
- func (s StakingReward) ToJSON() string
- func (s StakingReward) ToString() string
- func (s StakingReward) USDValue() (*big.Float, error)
- type Transaction
- func (t *Transaction) FromAddressID() string
- func (t *Transaction) IsSigned() bool
- func (t *Transaction) Raw() interface{}
- func (t *Transaction) Sign(k crypto.Signer) error
- func (t *Transaction) SignedPayload() string
- func (t *Transaction) Status() string
- func (t *Transaction) String() string
- func (t *Transaction) TransactionHash() string
- func (t *Transaction) TransactionLink() string
- func (t *Transaction) UnsignedPayload() string
- type Validator
- type ValidatorStatus
- type WaitOption
Constants ¶
const ( Eth = "eth" Wei = "wei" Gwei = "gwei" GweiDecimals = 9 Sol = "sol" StakingOperationModePartial = "partial" StakingOperationModeDefault = "default" StakingOperationModeNative = "native" EthereumHolesky = string(client.NETWORKIDENTIFIER_ETHEREUM_HOLESKY) EthereumMainnet = string(client.NETWORKIDENTIFIER_ETHEREUM_MAINNET) SolanaDevnet = string(client.NETWORKIDENTIFIER_SOLANA_DEVNET) SolanaMainnet = string(client.NETWORKIDENTIFIER_SOLANA_MAINNET) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
Address represents a blockchain address.
func NewExternalAddress ¶
NewExternalAddress creates a new external address.
type Balance ¶
type Balance struct {
// contains filtered or unexported fields
}
Balance represents a struct that holds a balance data.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a coinbase client
func NewClient ¶
func NewClient(o ...ClientOption) (*Client, error)
NewClient creates a new coinbase client with the supplied options.
func (*Client) BuildClaimStakeOperation ¶
func (c *Client) BuildClaimStakeOperation( ctx context.Context, amount *big.Float, assetID string, address *Address, o ...StakingOperationOption, ) (*StakingOperation, error)
BuildClaimStakeOperation will build an ephemeral staking operation using the claim_stake action
func (*Client) BuildStakeOperation ¶
func (c *Client) BuildStakeOperation( ctx context.Context, amount *big.Float, assetID string, address *Address, o ...StakingOperationOption, ) (*StakingOperation, error)
BuildStakeOperation will build an ephemeral staking operation using the stake action
func (*Client) BuildStakingOperation ¶
func (c *Client) BuildStakingOperation( ctx context.Context, address *Address, assetID string, action string, amount *big.Float, o ...StakingOperationOption, ) (*StakingOperation, error)
BuildStakingOperation will build an ephemeral staking operation based on the passed address, assetID, action, and amount.
func (*Client) BuildUnstakeOperation ¶
func (c *Client) BuildUnstakeOperation( ctx context.Context, amount *big.Float, assetID string, address *Address, o ...StakingOperationOption, ) (*StakingOperation, error)
BuildUnstakeOperation will build an ephemeral staking operation using the unstake action
func (*Client) FetchStakingOperation ¶ added in v0.0.11
func (c *Client) FetchStakingOperation(ctx context.Context, networkID, addressID, stakingOperationID string) (*StakingOperation, error)
FetchStakingOperation fetches a staking operation from the backend given a networkID, addressID, and stakingOperationID.
func (*Client) GetClaimableBalance ¶
func (c *Client) GetClaimableBalance(ctx context.Context, assetId string, address *Address, o ...StakingBalanceOption) (*Balance, error)
GetClaimableBalance returns the claimable balance.
func (*Client) GetStakeableBalance ¶
func (c *Client) GetStakeableBalance(ctx context.Context, assetId string, address *Address, o ...StakingBalanceOption) (*Balance, error)
GetStakeableBalance returns the stakeable balance.
func (*Client) GetUnstakeableBalance ¶
func (c *Client) GetUnstakeableBalance(ctx context.Context, assetId string, address *Address, o ...StakingBalanceOption) (*Balance, error)
GetUnstakeableBalance returns the unstakeable balance.
func (*Client) GetValidator ¶
func (*Client) ListHistoricalStakingBalances ¶ added in v0.0.3
func (c *Client) ListHistoricalStakingBalances( ctx context.Context, assetId string, address *Address, startTime time.Time, endTime time.Time, ) ([]*StakingBalance, error)
ListHistoricalStakingBalances fetches the historical staking balances for a given address and asset, and timeframe.
func (*Client) ListStakingRewards ¶
func (c *Client) ListStakingRewards( ctx context.Context, assetId string, addresses []Address, startTime time.Time, endTime time.Time, format client.StakingRewardFormat, ) ([]StakingReward, error)
ListStakingRewards list the staking rewards for a given set of addresses.
func (*Client) ListValidators ¶
func (*Client) ReloadStakingOperation ¶ added in v0.0.11
func (c *Client) ReloadStakingOperation(ctx context.Context, stakingOperation *StakingOperation) error
ReloadStakingOperation reloads a staking operation from the backend with the latest state. It ensures only newly constructed transactions are added to the staking operation and any existing transactions are untouched.
func (*Client) Wait ¶
func (c *Client) Wait(ctx context.Context, stakingOperation *StakingOperation, o ...WaitOption) error
type ClientOption ¶
ClientOption is a functional option for the client
func WithAPIKey ¶ added in v0.0.5
func WithAPIKey(name, privateKey string) ClientOption
WithAPIKey sets the explicit API key for the client loaded
func WithAPIKeyFromJSON ¶
func WithAPIKeyFromJSON(fileName string) ClientOption
WithAPIKeyFromJSON sets the API key for the client loaded from a supplied json file
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
WithBaseURL sets the base URL for the client
func WithDebug ¶ added in v0.0.5
func WithDebug() ClientOption
WithDebug sets the debug flag for the client
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
WithHTTPClient sets the http client for the client
func WithTimeout ¶ added in v0.0.10
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout sets the timeout for the client
type EthereumSignable ¶ added in v0.0.10
type EthereumSignable struct {
// contains filtered or unexported fields
}
EthereumSignable implements the Signable interface
func NewEthereumSignable ¶ added in v0.0.10
func NewEthereumSignable(raw *types.Transaction) *EthereumSignable
func (*EthereumSignable) IsSigned ¶ added in v0.0.10
func (e *EthereumSignable) IsSigned() bool
func (*EthereumSignable) Raw ¶ added in v0.0.10
func (e *EthereumSignable) Raw() interface{}
type ListValidatorsOption ¶ added in v0.0.4
type ListValidatorsOption func(client.ApiListValidatorsRequest) client.ApiListValidatorsRequest
ListValidatorsOption is a function that modifies the ListValidators request.
func WithListValidatorsStatusOption ¶ added in v0.0.4
func WithListValidatorsStatusOption(status ValidatorStatus) ListValidatorsOption
WithListValidatorsStatusOption filters the list of validators by status. Note: The Go generated code doesn't allow updating the request by reference. As a result we are forced to return back a copy of the request.
type SolanaSignable ¶ added in v0.0.10
type SolanaSignable struct {
// contains filtered or unexported fields
}
SolanaSignable implements the Signable interface
func NewSolanaSignable ¶ added in v0.0.10
func NewSolanaSignable(raw *solana.Transaction) *SolanaSignable
func (*SolanaSignable) IsSigned ¶ added in v0.0.10
func (s *SolanaSignable) IsSigned() bool
func (*SolanaSignable) Raw ¶ added in v0.0.10
func (s *SolanaSignable) Raw() interface{}
type StakingBalance ¶ added in v0.0.3
type StakingBalance struct {
// contains filtered or unexported fields
}
StakingBalance represents a struct that holds a staking balance data.
func (*StakingBalance) BondedStake ¶ added in v0.0.3
func (sb *StakingBalance) BondedStake() *Balance
BondedStake returns the bonded stake of the staking balance.
func (*StakingBalance) Date ¶ added in v0.0.3
func (sb *StakingBalance) Date() time.Time
Date returns the date of the staking balance.
func (*StakingBalance) ParticipantType ¶ added in v0.0.3
func (sb *StakingBalance) ParticipantType() string
ParticipantType returns the participant type of the staking balance.
func (*StakingBalance) String ¶ added in v0.0.3
func (sb *StakingBalance) String() string
String returns the string representation of the staking balance.
func (*StakingBalance) UnbondedBalance ¶ added in v0.0.3
func (sb *StakingBalance) UnbondedBalance() *Balance
UnbondedBalance returns the unbonded balance of the staking balance.
type StakingBalanceOption ¶
type StakingBalanceOption func(*client.GetStakingContextRequest)
StakingBalanceOption allows for the passing of custom options to the staking balance
func WithStakingBalanceMode ¶
func WithStakingBalanceMode(mode string) StakingBalanceOption
WithStakingBalanceMode allows for the setting of the mode of the staking balance
func WithStakingBalanceOption ¶
func WithStakingBalanceOption(optionKey string, optionValue string) StakingBalanceOption
WithStakingBalanceOption allows for the passing of custom options to the staking balance
type StakingContextBalance ¶ added in v0.0.3
type StakingContextBalance struct { StakeableBalance *Balance UnstakeableBalance *Balance ClaimableBalance *Balance }
StakingContextBalance represents the active stakeable balances for a given address and asset.
type StakingOperation ¶
type StakingOperation struct {
// contains filtered or unexported fields
}
StakingOperation represents a staking operation for a given action, asset, and amount.
func (*StakingOperation) AddressID ¶
func (s *StakingOperation) AddressID() string
AddressID returns the StakingOperation address id
func (*StakingOperation) GetSignedVoluntaryExitMessages ¶
func (s *StakingOperation) GetSignedVoluntaryExitMessages() ([]string, error)
func (*StakingOperation) ID ¶
func (s *StakingOperation) ID() string
ID returns the StakingOperation ID
func (*StakingOperation) IsCompleteState ¶ added in v0.0.12
func (s *StakingOperation) IsCompleteState() bool
func (*StakingOperation) IsFailedState ¶ added in v0.0.12
func (s *StakingOperation) IsFailedState() bool
func (*StakingOperation) IsTerminalState ¶ added in v0.0.12
func (s *StakingOperation) IsTerminalState() bool
func (*StakingOperation) NetworkID ¶
func (s *StakingOperation) NetworkID() string
NetworkID returns the StakingOperation network id
func (*StakingOperation) Sign ¶
func (s *StakingOperation) Sign(k crypto.Signer) error
Sign will sign each transaction using the supplied key if it isn't already signed. This will halt and return an error if any of the transactions fail to sign.
func (*StakingOperation) Status ¶
func (s *StakingOperation) Status() string
Status returns the StakingOperation status
func (*StakingOperation) Transactions ¶
func (s *StakingOperation) Transactions() []*Transaction
Transactions returns the transactions associated with the StakingOperation
type StakingOperationOption ¶
type StakingOperationOption func(*client.BuildStakingOperationRequest)
StakingOperationOption allows for the passing of custom options to the staking operation, like `mode` or `withdrawal_address`.
func WithStakingOperationMode ¶
func WithStakingOperationMode(mode string) StakingOperationOption
WithStakingOperationMode allows for the setting of the mode of the staking operation (i.e. `default`, `partial`, or `native`)
func WithStakingOperationOption ¶
func WithStakingOperationOption(optionKey, optionValue string) StakingOperationOption
WithStakingOperationOption allows for the passing of custom options to the staking operation, like `mode` or `withdrawal_address`.
type StakingReward ¶
type StakingReward struct {
// contains filtered or unexported fields
}
StakingReward represents a struct that holds a staking reward data.
func NewStakingReward ¶
func NewStakingReward(model client.StakingReward, asset Asset, format client.StakingRewardFormat) StakingReward
NewStakingReward creates a new staking rewards object.
func (StakingReward) AddressId ¶
func (s StakingReward) AddressId() string
AddressId returns the address of the staking reward.
func (StakingReward) Amount ¶
func (s StakingReward) Amount() (*big.Float, error)
Amount returns the amount of the staking reward.
func (StakingReward) ConversionPrice ¶
func (s StakingReward) ConversionPrice() (*big.Float, error)
ConversionPrice returns the conversion price of the staking reward.
func (StakingReward) ConversionTime ¶
func (s StakingReward) ConversionTime() time.Time
ConversionTime returns the conversion time of the staking reward.
func (StakingReward) Date ¶
func (s StakingReward) Date() (time.Time, error)
Date returns the date of the staking reward.
func (StakingReward) ToJSON ¶
func (s StakingReward) ToJSON() string
ToJSON prints the string representation of the reward.
func (StakingReward) ToString ¶
func (s StakingReward) ToString() string
ToString prints a simplified version of the reward.
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction represents an onchain transaction
func (*Transaction) FromAddressID ¶
func (t *Transaction) FromAddressID() string
FromAddressID returns the from address for the transaction
func (*Transaction) IsSigned ¶
func (t *Transaction) IsSigned() bool
IsSigned returns true if the transaction is signed
func (*Transaction) Raw ¶
func (t *Transaction) Raw() interface{}
Raw returns the raw transaction in the underlying blockchain's format
func (*Transaction) Sign ¶
func (t *Transaction) Sign(k crypto.Signer) error
Sign will sign the transaction using the supplied key
func (*Transaction) SignedPayload ¶
func (t *Transaction) SignedPayload() string
SignedPayload returns the signed payload of the transaction
func (*Transaction) Status ¶
func (t *Transaction) Status() string
Status returns the status of the Transaction
func (*Transaction) String ¶ added in v0.0.3
func (t *Transaction) String() string
String returns a string representation of the transaction
func (*Transaction) TransactionHash ¶
func (t *Transaction) TransactionHash() string
TransactionHash returns the hash of the transaction
func (*Transaction) TransactionLink ¶ added in v0.0.3
func (t *Transaction) TransactionLink() string
TransactionLink returns the link to the transaction on the blockchain explorer.
func (*Transaction) UnsignedPayload ¶
func (t *Transaction) UnsignedPayload() string
UnsignedPayload returns the unsigned payload of the transaction
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
func NewValidator ¶
func (Validator) Status ¶
func (v Validator) Status() client.ValidatorStatus
type ValidatorStatus ¶ added in v0.0.4
type ValidatorStatus string
const ( ValidatorStatusUnknown ValidatorStatus = "unknown" ValidatorStatusProvisioning ValidatorStatus = "provisioning" ValidatorStatusProvisioned ValidatorStatus = "provisioned" ValidatorStatusDeposited ValidatorStatus = "deposited" ValidatorStatusPendingActivation ValidatorStatus = "pending_activation" ValidatorStatusActive ValidatorStatus = "active" ValidatorStatusExiting ValidatorStatus = "exiting" ValidatorStatusExited ValidatorStatus = "exited" ValidatorStatusWithdrawalAvailable ValidatorStatus = "withdrawal_available" ValidatorStatusWithdrawalComplete ValidatorStatus = "withdrawal_complete" ValidatorStatusActiveSlashed ValidatorStatus = "active_slashed" ValidatorStatusExitedSlashed ValidatorStatus = "exited_slashed" ValidatorStatusReaped ValidatorStatus = "reaped" )
type WaitOption ¶
type WaitOption func(*waitOptions)
WaitOption allows for the passing of custom options to the wait function.
func WithWaitIntervalSeconds ¶
func WithWaitIntervalSeconds(intervalSeconds int) WaitOption
WithWaitIntervalSeconds sets the interval in seconds to wait between polling the staking operation.
func WithWaitTimeoutSeconds ¶
func WithWaitTimeoutSeconds(timeoutSeconds int) WaitOption
WithWaitTimeoutSeconds sets the timeout in seconds to wait for the staking operation to complete.