Skip to content

Commit 29d7a04

Browse files
authored
[SDK] Fix typescript types in return statements (#3575)
1 parent f5b62d4 commit 29d7a04

89 files changed

Lines changed: 1098 additions & 557 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/olive-ideas-carry.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
"@human-protocol/sdk": minor
3+
---
4+
5+
# Changelog
6+
7+
### Changed
8+
9+
- Relaxed several SDK return types (EscrowUtils, OperatorUtils, TransactionUtils, WorkerUtils) to allow `null` when a subgraph entity does not exist.
10+
11+
# How to upgrade
12+
13+
## TypeScript
14+
15+
### yarn
16+
17+
```bash
18+
yarn upgrade @human-protocol/sdk
19+
```
20+
21+
### npm
22+
23+
```bash
24+
npm update @human-protocol/sdk
25+
```

docs/sdk/typescript/base/classes/BaseEthersClient.md

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Class: `abstract` BaseEthersClient
88

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

1111
## Introduction
1212

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

2525
> **new BaseEthersClient**(`runner`, `networkData`): `BaseEthersClient`
2626
27-
Defined in: [base.ts:20](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L20)
27+
Defined in: [base.ts:22](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L22)
2828

2929
**BaseClient constructor**
3030

@@ -52,12 +52,37 @@ The network information required to connect to the contracts
5252

5353
> **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md)
5454
55-
Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12)
55+
Defined in: [base.ts:14](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L14)
5656

5757
***
5858

5959
### runner
6060

6161
> `protected` **runner**: `ContractRunner`
6262
63-
Defined in: [base.ts:11](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L11)
63+
Defined in: [base.ts:13](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L13)
64+
65+
## Methods
66+
67+
### applyTxDefaults()
68+
69+
> `protected` **applyTxDefaults**(`txOptions`): `Overrides`
70+
71+
Defined in: [base.ts:35](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L35)
72+
73+
Internal helper to enrich transaction overrides with network specific defaults.
74+
75+
Aurora networks use a fixed gas price. We always override any user provided
76+
gasPrice with the canonical DEFAULT_AURORA_GAS_PRICE to avoid mismatches
77+
or tx failures due to an unexpected value. For other networks the user
78+
supplied fee parameters are left untouched.
79+
80+
#### Parameters
81+
82+
##### txOptions
83+
84+
`Overrides` = `{}`
85+
86+
#### Returns
87+
88+
`Overrides`

docs/sdk/typescript/encryption/classes/Encryption.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Class: Encryption
88

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

1111
## Introduction
1212

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

5454
> **new Encryption**(`privateKey`): `Encryption`
5555
56-
Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66)
56+
Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66)
5757

5858
Constructor for the Encryption class.
5959

@@ -75,7 +75,7 @@ The private key.
7575

7676
> **decrypt**(`message`, `publicKey?`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
7777
78-
Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194)
78+
Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194)
7979

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

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

130130
> **sign**(`message`): `Promise`\<`string`\>
131131
132-
Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251)
132+
Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251)
133133

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

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

166166
> **signAndEncrypt**(`message`, `publicKeys`): `Promise`\<`string`\>
167167
168-
Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142)
168+
Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142)
169169

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

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

233233
> `static` **build**(`privateKeyArmored`, `passphrase?`): `Promise`\<`Encryption`\>
234234
235-
Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77)
235+
Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77)
236236

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

docs/sdk/typescript/encryption/classes/EncryptionUtils.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
# Class: EncryptionUtils
88

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

1111
## Introduction
1212

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

4949
> `static` **encrypt**(`message`, `publicKeys`): `Promise`\<`string`\>
5050
51-
Defined in: [encryption.ts:444](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L444)
51+
Defined in: [encryption.ts:444](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L444)
5252

5353
This function encrypts a message using the specified public keys.
5454

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

112112
> `static` **generateKeyPair**(`name`, `email`, `passphrase`): `Promise`\<[`IKeyPair`](../../interfaces/interfaces/IKeyPair.md)\>
113113
114-
Defined in: [encryption.ts:382](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L382)
114+
Defined in: [encryption.ts:382](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L382)
115115

116116
This function generates a key pair for encryption and decryption.
117117

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

159159
> `static` **getSignedData**(`message`): `Promise`\<`string`\>
160160
161-
Defined in: [encryption.ts:351](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L351)
161+
Defined in: [encryption.ts:351](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L351)
162162

163163
This function gets signed data from a signed message.
164164

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

