@oneshot-agent/sdk 0.4.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 +199 -0
- package/dist/index.d.ts +331 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +417 -0
- package/dist/index.js.map +1 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# @oneshot/sdk
|
|
2
|
+
|
|
3
|
+
Autonomous Agent SDK for executing real-world commercial transactions with automatic x402 payments.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @oneshot/sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { OneShot } from '@oneshot/sdk';
|
|
15
|
+
|
|
16
|
+
const agent = new OneShot({
|
|
17
|
+
privateKey: process.env.AGENT_PRIVATE_KEY!
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Send email
|
|
21
|
+
await agent.email({
|
|
22
|
+
to: 'user@example.com',
|
|
23
|
+
subject: 'Hello',
|
|
24
|
+
body: 'Hello World!'
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Research
|
|
28
|
+
const report = await agent.research({ topic: 'AI agents', depth: 'deep' });
|
|
29
|
+
|
|
30
|
+
// Check balance
|
|
31
|
+
const balance = await agent.getBalance(agent.usdcAddress);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Test vs Production Mode
|
|
35
|
+
|
|
36
|
+
The SDK defaults to **test mode** for safety - no real money until you explicitly opt-in.
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
// Test mode (default) - Base Sepolia testnet
|
|
40
|
+
const agent = new OneShot({
|
|
41
|
+
privateKey: process.env.AGENT_PRIVATE_KEY!
|
|
42
|
+
});
|
|
43
|
+
agent.isTestMode; // true
|
|
44
|
+
agent.usdcAddress; // 0x036CbD53842c5426634e7929541eC2318f3dCF7e
|
|
45
|
+
agent.expectedChainId; // 84532
|
|
46
|
+
|
|
47
|
+
// Production mode - Base mainnet (real USDC)
|
|
48
|
+
const prodAgent = new OneShot({
|
|
49
|
+
privateKey: process.env.AGENT_PRIVATE_KEY!,
|
|
50
|
+
testMode: false
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Get testnet USDC from the [Circle Faucet](https://faucet.circle.com/).
|
|
55
|
+
|
|
56
|
+
## Available Methods
|
|
57
|
+
|
|
58
|
+
| Method | Description |
|
|
59
|
+
|--------|-------------|
|
|
60
|
+
| `email()` | Send emails with attachments |
|
|
61
|
+
| `research()` | Deep web research |
|
|
62
|
+
| `peopleSearch()` | Search people by criteria |
|
|
63
|
+
| `enrichProfile()` | Enrich from LinkedIn/email |
|
|
64
|
+
| `findEmail()` | Find email for a person |
|
|
65
|
+
| `verifyEmail()` | Verify email deliverability |
|
|
66
|
+
| `commerceBuy()` | Purchase products |
|
|
67
|
+
| `commerceSearch()` | Search products |
|
|
68
|
+
| `inboxList()` | List inbound emails |
|
|
69
|
+
| `inboxGet()` | Get email by ID |
|
|
70
|
+
| `getBalance()` | Check token balance |
|
|
71
|
+
|
|
72
|
+
## Configuration
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
interface OneShotConfig {
|
|
76
|
+
privateKey: string; // Required
|
|
77
|
+
testMode?: boolean; // Default: true (testnet)
|
|
78
|
+
baseUrl?: string; // Override API URL
|
|
79
|
+
rpcUrl?: string; // Override RPC URL
|
|
80
|
+
debug?: boolean; // Enable logging
|
|
81
|
+
logger?: (msg: string) => void;
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Tool Options
|
|
86
|
+
|
|
87
|
+
All methods accept these common options:
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
interface ToolOptions {
|
|
91
|
+
maxCost?: number; // Max USDC willing to pay
|
|
92
|
+
timeout?: number; // Timeout in seconds
|
|
93
|
+
signal?: AbortSignal; // For cancellation
|
|
94
|
+
wait?: boolean; // Wait for async jobs (default: true)
|
|
95
|
+
onStatusUpdate?: (status: string, requestId: string) => void;
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Error Handling
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
import { ValidationError, ToolError, JobError, JobTimeoutError } from '@oneshot/sdk';
|
|
103
|
+
|
|
104
|
+
try {
|
|
105
|
+
await agent.email({ to: '', subject: 'Test', body: 'Hello' });
|
|
106
|
+
} catch (error) {
|
|
107
|
+
if (error instanceof ValidationError) {
|
|
108
|
+
console.log(`Invalid: ${error.field}`);
|
|
109
|
+
} else if (error instanceof ToolError) {
|
|
110
|
+
console.log(`API error: ${error.statusCode}`);
|
|
111
|
+
} else if (error instanceof JobTimeoutError) {
|
|
112
|
+
console.log(`Timeout: ${error.jobId}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Examples
|
|
118
|
+
|
|
119
|
+
### Email with Attachments
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
await agent.email({
|
|
123
|
+
to: ['alice@example.com', 'bob@example.com'],
|
|
124
|
+
subject: 'Report',
|
|
125
|
+
body: 'See attached.',
|
|
126
|
+
attachments: [{
|
|
127
|
+
filename: 'report.pdf',
|
|
128
|
+
content: base64Content,
|
|
129
|
+
content_type: 'application/pdf'
|
|
130
|
+
}]
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### People Search & Enrichment
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
const results = await agent.peopleSearch({
|
|
138
|
+
job_titles: ['CEO', 'CTO'],
|
|
139
|
+
companies: ['Stripe'],
|
|
140
|
+
limit: 10
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const profile = await agent.enrichProfile({
|
|
144
|
+
linkedin_url: results.results[0].linkedin_url
|
|
145
|
+
});
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Commerce
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
const order = await agent.commerceBuy({
|
|
152
|
+
product_url: 'https://amazon.com/dp/B07ZPC9QD4',
|
|
153
|
+
shipping_address: {
|
|
154
|
+
first_name: 'John',
|
|
155
|
+
last_name: 'Doe',
|
|
156
|
+
street: '123 Main St',
|
|
157
|
+
city: 'San Francisco',
|
|
158
|
+
state: 'CA',
|
|
159
|
+
zip_code: '94102',
|
|
160
|
+
country: 'US',
|
|
161
|
+
phone: '4155550100'
|
|
162
|
+
},
|
|
163
|
+
maxCost: 100
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Cancellation
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
const controller = new AbortController();
|
|
171
|
+
setTimeout(() => controller.abort(), 30000);
|
|
172
|
+
|
|
173
|
+
try {
|
|
174
|
+
await agent.research({
|
|
175
|
+
topic: 'Long research',
|
|
176
|
+
signal: controller.signal
|
|
177
|
+
});
|
|
178
|
+
} catch (error) {
|
|
179
|
+
if (error.message === 'Operation cancelled') {
|
|
180
|
+
console.log('Cancelled');
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Environment Constants
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
import { TEST_ENV, PROD_ENV } from '@oneshot/sdk';
|
|
189
|
+
|
|
190
|
+
TEST_ENV.chainId; // 84532
|
|
191
|
+
TEST_ENV.usdcAddress; // 0x036CbD53842c5426634e7929541eC2318f3dCF7e
|
|
192
|
+
|
|
193
|
+
PROD_ENV.chainId; // 8453
|
|
194
|
+
PROD_ENV.usdcAddress; // 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## License
|
|
198
|
+
|
|
199
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
/** Test environment (Base Sepolia) - safe for development */
|
|
2
|
+
export declare const TEST_ENV: {
|
|
3
|
+
readonly baseUrl: "https://oneshot-api-stg-525492415644.us-central1.run.app";
|
|
4
|
+
readonly rpcUrl: "https://sepolia.base.org";
|
|
5
|
+
readonly chainId: 84532;
|
|
6
|
+
readonly usdcAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
|
|
7
|
+
};
|
|
8
|
+
/** Production environment (Base Mainnet) - real money */
|
|
9
|
+
export declare const PROD_ENV: {
|
|
10
|
+
readonly baseUrl: "https://win.oneshotagent.com";
|
|
11
|
+
readonly rpcUrl: "https://mainnet.base.org";
|
|
12
|
+
readonly chainId: 8453;
|
|
13
|
+
readonly usdcAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
14
|
+
};
|
|
15
|
+
export declare class OneShotError extends Error {
|
|
16
|
+
constructor(message: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class ToolError extends OneShotError {
|
|
19
|
+
readonly statusCode: number;
|
|
20
|
+
readonly responseBody: string;
|
|
21
|
+
constructor(message: string, statusCode: number, responseBody: string);
|
|
22
|
+
}
|
|
23
|
+
export declare class JobError extends OneShotError {
|
|
24
|
+
readonly jobId: string;
|
|
25
|
+
readonly jobError: string;
|
|
26
|
+
constructor(message: string, jobId: string, jobError: string);
|
|
27
|
+
}
|
|
28
|
+
export declare class JobTimeoutError extends OneShotError {
|
|
29
|
+
readonly jobId: string;
|
|
30
|
+
readonly elapsedMs: number;
|
|
31
|
+
constructor(jobId: string, elapsedMs: number);
|
|
32
|
+
}
|
|
33
|
+
export declare class ValidationError extends OneShotError {
|
|
34
|
+
readonly field: string;
|
|
35
|
+
constructor(message: string, field: string);
|
|
36
|
+
}
|
|
37
|
+
export interface TokenInfo {
|
|
38
|
+
address: string;
|
|
39
|
+
symbol: string;
|
|
40
|
+
decimals: number;
|
|
41
|
+
}
|
|
42
|
+
export interface PaymentInfo {
|
|
43
|
+
protocol: 'x402';
|
|
44
|
+
network: string;
|
|
45
|
+
payTo: string;
|
|
46
|
+
amount: string;
|
|
47
|
+
currency: string;
|
|
48
|
+
facilitator_url: string;
|
|
49
|
+
token: TokenInfo;
|
|
50
|
+
context?: Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
export interface PaymentAuthorization {
|
|
53
|
+
from: string;
|
|
54
|
+
to: string;
|
|
55
|
+
value: string;
|
|
56
|
+
validAfter: number;
|
|
57
|
+
validBefore: number;
|
|
58
|
+
nonce: string;
|
|
59
|
+
signature: {
|
|
60
|
+
v: number;
|
|
61
|
+
r: string;
|
|
62
|
+
s: string;
|
|
63
|
+
};
|
|
64
|
+
network: string;
|
|
65
|
+
token: string;
|
|
66
|
+
}
|
|
67
|
+
export type LoggerFn = (message: string) => void;
|
|
68
|
+
export type StatusUpdateFn = (status: string, requestId: string) => void;
|
|
69
|
+
export interface OneShotConfig {
|
|
70
|
+
/** Private key for the agent's wallet (required) */
|
|
71
|
+
privateKey: string;
|
|
72
|
+
/** Test mode uses staging API + testnet (default: true) */
|
|
73
|
+
testMode?: boolean;
|
|
74
|
+
/** Override API URL */
|
|
75
|
+
baseUrl?: string;
|
|
76
|
+
/** Override RPC URL */
|
|
77
|
+
rpcUrl?: string;
|
|
78
|
+
/** Enable debug logging */
|
|
79
|
+
debug?: boolean;
|
|
80
|
+
/** Custom logger function */
|
|
81
|
+
logger?: LoggerFn;
|
|
82
|
+
}
|
|
83
|
+
export interface ToolOptions {
|
|
84
|
+
maxCost?: number;
|
|
85
|
+
timeout?: number;
|
|
86
|
+
signal?: AbortSignal;
|
|
87
|
+
onStatusUpdate?: StatusUpdateFn;
|
|
88
|
+
wait?: boolean;
|
|
89
|
+
}
|
|
90
|
+
export interface EmailToolOptions extends ToolOptions {
|
|
91
|
+
to: string | string[];
|
|
92
|
+
subject: string;
|
|
93
|
+
body: string;
|
|
94
|
+
from_domain?: string;
|
|
95
|
+
attachments?: Array<{
|
|
96
|
+
filename?: string;
|
|
97
|
+
content?: string;
|
|
98
|
+
url?: string;
|
|
99
|
+
content_type?: string;
|
|
100
|
+
}>;
|
|
101
|
+
}
|
|
102
|
+
export interface ResearchToolOptions extends ToolOptions {
|
|
103
|
+
topic: string;
|
|
104
|
+
depth?: 'deep' | 'quick';
|
|
105
|
+
max_sources?: number;
|
|
106
|
+
output_format?: 'report_markdown' | 'structured_json';
|
|
107
|
+
}
|
|
108
|
+
export interface PeopleSearchOptions extends ToolOptions {
|
|
109
|
+
job_titles?: string[];
|
|
110
|
+
keywords?: string[];
|
|
111
|
+
companies?: string[];
|
|
112
|
+
location?: string[];
|
|
113
|
+
skills?: string[];
|
|
114
|
+
seniority?: string[];
|
|
115
|
+
industry?: string[];
|
|
116
|
+
company_size?: string;
|
|
117
|
+
limit?: number;
|
|
118
|
+
}
|
|
119
|
+
export interface EnrichProfileOptions extends ToolOptions {
|
|
120
|
+
linkedin_url?: string;
|
|
121
|
+
email?: string;
|
|
122
|
+
name?: string;
|
|
123
|
+
company_domain?: string;
|
|
124
|
+
}
|
|
125
|
+
export interface FindEmailOptions extends ToolOptions {
|
|
126
|
+
full_name?: string;
|
|
127
|
+
first_name?: string;
|
|
128
|
+
last_name?: string;
|
|
129
|
+
company_domain: string;
|
|
130
|
+
}
|
|
131
|
+
export interface VerifyEmailOptions extends ToolOptions {
|
|
132
|
+
email: string;
|
|
133
|
+
}
|
|
134
|
+
export interface InboxListOptions {
|
|
135
|
+
since?: string;
|
|
136
|
+
limit?: number;
|
|
137
|
+
include_body?: boolean;
|
|
138
|
+
}
|
|
139
|
+
export interface ShippingAddress {
|
|
140
|
+
first_name: string;
|
|
141
|
+
last_name: string;
|
|
142
|
+
street: string;
|
|
143
|
+
street2?: string;
|
|
144
|
+
city: string;
|
|
145
|
+
state: string;
|
|
146
|
+
zip_code: string;
|
|
147
|
+
country?: string;
|
|
148
|
+
email?: string;
|
|
149
|
+
phone: string;
|
|
150
|
+
}
|
|
151
|
+
export interface CommerceBuyOptions extends ToolOptions {
|
|
152
|
+
product_url: string;
|
|
153
|
+
shipping_address: ShippingAddress;
|
|
154
|
+
quantity?: number;
|
|
155
|
+
variant_id?: string;
|
|
156
|
+
}
|
|
157
|
+
export interface CommerceSearchOptions extends ToolOptions {
|
|
158
|
+
query: string;
|
|
159
|
+
limit?: number;
|
|
160
|
+
}
|
|
161
|
+
export interface Experience {
|
|
162
|
+
company?: {
|
|
163
|
+
name?: string;
|
|
164
|
+
website?: string;
|
|
165
|
+
};
|
|
166
|
+
title?: {
|
|
167
|
+
name?: string;
|
|
168
|
+
};
|
|
169
|
+
start_date?: string;
|
|
170
|
+
end_date?: string;
|
|
171
|
+
is_primary?: boolean;
|
|
172
|
+
}
|
|
173
|
+
export interface Education {
|
|
174
|
+
school?: {
|
|
175
|
+
name?: string;
|
|
176
|
+
};
|
|
177
|
+
degrees?: string[];
|
|
178
|
+
majors?: string[];
|
|
179
|
+
start_date?: string;
|
|
180
|
+
end_date?: string;
|
|
181
|
+
}
|
|
182
|
+
export interface PersonResult {
|
|
183
|
+
full_name?: string;
|
|
184
|
+
first_name?: string;
|
|
185
|
+
last_name?: string;
|
|
186
|
+
title?: string;
|
|
187
|
+
company?: string;
|
|
188
|
+
company_domain?: string;
|
|
189
|
+
linkedin_url?: string;
|
|
190
|
+
location?: string;
|
|
191
|
+
email?: string;
|
|
192
|
+
phone?: string;
|
|
193
|
+
summary?: string;
|
|
194
|
+
skills?: string[];
|
|
195
|
+
experience?: Experience[];
|
|
196
|
+
education?: Education[];
|
|
197
|
+
}
|
|
198
|
+
export interface PeopleSearchResult {
|
|
199
|
+
status: string;
|
|
200
|
+
results: PersonResult[];
|
|
201
|
+
total_found: number;
|
|
202
|
+
provider: string;
|
|
203
|
+
completed_at: string;
|
|
204
|
+
}
|
|
205
|
+
export interface ResearchResult {
|
|
206
|
+
report_content: string;
|
|
207
|
+
sources: Array<{
|
|
208
|
+
url: string;
|
|
209
|
+
title?: string;
|
|
210
|
+
}>;
|
|
211
|
+
sources_count: number;
|
|
212
|
+
topic: string;
|
|
213
|
+
depth: string;
|
|
214
|
+
workspace: string;
|
|
215
|
+
report_path: string;
|
|
216
|
+
completed_at: string;
|
|
217
|
+
report_gcs_uri: string;
|
|
218
|
+
}
|
|
219
|
+
export interface EmailResult {
|
|
220
|
+
success: boolean;
|
|
221
|
+
message_id?: string;
|
|
222
|
+
job_id?: string;
|
|
223
|
+
}
|
|
224
|
+
export interface EnrichProfileResult {
|
|
225
|
+
status: string;
|
|
226
|
+
profile: PersonResult;
|
|
227
|
+
provider: string;
|
|
228
|
+
}
|
|
229
|
+
export interface FindEmailResult {
|
|
230
|
+
status: string;
|
|
231
|
+
email: string | null;
|
|
232
|
+
found: boolean;
|
|
233
|
+
provider: string;
|
|
234
|
+
}
|
|
235
|
+
export interface AsyncJobResult {
|
|
236
|
+
request_id: string;
|
|
237
|
+
status: string;
|
|
238
|
+
}
|
|
239
|
+
export interface VerifyEmailResult {
|
|
240
|
+
status: string;
|
|
241
|
+
email: string;
|
|
242
|
+
deliverable: boolean;
|
|
243
|
+
reason?: string;
|
|
244
|
+
provider: string;
|
|
245
|
+
}
|
|
246
|
+
export interface InboxEmail {
|
|
247
|
+
id: string;
|
|
248
|
+
from: string;
|
|
249
|
+
subject: string;
|
|
250
|
+
received_at: string;
|
|
251
|
+
thread_id?: string;
|
|
252
|
+
body?: string;
|
|
253
|
+
body_html?: string;
|
|
254
|
+
attachments?: Array<{
|
|
255
|
+
filename: string;
|
|
256
|
+
content_type: string;
|
|
257
|
+
size: number;
|
|
258
|
+
content?: string;
|
|
259
|
+
}>;
|
|
260
|
+
}
|
|
261
|
+
export interface InboxListResult {
|
|
262
|
+
emails: InboxEmail[];
|
|
263
|
+
count: number;
|
|
264
|
+
has_more: boolean;
|
|
265
|
+
agent_id: string;
|
|
266
|
+
}
|
|
267
|
+
export interface CommerceQuote {
|
|
268
|
+
quote_id: string;
|
|
269
|
+
product_title: string;
|
|
270
|
+
subtotal: string;
|
|
271
|
+
shipping: string;
|
|
272
|
+
tax: string;
|
|
273
|
+
fee: string;
|
|
274
|
+
total: string;
|
|
275
|
+
}
|
|
276
|
+
export interface CommerceBuyResult {
|
|
277
|
+
request_id: string;
|
|
278
|
+
status: string;
|
|
279
|
+
product?: {
|
|
280
|
+
title: string;
|
|
281
|
+
total_charged: string;
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
export interface CommerceSearchResult {
|
|
285
|
+
request_id: string;
|
|
286
|
+
status: string;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* OneShot Agent SDK - Execute commercial transactions with automatic x402 payments.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```typescript
|
|
293
|
+
* const agent = new OneShot({ privateKey: process.env.AGENT_PRIVATE_KEY });
|
|
294
|
+
* await agent.email({ to: 'user@example.com', subject: 'Hi', body: 'Hello' });
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
export declare class OneShot {
|
|
298
|
+
private readonly wallet;
|
|
299
|
+
private readonly baseUrl;
|
|
300
|
+
private readonly debug;
|
|
301
|
+
private readonly logger;
|
|
302
|
+
private readonly _testMode;
|
|
303
|
+
private readonly _expectedChainId;
|
|
304
|
+
private readonly _usdcAddress;
|
|
305
|
+
constructor(config: OneShotConfig);
|
|
306
|
+
get address(): string;
|
|
307
|
+
get isTestMode(): boolean;
|
|
308
|
+
get usdcAddress(): string;
|
|
309
|
+
get expectedChainId(): number;
|
|
310
|
+
tool<T = unknown>(toolName: string, options: ToolOptions & Record<string, unknown>): Promise<T>;
|
|
311
|
+
email(options: EmailToolOptions): Promise<EmailResult>;
|
|
312
|
+
research(options: ResearchToolOptions): Promise<ResearchResult>;
|
|
313
|
+
peopleSearch(options: PeopleSearchOptions): Promise<PeopleSearchResult>;
|
|
314
|
+
enrichProfile(options: EnrichProfileOptions): Promise<EnrichProfileResult>;
|
|
315
|
+
findEmail(options: FindEmailOptions): Promise<FindEmailResult>;
|
|
316
|
+
verifyEmail(options: VerifyEmailOptions): Promise<VerifyEmailResult>;
|
|
317
|
+
inboxList(options?: InboxListOptions): Promise<InboxListResult>;
|
|
318
|
+
inboxGet(emailId: string): Promise<InboxEmail>;
|
|
319
|
+
commerceBuy(options: CommerceBuyOptions): Promise<CommerceBuyResult>;
|
|
320
|
+
commerceSearch(options: CommerceSearchOptions): Promise<CommerceSearchResult>;
|
|
321
|
+
getBalance(tokenAddress: string): Promise<string>;
|
|
322
|
+
private log;
|
|
323
|
+
private validate;
|
|
324
|
+
private headers;
|
|
325
|
+
private executeToolRequest;
|
|
326
|
+
private pollJob;
|
|
327
|
+
private sleep;
|
|
328
|
+
private makeRequest;
|
|
329
|
+
private signPaymentAuthorization;
|
|
330
|
+
}
|
|
331
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,6DAA6D;AAC7D,eAAO,MAAM,QAAQ;;;;;CAKX,CAAC;AAEX,yDAAyD;AACzD,eAAO,MAAM,QAAQ;;;;;CAKX,CAAC;AAMX,qBAAa,YAAa,SAAQ,KAAK;gBACzB,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,SAAU,SAAQ,YAAY;aAGvB,UAAU,EAAE,MAAM;aAClB,YAAY,EAAE,MAAM;gBAFpC,OAAO,EAAE,MAAM,EACC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM;CAKvC;AAED,qBAAa,QAAS,SAAQ,YAAY;aAGtB,KAAK,EAAE,MAAM;aACb,QAAQ,EAAE,MAAM;gBAFhC,OAAO,EAAE,MAAM,EACC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM;CAKnC;AAED,qBAAa,eAAgB,SAAQ,YAAY;aAE7B,KAAK,EAAE,MAAM;aACb,SAAS,EAAE,MAAM;gBADjB,KAAK,EAAE,MAAM,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,GAAG,OAAO,CAAC,UAAU,CAAC;IAgB9C,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAsDpE,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAK7E,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAqBvD,OAAO,CAAC,GAAG;IAIX,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,OAAO;YAOD,kBAAkB;YAwClB,OAAO;IAwDrB,OAAO,CAAC,KAAK;YAiBC,WAAW;YAuBX,wBAAwB;CA0DvC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OneShot = exports.ValidationError = exports.JobTimeoutError = exports.JobError = exports.ToolError = exports.OneShotError = exports.PROD_ENV = exports.TEST_ENV = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const SDK_VERSION = '0.4.0';
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// Environment Configuration
|
|
8
|
+
// ============================================================================
|
|
9
|
+
/** Test environment (Base Sepolia) - safe for development */
|
|
10
|
+
exports.TEST_ENV = {
|
|
11
|
+
baseUrl: 'https://oneshot-api-stg-525492415644.us-central1.run.app',
|
|
12
|
+
rpcUrl: 'https://sepolia.base.org',
|
|
13
|
+
chainId: 84532,
|
|
14
|
+
usdcAddress: '0x036CbD53842c5426634e7929541eC2318f3dCF7e'
|
|
15
|
+
};
|
|
16
|
+
/** Production environment (Base Mainnet) - real money */
|
|
17
|
+
exports.PROD_ENV = {
|
|
18
|
+
baseUrl: 'https://win.oneshotagent.com',
|
|
19
|
+
rpcUrl: 'https://mainnet.base.org',
|
|
20
|
+
chainId: 8453,
|
|
21
|
+
usdcAddress: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
|
|
22
|
+
};
|
|
23
|
+
// ============================================================================
|
|
24
|
+
// Error Classes
|
|
25
|
+
// ============================================================================
|
|
26
|
+
class OneShotError extends Error {
|
|
27
|
+
constructor(message) {
|
|
28
|
+
super(message);
|
|
29
|
+
this.name = 'OneShotError';
|
|
30
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.OneShotError = OneShotError;
|
|
34
|
+
class ToolError extends OneShotError {
|
|
35
|
+
constructor(message, statusCode, responseBody) {
|
|
36
|
+
super(message);
|
|
37
|
+
this.statusCode = statusCode;
|
|
38
|
+
this.responseBody = responseBody;
|
|
39
|
+
this.name = 'ToolError';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.ToolError = ToolError;
|
|
43
|
+
class JobError extends OneShotError {
|
|
44
|
+
constructor(message, jobId, jobError) {
|
|
45
|
+
super(message);
|
|
46
|
+
this.jobId = jobId;
|
|
47
|
+
this.jobError = jobError;
|
|
48
|
+
this.name = 'JobError';
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.JobError = JobError;
|
|
52
|
+
class JobTimeoutError extends OneShotError {
|
|
53
|
+
constructor(jobId, elapsedMs) {
|
|
54
|
+
super(`Job ${jobId} timed out after ${elapsedMs / 1000}s`);
|
|
55
|
+
this.jobId = jobId;
|
|
56
|
+
this.elapsedMs = elapsedMs;
|
|
57
|
+
this.name = 'JobTimeoutError';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.JobTimeoutError = JobTimeoutError;
|
|
61
|
+
class ValidationError extends OneShotError {
|
|
62
|
+
constructor(message, field) {
|
|
63
|
+
super(message);
|
|
64
|
+
this.field = field;
|
|
65
|
+
this.name = 'ValidationError';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.ValidationError = ValidationError;
|
|
69
|
+
// ============================================================================
|
|
70
|
+
// OneShot SDK
|
|
71
|
+
// ============================================================================
|
|
72
|
+
/**
|
|
73
|
+
* OneShot Agent SDK - Execute commercial transactions with automatic x402 payments.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* const agent = new OneShot({ privateKey: process.env.AGENT_PRIVATE_KEY });
|
|
78
|
+
* await agent.email({ to: 'user@example.com', subject: 'Hi', body: 'Hello' });
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
class OneShot {
|
|
82
|
+
constructor(config) {
|
|
83
|
+
if (!config.privateKey) {
|
|
84
|
+
throw new ValidationError('privateKey is required', 'privateKey');
|
|
85
|
+
}
|
|
86
|
+
this._testMode = config.testMode ?? true;
|
|
87
|
+
const env = this._testMode ? exports.TEST_ENV : exports.PROD_ENV;
|
|
88
|
+
this.baseUrl = config.baseUrl ?? env.baseUrl;
|
|
89
|
+
this._expectedChainId = env.chainId;
|
|
90
|
+
this._usdcAddress = env.usdcAddress;
|
|
91
|
+
this.debug = config.debug ?? false;
|
|
92
|
+
this.logger = config.logger ?? console.log;
|
|
93
|
+
const provider = new ethers_1.ethers.JsonRpcProvider(config.rpcUrl ?? env.rpcUrl);
|
|
94
|
+
this.wallet = new ethers_1.ethers.Wallet(config.privateKey, provider);
|
|
95
|
+
if (this.debug) {
|
|
96
|
+
this.log(`SDK initialized [${this._testMode ? 'TEST' : 'PROD'}] chain=${this._expectedChainId}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
// Public getters
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
get address() {
|
|
103
|
+
return this.wallet.address;
|
|
104
|
+
}
|
|
105
|
+
get isTestMode() {
|
|
106
|
+
return this._testMode;
|
|
107
|
+
}
|
|
108
|
+
get usdcAddress() {
|
|
109
|
+
return this._usdcAddress;
|
|
110
|
+
}
|
|
111
|
+
get expectedChainId() {
|
|
112
|
+
return this._expectedChainId;
|
|
113
|
+
}
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
// Public methods
|
|
116
|
+
// ---------------------------------------------------------------------------
|
|
117
|
+
async tool(toolName, options) {
|
|
118
|
+
return this.executeToolRequest(`/v1/tools/${toolName}`, options);
|
|
119
|
+
}
|
|
120
|
+
async email(options) {
|
|
121
|
+
this.validate(options.to, 'to');
|
|
122
|
+
this.validate(options.subject, 'subject');
|
|
123
|
+
this.validate(options.body, 'body');
|
|
124
|
+
const fromAddress = `agent@${options.from_domain ?? 'oneshotagent.com'}`;
|
|
125
|
+
const quote = await this.tool('email/quote', {
|
|
126
|
+
from_address: fromAddress,
|
|
127
|
+
to_address: options.to,
|
|
128
|
+
subject: options.subject,
|
|
129
|
+
body: options.body
|
|
130
|
+
});
|
|
131
|
+
this.log(`Email quote: $${quote.total_cost}`);
|
|
132
|
+
const payload = {
|
|
133
|
+
from_address: fromAddress,
|
|
134
|
+
to_address: options.to,
|
|
135
|
+
subject: options.subject,
|
|
136
|
+
body: options.body,
|
|
137
|
+
signal: options.signal,
|
|
138
|
+
onStatusUpdate: options.onStatusUpdate,
|
|
139
|
+
wait: options.wait
|
|
140
|
+
};
|
|
141
|
+
if (options.attachments?.length) {
|
|
142
|
+
payload.attachments = options.attachments;
|
|
143
|
+
}
|
|
144
|
+
return this.executeToolRequest('/v1/tools/email/send', payload, quote.quote_id);
|
|
145
|
+
}
|
|
146
|
+
async research(options) {
|
|
147
|
+
this.validate(options.topic, 'topic');
|
|
148
|
+
return this.tool('research', { ...options });
|
|
149
|
+
}
|
|
150
|
+
async peopleSearch(options) {
|
|
151
|
+
return this.tool('research/people', { ...options, limit: options.limit ?? 100 });
|
|
152
|
+
}
|
|
153
|
+
async enrichProfile(options) {
|
|
154
|
+
if (!options.linkedin_url && !options.email && !options.name) {
|
|
155
|
+
throw new ValidationError('At least one of linkedin_url, email, or name is required', 'identifier');
|
|
156
|
+
}
|
|
157
|
+
return this.tool('enrich/profile', { ...options });
|
|
158
|
+
}
|
|
159
|
+
async findEmail(options) {
|
|
160
|
+
this.validate(options.company_domain, 'company_domain');
|
|
161
|
+
if (!options.full_name && !(options.first_name && options.last_name)) {
|
|
162
|
+
throw new ValidationError('Either full_name or both first_name and last_name required', 'name');
|
|
163
|
+
}
|
|
164
|
+
return this.tool('enrich/email', { ...options });
|
|
165
|
+
}
|
|
166
|
+
async verifyEmail(options) {
|
|
167
|
+
this.validate(options.email, 'email');
|
|
168
|
+
return this.tool('verify/email', { ...options });
|
|
169
|
+
}
|
|
170
|
+
async inboxList(options = {}) {
|
|
171
|
+
const params = new URLSearchParams();
|
|
172
|
+
if (options.since)
|
|
173
|
+
params.set('since', options.since);
|
|
174
|
+
if (options.limit)
|
|
175
|
+
params.set('limit', String(options.limit));
|
|
176
|
+
if (options.include_body)
|
|
177
|
+
params.set('include_body', 'true');
|
|
178
|
+
const qs = params.toString();
|
|
179
|
+
const response = await fetch(`${this.baseUrl}/v1/tools/inbox${qs ? `?${qs}` : ''}`, {
|
|
180
|
+
headers: this.headers()
|
|
181
|
+
});
|
|
182
|
+
if (!response.ok) {
|
|
183
|
+
throw new ToolError('Failed to list inbox', response.status, await response.text());
|
|
184
|
+
}
|
|
185
|
+
return response.json();
|
|
186
|
+
}
|
|
187
|
+
async inboxGet(emailId) {
|
|
188
|
+
this.validate(emailId, 'emailId');
|
|
189
|
+
const response = await fetch(`${this.baseUrl}/v1/tools/inbox/${emailId}`, {
|
|
190
|
+
headers: this.headers()
|
|
191
|
+
});
|
|
192
|
+
if (response.status === 404) {
|
|
193
|
+
throw new ToolError('Email not found', 404, 'Email not found');
|
|
194
|
+
}
|
|
195
|
+
if (!response.ok) {
|
|
196
|
+
throw new ToolError('Failed to get email', response.status, await response.text());
|
|
197
|
+
}
|
|
198
|
+
return response.json();
|
|
199
|
+
}
|
|
200
|
+
async commerceBuy(options) {
|
|
201
|
+
this.validate(options.product_url, 'product_url');
|
|
202
|
+
this.validate(options.shipping_address, 'shipping_address');
|
|
203
|
+
this.validate(options.shipping_address?.phone, 'shipping_address.phone');
|
|
204
|
+
const payload = {
|
|
205
|
+
product_url: options.product_url,
|
|
206
|
+
shipping_address: options.shipping_address,
|
|
207
|
+
quantity: options.quantity ?? 1,
|
|
208
|
+
variant_id: options.variant_id
|
|
209
|
+
};
|
|
210
|
+
const quoteResp = await this.makeRequest('/v1/tools/commerce/buy', payload, undefined, undefined, options.signal);
|
|
211
|
+
if (quoteResp.status !== 402) {
|
|
212
|
+
throw new ToolError('Expected 402 for quote', quoteResp.status, await quoteResp.text());
|
|
213
|
+
}
|
|
214
|
+
const quoteData = await quoteResp.json();
|
|
215
|
+
this.log(`Commerce quote: $${quoteData.context.total} for "${quoteData.context.product_title}"`);
|
|
216
|
+
if (options.maxCost && parseFloat(quoteData.context.total) > options.maxCost) {
|
|
217
|
+
throw new OneShotError(`Quote $${quoteData.context.total} exceeds maxCost $${options.maxCost}`);
|
|
218
|
+
}
|
|
219
|
+
const paymentInfo = {
|
|
220
|
+
protocol: 'x402',
|
|
221
|
+
network: `eip155:${quoteData.payment_request.chain_id}`,
|
|
222
|
+
payTo: quoteData.payment_request.recipient,
|
|
223
|
+
amount: quoteData.payment_request.amount,
|
|
224
|
+
currency: 'USD',
|
|
225
|
+
facilitator_url: this.baseUrl,
|
|
226
|
+
token: { address: quoteData.payment_request.token_address, symbol: 'USDC', decimals: 6 }
|
|
227
|
+
};
|
|
228
|
+
const auth = await this.signPaymentAuthorization(paymentInfo);
|
|
229
|
+
const buyResp = await this.makeRequest('/v1/tools/commerce/buy', payload, auth, quoteData.context.quote_id, options.signal);
|
|
230
|
+
if (buyResp.status !== 202) {
|
|
231
|
+
throw new ToolError('Commerce buy failed', buyResp.status, await buyResp.text());
|
|
232
|
+
}
|
|
233
|
+
const result = await buyResp.json();
|
|
234
|
+
this.log(`Order submitted: ${result.request_id}`);
|
|
235
|
+
if (options.wait !== false && result.request_id) {
|
|
236
|
+
return this.pollJob(result.request_id, options.timeout, options.signal, options.onStatusUpdate);
|
|
237
|
+
}
|
|
238
|
+
return result;
|
|
239
|
+
}
|
|
240
|
+
async commerceSearch(options) {
|
|
241
|
+
this.validate(options.query, 'query');
|
|
242
|
+
return this.tool('commerce/search', { ...options, limit: options.limit ?? 10 });
|
|
243
|
+
}
|
|
244
|
+
async getBalance(tokenAddress) {
|
|
245
|
+
this.validate(tokenAddress, 'tokenAddress');
|
|
246
|
+
const contract = new ethers_1.ethers.Contract(tokenAddress, ['function balanceOf(address) view returns (uint256)', 'function decimals() view returns (uint8)'], this.wallet);
|
|
247
|
+
const [balance, decimals] = await Promise.all([
|
|
248
|
+
contract.balanceOf(this.wallet.address),
|
|
249
|
+
contract.decimals()
|
|
250
|
+
]);
|
|
251
|
+
return ethers_1.ethers.formatUnits(balance, decimals);
|
|
252
|
+
}
|
|
253
|
+
// ---------------------------------------------------------------------------
|
|
254
|
+
// Private helpers
|
|
255
|
+
// ---------------------------------------------------------------------------
|
|
256
|
+
log(msg) {
|
|
257
|
+
if (this.debug)
|
|
258
|
+
this.logger(`[OneShot] ${msg}`);
|
|
259
|
+
}
|
|
260
|
+
validate(value, field) {
|
|
261
|
+
if (!value)
|
|
262
|
+
throw new ValidationError(`${field} is required`, field);
|
|
263
|
+
}
|
|
264
|
+
headers() {
|
|
265
|
+
return {
|
|
266
|
+
'X-Agent-ID': this.wallet.address,
|
|
267
|
+
'X-OneShot-SDK-Version': SDK_VERSION
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
async executeToolRequest(endpoint, options, quoteId) {
|
|
271
|
+
const { signal, onStatusUpdate, wait = true, ...payload } = options;
|
|
272
|
+
if (signal?.aborted) {
|
|
273
|
+
throw new OneShotError('Operation cancelled');
|
|
274
|
+
}
|
|
275
|
+
let response = await this.makeRequest(endpoint, payload, undefined, quoteId, signal);
|
|
276
|
+
// Handle 402 Payment Required
|
|
277
|
+
if (response.status === 402) {
|
|
278
|
+
const { payment_info } = await response.json();
|
|
279
|
+
this.log(`Payment required: ${payment_info.amount} USDC`);
|
|
280
|
+
const auth = await this.signPaymentAuthorization(payment_info);
|
|
281
|
+
response = await this.makeRequest(endpoint, payload, auth, quoteId, signal);
|
|
282
|
+
}
|
|
283
|
+
if (!response.ok) {
|
|
284
|
+
throw new ToolError('Tool request failed', response.status, await response.text());
|
|
285
|
+
}
|
|
286
|
+
const result = await response.json();
|
|
287
|
+
// Handle async jobs
|
|
288
|
+
if ((result.status === 'pending' || result.status === 'processing') && result.request_id) {
|
|
289
|
+
this.log(`Job queued: ${result.request_id}`);
|
|
290
|
+
if (!wait) {
|
|
291
|
+
return { request_id: result.request_id, status: result.status };
|
|
292
|
+
}
|
|
293
|
+
return this.pollJob(result.request_id, options.timeout, signal, onStatusUpdate);
|
|
294
|
+
}
|
|
295
|
+
return (result.data ?? result);
|
|
296
|
+
}
|
|
297
|
+
async pollJob(requestId, timeoutSec, signal, onStatusUpdate) {
|
|
298
|
+
const maxWaitMs = (timeoutSec ?? 120) * 1000;
|
|
299
|
+
const startTime = Date.now();
|
|
300
|
+
const pollInterval = 2000;
|
|
301
|
+
let retries = 0;
|
|
302
|
+
const maxRetries = 3;
|
|
303
|
+
while (Date.now() - startTime < maxWaitMs) {
|
|
304
|
+
if (signal?.aborted)
|
|
305
|
+
throw new OneShotError('Operation cancelled');
|
|
306
|
+
try {
|
|
307
|
+
const resp = await fetch(`${this.baseUrl}/v1/requests/${requestId}`, {
|
|
308
|
+
headers: this.headers(),
|
|
309
|
+
signal
|
|
310
|
+
});
|
|
311
|
+
if (!resp.ok) {
|
|
312
|
+
throw new ToolError('Failed to check job status', resp.status, await resp.text());
|
|
313
|
+
}
|
|
314
|
+
const job = await resp.json();
|
|
315
|
+
if (job.status === 'completed') {
|
|
316
|
+
this.log('Job completed');
|
|
317
|
+
return (job.result ?? job);
|
|
318
|
+
}
|
|
319
|
+
if (job.status === 'failed') {
|
|
320
|
+
throw new JobError(`Job failed: ${job.error ?? 'Unknown'}`, requestId, String(job.error ?? 'Unknown'));
|
|
321
|
+
}
|
|
322
|
+
onStatusUpdate?.(job.status, requestId);
|
|
323
|
+
retries = 0;
|
|
324
|
+
await this.sleep(pollInterval, signal);
|
|
325
|
+
}
|
|
326
|
+
catch (err) {
|
|
327
|
+
if (err instanceof OneShotError)
|
|
328
|
+
throw err;
|
|
329
|
+
if (++retries > maxRetries) {
|
|
330
|
+
throw new OneShotError(`Polling failed after ${maxRetries} retries: ${err}`);
|
|
331
|
+
}
|
|
332
|
+
const backoff = pollInterval * Math.pow(2, retries - 1);
|
|
333
|
+
this.log(`Retry ${retries}/${maxRetries} in ${backoff}ms`);
|
|
334
|
+
await this.sleep(backoff, signal);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
throw new JobTimeoutError(requestId, Date.now() - startTime);
|
|
338
|
+
}
|
|
339
|
+
sleep(ms, signal) {
|
|
340
|
+
return new Promise((resolve, reject) => {
|
|
341
|
+
if (signal?.aborted) {
|
|
342
|
+
return reject(new OneShotError('Operation cancelled'));
|
|
343
|
+
}
|
|
344
|
+
const timer = setTimeout(resolve, ms);
|
|
345
|
+
const onAbort = () => {
|
|
346
|
+
clearTimeout(timer);
|
|
347
|
+
reject(new OneShotError('Operation cancelled'));
|
|
348
|
+
};
|
|
349
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
async makeRequest(endpoint, data, payment, quoteId, signal) {
|
|
353
|
+
const headers = {
|
|
354
|
+
'Content-Type': 'application/json',
|
|
355
|
+
...this.headers()
|
|
356
|
+
};
|
|
357
|
+
if (payment)
|
|
358
|
+
headers['x-payment'] = JSON.stringify(payment);
|
|
359
|
+
if (quoteId)
|
|
360
|
+
headers['x-quote-id'] = quoteId;
|
|
361
|
+
return fetch(`${this.baseUrl}${endpoint}`, {
|
|
362
|
+
method: 'POST',
|
|
363
|
+
headers,
|
|
364
|
+
body: JSON.stringify(data),
|
|
365
|
+
signal
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
async signPaymentAuthorization(paymentInfo) {
|
|
369
|
+
const now = Math.floor(Date.now() / 1000);
|
|
370
|
+
const nonce = ethers_1.ethers.randomBytes(32);
|
|
371
|
+
const value = ethers_1.ethers.parseUnits(paymentInfo.amount, paymentInfo.token.decimals);
|
|
372
|
+
// Parse chain ID from CAIP-2 format or plain number
|
|
373
|
+
const chainId = paymentInfo.network.includes(':')
|
|
374
|
+
? parseInt(paymentInfo.network.split(':')[1])
|
|
375
|
+
: parseInt(paymentInfo.network);
|
|
376
|
+
// Warn on chain mismatch
|
|
377
|
+
if (chainId !== this._expectedChainId) {
|
|
378
|
+
console.warn(`[OneShot] Chain mismatch: API returned ${chainId}, expected ${this._expectedChainId} (${this._testMode ? 'test' : 'prod'})`);
|
|
379
|
+
}
|
|
380
|
+
const signature = await this.wallet.signTypedData({
|
|
381
|
+
name: paymentInfo.token.symbol,
|
|
382
|
+
version: '2',
|
|
383
|
+
chainId,
|
|
384
|
+
verifyingContract: paymentInfo.token.address
|
|
385
|
+
}, {
|
|
386
|
+
TransferWithAuthorization: [
|
|
387
|
+
{ name: 'from', type: 'address' },
|
|
388
|
+
{ name: 'to', type: 'address' },
|
|
389
|
+
{ name: 'value', type: 'uint256' },
|
|
390
|
+
{ name: 'validAfter', type: 'uint256' },
|
|
391
|
+
{ name: 'validBefore', type: 'uint256' },
|
|
392
|
+
{ name: 'nonce', type: 'bytes32' }
|
|
393
|
+
]
|
|
394
|
+
}, {
|
|
395
|
+
from: this.wallet.address,
|
|
396
|
+
to: paymentInfo.payTo,
|
|
397
|
+
value,
|
|
398
|
+
validAfter: now,
|
|
399
|
+
validBefore: now + 300,
|
|
400
|
+
nonce: ethers_1.ethers.hexlify(nonce)
|
|
401
|
+
});
|
|
402
|
+
const sig = ethers_1.ethers.Signature.from(signature);
|
|
403
|
+
return {
|
|
404
|
+
from: this.wallet.address,
|
|
405
|
+
to: paymentInfo.payTo,
|
|
406
|
+
value: value.toString(),
|
|
407
|
+
validAfter: now,
|
|
408
|
+
validBefore: now + 300,
|
|
409
|
+
nonce: ethers_1.ethers.hexlify(nonce),
|
|
410
|
+
signature: { v: sig.v, r: sig.r, s: sig.s },
|
|
411
|
+
network: paymentInfo.network,
|
|
412
|
+
token: paymentInfo.token.address
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
exports.OneShot = OneShot;
|
|
417
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAEhC,MAAM,WAAW,GAAG,OAAO,CAAC;AAE5B,+EAA+E;AAC/E,4BAA4B;AAC5B,+EAA+E;AAE/E,6DAA6D;AAChD,QAAA,QAAQ,GAAG;IACtB,OAAO,EAAE,0DAA0D;IACnE,MAAM,EAAE,0BAA0B;IAClC,OAAO,EAAE,KAAK;IACd,WAAW,EAAE,4CAA4C;CACjD,CAAC;AAEX,yDAAyD;AAC5C,QAAA,QAAQ,GAAG;IACtB,OAAO,EAAE,8BAA8B;IACvC,MAAM,EAAE,0BAA0B;IAClC,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,4CAA4C;CACjD,CAAC;AAEX,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E,MAAa,YAAa,SAAQ,KAAK;IACrC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;CACF;AAND,oCAMC;AAED,MAAa,SAAU,SAAQ,YAAY;IACzC,YACE,OAAe,EACC,UAAkB,EAClB,YAAoB;QAEpC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,eAAU,GAAV,UAAU,CAAQ;QAClB,iBAAY,GAAZ,YAAY,CAAQ;QAGpC,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAA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
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Autonomous Agent SDK for executing real-world commercial transactions with automatic x402 payments",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"prepublishOnly": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/oneshot-agent/sdk.git"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://github.com/oneshot-agent/sdk#readme",
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/oneshot-agent/sdk/issues"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"ai",
|
|
26
|
+
"agent",
|
|
27
|
+
"sdk",
|
|
28
|
+
"x402",
|
|
29
|
+
"payments",
|
|
30
|
+
"autonomous",
|
|
31
|
+
"commerce",
|
|
32
|
+
"email",
|
|
33
|
+
"research",
|
|
34
|
+
"blockchain",
|
|
35
|
+
"usdc",
|
|
36
|
+
"base"
|
|
37
|
+
],
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"ethers": "^6.16.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^25.0.3",
|
|
43
|
+
"typescript": "^5.9.3"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"typescript": ">=5.0.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependenciesMeta": {
|
|
49
|
+
"typescript": {
|
|
50
|
+
"optional": true
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=18.0.0"
|
|
55
|
+
},
|
|
56
|
+
"author": "OneShot",
|
|
57
|
+
"license": "MIT"
|
|
58
|
+
}
|