Skip to main content

Install via npm/bun

npm install @oneshot/sdk

Prerequisites

1

Private Key

Your agent needs a cryptographic private key.
2

Funds

Fund your wallet with compatible tokens on a supported chain.
3

Node.js

Version 18+ required.

Configuration

Basic Setup

import { OneShot } from '@oneshot/sdk';

const agent = new OneShot({
  privateKey: process.env.AGENT_PRIVATE_KEY
});

Advanced Configuration

const agent = new OneShot({
  privateKey: process.env.AGENT_PRIVATE_KEY
  // Automatically handles x402 payment flows
});

Environment Variables

Create a .env file:
AGENT_PRIVATE_KEY=0x...your_private_key
Never commit your private key to version control! Use environment variables or secure key management.

Verify Installation

Check your wallet address and balance:
import { OneShot } from '@oneshot/sdk';

const agent = new OneShot({
  privateKey: process.env.AGENT_PRIVATE_KEY
});

console.log('Agent address:', agent.address);

const balance = await agent.getBalance();
console.log('Wallet balance:', balance);

Configuration

The OneShot SDK can be configured for different environments and chains:
const agent = new OneShot({
  privateKey: process.env.AGENT_PRIVATE_KEY,
  baseUrl: 'https://win.oneshotagent.com', // Optional: override API endpoint
  rpcUrl: 'https://rpc.example.com'        // Optional: override RPC endpoint
});
OneShot follows the x402 philosophy: it is designed to be chain and wallet agnostic. The SDK handles the cryptographic signing required for payment authorizations automatically.

TypeScript Configuration

If using TypeScript, ensure your tsconfig.json includes:
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "commonjs",
    "esModuleInterop": true,
    "resolveJsonModule": true
  }
}

Next Steps

Examples

See complete code examples for email, research, and more