@vocdoni/sdk
Table of contents
Classes
- Account
- AccountAPI
- AccountService
- AnonymousService
- AnonymousVote
- ApprovalElection
- ArchivedElection
- BudgetElection
- Census
- Census3CensusAPI
- Census3ServiceAPI
- Census3StrategyAPI
- Census3TokenAPI
- CensusAPI
- CensusService
- ChainAPI
- ChainService
- CspAPI
- CspCensus
- CspService
- CspVote
- Election
- ElectionAPI
- ElectionService
- FaucetAPI
- FaucetService
- FileAPI
- FileService
- InvalidElection
- MultiChoiceElection
- OffchainCensus
- PlainCensus
- PublishedCensus
- PublishedElection
- Service
- StrategyCensus
- TokenCensus
- UnpublishedElection
- VocdoniCensus3Client
- VocdoniSDKClient
- Vote
- VoteAPI
- VoteService
- WalletAPI
- WeightedCensus
- ZkAPI
Interfaces
- AccountMetadata
- AdminTx
- CircuitInputs
- CollectFaucetTx
- ElectionMetadata
- FetchElectionsParameters
- IAccount
- IAccountTransfersCountResponse
- IAccountsCountResponse
- IAccountsListResponse
- IApprovalElectionParameters
- IBlockTransactionsResponse
- IBudgetElectionParametersInfo
- IBudgetElectionParametersWithBudget
- IBudgetElectionParametersWithCensusWeight
- ICensus
- ICensus3CensusListResponse
- ICensus3CensusQueueResponse
- ICensus3CensusResponse
- ICensus3ServiceInfoResponse
- ICensus3StrategiesListResponse
- ICensus3StrategiesListResponsePaginated
- ICensus3StrategiesOperator
- ICensus3StrategiesOperatorsResponse
- ICensus3StrategyCreateResponse
- ICensus3StrategyEstimationQueueResponse
- ICensus3StrategyHoldersResponse
- ICensus3StrategyHoldersResponsePaginated
- ICensus3StrategyImportQueueResponse
- ICensus3StrategyToken
- ICensus3SupportedChain
- ICensus3TokenHolderResponse
- ICensus3TokenListResponse
- ICensus3TokenListResponsePaginated
- ICensus3TokenTypesResponse
- ICensus3ValidatePredicateChild
- ICensus3ValidatePredicateResponse
- ICensus3ValidatePredicateToken
- ICensusExportResponse
- ICensusImportResponse
- ICensusParticipant
- ICensusProofResponse
- ICensusPublishResponse
- IChainBlockInfoResponse
- IChainGetCircuitResponse
- IChainGetCostsResponse
- IChainGetInfoResponse
- IChainOrganizationCountResponse
- IChainOrganizationListResponse
- IChainOrganizationResponse
- IChainSubmitTxResponse
- IChainTxCountResponse
- IChainTxListResponse
- IChainTxReference
- IChainValidator
- IChainValidatorsListResponse
- IChoice
- ICspAuthStep
- ICspFinalStepResponse
- ICspInfoResponse
- ICspIntermediateStepResponse
- ICspSignResponse
- IElectionCreateResponse
- IElectionInfoResponse
- IElectionKeysResponse
- IElectionListFilter
- IElectionListResponse
- IElectionMode
- IElectionNextIdResponse
- IElectionParameters
- IElectionSummary
- IElectionType
- IElectionVote
- IElectionVoteListResponse
- IEncryptionKey
- IInvalidElectionParameters
- IMultiChoiceElectionParameters
- IPublishedElectionParameters
- IQuestion
- ITallyMode
- IVoteInfoResponse
- IVoteMode
- IVoteSubmitResponse
- IVoteType
- IZkProofResponse
- IZkSIKResponse
- MintTokensTx
- NewProcessTx
- Process
- Proof
- RegisterKeyTx
- SendTokensTx
- ServiceProperties
- SetAccountTx
- SetProcessTx
- SetTransactionCostsTx
- Tx
- VoteEnvelope
Enumerations
- CensusOrigin
- CensusType
- CensusTypeEnum
- CspProofType
- ElectionCreationSteps
- ElectionResultsTypeNames
- ElectionStatus
- ElectionStatusReady
- EnvOptions
- TransactionType
- TxType
- VoteSteps
Functions
- areEqualHexStrings
- checkValidAccountMetadata
- checkValidElectionMetadata
- delay
- dotobject
- ensure0x
- formatUnits
- getBytes
- getHex
- strip0x
Type Aliases
- AccountData
- AllElectionStatus
- ArchivedAccountData
- Census3Census
- Census3CreateStrategyToken
- Census3Strategy
- Census3StrategyToken
- Census3SummaryToken
- Census3Token
- CensusImportExport
- CensusProof
- ChainCircuits
- ChainCosts
- ChainData
- ChainTx
- ClientOptions
- CspCensusProof
- ElectionCreatedInformation
- ElectionCreationStepValue
- ElectionIdOption
- ElectionKeys
- ElectionMeta
- ElectionResultsType
- FaucetOptions
- FaucetPackage
- HasAlreadyVotedOptions
- IAccountSummary
- IBudgetElectionParameters
- IsAbleToVoteOptions
- IsInCensusOptions
- ParsedPredicate
- SendTokensOptions
- Strategy
- StrategyHolder
- StrategyHolders
- StrategyToken
- SupportedChain
- SupportedOperator
- Token
- TokenSummary
- TxWaitOptions
- VoteIdOption
- VoteInfo
- VoteStepValue
- VoteSubmit
- VotesLeftCountOptions
- WalletOption
- ZkProof
Variables
Functions
areEqualHexStrings
▸ areEqualHexStrings(hex1?
, hex2?
): boolean
Compares two hex strings checking if they're the same. It ensures both have hex prefix and are lowercase.
Parameters
Name | Type |
---|---|
hex1? | string |
hex2? | string |
Returns
boolean
Defined in
checkValidAccountMetadata
▸ checkValidAccountMetadata(accountMetadata
): AccountMetadata
Asserts that the given metadata is valid. Throws an exception if it is not.
Parameters
Name | Type |
---|---|
accountMetadata | AccountMetadata |
Returns
Defined in
checkValidElectionMetadata
▸ checkValidElectionMetadata(electionMetadata
): ElectionMetadata
Asserts that the given metadata is valid. Throws an exception if it is not.
Parameters
Name | Type |
---|---|
electionMetadata | ElectionMetadata |
Returns
Defined in
delay
▸ delay(ms
): Promise
\<unknown
>
Parameters
Name | Type |
---|---|
ms | any |
Returns
Promise
\<unknown
>
Defined in
dotobject
▸ dotobject(obj
, dot
): any
Dot notation to object conversion. Takes any object as first argument and uses the string dot notation from the second argument (i.e. 'a.child.node') to access that given object value.
Parameters
Name | Type | Description |
---|---|---|
obj | any | Object to be accessed by dot notation |
dot | string | Dot notation string to extract object data |
Returns
any
Return the object data
Defined in
ensure0x
▸ ensure0x(value
): string
Parameters
Name | Type |
---|---|
value | string |
Returns
string
Defined in
formatUnits
▸ formatUnits(value
, decimals?
): string
Returns a string representation of value formatted with decimals digits
Parameters
Name | Type | Default value | Description |
---|---|---|---|
value | BigNumberish | undefined | The value in native BigInt |
decimals | number | 18 | The number of decimals |
Returns
string
The formatted string
Defined in
getBytes
▸ getBytes(count
): Uint8Array
Parameters
Name | Type |
---|---|
count | number |
Returns
Uint8Array
Defined in
getHex
▸ getHex(): string
Generates a random seed and returns a 32 byte keccak256 hash of it (starting with "0x")
Returns
string
Defined in
strip0x
▸ strip0x(value
): string
Parameters
Name | Type |
---|---|
value | string |
Returns
string
Defined in
Type Aliases
AccountData
Ƭ AccountData: Object
Type declaration
Name | Type |
---|---|
account | Account |
address | string |
balance | number |
electionIndex | number |
infoURL? | string |
nonce | number |
sik? | string |
Defined in
AllElectionStatus
Ƭ AllElectionStatus: ElectionStatus
| ElectionStatusReady
Defined in
types/election/published.ts:24
ArchivedAccountData
Ƭ ArchivedAccountData: Pick
\<AccountData
, "address"
| "account"
>
Defined in
Census3Census
Ƭ Census3Census: ICensus3CensusResponse
Defined in
Census3CreateStrategyToken
Ƭ Census3CreateStrategyToken: Omit
\<Census3StrategyToken
, "chainAddress"
>
Defined in
Census3Strategy
Ƭ Census3Strategy: Object
Type declaration
Name | Type | Description |
---|---|---|
ID | number | The strategy identifier |
alias | string | The strategy alias |
predicate | string | The strategy predicate |
tokens | { [key: string] : Census3StrategyToken ; } | The list of tokens |
uri | string | The URI of the strategy |
Defined in
Census3StrategyToken
Ƭ Census3StrategyToken: Object
Type declaration
Name | Type | Description |
---|---|---|
ID | string | The id (address) of the token. |
chainAddress | string | The chain address of the token. |
chainID | number | The chain id of the token. |
externalID? | string | The external identifier of the token. |
iconURI? | string | The token icon URI. |
minBalance? | string | The minimum balance for the strategy. |
Defined in
Census3SummaryToken
Ƭ Census3SummaryToken: Omit
\<Census3Token
, "status"
| "size"
> & { synced
: boolean
}
Defined in
Census3Token
Ƭ Census3Token: Object
Type declaration
Name | Type | Description |
---|---|---|
ID | string | The id (address) of the token. |
chainAddress | string | The chain address of the token. |
chainID | number | The chain id of the token. |
decimals | number | The decimals of the token |
defaultStrategy | number | The default strategy assigned. |
externalID? | string | The external identifier of the token. |
iconURI? | string | The icon URI of the token. |
name | string | The name of the token. |
size | number | The size (token holders) of the token. |
startBlock | number | The creation block. |
status | { atBlock : number ; progress : number ; synced : boolean } | The census3 status of the token. |
status.atBlock | number | At which number of block the token is synced |
status.progress | number | The progress percentage of the sync |
status.synced | boolean | If the token is already synced or not. |
symbol | string | The symbol of the token. |
tags? | string | The tags of the token. |
totalSupply | string | The total supply of the token. |
type | string | The type of the token. |
Defined in
CensusImportExport
Ƭ CensusImportExport: Object
Type declaration
Name | Type |
---|---|
data | string |
maxLevels | number |
rootHash | string |
type | number |
Defined in
CensusProof
Ƭ CensusProof: Object
Type declaration
Name | Type |
---|---|
proof | string |
root | string |
siblings? | string [] |
type | CensusType |
value | string |
weight | string |
Defined in
ChainCircuits
Ƭ ChainCircuits: Object
Type declaration
Name | Type |
---|---|
vKeyData | Uint8Array |
vKeyHash | string |
vKeyURI | string |
wasmData | Uint8Array |
wasmHash | string |
wasmURI | string |
zKeyData | Uint8Array |
zKeyHash | string |
zKeyURI | string |
Defined in
ChainCosts
Ƭ ChainCosts: IChainGetCostsResponse
Defined in
ChainData
Ƭ ChainData: Object
Type declaration
Name | Type |
---|---|
blockTime | number [] |
blockTimestamp | number |
chainId | string |
height | number |
maxCensusSize | number |
Defined in
ChainTx
Ƭ ChainTx: IChainTxReference
Defined in
ClientOptions
Ƭ ClientOptions: Object
Optional VocdoniSDKClient arguments
Type declaration
Name | Type |
---|---|
api_url? | string |
electionId? | string |
env | EnvOptions |
faucet? | Partial \<FaucetOptions > |
tx_wait? | TxWaitOptions |
wallet? | Wallet | Signer |
Defined in
CspCensusProof
Ƭ CspCensusProof: Object
Type declaration
Name | Type |
---|---|
address | string |
proof_type? | CspProofType |
signature | string |
type? | number |
weight? | bigint |
Defined in
ElectionCreatedInformation
Ƭ ElectionCreatedInformation: IElectionCreateResponse
Defined in
ElectionCreationStepValue
Ƭ ElectionCreationStepValue: { key
: GET_CHAIN_DATA
} | { key
: CENSUS_CREATED
} | { key
: GET_ACCOUNT_DATA
} | { key
: GET_DATA_PIN
} | { key
: GENERATE_TX
} | { key
: SIGN_TX
} | { key
: CREATING
; txHash
: string
} | { electionId
: string
; key
: DONE
}
Defined in
ElectionIdOption
Ƭ ElectionIdOption: Object
Type declaration
Name | Type |
---|---|
electionId | string |
Defined in
ElectionKeys
Ƭ ElectionKeys: IElectionKeysResponse
Defined in
ElectionMeta
Ƭ ElectionMeta: AnyJson
| JsonArray
| JsonMap
Defined in
types/election/election.ts:101
ElectionResultsType
Ƭ ElectionResultsType: { name
: SINGLE_CHOICE_MULTIQUESTION
; properties
: {} } | { name
: MULTIPLE_CHOICE
; properties
: { abstainValues
: string
[] ; canAbstain
: boolean
; repeatChoice
: boolean
} } | { name
: BUDGET
; properties
: { forceFullBudget
: boolean
; maxBudget
: number
; minStep
: number
; useCensusWeightAsBudget
: boolean
} } | { name
: APPROVAL
; properties
: { acceptValue
: number
; rejectValue
: number
} }
Defined in
FaucetOptions
Ƭ FaucetOptions: FaucetServiceParameters
Defined in
FaucetPackage
Ƭ FaucetPackage: Object
Type declaration
Name | Type |
---|---|
payload | string |
signature | string |
Defined in
HasAlreadyVotedOptions
Ƭ HasAlreadyVotedOptions: Partial
\<WalletOption
& ElectionIdOption
& VoteIdOption
>
Defined in
IAccountSummary
Ƭ IAccountSummary: Pick
\<IAccountInfoResponse
, "address"
| "balance"
| "nonce"
>
Defined in
IBudgetElectionParameters
Ƭ IBudgetElectionParameters: IBudgetElectionParametersWithCensusWeight
| IBudgetElectionParametersWithBudget
Defined in
IsAbleToVoteOptions
Ƭ IsAbleToVoteOptions: Partial
\<WalletOption
& ElectionIdOption
& VoteIdOption
>
Defined in
IsInCensusOptions
Ƭ IsInCensusOptions: Partial
\<WalletOption
& ElectionIdOption
>
Defined in
ParsedPredicate
Ƭ ParsedPredicate: ICensus3ValidatePredicateResponse
Defined in
SendTokensOptions
Ƭ SendTokensOptions: Partial
\<WalletOption
> & { amount
: number
; to
: string
}
Defined in
Strategy
Ƭ Strategy: Census3Strategy
Defined in
StrategyHolder
Ƭ StrategyHolder: Object
Type declaration
Name | Type |
---|---|
holder | string |
weight | bigint |
Defined in
StrategyHolders
Ƭ StrategyHolders: Object
Type declaration
Name | Type |
---|---|
holders | StrategyHolder [] |
pagination | Census3Pagination |
Defined in
StrategyToken
Ƭ StrategyToken: Census3CreateStrategyToken
Defined in
SupportedChain
Ƭ SupportedChain: ICensus3SupportedChain
Defined in
SupportedOperator
Ƭ SupportedOperator: ICensus3StrategiesOperator
Defined in
Token
Ƭ Token: Omit
\<Census3Token
, "tags"
> & { tags
: string
[] }
Defined in
TokenSummary
Ƭ TokenSummary: Omit
\<Census3SummaryToken
, "tags"
> & { tags
: string
[] }
Defined in
TxWaitOptions
Ƭ TxWaitOptions: Object
Specify custom retry times and attempts when waiting for a transaction.
Type declaration
Name | Type |
---|---|
attempts | number |
retryTime | number |
Defined in
VoteIdOption
Ƭ VoteIdOption: Object
Type declaration
Name | Type |
---|---|
voteId | string |
Defined in
VoteInfo
Ƭ VoteInfo: IVoteInfoResponse
Defined in
VoteStepValue
Ƭ VoteStepValue: { electionId
: string
; key
: GET_ELECTION
} | { key
: GET_PROOF
} | { key
: GET_SIGNATURE
; signature
: string
} | { key
: CALC_ZK_PROOF
} | { key
: GENERATE_TX
} | { key
: SIGN_TX
} | { key
: DONE
; voteId
: string
}
Defined in
VoteSubmit
Ƭ VoteSubmit: IVoteSubmitResponse
Defined in
VotesLeftCountOptions
Ƭ VotesLeftCountOptions: Partial
\<WalletOption
& ElectionIdOption
& VoteIdOption
>
Defined in
WalletOption
Ƭ WalletOption: Object
Type declaration
Name | Type |
---|---|
wallet | Wallet | Signer |
Defined in
ZkProof
Ƭ ZkProof: Object
Type declaration
Name | Type |
---|---|
proof | { curve : string ; pi_a : string [] ; pi_b : string [][] ; pi_c : string [] ; protocol : string } |
proof.curve | string |
proof.pi_a | string [] |
proof.pi_b | string [][] |
proof.pi_c | string [] |
proof.protocol | string |
publicSignals | string [] |
Defined in
Variables
AccountMetadataTemplate
• Const
AccountMetadataTemplate: AccountMetadata
Defined in
ElectionMetadataTemplate
• Const
ElectionMetadataTemplate: ElectionMetadata