@beeperbot/sdk 0.2.2 → 0.2.3
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/dist/core/index.cjs +542 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +376 -0
- package/dist/core/index.d.ts +376 -0
- package/dist/core/index.js +531 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index.cjs +534 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -31
- package/dist/index.d.ts +32 -31
- package/dist/index.js +525 -1
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
type GoalType = 'max_reach' | 'lil_mission' | 'hard_mission';
|
|
2
|
+
type SplitPreset = 'balanced' | 'more_reach' | 'more_action';
|
|
3
|
+
type BonusDistributionType = 'lottery' | 'fcfs';
|
|
4
|
+
interface MissionCTA {
|
|
5
|
+
type: 'follow_profile' | 'like_cast' | 'recast' | 'share_cast' | 'visit_link' | 'quiz' | 'external_verify' | 'x_follow' | 'x_like' | 'x_recast';
|
|
6
|
+
profileFid?: number;
|
|
7
|
+
profileUsername?: string;
|
|
8
|
+
castHash?: string;
|
|
9
|
+
castUrl?: string;
|
|
10
|
+
requirements?: {
|
|
11
|
+
textIncludes?: string[];
|
|
12
|
+
mentions?: string[];
|
|
13
|
+
embeds?: string[];
|
|
14
|
+
};
|
|
15
|
+
url?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
questions?: Array<{
|
|
18
|
+
question: string;
|
|
19
|
+
answers: string[];
|
|
20
|
+
correctAnswerIndex: number;
|
|
21
|
+
}>;
|
|
22
|
+
endpointUrl?: string;
|
|
23
|
+
appUrl?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
handle?: string;
|
|
26
|
+
profileUrl?: string;
|
|
27
|
+
tweetId?: string;
|
|
28
|
+
tweetUrl?: string;
|
|
29
|
+
}
|
|
30
|
+
interface BonusConfig {
|
|
31
|
+
type: BonusDistributionType;
|
|
32
|
+
ctas: MissionCTA[];
|
|
33
|
+
lotteryConfig?: {
|
|
34
|
+
prizeTiers: Array<{
|
|
35
|
+
prizeAmount: number;
|
|
36
|
+
winnerCount: number;
|
|
37
|
+
}>;
|
|
38
|
+
durationSeconds?: number;
|
|
39
|
+
};
|
|
40
|
+
fcfsConfig?: {
|
|
41
|
+
amountPerClaim: number;
|
|
42
|
+
maxClaims: number;
|
|
43
|
+
startDelaySeconds?: number;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
interface BudgetSplit {
|
|
47
|
+
totalUsd: number;
|
|
48
|
+
payoutUsd: number;
|
|
49
|
+
bonusUsd: number;
|
|
50
|
+
platformFeeUsd: number;
|
|
51
|
+
userPaysUsd: number;
|
|
52
|
+
goalType: GoalType;
|
|
53
|
+
splitPreset: SplitPreset;
|
|
54
|
+
payoutPercent: number;
|
|
55
|
+
bonusPercent: number;
|
|
56
|
+
}
|
|
57
|
+
interface AgentUser {
|
|
58
|
+
id: string;
|
|
59
|
+
fid?: number;
|
|
60
|
+
username: string;
|
|
61
|
+
displayName?: string;
|
|
62
|
+
pfpUrl?: string;
|
|
63
|
+
platform: string;
|
|
64
|
+
walletAddress?: string;
|
|
65
|
+
attentionPriceUsd: string;
|
|
66
|
+
followerCount?: number;
|
|
67
|
+
}
|
|
68
|
+
interface AttentionPrice {
|
|
69
|
+
userId: string;
|
|
70
|
+
username: string;
|
|
71
|
+
priceUsd: string;
|
|
72
|
+
priceUsdc: string;
|
|
73
|
+
}
|
|
74
|
+
interface PaymentIntent {
|
|
75
|
+
intentId: string;
|
|
76
|
+
recipient: string;
|
|
77
|
+
amount: string;
|
|
78
|
+
amountFormatted: string;
|
|
79
|
+
tokenAddress: string;
|
|
80
|
+
tokenSymbol: string;
|
|
81
|
+
chainId: number;
|
|
82
|
+
chainName: string;
|
|
83
|
+
message: string;
|
|
84
|
+
recipientInfo: {
|
|
85
|
+
username: string;
|
|
86
|
+
displayName?: string;
|
|
87
|
+
fid?: number;
|
|
88
|
+
};
|
|
89
|
+
instruction: string;
|
|
90
|
+
expiresAt: string;
|
|
91
|
+
baseAmountUsd: string;
|
|
92
|
+
platformFeeUsd: string;
|
|
93
|
+
totalAmountUsd: string;
|
|
94
|
+
feePercentage: number;
|
|
95
|
+
}
|
|
96
|
+
interface PrepareBeepResult {
|
|
97
|
+
type: 'confirmation';
|
|
98
|
+
recipient: {
|
|
99
|
+
username: string;
|
|
100
|
+
displayName?: string;
|
|
101
|
+
pfpUrl?: string;
|
|
102
|
+
fid?: number;
|
|
103
|
+
walletAddress: string;
|
|
104
|
+
};
|
|
105
|
+
message: string;
|
|
106
|
+
baseAmountUsd: string;
|
|
107
|
+
platformFeeUsd: string;
|
|
108
|
+
totalAmountUsd: string;
|
|
109
|
+
feePercentage: number;
|
|
110
|
+
chainId: number;
|
|
111
|
+
chainName: string;
|
|
112
|
+
attentionPriceUsd: string;
|
|
113
|
+
hasMissions?: boolean;
|
|
114
|
+
budgetSplit?: BudgetSplit;
|
|
115
|
+
bonusConfig?: BonusConfig;
|
|
116
|
+
}
|
|
117
|
+
interface PrepareCampaignResult {
|
|
118
|
+
type: 'campaign_confirmation';
|
|
119
|
+
recipientCount: number;
|
|
120
|
+
budgetSplit: BudgetSplit;
|
|
121
|
+
bonusConfig?: BonusConfig;
|
|
122
|
+
missionSummary?: string;
|
|
123
|
+
payoutEstimate: {
|
|
124
|
+
recipientCount: number;
|
|
125
|
+
totalPayoutCostUsd: string;
|
|
126
|
+
avgPriceUsd: string;
|
|
127
|
+
};
|
|
128
|
+
platformFeeUsd: string;
|
|
129
|
+
userPaysUsd: string;
|
|
130
|
+
message?: string;
|
|
131
|
+
chainId: number;
|
|
132
|
+
chainName: string;
|
|
133
|
+
}
|
|
134
|
+
interface PrepareBeepError {
|
|
135
|
+
error: string;
|
|
136
|
+
message: string;
|
|
137
|
+
minimumUsd?: string;
|
|
138
|
+
requestedUsd?: string;
|
|
139
|
+
}
|
|
140
|
+
interface EstimateDiagnostics {
|
|
141
|
+
candidateCount: number;
|
|
142
|
+
budgetMicro: number;
|
|
143
|
+
appliedDefaults: string[];
|
|
144
|
+
}
|
|
145
|
+
interface EstimateResult {
|
|
146
|
+
recipientCount: number;
|
|
147
|
+
totalCostUsd: string;
|
|
148
|
+
avgPriceUsd: string;
|
|
149
|
+
minPriceUsd: string;
|
|
150
|
+
maxPriceUsd: string;
|
|
151
|
+
remainingBudgetUsd: string;
|
|
152
|
+
budgetSufficient: boolean;
|
|
153
|
+
diagnostics?: EstimateDiagnostics;
|
|
154
|
+
}
|
|
155
|
+
interface PreviewUser {
|
|
156
|
+
username: string;
|
|
157
|
+
displayName?: string;
|
|
158
|
+
fid?: number;
|
|
159
|
+
priceUsd: string;
|
|
160
|
+
followerCount?: number;
|
|
161
|
+
neynarScore?: number;
|
|
162
|
+
pfpUrl?: string;
|
|
163
|
+
}
|
|
164
|
+
interface PreviewResult {
|
|
165
|
+
users: PreviewUser[];
|
|
166
|
+
totalCount: number;
|
|
167
|
+
hasMore: boolean;
|
|
168
|
+
}
|
|
169
|
+
interface BulkIntentResult {
|
|
170
|
+
bulkIntentId: string;
|
|
171
|
+
recipientCount: number;
|
|
172
|
+
totalAmount: string;
|
|
173
|
+
totalAmountFormatted: string;
|
|
174
|
+
payments: Array<{
|
|
175
|
+
recipient: string;
|
|
176
|
+
amount: string;
|
|
177
|
+
username: string;
|
|
178
|
+
}>;
|
|
179
|
+
summary: string;
|
|
180
|
+
chainId: number;
|
|
181
|
+
chainName: string;
|
|
182
|
+
tokenAddress: string;
|
|
183
|
+
tokenSymbol: string;
|
|
184
|
+
expiresAt: string;
|
|
185
|
+
}
|
|
186
|
+
interface SimpleFilters {
|
|
187
|
+
platform?: 'all' | 'farcaster' | 'twitter';
|
|
188
|
+
activeInLastDays?: number;
|
|
189
|
+
minCastCount?: number;
|
|
190
|
+
neynarScoreMin?: number;
|
|
191
|
+
neynarScoreMax?: number;
|
|
192
|
+
quotientScoreMin?: number;
|
|
193
|
+
quotientScoreMax?: number;
|
|
194
|
+
spamLabel?: 'not_spam_only' | 'spam_only' | 'all';
|
|
195
|
+
verifiedOnly?: boolean;
|
|
196
|
+
minFollowers?: number;
|
|
197
|
+
maxFollowers?: number;
|
|
198
|
+
followersOf?: number;
|
|
199
|
+
mutualsWith?: number;
|
|
200
|
+
signalTokens?: string[];
|
|
201
|
+
tokenHolders?: Array<{
|
|
202
|
+
tokenAddress: string;
|
|
203
|
+
chainId: number;
|
|
204
|
+
minBalance?: string;
|
|
205
|
+
}>;
|
|
206
|
+
hasBaseWallet?: boolean;
|
|
207
|
+
hasVerifiedWallet?: boolean;
|
|
208
|
+
maxAttentionPriceUsd?: number;
|
|
209
|
+
minBatteryPercentage?: number;
|
|
210
|
+
hasRechargedInLastDays?: number;
|
|
211
|
+
excludePingedToday?: boolean;
|
|
212
|
+
countries?: string[];
|
|
213
|
+
timezones?: Array<{
|
|
214
|
+
offset: number;
|
|
215
|
+
range?: number;
|
|
216
|
+
}>;
|
|
217
|
+
fids?: number[];
|
|
218
|
+
userIds?: string[];
|
|
219
|
+
orderBy?: 'attention_price_asc' | 'attention_price_desc' | 'neynar_score_desc' | 'followers_desc' | 'followers_asc' | 'recent_activity' | 'battery_desc' | 'random';
|
|
220
|
+
}
|
|
221
|
+
type OrderByOption = NonNullable<SimpleFilters['orderBy']>;
|
|
222
|
+
interface AgentQueryPlan {
|
|
223
|
+
inputFilters: SimpleFilters;
|
|
224
|
+
filters: SimpleFilters;
|
|
225
|
+
orderBy: OrderByOption;
|
|
226
|
+
defaultsApplied: string[];
|
|
227
|
+
}
|
|
228
|
+
interface CoreUserRecord {
|
|
229
|
+
id: string;
|
|
230
|
+
username: string;
|
|
231
|
+
displayName?: string;
|
|
232
|
+
pfpUrl?: string;
|
|
233
|
+
platform: string;
|
|
234
|
+
followerCount?: number;
|
|
235
|
+
attentionPriceMicroUsd: bigint | number | string;
|
|
236
|
+
}
|
|
237
|
+
interface CoreResolvedUser extends CoreUserRecord {
|
|
238
|
+
fid?: number;
|
|
239
|
+
walletAddress?: string;
|
|
240
|
+
}
|
|
241
|
+
interface CoreCandidateUser extends CoreUserRecord {
|
|
242
|
+
neynarScore?: number;
|
|
243
|
+
}
|
|
244
|
+
interface BeepHistoryRecord {
|
|
245
|
+
id: string;
|
|
246
|
+
toUsername: string;
|
|
247
|
+
message: string | null;
|
|
248
|
+
value: number;
|
|
249
|
+
status: string;
|
|
250
|
+
createdAt: Date;
|
|
251
|
+
}
|
|
252
|
+
interface AgentCoreAdapter {
|
|
253
|
+
resolveUser(query: string | number): Promise<CoreResolvedUser | null>;
|
|
254
|
+
getFidForUser(userId: string): Promise<number | null>;
|
|
255
|
+
getBulkFidsForUsers(userIds: string[]): Promise<Map<string, number>>;
|
|
256
|
+
getPrimaryWalletAddress(userId: string): Promise<string | null>;
|
|
257
|
+
getBulkPrimaryWalletAddresses(userIds: string[]): Promise<Map<string, string>>;
|
|
258
|
+
findUsers(params: {
|
|
259
|
+
filters: SimpleFilters;
|
|
260
|
+
orderBy: OrderByOption;
|
|
261
|
+
limit: number;
|
|
262
|
+
includeProfile?: boolean;
|
|
263
|
+
includeReputation?: boolean;
|
|
264
|
+
}): Promise<CoreCandidateUser[]>;
|
|
265
|
+
countUsers(filters: SimpleFilters): Promise<number>;
|
|
266
|
+
getBeepHistory(params: {
|
|
267
|
+
fromFid?: number;
|
|
268
|
+
fromUserId?: string;
|
|
269
|
+
limit?: number;
|
|
270
|
+
offset?: number;
|
|
271
|
+
}): Promise<{
|
|
272
|
+
beeps: BeepHistoryRecord[];
|
|
273
|
+
total: number;
|
|
274
|
+
}>;
|
|
275
|
+
}
|
|
276
|
+
interface AgentCoreConfig {
|
|
277
|
+
defaultChainId?: number;
|
|
278
|
+
platformFeeRate?: number;
|
|
279
|
+
estimateMaxUsers?: number;
|
|
280
|
+
bulkMaxUsers?: number;
|
|
281
|
+
microUsdPerUsd?: number;
|
|
282
|
+
chainInfo?: Record<number, {
|
|
283
|
+
name: string;
|
|
284
|
+
usdcAddress: string;
|
|
285
|
+
}>;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
interface NormalizedFiltersResult {
|
|
289
|
+
filters: SimpleFilters;
|
|
290
|
+
defaultsApplied: string[];
|
|
291
|
+
}
|
|
292
|
+
declare function normalizeAgentFilters(filters: SimpleFilters): NormalizedFiltersResult;
|
|
293
|
+
declare function getOrderByOrDefault(filters: SimpleFilters): OrderByOption;
|
|
294
|
+
declare function buildAgentQueryPlan(filters: SimpleFilters): AgentQueryPlan;
|
|
295
|
+
|
|
296
|
+
declare class AgentCore {
|
|
297
|
+
private readonly adapter;
|
|
298
|
+
private readonly defaultChainId;
|
|
299
|
+
private readonly platformFeeRate;
|
|
300
|
+
private readonly estimateMaxUsers;
|
|
301
|
+
private readonly bulkMaxUsers;
|
|
302
|
+
private readonly microUsdPerUsd;
|
|
303
|
+
private readonly chainInfo;
|
|
304
|
+
constructor(adapter: AgentCoreAdapter, config?: AgentCoreConfig);
|
|
305
|
+
buildQueryPlan(filters: SimpleFilters): AgentQueryPlan;
|
|
306
|
+
normalizeFilters(filters: SimpleFilters): NormalizedFiltersResult;
|
|
307
|
+
computeBudgetSplit(totalUsd: number, goalType?: GoalType, splitPreset?: SplitPreset): BudgetSplit;
|
|
308
|
+
lookup(query: string | number): Promise<AgentUser | null>;
|
|
309
|
+
getPrice(query: string | number): Promise<AttentionPrice | null>;
|
|
310
|
+
prepareBeep(params: {
|
|
311
|
+
to: string | number;
|
|
312
|
+
amountUsd: string;
|
|
313
|
+
message: string;
|
|
314
|
+
chainId?: number;
|
|
315
|
+
goalType?: GoalType;
|
|
316
|
+
splitPreset?: SplitPreset;
|
|
317
|
+
bonusConfig?: BonusConfig;
|
|
318
|
+
}): Promise<PrepareBeepResult | PrepareBeepError>;
|
|
319
|
+
createIntent(params: {
|
|
320
|
+
to: string | number;
|
|
321
|
+
amountUsd: string;
|
|
322
|
+
message?: string;
|
|
323
|
+
chainId?: number;
|
|
324
|
+
}): Promise<PaymentIntent | null>;
|
|
325
|
+
estimate(params: {
|
|
326
|
+
filters: SimpleFilters;
|
|
327
|
+
budgetUsd: string;
|
|
328
|
+
message?: string;
|
|
329
|
+
}): Promise<EstimateResult>;
|
|
330
|
+
preview(params: {
|
|
331
|
+
filters: SimpleFilters;
|
|
332
|
+
limit: number;
|
|
333
|
+
}): Promise<PreviewResult>;
|
|
334
|
+
createBulkIntent(params: {
|
|
335
|
+
filters: SimpleFilters;
|
|
336
|
+
budgetUsd: string;
|
|
337
|
+
message?: string;
|
|
338
|
+
chainId?: number;
|
|
339
|
+
}): Promise<BulkIntentResult>;
|
|
340
|
+
prepareCampaign(params: {
|
|
341
|
+
filters: SimpleFilters;
|
|
342
|
+
budgetUsd: string;
|
|
343
|
+
message?: string;
|
|
344
|
+
goalType?: GoalType;
|
|
345
|
+
splitPreset?: SplitPreset;
|
|
346
|
+
bonusConfig?: BonusConfig;
|
|
347
|
+
chainId?: number;
|
|
348
|
+
}): Promise<PrepareCampaignResult>;
|
|
349
|
+
getBeepHistory(params: {
|
|
350
|
+
fromFid?: number;
|
|
351
|
+
fromUserId?: string;
|
|
352
|
+
limit?: number;
|
|
353
|
+
offset?: number;
|
|
354
|
+
}): Promise<{
|
|
355
|
+
beeps: BeepHistoryRecord[];
|
|
356
|
+
total: number;
|
|
357
|
+
}>;
|
|
358
|
+
}
|
|
359
|
+
declare function createAgentCore(adapter: AgentCoreAdapter, config?: AgentCoreConfig): AgentCore;
|
|
360
|
+
declare function normalizeFilters(filters: SimpleFilters): NormalizedFiltersResult;
|
|
361
|
+
declare function buildQueryPlan(filters: SimpleFilters): AgentQueryPlan;
|
|
362
|
+
declare function getDefaultOrderBy(filters: SimpleFilters): OrderByOption;
|
|
363
|
+
|
|
364
|
+
type AgentCoreErrorCode = 'VALIDATION_ERROR' | 'NOT_FOUND' | 'UNSUPPORTED_CHAIN' | 'NO_RECIPIENTS' | 'INTERNAL_ERROR';
|
|
365
|
+
declare class AgentCoreError extends Error {
|
|
366
|
+
readonly code: AgentCoreErrorCode;
|
|
367
|
+
constructor(code: AgentCoreErrorCode, message: string);
|
|
368
|
+
static validation(message: string): AgentCoreError;
|
|
369
|
+
static notFound(message: string): AgentCoreError;
|
|
370
|
+
static unsupportedChain(chainId: number): AgentCoreError;
|
|
371
|
+
static noRecipients(message: string): AgentCoreError;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
declare function computeBudgetSplit(totalUsd: number, goalType?: GoalType, splitPreset?: SplitPreset, platformFeeRate?: number): BudgetSplit;
|
|
375
|
+
|
|
376
|
+
export { AgentCore, type AgentCoreAdapter, type AgentCoreConfig, AgentCoreError, type AgentCoreErrorCode, type AgentQueryPlan, type AgentUser, type AttentionPrice, type BeepHistoryRecord, type BonusConfig, type BonusDistributionType, type BudgetSplit, type BulkIntentResult, type CoreCandidateUser, type CoreResolvedUser, type CoreUserRecord, type EstimateDiagnostics, type EstimateResult, type GoalType, type MissionCTA, type OrderByOption, type PaymentIntent, type PrepareBeepError, type PrepareBeepResult, type PrepareCampaignResult, type PreviewResult, type PreviewUser, type SimpleFilters, type SplitPreset, buildAgentQueryPlan, buildQueryPlan, computeBudgetSplit, createAgentCore, getDefaultOrderBy, getOrderByOrDefault, normalizeAgentFilters, normalizeFilters };
|