Documentation ¶
Index ¶
- func NewPublicLegacyAPI(astra *astra.Astra, namespace string) rpc.API
- func NewReceipt(tx interface{}, blockHash common.Hash, blockNumber, blockIndex uint64, ...) (interface{}, error)
- type BlockFactory
- type BlockHeader
- type BlockWithFullTx
- type BlockWithTxHash
- type CollectRewardsMsg
- type CreateValidatorMsg
- type CxReceipt
- type DelegateMsg
- type EditValidatorMsg
- type PublicLegacyService
- type StakingTransaction
- func NewStakingTransaction(tx *staking.StakingTransaction, blockHash common.Hash, blockNumber uint64, ...) (*StakingTransaction, error)
- func NewStakingTransactionFromBlockHash(b *types.Block, hash common.Hash) (*StakingTransaction, error)
- func NewStakingTransactionFromBlockIndex(b *types.Block, index uint64) (*StakingTransaction, error)
- func StakingTransactionsFromBlock(b *types.Block) ([]*StakingTransaction, error)
- type StakingTxReceipt
- type Transaction
- type TxReceipt
- type UndelegateMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPublicLegacyAPI ¶
NewPublicLegacyAPI creates a new API for the RPC interface
Types ¶
type BlockFactory ¶
type BlockFactory struct {
// contains filtered or unexported fields
}
BlockFactory is the factory for v1 rpc block
func NewBlockFactory ¶
func NewBlockFactory(provider rpc_common.BlockDataProvider) *BlockFactory
NewBlockFactory return the block factory with the given provider
func (*BlockFactory) NewBlock ¶
func (fac *BlockFactory) NewBlock(b *types.Block, args *rpc_common.BlockArgs) (interface{}, error)
NewBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain transaction hashes.
type BlockHeader ¶
type BlockHeader struct { ParentHash common.Hash `json:"parentHash"` Miner common.Address `json:"miner"` StateRoot common.Hash `json:"stateRoot"` TransactionsRoot common.Hash `json:"transactionsRoot"` ReceiptsRoot common.Hash `json:"receiptsRoot"` OutgoingReceiptsRoot common.Hash `json:"outgoingReceiptsRoot"` IncomingReceiptsRoot common.Hash `json:"incomingReceiptsRoot"` LogsBloom ethtypes.Bloom `json:"logsBloom"` Number *big.Int `json:"number"` GasLimit uint64 `json:"gasLimit"` GasUsed uint64 `json:"gasUsed"` Timestamp *big.Int `json:"timestamp"` ExtraData hexutil.Bytes `json:"extraData"` MixHash common.Hash `json:"mixHash"` ViewID *big.Int `json:"viewID"` Epoch *big.Int `json:"epoch"` ShardID uint32 `json:"shardID"` LastCommitSignature hexutil.Bytes `json:"lastCommitSignature"` LastCommitBitmap hexutil.Bytes `json:"lastCommitBitmap"` Vrf hexutil.Bytes `json:"vrf"` Vdf hexutil.Bytes `json:"vdf"` ShardState hexutil.Bytes `json:"shardState"` CrossLink hexutil.Bytes `json:"crossLink"` Slashes hexutil.Bytes `json:"slashes"` }
BlockHeader represents a block header that will serialize to the RPC representation of a block header
func NewBlockHeader ¶
func NewBlockHeader( head *block.Header, ) (*BlockHeader, error)
type BlockWithFullTx ¶
type BlockWithFullTx struct { Number *big.Int `json:"number"` ViewID *big.Int `json:"viewID"` Epoch *big.Int `json:"epoch"` Hash common.Hash `json:"hash"` ParentHash common.Hash `json:"parentHash"` Nonce uint64 `json:"nonce"` MixHash common.Hash `json:"mixHash"` LogsBloom ethtypes.Bloom `json:"logsBloom"` StateRoot common.Hash `json:"stateRoot"` Miner string `json:"miner"` Difficulty uint64 `json:"difficulty"` ExtraData hexutil.Bytes `json:"extraData"` Size uint64 `json:"size"` GasLimit uint64 `json:"gasLimit"` GasUsed uint64 `json:"gasUsed"` VRF common.Hash `json:"vrf"` VRFProof hexutil.Bytes `json:"vrfProof"` Timestamp *big.Int `json:"timestamp"` TransactionsRoot common.Hash `json:"transactionsRoot"` ReceiptsRoot common.Hash `json:"receiptsRoot"` Uncles []common.Hash `json:"uncles"` Transactions []*Transaction `json:"transactions"` StakingTxs []*StakingTransaction `json:"stakingTransactions"` Signers []string `json:"signers,omitempty"` }
BlockWithFullTx represents a block that will serialize to the RPC representation of a block having FULL transactions in the Transaction & Staking transaction fields.
type BlockWithTxHash ¶
type BlockWithTxHash struct { Number *big.Int `json:"number"` ViewID *big.Int `json:"viewID"` Epoch *big.Int `json:"epoch"` Hash common.Hash `json:"hash"` ParentHash common.Hash `json:"parentHash"` Nonce uint64 `json:"nonce"` MixHash common.Hash `json:"mixHash"` LogsBloom ethtypes.Bloom `json:"logsBloom"` StateRoot common.Hash `json:"stateRoot"` Miner string `json:"miner"` Difficulty uint64 `json:"difficulty"` ExtraData hexutil.Bytes `json:"extraData"` Size uint64 `json:"size"` GasLimit uint64 `json:"gasLimit"` GasUsed uint64 `json:"gasUsed"` VRF common.Hash `json:"vrf"` VRFProof hexutil.Bytes `json:"vrfProof"` Timestamp *big.Int `json:"timestamp"` TransactionsRoot common.Hash `json:"transactionsRoot"` ReceiptsRoot common.Hash `json:"receiptsRoot"` Uncles []common.Hash `json:"uncles"` Transactions []common.Hash `json:"transactions"` EthTransactions []common.Hash `json:"transactionsInEthHash"` StakingTxs []common.Hash `json:"stakingTransactions"` Signers []string `json:"signers,omitempty"` }
BlockWithTxHash represents a block that will serialize to the RPC representation of a block having ONLY transaction hashes in the Transaction & Staking transaction fields.
type CollectRewardsMsg ¶
type CollectRewardsMsg struct {
DelegatorAddress string `json:"delegatorAddress"`
}
CollectRewardsMsg represents a staking transaction's collect rewards directive that will serialize to the RPC representation
type CreateValidatorMsg ¶
type CreateValidatorMsg struct { ValidatorAddress string `json:"validatorAddress"` CommissionRate *big.Int `json:"commissionRate"` MaxCommissionRate *big.Int `json:"maxCommissionRate"` MaxChangeRate *big.Int `json:"maxChangeRate"` MinSelfDelegation *big.Int `json:"minSelfDelegation"` MaxTotalDelegation *big.Int `json:"maxTotalDelegation"` Amount *big.Int `json:"amount"` Name string `json:"name"` Website string `json:"website"` Identity string `json:"identity"` SecurityContact string `json:"securityContact"` Details string `json:"details"` SlotPubKeys []bls.SerializedPublicKey `json:"slotPubKeys"` SlotKeySigs []bls.SerializedSignature `json:"slotKeySigs"` }
CreateValidatorMsg represents a staking transaction's create validator directive that will serialize to the RPC representation
type CxReceipt ¶
type CxReceipt struct { BlockHash common.Hash `json:"blockHash"` BlockNumber *big.Int `json:"blockNumber"` TxHash common.Hash `json:"hash"` From string `json:"from"` To string `json:"to"` ShardID uint32 `json:"shardID"` ToShardID uint32 `json:"toShardID"` Amount *big.Int `json:"value"` }
CxReceipt represents a CxReceipt that will serialize to the RPC representation of a CxReceipt
type DelegateMsg ¶
type DelegateMsg struct { DelegatorAddress string `json:"delegatorAddress"` ValidatorAddress string `json:"validatorAddress"` Amount *big.Int `json:"amount"` }
DelegateMsg represents a staking transaction's delegate directive that will serialize to the RPC representation
type EditValidatorMsg ¶
type EditValidatorMsg struct { ValidatorAddress string `json:"validatorAddress"` CommissionRate *big.Int `json:"commissionRate"` MinSelfDelegation *big.Int `json:"minSelfDelegation"` MaxTotalDelegation *big.Int `json:"maxTotalDelegation"` Name string `json:"name"` Website string `json:"website"` Identity string `json:"identity"` SecurityContact string `json:"securityContact"` Details string `json:"details"` SlotPubKeyToAdd *bls.SerializedPublicKey `json:"slotPubKeyToAdd"` SlotPubKeyToRemove *bls.SerializedPublicKey `json:"slotPubKeyToRemove"` SlotKeyToAddSig *bls.SerializedSignature `json:"slotKeyToAddSig"` }
EditValidatorMsg represents a staking transaction's edit validator directive that will serialize to the RPC representation
type PublicLegacyService ¶
type PublicLegacyService struct {
// contains filtered or unexported fields
}
PublicLegacyService provides an API to access the Astra blockchain. Services here are legacy methods, specific to the V1 RPC that can be deprecated in the future.
func (*PublicLegacyService) GetBalance ¶
GetBalance returns the amount of Atto for the given address in the state of the given block number.
type StakingTransaction ¶
type StakingTransaction struct { BlockHash common.Hash `json:"blockHash"` BlockNumber *big.Int `json:"blockNumber"` From string `json:"from"` Timestamp uint64 `json:"timestamp"` Gas uint64 `json:"gas"` GasPrice *big.Int `json:"gasPrice"` Hash common.Hash `json:"hash"` Nonce uint64 `json:"nonce"` TransactionIndex uint64 `json:"transactionIndex"` V *hexutil.Big `json:"v"` R *hexutil.Big `json:"r"` S *hexutil.Big `json:"s"` Type string `json:"type"` Msg interface{} `json:"msg"` }
StakingTransaction represents a transaction that will serialize to the RPC representation of a staking transaction
func NewStakingTransaction ¶
func NewStakingTransaction( tx *staking.StakingTransaction, blockHash common.Hash, blockNumber uint64, timestamp uint64, index uint64, signed bool, ) (*StakingTransaction, error)
NewStakingTransaction returns a staking transaction that will serialize to the RPC representation, with the given location metadata set (if available).
func NewStakingTransactionFromBlockHash ¶
func NewStakingTransactionFromBlockHash(b *types.Block, hash common.Hash) (*StakingTransaction, error)
NewStakingTransactionFromBlockHash returns a staking transaction that will serialize to the RPC representation.
func NewStakingTransactionFromBlockIndex ¶
func NewStakingTransactionFromBlockIndex(b *types.Block, index uint64) (*StakingTransaction, error)
NewStakingTransactionFromBlockIndex returns a staking transaction that will serialize to the RPC representation.
func StakingTransactionsFromBlock ¶
func StakingTransactionsFromBlock(b *types.Block) ([]*StakingTransaction, error)
StakingTransactionsFromBlock return rpc staking transactions from a block
type StakingTxReceipt ¶
type StakingTxReceipt struct { BlockHash common.Hash `json:"blockHash"` TransactionHash common.Hash `json:"transactionHash"` BlockNumber uint64 `json:"blockNumber"` TransactionIndex uint64 `json:"transactionIndex"` GasUsed uint64 `json:"gasUsed"` CumulativeGasUsed uint64 `json:"cumulativeGasUsed"` ContractAddress common.Address `json:"contractAddress"` Logs []*types.Log `json:"logs"` LogsBloom ethtypes.Bloom `json:"logsBloom"` Sender string `json:"sender"` Type staking.Directive `json:"type"` Root hexutil.Bytes `json:"root"` Status uint `json:"status"` }
StakingTxReceipt represents a staking transaction receipt that will serialize to the RPC representation.
func NewStakingTxReceipt ¶
func NewStakingTxReceipt( tx *staking.StakingTransaction, blockHash common.Hash, blockNumber, blockIndex uint64, receipt *types.Receipt, ) (*StakingTxReceipt, error)
NewStakingTxReceipt returns a staking transaction receipt that will serialize to the RPC representation
type Transaction ¶
type Transaction struct { BlockHash common.Hash `json:"blockHash"` BlockNumber *big.Int `json:"blockNumber"` From string `json:"from"` Timestamp uint64 `json:"timestamp"` Gas uint64 `json:"gas"` GasPrice *big.Int `json:"gasPrice"` Hash common.Hash `json:"hash"` EthHash common.Hash `json:"ethHash"` Input hexutil.Bytes `json:"input"` Nonce uint64 `json:"nonce"` To string `json:"to"` TransactionIndex uint64 `json:"transactionIndex"` Value *big.Int `json:"value"` ShardID uint32 `json:"shardID"` ToShardID uint32 `json:"toShardID"` V *hexutil.Big `json:"v"` R *hexutil.Big `json:"r"` S *hexutil.Big `json:"s"` }
Transaction represents a transaction that will serialize to the RPC representation of a transaction
func NewTransaction ¶
func NewTransaction( tx *types.Transaction, blockHash common.Hash, blockNumber uint64, timestamp uint64, index uint64, ) (*Transaction, error)
NewTransaction returns a transaction that will serialize to the RPC representation, with the given location metadata set (if available). Note that all txs on Astra are replay protected (post EIP155 epoch).
func NewTransactionFromBlockIndex ¶
func NewTransactionFromBlockIndex(b *types.Block, index uint64) (*Transaction, error)
NewTransactionFromBlockIndex returns a transaction that will serialize to the RPC representation.
func NewTransactionFromHash ¶
NewTransactionFromHash returns a transaction that will serialize to the RPC representation.
type TxReceipt ¶
type TxReceipt struct { BlockHash common.Hash `json:"blockHash"` TransactionHash common.Hash `json:"transactionHash"` BlockNumber uint64 `json:"blockNumber"` TransactionIndex uint64 `json:"transactionIndex"` GasUsed uint64 `json:"gasUsed"` CumulativeGasUsed uint64 `json:"cumulativeGasUsed"` ContractAddress common.Address `json:"contractAddress"` Logs []*types.Log `json:"logs"` LogsBloom ethtypes.Bloom `json:"logsBloom"` ShardID uint32 `json:"shardID"` From string `json:"from"` To string `json:"to"` Root hexutil.Bytes `json:"root"` Status uint `json:"status"` }
TxReceipt represents a transaction receipt that will serialize to the RPC representation.