Documentation ¶
Index ¶
- Constants
- func DeserializeModel(b []byte, v any) error
- func SerializeModel(v any) ([]byte, error)
- type AccountAddress
- type AccountEncryptedAmount
- type AccountInfo
- type AccountNonce
- type AccountReleaseSchedule
- type Address
- type Amount
- func (a *Amount) CCD() float64
- func (a *Amount) Deserialize(b []byte) error
- func (a *Amount) DeserializeModel(b []byte) (int, error)
- func (a *Amount) MarshalJSON() ([]byte, error)
- func (a *Amount) MicroCCD() int
- func (a *Amount) Serialize() ([]byte, error)
- func (a *Amount) SerializeModel() ([]byte, error)
- func (a *Amount) UnmarshalJSON(b []byte) error
- type AnonymityRevoker
- type AnonymityRevokerDescription
- type BakerId
- type BakerInfo
- type BirkParameters
- type BlockHash
- type BlockHeight
- type BlockInfo
- type BlockItemKind
- type BlockItemVersion
- type Branch
- type Client
- type ConsensusStatus
- type ConsensusType
- type ContractAddress
- type ContractContext
- type ContractName
- type Credentials
- type DecryptedSignKey
- type Deserializer
- type EncryptedAmount
- type EncryptedSignKey
- type EncryptedSignKeyMetadata
- type EncryptionKey
- type IdentityProvider
- type IdentityProviderDescription
- type InitName
- type InstanceInfo
- type InvokeContractResult
- type InvokeContractResultTag
- type KeyPair
- type Model
- type ModelDeserializer
- type ModelSerializer
- type ModuleRef
- type NetworkId
- type NextAccountNonce
- type NodeId
- type NodeInfo
- type NodeInfoIsInBakingCommittee
- type PeerElement
- type PeerElementCatchupStatus
- type PeerList
- type PeerStats
- type PeerStatsElement
- type PeerType
- type ReceiveName
- type Release
- type RewardStatus
- type Serializer
- type SignKey
- type TransactionEvent
- type TransactionHash
- type TransactionOutcome
- type TransactionRequest
- type TransactionResult
- type TransactionResultEvents
- type TransactionResultOutcome
- type TransactionStatus
- type TransactionSummary
Constants ¶
const ( NodeInfoNotInCommittee = 0 NodeInfoAddedButNotActiveInCommittee = 1 NodeInfoAddedButWrongKeys = 2 NodeInfoActiveInCommittee = 3 )
const ( DefaultExpiry = 10 * time.Minute TransactionStatusFinalized TransactionStatus = "finalized" TransactionStatusCommitted TransactionStatus = "committed" TransactionStatusReceived TransactionStatus = "received" TransactionResultSuccess TransactionResultOutcome = "success" TransactionResultReject TransactionResultOutcome = "reject" )
const ( BlockItemVersion0 BlockItemVersion = 0 BlockItemKindAccountTransaction BlockItemKind = 0 BlockItemKindCredentialDeployment BlockItemKind = 1 BlockItemKindUpdateInstruction BlockItemKind = 2 )
const DefaultNetworkId = 100
Variables ¶
This section is empty.
Functions ¶
func DeserializeModel ¶
func SerializeModel ¶
Types ¶
type AccountAddress ¶
type AccountAddress string
AccountAddress base-58 check with version byte 1 encoded address (with Bitcoin mapping table)
func (*AccountAddress) Deserialize ¶
func (a *AccountAddress) Deserialize(b []byte) error
func (*AccountAddress) DeserializeModel ¶
func (a *AccountAddress) DeserializeModel(b []byte) (int, error)
func (*AccountAddress) Serialize ¶
func (a *AccountAddress) Serialize() ([]byte, error)
func (*AccountAddress) SerializeModel ¶
func (a *AccountAddress) SerializeModel() ([]byte, error)
type AccountEncryptedAmount ¶
type AccountEncryptedAmount struct { IncomingAmounts []EncryptedAmount `json:"incomingAmounts"` SelfAmount EncryptedAmount `json:"selfAmount"` StartIndex int `json:"startIndex"` }
type AccountInfo ¶
type AccountInfo struct { AccountNonce uint64 `json:"accountNonce"` AccountAmount *Amount `json:"accountAmount"` AccountReleaseSchedule *AccountReleaseSchedule `json:"accountReleaseSchedule"` AccountCredentials any `json:"accountCredentials"` // TODO AccountThreshold int `json:"accountThreshold"` AccountEncryptedAmount *AccountEncryptedAmount `json:"accountEncryptedAmount"` AccountEncryptionKey EncryptionKey `json:"accountEncryptionKey"` AccountIndex uint64 `json:"accountIndex"` AccountAddress AccountAddress `json:"accountAddress"` }
AccountInfo Messy documentations: https://github.com/Concordium/concordium-node/blob/main/docs/grpc-for-smart-contracts.md#getaccountinfo https://github.com/Concordium/concordium-node/blob/main/docs/grpc.md#getaccountinfo--blockhash---accountaddress---accountinfo
type AccountNonce ¶
type AccountNonce uint64
type AccountReleaseSchedule ¶
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
func WrapAccountAddress ¶
func WrapAccountAddress(addr AccountAddress) *Address
func WrapContractAddress ¶
func WrapContractAddress(addr *ContractAddress) *Address
func (*Address) MarshalJSON ¶
func (*Address) SerializeModel ¶
func (*Address) UnmarshalJSON ¶
type Amount ¶
type Amount struct {
// contains filtered or unexported fields
}
func NewAmountFromCCD ¶
func NewAmountFromMicroCCD ¶
func NewAmountZero ¶
func NewAmountZero() *Amount
func (*Amount) Deserialize ¶
func (*Amount) MarshalJSON ¶
func (*Amount) SerializeModel ¶
func (*Amount) UnmarshalJSON ¶
type AnonymityRevoker ¶
type AnonymityRevoker struct { ArIdentity int `json:"arIdentity"` ArDescription *AnonymityRevokerDescription `json:"arDescription"` ArPublicKey string `json:"arPublicKey"` }
type BakerInfo ¶
type BakerInfo struct { BakerId BakerId `json:"bakerId"` BakerAccount AccountAddress `json:"bakerAccount"` BakerLotteryPower float64 `json:"bakerLotteryPower"` }
type BirkParameters ¶
type BlockHeight ¶
type BlockHeight uint64
type BlockInfo ¶
type BlockInfo struct { BlockHash BlockHash `json:"blockHash"` BlockParent BlockHash `json:"blockParent"` BlockLastFinalized BlockHash `json:"blockLastFinalized"` BlockHeight BlockHeight `json:"blockHeight"` EraBlockHeight BlockHeight `json:"eraBlockHeight"` GenesisIndex int `json:"genesisIndex"` BlockReceiveTime time.Time `json:"blockReceiveTime"` BlockArriveTime time.Time `json:"blockArriveTime"` BlockSlot int `json:"blockSlot"` BlockSlotTime time.Time `json:"blockSlotTime"` BlockBaker BakerId `json:"blockBaker"` Finalized bool `json:"finalized"` TransactionCount int `json:"transactionCount"` TransactionEnergyCost int `json:"transactionEnergyCost"` // undocumented but returned in fact TransactionsSize int `json:"transactionsSize"` BlockStateHash BlockHash `json:"blockStateHash"` }
type BlockItemKind ¶
type BlockItemKind uint8
type BlockItemVersion ¶
type BlockItemVersion uint8
type Client ¶
type Client interface { // PeerConnect Suggest to w peer to connect to the submitted peer details. // This, if successful, adds the peer to the list of given addresses. PeerConnect(ctx context.Context, ip string, port int) (bool, error) // PeerDisconnect Disconnect from the peer and remove them from the given addresses list // if they are on it. Return if the request was processed successfully. PeerDisconnect(ctx context.Context, ip string, port int) (bool, error) // PeerUptime Peer uptime PeerUptime(ctx context.Context) (int64, error) // PeerTotalSent Peer total number of sent packets PeerTotalSent(ctx context.Context) (int, error) // PeerTotalReceived Peer total number of received packets PeerTotalReceived(ctx context.Context) (int, error) // PeerVersion Peer client software version PeerVersion(ctx context.Context) (string, error) // PeerStats Stats for connected peers PeerStats(ctx context.Context, includeBootstrappers bool) (*PeerStats, error) // PeerList List of connected peers PeerList(ctx context.Context, includeBootstrappers bool) (*PeerList, error) // BanNode ... BanNode(ctx context.Context, element *PeerElement) (bool, error) // UnbanNode ... UnbanNode(ctx context.Context, element *PeerElement) (bool, error) // JoinNetwork ... JoinNetwork(ctx context.Context, id NetworkId) (bool, error) // LeaveNetwork ... LeaveNetwork(ctx context.Context, id NetworkId) (bool, error) // NodeInfo Get information about the running Node NodeInfo(ctx context.Context) (*NodeInfo, error) // GetConsensusStatus see https://github.com/Concordium/concordium-node/blob/main/docs/grpc.md#getconsensusstatus--consensusstatus GetConsensusStatus(ctx context.Context) (*ConsensusStatus, error) // GetBlockInfo see https://github.com/Concordium/concordium-node/blob/main/docs/grpc.md#getblockinfo--blockhash---blockinfo GetBlockInfo(ctx context.Context, hash BlockHash) (*BlockInfo, error) // GetAncestors see https://github.com/Concordium/concordium-node/blob/main/docs/grpc.md#getancestors--blockhash---blockhash GetAncestors(ctx context.Context, hash BlockHash, amount int) ([]BlockHash, error) // GetBranches see https://github.com/Concordium/concordium-node/blob/main/docs/grpc.md#getbranches--branch GetBranches(ctx context.Context) (*Branch, error) // GetBlocksAtHeight Get the blocks at the given height GetBlocksAtHeight(ctx context.Context, height BlockHeight) ([]BlockHash, error) // SendTransactionAsync Submit a local transaction SendTransactionAsync(ctx context.Context, id NetworkId, request TransactionRequest) (TransactionHash, error) SendTransactionAwait(ctx context.Context, id NetworkId, request TransactionRequest) (*TransactionOutcome, error) // StartBaker Start the baker in the consensus module StartBaker(ctx context.Context) (bool, error) // StopBaker Stop the baker in the consensus module StopBaker(ctx context.Context) (bool, error) // GetAccountList see https://github.com/Concordium/concordium-node/blob/main/docs/grpc.md#getaccountlist--blockhash---accountaddress GetAccountList(ctx context.Context, hash BlockHash) ([]AccountAddress, error) // GetInstances see https://github.com/Concordium/concordium-node/blob/main/docs/grpc.md#getinstances--blockhash---contractaddress GetInstances(ctx context.Context, hash BlockHash) ([]*ContractAddress, error) // GetAccountInfo see https://github.com/Concordium/concordium-node/blob/main/docs/grpc.md#getaccountinfo--blockhash---accountaddress---accountinfo GetAccountInfo(ctx context.Context, hash BlockHash, address AccountAddress) (*AccountInfo, error) // GetInstanceInfo see https://github.com/Concordium/concordium-node/blob/main/docs/grpc.md#getinstanceinfo--blockhash---contractaddress---contractinfo GetInstanceInfo(ctx context.Context, hash BlockHash, address *ContractAddress) (*InstanceInfo, error) // InvokeContract see https://github.com/Concordium/concordium-node/blob/main/docs/grpc.md#invokecontract--blockhash---contractcontext---invokecontractresult InvokeContract(ctx context.Context, hash BlockHash, context *ContractContext) (*InvokeContractResult, error) // GetRewardStatus see https://github.com/Concordium/concordium-node/blob/main/docs/grpc.md#getrewardstatus-blockhash---rewardstatus GetRewardStatus(ctx context.Context, hash BlockHash) (*RewardStatus, error) // GetBirkParameters see https://github.com/Concordium/concordium-node/blob/main/docs/grpc.md#getbirkparameters--blockhash---birkparameters GetBirkParameters(ctx context.Context, hash BlockHash) (*BirkParameters, error) // GetModuleList see https://github.com/Concordium/concordium-node/blob/main/docs/grpc.md#getmodulelist--blockhash---moduleref GetModuleList(ctx context.Context, hash BlockHash) ([]ModuleRef, error) // GetModuleSource see https://github.com/Concordium/concordium-node/blob/main/docs/grpc.md#getmodulesource--blockhash---moduleref---modulesource GetModuleSource(ctx context.Context, hash BlockHash, ref ModuleRef) (io.Reader, error) // GetIdentityProviders ... GetIdentityProviders(ctx context.Context, hash BlockHash) ([]*IdentityProvider, error) // GetAnonymityRevokers ... GetAnonymityRevokers(ctx context.Context, hash BlockHash) ([]*AnonymityRevoker, error) // GetCryptographicParameters ... GetCryptographicParameters(ctx context.Context, hash BlockHash) ([]byte, error) // TODO // GetBannedPeers ... GetBannedPeers(ctx context.Context) (*PeerList, error) // Shutdown ... Shutdown(ctx context.Context) (bool, error) // DumpStart ... DumpStart(ctx context.Context, file string, raw bool) (bool, error) // DumpStop ... DumpStop(ctx context.Context) (bool, error) // GetTransactionStatus Query for the status of a transaction by its hash GetTransactionStatus(ctx context.Context, hash TransactionHash) (*TransactionSummary, error) // GetTransactionStatusInBlock Query for transactions in a block by its hash GetTransactionStatusInBlock(ctx context.Context, hash TransactionHash, blockHash BlockHash) (*TransactionSummary, error) // GetAccountNonFinalizedTransactions Query for non-finalized // transactions present on an account by the account address GetAccountNonFinalizedTransactions(ctx context.Context, address AccountAddress) ([]byte, error) // TODO // GetBlockSummary Request a summary for a block by its hash GetBlockSummary(ctx context.Context, hash BlockHash) ([]byte, error) // TODO // GetNextAccountNonce Request next nonce information for an account GetNextAccountNonce(ctx context.Context, address AccountAddress) (*NextAccountNonce, error) }
type ConsensusStatus ¶
type ConsensusStatus struct { BestBlock BlockHash `json:"bestBlock"` GenesisBlock BlockHash `json:"genesisBlock"` GenesisTime time.Time `json:"genesisTime"` SlotDuration int64 `json:"slotDuration"` EpochDuration int64 `json:"epochDuration"` LastFinalizedBlock BlockHash `json:"lastFinalizedBlock"` BestBlockHeight BlockHeight `json:"bestBlockHeight"` LastFinalizedBlockHeight BlockHeight `json:"lastFinalizedBlockHeight"` BlocksReceivedCount int `json:"blocksReceivedCount"` BlockLastReceivedTime time.Time `json:"blockLastReceivedTime"` BlockReceiveLatencyEMA float64 `json:"blockReceiveLatencyEMA"` BlockReceiveLatencyEMSD float64 `json:"blockReceiveLatencyEMSD"` BlockReceivePeriodEMA float64 `json:"blockReceivePeriodEMA"` BlockReceivePeriodEMSD float64 `json:"blockReceivePeriodEMSD"` BlocksVerifiedCount int `json:"blocksVerifiedCount"` BlockLastArrivedTime time.Time `json:"blockLastArrivedTime"` BlockArriveLatencyEMA float64 `json:"blockArriveLatencyEMA"` BlockArriveLatencyEMSD float64 `json:"blockArriveLatencyEMSD"` BlockArrivePeriodEMA float64 `json:"blockArrivePeriodEMA"` BlockArrivePeriodEMSD float64 `json:"blockArrivePeriodEMSD"` TransactionsPerBlockEMA float64 `json:"transactionsPerBlockEMA"` TransactionsPerBlockEMSD float64 `json:"transactionsPerBlockEMSD"` FinalizationCount int `json:"finalizationCount"` LastFinalizedTime time.Time `json:"lastFinalizedTime"` FinalizationPeriodEMA float64 `json:"finalizationPeriodEMA"` FinalizationPeriodEMSD float64 `json:"finalizationPeriodEMSD"` ProtocolVersion int `json:"protocolVersion"` GenesisIndex int `json:"genesisIndex"` CurrentEraGenesisBlock BlockHash `json:"currentEraGenesisBlock"` CurrentEraGenesisTime time.Time `json:"currentEraGenesisTime"` }
type ConsensusType ¶
type ConsensusType string
type ContractAddress ¶
ContractAddress is a JSON record with two fields {index : Int, subindex : Int}
func (*ContractAddress) Deserialize ¶
func (a *ContractAddress) Deserialize(b []byte) error
func (*ContractAddress) DeserializeModel ¶
func (a *ContractAddress) DeserializeModel(b []byte) (int, error)
func (*ContractAddress) Serialize ¶
func (a *ContractAddress) Serialize() ([]byte, error)
Serialize returns bytes (Index and SubIndex in big-endian order) of serialized ContractAddress.
func (*ContractAddress) SerializeModel ¶
func (a *ContractAddress) SerializeModel() ([]byte, error)
type ContractContext ¶
type ContractContext struct { Invoker *Address `json:"invoker"` Contract *ContractAddress `json:"contract"` Amount *Amount `json:"amount"` Method ReceiveName `json:"method"` Parameter Model `json:"parameter"` Energy int `json:"energy"` }
type ContractName ¶
type ContractName string
func (*ContractName) DeserializeModel ¶
func (n *ContractName) DeserializeModel([]byte) (int, error)
func (*ContractName) SerializeModel ¶
func (n *ContractName) SerializeModel() ([]byte, error)
type Credentials ¶
type DecryptedSignKey ¶
type DecryptedSignKey string
func (DecryptedSignKey) Decode ¶
func (k DecryptedSignKey) Decode() ([]byte, error)
type Deserializer ¶
type EncryptedAmount ¶
type EncryptedAmount string
EncryptedAmount base-16 encoded string (384 characters)
type EncryptedSignKey ¶
type EncryptedSignKey struct { Password string `json:"password"` Metadata EncryptedSignKeyMetadata `json:"metadata"` CipherText string `json:"cipherText"` }
func (*EncryptedSignKey) Decode ¶
func (k *EncryptedSignKey) Decode() ([]byte, error)
type EncryptionKey ¶
type EncryptionKey string
EncryptionKey base-16 encoded string (192 characters)
type IdentityProvider ¶
type IdentityProvider struct { IpIdentity int `json:"ipIdentity"` IpDescription *IdentityProviderDescription `json:"ipDescription"` IpVerifyKey string `json:"ipVerifyKey"` IpCdiVerifyKey string `json:"ipCdiVerifyKey"` }
type InitName ¶
type InitName string
func NewInitName ¶
func NewInitName(contractName ContractName) InitName
func (*InitName) SerializeModel ¶
type InstanceInfo ¶
type InstanceInfo struct { Amount *Amount `json:"amount"` SourceModule ModuleRef `json:"sourceModule"` Owner AccountAddress `json:"owner"` Name InitName `json:"name"` Model Model `json:"model"` Methods []ReceiveName `json:"methods"` }
type InvokeContractResult ¶
type InvokeContractResult struct { Tag InvokeContractResultTag `json:"tag"` UsedEnergy int `json:"usedEnergy"` ReturnValue Model `json:"returnValue"` Events any `json:"events"` // TODO Reason any `json:"reason"` // TODO }
type InvokeContractResultTag ¶
type InvokeContractResultTag string
const ( InvokeContractResultSuccess InvokeContractResultTag = "success" InvokeContractResultFailure InvokeContractResultTag = "failure" )
type ModelDeserializer ¶
type ModelSerializer ¶
type ModuleRef ¶
type ModuleRef string
ModuleRef base-16 encoded module reference (64 characters)
func (*ModuleRef) Deserialize ¶
type NextAccountNonce ¶
type NextAccountNonce struct { AllFinal bool `json:"allFinal"` Nonce AccountNonce `json:"nonce"` }
type NodeInfo ¶
type NodeInfo struct { NodeId NodeId CurrentLocaltime int64 PeerType PeerType ConsensusBakerRunning bool ConsensusRunning bool ConsensusType ConsensusType ConsensusBakerCommittee NodeInfoIsInBakingCommittee ConsensusFinalizerCommittee bool ConsensusBakerId BakerId }
type NodeInfoIsInBakingCommittee ¶
type NodeInfoIsInBakingCommittee int
type PeerElement ¶
type PeerElement struct { NodeId NodeId Ip string Port int CatchupStatus PeerElementCatchupStatus }
type PeerElementCatchupStatus ¶
type PeerElementCatchupStatus int
const ( PeerElementUpToDate PeerElementCatchupStatus = 0 PeerElementPending PeerElementCatchupStatus = 1 PeerElementCatchingUp PeerElementCatchupStatus = 2 )
type PeerList ¶
type PeerList struct { Type PeerType Peers []*PeerElement }
type PeerStats ¶
type PeerStats struct { Peers []*PeerStatsElement AvgBpsIn int AvgBpsOut int }
type PeerStatsElement ¶
type ReceiveName ¶
type ReceiveName string
func NewReceiveName ¶
func NewReceiveName(contractName ContractName, receiver string) ReceiveName
func (*ReceiveName) DeserializeModel ¶
func (n *ReceiveName) DeserializeModel(b []byte) (int, error)
func (*ReceiveName) Serialize ¶
func (n *ReceiveName) Serialize() ([]byte, error)
func (*ReceiveName) SerializeModel ¶
func (n *ReceiveName) SerializeModel() ([]byte, error)
type Release ¶
type Release struct { Timestamp time.Time `json:"timestamp"` Amount *Amount `json:"amount"` Transactions []TransactionHash `json:"transactions"` }
type RewardStatus ¶
type Serializer ¶
type TransactionEvent ¶
type TransactionEvent struct { Address ContractAddress `json:"address"` Contents string `json:"contents"` }
type TransactionHash ¶
type TransactionHash string
TransactionHash base-16 encoded hash of a transaction (64 characters)
type TransactionOutcome ¶
type TransactionOutcome struct { Hash TransactionHash `json:"hash"` Result TransactionResult `json:"result"` }
func (*TransactionOutcome) Error ¶
func (o *TransactionOutcome) Error() error
type TransactionRequest ¶
type TransactionRequest interface { Serializer Version() BlockItemVersion Kind() BlockItemKind ExpiredAt() time.Time }
type TransactionResult ¶
type TransactionResult struct { Outcome TransactionResultOutcome `json:"outcome"` Events TransactionResultEvents `json:"events,omitempty"` }
type TransactionResultEvents ¶
type TransactionResultEvents []*TransactionEvent
type TransactionResultOutcome ¶
type TransactionResultOutcome string
type TransactionStatus ¶
type TransactionStatus string
type TransactionSummary ¶
type TransactionSummary struct { Status TransactionStatus `json:"status"` Outcomes map[string]TransactionOutcome `json:"outcomes"` }