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

docs: Update blockchain signers documentation #249

Merged
merged 1 commit into from
May 15, 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
2 changes: 2 additions & 0 deletions packages/blockchain/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
## Signers

- [CereWalletSigner](classes/CereWalletSigner.md)
- [JsonSigner](classes/JsonSigner.md)
- [KeyringSigner](classes/KeyringSigner.md)
- [Signer](classes/Signer.md)
- [UriSigner](classes/UriSigner.md)
- [Web3Signer](classes/Web3Signer.md)
22 changes: 22 additions & 0 deletions packages/blockchain/docs/classes/CereWalletSigner.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,28 @@ A promise that resolves to the signature.

___

### unlock

▸ **unlock**(`passphrase?`): `Promise`\<`void`\>

Unlocks the signer with a passphrase.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `passphrase?` | `string` | The passphrase to unlock the signer. |

#### Returns

`Promise`\<`void`\>

#### Inherited from

[Web3Signer](Web3Signer.md).[unlock](Web3Signer.md#unlock)

___

### isSigner

▸ **isSigner**(`signer`): signer is Signer
Expand Down
4 changes: 2 additions & 2 deletions packages/blockchain/docs/classes/DDCClustersPallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Creates a new cluster.
| `clusterId` | \`0x$\{string}\` | The ID of the cluster. |
| `clusterManagerId` | `string` | The ID of the cluster manager. |
| `clusterReserveId` | `string` | The ID of the cluster reserve. |
| `clusterProps` | `ClusterProps` | The properties of the cluster. |
| `clusterProps` | `Partial`\<`ClusterProps`\> | The properties of the cluster. |
| `clusterGovernmentParams` | `ClusterGovernmentParams` | The government parameters of the cluster. |

#### Returns
Expand Down Expand Up @@ -273,7 +273,7 @@ Sets the properties of a cluster.
| Name | Type | Description |
| :------ | :------ | :------ |
| `clusterId` | \`0x$\{string}\` | The ID of the cluster. |
| `clusterProps` | `ClusterProps` | The properties of the cluster. |
| `clusterProps` | `Partial`\<`ClusterProps`\> | The properties of the cluster. |

#### Returns

Expand Down
45 changes: 45 additions & 0 deletions packages/blockchain/docs/classes/JsonSigner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[@cere-ddc-sdk/blockchain](../README.md) / JsonSigner

# Class: JsonSigner

Signer that uses a JSON object to create a keypair.

**`Example`**

```typescript
const accountDataJson = {}; // Exported from Cere Wallet or other wallets
const jsonSigner = new JsonSigner(accountDataJson, { passphrase: '1234' });
const signature = await jsonSigner.sign('data');

console.log(signature);
```

## Hierarchy

- [`KeyringSigner`](KeyringSigner.md)

↳ **`JsonSigner`**

## Methods

### isSigner

▸ **isSigner**(`signer`): signer is Signer

Checks if an object is a signer.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `signer` | `unknown` | The object to check. |

#### Returns

signer is Signer

A boolean indicating whether the object is a signer.

#### Inherited from

[KeyringSigner](KeyringSigner.md).[isSigner](KeyringSigner.md#issigner)
49 changes: 49 additions & 0 deletions packages/blockchain/docs/classes/KeyringSigner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[@cere-ddc-sdk/blockchain](../README.md) / KeyringSigner

# Class: KeyringSigner

Signer that uses a keyring pair to sign data.

**`Example`**

```typescript
const pair = new Keyring().addFromUri('//Alice');
const keyringSigner = new KeyringSigner(pair);
const signature = await keyringSigner.sign('data');

console.log(signature);
```

## Hierarchy

- [`Signer`](Signer.md)

↳ **`KeyringSigner`**

↳↳ [`UriSigner`](UriSigner.md)

↳↳ [`JsonSigner`](JsonSigner.md)

## Methods

### isSigner

▸ **isSigner**(`signer`): signer is Signer

Checks if an object is a signer.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `signer` | `unknown` | The object to check. |

#### Returns

signer is Signer

A boolean indicating whether the object is a signer.

#### Inherited from

[Signer](Signer.md).[isSigner](Signer.md#issigner)
30 changes: 28 additions & 2 deletions packages/blockchain/docs/classes/Signer.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ console.log(isReady);

- **`Signer`**

↳ [`UriSigner`](UriSigner.md)

↳ [`Web3Signer`](Web3Signer.md)

↳ [`KeyringSigner`](KeyringSigner.md)

## Methods

### isReady
Expand Down Expand Up @@ -60,6 +60,24 @@ A promise that resolves to the signature.

___

### unlock

▸ **unlock**(`passphrase?`): `Promise`\<`void`\>

Unlocks the signer with a passphrase.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `passphrase?` | `string` | The passphrase to unlock the signer. |

#### Returns

`Promise`\<`void`\>

___

### isSigner

▸ **isSigner**(`signer`): signer is Signer
Expand Down Expand Up @@ -88,6 +106,14 @@ The address of the signer.

___

### isLocked

• `Readonly` `Abstract` **isLocked**: `boolean`

A boolean indicating whether the signer is locked.

___

### publicKey

• `Readonly` `Abstract` **publicKey**: `Uint8Array`
Expand Down
4 changes: 2 additions & 2 deletions packages/blockchain/docs/classes/UriSigner.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ console.log(signature);

## Hierarchy

- [`Signer`](Signer.md)
- [`KeyringSigner`](KeyringSigner.md)

**`UriSigner`**

Expand All @@ -41,4 +41,4 @@ A boolean indicating whether the object is a signer.

#### Inherited from

[Signer](Signer.md).[isSigner](Signer.md#issigner)
[KeyringSigner](KeyringSigner.md).[isSigner](KeyringSigner.md#issigner)
22 changes: 22 additions & 0 deletions packages/blockchain/docs/classes/Web3Signer.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,28 @@ A promise that resolves to the signature.

___

### unlock

▸ **unlock**(`passphrase?`): `Promise`\<`void`\>

Unlocks the signer with a passphrase.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `passphrase?` | `string` | The passphrase to unlock the signer. |

#### Returns

`Promise`\<`void`\>

#### Inherited from

[Signer](Signer.md).[unlock](Signer.md#unlock)

___

### isSigner

▸ **isSigner**(`signer`): signer is Signer
Expand Down
2 changes: 2 additions & 0 deletions packages/ddc-client/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@

## Signers

- [JsonSigner](classes/JsonSigner.md)
- [KeyringSigner](classes/KeyringSigner.md)
- [Signer](classes/Signer.md)
- [UriSigner](classes/UriSigner.md)
5 changes: 3 additions & 2 deletions packages/ddc-client/docs/classes/DdcClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ ___

### resolveName

▸ **resolveName**(`bucketId`, `cnsName`): `Promise`\<``null`` \| `string`\>
▸ **resolveName**(`bucketId`, `cnsName`, `options?`): `Promise`\<`Cid`\>

Resolves a CNS name to a specific CID.

Expand All @@ -273,10 +273,11 @@ Resolves a CNS name to a specific CID.
| :------ | :------ | :------ |
| `bucketId` | `bigint` | The ID of the bucket to resolve the CNS name in. |
| `cnsName` | `string` | The CNS name to resolve. |
| `options?` | `CnsRecordGetOptions` | - |

#### Returns

`Promise`\<``null`` \| `string`\>
`Promise`\<`Cid`\>

A promise that resolves to the CID of the CNS name.

Expand Down
45 changes: 45 additions & 0 deletions packages/ddc-client/docs/classes/JsonSigner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[@cere-ddc-sdk/ddc-client](../README.md) / JsonSigner

# Class: JsonSigner

Signer that uses a JSON object to create a keypair.

**`Example`**

```typescript
const accountDataJson = {}; // Exported from Cere Wallet or other wallets
const jsonSigner = new JsonSigner(accountDataJson, { passphrase: '1234' });
const signature = await jsonSigner.sign('data');

console.log(signature);
```

## Hierarchy

- [`KeyringSigner`](KeyringSigner.md)

↳ **`JsonSigner`**

## Methods

### isSigner

▸ **isSigner**(`signer`): signer is Signer

Checks if an object is a signer.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `signer` | `unknown` | The object to check. |

#### Returns

signer is Signer

A boolean indicating whether the object is a signer.

#### Inherited from

[KeyringSigner](KeyringSigner.md).[isSigner](KeyringSigner.md#issigner)
49 changes: 49 additions & 0 deletions packages/ddc-client/docs/classes/KeyringSigner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[@cere-ddc-sdk/ddc-client](../README.md) / KeyringSigner

# Class: KeyringSigner

Signer that uses a keyring pair to sign data.

**`Example`**

```typescript
const pair = new Keyring().addFromUri('//Alice');
const keyringSigner = new KeyringSigner(pair);
const signature = await keyringSigner.sign('data');

console.log(signature);
```

## Hierarchy

- [`Signer`](Signer.md)

↳ **`KeyringSigner`**

↳↳ [`UriSigner`](UriSigner.md)

↳↳ [`JsonSigner`](JsonSigner.md)

## Methods

### isSigner

▸ **isSigner**(`signer`): signer is Signer

Checks if an object is a signer.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `signer` | `unknown` | The object to check. |

#### Returns

signer is Signer

A boolean indicating whether the object is a signer.

#### Inherited from

[Signer](Signer.md).[isSigner](Signer.md#issigner)
Loading
Loading