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.
Feature: Memo attachment to transactions
Context
/workspaces/3D-Agent/solana-agent-sdk is a TypeScript Solana agent SDK (@three-ws/solana-agent).
Build command: cd /workspaces/3D-Agent/solana-agent-sdk && npm run build
The build must pass with zero errors before this task is complete.
What to Build
The Solana Memo Program (MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr) allows attaching arbitrary UTF-8 text to any transaction. This is commonly used for tagging payments, adding notes, or including off-chain identifiers (e.g. invoice IDs, chat message IDs).
Implementation
src/utils/memo.ts
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
export const MEMO_PROGRAM_ID = new PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");
/**
* Build a Memo program instruction.
* The memo string will be visible in explorer and indexers.
* Max recommended length: 566 bytes (Solana transaction size limit).
*/
export function memoInstruction(memo: string, signerPublicKeys: PublicKey[] = []): TransactionInstruction {
const data = Buffer.from(memo, "utf-8");
return new TransactionInstruction({
keys: signerPublicKeys.map((pk) => ({ pubkey: pk, isSigner: true, isWritable: false })),
programId: MEMO_PROGRAM_ID,
data,
});
}
Add memo to BuildAndSendOptions
src/tx/build.ts — add optional memo to BuildAndSendOptions:
export interface BuildAndSendOptions {
priorityFee?: number;
cuLimit?: number;
maxRetries?: number;
meta?: TxMetadata;
lookupTables?: AddressLookupTableAccount[];
/**
* Optional UTF-8 memo string attached to the transaction.
* Visible in Solana Explorer and on-chain indexers.
*/
memo?: string;
}
In buildAndSend, if opts.memo is provided, add a memo instruction at the END of the instruction list (memo must be last per convention):
const allInstructions = opts.memo
? [...instructions, memoInstruction(opts.memo, [wallet.publicKey])]
: instructions;
Use allInstructions for CU estimation and transaction building.
Add memo parameter to transfer functions
src/actions/transfer-sol.ts — add memo?: string to TransferSolParams:
export interface TransferSolParams {
to: PublicKey | string;
amount: number;
memo?: string;
}
Pass through to buildAndSend opts:
return buildAndSend(wallet, connection, [ix], {
...opts,
memo: params.memo ?? opts?.memo,
meta: ...
});
src/actions/transfer-spl.ts — same, add memo?: string to TransferSplParams.
Add memo to LLM action schemas
src/solana-agent-kit/actions.ts — add optional memo to transferSolAction and transferSplAction schemas:
memo: z.string().max(500).optional().describe("Optional memo string attached to the transaction (visible on-chain)"),
Pass it through to the action params in the handler.
Export
src/utils/memo.ts — export memoInstruction and MEMO_PROGRAM_ID.
src/index.ts — add:
export { memoInstruction, MEMO_PROGRAM_ID } from "./utils/memo.js";
Verification
npm run buildpasses with zero errorsmemoInstructionandMEMO_PROGRAM_IDexported from main indexBuildAndSendOptions.memois optional (no breaking change)TransferSolParams.memoandTransferSplParams.memoare optional- LLM action schemas have optional
memofield - No new npm dependencies (Memo program is a Solana native program, no SDK needed)