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(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 Transaction
- type TxArgs
- type TxMetadata
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Accounts CreateAccount = registerMethod(wrapper.AccountsRegistryId, "createAccount", nil) AuthorizeVoteSigner = registerMethod(wrapper.AccountsRegistryId, "authorizeVoteSigner", []argParser{addressParser, bytesParser}) AuthorizeAttestationSigner = registerMethod(wrapper.AccountsRegistryId, "authorizeAttestationSigner", []argParser{addressParser, bytesParser}) AuthorizeValidatorSigner = registerMethod(wrapper.AccountsRegistryId, "authorizeValidatorSigner", []argParser{addressParser, bytesParser}) // Locked Gold LockGold = registerMethod(wrapper.LockedGoldRegistryId, "lock", nil) UnlockGold = registerMethod(wrapper.LockedGoldRegistryId, "unlock", []argParser{bigIntParser}) RelockGold = registerMethod(wrapper.LockedGoldRegistryId, "relock", []argParser{bigIntParser, bigIntParser}) WithdrawGold = registerMethod(wrapper.LockedGoldRegistryId, "withdraw", []argParser{bigIntParser}) // Election Vote = registerMethod(wrapper.ElectionRegistryId, "vote", []argParser{addressParser, bigIntParser}) ActivateVotes = registerMethod(wrapper.ElectionRegistryId, "activate", []argParser{addressParser, addressParser}) RevokePendingVotes = registerMethod(wrapper.ElectionRegistryId, "revokePending", []argParser{addressParser, addressParser, bigIntParser}) RevokeActiveVotes = registerMethod(wrapper.ElectionRegistryId, "revokeActive", []argParser{addressParser, addressParser, bigIntParser}) )
values taken from contract method names for ABI usage
Functions ¶
func MarshallToMap ¶
func UnmarshallFromMap ¶
Types ¶
type ArgBuilder ¶
type ArgBuilder interface {
CreateAccount(signer common.Address) (*TxArgs, error)
AuthorizeVoteSigner(account 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, account common.Address, group common.Address) (*TxArgs, error)
RevokePendingVotes(signer common.Address, account common.Address, group common.Address, value *big.Int) (*TxArgs, error)
RevokeActiveVotes(signer common.Address, account common.Address, group common.Address, value *big.Int) (*TxArgs, error)
TransferGold(from common.Address, to 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 wrapper.RegistryKey
// 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 Transaction ¶
type Transaction struct {
*TxMetadata `json:"metadata"`
// Signature values
V *big.Int `json:"v"`
R *big.Int `json:"r"`
S *big.Int `json:"s"`
}
func (*Transaction) AsGethTransaction ¶
func (tx *Transaction) AsGethTransaction() *types.Transaction
func (*Transaction) Hash ¶
func (tx *Transaction) Hash() common.Hash
func (Transaction) MarshalJSON ¶
func (tx Transaction) MarshalJSON() ([]byte, error)
func (*Transaction) Serialize ¶
func (tx *Transaction) Serialize() ([]byte, error)
func (*Transaction) Signed ¶
func (t *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.