Skip to content
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
25 changes: 25 additions & 0 deletions .changeset/olive-ideas-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
"@human-protocol/sdk": minor
---

# Changelog

### Changed

- Relaxed several SDK return types (EscrowUtils, OperatorUtils, TransactionUtils, WorkerUtils) to allow `null` when a subgraph entity does not exist.

# How to upgrade

## TypeScript

### yarn

```bash
yarn upgrade @human-protocol/sdk
```

### npm

```bash
npm update @human-protocol/sdk
```
33 changes: 29 additions & 4 deletions docs/sdk/typescript/base/classes/BaseEthersClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Class: `abstract` BaseEthersClient

Defined in: [base.ts:10](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L10)
Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12)

## Introduction

Expand All @@ -24,7 +24,7 @@ This class is used as a base class for other clients making on-chain calls.

> **new BaseEthersClient**(`runner`, `networkData`): `BaseEthersClient`

Defined in: [base.ts:20](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20)
Defined in: [base.ts:22](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L22)

**BaseClient constructor**

Expand Down Expand Up @@ -52,12 +52,37 @@ The network information required to connect to the contracts

> **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md)

Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12)
Defined in: [base.ts:14](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L14)

***

### runner

> `protected` **runner**: `ContractRunner`

Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11)
Defined in: [base.ts:13](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L13)

## Methods

### applyTxDefaults()

> `protected` **applyTxDefaults**(`txOptions`): `Overrides`

Defined in: [base.ts:35](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L35)

Internal helper to enrich transaction overrides with network specific defaults.

Aurora networks use a fixed gas price. We always override any user provided
gasPrice with the canonical DEFAULT_AURORA_GAS_PRICE to avoid mismatches
or tx failures due to an unexpected value. For other networks the user
supplied fee parameters are left untouched.

#### Parameters

##### txOptions

`Overrides` = `{}`

#### Returns

`Overrides`
12 changes: 6 additions & 6 deletions docs/sdk/typescript/encryption/classes/Encryption.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Class: Encryption

Defined in: [encryption.ts:58](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L58)
Defined in: [encryption.ts:58](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L58)

## Introduction

Expand Down Expand Up @@ -53,7 +53,7 @@ const encryption = await Encryption.build(privateKey, passphrase);

> **new Encryption**(`privateKey`): `Encryption`

Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66)
Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66)

Constructor for the Encryption class.

Expand All @@ -75,7 +75,7 @@ The private key.

> **decrypt**(`message`, `publicKey?`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>

Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194)
Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194)

This function decrypts messages using the private key. In addition, the public key can be added for signature verification.

Expand Down Expand Up @@ -129,7 +129,7 @@ const resultMessage = await encryption.decrypt('message');

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

Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251)
Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251)

This function signs a message using the private key used to initialize the client.

Expand Down Expand Up @@ -165,7 +165,7 @@ const resultMessage = await encryption.sign('message');

> **signAndEncrypt**(`message`, `publicKeys`): `Promise`\<`string`\>

Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142)
Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142)

This function signs and encrypts a message using the private key used to initialize the client and the specified public keys.

Expand Down Expand Up @@ -232,7 +232,7 @@ const resultMessage = await encryption.signAndEncrypt('message', publicKeys);

> `static` **build**(`privateKeyArmored`, `passphrase?`): `Promise`\<`Encryption`\>

Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77)
Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77)

Builds an Encryption instance by decrypting the private key from an encrypted private key and passphrase.

Expand Down
12 changes: 6 additions & 6 deletions docs/sdk/typescript/encryption/classes/EncryptionUtils.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Class: EncryptionUtils

Defined in: [encryption.ts:290](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L290)
Defined in: [encryption.ts:290](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L290)

## Introduction

Expand Down Expand Up @@ -48,7 +48,7 @@ const keyPair = await EncryptionUtils.generateKeyPair('Human', 'human@hmt.ai');

> `static` **encrypt**(`message`, `publicKeys`): `Promise`\<`string`\>

Defined in: [encryption.ts:444](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L444)
Defined in: [encryption.ts:444](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L444)

This function encrypts a message using the specified public keys.

Expand Down Expand Up @@ -111,7 +111,7 @@ const result = await EncryptionUtils.encrypt('message', publicKeys);

