Documentation
¶
Index ¶
- Variables
- func MarshallToMap(input interface{}) (map[string]interface{}, error)
- func UnmarshallFromMap(input map[string]interface{}, output interface{}) error
- type ArgBuilder
- type CeloMethod
- func (cm *CeloMethod) CreateTxArgs(to *common.Address, from common.Address, value *big.Int, args ...interface{}) (*TxArgs, error)
- func (cm *CeloMethod) DeserializeArguments(values ...interface{}) ([]interface{}, error)
- func (cm *CeloMethod) SerializeArguments(args ...interface{}) ([]interface{}, error)
- func (cm *CeloMethod) String() string
- type Client
- 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 ( // 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}) // 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}) // 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}) )
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, amount *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)
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, amount *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)
}
func NewArgBuilder ¶
func NewArgBuilder() ArgBuilder
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) CreateTxArgs ¶
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)
// GenerateProofOfPossessionSignature generates a PoP needed for Authorize calls
GenerateProofOfPossessionSignature(privateKey *ecdsa.PrivateKey, address *common.Address) ([]byte, 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.