Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cmd committed Jan 31, 2024
1 parent b18b7bb commit 04ce310
Show file tree
Hide file tree
Showing 18 changed files with 879 additions and 520 deletions.
140 changes: 103 additions & 37 deletions docs/api/contract.md
Original file line number Diff line number Diff line change
@@ -1,99 +1,165 @@
# Contract API

Work in progreess. Check back later!
[`/api/contract/create`](#create-a-contract)
[`/api/contract/list/:pubkey`](#list-contracts-by-pubkey)
[`/api/contract/:cid`](#read-a-contract-by-id)
[`/api/contract/:cid/cancel`](#cancel-a-contract)
[`/api/contract/:cid/funds`](#list-funds-in-a-contract)
[`/api/contract/:cid/submit`](#submit-a-witness-statement)
[`/api/contract/:cid/witness`](#list-statements-in-a-contract)

## Create a Contract

`/api/contract/create`

**Request Example**
**Request Format**

```ts
interface goes here
method : 'POST'
endpoint : '/api/contract/create'
headers : { 'content-type' : 'application/json' }
body : JSON.stringify(contract_request)
```

**Response Example**
**Request Body**

```ts
interface goes here
interface ContractRequest {
proposal : ProposalData
signatures ?: string[]
}
```

## Read a Contract
**Response Interface**

```ts
interface ContractDataResponse {
data : {
contract : ContractData
}
}
```

`/api/contract/<cid>`
## List Contracts By Pubkey

**Request Example**
**Request Format**

```ts
interface goes here
method : 'GET'
endpoint : '/api/contract/list/:pubkey'
headers : { 'Authorization' : 'Token ' + auth_token }
```

**Response Example**
**Response Interface**

```ts
interface goes here
interface ContractListResponse {
data : {
contracts : ContractData[]
}
}
```

## View Contracts by Registered Pubkey
## Read a Contract By Id

`/api/contract/list/<pubkey>`
**Request Format**

**Request Example**
```ts
method : 'GET'
endpoint : '/api/contract/:cid'
```

**Response Interface**

```ts
interface goes here
interface ContractDataResponse {
data : {
contract : ContractData
}
}
```

**Response Example**
## Cancel a Contract

**Request Format**

```ts
interface goes here
method : 'GET'
endpoint : '/api/contract/:cid/cancel'
headers : { 'Authorization' : 'Token ' + auth_token }
```

## View Contract Deposits
**Response Interface**

`/api/contract/<cid>/funds`
```ts
interface ContractDataResponse {
data : {
contract : ContractData
}
}
```

**Request Example**
## List Funds in a Contract

**Request Format**

```ts
interface goes here
method : 'GET'
endpoint : '/api/contract/:cid/funds'
```

**Response Example**
**Response Interface**

```ts
interface goes here
interface DepositListResponse {
data : {
deposits : DepositData[]
}
}
```

## Submit a Witness Statement

`/api/contract/<cid>/submit`

**Request Example**
**Request Format**

```ts
interface goes here
method : 'POST'
endpoint : '/api/contract/:cid/submit'
headers : { 'content-type' : 'application/json' }
body : JSON.stringify(witness_request)
```

**Response Example**
**Request Body**

```ts
interface goes here
interface WitnessRequest {
witness : WitnessData
}
```

## View Witness Statements
**Response Interface**

```ts
interface ContractDataResponse {
data : {
contract : ContractData
}
}
```

`/api/contract/<cid>/witness`
## List Statements in a Contract

**Request Example**
**Request Format**

```ts
interface goes here
method : 'GET'
endpoint : '/api/contract/:cid/witness'
```

**Response Example**
**Response Interface**

```ts
interface goes here
interface WitnessListResponse {
data : {
statements : WitnessData[]
}
}
```
Loading

0 comments on commit 04ce310

Please sign in to comment.