> `static` **generateKeyPair**(`name`, `email`, `passphrase`): `Promise`\<[`IKeyPair`](../../interfaces/interfaces/IKeyPair.md)\>

Defined in: [encryption.ts:382](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L382)
Defined in: [encryption.ts:382](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L382)

This function generates a key pair for encryption and decryption.

Expand Down Expand Up @@ -158,7 +158,7 @@ const result = await EncryptionUtils.generateKeyPair(name, email, passphrase);

> `static` **getSignedData**(`message`): `Promise`\<`string`\>

Defined in: [encryption.ts:351](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L351)
Defined in: [encryption.ts:351](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L351)

This function gets signed data from a signed message.

Expand Down Expand Up @@ -190,7 +190,7 @@ const signedData = await EncryptionUtils.getSignedData('message');

> `static` **isEncrypted**(`message`): `boolean`

Defined in: [encryption.ts:494](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L494)
Defined in: [encryption.ts:494](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L494)

Verifies if a message appears to be encrypted with OpenPGP.

Expand Down Expand Up @@ -238,7 +238,7 @@ if (isEncrypted) {

> `static` **verify**(`message`, `publicKey`): `Promise`\<`boolean`\>

Defined in: [encryption.ts:318](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L318)
Defined in: [encryption.ts:318](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L318)

This function verifies the signature of a signed message using the public key.

Expand Down
20 changes: 10 additions & 10 deletions docs/sdk/typescript/enums/enumerations/ChainId.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,76 +6,76 @@

# Enumeration: ChainId

Defined in: [enums.ts:1](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L1)
Defined in: [enums.ts:1](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L1)

## Enumeration Members

### ALL

> **ALL**: `-1`

Defined in: [enums.ts:2](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L2)
Defined in: [enums.ts:2](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L2)

***

### AURORA\_TESTNET

> **AURORA\_TESTNET**: `1313161555`

Defined in: [enums.ts:9](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L9)
Defined in: [enums.ts:9](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L9)

***

### BSC\_MAINNET

> **BSC\_MAINNET**: `56`

Defined in: [enums.ts:5](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L5)
Defined in: [enums.ts:5](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L5)

***

### BSC\_TESTNET

> **BSC\_TESTNET**: `97`

Defined in: [enums.ts:6](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L6)
Defined in: [enums.ts:6](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L6)

***

### LOCALHOST

> **LOCALHOST**: `1338`

Defined in: [enums.ts:10](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L10)
Defined in: [enums.ts:10](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L10)

***

### MAINNET

> **MAINNET**: `1`

Defined in: [enums.ts:3](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L3)
Defined in: [enums.ts:3](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L3)

***

### POLYGON

> **POLYGON**: `137`

Defined in: [enums.ts:7](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L7)
Defined in: [enums.ts:7](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L7)

***

### POLYGON\_AMOY

> **POLYGON\_AMOY**: `80002`

Defined in: [enums.ts:8](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L8)
Defined in: [enums.ts:8](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L8)

***

### SEPOLIA

> **SEPOLIA**: `11155111`

Defined in: [enums.ts:4](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L4)
Defined in: [enums.ts:4](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L4)
6 changes: 3 additions & 3 deletions docs/sdk/typescript/enums/enumerations/OperatorCategory.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

# Enumeration: OperatorCategory

Defined in: [enums.ts:18](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L18)
Defined in: [enums.ts:18](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L18)

## Enumeration Members

### MACHINE\_LEARNING

> **MACHINE\_LEARNING**: `"machine_learning"`

Defined in: [enums.ts:19](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L19)
Defined in: [enums.ts:19](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L19)

***

### MARKET\_MAKING

> **MARKET\_MAKING**: `"market_making"`

Defined in: [enums.ts:20](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L20)
Defined in: [enums.ts:20](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L20)
6 changes: 3 additions & 3 deletions docs/sdk/typescript/enums/enumerations/OrderDirection.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

# Enumeration: OrderDirection

Defined in: [enums.ts:13](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L13)
Defined in: [enums.ts:13](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L13)

## Enumeration Members

### ASC

> **ASC**: `"asc"`

Defined in: [enums.ts:14](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L14)
Defined in: [enums.ts:14](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L14)

***

### DESC

> **DESC**: `"desc"`

Defined in: [enums.ts:15](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L15)
Defined in: [enums.ts:15](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L15)
Loading
Loading