@beeperbot/sdk 0.2.1 → 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/README.md +5 -5
- package/dist/index.cjs +81 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -25
- package/dist/index.d.ts +38 -25
- package/dist/index.js +81 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -113,7 +113,7 @@ declare function generateFilterDocumentation(): string;
|
|
|
113
113
|
*
|
|
114
114
|
* @example
|
|
115
115
|
* ```typescript
|
|
116
|
-
* import { AgentClient } from '@
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
1034
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
1022
1035
|
status: "draft" | "quoted" | "executed";
|
|
1023
1036
|
id: string;
|
|
1024
1037
|
createdAt: string;
|
|
@@ -1915,7 +1928,7 @@ interface PaginatedResponse<T> {
|
|
|
1915
1928
|
*
|
|
1916
1929
|
* @example
|
|
1917
1930
|
* ```typescript
|
|
1918
|
-
* import { FilterBuilder } from '@
|
|
1931
|
+
* import { FilterBuilder } from '@beeperbot/sdk';
|
|
1919
1932
|
*
|
|
1920
1933
|
* const filter = FilterBuilder.and([
|
|
1921
1934
|
* FilterBuilder.platform('farcaster'),
|
|
@@ -2586,7 +2599,7 @@ declare const QuoteSchema: z.ZodObject<{
|
|
|
2586
2599
|
createdAt: z.ZodString;
|
|
2587
2600
|
isValid: z.ZodBoolean;
|
|
2588
2601
|
}, "strip", z.ZodTypeAny, {
|
|
2589
|
-
network: "base" | "ethereum" | "
|
|
2602
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2590
2603
|
id: string;
|
|
2591
2604
|
recipientCount: number;
|
|
2592
2605
|
totalAmount: string;
|
|
@@ -2606,7 +2619,7 @@ declare const QuoteSchema: z.ZodObject<{
|
|
|
2606
2619
|
}[];
|
|
2607
2620
|
isValid: boolean;
|
|
2608
2621
|
}, {
|
|
2609
|
-
network: "base" | "ethereum" | "
|
|
2622
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2610
2623
|
id: string;
|
|
2611
2624
|
recipientCount: number;
|
|
2612
2625
|
totalAmount: string;
|
|
@@ -2713,7 +2726,7 @@ declare function parseQuoteOptions(options: unknown): {
|
|
|
2713
2726
|
* Validate quote response
|
|
2714
2727
|
*/
|
|
2715
2728
|
declare function validateQuote(quote: unknown): z.SafeParseReturnType<{
|
|
2716
|
-
network: "base" | "ethereum" | "
|
|
2729
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2717
2730
|
id: string;
|
|
2718
2731
|
recipientCount: number;
|
|
2719
2732
|
totalAmount: string;
|
|
@@ -2733,7 +2746,7 @@ declare function validateQuote(quote: unknown): z.SafeParseReturnType<{
|
|
|
2733
2746
|
}[];
|
|
2734
2747
|
isValid: boolean;
|
|
2735
2748
|
}, {
|
|
2736
|
-
network: "base" | "ethereum" | "
|
|
2749
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2737
2750
|
id: string;
|
|
2738
2751
|
recipientCount: number;
|
|
2739
2752
|
totalAmount: string;
|
|
@@ -2757,7 +2770,7 @@ declare function validateQuote(quote: unknown): z.SafeParseReturnType<{
|
|
|
2757
2770
|
* Parse quote response
|
|
2758
2771
|
*/
|
|
2759
2772
|
declare function parseQuote(quote: unknown): {
|
|
2760
|
-
network: "base" | "ethereum" | "
|
|
2773
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2761
2774
|
id: string;
|
|
2762
2775
|
recipientCount: number;
|
|
2763
2776
|
totalAmount: string;
|
|
@@ -2877,7 +2890,7 @@ declare const ReceiptSchema: z.ZodObject<{
|
|
|
2877
2890
|
createdAt: z.ZodString;
|
|
2878
2891
|
}, "strip", z.ZodTypeAny, {
|
|
2879
2892
|
quoteId: string;
|
|
2880
|
-
network: "base" | "ethereum" | "
|
|
2893
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2881
2894
|
id: string;
|
|
2882
2895
|
totalAmount: string;
|
|
2883
2896
|
createdAt: string;
|
|
@@ -2900,7 +2913,7 @@ declare const ReceiptSchema: z.ZodObject<{
|
|
|
2900
2913
|
failedTransfers: number;
|
|
2901
2914
|
}, {
|
|
2902
2915
|
quoteId: string;
|
|
2903
|
-
network: "base" | "ethereum" | "
|
|
2916
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2904
2917
|
id: string;
|
|
2905
2918
|
totalAmount: string;
|
|
2906
2919
|
createdAt: string;
|
|
@@ -2927,7 +2940,7 @@ declare const ReceiptSchema: z.ZodObject<{
|
|
|
2927
2940
|
*/
|
|
2928
2941
|
declare function validateReceipt(receipt: unknown): z.SafeParseReturnType<{
|
|
2929
2942
|
quoteId: string;
|
|
2930
|
-
network: "base" | "ethereum" | "
|
|
2943
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2931
2944
|
id: string;
|
|
2932
2945
|
totalAmount: string;
|
|
2933
2946
|
createdAt: string;
|
|
@@ -2950,7 +2963,7 @@ declare function validateReceipt(receipt: unknown): z.SafeParseReturnType<{
|
|
|
2950
2963
|
failedTransfers: number;
|
|
2951
2964
|
}, {
|
|
2952
2965
|
quoteId: string;
|
|
2953
|
-
network: "base" | "ethereum" | "
|
|
2966
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2954
2967
|
id: string;
|
|
2955
2968
|
totalAmount: string;
|
|
2956
2969
|
createdAt: string;
|
|
@@ -2977,7 +2990,7 @@ declare function validateReceipt(receipt: unknown): z.SafeParseReturnType<{
|
|
|
2977
2990
|
*/
|
|
2978
2991
|
declare function parseReceipt(receipt: unknown): {
|
|
2979
2992
|
quoteId: string;
|
|
2980
|
-
network: "base" | "ethereum" | "
|
|
2993
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2981
2994
|
id: string;
|
|
2982
2995
|
totalAmount: string;
|
|
2983
2996
|
createdAt: string;
|
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 '@
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
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" | "
|
|
1034
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
1022
1035
|
status: "draft" | "quoted" | "executed";
|
|
1023
1036
|
id: string;
|
|
1024
1037
|
createdAt: string;
|
|
@@ -1915,7 +1928,7 @@ interface PaginatedResponse<T> {
|
|
|
1915
1928
|
*
|
|
1916
1929
|
* @example
|
|
1917
1930
|
* ```typescript
|
|
1918
|
-
* import { FilterBuilder } from '@
|
|
1931
|
+
* import { FilterBuilder } from '@beeperbot/sdk';
|
|
1919
1932
|
*
|
|
1920
1933
|
* const filter = FilterBuilder.and([
|
|
1921
1934
|
* FilterBuilder.platform('farcaster'),
|
|
@@ -2586,7 +2599,7 @@ declare const QuoteSchema: z.ZodObject<{
|
|
|
2586
2599
|
createdAt: z.ZodString;
|
|
2587
2600
|
isValid: z.ZodBoolean;
|
|
2588
2601
|
}, "strip", z.ZodTypeAny, {
|
|
2589
|
-
network: "base" | "ethereum" | "
|
|
2602
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2590
2603
|
id: string;
|
|
2591
2604
|
recipientCount: number;
|
|
2592
2605
|
totalAmount: string;
|
|
@@ -2606,7 +2619,7 @@ declare const QuoteSchema: z.ZodObject<{
|
|
|
2606
2619
|
}[];
|
|
2607
2620
|
isValid: boolean;
|
|
2608
2621
|
}, {
|
|
2609
|
-
network: "base" | "ethereum" | "
|
|
2622
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2610
2623
|
id: string;
|
|
2611
2624
|
recipientCount: number;
|
|
2612
2625
|
totalAmount: string;
|
|
@@ -2713,7 +2726,7 @@ declare function parseQuoteOptions(options: unknown): {
|
|
|
2713
2726
|
* Validate quote response
|
|
2714
2727
|
*/
|
|
2715
2728
|
declare function validateQuote(quote: unknown): z.SafeParseReturnType<{
|
|
2716
|
-
network: "base" | "ethereum" | "
|
|
2729
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2717
2730
|
id: string;
|
|
2718
2731
|
recipientCount: number;
|
|
2719
2732
|
totalAmount: string;
|
|
@@ -2733,7 +2746,7 @@ declare function validateQuote(quote: unknown): z.SafeParseReturnType<{
|
|
|
2733
2746
|
}[];
|
|
2734
2747
|
isValid: boolean;
|
|
2735
2748
|
}, {
|
|
2736
|
-
network: "base" | "ethereum" | "
|
|
2749
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2737
2750
|
id: string;
|
|
2738
2751
|
recipientCount: number;
|
|
2739
2752
|
totalAmount: string;
|
|
@@ -2757,7 +2770,7 @@ declare function validateQuote(quote: unknown): z.SafeParseReturnType<{
|
|
|
2757
2770
|
* Parse quote response
|
|
2758
2771
|
*/
|
|
2759
2772
|
declare function parseQuote(quote: unknown): {
|
|
2760
|
-
network: "base" | "ethereum" | "
|
|
2773
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2761
2774
|
id: string;
|
|
2762
2775
|
recipientCount: number;
|
|
2763
2776
|
totalAmount: string;
|
|
@@ -2877,7 +2890,7 @@ declare const ReceiptSchema: z.ZodObject<{
|
|
|
2877
2890
|
createdAt: z.ZodString;
|
|
2878
2891
|
}, "strip", z.ZodTypeAny, {
|
|
2879
2892
|
quoteId: string;
|
|
2880
|
-
network: "base" | "ethereum" | "
|
|
2893
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2881
2894
|
id: string;
|
|
2882
2895
|
totalAmount: string;
|
|
2883
2896
|
createdAt: string;
|
|
@@ -2900,7 +2913,7 @@ declare const ReceiptSchema: z.ZodObject<{
|
|
|
2900
2913
|
failedTransfers: number;
|
|
2901
2914
|
}, {
|
|
2902
2915
|
quoteId: string;
|
|
2903
|
-
network: "base" | "ethereum" | "
|
|
2916
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2904
2917
|
id: string;
|
|
2905
2918
|
totalAmount: string;
|
|
2906
2919
|
createdAt: string;
|
|
@@ -2927,7 +2940,7 @@ declare const ReceiptSchema: z.ZodObject<{
|
|
|
2927
2940
|
*/
|
|
2928
2941
|
declare function validateReceipt(receipt: unknown): z.SafeParseReturnType<{
|
|
2929
2942
|
quoteId: string;
|
|
2930
|
-
network: "base" | "ethereum" | "
|
|
2943
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2931
2944
|
id: string;
|
|
2932
2945
|
totalAmount: string;
|
|
2933
2946
|
createdAt: string;
|
|
@@ -2950,7 +2963,7 @@ declare function validateReceipt(receipt: unknown): z.SafeParseReturnType<{
|
|
|
2950
2963
|
failedTransfers: number;
|
|
2951
2964
|
}, {
|
|
2952
2965
|
quoteId: string;
|
|
2953
|
-
network: "base" | "ethereum" | "
|
|
2966
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2954
2967
|
id: string;
|
|
2955
2968
|
totalAmount: string;
|
|
2956
2969
|
createdAt: string;
|
|
@@ -2977,7 +2990,7 @@ declare function validateReceipt(receipt: unknown): z.SafeParseReturnType<{
|
|
|
2977
2990
|
*/
|
|
2978
2991
|
declare function parseReceipt(receipt: unknown): {
|
|
2979
2992
|
quoteId: string;
|
|
2980
|
-
network: "base" | "ethereum" | "
|
|
2993
|
+
network: "base" | "ethereum" | "arbitrum" | "polygon" | "optimism";
|
|
2981
2994
|
id: string;
|
|
2982
2995
|
totalAmount: string;
|
|
2983
2996
|
createdAt: string;
|
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:
|
|
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 } : {}
|