Skip to content

Commit

Permalink
feat: export logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Harasz committed May 16, 2022
1 parent bda8ea1 commit 819e67c
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 59 deletions.
112 changes: 55 additions & 57 deletions docs/api/classes/modules_signer.SignerService.md
Expand Up @@ -2,7 +2,7 @@

[modules/signer](../modules/modules_signer.md).SignerService

Service responsible for sending transactions to the blockchain
Service responsible for signing messages and sending transactions to the blockchain

```typescript
const { signerService } = await initWithPrivateKeySigner(privateKey, rpcUrl);
Expand Down Expand Up @@ -54,7 +54,7 @@ signerService.signMessage(...);
#### Parameters

| Name | Type |
| :-- | :-- |
| :------ | :------ |
| `_signer` | `Required`<[`SignerT`](../modules/modules_signer.md#signert)\> |
| `_providerType` | [`ProviderType`](../enums/modules_signer.ProviderType.md) |

Expand All @@ -76,7 +76,7 @@ signerService.accountInfo;

account info

---
___

### address

Expand All @@ -94,7 +94,7 @@ signerService.address;

user address

---
___

### chainId

Expand All @@ -112,13 +112,13 @@ signerService.chainId;

chain id

---
___

### did

`get` **did**(): `string`

Get current user DID address.
Get current user DID

```typescript
signerService.did;
Expand All @@ -128,9 +128,9 @@ signerService.did;

`string`

DID address
DID

---
___

### didHex

Expand All @@ -148,13 +148,13 @@ signerService.didHex;

DID address

---
___

### isEthSigner

`get` **isEthSigner**(): `boolean`

Get if the signer is an Ethereum signer.
If signer is EIP-191 compliant https://eips.ethereum.org/EIPS/eip-191.

```typescript
signerService.isEthSigner;
Expand All @@ -164,9 +164,9 @@ signerService.isEthSigner;

`boolean`

true if the signer is an Ethereum signer
true if the signer is EIP-191 compliant.

---
___

### provider

Expand All @@ -184,7 +184,7 @@ signerService.provider;

connection provider

---
___

### providerType

Expand All @@ -202,13 +202,13 @@ signerService.providerType;

provider type

---
___

### signer

`get` **signer**(): `Required`<[`SignerT`](../modules/modules_signer.md#signert)\>

Custom signer instance.
The instance of the `ether` library signer in use by the service

```typescript
signerService.signer;
Expand Down Expand Up @@ -238,13 +238,14 @@ signerService.getBalance();

user balance

---
___

### call

**call**(`options`): `Promise`<`string`\>

Makes a (readonly) call to a smart contract. https://docs.ethers.io/v5/single-page/#/v5/api/providers/provider/-%23-Provider-call
Makes a (readonly) call to a smart contract.
https://docs.ethers.io/v5/single-page/#/v5/api/providers/provider/-%23-Provider-call

