Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion docs/src/content/docs/sdk/outgoing-grant-spent-amounts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,27 @@ The code snippets below let an authorized client retrieve the spent amounts for
</details>

```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 }
```

</TabItem>
Expand Down
Loading