> ## Documentation Index
> Fetch the complete documentation index at: https://heyaven09.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Aven Integration Examples: TypeScript and Rust

> End-to-end code examples for creating streams, submitting session reports, and reading on-chain reputation using the Aven contracts on Stellar.

All examples target **Stellar Testnet**. Replace the contract IDs with the values from the [Contract Addresses](/developers/contract-addresses) page before deploying anywhere else.

## Create a payment stream (TypeScript)

```ts theme={null}
import { Contract, TransactionBuilder, Networks, rpc } from "@stellar/stellar-sdk";
import { signTransaction } from "@stellar/freighter-api";

const server = new rpc.Server("https://soroban-testnet.stellar.org");
const stream = new Contract("CSTREAMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");

const tx = new TransactionBuilder(clientAccount, {
  fee: "100",
  networkPassphrase: Networks.TESTNET,
})
  .addOperation(stream.call(
    "create_stream",
    workerAddress,
    tokenAddress,
    ratePerSecond,
    totalAmount
  ))
  .setTimeout(30)
  .build();

const signed = await signTransaction(tx.toXDR(), { networkPassphrase: Networks.TESTNET });
await server.sendTransaction(TransactionBuilder.fromXDR(signed, Networks.TESTNET));
```

## Query a worker's reputation (TypeScript)

```ts theme={null}
const reputation = new Contract("CREPUTxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");

const score = await server.simulateTransaction(
  new TransactionBuilder(readOnlyAccount, { fee: "100", networkPassphrase: Networks.TESTNET })
    .addOperation(reputation.call("compute_score", workerAddress))
    .setTimeout(30)
    .build()
);

console.log("Score:", score.result?.retval);
```

## Read all attestations (Rust)

```rust theme={null}
use soroban_sdk::{Address, Env, Vec};

let attestation_client = attestation::Client::new(&env, &ATTESTATION_ID);
let all: Vec<Attestation> = attestation_client.get_attestations(&worker);

for a in all.iter() {
    log!(&env, "session={} amount={}", a.session_id, a.amount);
}
```

<Card title="Full sample repo" icon="github" href="https://github.com/aven-stellar/examples">
  Clone the reference implementation with tests and a working web demo.
</Card>
