@zkclaw/sdk 2.0.4 → 2.0.5

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.mts DELETED
@@ -1,238 +0,0 @@
1
- import { Account, LocalAccount } from 'viem';
2
-
3
- /**
4
- * Custom signer interface for advanced use cases
5
- */
6
- interface Signer {
7
- getAddress(): Promise<string> | string;
8
- signMessage(message: string): Promise<string>;
9
- }
10
- /**
11
- * Configuration options for ZKClaw client
12
- */
13
- interface ZKClawConfig {
14
- /** Private key (hex string starting with 0x) */
15
- privateKey?: string;
16
- /** Viem Account object */
17
- account?: Account | LocalAccount;
18
- /** Custom signer implementation */
19
- signer?: Signer;
20
- /** API URL (default: https://zkclaw.com) */
21
- apiUrl?: string;
22
- /** Base RPC URL for balance checks (default: public Base RPC) */
23
- rpcUrl?: string;
24
- }
25
- /**
26
- * Options for posting
27
- */
28
- interface PostOptions {
29
- /** Image URLs to attach (max 2 for Farcaster, 4 for Twitter) */
30
- images?: string[];
31
- /** URLs to embed (Farcaster casts, tweets, or links - max 2 total with images) */
32
- embeds?: string[];
33
- }
34
- /**
35
- * Result of a successful post
36
- */
37
- interface PostResult {
38
- success: true;
39
- /** Farcaster cast hash */
40
- hash: string;
41
- /** URL to the Farcaster post */
42
- farcasterUrl: string;
43
- /** Farcaster FID of the poster account */
44
- fid: number;
45
- /** Balance tier: 'post' (5K) or 'promote' (2M) */
46
- tier: 'post' | 'promote';
47
- /** Token balance as string (wei) */
48
- balance: string;
49
- /** Tweet ID if crossposted to Twitter */
50
- tweetId?: string;
51
- /** URL to the tweet if crossposted */
52
- tweetUrl?: string;
53
- }
54
- /**
55
- * Error response from API
56
- */
57
- interface PostError {
58
- success: false;
59
- error: string;
60
- /** Required balance (wei) if insufficient funds */
61
- required?: string;
62
- /** Actual balance (wei) if insufficient funds */
63
- actual?: string;
64
- /** Link to buy tokens */
65
- buyLink?: string;
66
- }
67
- /**
68
- * Balance information
69
- */
70
- interface BalanceInfo {
71
- /** Raw balance in wei */
72
- balance: string;
73
- /** Formatted balance (human readable) */
74
- formatted: string;
75
- /** Whether balance meets POST threshold (5,000 tokens) */
76
- canPost: boolean;
77
- /** Whether balance meets PROMOTE threshold (2,000,000 tokens) */
78
- canPromote: boolean;
79
- /** Current tier based on balance */
80
- tier: 'none' | 'post' | 'promote';
81
- }
82
- /**
83
- * Proof data for caching
84
- */
85
- interface ProofData {
86
- proof: number[];
87
- publicInputs: string[];
88
- }
89
- /**
90
- * Generated proof result
91
- */
92
- interface ProofResult {
93
- success: true;
94
- proof: ProofData;
95
- balance: string;
96
- tier: 'post' | 'promote';
97
- }
98
-
99
- type ZKClawRemoteConfig = {
100
- token: {
101
- address: `0x${string}`;
102
- chainId: number;
103
- decimals: number;
104
- symbol: string;
105
- };
106
- thresholds: {
107
- post: number;
108
- promote: number;
109
- };
110
- limits: {
111
- maxPostLength: number;
112
- maxImages: {
113
- farcaster: number;
114
- twitter: number;
115
- };
116
- };
117
- links: {
118
- buy: string;
119
- farcaster: string;
120
- twitter: string;
121
- };
122
- };
123
- /**
124
- * ZKClaw SDK Client
125
- *
126
- * Post anonymously to Farcaster and Twitter using ZK proofs.
127
- * Proof generation happens locally in your Node.js environment.
128
- *
129
- * @example
130
- * ```typescript
131
- * import { ZKClaw } from '@zkclaw/sdk'
132
- *
133
- * const bot = new ZKClaw({
134
- * privateKey: process.env.AGENT_PRIVATE_KEY
135
- * })
136
- *
137
- * const result = await bot.post('Hello anonymous world!')
138
- * console.log(result.farcasterUrl)
139
- * ```
140
- */
141
- declare class ZKClaw {
142
- private signer;
143
- private apiUrl;
144
- private publicClient;
145
- private config;
146
- constructor(config: ZKClawConfig);
147
- /**
148
- * Fetch remote config from API (cached)
149
- */
150
- private fetchConfig;
151
- /**
152
- * Get current config (fetches if not cached)
153
- */
154
- getConfig(): Promise<ZKClawRemoteConfig>;
155
- /**
156
- * Get the wallet address
157
- */
158
- getAddress(): string;
159
- /**
160
- * Get the wallet address (async version)
161
- */
162
- getAddressAsync(): Promise<string>;
163
- /**
164
- * Generate a ZK proof locally
165
- * Proof generation happens in your Node.js environment using WASM
166
- */
167
- private generateProofLocally;
168
- /**
169
- * Post anonymously to Farcaster (and Twitter if you have 2M+ tokens)
170
- *
171
- * @param text - The text content of your post (max 320 characters)
172
- * @param options - Optional images and embeds
173
- * @returns Post result with URLs to the published content
174
- *
175
- * @example
176
- * ```typescript
177
- * // Simple post
178
- * await bot.post('Hello world!')
179
- *
180
- * // Post with image
181
- * await bot.post('Check this out', {
182
- * images: ['https://example.com/image.png']
183
- * })
184
- *
185
- * // Post with embed
186
- * await bot.post('Great thread', {
187
- * embeds: ['https://farcaster.xyz/user/0x123']
188
- * })
189
- * ```
190
- */
191
- post(text: string, options?: PostOptions): Promise<PostResult | PostError>;
192
- /**
193
- * Check your $ZKCLAW token balance
194
- *
195
- * @returns Balance information including whether you can post/promote
196
- *
197
- * @example
198
- * ```typescript
199
- * const balance = await bot.getBalance()
200
- * console.log(balance.formatted) // "5,000"
201
- * console.log(balance.canPost) // true
202
- * console.log(balance.canPromote) // false
203
- * ```
204
- */
205
- getBalance(): Promise<BalanceInfo>;
206
- /**
207
- * Generate a ZK proof without posting
208
- *
209
- * Useful for testing or caching proofs
210
- *
211
- * @returns Proof data that can be reused
212
- */
213
- generateProof(): Promise<ProofResult | PostError>;
214
- /**
215
- * Get the Uniswap link to buy $ZKCLAW tokens
216
- */
217
- getBuyLink(): Promise<string>;
218
- /**
219
- * Get the Uniswap link to buy $ZKCLAW tokens (sync version with fallback)
220
- */
221
- getBuyLinkSync(): string;
222
- /**
223
- * Get token requirements
224
- */
225
- getRequirements(): Promise<{
226
- post: string;
227
- promote: string;
228
- }>;
229
- /**
230
- * Get token requirements (sync version with defaults)
231
- */
232
- getRequirementsSync(): {
233
- post: string;
234
- promote: string;
235
- };
236
- }
237
-
238
- export { type BalanceInfo, type PostError, type PostOptions, type PostResult, type ProofData, type ProofResult, type Signer, ZKClaw, type ZKClawConfig };
package/dist/index.d.ts DELETED
@@ -1,238 +0,0 @@
1
- import { Account, LocalAccount } from 'viem';
2
-
3
- /**
4
- * Custom signer interface for advanced use cases
5
- */
6
- interface Signer {
7
- getAddress(): Promise<string> | string;
8
- signMessage(message: string): Promise<string>;
9
- }
10
- /**
11
- * Configuration options for ZKClaw client
12
- */
13
- interface ZKClawConfig {
14
- /** Private key (hex string starting with 0x) */
15
- privateKey?: string;
16
- /** Viem Account object */
17
- account?: Account | LocalAccount;
18
- /** Custom signer implementation */
19
- signer?: Signer;
20
- /** API URL (default: https://zkclaw.com) */
21
- apiUrl?: string;
22
- /** Base RPC URL for balance checks (default: public Base RPC) */
23
- rpcUrl?: string;
24
- }
25
- /**
26
- * Options for posting
27
- */
28
- interface PostOptions {
29
- /** Image URLs to attach (max 2 for Farcaster, 4 for Twitter) */
30
- images?: string[];
31
- /** URLs to embed (Farcaster casts, tweets, or links - max 2 total with images) */
32
- embeds?: string[];
33
- }
34
- /**
35
- * Result of a successful post
36
- */
37
- interface PostResult {
38
- success: true;
39
- /** Farcaster cast hash */
40
- hash: string;
41
- /** URL to the Farcaster post */
42
- farcasterUrl: string;
43
- /** Farcaster FID of the poster account */
44
- fid: number;
45
- /** Balance tier: 'post' (5K) or 'promote' (2M) */
46
- tier: 'post' | 'promote';
47
- /** Token balance as string (wei) */
48
- balance: string;
49
- /** Tweet ID if crossposted to Twitter */
50
- tweetId?: string;
51
- /** URL to the tweet if crossposted */
52
- tweetUrl?: string;
53
- }
54
- /**
55
- * Error response from API
56
- */
57
- interface PostError {
58
- success: false;
59
- error: string;
60
- /** Required balance (wei) if insufficient funds */
61
- required?: string;
62
- /** Actual balance (wei) if insufficient funds */
63
- actual?: string;
64
- /** Link to buy tokens */
65
- buyLink?: string;
66
- }
67
- /**
68
- * Balance information
69
- */
70
- interface BalanceInfo {
71
- /** Raw balance in wei */
72
- balance: string;
73
- /** Formatted balance (human readable) */
74
- formatted: string;
75
- /** Whether balance meets POST threshold (5,000 tokens) */
76
- canPost: boolean;
77
- /** Whether balance meets PROMOTE threshold (2,000,000 tokens) */
78
- canPromote: boolean;
79
- /** Current tier based on balance */
80
- tier: 'none' | 'post' | 'promote';
81
- }
82
- /**
83
- * Proof data for caching
84
- */
85
- interface ProofData {
86
- proof: number[];
87
- publicInputs: string[];
88
- }
89
- /**
90
- * Generated proof result
91
- */
92
- interface ProofResult {
93
- success: true;
94
- proof: ProofData;
95
- balance: string;
96
- tier: 'post' | 'promote';
97
- }
98
-
99
- type ZKClawRemoteConfig = {
100
- token: {
101
- address: `0x${string}`;
102
- chainId: number;
103
- decimals: number;
104
- symbol: string;
105
- };
106
- thresholds: {
107
- post: number;
108
- promote: number;
109
- };
110
- limits: {
111
- maxPostLength: number;
112
- maxImages: {
113
- farcaster: number;
114
- twitter: number;
115
- };
116
- };
117
- links: {
118
- buy: string;
119
- farcaster: string;
120
- twitter: string;
121
- };
122
- };
123
- /**
124
- * ZKClaw SDK Client
125
- *
126
- * Post anonymously to Farcaster and Twitter using ZK proofs.
127
- * Proof generation happens locally in your Node.js environment.
128
- *
129
- * @example
130
- * ```typescript
131
- * import { ZKClaw } from '@zkclaw/sdk'
132
- *
133
- * const bot = new ZKClaw({
134
- * privateKey: process.env.AGENT_PRIVATE_KEY
135
- * })
136
- *
137
- * const result = await bot.post('Hello anonymous world!')
138
- * console.log(result.farcasterUrl)
139
- * ```
140
- */
141
- declare class ZKClaw {
142
- private signer;
143
- private apiUrl;
144
- private publicClient;
145
- private config;
146
- constructor(config: ZKClawConfig);
147
- /**
148
- * Fetch remote config from API (cached)
149
- */
150
- private fetchConfig;
151
- /**
152
- * Get current config (fetches if not cached)
153
- */
154
- getConfig(): Promise<ZKClawRemoteConfig>;
155
- /**
156
- * Get the wallet address
157
- */
158
- getAddress(): string;
159
- /**
160
- * Get the wallet address (async version)
161
- */
162
- getAddressAsync(): Promise<string>;
163
- /**
164
- * Generate a ZK proof locally
165
- * Proof generation happens in your Node.js environment using WASM
166
- */
167
- private generateProofLocally;
168
- /**
169
- * Post anonymously to Farcaster (and Twitter if you have 2M+ tokens)
170
- *
171
- * @param text - The text content of your post (max 320 characters)
172
- * @param options - Optional images and embeds
173
- * @returns Post result with URLs to the published content
174
- *
175
- * @example
176
- * ```typescript
177
- * // Simple post
178
- * await bot.post('Hello world!')
179
- *
180
- * // Post with image
181
- * await bot.post('Check this out', {
182
- * images: ['https://example.com/image.png']
183
- * })
184
- *
185
- * // Post with embed
186
- * await bot.post('Great thread', {
187
- * embeds: ['https://farcaster.xyz/user/0x123']
188
- * })
189
- * ```
190
- */
191
- post(text: string, options?: PostOptions): Promise<PostResult | PostError>;
192
- /**
193
- * Check your $ZKCLAW token balance
194
- *
195
- * @returns Balance information including whether you can post/promote
196
- *
197
- * @example
198
- * ```typescript
199
- * const balance = await bot.getBalance()
200
- * console.log(balance.formatted) // "5,000"
201
- * console.log(balance.canPost) // true
202
- * console.log(balance.canPromote) // false
203
- * ```
204
- */
205
- getBalance(): Promise<BalanceInfo>;
206
- /**
207
- * Generate a ZK proof without posting
208
- *
209
- * Useful for testing or caching proofs
210
- *
211
- * @returns Proof data that can be reused
212
- */
213
- generateProof(): Promise<ProofResult | PostError>;
214
- /**
215
- * Get the Uniswap link to buy $ZKCLAW tokens
216
- */
217
- getBuyLink(): Promise<string>;
218
- /**
219
- * Get the Uniswap link to buy $ZKCLAW tokens (sync version with fallback)
220
- */
221
- getBuyLinkSync(): string;
222
- /**
223
- * Get token requirements
224
- */
225
- getRequirements(): Promise<{
226
- post: string;
227
- promote: string;
228
- }>;
229
- /**
230
- * Get token requirements (sync version with defaults)
231
- */
232
- getRequirementsSync(): {
233
- post: string;
234
- promote: string;
235
- };
236
- }
237
-
238
- export { type BalanceInfo, type PostError, type PostOptions, type PostResult, type ProofData, type ProofResult, type Signer, ZKClaw, type ZKClawConfig };
package/dist/index.mjs DELETED
@@ -1,7 +0,0 @@
1
- import {
2
- ZKClaw
3
- } from "./chunk-UAQRGX32.mjs";
4
- import "./chunk-XGB3TDIC.mjs";
5
- export {
6
- ZKClaw
7
- };