Use this first if you want to understand Oryn itself without any AI SDK in the way. One wallet acts as the sender agent, another as the recipient agent, and the payer sends USDC after both identities exist onchain.
import { OrynSDK } from "@oryn/sdk";
const payer = new OrynSDK({
contractAddress: process.env.ORYN_PAYMENT_CONTRACT_ADDRESS!,
usdcAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
chainId: 84532
});
const recipient = new OrynSDK({
contractAddress: process.env.ORYN_PAYMENT_CONTRACT_ADDRESS!,
usdcAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
chainId: 84532
});
await payer.connect(process.env.PRIVATE_KEY!, process.env.BASE_SEPOLIA_RPC_URL!);
await recipient.connect(process.env.RECIPIENT_PRIVATE_KEY!, process.env.BASE_SEPOLIA_RPC_URL!);
await payer.registerAgent("planner-agent-001");
await recipient.registerAgent("compute-agent-001");
const fee = await payer.estimateFee(0.5);
console.log("Estimated fee:", fee, "USDC");
const receipt = await payer.pay("planner-agent-001", "compute-agent-001", 0.5);
console.log("Payment confirmed:", receipt.hash);
Required env vars
BASE_SEPOLIA_RPC_URLfor Base Sepolia accessPRIVATE_KEYfor the payer walletRECIPIENT_PRIVATE_KEYfor the recipient walletORYN_PAYMENT_CONTRACT_ADDRESSfor the live Oryn contract
Wallet requirements
- Payer wallet needs Base Sepolia ETH for gas
- Payer wallet needs Base Sepolia USDC for the transfer
- Recipient wallet needs a little ETH for registration gas
- Use two separate wallets for a real first-run test
Expected output
You should see both wallets connect, the agent IDs register or get detected as already registered, a fee estimate print, and then a transaction hash from pay().
After the payment confirms, the recipient balance should increase and the payer balance should decrease by the sent amount plus any fee.