diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/ecash.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/ecash.js b/lib/ecash.js index 0e4a3c1a..df7759bf 100644 --- a/lib/ecash.js +++ b/lib/ecash.js @@ -32,3 +32,13 @@ export async function mint(amount) { await s(`cash`, enc(returnChange)); return enc(rcvd); } + +export async function check(token) { + let { proofs } = dec(token); + let total = proofs.reduce((a, b) => a + b.amount, 0); + + let r = await wallet.checkProofsSpent(proofs); + let spent = r.reduce((a, b) => a + b.amount, 0); + + return { total, spent }; +} |
