-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
cmd
committed
Jan 31, 2024
1 parent
b18b7bb
commit 04ce310
Showing
18 changed files
with
879 additions
and
520 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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[] | ||
} | ||
} | ||
``` |
Oops, something went wrong.