Skip to content

Commit 84911f8

Browse files
committed
Merge branch 'develop' into contracts-v2
2 parents c6ab6b3 + 2c62f72 commit 84911f8

File tree

93 files changed

+813
-599
lines changed

Some content is hidden

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

93 files changed

+813
-599
lines changed

.changeset/olive-ideas-carry.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

.gitbook.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
root: ./docs
1+
root: ./docs/sdk
22
structure:
3-
summary: SUMMARY.md
3+
readme: README.md
4+
summary: SUMMARY.md
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Publish SDK Docs to GitBook
2+
3+
on:
4+
push:
5+
tags:
6+
- "sdk@*"
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
publish-docs:
13+
name: Sync docs to GitBook
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v5
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version-file: .nvmrc
20+
- name: Publish docs
21+
env:
22+
GITBOOK_API_TOKEN: ${{ secrets.GITBOOK_API_TOKEN }}
23+
GITBOOK_ORG_ID: ${{ secrets.GITBOOK_ORG_ID }}
24+
PARENT_SPACE_ID: ${{ secrets.GITBOOK_PARENT_SPACE_ID }}
25+
GITBOOK_SITE_ID: ${{ secrets.GITBOOK_SITE_ID }}
26+
GIT_REF: ${{ github.ref }}
27+
SPACE_VISIBILITY: ${{ vars.GITBOOK_SPACE_VISIBILITY }}
28+
MAKE_DEFAULT: ${{ vars.GITBOOK_MAKE_DEFAULT }}
29+
run: node scripts/gitbook-sync-sdk.mjs

.github/workflows/cd-packages.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v5
17+
with:
18+
token: ${{ secrets.GH_GITBOOK_TOKEN }}
1719
- uses: actions/setup-node@v4
1820
with:
1921
node-version-file: .nvmrc

docs/sdk/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# HUMAN Protocol SDK
2+
3+
Welcome to the official documentation for HUMAN Protocol SDK.
4+
5+
## Overview
6+
7+
- Covers both TypeScript and Python SDKs used to build on HUMAN Protocol.
8+
- Use the sidebar to browse guides and API references; search to quickly find classes and functions.
9+
10+
## Install
11+
12+
### Typescript
13+
14+
```bash
15+
npm install @human-protocol/sdk
16+
# or
17+
yarn add @human-protocol/sdk
18+
```
19+
20+
### Python
21+
22+
```bash
23+
pip install human-protocol-sdk
24+
```
25+
26+
## Links
27+
28+
- [NPM package](https://www.npmjs.com/package/@human-protocol/sdk)
29+
- [PyPI package](https://pypi.org/project/human-protocol-sdk/)
30+
- [GitHub repository](https://github.com/humanprotocol/human-protocol)
31+
32+
## Versioning
33+
34+
- Content is imported from the repository at release time.
35+
36+
## Changelog
37+
38+
- [CHANGELOG](changelog.md) — release notes and changes.

docs/sdk/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Table of contents
22

3+
- [HUMAN Protocol SDK](README.md)
4+
35
## Typescript SDK
46

57
- [Encryption](typescript/encryption/README.md)

docs/sdk/changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
### Changed
66

7+
- Relaxed several SDK return types (EscrowUtils, OperatorUtils, TransactionUtils, WorkerUtils) to allow `null` when a subgraph entity does not exist.
8+
- EscrowUtils.getEscrow now includes `chainId` in the returned object.
9+
710
### Deprecated
811

912
### Removed

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

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

77
# Abstract Class: BaseEthersClient
88

9-
Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L12)
9+
Defined in: [base.ts:12](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/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:22](https://github.com/humanprotocol/human-protocol/blob/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L22)
27+
Defined in: [base.ts:22](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L22)
2828

2929
**BaseClient constructor**
3030

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

5353
> **networkData**: [`NetworkData`](../../types/type-aliases/NetworkData.md)
5454
55-
Defined in: [base.ts:14](https://github.com/humanprotocol/human-protocol/blob/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L14)
55+
Defined in: [base.ts:14](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/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:13](https://github.com/humanprotocol/human-protocol/blob/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L13)
63+
Defined in: [base.ts:13](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L13)
6464

6565
## Methods
6666

6767
### applyTxDefaults()
6868

6969
> `protected` **applyTxDefaults**(`txOptions`): `Overrides`
7070
71-
Defined in: [base.ts:35](https://github.com/humanprotocol/human-protocol/blob/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L35)
71+
Defined in: [base.ts:35](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/packages/sdk/typescript/human-protocol-sdk/src/base.ts#L35)
7272

7373
Internal helper to enrich transaction overrides with network specific defaults.
7474

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/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L58)
9+
Defined in: [encryption.ts:58](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/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/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L66)
56+
Defined in: [encryption.ts:66](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/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/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L194)
78+
Defined in: [encryption.ts:194](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/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/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L251)
132+
Defined in: [encryption.ts:251](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/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/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L142)
168+
Defined in: [encryption.ts:142](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/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/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L77)
235+
Defined in: [encryption.ts:77](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/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/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L290)
9+
Defined in: [encryption.ts:290](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L290)
1010

1111
## Introduction
1212

@@ -48,7 +48,7 @@ const keyPair = await EncryptionUtils.generateKeyPair('Human', '[email protected]');
4848

4949
> `static` **encrypt**(`message`, `publicKeys`): `Promise`\<`string`\>
5050
51-
Defined in: [encryption.ts:444](https://github.com/humanprotocol/human-protocol/blob/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L444)
51+
Defined in: [encryption.ts:444](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/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/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L382)
114+
Defined in: [encryption.ts:382](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/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/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L351)
161+
Defined in: [encryption.ts:351](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/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/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L494)
193+
Defined in: [encryption.ts:494](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/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/111a3dfb8ed775487998fa7cc407fdc884e7a927/packages/sdk/typescript/human-protocol-sdk/src/encryption.ts#L318)
241+
Defined in: [encryption.ts:318](https://github.com/humanprotocol/human-protocol/blob/c6ab6b31903af39ac6b3e92bd60cecc017b01413/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

0 commit comments

Comments
 (0)