```typescript
signerService.call({
Expand All @@ -255,8 +256,8 @@ signerService.call({

#### Parameters

| Name | Type | Description |
| :-------- | :------------------- | :------------------ |
| Name | Type | Description |
| :------ | :------ | :------ |
| `options` | `TransactionRequest` | object with options |

#### Returns
Expand All @@ -265,7 +266,7 @@ signerService.call({

the result of the call

---
___

### chainName

Expand All @@ -283,7 +284,7 @@ signerService.chainName();

chain name

---
___

### closeConnection

Expand All @@ -301,7 +302,7 @@ signerService.closeConnection();

true if connection was closed

---
___

### connect

Expand All @@ -310,31 +311,31 @@ true if connection was closed
#### Parameters

| Name | Type |
| :-- | :-- |
| :------ | :------ |
| `signer` | `Required`<[`SignerT`](../modules/modules_signer.md#signert)\> |
| `providerType` | [`ProviderType`](../enums/modules_signer.ProviderType.md) |

#### Returns

`Promise`<`void`\>

---
___

### emit

**emit**(`e`): `Promise`<`void`\>

#### Parameters

| Name | Type |
| :--- | :---------------------------------------------------------- |
| `e` | [`ProviderEvent`](../enums/modules_signer.ProviderEvent.md) |
| Name | Type |
| :------ | :------ |
| `e` | [`ProviderEvent`](../enums/modules_signer.ProviderEvent.md) |

#### Returns

`Promise`<`void`\>

---
___

### init

Expand All @@ -344,7 +345,7 @@ true if connection was closed

`Promise`<`void`\>

---
___

### initEventHandlers

Expand All @@ -358,24 +359,24 @@ Add event handler for certain events

`void`

---
___

### on

**on**(`event`, `cb`): `void`

#### Parameters

| Name | Type |
| :------ | :---------------------------------------------------------- |
| Name | Type |
| :------ | :------ |
| `event` | [`ProviderEvent`](../enums/modules_signer.ProviderEvent.md) |
| `cb` | `any` |
| `cb` | `any` |

#### Returns

`void`

---
___

### onInit

Expand All @@ -386,14 +387,14 @@ Registers reinitialization of dependent service on signer reconnection
#### Parameters

| Name | Type |
| :-- | :-- |
| :------ | :------ |
| `initializer` | [`ServiceInitializer`](../modules/modules_signer.md#serviceinitializer) |

#### Returns

`void`

---
___

### publicKey

Expand All @@ -411,7 +412,7 @@ signerService.publicKey();

public key

---
___

### publicKeyAndIdentityToken

Expand All @@ -429,7 +430,7 @@ signerService.publicKeyAndIdentityToken();

object with public key and identity token

---
___

### send

Expand All @@ -446,8 +447,8 @@ signerService.send({

#### Parameters

| Name | Type | Description |
| :-------- | :------------------- | :------------------ |
| Name | Type | Description |
| :------ | :------ | :------ |
| `options` | `TransactionRequest` | object with options |

#### Returns
Expand All @@ -456,13 +457,15 @@ signerService.send({

transaction receipt

---
___

### signMessage

**signMessage**(`message`): `Promise`<`string`\>

Tries to create `eth_sign` conformant signature (https://eth.wiki/json-rpc/API#eth_sign). Whether or not to hash the message prior to signature is determined by signature performed during login. When running in browser `isEthSigner` variable should be stored in local storage.
Tries to create `eth_sign` conformant signature (https://eth.wiki/json-rpc/API#eth_sign).
Whether or not to hash the message prior to signature is depends on whether is signer EIP-191 compliant.
When running in browser `isEthSigner` variable should be stored in local storage.

```typescript
signerService.signMessage(arrayify('Hello World'));
Expand All @@ -471,7 +474,7 @@ signerService.signMessage(arrayify('Hello World'));
#### Parameters

| Name | Type | Description |
| :-- | :-- | :-- |
| :------ | :------ | :------ |
| `message` | `Uint8Array` | The message to be signed. The message should have binary representation to avoid confusion of text with hexadecimal binary data |

#### Returns
Expand All @@ -480,7 +483,7 @@ signerService.signMessage(arrayify('Hello World'));

the signature

---
___

### signTypedData

Expand All @@ -490,24 +493,19 @@ Tries to create conformant EIP-712 signature (https://eips.ethereum.org/EIPS/eip

```typescript
signerService.signTypedData(
{ name: 'MyToken', version: '1.0' },
{
Model: [
{ name: 'name', type: 'string' },
{ name: 'type', type: 'string' },
],
},
{ name: 'MyToken', type: 'erc721' }
{ name: 'MyToken', version: '1.0' },
{ Model: [{ name: 'name', type: 'string' }, { name: 'type', type: 'string' }] },
{ name: 'MyToken', type: 'erc721' },
);
```

#### Parameters

| Name | Type | Description |
| :-------- | :-------------------------------------- | :--------------------- |
| `domain` | `TypedDataDomain` | EIP-712 domain object |
| `types` | `Record`<`string`, `TypedDataField`[]\> | EIP-712 types object |
| `message` | `Record`<`string`, `unknown`\> | EIP-712 message object |
| Name | Type | Description |
| :------ | :------ | :------ |
| `domain` | `TypedDataDomain` | EIP-712 domain object |
| `types` | `Record`<`string`, `TypedDataField`[]\> | EIP-712 types object |
| `message` | `Record`<`string`, `unknown`\> | EIP-712 message object |

#### Returns

Expand Down
1 change: 1 addition & 0 deletions src/config/index.ts
@@ -1,3 +1,4 @@
export * from './cache.config';
export * from './chain.config';
export * from './messaging.config';
export * from './logger.config';
4 changes: 2 additions & 2 deletions src/config/logger.config.ts
@@ -1,4 +1,4 @@
import { ConsoleLogger, ILogger } from '../utils/logger';
import { ConsoleLogger, ILogger } from '../utils';

let logger: ILogger = new ConsoleLogger();

Expand All @@ -10,7 +10,7 @@ export const setLogger = (newLogger: ILogger) => (logger = newLogger);

/**
*
* Returns currenly set up logger. Console Logger By default
* Returns currently set up logger. Console Logger By default
* @returns logger
*/
export const getLogger = () => logger;
1 change: 1 addition & 0 deletions src/utils/index.ts
@@ -1,3 +1,4 @@
export * from './constants';
export * from './detect-environment';
export * from './did';
export * from './logger';

0 comments on commit 819e67c

Please sign in to comment.