@beeperbot/sdk 0.2.0 → 0.2.2

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/index.d.ts CHANGED
@@ -113,7 +113,7 @@ declare function generateFilterDocumentation(): string;
113
113
  *
114
114
  * @example
115
115
  * ```typescript
116
- * import { AgentClient } from '@beeper/sdk';
116
+ * import { AgentClient } from '@beeperbot/sdk';
117
117
  *
118
118
  * const agent = new AgentClient({
119
119
  * apiKey: process.env.BEEPER_API_KEY,
@@ -253,6 +253,12 @@ interface SimpleFilters {
253
253
  tokenAddress: string;
254
254
  chainId: number;
255
255
  minBalance?: string;
256
+ } | {
257
+ contractAddress: string;
258
+ chain: string | number;
259
+ minBalance?: string;
260
+ tokenStandard?: string;
261
+ tokenId?: string;
256
262
  }>;
257
263
  hasBaseWallet?: boolean;
258
264
  hasVerifiedWallet?: boolean;
@@ -260,7 +266,9 @@ interface SimpleFilters {
260
266
  minBatteryPercentage?: number;
261
267
  hasRechargedInLastDays?: number;
262
268
  excludePingedToday?: boolean;
263
- countries?: string[];
269
+ countries?: Array<string | {
270
+ code: string;
271
+ }>;
264
272
  timezones?: Array<{
265
273
  offset: number;
266
274
  range?: number;
@@ -375,7 +383,12 @@ interface BulkIntentResult {
375
383
  */
376
384
  declare class AgentClient {
377
385
  private readonly http;
386
+ private static readonly CHAIN_ID_MAP;
378
387
  constructor(config: AgentClientConfig);
388
+ /**
389
+ * Normalize filters for agent endpoints (accepts flexible shapes from other builders)
390
+ */
391
+ private normalizeFilters;
379
392
  /**
380
393
  * Look up a user by username, FID, or wallet address
381
394
  *
@@ -857,7 +870,7 @@ declare const DraftInputSchema: z.ZodObject<{
857
870
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
858
871
  }, "strip", z.ZodTypeAny, {
859
872
  name: string;
860
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
873
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
861
874
  amount: string;
862
875
  token: "USDC" | "USDT" | "ETH" | "MATIC";
863
876
  strategy: "equal" | "weighted" | "proportional";
@@ -866,7 +879,7 @@ declare const DraftInputSchema: z.ZodObject<{
866
879
  metadata?: Record<string, unknown> | undefined;
867
880
  }, {
868
881
  name: string;
869
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
882
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
870
883
  amount: string;
871
884
  token: "USDC" | "USDT" | "ETH" | "MATIC";
872
885
  strategy: "equal" | "weighted" | "proportional";
@@ -892,7 +905,7 @@ declare const DraftSchema: z.ZodObject<{
892
905
  status: z.ZodEnum<["draft", "quoted", "executed"]>;
893
906
  }, "strip", z.ZodTypeAny, {
894
907
  name: string;
895
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
908
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
896
909
  status: "draft" | "quoted" | "executed";
897
910
  id: string;
898
911
  createdAt: string;
@@ -905,7 +918,7 @@ declare const DraftSchema: z.ZodObject<{
905
918
  metadata?: Record<string, unknown> | undefined;
906
919
  }, {
907
920
  name: string;
908
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
921
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
909
922
  status: "draft" | "quoted" | "executed";
910
923
  id: string;
911
924
  createdAt: string;
@@ -932,7 +945,7 @@ declare const DraftUpdateSchema: z.ZodObject<{
932
945
  }, "strip", z.ZodTypeAny, {
933
946
  name?: string | undefined;
934
947
  filter?: unknown;
935
- network?: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism" | undefined;
948
+ network?: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism" | undefined;
936
949
  amount?: string | undefined;
937
950
  token?: "USDC" | "USDT" | "ETH" | "MATIC" | undefined;
938
951
  strategy?: "equal" | "weighted" | "proportional" | undefined;
@@ -941,7 +954,7 @@ declare const DraftUpdateSchema: z.ZodObject<{
941
954
  }, {
942
955
  name?: string | undefined;
943
956
  filter?: unknown;
944
- network?: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism" | undefined;
957
+ network?: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism" | undefined;
945
958
  amount?: string | undefined;
946
959
  token?: "USDC" | "USDT" | "ETH" | "MATIC" | undefined;
947
960
  strategy?: "equal" | "weighted" | "proportional" | undefined;
@@ -953,7 +966,7 @@ declare const DraftUpdateSchema: z.ZodObject<{
953
966
  */
954
967
  declare function validateDraftInput$1(input: unknown): z.SafeParseReturnType<{
955
968
  name: string;
956
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
969
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
957
970
  amount: string;
958
971
  token: "USDC" | "USDT" | "ETH" | "MATIC";
959
972
  strategy: "equal" | "weighted" | "proportional";
@@ -962,7 +975,7 @@ declare function validateDraftInput$1(input: unknown): z.SafeParseReturnType<{
962
975
  metadata?: Record<string, unknown> | undefined;
963
976
  }, {
964
977
  name: string;
965
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
978
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
966
979
  amount: string;
967
980
  token: "USDC" | "USDT" | "ETH" | "MATIC";
968
981
  strategy: "equal" | "weighted" | "proportional";
@@ -975,7 +988,7 @@ declare function validateDraftInput$1(input: unknown): z.SafeParseReturnType<{
975
988
  */
976
989
  declare function parseDraftInput(input: unknown): {
977
990
  name: string;
978
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
991
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
979
992
  amount: string;
980
993
  token: "USDC" | "USDT" | "ETH" | "MATIC";
981
994
  strategy: "equal" | "weighted" | "proportional";
@@ -988,7 +1001,7 @@ declare function parseDraftInput(input: unknown): {
988
1001
  */
989
1002
  declare function validateDraft(draft: unknown): z.SafeParseReturnType<{
990
1003
  name: string;
991
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
1004
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
992
1005
  status: "draft" | "quoted" | "executed";
993
1006
  id: string;
994
1007
  createdAt: string;
@@ -1001,7 +1014,7 @@ declare function validateDraft(draft: unknown): z.SafeParseReturnType<{
1001
1014
  metadata?: Record<string, unknown> | undefined;
1002
1015
  }, {
1003
1016
  name: string;
1004
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
1017
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
1005
1018
  status: "draft" | "quoted" | "executed";
1006
1019
  id: string;
1007
1020
  createdAt: string;
@@ -1018,7 +1031,7 @@ declare function validateDraft(draft: unknown): z.SafeParseReturnType<{
1018
1031
  */
1019
1032
  declare function parseDraft(draft: unknown): {
1020
1033
  name: string;
1021
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
1034
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
1022
1035
  status: "draft" | "quoted" | "executed";
1023
1036
  id: string;
1024
1037
  createdAt: string;
@@ -1545,6 +1558,154 @@ declare function getApiKeyEnvironment(apiKey: string): 'production' | 'test' | n
1545
1558
  */
1546
1559
  declare function maskApiKey(apiKey: string): string;
1547
1560
 
1561
+ /**
1562
+ * Mission & Bonus Reward Types for beeper-sdk
1563
+ *
1564
+ * Types for configuring bonus missions (CTAs + reward distribution)
1565
+ * on beeps and campaigns.
1566
+ */
1567
+ /** Farcaster: Follow a profile */
1568
+ interface FollowProfileCTA {
1569
+ type: 'follow_profile';
1570
+ profileFid: number;
1571
+ profileUsername?: string;
1572
+ profileDisplayName?: string;
1573
+ }
1574
+ /** Farcaster: Like a specific cast */
1575
+ interface LikeCastCTA {
1576
+ type: 'like_cast';
1577
+ castHash: string;
1578
+ castUrl?: string;
1579
+ castAuthorFid?: number;
1580
+ castAuthorUsername?: string;
1581
+ }
1582
+ /** Farcaster: Recast a specific cast */
1583
+ interface RecastCTA {
1584
+ type: 'recast';
1585
+ castHash: string;
1586
+ castUrl?: string;
1587
+ castAuthorFid?: number;
1588
+ castAuthorUsername?: string;
1589
+ }
1590
+ /** Farcaster: Post a quote cast with requirements */
1591
+ interface ShareCastCTA {
1592
+ type: 'share_cast';
1593
+ requirements?: {
1594
+ textIncludes?: string[];
1595
+ mentions?: string[];
1596
+ embeds?: string[];
1597
+ };
1598
+ }
1599
+ /** Universal: Visit a link */
1600
+ interface VisitLinkCTA {
1601
+ type: 'visit_link';
1602
+ url: string;
1603
+ label?: string;
1604
+ }
1605
+ /** Universal: Answer quiz questions */
1606
+ interface QuizCTA {
1607
+ type: 'quiz';
1608
+ questions: QuizQuestion[];
1609
+ }
1610
+ interface QuizQuestion {
1611
+ question: string;
1612
+ answers: string[];
1613
+ correctAnswerIndex: number;
1614
+ }
1615
+ /** Universal: Custom verification via external endpoint */
1616
+ interface ExternalVerifyCTA {
1617
+ type: 'external_verify';
1618
+ endpointUrl: string;
1619
+ appUrl: string;
1620
+ appIsMiniApp?: boolean;
1621
+ guideUrl?: string;
1622
+ guideLabel?: string;
1623
+ description?: string;
1624
+ }
1625
+ /** X (Twitter): Follow a profile */
1626
+ interface XFollowCTA {
1627
+ type: 'x_follow';
1628
+ handle: string;
1629
+ profileUrl: string;
1630
+ displayName?: string;
1631
+ }
1632
+ /** X (Twitter): Like a tweet */
1633
+ interface XLikeCTA {
1634
+ type: 'x_like';
1635
+ tweetId: string;
1636
+ tweetUrl: string;
1637
+ authorHandle?: string;
1638
+ tweetText?: string;
1639
+ }
1640
+ /** X (Twitter): Repost a tweet */
1641
+ interface XRecastCTA {
1642
+ type: 'x_recast';
1643
+ tweetId: string;
1644
+ tweetUrl: string;
1645
+ authorHandle?: string;
1646
+ tweetText?: string;
1647
+ }
1648
+ /** All CTA types */
1649
+ type MissionCTA = FollowProfileCTA | LikeCastCTA | RecastCTA | ShareCastCTA | VisitLinkCTA | QuizCTA | ExternalVerifyCTA | XFollowCTA | XLikeCTA | XRecastCTA;
1650
+ /** CTA type strings */
1651
+ type CTAType = MissionCTA['type'];
1652
+ /** Lottery prize tier */
1653
+ interface PrizeTier {
1654
+ prizeAmount: number;
1655
+ winnerCount: number;
1656
+ }
1657
+ /** Lottery distribution config */
1658
+ interface LotteryConfig {
1659
+ prizeTiers: PrizeTier[];
1660
+ durationSeconds?: number;
1661
+ }
1662
+ /** FCFS distribution config */
1663
+ interface FCFSConfig {
1664
+ amountPerClaim: number;
1665
+ maxClaims: number;
1666
+ startDelaySeconds?: number;
1667
+ }
1668
+ /** Bonus reward configuration */
1669
+ interface BonusConfig {
1670
+ type: 'lottery' | 'fcfs';
1671
+ ctas?: MissionCTA[];
1672
+ lotteryConfig?: LotteryConfig;
1673
+ fcfsConfig?: FCFSConfig;
1674
+ }
1675
+ /** How budget is split between payout and bonus pool */
1676
+ type GoalType = 'max_reach' | 'lil_mission' | 'hard_mission';
1677
+ /** Fine-tune the budget split */
1678
+ type SplitPreset = 'balanced' | 'more_reach' | 'more_action';
1679
+ /** Computed budget split */
1680
+ interface BudgetSplit {
1681
+ totalUsd: number;
1682
+ payoutUsd: number;
1683
+ bonusUsd: number;
1684
+ platformFeeUsd: number;
1685
+ userPaysUsd: number;
1686
+ goalType: GoalType;
1687
+ splitPreset: SplitPreset;
1688
+ payoutPercent: number;
1689
+ bonusPercent: number;
1690
+ }
1691
+ /** Campaign input extending estimate with mission support */
1692
+ interface CampaignInput {
1693
+ filters: Record<string, unknown>;
1694
+ budget: string;
1695
+ message?: string;
1696
+ goalType?: GoalType;
1697
+ splitPreset?: SplitPreset;
1698
+ bonusConfig?: BonusConfig;
1699
+ }
1700
+
1701
+ /**
1702
+ * Core types for the Beeper SDK
1703
+ *
1704
+ * These types are the canonical API contract types matching the BeeperClient
1705
+ * and the backend HTTP contract. Legacy types from the old schema-based API
1706
+ * have been removed or replaced.
1707
+ */
1708
+
1548
1709
  /**
1549
1710
  * Draft input - what the user provides to create a draft
1550
1711
  */
@@ -1767,7 +1928,7 @@ interface PaginatedResponse<T> {
1767
1928
  *
1768
1929
  * @example
1769
1930
  * ```typescript
