Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
cmd committed Jan 29, 2024
1 parent 0015e33 commit fd8afea
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
12 changes: 9 additions & 3 deletions src/client/api/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,16 @@ function list_contract_api (client : EscrowClient) {
pubkey : string,
token : string
) : Promise<ApiResponse<ContractListResponse>> => {
// Formulate the request.
const url = `${client.host}/api/contract/list/${pubkey}`
// Define the request url.
const url = `${client.host}/api/contract/list/${pubkey}`
// Define the request config.
const init = {
method : 'POST',
body : token,
headers : { 'content-type' : 'text/plain' }
}
// Return the response.
return client.fetcher<ContractListResponse>({ url, token })
return client.fetcher<ContractListResponse>({ url, init })
}
}

Expand Down
10 changes: 8 additions & 2 deletions src/client/api/deposit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,16 @@ function list_deposit_api (client : EscrowClient) {
) : Promise<ApiResponse<DepositListResponse>> => {
// Validate the pubkey.
assert.is_hash(pubkey)
// Formulate the request.
// Define the request url.
const url = `${client.host}/api/deposit/list/${pubkey}`
// Define the request config.
const init = {
method : 'POST',
body : token,
headers : { 'content-type' : 'text/plain' }
}
// Return the response.
return client.fetcher<DepositListResponse>({ url, token })
return client.fetcher<DepositListResponse>({ url, init })
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/client/api/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export function request_deposits_api (signer : EscrowSigner) {
const pub = signer.pubkey
const host = signer.client.host
const url = `${host}/api/deposit/list/${pub}`
const content = 'GET' + url
const content = 'POST' + url
return signer._signer.gen_token(content)
}
}
Expand All @@ -15,7 +15,7 @@ export function request_contracts_api (signer : EscrowSigner) {
const pub = signer.pubkey
const host = signer.client.host
const url = `${host}/api/contract/list/${pub}`
const content = 'GET' + url
const content = 'POST' + url
return signer._signer.gen_token(content)
}
}
Expand Down

0 comments on commit fd8afea

Please sign in to comment.