From fd8afea9eb2b90c9d58e1918749dd3f00b014cb3 Mon Sep 17 00:00:00 2001 From: cmd Date: Mon, 29 Jan 2024 00:32:49 -0600 Subject: [PATCH] update --- src/client/api/contract.ts | 12 +++++++++--- src/client/api/deposit.ts | 10 ++++++++-- src/client/api/request.ts | 4 ++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/client/api/contract.ts b/src/client/api/contract.ts index 2e7bf76c..2a508a09 100644 --- a/src/client/api/contract.ts +++ b/src/client/api/contract.ts @@ -73,10 +73,16 @@ function list_contract_api (client : EscrowClient) { pubkey : string, token : string ) : Promise> => { - // 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({ url, token }) + return client.fetcher({ url, init }) } } diff --git a/src/client/api/deposit.ts b/src/client/api/deposit.ts index 23ffe251..08394d9c 100644 --- a/src/client/api/deposit.ts +++ b/src/client/api/deposit.ts @@ -112,10 +112,16 @@ function list_deposit_api (client : EscrowClient) { ) : Promise> => { // 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({ url, token }) + return client.fetcher({ url, init }) } } diff --git a/src/client/api/request.ts b/src/client/api/request.ts index 7ac834c0..5516370a 100644 --- a/src/client/api/request.ts +++ b/src/client/api/request.ts @@ -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) } } @@ -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) } }