# SDK Reference

## SDK Reference

@afriwage/sdk is a standalone TypeScript package wrapping common Stellar operations.

### Installation

pnpm add @afriwage/sdk

### sendPayment

Sends USDC from one Stellar account to another.

import { sendPayment } from '@afriwage/sdk'

const hash = await sendPayment({ senderSecret: 'S...', recipientPublicKey: 'G...', amount: '250.00', memo: 'Design invoice' // optional })

console.log('Transaction hash:', hash)

Parameters:

* senderSecret — Stellar secret key of the sender
* recipientPublicKey — Stellar public key of the recipient
* amount — amount in USDC as string
* memo — optional payment memo (max 28 chars)

Returns: transaction hash string

***

### getBalance

Returns XLM and USDC balances for a Stellar address.

import { getBalance } from '@afriwage/sdk'

const { xlm, usdc } = await getBalance('G...') console.log('XLM:', xlm) console.log('USDC:', usdc)

***

### getTransactionHistory

Returns the last 20 payments for a Stellar address.

import { getTransactionHistory } from '@afriwage/sdk'

const payments = await getTransactionHistory('G...') payments.forEach(p => { console.log(p.type, p.amount, p.asset) })

***

### createKeypair

Generates a new Stellar keypair for testnet use.

import { createKeypair } from '@afriwage/sdk'

const { publicKey, secretKey } = createKeypair()

Never use a generated keypair on mainnet without proper key management.

***

### fundTestnetAccount

Funds a Stellar testnet account via Friendbot.

import { fundTestnetAccount } from '@afriwage/sdk'

await fundTestnetAccount('G...') // Account receives 10,000 XLM on testnet


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://k1ngd4vid.gitbook.io/afriwage-doc/sdk-reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
