Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update docs with vocdoni-sdk repo changes #116

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
441 changes: 434 additions & 7 deletions docs/get-started/01-intro.md

Large diffs are not rendered by default.

63 changes: 61 additions & 2 deletions docs/sdk/AccountAPI.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AccountAPI

<div className="container">
<div className="row mb-2"><div className="col col--12"><strong>Methods</strong></div></div>
<div className="row"><div className="col col--12"><a href="#info">info</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#setInfo">setInfo</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#transfersList">transfersList</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#electionsList">electionsList</a><span className="badge badge--info margin-left--sm">static</span></div></div>
<div className="row"><div className="col col--12"><a href="#list">list</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#count">count</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#info">info</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#metadata">metadata</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#setInfo">setInfo</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#transfersList">transfersList</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#transfersCount">transfersCount</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#electionsList">electionsList</a><span className="badge badge--info margin-left--sm">static</span></div></div>
</div>

## constructor
Expand All @@ -27,6 +27,35 @@ new AccountAPI()
Cannot be constructed.

## Methods
### list {#list}

<div>
<span className="badge badge--info">static</span>
</div>

Returns paginated list of accounts

**Returns**: Promise&lt;IAccountsListResponse&gt;

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|url|string|||API endpoint URL|
|page|number|✔️|0|The page number|

### count {#count}

<div>
<span className="badge badge--info">static</span>
</div>

Returns the number of accounts

**Returns**: Promise&lt;IAccountsCountResponse&gt;

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|url|string|||API endpoint URL|

### info {#info}

<div>
Expand All @@ -40,7 +69,22 @@ Fetches an Account information
|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|url|string|||API endpoint URL|
|address|string|||The one we want the info from|
|accountId|string|||The account we want the info from|

### metadata {#metadata}

<div>
<span className="badge badge--info">static</span>
</div>

Fetches the account metadata

**Returns**: Promise&lt;[AccountMetadata](AccountMetadata)&gt;

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|url|string|||API endpoint URL|
|accountId|string|||The account we want the info from|

### setInfo {#setInfo}

Expand Down Expand Up @@ -74,6 +118,21 @@ Returns paginated list of transfers for a specific account
|accountId|string|||accountId to get transfers|
|page|number|✔️|0|The page number|

### transfersCount {#transfersCount}

<div>
<span className="badge badge--info">static</span>
</div>

Returns the account's transfers count

**Returns**: Promise&lt;IAccountTransfersCountResponse&gt;

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|url|string|||API endpoint URL|
|accountId|string|||accountId to get the transfers count|

### electionsList {#electionsList}

<div>
Expand Down
64 changes: 64 additions & 0 deletions docs/sdk/AccountService.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
custom_edit_url: null
---

```ts
class AccountService
```

<div>

</div>

<div className="container">
<div className="row mb-2"><div className="col col--12"><strong>Methods</strong></div></div>
<div className="row"><div className="col col--12"><a href="#fetchAccountInfo">fetchAccountInfo</a><br/><a href="#setInfo">setInfo</a></div></div>
</div>

## constructor
```ts
new AccountService(params)
```

<div>

</div>

Instantiate the election service.

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|params|Partial&lt;AccountServiceParameters&gt;|||The service parameters|

## Methods

### fetchAccountInfo {#fetchAccountInfo}

<div>
<span className="badge badge--success">async</span>
</div>

Fetches account information.

**Returns**: Promise&lt;[AccountData](AccountData)&gt;

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|address|string|||The account address to fetch the information|

### setInfo {#setInfo}

<div>

</div>

Updates an account with information

**Returns**: Promise&lt;string&gt;
- The transaction hash

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|tx|string|||The transaction for setting the account|
|metadata|string|||The account metadata|

73 changes: 73 additions & 0 deletions docs/sdk/AnonymousService.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
custom_edit_url: null
---

```ts
class AnonymousService
```

<div>

</div>

<div className="container">
<div className="row mb-2"><div className="col col--12"><strong>Methods</strong></div></div>
<div className="row"><div className="col col--12"><a href="#checkCircuitsHashes">checkCircuitsHashes</a><br/><a href="#fetchCircuits">fetchCircuits</a><br/><a href="#setCircuits">setCircuits</a></div></div>
</div>

## constructor
```ts
new AnonymousService(params)
```

<div>

</div>

Instantiate the anonymous service.

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|params|Partial&lt;AnonymousServiceParameters&gt;|||The service parameters|

## Methods

### checkCircuitsHashes {#checkCircuitsHashes}

<div>

</div>

Checks circuit hashes

**Returns**: ChainCircuits
- The checked circuit parameters

### fetchCircuits {#fetchCircuits}

<div>

</div>

Fetches circuits for anonymous voting

**Returns**: Promise&lt;ChainCircuits&gt;

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|circuits|Omit&lt;ChainCircuits, ('zKeyData'\|'vKeyData'\|'wasmData')&gt;|✔️||Additional options for custom circuits|

### setCircuits {#setCircuits}

<div>

</div>

Sets circuits for anonymous voting

**Returns**: Promise&lt;ChainCircuits&gt;

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|circuits|ChainCircuits|||Custom circuits|

29 changes: 29 additions & 0 deletions docs/sdk/AnonymousVote.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
custom_edit_url: null
---

```ts
class AnonymousVote
```

<div>

</div>

## constructor
```ts
new AnonymousVote(votes, signature, password)
```

<div>

</div>

Constructs a csp vote

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|votes|Array&lt;number \| TSBigIntKeyword&gt;|||The list of votes values|
|signature|string|✔️||The signature of the payload|
|password|string|✔️|"0"|The password of the anonymous vote|

29 changes: 29 additions & 0 deletions docs/sdk/ApprovalElection.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
custom_edit_url: null
---

```ts
class ApprovalElection
```

<div>

</div>

Represents an approval election

## constructor
```ts
new ApprovalElection(params)
```

<div>

</div>

Constructs an approval election

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|params|IApprovalElectionParameters|||Approval election parameters|

33 changes: 33 additions & 0 deletions docs/sdk/ArchivedCensus.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
custom_edit_url: null
---

```ts
class ArchivedCensus
```

<div>

</div>

Represents an archived census

## constructor
```ts
new ArchivedCensus(censusId, censusURI, type, size, weight)
```

<div>

</div>

Constructs an archived census

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|censusId|string|||The id of the census|
|censusURI|string|✔️||The URI of the census|
|type|CensusType|✔️||The type of the census|
|size|number|✔️||The size of the census|
|weight|TSBigIntKeyword|✔️||The weight of the census|

29 changes: 29 additions & 0 deletions docs/sdk/ArchivedElection.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
custom_edit_url: null
---

```ts
class ArchivedElection
```

<div>

</div>

Represents a published election

## constructor
```ts
new ArchivedElection(params)
```

<div>

</div>

Constructs an archived election

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|params|IPublishedElectionParameters|||Election parameters|

29 changes: 29 additions & 0 deletions docs/sdk/BudgetElection.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
custom_edit_url: null
---

```ts
class BudgetElection
```

<div>

</div>

Represents a budget election

## constructor
```ts
new BudgetElection(params)
```

<div>

</div>

Constructs a budget election

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|params|IBudgetElectionParameters|||Budget election parameters|

Loading
Loading