1770
- * import { FilterBuilder } from '@beeper/sdk';
1931
+ * import { FilterBuilder } from '@beeperbot/sdk';
1771
1932
  *
1772
1933
  * const filter = FilterBuilder.and([
1773
1934
  * FilterBuilder.platform('farcaster'),
@@ -2438,7 +2599,7 @@ declare const QuoteSchema: z.ZodObject<{
2438
2599
  createdAt: z.ZodString;
2439
2600
  isValid: z.ZodBoolean;
2440
2601
  }, "strip", z.ZodTypeAny, {
2441
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
2602
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
2442
2603
  id: string;
2443
2604
  recipientCount: number;
2444
2605
  totalAmount: string;
@@ -2458,7 +2619,7 @@ declare const QuoteSchema: z.ZodObject<{
2458
2619
  }[];
2459
2620
  isValid: boolean;
2460
2621
  }, {
2461
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
2622
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
2462
2623
  id: string;
2463
2624
  recipientCount: number;
2464
2625
  totalAmount: string;
@@ -2565,7 +2726,7 @@ declare function parseQuoteOptions(options: unknown): {
2565
2726
  * Validate quote response
2566
2727
  */
2567
2728
  declare function validateQuote(quote: unknown): z.SafeParseReturnType<{
2568
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
2729
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
2569
2730
  id: string;
2570
2731
  recipientCount: number;
2571
2732
  totalAmount: string;
@@ -2585,7 +2746,7 @@ declare function validateQuote(quote: unknown): z.SafeParseReturnType<{
2585
2746
  }[];
2586
2747
  isValid: boolean;
2587
2748
  }, {
2588
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
2749
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
2589
2750
  id: string;
2590
2751
  recipientCount: number;
2591
2752
  totalAmount: string;
@@ -2609,7 +2770,7 @@ declare function validateQuote(quote: unknown): z.SafeParseReturnType<{
2609
2770
  * Parse quote response
2610
2771
  */
2611
2772
  declare function parseQuote(quote: unknown): {
2612
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
2773
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
2613
2774
  id: string;
2614
2775
  recipientCount: number;
2615
2776
  totalAmount: string;
@@ -2729,7 +2890,7 @@ declare const ReceiptSchema: z.ZodObject<{
2729
2890
  createdAt: z.ZodString;
2730
2891
  }, "strip", z.ZodTypeAny, {
2731
2892
  quoteId: string;
2732
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
2893
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
2733
2894
  id: string;
2734
2895
  totalAmount: string;
2735
2896
  createdAt: string;
@@ -2752,7 +2913,7 @@ declare const ReceiptSchema: z.ZodObject<{
2752
2913
  failedTransfers: number;
2753
2914
  }, {
2754
2915
  quoteId: string;
2755
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
2916
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
2756
2917
  id: string;
2757
2918
  totalAmount: string;
2758
2919
  createdAt: string;
@@ -2779,7 +2940,7 @@ declare const ReceiptSchema: z.ZodObject<{
2779
2940
  */
2780
2941
  declare function validateReceipt(receipt: unknown): z.SafeParseReturnType<{
2781
2942
  quoteId: string;
2782
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
2943
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
2783
2944
  id: string;
2784
2945
  totalAmount: string;
2785
2946
  createdAt: string;
@@ -2802,7 +2963,7 @@ declare function validateReceipt(receipt: unknown): z.SafeParseReturnType<{
2802
2963
  failedTransfers: number;
2803
2964
  }, {
2804
2965
  quoteId: string;
2805
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
2966
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
2806
2967
  id: string;
2807
2968
  totalAmount: string;
2808
2969
  createdAt: string;
@@ -2829,7 +2990,7 @@ declare function validateReceipt(receipt: unknown): z.SafeParseReturnType<{
2829
2990
  */
2830
2991
  declare function parseReceipt(receipt: unknown): {
2831
2992
  quoteId: string;
2832
- network: "base" | "ethereum" | "polygon" | "arbitrum" | "optimism";
2993
+ network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
2833
2994
  id: string;
2834
2995
  totalAmount: string;
2835
2996
  createdAt: string;
@@ -4344,4 +4505,4 @@ declare function validateFilterHasTargeting(filter: RecipientFilter): boolean;
4344
4505
  */
4345
4506
  declare function describeFilters(filter: RecipientFilter): string[];
4346
4507
 
4347
- export { API_BASE_URLS, API_KEY_PREFIXES, ActiveInLastDaysFilterSchema, AgentClient, type AgentClientConfig, type User as AgentUser, type ApiQuoteResponse, ApiQuoteResponseSchema, type ApiReceiptResponse, ApiReceiptResponseSchema, type AttentionPrice, type AttentionQuoteInput, BeeperClient, type BeeperClientConfig, type BeeperConfig, BeeperEconomicsFilterSchema, type BeeperEconomicsFilter as BeeperEconomicsFilterSchemaType, BeeperError, type BeeperErrorOptions, type BulkIntentInput, type BulkIntentResult, CachedTokenHolderFilterSchema, CachedTokenHolderSchema, type CachedTokenHolder as CachedTokenHolderSchemaType, type ConfirmDeploymentInput, type ConfirmDeploymentResult, type ConfirmDepositParams, type ConfirmDepositResponse, ConfirmDepositResponseSchema, type ConfirmResult, ConfirmResultSchema, CountryFilterSchema, type CreateIntentInput, DistributionStrategySchema, type Draft, type DraftInput, DraftInputSchema, DraftSchema, DraftStatusSchema, DraftUpdateSchema, type Environment, type ErrorCode, ErrorCodes, type ErrorContext, type EstimateInput, type EstimateResult, ExcludePingedTodayFilterSchema, ExcludeUsersFilterSchema, type ExecuteResult, ExecuteResultSchema, type ExecuteSendParams, type ExecuteSendResponse, ExecuteSendResponseSchema, ExecuteStatusSchema, FILTER_SCHEMA, FieldComparisonSchema, FilterBuilder, type FilterCategory, FilterExpression$1 as FilterExpression, type FilterExpressionJSON, FilterExpressionSchema, type FilterExpression as FilterExpressionSchemaType, type FilterFieldSchema, FilterOperatorSchema, FilterValueSchema, FollowersOfFilterSchema, FollowingOfFilterSchema, GasTierSchema, HEADERS, HTTP_STATUS_TO_ERROR_CODE, HasBaseWalletFilterSchema, HasRechargedInLastDaysFilterSchema, HasTierFilterSchema, HasVerifiedWalletFilterSchema, type Health, HttpClient, type HttpClientConfig, type HttpRequestOptions, type HttpResponse, IsWaitlistedFilterSchema, type LegacyFieldComparison, LegacyFieldComparisonSchema, type LegacyFilterOperator, LegacyFilterOperatorSchema, type LegacyFilterValue, LegacyFilterValueSchema, LegacyRecipientFilterDSLSchema, MaxAttentionPriceFilterSchema, MaxFidFilterSchema, MaxFollowersFilterSchema, MaxFollowingFilterSchema, MinAttentionPriceFilterSchema, MinBatteryPercentageFilterSchema, MinCastCountFilterSchema, MinClickThroughRateFilterSchema, MinFidFilterSchema, MinFollowersFilterSchema, MinFollowingFilterSchema, MinProTenureDaysFilterSchema, MinTenureDaysFilterSchema, MutualsWithFilterSchema, NetworkSchema, NeynarScoreMaxFilterSchema, NeynarScoreMinFilterSchema, OnchainFilterSchema, type OnchainFilter as OnchainFilterSchemaType, type OrderByOption, OrderBySchema, type OrderBy as OrderBySchemaType, type PaginatedResponse, type PaginationOptions, type PaymentIntent, type Platform, PlatformFilterSchema, type PlatformFilter as PlatformFilterSchemaType, type PollOptions$1 as PollOptions, type PreviewInput, type PreviewResult, type PreviewUser, ProSubscriptionFilterSchema, QUOTE_EXPIRATION_SECONDS, type Quote, type QuoteOptions, QuoteOptionsSchema, QuoteRecipientSchema, QuoteSchema, type QuoteStatus$2 as QuoteStatus, QuotientScoreMaxFilterSchema, QuotientScoreMinFilterSchema, RETRYABLE_ERROR_CODES, RETRY_CONFIG, type Receipt, ReceiptSchema, type ReceiptStatus, type ReceiptTransaction, ReceiptTransactionSchema, ReceiptTransferSchema, RecipientFilterDSLSchema, RecipientFilterSchema, type RecipientFilter as RecipientFilterSchemaType, ReputationFilterSchema, type ReputationFilter as ReputationFilterSchemaType, RequireLotteryOptInFilterSchema, RequireQuizOptInFilterSchema, type RetryOptions, RolesFilterSchema, SDK_VERSION, type PollOptions as SendPollOptions, type QuoteStatus$1 as SendQuoteStatus, type ReceiptTransaction$1 as SendReceiptTransaction, SignalTokenFilterSchema, type SimpleFilters, SocialFilterSchema, type SocialFilter as SocialFilterSchemaType, type SpamLabel, SpamLabelFilterSchema, type SpamLabelOption, SpecificUsersFilterSchema, TIMEOUTS, TimezoneFilterSchema, type TimezoneOptions, TokenHolderDiscoverySchema, type TokenHolderDiscovery as TokenHolderDiscoverySchemaType, TokenHolderFilterSchema, type TokenHolderOptions, TokenTypeSchema, TransferStatusSchema, type QuoteStatus as TypesQuoteStatus, VerifiedOnlyFilterSchema, type WalletChain, createHttpConfig, BeeperClient as default, describeFilters, generateDepositIdempotencyKey, generateExecuteIdempotencyKey, generateFilterDocumentation, generateIdempotencyKey, getAllFilterNames, getApiKeyEnvironment, getFilterSchema, isRetryableCode, isValidApiKeyFormat, maskApiKey, parseDraft, parseDraftInput, parseExecuteResult, parseFilter, parseQuote, parseQuoteOptions, parseReceipt, parseRecipientFilter, safeParseFilter, safeParseRecipientFilter, confirmDeposit as sendConfirmDeposit, createDraft as sendCreateDraft, createQuote as sendCreateQuote, executeSend as sendExecuteSend, getEstimatedTimeRemaining as sendGetEstimatedTimeRemaining, getFailedTransactions as sendGetFailedTransactions, getQuote as sendGetQuote, getReceipt as sendGetReceipt, getSuccessRate as sendGetSuccessRate, isComplete as sendIsComplete, isDepositSufficient as sendIsDepositSufficient, isExecuting as sendIsExecuting, isQuoteExpired as sendIsQuoteExpired, isReadyForDeposit as sendIsReadyForDeposit, isReadyForQuote as sendIsReadyForQuote, isSuccess as sendIsSuccess, pollUntilComplete as sendPollUntilComplete, updateDraft as sendUpdateDraft, validateDraftInput as sendValidateDraftInput, validateDraft, validateDraftInput$1 as validateDraftInput, validateExecuteResult, validateFilter, validateFilterHasTargeting, validateQuote, validateQuoteOptions, validateReceipt, validateRecipientFilter };
4508
+ export { API_BASE_URLS, API_KEY_PREFIXES, ActiveInLastDaysFilterSchema, AgentClient, type AgentClientConfig, type User as AgentUser, type ApiQuoteResponse, ApiQuoteResponseSchema, type ApiReceiptResponse, ApiReceiptResponseSchema, type AttentionPrice, type AttentionQuoteInput, BeeperClient, type BeeperClientConfig, type BeeperConfig, BeeperEconomicsFilterSchema, type BeeperEconomicsFilter as BeeperEconomicsFilterSchemaType, BeeperError, type BeeperErrorOptions, type BonusConfig, type BudgetSplit, type BulkIntentInput, type BulkIntentResult, type CTAType, CachedTokenHolderFilterSchema, CachedTokenHolderSchema, type CachedTokenHolder as CachedTokenHolderSchemaType, type CampaignInput, type ConfirmDeploymentInput, type ConfirmDeploymentResult, type ConfirmDepositParams, type ConfirmDepositResponse, ConfirmDepositResponseSchema, type ConfirmResult, ConfirmResultSchema, CountryFilterSchema, type CreateIntentInput, DistributionStrategySchema, type Draft, type DraftInput, DraftInputSchema, DraftSchema, DraftStatusSchema, DraftUpdateSchema, type Environment, type ErrorCode, ErrorCodes, type ErrorContext, type EstimateInput, type EstimateResult, ExcludePingedTodayFilterSchema, ExcludeUsersFilterSchema, type ExecuteResult, ExecuteResultSchema, type ExecuteSendParams, type ExecuteSendResponse, ExecuteSendResponseSchema, ExecuteStatusSchema, type ExternalVerifyCTA, type FCFSConfig, FILTER_SCHEMA, FieldComparisonSchema, FilterBuilder, type FilterCategory, FilterExpression$1 as FilterExpression, type FilterExpressionJSON, FilterExpressionSchema, type FilterExpression as FilterExpressionSchemaType, type FilterFieldSchema, FilterOperatorSchema, FilterValueSchema, type FollowProfileCTA, FollowersOfFilterSchema, FollowingOfFilterSchema, GasTierSchema, type GoalType, HEADERS, HTTP_STATUS_TO_ERROR_CODE, HasBaseWalletFilterSchema, HasRechargedInLastDaysFilterSchema, HasTierFilterSchema, HasVerifiedWalletFilterSchema, type Health, HttpClient, type HttpClientConfig, type HttpRequestOptions, type HttpResponse, IsWaitlistedFilterSchema, type LegacyFieldComparison, LegacyFieldComparisonSchema, type LegacyFilterOperator, LegacyFilterOperatorSchema, type LegacyFilterValue, LegacyFilterValueSchema, LegacyRecipientFilterDSLSchema, type LikeCastCTA, type LotteryConfig, MaxAttentionPriceFilterSchema, MaxFidFilterSchema, MaxFollowersFilterSchema, MaxFollowingFilterSchema, MinAttentionPriceFilterSchema, MinBatteryPercentageFilterSchema, MinCastCountFilterSchema, MinClickThroughRateFilterSchema, MinFidFilterSchema, MinFollowersFilterSchema, MinFollowingFilterSchema, MinProTenureDaysFilterSchema, MinTenureDaysFilterSchema, type MissionCTA, MutualsWithFilterSchema, NetworkSchema, NeynarScoreMaxFilterSchema, NeynarScoreMinFilterSchema, OnchainFilterSchema, type OnchainFilter as OnchainFilterSchemaType, type OrderByOption, OrderBySchema, type OrderBy as OrderBySchemaType, type PaginatedResponse, type PaginationOptions, type PaymentIntent, type Platform, PlatformFilterSchema, type PlatformFilter as PlatformFilterSchemaType, type PollOptions$1 as PollOptions, type PreviewInput, type PreviewResult, type PreviewUser, type PrizeTier, ProSubscriptionFilterSchema, QUOTE_EXPIRATION_SECONDS, type QuizCTA, type QuizQuestion, type Quote, type QuoteOptions, QuoteOptionsSchema, QuoteRecipientSchema, QuoteSchema, type QuoteStatus$2 as QuoteStatus, QuotientScoreMaxFilterSchema, QuotientScoreMinFilterSchema, RETRYABLE_ERROR_CODES, RETRY_CONFIG, type RecastCTA, type Receipt, ReceiptSchema, type ReceiptStatus, type ReceiptTransaction, ReceiptTransactionSchema, ReceiptTransferSchema, RecipientFilterDSLSchema, RecipientFilterSchema, type RecipientFilter as RecipientFilterSchemaType, ReputationFilterSchema, type ReputationFilter as ReputationFilterSchemaType, RequireLotteryOptInFilterSchema, RequireQuizOptInFilterSchema, type RetryOptions, RolesFilterSchema, SDK_VERSION, type PollOptions as SendPollOptions, type QuoteStatus$1 as SendQuoteStatus, type ReceiptTransaction$1 as SendReceiptTransaction, type ShareCastCTA, SignalTokenFilterSchema, type SimpleFilters, SocialFilterSchema, type SocialFilter as SocialFilterSchemaType, type SpamLabel, SpamLabelFilterSchema, type SpamLabelOption, SpecificUsersFilterSchema, type SplitPreset, TIMEOUTS, TimezoneFilterSchema, type TimezoneOptions, TokenHolderDiscoverySchema, type TokenHolderDiscovery as TokenHolderDiscoverySchemaType, TokenHolderFilterSchema, type TokenHolderOptions, TokenTypeSchema, TransferStatusSchema, type QuoteStatus as TypesQuoteStatus, VerifiedOnlyFilterSchema, type VisitLinkCTA, type WalletChain, type XFollowCTA, type XLikeCTA, type XRecastCTA, createHttpConfig, BeeperClient as default, describeFilters, generateDepositIdempotencyKey, generateExecuteIdempotencyKey, generateFilterDocumentation, generateIdempotencyKey, getAllFilterNames, getApiKeyEnvironment, getFilterSchema, isRetryableCode, isValidApiKeyFormat, maskApiKey, parseDraft, parseDraftInput, parseExecuteResult, parseFilter, parseQuote, parseQuoteOptions, parseReceipt, parseRecipientFilter, safeParseFilter, safeParseRecipientFilter, confirmDeposit as sendConfirmDeposit, createDraft as sendCreateDraft, createQuote as sendCreateQuote, executeSend as sendExecuteSend, getEstimatedTimeRemaining as sendGetEstimatedTimeRemaining, getFailedTransactions as sendGetFailedTransactions, getQuote as sendGetQuote, getReceipt as sendGetReceipt, getSuccessRate as sendGetSuccessRate, isComplete as sendIsComplete, isDepositSufficient as sendIsDepositSufficient, isExecuting as sendIsExecuting, isQuoteExpired as sendIsQuoteExpired, isReadyForDeposit as sendIsReadyForDeposit, isReadyForQuote as sendIsReadyForQuote, isSuccess as sendIsSuccess, pollUntilComplete as sendPollUntilComplete, updateDraft as sendUpdateDraft, validateDraftInput as sendValidateDraftInput, validateDraft, validateDraftInput$1 as validateDraftInput, validateExecuteResult, validateFilter, validateFilterHasTargeting, validateQuote, validateQuoteOptions, validateReceipt, validateRecipientFilter };
package/dist/index.js CHANGED
@@ -904,8 +904,16 @@ var ENDPOINTS = {
904
904
  PREVIEW: "/agent/preview",
905
905
  BULK_INTENT: "/agent/bulk-intent"
906
906
  };
907
- var AgentClient = class {
907
+ var AgentClient = class _AgentClient {
908
908
  http;
909
+ static CHAIN_ID_MAP = {
910
+ base: 8453,
911
+ ethereum: 1,
912
+ mainnet: 1,
913
+ arbitrum: 42161,
914
+ polygon: 137,
915
+ optimism: 10
916
+ };
909
917
  constructor(config) {
910
918
  if (!config.apiKey) {
911
919
  throw BeeperError.validation("API key is required");
@@ -920,6 +928,62 @@ var AgentClient = class {
920
928
  });
921
929
  this.http = new HttpClient(httpConfig);
922
930
  }
931
+ /**
932
+ * Normalize filters for agent endpoints (accepts flexible shapes from other builders)
933
+ */
934
+ normalizeFilters(filters) {
935
+ const normalized = { ...filters };
936
+ const stripEmptyArray = (key) => {
937
+ const val = normalized[key];
938
+ if (Array.isArray(val) && val.length === 0) {
939
+ delete normalized[key];
940
+ }
941
+ };
942
+ const stripZero = (key) => {
943
+ const val = normalized[key];
944
+ if (typeof val === "number" && val === 0) {
945
+ delete normalized[key];
946
+ }
947
+ };
948
+ if (normalized.platform === "all") delete normalized.platform;
949
+ if (normalized.spamLabel === "all") delete normalized.spamLabel;
950
+ stripZero("minFollowers");
951
+ stripZero("maxFollowers");
952
+ stripZero("activeInLastDays");
953
+ stripZero("minBatteryPercentage");
954
+ stripZero("hasRechargedInLastDays");
955
+ stripZero("maxAttentionPriceUsd");
956
+ if (normalized.neynarScoreMin === 0) delete normalized.neynarScoreMin;
957
+ if (normalized.neynarScoreMax === 1) delete normalized.neynarScoreMax;
958
+ if (normalized.quotientScoreMin === 0) delete normalized.quotientScoreMin;
959
+ if (normalized.quotientScoreMax === 1) delete normalized.quotientScoreMax;
960
+ if (Array.isArray(normalized.countries)) {
961
+ normalized.countries = normalized.countries.map((c) => typeof c === "string" ? c : c?.code).filter((c) => typeof c === "string" && c.trim().length > 0).map((c) => c.trim().toUpperCase());
962
+ }
963
+ stripEmptyArray("countries");
964
+ if (Array.isArray(normalized.tokenHolders)) {
965
+ normalized.tokenHolders = normalized.tokenHolders.map((holder) => {
966
+ if (!holder) return null;
967
+ if ("tokenAddress" in holder && "chainId" in holder) return holder;
968
+ const contractAddress = holder.contractAddress;
969
+ const chain = holder.chain;
970
+ const minBalance = holder.minBalance;
971
+ if (!contractAddress || chain == null) return null;
972
+ const chainId = typeof chain === "number" ? chain : _AgentClient.CHAIN_ID_MAP[String(chain).toLowerCase()] ?? Number(chain);
973
+ if (!Number.isFinite(chainId)) return null;
974
+ return {
975
+ tokenAddress: contractAddress,
976
+ chainId,
977
+ ...minBalance ? { minBalance } : {}
978
+ };
979
+ }).filter((holder) => !!holder);
980
+ }
981
+ stripEmptyArray("tokenHolders");
982
+ stripEmptyArray("signalTokens");
983
+ stripEmptyArray("fids");
984
+ stripEmptyArray("userIds");
985
+ return normalized;
986
+ }
923
987
  /**
924
988
  * Look up a user by username, FID, or wallet address
925
989
  *
@@ -1050,7 +1114,7 @@ var AgentClient = class {
1050
1114
  const response = await this.http.post(
1051
1115
  ENDPOINTS.ESTIMATE,
1052
1116
  {
1053
- filters: input.filters,
1117
+ filters: this.normalizeFilters(input.filters),
1054
1118
  budgetUsd: budgetStr,
1055
1119
  message: input.message
1056
1120
  }
@@ -1080,7 +1144,7 @@ var AgentClient = class {
1080
1144
  const response = await this.http.post(
1081
1145
  ENDPOINTS.PREVIEW,
1082
1146
  {
1083
- filters: input.filters,
1147
+ filters: this.normalizeFilters(input.filters),
1084
1148
  limit
1085
1149
  }
1086
1150
  );
@@ -1112,7 +1176,7 @@ var AgentClient = class {
1112
1176
  const response = await this.http.post(
1113
1177
  ENDPOINTS.BULK_INTENT,
1114
1178
  {
1115
- filters: input.filters,
1179
+ filters: this.normalizeFilters(input.filters),
1116
1180
  budgetUsd: budgetStr,
1117
1181
  message: input.message,
1118
1182
  chainId: input.chainId ?? 8453
@@ -1194,6 +1258,7 @@ function maskApiKey(apiKey) {
1194
1258
  }
1195
1259
 
1196
1260
  // src/client/BeeperClient.ts
1261
+ var ALLOWED_REWARD_TYPES = ["guaranteed", "lottery", "fcfs"];
1197
1262
  var QuoteSchema = z.object({
1198
1263
  id: z.string(),
1199
1264
  status: z.enum([
@@ -1400,6 +1465,16 @@ var BeeperClient = class {
1400
1465
  if (input.message.length > 1e3) {
1401
1466
  throw BeeperError.validation("Message must be 1000 characters or less");
1402
1467
  }
1468
+ if (input.rewardType !== void 0) {
1469
+ if (input.rewardType.trim().length === 0) {
1470
+ throw BeeperError.validation("rewardType must be a non-empty string");
1471
+ }
1472
+ if (!ALLOWED_REWARD_TYPES.includes(input.rewardType)) {
1473
+ throw BeeperError.validation(
1474
+ `rewardType must be one of: ${ALLOWED_REWARD_TYPES.join(", ")}`
1475
+ );
1476
+ }
1477
+ }
1403
1478
  if (!input.recipientFids?.length && !input.filter) {
1404
1479
  throw BeeperError.validation("Must provide either recipientFids or filter");
1405
1480
  }
@@ -1418,6 +1493,7 @@ var BeeperClient = class {
1418
1493
  filter: input.filter,
1419
1494
  budgetUSD: input.budgetUSD,
1420
1495
  rewardType: input.rewardType ?? "guaranteed",
1496
+ mode: "attention_marketplace",
1421
1497
  memo: input.memo,
1422
1498
  metadata: input.metadata,
1423
1499
  ttlSeconds: opts?.ttlSeconds ?? 300
@@ -2781,11 +2857,10 @@ var FilterBuilder = class _FilterBuilder {
2781
2857
  throw new Error("minBalance must be a numeric string (wei)");
2782
2858
  }
2783
2859
  }
2784
- const chainNames = { 1: "ethereum", 8453: "base", 42161: "arbitrum", 10: "optimism", 137: "polygon" };
2785
2860
  return new FilterExpression({
2786
2861
  cachedTokenHolders: opts.map((o) => ({
2787
2862
  contractAddress: o.tokenAddress,
2788
- chain: chainNames[o.chainId] ?? String(o.chainId),
2863
+ chain: o.chainId === 8453 ? "base" : "ethereum",
2789
2864
  tokenStandard: o.tokenStandard ?? "ERC20",
2790
2865
  ...o.minBalance !== void 0 ? { minBalance: o.minBalance } : {},
2791
2866
  ...o.tokenId !== void 0 ? { tokenId: o.tokenId } : {}