@celo/contractkit › "wrappers/Accounts" › AccountsWrapper
Class: AccountsWrapper
Contract for handling deposits needed for voting.
Hierarchy
- BaseWrapper‹Accounts›
↳ AccountsWrapper
Index
Constructors
Properties
- createAccount
- eventTypes
- events
- getAttestationSigner
- getDataEncryptionKey
- getMetadataURL
- getValidatorSigner
- getVoteSigner
- getWalletAddress
- hasAuthorizedAttestationSigner
- isAccount
- isSigner
- methodIds
- setAccountDataEncryptionKey
- setMetadataURL
- setName
- signerToAccount
- validatorSignerToAccount
- voteSignerToAccount
Accessors
Methods
- authorizeAttestationSigner
- authorizeSigner
- authorizeValidatorSigner
- authorizeValidatorSignerAndBls
- authorizeVoteSigner
- completeSignerAuthorization
- generateProofOfKeyPossession
- generateProofOfKeyPossessionLocally
- getAccountSummary
- getCurrentSigners
- getName
- getPastEvents
- parseSignatureOfAddress
- setAccount
- setWalletAddress
- startSignerAuthorization
- version
Constructors
constructor
+ new AccountsWrapper(kit
: ContractKit, contract
: Accounts): AccountsWrapper
Inherited from BaseWrapper.constructor
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:30
Parameters:
Name | Type |
---|---|
kit |
ContractKit |
contract |
Accounts |
Returns: AccountsWrapper
Properties
createAccount
• createAccount: function = proxySend(this.kit, this.contract.methods.createAccount)
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:44
Creates an account.
Type declaration:
▸ (...args
: InputArgs): CeloTransactionObject‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
eventTypes
• eventTypes: EventsEnum‹T› = Object.keys(this.events).reduce
Inherited from BaseWrapper.eventTypes
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:61
events
• events: Accounts["events"] = this.contract.events
Inherited from BaseWrapper.events
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:59
getAttestationSigner
• getAttestationSigner: function = proxyCall( this.contract.methods.getAttestationSigner )
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:51
Returns the attestation signer for the specified account.
param
The address of the account.
returns
The address with which the account can vote.
Type declaration:
▸ (account
: string): Promise‹Address›
Parameters:
Name | Type |
---|---|
account |
string |
getDataEncryptionKey
• getDataEncryptionKey: function = proxyCall(this.contract.methods.getDataEncryptionKey, undefined, (res) => solidityBytesToString(res) )
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:356
Returns the set data encryption key for the account
param
Account
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
getMetadataURL
• getMetadataURL: function = proxyCall(this.contract.methods.getMetadataURL)
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:370
Returns the metadataURL for the account
param
Account
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
getValidatorSigner
• getValidatorSigner: function = proxyCall( this.contract.methods.getValidatorSigner )
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:77
Returns the validator signer for the specified account.
param
The address of the account.
returns
The address with which the account can register a validator or group.
Type declaration:
▸ (account
: string): Promise‹Address›
Parameters:
Name | Type |
---|---|
account |
string |
getVoteSigner
• getVoteSigner: function = proxyCall( this.contract.methods.getVoteSigner )
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:69
Returns the vote signer for the specified account.
param
The address of the account.
returns
The address with which the account can vote.
Type declaration:
▸ (account
: string): Promise‹Address›
Parameters:
Name | Type |
---|---|
account |
string |
getWalletAddress
• getWalletAddress: function = proxyCall(this.contract.methods.getWalletAddress)
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:364
Returns the set wallet address for the account
param
Account
Type declaration:
▸ (...args
: InputArgs): Promise‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
hasAuthorizedAttestationSigner
• hasAuthorizedAttestationSigner: function = proxyCall( this.contract.methods.hasAuthorizedAttestationSigner )
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:60
Returns if the account has authorized an attestation signer
param
The address of the account.
returns
If the account has authorized an attestation signer
Type declaration:
▸ (account
: string): Promise‹boolean›
Parameters:
Name | Type |
---|---|
account |
string |
isAccount
• isAccount: function = proxyCall(this.contract.methods.isAccount)
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:114
Check if an account already exists.
param
The address of the account
returns
Returns true
if account exists. Returns false
otherwise.
Type declaration:
▸ (account
: string): Promise‹boolean›
Parameters:
Name | Type |
---|---|
account |
string |
isSigner
• isSigner: function = proxyCall( this.contract.methods.isAuthorizedSigner )
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:121
Check if an address is a signer address
param
The address of the account
returns
Returns true
if account exists. Returns false
otherwise.
Type declaration:
▸ (address
: string): Promise‹boolean›
Parameters:
Name | Type |
---|---|
address |
string |
methodIds
• methodIds: Record‹keyof T["methods"], string› = Object.keys(this.contract.methods).reduce
acc[method] =
methodABI === undefined
? '0x'
: this.kit.connection.getAbiCoder().encodeFunctionSignature(methodABI)
return acc
},
{} as any
)
Inherited from BaseWrapper.methodIds
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:66
setAccountDataEncryptionKey
• setAccountDataEncryptionKey: function = proxySend( this.kit, this.contract.methods.setAccountDataEncryptionKey )
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:376
Sets the data encryption of the account
param
The key to set
Type declaration:
▸ (...args
: InputArgs): CeloTransactionObject‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
setMetadataURL
• setMetadataURL: function = proxySend(this.kit, this.contract.methods.setMetadataURL)
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:433
Sets the metadataURL for the account
param
The url to set
Type declaration:
▸ (...args
: InputArgs): CeloTransactionObject‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
setName
• setName: function = proxySend(this.kit, this.contract.methods.setName)
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:427
Sets the name for the account
param
The name to set
Type declaration:
▸ (...args
: InputArgs): CeloTransactionObject‹Output›
Parameters:
Name | Type |
---|---|
...args |
InputArgs |
signerToAccount
• signerToAccount: function = proxyCall( this.contract.methods.signerToAccount )
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:105
Returns the account associated with signer
.
param
The address of the account or previously authorized signer.
dev
Fails if the signer
is not an account or previously authorized signer.
returns
The associated account.
Type declaration:
▸ (signer
: Address): Promise‹Address›
Parameters:
Name | Type |
---|---|
signer |
Address |
validatorSignerToAccount
• validatorSignerToAccount: function = proxyCall( this.contract.methods.validatorSignerToAccount )
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:95
Returns the account address given the signer for validating
param
Address that is authorized to sign the tx as validator
returns
The Account address
Type declaration:
▸ (signer
: Address): Promise‹Address›
Parameters:
Name | Type |
---|---|
signer |
Address |
voteSignerToAccount
• voteSignerToAccount: function = proxyCall( this.contract.methods.voteSignerToAccount )
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:86
Returns the account address given the signer for voting
param
Address that is authorized to sign the tx as voter
returns
The Account address
Type declaration:
▸ (signer
: Address): Promise‹Address›
Parameters:
Name | Type |
---|---|
signer |
Address |
Accessors
address
• get address(): string
Inherited from BaseWrapper.address
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:35
Contract address
Returns: string
Methods
authorizeAttestationSigner
▸ authorizeAttestationSigner(signer
: Address, proofOfSigningKeyPossession
: Signature): Promise‹CeloTransactionObject‹void››
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:163
Authorize an attestation signing key on behalf of this account to another address.
Parameters:
Name | Type | Description |
---|---|---|
signer |
Address | The address of the signing key to authorize. |
proofOfSigningKeyPossession |
Signature | The account address signed by the signer address. |
Returns: Promise‹CeloTransactionObject‹void››
A CeloTransactionObject
authorizeSigner
▸ authorizeSigner(signer
: Address, role
: string): Promise‹CeloTransactionObject‹void››
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:289
Parameters:
Name | Type |
---|---|
signer |
Address |
role |
string |
Returns: Promise‹CeloTransactionObject‹void››
authorizeValidatorSigner
▸ authorizeValidatorSigner(signer
: Address, proofOfSigningKeyPossession
: Signature): Promise‹CeloTransactionObject‹void››
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:204
Authorizes an address to sign consensus messages on behalf of the account.
Parameters:
Name | Type | Description |
---|---|---|
signer |
Address | The address of the signing key to authorize. |
proofOfSigningKeyPossession |
Signature | The account address signed by the signer address. |
Returns: Promise‹CeloTransactionObject‹void››
A CeloTransactionObject
authorizeValidatorSignerAndBls
▸ authorizeValidatorSignerAndBls(signer
: Address, proofOfSigningKeyPossession
: Signature, blsPublicKey
: string, blsPop
: string): Promise‹CeloTransactionObject‹void››
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:256
Authorizes an address to sign consensus messages on behalf of the account. Also switch BLS key at the same time.
Parameters:
Name | Type | Description |
---|---|---|
signer |
Address | The address of the signing key to authorize. |
proofOfSigningKeyPossession |
Signature | The account address signed by the signer address. |
blsPublicKey |
string | The BLS public key that the validator is using for consensus, should pass proof of possession. 48 bytes. |
blsPop |
string | The BLS public key proof-of-possession, which consists of a signature on the account address. 96 bytes. |
Returns: Promise‹CeloTransactionObject‹void››
A CeloTransactionObject
authorizeVoteSigner
▸ authorizeVoteSigner(signer
: Address, proofOfSigningKeyPossession
: Signature): Promise‹CeloTransactionObject‹void››
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:183
Authorizes an address to sign votes on behalf of the account.
Parameters:
Name | Type | Description |
---|---|---|
signer |
Address | The address of the vote signing key to authorize. |
proofOfSigningKeyPossession |
Signature | The account address signed by the signer address. |
Returns: Promise‹CeloTransactionObject‹void››
A CeloTransactionObject
completeSignerAuthorization
▸ completeSignerAuthorization(account
: Address, role
: string): Promise‹CeloTransactionObject‹void››
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:322
Parameters:
Name | Type |
---|---|
account |
Address |
role |
string |
Returns: Promise‹CeloTransactionObject‹void››
generateProofOfKeyPossession
▸ generateProofOfKeyPossession(account
: Address, signer
: Address): Promise‹object›
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:330
Parameters:
Name | Type |
---|---|
account |
Address |
signer |
Address |
Returns: Promise‹object›
generateProofOfKeyPossessionLocally
▸ generateProofOfKeyPossessionLocally(account
: Address, signer
: Address, privateKey
: string): Promise‹object›
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:338
Parameters:
Name | Type |
---|---|
account |
Address |
signer |
Address |
privateKey |
string |
Returns: Promise‹object›
getAccountSummary
▸ getAccountSummary(account
: string): Promise‹AccountSummary›
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:133
Parameters:
Name | Type |
---|---|
account |
string |
Returns: Promise‹AccountSummary›
getCurrentSigners
▸ getCurrentSigners(address
: string): Promise‹string[]›
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:125
Parameters:
Name | Type |
---|---|
address |
string |
Returns: Promise‹string[]›
getName
▸ getName(account
: Address, blockNumber?
: undefined | number): Promise‹string›
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:347
Returns the set name for the account
Parameters:
Name | Type | Description |
---|---|---|
account |
Address | Account |
blockNumber? |
undefined | number | Height of result, defaults to tip. |
Returns: Promise‹string›
getPastEvents
▸ getPastEvents(event
: Events‹Accounts›, options
: PastEventOptions): Promise‹EventLog[]›
Inherited from BaseWrapper.getPastEvents
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:55
Contract getPastEvents
Parameters:
Name | Type |
---|---|
event |
Events‹Accounts› |
options |
PastEventOptions |
Returns: Promise‹EventLog[]›
parseSignatureOfAddress
▸ parseSignatureOfAddress(address
: Address, signer
: string, signature
: string): object
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:461
Parameters:
Name | Type |
---|---|
address |
Address |
signer |
string |
signature |
string |
Returns: object
-
r: string
-
s: string
-
v: number
setAccount
▸ setAccount(name
: string, dataEncryptionKey
: string, walletAddress
: Address, proofOfPossession
: Signature | null): CeloTransactionObject‹void›
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:388
Convenience Setter for the dataEncryptionKey and wallet address for an account
Parameters:
Name | Type | Default | Description |
---|---|---|---|
name |
string | - | A string to set as the name of the account |
dataEncryptionKey |
string | - | secp256k1 public key for data encryption. Preferably compressed. |
walletAddress |
Address | - | The wallet address to set for the account |
proofOfPossession |
Signature | null | null | Signature from the wallet address key over the sender's address |
Returns: CeloTransactionObject‹void›
setWalletAddress
▸ setWalletAddress(walletAddress
: Address, proofOfPossession
: Signature | null): CeloTransactionObject‹void›
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:439
Sets the wallet address for the account
Parameters:
Name | Type | Default |
---|---|---|
walletAddress |
Address | - |
proofOfPossession |
Signature | null | null |
Returns: CeloTransactionObject‹void›
startSignerAuthorization
▸ startSignerAuthorization(signer
: Address, role
: string): Promise‹CeloTransactionObject‹void››
Defined in packages/sdk/contractkit/src/wrappers/Accounts.ts:314
Parameters:
Name | Type |
---|---|
signer |
Address |
role |
string |
Returns: Promise‹CeloTransactionObject‹void››
version
▸ version(): Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››
Inherited from BaseWrapper.version
Defined in packages/sdk/contractkit/src/wrappers/BaseWrapper.ts:39
Returns: Promise‹NonNullable‹T["methods"] extends object ? ContractVersion<> : never››