diff --git a/docs/src/content/docs/sdk/outgoing-grant-spent-amounts.mdx b/docs/src/content/docs/sdk/outgoing-grant-spent-amounts.mdx index 6e8ae503..5877098a 100644 --- a/docs/src/content/docs/sdk/outgoing-grant-spent-amounts.mdx +++ b/docs/src/content/docs/sdk/outgoing-grant-spent-amounts.mdx @@ -31,7 +31,27 @@ The code snippets below let an authorized client retrieve the spent amounts for ```ts wrap -// Coming soon +import { createAuthenticatedClient } from '@interledger/open-payments' + +// Initialize client +const client = await createAuthenticatedClient({ + walletAddressUrl: WALLET_ADDRESS, + privateKey: PRIVATE_KEY_PATH, + keyId: KEY_ID +}) + +// Get sender wallet address information +const walletAddress = await client.walletAddress.get({ url: WALLET_ADDRESS }) + +// Get spent amounts +const grantSpentAmounts = await client.outgoingPayment.getGrantSpentAmounts({ + url: walletAddress.resourceServer, + accessToken: OUTGOING_PAYMENT_ACCESS_TOKEN +}) + +// Output +console.log('GRANT_SPENT_DEBIT_AMOUNT: ', grantSpentAmounts.spentDebitAmount) +// GRANT_SPENT_DEBIT_AMOUNT: { value: '800', assetCode: 'USD', assetScale: 2 } ```