@starrohan/agentpay 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,147 @@
1
+ # AgentPay πŸ’ΈπŸ€–
2
+
3
+ Autonomous agent wallets with built-in spending policies for Ethereum. Let your AI agents pay β€” but never overspend.
4
+
5
+ ## What is AgentPay?
6
+
7
+ AgentPay gives every AI agent its own Ethereum wallet with **programmable spending limits**. Your agent can make payments autonomously, but policy rules prevent runaway spending.
8
+
9
+ ### Key Features
10
+
11
+ - πŸ€– **Autonomous Payments** β€” agents send ETH without human approval
12
+ - πŸ›‘οΈ **Spending Policies** β€” per-transaction caps, daily limits, address whitelists
13
+ - πŸ“Š **Transaction Tracking** β€” full history with memos, timestamps, and status
14
+ - ⚠️ **Large Payment Warnings** β€” configurable alerts for big transactions
15
+ - πŸ”§ **Fluent Policy Builder** β€” clean API for defining spending rules
16
+
17
+ ## Quickstart
18
+
19
+ ### 1. Install
20
+
21
+ ```bash
22
+ npm install @starrohan/agentpay
23
+ ```
24
+
25
+ ### 2. Create an Agent Wallet
26
+
27
+ ```ts
28
+ import { AgentWallet, policy } from "@starrohan/agentpay";
29
+
30
+ const agent = new AgentWallet({
31
+ privateKey: process.env.AGENT_PRIVATE_KEY!, // your wallet private key
32
+ agentId: "research-agent-01", // give your agent a name
33
+
34
+ policy: policy()
35
+ .maxTx(0.00005) // max 0.00005 ETH per transaction
36
+ .dailyLimit(0.0002) // max 0.0002 ETH per day total
37
+ .warnAbove(0.00003) // log warning for large payments
38
+ .build()
39
+ });
40
+ ```
41
+
42
+ ### 3. Check Balance
43
+
44
+ ```ts
45
+ const balance = await agent.balance();
46
+ console.log("Agent balance:", balance, "ETH");
47
+ ```
48
+
49
+ ### 4. Send a Payment
50
+
51
+ ```ts
52
+ const tx = await agent.pay({
53
+ to: "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
54
+ amount: 0.00001,
55
+ memo: "paying for weather API call"
56
+ });
57
+
58
+ console.log("Transaction:", tx.hash);
59
+ ```
60
+
61
+ ### 5. Policy Violations Are Caught
62
+
63
+ ```ts
64
+ try {
65
+ await agent.pay({
66
+ to: "0x71C7656EC7ab88b098defB751B7401B5f6d8976F",
67
+ amount: 99, // way over the maxTx limit!
68
+ memo: "this will be blocked"
69
+ });
70
+ } catch (err) {
71
+ console.log(err.message);
72
+ // [AgentPay] Policy violation: tx amount 99 ETH exceeds maxTxAmount 0.00005 ETH
73
+ }
74
+ ```
75
+
76
+ ### 6. View Summary & History
77
+
78
+ ```ts
79
+ await agent.summary();
80
+ // [AgentPay] ── research-agent-01 Summary ──
81
+ // Address: 0x5908...
82
+ // Balance: 0.000079 ETH
83
+ // Spent today: 0.00001 ETH
84
+ // Transactions: 1
85
+ // Daily limit: 0.0002 ETH (5.0% used)
86
+
87
+ const history = agent.history();
88
+ ```
89
+
90
+ ## Policy Builder API
91
+
92
+ ```ts
93
+ const rules = policy()
94
+ .maxTx(0.001) // max per single transaction (ETH)
95
+ .dailyLimit(0.01) // max total spend per day (ETH)
96
+ .allowOnly([ // whitelist of allowed recipient addresses
97
+ "0x1234...",
98
+ "0x5678..."
99
+ ])
100
+ .warnAbove(0.0005) // log warning if tx exceeds this amount
101
+ .build();
102
+ ```
103
+
104
+ | Method | Description |
105
+ |--------|-------------|
106
+ | `maxTx(amount)` | Maximum ETH per single transaction |
107
+ | `dailyLimit(amount)` | Maximum total ETH spent per day |
108
+ | `allowOnly(addresses)` | Only allow payments to these addresses |
109
+ | `warnAbove(amount)` | Log a warning for payments above this amount |
110
+
111
+ ## Running the Example
112
+
113
+ ```bash
114
+ # Clone the repo
115
+ git clone https://github.com/starrohan-dotcom/agentpay.git
116
+ cd agentpay
117
+
118
+ # Install dependencies
119
+ npm install
120
+
121
+ # Set your private key
122
+ export AGENT_PRIVATE_KEY=0xYOUR_PRIVATE_KEY
123
+
124
+ # Run the example
125
+ npx tsx example.ts
126
+ ```
127
+
128
+ ## Network
129
+
130
+ AgentPay currently runs on **Base Sepolia** testnet. Get free testnet ETH from:
131
+ - https://faucet.quicknode.com/base/sepolia
132
+ - https://www.coinbase.com/faucets/base-ethereum-goerli-faucet
133
+
134
+ ## Security
135
+
136
+ ⚠️ **Never commit your private key to git.** Always use environment variables:
137
+
138
+ ```ts
139
+ const agent = new AgentWallet({
140
+ privateKey: process.env.AGENT_PRIVATE_KEY!,
141
+ // ...
142
+ });
143
+ ```
144
+
145
+ ## License
146
+
147
+ MIT
@@ -0,0 +1,53 @@
1
+ import { type Hash, type Address } from "viem";
2
+ export interface SpendingPolicy {
3
+ maxTxAmount?: number;
4
+ dailyLimit?: number;
5
+ allowedAddresses?: Address[];
6
+ requireLogAbove?: number;
7
+ }
8
+ export interface PayOptions {
9
+ to: Address;
10
+ amount: number;
11
+ memo?: string;
12
+ }
13
+ export interface TxRecord {
14
+ hash: Hash;
15
+ to: Address;
16
+ amount: number;
17
+ memo?: string;
18
+ timestamp: Date;
19
+ status: "success" | "failed";
20
+ }
21
+ export interface WalletConfig {
22
+ privateKey: `0x${string}`;
23
+ agentId?: string;
24
+ policy?: SpendingPolicy;
25
+ rpcUrl?: string;
26
+ }
27
+ export declare class PolicyBuilder {
28
+ private rules;
29
+ maxTx(amount: number): PolicyBuilder;
30
+ dailyLimit(amount: number): PolicyBuilder;
31
+ allowOnly(addresses: Address[]): PolicyBuilder;
32
+ warnAbove(amount: number): PolicyBuilder;
33
+ build(): SpendingPolicy;
34
+ }
35
+ export declare const policy: () => PolicyBuilder;
36
+ export declare class AgentWallet {
37
+ private walletClient;
38
+ private publicClient;
39
+ private policy;
40
+ private txHistory;
41
+ private dailySpent;
42
+ private dayStart;
43
+ address: Address;
44
+ agentId: string;
45
+ constructor(config: WalletConfig);
46
+ private checkPolicy;
47
+ pay(opts: PayOptions): Promise<TxRecord>;
48
+ balance(): Promise<string>;
49
+ history(): TxRecord[];
50
+ dailySpentSoFar(): number;
51
+ summary(): Promise<void>;
52
+ }
53
+ //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;AAMhD,qBAAa,WAAW;IACtB,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAoB;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;gBAEX,MAAM,EAAE,YAAY;IAmBhC,OAAO,CAAC,WAAW;IAuDb,GAAG,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC;IAmDxC,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAQhC,OAAO,IAAI,QAAQ,EAAE;IAKrB,eAAe,IAAI,MAAM;IAKnB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAiB/B"}
@@ -0,0 +1,157 @@
1
+ import { createWalletClient, createPublicClient, http, parseEther, formatEther, } from "viem";
2
+ import { privateKeyToAccount } from "viem/accounts";
3
+ import { baseSepolia } from "viem/chains";
4
+ // ─────────────────────────────────────────────
5
+ // POLICY BUILDER β€” fluent API
6
+ // ─────────────────────────────────────────────
7
+ export class PolicyBuilder {
8
+ rules = {};
9
+ maxTx(amount) {
10
+ this.rules.maxTxAmount = amount;
11
+ return this;
12
+ }
13
+ dailyLimit(amount) {
14
+ this.rules.dailyLimit = amount;
15
+ return this;
16
+ }
17
+ allowOnly(addresses) {
18
+ this.rules.allowedAddresses = addresses;
19
+ return this;
20
+ }
21
+ warnAbove(amount) {
22
+ this.rules.requireLogAbove = amount;
23
+ return this;
24
+ }
25
+ build() {
26
+ return this.rules;
27
+ }
28
+ }
29
+ export const policy = () => new PolicyBuilder();
30
+ // ─────────────────────────────────────────────
31
+ // AGENT WALLET β€” main class
32
+ // ─────────────────────────────────────────────
33
+ export class AgentWallet {
34
+ walletClient;
35
+ publicClient;
36
+ policy;
37
+ txHistory = [];
38
+ dailySpent = 0;
39
+ dayStart = new Date();
40
+ address;
41
+ agentId;
42
+ constructor(config) {
43
+ const account = privateKeyToAccount(config.privateKey);
44
+ this.address = account.address;
45
+ this.agentId = config.agentId ?? "agent-" + account.address.slice(0, 6);
46
+ this.policy = config.policy ?? {};
47
+ this.walletClient = createWalletClient({
48
+ account,
49
+ chain: baseSepolia,
50
+ transport: http(config.rpcUrl ?? "https://sepolia.base.org"),
51
+ });
52
+ this.publicClient = createPublicClient({
53
+ chain: baseSepolia,
54
+ transport: http(config.rpcUrl ?? "https://sepolia.base.org"),
55
+ });
56
+ }
57
+ // ── Check spending policy before every payment ──
58
+ checkPolicy(to, amount) {
59
+ // Reset daily counter if new day
60
+ const now = new Date();
61
+ const hoursSinceDayStart = (now.getTime() - this.dayStart.getTime()) / (1000 * 60 * 60);
62
+ if (hoursSinceDayStart >= 24) {
63
+ this.dailySpent = 0;
64
+ this.dayStart = now;
65
+ }
66
+ // Max per transaction
67
+ if (this.policy.maxTxAmount !== undefined &&
68
+ amount > this.policy.maxTxAmount) {
69
+ throw new Error(`[AgentPay] Policy violation: tx amount ${amount} ETH exceeds maxTxAmount ${this.policy.maxTxAmount} ETH`);
70
+ }
71
+ // Daily limit
72
+ if (this.policy.dailyLimit !== undefined &&
73
+ this.dailySpent + amount > this.policy.dailyLimit) {
74
+ throw new Error(`[AgentPay] Policy violation: daily limit of ${this.policy.dailyLimit} ETH would be exceeded. Spent today: ${this.dailySpent} ETH`);
75
+ }
76
+ // Allowlist check
77
+ if (this.policy.allowedAddresses &&
78
+ this.policy.allowedAddresses.length > 0 &&
79
+ !this.policy.allowedAddresses
80
+ .map((a) => a.toLowerCase())
81
+ .includes(to.toLowerCase())) {
82
+ throw new Error(`[AgentPay] Policy violation: address ${to} is not in the allowed list`);
83
+ }
84
+ // Warn above threshold
85
+ if (this.policy.requireLogAbove !== undefined &&
86
+ amount > this.policy.requireLogAbove) {
87
+ console.warn(`[AgentPay] ⚠️ Large payment warning: ${amount} ETH to ${to}`);
88
+ }
89
+ }
90
+ // ── Send a payment ──
91
+ async pay(opts) {
92
+ const { to, amount, memo } = opts;
93
+ // Enforce policy
94
+ this.checkPolicy(to, amount);
95
+ console.log(`[AgentPay] ${this.agentId} paying ${amount} ETH to ${to}${memo ? ` (${memo})` : ""}...`);
96
+ let hash;
97
+ let status = "success";
98
+ try {
99
+ hash = await this.walletClient.sendTransaction({
100
+ to,
101
+ value: parseEther(amount.toString()),
102
+ });
103
+ // Wait for confirmation
104
+ await this.publicClient.waitForTransactionReceipt({ hash });
105
+ // Update daily spend tracker
106
+ this.dailySpent += amount;
107
+ console.log(`[AgentPay] βœ… Payment sent!`);
108
+ console.log(`[AgentPay] πŸ”— https://sepolia.basescan.org/tx/${hash}`);
109
+ }
110
+ catch (err) {
111
+ status = "failed";
112
+ hash = "0x0000000000000000000000000000000000000000000000000000000000000000";
113
+ console.error(`[AgentPay] ❌ Payment failed:`, err);
114
+ throw err;
115
+ }
116
+ const record = {
117
+ hash,
118
+ to,
119
+ amount,
120
+ memo,
121
+ timestamp: new Date(),
122
+ status,
123
+ };
124
+ this.txHistory.push(record);
125
+ return record;
126
+ }
127
+ // ── Get wallet balance ──
128
+ async balance() {
129
+ const raw = await this.publicClient.getBalance({
130
+ address: this.address,
131
+ });
132
+ return formatEther(raw);
133
+ }
134
+ // ── Get transaction history ──
135
+ history() {
136
+ return this.txHistory;
137
+ }
138
+ // ── Get daily spend so far ──
139
+ dailySpentSoFar() {
140
+ return this.dailySpent;
141
+ }
142
+ // ── Print a summary ──
143
+ async summary() {
144
+ const bal = await this.balance();
145
+ console.log(`\n[AgentPay] ── ${this.agentId} Summary ──`);
146
+ console.log(` Address: ${this.address}`);
147
+ console.log(` Balance: ${bal} ETH`);
148
+ console.log(` Spent today: ${this.dailySpent} ETH`);
149
+ console.log(` Transactions: ${this.txHistory.length}`);
150
+ if (this.policy.dailyLimit) {
151
+ console.log(` Daily limit: ${this.policy.dailyLimit} ETH (${((this.dailySpent / this.policy.dailyLimit) *
152
+ 100).toFixed(1)}% used)`);
153
+ }
154
+ console.log("");
155
+ }
156
+ }
157
+ //# sourceMappingURL=AgentWallet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentWallet.js","sourceRoot":"","sources":["../src/AgentWallet.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,IAAI,EACJ,UAAU,EACV,WAAW,GAGZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAmC1C,gDAAgD;AAChD,8BAA8B;AAC9B,gDAAgD;AAEhD,MAAM,OAAO,aAAa;IAChB,KAAK,GAAmB,EAAE,CAAC;IAEnC,KAAK,CAAC,MAAc;QAClB,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,UAAU,CAAC,MAAc;QACvB,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,SAAoB;QAC5B,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAAG,SAAS,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,SAAS,CAAC,MAAc;QACtB,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,MAAM,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK;QACH,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,aAAa,EAAE,CAAC;AAEhD,gDAAgD;AAChD,4BAA4B;AAC5B,gDAAgD;AAEhD,MAAM,OAAO,WAAW;IACd,YAAY,CAAM;IAClB,YAAY,CAAM;IAClB,MAAM,CAAiB;IACvB,SAAS,GAAe,EAAE,CAAC;IA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YAAY,CAAC,UAAU,CAAC;YAC7C,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC,CAAC;QACH,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED,gCAAgC;IAChC,OAAO;QACL,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,+BAA+B;IAC/B,eAAe;QACb,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,wBAAwB;IACxB,KAAK,CAAC,OAAO;QACX,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACjC,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,OAAO,aAAa,CAAC,CAAC;QAC1D,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,mBAAmB,GAAG,MAAM,CAAC,CAAC;QAC1C,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,UAAU,MAAM,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;QACxD,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YAC3B,OAAO,CAAC,GAAG,CACT,mBAAmB,IAAI,CAAC,MAAM,CAAC,UAAU,SAAS,CAChD,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;gBAC1C,GAAG,CACJ,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CACtB,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ export { AgentWallet, policy, PolicyBuilder } from "./AgentWallet.js";
2
+ export type { SpendingPolicy, PayOptions, TxRecord, WalletConfig } from "./AgentWallet.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { AgentWallet, policy, PolicyBuilder } from "./AgentWallet.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@starrohan/agentpay",
3
+ "version": "1.0.0",
4
+ "description": "Autonomous agent wallets with built-in spending policies for Ethereum",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "prepublishOnly": "npm run build",
21
+ "example": "tsx example.ts",
22
+ "test": "echo \"Error: no test specified\" && exit 1"
23
+ },
24
+ "keywords": [
25
+ "ethereum",
26
+ "agent",
27
+ "wallet",
28
+ "autonomous",
29
+ "spending",
30
+ "policy",
31
+ "viem",
32
+ "base",
33
+ "web3",
34
+ "crypto"
35
+ ],
36
+ "author": "",
37
+ "license": "MIT",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "https://github.com/starrohan-dotcom/agentpay.git"
41
+ },
42
+ "peerDependencies": {
43
+ "viem": "^2.0.0"
44
+ },
45
+ "devDependencies": {
46
+ "tsx": "^4.21.0",
47
+ "typescript": "^6.0.3",
48
+ "viem": "^2.48.8"
49
+ }
50
+ }