191191
> `static` **isEncrypted**(`message`): `boolean`
192192
193-
Defined in: [encryption.ts:494](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L494)
193+
Defined in: [encryption.ts:494](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L494)
194194

195195
Verifies if a message appears to be encrypted with OpenPGP.
196196

@@ -238,7 +238,7 @@ if (isEncrypted) {
238238

239239
> `static` **verify**(`message`, `publicKey`): `Promise`\<`boolean`\>
240240
241-
Defined in: [encryption.ts:318](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L318)
241+
Defined in: [encryption.ts:318](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L318)
242242

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

docs/sdk/typescript/enums/enumerations/ChainId.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,76 +6,76 @@
66

77
# Enumeration: ChainId
88

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

1111
## Enumeration Members
1212

1313
### ALL
1414

1515
> **ALL**: `-1`
1616
17-
Defined in: [enums.ts:2](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L2)
17+
Defined in: [enums.ts:2](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L2)
1818

1919
***
2020

2121
### AURORA\_TESTNET
2222

2323
> **AURORA\_TESTNET**: `1313161555`
2424
25-
Defined in: [enums.ts:9](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L9)
25+
Defined in: [enums.ts:9](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L9)
2626

2727
***
2828

2929
### BSC\_MAINNET
3030

3131
> **BSC\_MAINNET**: `56`
3232
33-
Defined in: [enums.ts:5](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L5)
33+
Defined in: [enums.ts:5](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L5)
3434

3535
***
3636

3737
### BSC\_TESTNET
3838

3939
> **BSC\_TESTNET**: `97`
4040
41-
Defined in: [enums.ts:6](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L6)
41+
Defined in: [enums.ts:6](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L6)
4242

4343
***
4444

4545
### LOCALHOST
4646

4747
> **LOCALHOST**: `1338`
4848
49-
Defined in: [enums.ts:10](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L10)
49+
Defined in: [enums.ts:10](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L10)
5050

5151
***
5252

5353
### MAINNET
5454

5555
> **MAINNET**: `1`
5656
57-
Defined in: [enums.ts:3](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L3)
57+
Defined in: [enums.ts:3](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L3)
5858

5959
***
6060

6161
### POLYGON
6262

6363
> **POLYGON**: `137`
6464
65-
Defined in: [enums.ts:7](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L7)
65+
Defined in: [enums.ts:7](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L7)
6666

6767
***
6868

6969
### POLYGON\_AMOY
7070

7171
> **POLYGON\_AMOY**: `80002`
7272
73-
Defined in: [enums.ts:8](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L8)
73+
Defined in: [enums.ts:8](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L8)
7474

7575
***
7676

7777
### SEPOLIA
7878

7979
> **SEPOLIA**: `11155111`
8080
81-
Defined in: [enums.ts:4](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L4)
81+
Defined in: [enums.ts:4](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L4)

docs/sdk/typescript/enums/enumerations/OperatorCategory.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66

77
# Enumeration: OperatorCategory
88

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

1111
## Enumeration Members
1212

1313
### MACHINE\_LEARNING
1414

1515
> **MACHINE\_LEARNING**: `"machine_learning"`
1616
17-
Defined in: [enums.ts:19](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L19)
17+
Defined in: [enums.ts:19](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L19)
1818

1919
***
2020

2121
### MARKET\_MAKING
2222

2323
> **MARKET\_MAKING**: `"market_making"`
2424
25-
Defined in: [enums.ts:20](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L20)
25+
Defined in: [enums.ts:20](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L20)

docs/sdk/typescript/enums/enumerations/OrderDirection.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66

77
# Enumeration: OrderDirection
88

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

1111
## Enumeration Members
1212

1313
### ASC
1414

1515
> **ASC**: `"asc"`
1616
17-
Defined in: [enums.ts:14](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L14)
17+
Defined in: [enums.ts:14](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L14)
1818

1919
***
2020

2121
### DESC
2222

2323
> **DESC**: `"desc"`
2424
25-
Defined in: [enums.ts:15](https://github.com/humanprotocol/human-protocol/blob/8c6afbe01e352b593635124b575731df11c509c7/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L15)
25+
Defined in: [enums.ts:15](https://github.com/humanprotocol/human-protocol/blob/57c781c4208fceea534a5c18b81692eb57100170/packages/sdk/typescript/human-protocol-sdk/src/enums.ts#L15)

0 commit comments

Comments
 (0)