Documentation
¶
Index ¶
- Variables
- func MarshallToMap(input interface{}) (map[string]interface{}, error)
- func UnmarshallFromMap(input map[string]interface{}, output interface{}) error
- type ArgBuilder
- type CallParams
- type CeloEvent
- type CeloMethod
- type Client
- type FilterQueryParams
- type Server
- type SignatureValues
- type Transaction
- func (tx *Transaction) AsGethTransaction() (*types.Transaction, error)
- func (tx *Transaction) Deserialize(data []byte, chainId *big.Int) error
- func (tx *Transaction) GetSignatureValues() (*SignatureValues, error)
- func (tx *Transaction) Hash() (common.Hash, error)
- func (tx Transaction) MarshalJSON() ([]byte, error)
- func (tx *Transaction) Serialize() ([]byte, error)
- func (tx *Transaction) Signed() bool
- func (tx *Transaction) UnmarshalJSON(b []byte) error
- type TxArgs
- type TxMetadata
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Election EpochRewardsDistributedToVoters = registerEvent(registry.ElectionContractID.String(), "EpochRewardsDistributedToVoters", []topicParser{addressTopicParser}) // StableToken StableTokenTransferred = registerEvent(registry.StableTokenContractID.String(), "Transfer", []topicParser{addressTopicParser, addressTopicParser}) )
View Source
var ( // Accounts CreateAccount = registerMethod(registry.AccountsContractID.String(), "createAccount", nil) AuthorizeVoteSigner = registerMethod(registry.AccountsContractID.String(), "authorizeVoteSigner", []argParser{addressParser, bytesParser}) AuthorizeAttestationSigner = registerMethod(registry.AccountsContractID.String(), "authorizeAttestationSigner", []argParser{addressParser, bytesParser}) AuthorizeValidatorSigner = registerMethod(registry.AccountsContractID.String(), "authorizeValidatorSigner", []argParser{addressParser, bytesParser}) IsAccount = registerMethod(registry.AccountsContractID.String(), "isAccount", []argParser{addressParser}) GetVoteSigner = registerMethod(registry.AccountsContractID.String(), "getVoteSigner", []argParser{addressParser}) // Locked Gold LockGold = registerMethod(registry.LockedGoldContractID.String(), "lock", nil) UnlockGold = registerMethod(registry.LockedGoldContractID.String(), "unlock", []argParser{bigIntParser}) RelockGold = registerMethod(registry.LockedGoldContractID.String(), "relock", []argParser{bigIntParser, bigIntParser}) WithdrawGold = registerMethod(registry.LockedGoldContractID.String(), "withdraw", []argParser{bigIntParser}) // Election Vote = registerMethod(registry.ElectionContractID.String(), "vote", []argParser{addressParser, bigIntParser}) ActivateVotes = registerMethod(registry.ElectionContractID.String(), "activate", []argParser{addressParser}) RevokePendingVotes = registerMethod(registry.ElectionContractID.String(), "revokePending", []argParser{addressParser, addressParser, bigIntParser}) RevokeActiveVotes = registerMethod(registry.ElectionContractID.String(), "revokeActive", []argParser{addressParser, addressParser, bigIntParser}) CanReceiveVotes = registerMethod(registry.ElectionContractID.String(), "canReceiveVotes", []argParser{addressParser, bigIntParser}) GetEpochNumber = registerMethod(registry.ElectionContractID.String(), "getEpochNumber", []argParser{}) GetEpochSize = registerMethod(registry.ElectionContractID.String(), "getEpochSize", []argParser{}) GetEpochNumberOfBlock = registerMethod(registry.ElectionContractID.String(), "getEpochNumberOfBlock", []argParser{bigIntParser}) GetGroupsVotedForByAccount = registerMethod(registry.ElectionContractID.String(), "getGroupsVotedForByAccount", []argParser{addressParser}) GetActiveVotesForGroup = registerMethod(registry.ElectionContractID.String(), "getActiveVotesForGroup", []argParser{addressParser}) GetActiveVotesForGroupByAccount = registerMethod(registry.ElectionContractID.String(), "getActiveVotesForGroupByAccount", []argParser{addressParser, addressParser}) // ReleaseGold ReleaseGoldWithdraw = registerMethod(ReleaseGold, "withdraw", []argParser{bigIntParser}) // Proxy ReleaseGoldCreateAccount = registerMethod(ReleaseGold, "createAccount", nil) ReleaseGoldLockGold = registerMethod(ReleaseGold, "lockGold", []argParser{bigIntParser}) ReleaseGoldUnlockGold = registerMethod(ReleaseGold, "unlockGold", []argParser{bigIntParser}) ReleaseGoldRelockGold = registerMethod(ReleaseGold, "relockGold", []argParser{bigIntParser, bigIntParser}) ReleaseGoldWithdrawGold = registerMethod(ReleaseGold, "withdrawLockedGold", []argParser{bigIntParser}) ReleaseGoldAuthorizeVoteSigner = registerMethod(ReleaseGold, "authorizeVoteSigner", []argParser{addressParser, bytesParser}) ReleaseGoldAuthorizeAttestationSigner = registerMethod(ReleaseGold, "authorizeAttestationSigner", []argParser{addressParser, bytesParser}) ReleaseGoldAuthorizeValidatorSigner = registerMethod(ReleaseGold, "authorizeValidatorSigner", []argParser{addressParser, bytesParser}) ReleaseGoldRevokePendingVotes = registerMethod(ReleaseGold, "revokePending", []argParser{addressParser, addressParser, bigIntParser}) ReleaseGoldRevokeActiveVotes = registerMethod(ReleaseGold, "revokeActive", []argParser{addressParser, addressParser, bigIntParser}) ReleaseGoldMaxDistribution = registerMethod(ReleaseGold, "maxDistribution", nil) ReleaseGoldTotalWithdrawn = registerMethod(ReleaseGold, "totalWithdrawn", nil) ReleaseGoldBeneficiary = registerMethod(ReleaseGold, "beneficiary", nil) ReleaseGoldReleaseOwner = registerMethod(ReleaseGold, "releaseOwner", nil) ReleaseGoldRefundAddress = registerMethod(ReleaseGold, "refundAddress", nil) ReleaseGoldRevocationInfo = registerMethod(ReleaseGold, "revocationInfo", nil) // StableToken StableTokenBalanceOf = registerMethod(registry.StableTokenContractID.String(), "balanceOf", []argParser{addressParser}) StableTokenTransfer = registerMethod(registry.StableTokenContractID.String(), "transfer", []argParser{addressParser, bigIntParser}) )
values taken from contract method names for ABI usage
View Source
var ReleaseGold = "ReleaseGold"
Functions ¶
func MarshallToMap ¶
func UnmarshallFromMap ¶
Types ¶
type ArgBuilder ¶
type ArgBuilder interface { TransferGold(from common.Address, to common.Address, value *big.Int) (*TxArgs, error) CreateAccount(signer common.Address) (*TxArgs, error) AuthorizeVoteSigner(account common.Address, signer common.Address, popSignature []byte) (*TxArgs, error) LockGold(signer common.Address, value *big.Int) (*TxArgs, error) UnlockGold(signer common.Address, value *big.Int) (*TxArgs, error) RelockGold(signer common.Address, index *big.Int, value *big.Int) (*TxArgs, error) WithdrawGold(signer common.Address, index *big.Int) (*TxArgs, error) Vote(signer common.Address, group common.Address, value *big.Int) (*TxArgs, error) ActivateVotes(signer common.Address, group common.Address) (*TxArgs, error) RevokePendingVotes(signer common.Address, group common.Address, value *big.Int) (*TxArgs, error) RevokeActiveVotes(signer common.Address, group common.Address, value *big.Int) (*TxArgs, error) ReleaseGoldCreateAccount(releaseGold common.Address, signer common.Address) (*TxArgs, error) ReleaseGoldWithdraw(releaseGold common.Address, signer common.Address, value *big.Int) (*TxArgs, error) ReleaseGoldAuthorizeVoteSigner(releaseGold common.Address, account common.Address, voteSigner common.Address, popSignature []byte) (*TxArgs, error) ReleaseGoldAuthorizeAttestationSigner(releaseGold common.Address, account common.Address, attestationSigner common.Address, popSignature []byte) (*TxArgs, error) ReleaseGoldAuthorizeValidatorSigner(releaseGold common.Address, account common.Address, validatorSigner common.Address, popSignature []byte) (*TxArgs, error) ReleaseGoldLockGold(releaseGold common.Address, signer common.Address, value *big.Int) (*TxArgs, error) ReleaseGoldUnlockGold(releaseGold common.Address, signer common.Address, value *big.Int) (*TxArgs, error) ReleaseGoldRelockGold(releaseGold common.Address, signer common.Address, index *big.Int, value *big.Int) (*TxArgs, error) ReleaseGoldWithdrawGold(releaseGold common.Address, signer common.Address, index *big.Int) (*TxArgs, error) ReleaseGoldRevokePendingVotes(releaseGold common.Address, signer common.Address, group common.Address, value *big.Int) (*TxArgs, error) ReleaseGoldRevokeActiveVotes(releaseGold common.Address, signer common.Address, group common.Address, value *big.Int) (*TxArgs, error) StableTokenTransfer(to common.Address, value *big.Int) (*TxArgs, error) }
func NewArgBuilder ¶
func NewArgBuilder() ArgBuilder
type CallParams ¶ added in v0.7.5
func (CallParams) MarshalJSON ¶ added in v0.7.5
func (params CallParams) MarshalJSON() ([]byte, error)
func (*CallParams) UnmarshalJSON ¶ added in v0.7.5
func (params *CallParams) UnmarshalJSON(b []byte) error
type CeloEvent ¶ added in v0.7.5
type CeloEvent struct { // Name of the abi method Name string // Registry id of contract where the method is defined Contract string // contains filtered or unexported fields }
func EventFromString ¶ added in v0.7.5
FromString returns the CeloEvent that matches the given string Events are represented as "Contract.EventName"
func (*CeloEvent) DeserializeTopics ¶ added in v0.7.5
type CeloMethod ¶
type CeloMethod struct { // Name of the abi method Name string // Registry id of contract where the method is defined Contract string // contains filtered or unexported fields }
Represents a CeloMethod that can be called with the AirgapClient DO NOT CREATE them, instead use `MethodFromString()`
func MethodFromString ¶
func MethodFromString(celoMethodStr string) (*CeloMethod, error)
FromString returns the CeloMethod that matches the given string Methods are represented as "Contract.Name"
func (*CeloMethod) DeserializeArguments ¶
func (cm *CeloMethod) DeserializeArguments(values ...interface{}) ([]interface{}, error)
func (*CeloMethod) SerializeArguments ¶
func (cm *CeloMethod) SerializeArguments(args ...interface{}) ([]interface{}, error)
func (*CeloMethod) String ¶
func (cm *CeloMethod) String() string
type Client ¶
type Client interface { // Keygen generates a private key Keygen() (*ecdsa.PrivateKey, error) // Derive the cryptographic public key and on-chain address from the private key Derive(privateKey *ecdsa.PrivateKey) (*ecdsa.PublicKey, *common.Address, error) // Sign an arbitrary message with the private key Sign(message []byte, privateKey *ecdsa.PrivateKey) ([]byte, error) // Verify the signature of an arbitrary message Verify(message []byte, publicKey *ecdsa.PublicKey, signature []byte) bool // ConstructTxFromMetadata creates a new transaction using given Metadata ConstructTxFromMetadata(txMetadata *TxMetadata) (*Transaction, error) // SignTx signs an unsignedTx using the private seed and return a signedTx that can be submitted to the node SignTx(transaction *Transaction, privateKey *ecdsa.PrivateKey) (*Transaction, error) // Parse transaction arguments from transaction metadata ParseTxArgs(txMetadata *TxMetadata) (*TxArgs, error) // Parse transaction data to celo method and args ParseMethodAndArgs(data []byte) (*CeloMethod, []interface{}, error) // GenerateProofOfPossessionSignature generates a PoP needed for Authorize calls GenerateProofOfPossessionSignature(privateKey *ecdsa.PrivateKey, address *common.Address) ([]byte, error) }
type FilterQueryParams ¶ added in v0.7.5
type FilterQueryParams struct { Event *CeloEvent Topics [][]interface{} FromBlock *big.Int ToBlock *big.Int }
func (FilterQueryParams) MarshalJSON ¶ added in v0.7.5
func (args FilterQueryParams) MarshalJSON() ([]byte, error)
func (*FilterQueryParams) UnmarshalJSON ¶ added in v0.7.5
func (args *FilterQueryParams) UnmarshalJSON(b []byte) error
type Server ¶
type Server interface { ObtainMetadata(ctx context.Context, txOpts *TxArgs) (*TxMetadata, error) SubmitTx(ctx context.Context, rawTx []byte) (*common.Hash, error) CallData(ctx context.Context, callOpts *CallParams) ([]byte, error) FilterQuery(ctx context.Context, filterQueryOps *FilterQueryParams) ([]types.Log, error) }
type SignatureValues ¶ added in v0.5.4
type Transaction ¶
type Transaction struct { *TxMetadata `json:"metadata"` Signature []byte `json:"signature"` }
func (*Transaction) AsGethTransaction ¶
func (tx *Transaction) AsGethTransaction() (*types.Transaction, error)
func (*Transaction) Deserialize ¶ added in v0.5.4
func (tx *Transaction) Deserialize(data []byte, chainId *big.Int) error
func (*Transaction) GetSignatureValues ¶ added in v0.5.4
func (tx *Transaction) GetSignatureValues() (*SignatureValues, error)
func (Transaction) MarshalJSON ¶
func (tx Transaction) MarshalJSON() ([]byte, error)
func (*Transaction) Serialize ¶
func (tx *Transaction) Serialize() ([]byte, error)
func (*Transaction) Signed ¶
func (tx *Transaction) Signed() bool
func (*Transaction) UnmarshalJSON ¶
func (tx *Transaction) UnmarshalJSON(b []byte) error
type TxArgs ¶
type TxArgs struct { From common.Address Value *big.Int // non-nil means exclusively cGLD transfer To *common.Address // non-nil means celo registry contract invokation Method *CeloMethod Args []interface{} }
func (TxArgs) MarshalJSON ¶
func (*TxArgs) UnmarshalJSON ¶
type TxMetadata ¶
type TxMetadata struct { From common.Address Nonce uint64 GasPrice *big.Int GatewayFeeRecipient *common.Address GatewayFee *big.Int FeeCurrency *common.Address To common.Address Data []byte Value *big.Int Gas uint64 ChainId *big.Int }
func (*TxMetadata) AsCallMessage ¶
func (tm *TxMetadata) AsCallMessage() ethereum.CallMsg
func (TxMetadata) MarshalJSON ¶
func (tm TxMetadata) MarshalJSON() ([]byte, error)
func (*TxMetadata) UnmarshalJSON ¶
func (tm *TxMetadata) UnmarshalJSON(b []byte) error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.