Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat: implement Solana agent SDK with wallet integration and transaction handling

nirholas8b4bd22340c3
diff --git a/solana-agent-sdk/package.json b/solana-agent-sdk/package.json
new file mode 100644
index 000000000..d80d2ac9a
--- /dev/null
+++ b/solana-agent-sdk/package.json
@@ -0,0 +1,50 @@
+{
+ "name": "@three-ws/solana-agent",
+ "version": "0.1.0",
+ "description": "Solana agent SDK — keypair + browser wallet, transfers, swaps, x402 exact scheme",
+ "type": "module",
+ "main": "./dist/index.cjs",
+ "module": "./dist/index.js",
+ "types": "./dist/index.d.ts",
+ "exports": {
+ ".": {
+ "types": "./dist/index.d.ts",
+ "import": "./dist/index.js",
+ "require": "./dist/index.cjs"
+ },
+ "./wallet": {
+ "types": "./dist/wallet/index.d.ts",
+ "import": "./dist/wallet/index.js",
+ "require": "./dist/wallet/index.cjs"
+ },
+ "./x402-exact": {
+ "types": "./dist/x402-exact/index.d.ts",
+ "import": "./dist/x402-exact/index.js",
+ "require": "./dist/x402-exact/index.cjs"
+ }
+ },
+ "files": ["dist"],
+ "scripts": {
+ "build": "tsup",
+ "build:prod": "tsup --minify",
+ "dev": "tsup --watch",
+ "typecheck": "tsc --noEmit",
+ "clean": "rm -rf dist",
+ "prepublishOnly": "npm run typecheck && npm run build:prod"
+ },
+ "dependencies": {
+ "@solana/spl-token": "^0.4.9",
+ "@solana/web3.js": "^1.98.0",
+ "bs58": "^6.0.0"
+ },
+ "devDependencies": {
+ "@types/node": "^22.0.0",
+ "@rollup/rollup-linux-x64-gnu": "*",
+ "tsup": "^8.3.5",
+ "typescript": "^5.7.3"
+ },
+ "publishConfig": {
+ "access": "public"
+ },
+ "license": "MIT"
+}
diff --git a/solana-agent-sdk/src/actions/ata.ts b/solana-agent-sdk/src/actions/ata.ts
new file mode 100644
index 000000000..97b7d6aae
--- /dev/null
+++ b/solana-agent-sdk/src/actions/ata.ts
@@ -0,0 +1,60 @@
+import {
+ PublicKey,
+ type Connection,
+} from "@solana/web3.js";
+import {
+ getAssociatedTokenAddressSync,
+ createAssociatedTokenAccountInstruction,
+ TOKEN_PROGRAM_ID,
+ ASSOCIATED_TOKEN_PROGRAM_ID,
+} from "@solana/spl-token";
+import type { WalletProvider } from "../wallet/types.js";
+import { buildAndSend, type BuildAndSendOptions } from "../tx/build.js";
+
+export interface GetOrCreateAtaParams {
+ mint: PublicKey | string;
+ owner?: PublicKey | string;
+}
+
+export interface GetOrCreateAtaResult {
+ ata: PublicKey;
+ /** Defined if a create transaction was sent; undefined if ATA already existed */
+ signature?: string;
+}
+
+export async function getOrCreateAta(
+ wallet: WalletProvider,
+ connection: Connection,
+ params: GetOrCreateAtaParams,
+ opts?: BuildAndSendOptions,
+): Promise<GetOrCreateAtaResult> {
+ const mint = typeof params.mint === "string" ? new PublicKey(params.mint) : params.mint;
+ const owner = params.owner
+ ? typeof params.owner === "string"
+ ? new PublicKey(params.owner)
+ : params.owner
+ : wallet.publicKey;
+
+ const ata = getAssociatedTokenAddressSync(
+ mint,
+ owner,
+ false,
+ TOKEN_PROGRAM_ID,
+ ASSOCIATED_TOKEN_PROGRAM_ID,
+ );
+
+ const info = await connection.getAccountInfo(ata);
+ if (info) return { ata };
+
+ const ix = createAssociatedTokenAccountInstruction(
+ wallet.publicKey,
+ ata,
+ owner,
+ mint,
+ TOKEN_PROGRAM_ID,
+ ASSOCIATED_TOKEN_PROGRAM_ID,
+ );
+
+ const signature = await buildAndSend(wallet, connection, [ix], opts);
+ return { ata, signature };
+}
diff --git a/solana-agent-sdk/src/actions/transfer-sol.ts b/solana-agent-sdk/src/actions/transfer-sol.ts
new file mode 100644
index 000000000..160431042
--- /dev/null
+++ b/solana-agent-sdk/src/actions/transfer-sol.ts
@@ -0,0 +1,32 @@
+import {
+ LAMPORTS_PER_SOL,
+ PublicKey,
+ SystemProgram,
+ type Connection,
+} from "@solana/web3.js";
+import type { WalletProvider } from "../wallet/types.js";
+import { buildAndSend, type BuildAndSendOptions } from "../tx/build.js";
+
+export interface TransferSolParams {
+ to: PublicKey | string;
+ /** Amount in SOL (not lamports) */
+ amount: number;
+}
+
+export async function transferSol(
+ wallet: WalletProvider,
+ connection: Connection,
+ params: TransferSolParams,
+ opts?: BuildAndSendOptions,
+): Promise<string> {
+ const to = typeof params.to === "string" ? new PublicKey(params.to) : params.to;
+ const lamports = Math.round(params.amount * LAMPORTS_PER_SOL);
+
+ const ix = SystemProgram.transfer({
+ fromPubkey: wallet.publicKey,
+ toPubkey: to,
+ lamports,
+ });
+
+ return buildAndSend(wallet, connection, [ix], opts);
+}
diff --git a/solana-agent-sdk/src/actions/transfer-spl.ts b/solana-agent-sdk/src/actions/transfer-spl.ts
new file mode 100644
index 000000000..6b3200722
--- /dev/null
+++ b/solana-agent-sdk/src/actions/transfer-spl.ts
@@ -0,0 +1,67 @@
+import {
+ PublicKey,
+ type Connection,
+} from "@solana/web3.js";
+import {
+ getAssociatedTokenAddressSync,
+ createAssociatedTokenAccountInstruction,
+ createTransferCheckedInstruction,
+ getMint,
+ TOKEN_PROGRAM_ID,
+ ASSOCIATED_TOKEN_PROGRAM_ID,
+} from "@solana/spl-token";
+import type { WalletProvider } from "../wallet/types.js";
+import { buildAndSend, type BuildAndSendOptions } from "../tx/build.js";
+import type { TransactionInstruction } from "@solana/web3.js";
+
+export interface TransferSplParams {
+ mint: PublicKey | string;
+ to: PublicKey | string;
+ /** Amount in token base units (not human-readable) */
+ amount: bigint;
+}
+
+export async function transferSpl(
+ wallet: WalletProvider,
+ connection: Connection,
+ params: TransferSplParams,
+ opts?: BuildAndSendOptions,
+): Promise<string> {
+ const mint = typeof params.mint === "string" ? new PublicKey(params.mint) : params.mint;
+ const to = typeof params.to === "string" ? new PublicKey(params.to) : params.to;
+
+ const mintInfo = await getMint(connection, mint);
+ const instructions: TransactionInstruction[] = [];
+
+ const senderAta = getAssociatedTokenAddressSync(mint, wallet.publicKey, false, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID);
+ const receiverAta = getAssociatedTokenAddressSync(mint, to, false, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID);
+
+ const receiverInfo = await connection.getAccountInfo(receiverAta);
+ if (!receiverInfo) {
+ instructions.push(
+ createAssociatedTokenAccountInstruction(
+ wallet.publicKey,
+ receiverAta,
+ to,
+ mint,
+ TOKEN_PROGRAM_ID,
+ ASSOCIATED_TOKEN_PROGRAM_ID,
+ ),
+ );
+ }
+
+ instructions.push(
+ createTransferCheckedInstruction(
+ senderAta,
+ mint,
+ receiverAta,
+ wallet.publicKey,
+ params.amount,
+ mintInfo.decimals,
+ [],
+ TOKEN_PROGRAM_ID,
+ ),
+ );
+
+ return buildAndSend(wallet, connection, instructions, opts);
+}
diff --git a/solana-agent-sdk/src/tx/build.ts b/solana-agent-sdk/src/tx/build.ts
new file mode 100644
index 000000000..e37181bff
--- /dev/null
+++ b/solana-agent-sdk/src/tx/build.ts
@@ -0,0 +1,70 @@
+import {
+ Transaction,
+ type Connection,
+ type TransactionInstruction,
+} from "@solana/web3.js";
+import type { WalletProvider } from "../wallet/types.js";
+import {
+ estimateComputeUnits,
+ estimatePriorityFee,
+ computeUnitIx,
+ priorityFeeIx,
+} from "./fees.js";
+
+export interface BuildAndSendOptions {
+ /** microLamports per CU — omit to auto-estimate from recent fees */
+ priorityFee?: number;
+ /** Compute unit limit — omit to simulate and auto-set */
+ cuLimit?: number;
+ /** Max times to retry on blockhash expiry (default 3) */
+ maxRetries?: number;
+}
+
+export async function buildAndSend(
+ wallet: WalletProvider,
+ connection: Connection,
+ instructions: TransactionInstruction[],
+ opts: BuildAndSendOptions = {},
+): Promise<string> {
+ const { maxRetries = 3 } = opts;
+
+ const [fee, cuLimit] = await Promise.all([
+ opts.priorityFee !== undefined
+ ? Promise.resolve(opts.priorityFee)
+ : estimatePriorityFee(connection),
+ opts.cuLimit !== undefined
+ ? Promise.resolve(opts.cuLimit)
+ : estimateComputeUnits(connection, instructions, wallet.publicKey),
+ ]);
+
+ const budgetIxs: TransactionInstruction[] = [
+ priorityFeeIx(fee),
+ computeUnitIx(cuLimit),
+ ];
+
+ for (let attempt = 0; attempt < maxRetries; attempt++) {
+ const { blockhash, lastValidBlockHeight } = await connection.getLatestBlockhash();
+
+ const tx = new Transaction();
+ tx.recentBlockhash = blockhash;
+ tx.feePayer = wallet.publicKey;
+ tx.add(...budgetIxs, ...instructions);
+
+ try {
+ return await wallet.signAndSendTransaction(tx, connection);
+ } catch (err) {
+ const isExpired =
+ err instanceof Error &&
+ (err.message.includes("Blockhash not found") ||
+ err.message.includes("block height exceeded"));
+
+ if (!isExpired || attempt === maxRetries - 1) throw err;
+
+ const slot = await connection.getSlot();
+ if (slot > lastValidBlockHeight) continue;
+ throw err;
+ }
+ }
+
+ throw new Error("buildAndSend: exhausted retries");
+}
diff --git a/solana-agent-sdk/src/tx/fees.ts b/solana-agent-sdk/src/tx/fees.ts
new file mode 100644
index 000000000..53ec2ee9c
--- /dev/null
+++ b/solana-agent-sdk/src/tx/fees.ts
@@ -0,0 +1,45 @@
+import {
+ ComputeBudgetProgram,
+ PublicKey,
+ TransactionMessage,
+ VersionedTransaction,
+ type Connection,
+ type TransactionInstruction,
+} from "@solana/web3.js";
+
+export async function estimatePriorityFee(connection: Connection): Promise<number> {
+ const fees = await connection.getRecentPrioritizationFees();
+ if (fees.length === 0) return 1_000;
+ const sorted = fees.map((f) => f.prioritizationFee).sort((a, b) => a - b);
+ return sorted[Math.floor(sorted.length * 0.75)] ?? 1_000;
+}
+
+export async function estimateComputeUnits(
+ connection: Connection,
+ instructions: TransactionInstruction[],
+ payer: PublicKey,
+): Promise<number> {
+ const { blockhash } = await connection.getLatestBlockhash();
+ const msg = new TransactionMessage({
+ payerKey: payer,
+ recentBlockhash: blockhash,
+ instructions,
+ }).compileToV0Message();
+
+ const sim = await connection.simulateTransaction(
+ new VersionedTransaction(msg),
+ { sigVerify: false },
+ );
+
+ const units = sim.value.unitsConsumed;
+ if (!units) return 200_000;
+ return Math.ceil(units * 1.1);
+}
+
+export function priorityFeeIx(microLamports: number): TransactionInstruction {
+ return ComputeBudgetProgram.setComputeUnitPrice({ microLamports });
+}
+
+export function computeUnitIx(units: number): TransactionInstruction {
+ return ComputeBudgetProgram.setComputeUnitLimit({ units });
+}
diff --git a/solana-agent-sdk/src/tx/index.ts b/solana-agent-sdk/src/tx/index.ts
new file mode 100644
index 000000000..5cb208b36
--- /dev/null
+++ b/solana-agent-sdk/src/tx/index.ts
@@ -0,0 +1,8 @@
+export { buildAndSend } from "./build.js";
+export type { BuildAndSendOptions } from "./build.js";
+export {
+ estimatePriorityFee,
+ estimateComputeUnits,
+ priorityFeeIx,
+ computeUnitIx,
+} from "./fees.js";
diff --git a/solana-agent-sdk/src/wallet/browser-client.ts b/solana-agent-sdk/src/wallet/browser-client.ts
new file mode 100644
index 000000000..b9797b3ea
--- /dev/null
+++ b/solana-agent-sdk/src/wallet/browser-client.ts
@@ -0,0 +1,104 @@
+/**
+ * BrowserWalletClient — browser-side half of the wallet bridge.
+ *
+ * Polls the server for pending transactions, signs them with the provided
+ * signer (Phantom, Solflare, or any Wallet Adapter), and submits them back.
+ *
+ * Works in any browser environment — no Node.js APIs required.
+ *
+ * Usage:
+ * const client = new BrowserWalletClient("/api/wallet", async (tx) => {
+ * return wallet.signTransaction(tx); // wallet adapter signTransaction
+ * });
+ * client.start();
+ */
+import { Transaction, VersionedTransaction } from "@solana/web3.js";
+
+export type SignerFn = (
+ tx: Transaction | VersionedTransaction,
+) => Promise<Transaction | VersionedTransaction>;
+
+export interface PendingTx {
+ id: string;
+ transaction: string;
+ versioned: boolean;
+ createdAt: number;
+}
+
+export class BrowserWalletClient {
+ private readonly baseUrl: string;
+ private readonly signer: SignerFn;
+ private timer: ReturnType<typeof setInterval> | null = null;
+ private processing = new Set<string>();
+
+ constructor(baseUrl: string, signer: SignerFn) {
+ this.baseUrl = baseUrl.replace(/\/$/, "");
+ this.signer = signer;
+ }
+
+ start(intervalMs = 1000): void {
+ if (this.timer) return;
+ this.timer = setInterval(() => void this.poll(), intervalMs);
+ }
+
+ stop(): void {
+ if (this.timer) {
+ clearInterval(this.timer);
+ this.timer = null;
+ }
+ }
+
+ private async poll(): Promise<void> {
+ let pending: PendingTx[];
+ try {
+ const res = await fetch(`${this.baseUrl}/pending`);
+ if (!res.ok) return;
+ const data = (await res.json()) as { pending: PendingTx[] };
+ pending = data.pending;
+ } catch {
+ return;
+ }
+
+ for (const item of pending) {
+ if (this.processing.has(item.id)) continue;
+ this.processing.add(item.id);
+ void this.handle(item).finally(() => this.processing.delete(item.id));
+ }
+ }
+
+ private async handle(item: PendingTx): Promise<void> {
+ const buf = base64ToUint8Array(item.transaction);
+ const tx = item.versioned
+ ? VersionedTransaction.deserialize(buf)
+ : Transaction.from(buf);
+
+ try {
+ const signed = await this.signer(tx);
+ const serialized = uint8ArrayToBase64(signed.serialize());
+ await fetch(`${this.baseUrl}/sign/${item.id}`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ signedTransaction: serialized }),
+ });
+ } catch {
+ await fetch(`${this.baseUrl}/reject/${item.id}`, { method: "POST" });
+ }
+ }
+}
+
+function base64ToUint8Array(b64: string): Uint8Array {
+ const binary = atob(b64);
+ const bytes = new Uint8Array(binary.length);
+ for (let i = 0; i < binary.length; i++) {
+ bytes[i] = binary.charCodeAt(i);
+ }
+ return bytes;
+}
+
+function uint8ArrayToBase64(bytes: Uint8Array): string {
+ let binary = "";
+ for (let i = 0; i < bytes.length; i++) {
+ binary += String.fromCharCode(bytes[i] as number);
+ }
+ return btoa(binary);
+}
diff --git a/solana-agent-sdk/src/wallet/browser-server.ts b/solana-agent-sdk/src/wallet/browser-server.ts
new file mode 100644
index 000000000..1d328fd35
--- /dev/null
+++ b/solana-agent-sdk/src/wallet/browser-server.ts
@@ -0,0 +1,134 @@
+/**
+ * BrowserWalletProvider — server-side half of the browser wallet bridge.
+ *
+ * The agent calls signAndSendTransaction() as normal. Internally this creates a
+ * pending request that the browser can pick up, sign with Phantom/Solflare, and
+ * submit back. The Promise resolves once the browser returns the signed tx.
+ *
+ * Mount createHandler() on any HTTP path (e.g. POST /api/wallet/sign/:id).
+ * Point BrowserWalletClient (browser-client.ts) at the same base URL.
+ */
+import { EventEmitter } from "events";
+import {
+ PublicKey,
+ Transaction,
+ VersionedTransaction,
+ type Connection,
+} from "@solana/web3.js";
+import type { WalletProvider } from "./types.js";
+
+export interface PendingTx {
+ id: string;
+ transaction: string;
+ versioned: boolean;
+ createdAt: number;
+}
+
+export interface BrowserWalletOptions {
+ publicKey: PublicKey | string;
+ sessionId?: string;
+ timeoutMs?: number;
+}
+
+export class BrowserWalletProvider implements WalletProvider {
+ readonly publicKey: PublicKey;
+ readonly sessionId: string;
+ private readonly timeoutMs: number;
+ private readonly pending = new Map<string, PendingTx>();
+ private readonly emitter = new EventEmitter();
+
+ constructor(opts: BrowserWalletOptions) {
+ this.publicKey =
+ typeof opts.publicKey === "string"
+ ? new PublicKey(opts.publicKey)
+ : opts.publicKey;
+ this.sessionId = opts.sessionId ?? crypto.randomUUID();
+ this.timeoutMs = opts.timeoutMs ?? 120_000;
+ }
+
+ async signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T> {
+ const id = crypto.randomUUID();
+ const versioned = !(tx instanceof Transaction);
+ const serialized = Buffer.from(
+ tx instanceof Transaction
+ ? tx.serialize({ requireAllSignatures: false })
+ : tx.serialize(),
+ ).toString("base64");
+
+ this.pending.set(id, { id, transaction: serialized, versioned, createdAt: Date.now() });
+
+ return new Promise<T>((resolve, reject) => {
+ const timer = setTimeout(() => {
+ this.pending.delete(id);
+ reject(new Error(`Transaction ${id} timed out after ${this.timeoutMs}ms`));
+ }, this.timeoutMs);
+
+ this.emitter.once(`signed:${id}`, (signedBase64: string) => {
+ clearTimeout(timer);
+ this.pending.delete(id);
+ const buf = Buffer.from(signedBase64, "base64");
+ const signed = versioned
+ ? VersionedTransaction.deserialize(buf)
+ : Transaction.from(buf);
+ resolve(signed as T);
+ });
+
+ this.emitter.once(`rejected:${id}`, () => {
+ clearTimeout(timer);
+ this.pending.delete(id);
+ reject(new Error(`Transaction ${id} rejected by user`));
+ });
+ });
+ }
+
+ async signAndSendTransaction(tx: Transaction | VersionedTransaction, connection: Connection): Promise<string> {
+ const signed = await this.signTransaction(tx);
+ const sig = await connection.sendRawTransaction(signed.serialize(), { skipPreflight: false });
+ await connection.confirmTransaction(sig, "confirmed");
+ return sig;
+ }
+
+ getPending(): PendingTx[] {
+ return Array.from(this.pending.values());
+ }
+
+ submitSigned(txId: string, signedBase64: string): void {
+ this.emitter.emit(`signed:${txId}`, signedBase64);
+ }
+
+ submitRejected(txId: string): void {
+ this.emitter.emit(`rejected:${txId}`);
+ }
+
+ /**
+ * Returns a fetch-API Request handler. Mount it in your server:
+ *
+ * GET {base}/pending → list pending txs for browser to sign
+ * POST {base}/sign/:id → body: { signedTransaction: base64 }
+ * POST {base}/reject/:id → user rejected
+ */
+ createHandler(base = ""): (req: Request) => Promise<Response> {
+ return async (req: Request) => {
+ const url = new URL(req.url);
+ const path = url.pathname.replace(base, "").replace(/^\//, "");
+ const [action, id] = path.split("/");
+
+ if (req.method === "GET" && !action) {
+ return Response.json({ pending: this.getPending() });
+ }
+
+ if (req.method === "POST" && action === "sign" && id) {
+ const body = (await req.json()) as { signedTransaction: string };
+ this.submitSigned(id, body.signedTransaction);
+ return Response.json({ ok: true });
+ }
+
+ if (req.method === "POST" && action === "reject" && id) {
+ this.submitRejected(id);
+ return Response.json({ ok: true });
+ }
+
+ return new Response("Not found", { status: 404 });
+ };
+ }
+}
diff --git a/solana-agent-sdk/src/wallet/index.ts b/solana-agent-sdk/src/wallet/index.ts
new file mode 100644
index 000000000..a2a5944e9
--- /dev/null
+++ b/solana-agent-sdk/src/wallet/index.ts
@@ -0,0 +1,6 @@
+export type { WalletProvider } from "./types.js";
+export { KeypairWalletProvider } from "./keypair.js";
+export { BrowserWalletProvider } from "./browser-server.js";
+export type { BrowserWalletOptions, PendingTx } from "./browser-server.js";
+export { BrowserWalletClient } from "./browser-client.js";
+export type { SignerFn } from "./browser-client.js";
diff --git a/solana-agent-sdk/src/wallet/keypair.ts b/solana-agent-sdk/src/wallet/keypair.ts
new file mode 100644
index 000000000..4ee8b2f51
--- /dev/null
+++ b/solana-agent-sdk/src/wallet/keypair.ts
@@ -0,0 +1,44 @@
+import {
+ Keypair,
+ Transaction,
+ VersionedTransaction,
+ sendAndConfirmTransaction,
+ type Connection,
+} from "@solana/web3.js";
+import bs58 from "bs58";
+import type { WalletProvider } from "./types.js";
+
+export class KeypairWalletProvider implements WalletProvider {
+ private readonly keypair: Keypair;
+
+ constructor(privateKey: string | Uint8Array | number[]) {
+ if (typeof privateKey === "string") {
+ this.keypair = Keypair.fromSecretKey(bs58.decode(privateKey));
+ } else {
+ this.keypair = Keypair.fromSecretKey(Uint8Array.from(privateKey));
+ }
+ }
+
+ get publicKey() {
+ return this.keypair.publicKey;
+ }
+
+ async signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T> {
+ if (tx instanceof Transaction) {
+ tx.sign(this.keypair);
+ } else {
+ tx.sign([this.keypair]);
+ }
+ return tx;
+ }
+
+ async signAndSendTransaction(tx: Transaction | VersionedTransaction, connection: Connection): Promise<string> {
+ if (tx instanceof Transaction) {
+ return sendAndConfirmTransaction(connection, tx, [this.keypair]);
+ }
+ tx.sign([this.keypair]);
+ const sig = await connection.sendRawTransaction(tx.serialize(), { skipPreflight: false });
+ await connection.confirmTransaction(sig, "confirmed");
+ return sig;
+ }
+}
diff --git a/solana-agent-sdk/src/wallet/types.ts b/solana-agent-sdk/src/wallet/types.ts
new file mode 100644
index 000000000..0fb1152c2
--- /dev/null
+++ b/solana-agent-sdk/src/wallet/types.ts
@@ -0,0 +1,7 @@
+import type { Connection, PublicKey, Transaction, VersionedTransaction } from "@solana/web3.js";
+
+export interface WalletProvider {
+ readonly publicKey: PublicKey;
+ signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T>;
+ signAndSendTransaction(tx: Transaction | VersionedTransaction, connection: Connection): Promise<string>;
+}
diff --git a/solana-agent-sdk/tsconfig.json b/solana-agent-sdk/tsconfig.json
new file mode 100644
index 000000000..958f2625a
--- /dev/null
+++ b/solana-agent-sdk/tsconfig.json
@@ -0,0 +1,22 @@
+{
+ "compilerOptions": {
+ "target": "ES2020",
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "strict": true,
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "resolveJsonModule": true,
+ "declaration": true,
+ "declarationMap": true,
+ "sourceMap": true,
+ "outDir": "dist",
+ "rootDir": "src",
+ "noUncheckedIndexedAccess": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true
+ },
+ "include": ["src/**/*"],
+ "exclude": ["node_modules", "dist"]
+}
diff --git a/solana-agent-sdk/tsup.config.ts b/solana-agent-sdk/tsup.config.ts
new file mode 100644
index 000000000..0719caf1f
--- /dev/null
+++ b/solana-agent-sdk/tsup.config.ts
@@ -0,0 +1,14 @@
+import { defineConfig } from "tsup";
+
+export default defineConfig({
+ entry: [
+ "src/index.ts",
+ "src/wallet/index.ts",
+ "src/x402-exact/index.ts",
+ ],
+ format: ["cjs", "esm"],
+ dts: true,
+ clean: true,
+ sourcemap: true,
+ splitting: false,
+});