@beeperbot/sdk 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +178 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,178 @@
1
+ # @beeperbot/sdk
2
+
3
+ TypeScript SDK for [beep.works](https://beep.works) — the attention tokenization platform on Farcaster.
4
+
5
+ Send beeps (paid DMs) programmatically. Look up users, check prices, create payment intents, and run bulk campaigns.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @beeperbot/sdk
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```typescript
16
+ import { AgentClient } from '@beeperbot/sdk';
17
+
18
+ const client = new AgentClient({
19
+ apiKey: 'bpk_live_...',
20
+ environment: 'production',
21
+ });
22
+
23
+ // Look up a user
24
+ const user = await client.lookup('dwr');
25
+ console.log(user); // { username, fid, attentionPriceUsd, ... }
26
+
27
+ // Check attention price
28
+ const price = await client.getPrice('dwr');
29
+ console.log(price); // { priceUsd: "0.50", priceUsdc: "500000" }
30
+
31
+ // Create a payment intent (single user)
32
+ const intent = await client.createIntent({
33
+ to: 'dwr',
34
+ amountUsd: 1.0,
35
+ message: 'Hey, check this out!',
36
+ });
37
+ console.log(intent); // { intentId, recipient, amount, instruction, ... }
38
+ ```
39
+
40
+ ## Agent Client API
41
+
42
+ The `AgentClient` is designed for AI agents and simple integrations.
43
+
44
+ ### `lookup(query)`
45
+ Search for a user by username, FID, or wallet address.
46
+
47
+ ```typescript
48
+ const user = await client.lookup('dwr');
49
+ const user = await client.lookup('3'); // by FID
50
+ const user = await client.lookup('0x1234...'); // by wallet
51
+ ```
52
+
53
+ ### `getPrice(username)`
54
+ Get the attention price for a user.
55
+
56
+ ```typescript
57
+ const price = await client.getPrice('dwr');
58
+ // { userId, username, priceUsd, priceUsdc }
59
+ ```
60
+
61
+ ### `createIntent(input)`
62
+ Create a single payment intent.
63
+
64
+ ```typescript
65
+ const intent = await client.createIntent({
66
+ to: 'dwr', // username or FID
67
+ amountUsd: 1.0, // amount in USD
68
+ message: 'Hello!', // optional message
69
+ chainId: 8453, // Base (default)
70
+ });
71
+ ```
72
+
73
+ ### `estimate(input)`
74
+ Estimate campaign costs before committing.
75
+
76
+ ```typescript
77
+ const estimate = await client.estimate({
78
+ filter: { minFollowers: 1000, platform: 'farcaster' },
79
+ budgetUsd: 100,
80
+ message: 'Check out our launch!',
81
+ });
82
+ // { estimatedRecipients, estimatedCostUsd, averagePriceUsd }
83
+ ```
84
+
85
+ ### `preview(input)`
86
+ Preview who would receive a campaign.
87
+
88
+ ```typescript
89
+ const preview = await client.preview({
90
+ filter: { minFollowers: 1000 },
91
+ limit: 20,
92
+ });
93
+ // { users: [...], totalMatched }
94
+ ```
95
+
96
+ ### `createBulkIntent(input)`
97
+ Create a bulk campaign targeting multiple users.
98
+
99
+ ```typescript
100
+ const bulk = await client.createBulkIntent({
101
+ filter: { platform: 'farcaster', minFollowers: 500 },
102
+ budgetUsd: 50,
103
+ message: 'GM from our SDK!',
104
+ });
105
+ // { intentId, recipientCount, totalAmountUsd, ... }
106
+ ```
107
+
108
+ ## Advanced: BeeperClient
109
+
110
+ For the full quote-based flow (create draft → get quote → deposit → execute → receipt):
111
+
112
+ ```typescript
113
+ import { BeeperClient } from '@beeperbot/sdk';
114
+
115
+ const beeper = new BeeperClient({
116
+ apiKey: 'bpk_live_...',
117
+ });
118
+
119
+ // Full flow
120
+ const draft = await beeper.createDraft({ ... });
121
+ const quote = await beeper.getQuote(draft.id);
122
+ const confirmed = await beeper.confirmDeposit(quote.id, { txHash: '0x...' });
123
+ const result = await beeper.execute(quote.id);
124
+ const receipt = await beeper.getReceipt(quote.id);
125
+ ```
126
+
127
+ ## Filter Builder
128
+
129
+ Build complex recipient filters with a fluent API:
130
+
131
+ ```typescript
132
+ import { FilterBuilder } from '@beeperbot/sdk';
133
+
134
+ const filter = FilterBuilder.and(
135
+ FilterBuilder.platform('farcaster'),
136
+ FilterBuilder.minFollowers(1000),
137
+ FilterBuilder.neynarScoreMin(0.8),
138
+ FilterBuilder.maxAttentionPrice(2.0),
139
+ );
140
+ ```
141
+
142
+ ## Authentication
143
+
144
+ API keys use the format `bpk_live_*` (production) or `bpk_test_*` (testing).
145
+
146
+ Get your API key from the [beep.works dashboard](https://beep.works/settings).
147
+
148
+ ## Error Handling
149
+
150
+ ```typescript
151
+ import { BeeperError } from '@beeperbot/sdk';
152
+
153
+ try {
154
+ const user = await client.lookup('nonexistent');
155
+ } catch (err) {
156
+ if (err instanceof BeeperError) {
157
+ console.log(err.code); // 'NOT_FOUND'
158
+ console.log(err.message); // 'User not found'
159
+ console.log(err.status); // 404
160
+ }
161
+ }
162
+ ```
163
+
164
+ ## Configuration
165
+
166
+ ```typescript
167
+ const client = new AgentClient({
168
+ apiKey: 'bpk_live_...',
169
+ environment: 'production', // 'production' | 'staging' | 'development'
170
+ baseUrl: 'https://custom.api.url', // override base URL
171
+ timeout: 30000, // request timeout (ms)
172
+ debug: false, // enable debug logging
173
+ });
174
+ ```
175
+
176
+ ## License
177
+
178
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beeperbot/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "TypeScript SDK for Beeper payment distribution",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",