diff --git a/jrx/src/popup.ts b/jrx/src/popup.ts index 56bf62f..caf54e8 100644 --- a/jrx/src/popup.ts +++ b/jrx/src/popup.ts @@ -311,6 +311,23 @@ pi_repop } } } + + +//async function +//mk_spend +// (source : string, +// recipient : string, +// amount : number) +//{ +// let nonce: number = await get_nonce(source); +//} +// +//async function +//get_nonce +// (source: string) +//{ +//} + /** * get account balance of ak_... str */ @@ -318,12 +335,12 @@ async function pi_balance (akstr : string) : Promise< {ok : true, - balance : number} + balance : string} | {ok : false, reason : string} > { - let endpoint_init_url = 'https://demonet.qpq.swiss/v2/'; + let endpoint_init_url = 'https://demonet.qpq.swiss/v2'; let this_endpoint = endpoint_init_url + '/accounts/' + akstr; let input_params = {pubkey: akstr}; // fetch: https://developer.mozilla.org/en-US/docs/Web/API/fetch @@ -334,10 +351,11 @@ pi_balance switch (response.status) { case 200: // unstringify the body - let return_data = response.json(); + let return_data = await response.json(); + console.log('return data', return_data); // get the balance // @ts-ignore talking to foreign api - let balance = return_data.balance; + let balance = return_data.balance.toString(); return {ok : true, balance : balance}; // pubkey malformed