Skip to content

Commit

Permalink
Update vocdoni-sdk docs by commit b6a41f9
Browse files Browse the repository at this point in the history
  • Loading branch information
marcvelmer authored and arabot-1 committed Sep 7, 2023
1 parent 32d96e0 commit 46df743
Show file tree
Hide file tree
Showing 17 changed files with 678 additions and 120 deletions.
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|

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

```ts
class AnonymousVote
```

<div>

</div>

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

<div>

</div>

Constructs a csp vote

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

18 changes: 17 additions & 1 deletion docs/sdk/Census3CensusAPI.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Census3CensusAPI

<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="#list">list</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#census">census</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#create">create</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="#census">census</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#queue">queue</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#create">create</a><span className="badge badge--info margin-left--sm">static</span></div></div>
</div>

## constructor
Expand Down Expand Up @@ -57,6 +57,21 @@ Returns the information of the census
|url|string|||API endpoint URL|
|id|number|||The identifier of the census|

### queue {#queue}

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

Returns the information of the census queue

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

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|url|string|||API endpoint URL|
|id|string|||The identifier of the census queue|

### create {#create}

<div>
Expand All @@ -72,5 +87,6 @@ Requests the creation of a new census with the strategy provided for the blockNu
|:---:|:---:|:---:|:---:|:---:|
|url|string|||API endpoint URL|
|strategyId|number|||The strategy identifier|
|anonymous|boolean|✔️|false|If the census has to be anonymous|
|blockNumber|number|✔️||The number of the block|

21 changes: 18 additions & 3 deletions docs/sdk/CensusAPI.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CensusAPI

<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="#create">create</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#add">add</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#publish">publish</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#proof">proof</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#size">size</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#weight">weight</a><span className="badge badge--info margin-left--sm">static</span></div></div>
<div className="row"><div className="col col--12"><a href="#create">create</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#add">add</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#publish">publish</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#proof">proof</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#size">size</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#weight">weight</a><span className="badge badge--info margin-left--sm">static</span><br/><a href="#type">type</a><span className="badge badge--info margin-left--sm">static</span></div></div>
</div>

## constructor
Expand Down Expand Up @@ -107,7 +107,7 @@ Returns the size of a given census
|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|url|string|||API endpoint URL|
|censusId|string|||The census ID of which we want the proof from|
|censusId|string|||The census ID|

### weight {#weight}

Expand All @@ -122,5 +122,20 @@ Returns the weight of a given census
|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|url|string|||API endpoint URL|
|censusId|string|||The census ID of which we want the proof from|
|censusId|string|||The census ID|

### type {#type}

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

Returns the type of given census

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

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|url|string|||API endpoint URL|
|censusId|string|||The census ID|

Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ custom_edit_url: null
|weight|string||
|proof|string||
|value|string||
|type|CensusProofType||

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

```ts
class CensusService
```

<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="#fetchCensusInfo">fetchCensusInfo</a><br/><a href="#fetchProof">fetchProof</a><br/><a href="#createCensus">createCensus</a><br/><a href="#fetchAccountToken">fetchAccountToken</a></div></div>
</div>

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

<div>

</div>

Instantiate the census service.

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

## Methods

### fetchCensusInfo {#fetchCensusInfo}

<div>

</div>

Fetches the information of a given census.

**Returns**: Promise&lt;{size: number, weight: bigint}&gt;

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|censusId|string||||

### fetchProof {#fetchProof}

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

Fetches proof that an address is part of the specified census.

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

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|censusId|string|||Census we want to check the address against|
|key|string|||The address to be found|

### createCensus {#createCensus}

<div>

</div>

Publishes the given census.

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

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|census|[PlainCensus](PlainCensus) \| [WeightedCensus](WeightedCensus)|||The census to be published.|

### fetchAccountToken {#fetchAccountToken}

<div>

</div>

Fetches the specific account token auth and sets it to the current instance.

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

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

```ts
class ChainService
```

<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="#fetchChainData">fetchChainData</a><br/><a href="#fetchChainCosts">fetchChainCosts</a><br/><a href="#submitTx">submitTx</a><br/><a href="#txInfo">txInfo</a></div></div>
</div>

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

<div>

</div>

Instantiate the chain service.

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

## Methods

### fetchChainData {#fetchChainData}

<div>

</div>

Fetches blockchain information if needed.

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

### fetchChainCosts {#fetchChainCosts}

<div>

</div>

Fetches blockchain costs information if needed.

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

### submitTx {#submitTx}

<div>

</div>

Submits a transaction to the blockchain

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

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|payload|string|||The transaction data payload|

### txInfo {#txInfo}

<div>

</div>

Fetches information about a transaction from the blockchain.

**Returns**: Promise&lt;ChainTx&gt;
- The chain transaction

|PARAMETER|TYPE|OPTIONAL|DEFAULT|DESCRIPTION|
|:---:|:---:|:---:|:---:|:---:|
|txHash|string|||The transaction hash which we want to retrieve the info from|

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

```ts
class CspService
```

<div>

</div>

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

<div>

</div>

Instantiate the CSP service.

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

Loading

0 comments on commit 46df743

Please sign in to comment.