clanker-sdk 4.2.8 → 4.2.10

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.
@@ -1,6 +1,308 @@
1
- import { WalletClient, Transport, Chain, Account, PublicClient } from 'viem';
1
+ import * as viem from 'viem';
2
+ import { Abi, WalletClient, Transport, Chain, Account, PublicClient } from 'viem';
2
3
  import { C as ClankerError } from '../errors-5Gv28Tkr.js';
3
4
 
5
+ /**
6
+ * Clanker factory addresses on Base by version
7
+ */
8
+ declare const LEGACY_FACTORIES: {
9
+ readonly 0: "0x250c9FB2b411B48273f69879007803790A6AeA47";
10
+ readonly 1: "0x9B84fcE5Dcd9a38d2D01d5D72373F6b6b067c3e1";
11
+ readonly 2: "0x732560fa1d1A76350b1A500155BA978031B53833";
12
+ readonly 3: "0x375C15db32D28cEcdcAB5C03Ab889bf15cbD2c5E";
13
+ readonly 3.1: "0x2A787b2362021cC3eEa3C24C4748a6cD5B687382";
14
+ };
15
+ type LegacyVersion = 0 | 1 | 2 | 3 | 3.1;
16
+ type LegacyFeeClaimsConfig$1 = {
17
+ wallet?: WalletClient<Transport, Chain, Account>;
18
+ publicClient?: PublicClient;
19
+ };
20
+ /**
21
+ * Transaction config for legacy fee claiming.
22
+ * Compatible with walletClient.writeContract()
23
+ */
24
+ type LegacyClaimTransactionConfig = {
25
+ address: `0x${string}`;
26
+ abi: Abi;
27
+ functionName: string;
28
+ args: readonly unknown[];
29
+ };
30
+ /**
31
+ * v0/v1 locker params - required for versions 0 and 1
32
+ */
33
+ type LockerParams = {
34
+ /** The locker contract address that holds the LP position */
35
+ locker: `0x${string}`;
36
+ /** The Uniswap V3 position NFT ID */
37
+ positionId: bigint;
38
+ /** The address to receive the fees */
39
+ recipient: `0x${string}`;
40
+ };
41
+ /**
42
+ * Input for claiming legacy creator fees.
43
+ *
44
+ * For v2/v3/v3.1: Only `token` and `version` are required.
45
+ * For v0/v1: Additional `lockerParams` are required.
46
+ */
47
+ type ClaimLegacyCreatorFeesInput = {
48
+ /** The Clanker token address */
49
+ token: `0x${string}`;
50
+ /** Token version */
51
+ version: 2 | 3 | 3.1;
52
+ } | {
53
+ /** The Clanker token address */
54
+ token: `0x${string}`;
55
+ /** Token version */
56
+ version: 0 | 1;
57
+ /** Required for v0/v1: locker info from TokenCreated event */
58
+ lockerParams: LockerParams;
59
+ };
60
+ /**
61
+ * Legacy Creator Fee Claims for Clanker v0–v3.1 on Base.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * const clanker = new LegacyCreatorFees({ wallet, publicClient });
66
+ *
67
+ * // v2/v3/v3.1 - simple!
68
+ * await clanker.claimLegacyCreatorFees({ token: '0x...', version: 3.1 });
69
+ *
70
+ * // v0/v1 - need locker info
71
+ * await clanker.claimLegacyCreatorFees({
72
+ * token: '0x...',
73
+ * version: 1,
74
+ * lockerParams: { locker: '0x...', positionId: 123n, recipient: '0x...' }
75
+ * });
76
+ * ```
77
+ */
78
+ declare class LegacyCreatorFees {
79
+ readonly wallet?: WalletClient<Transport, Chain, Account>;
80
+ readonly publicClient?: PublicClient;
81
+ constructor(config?: LegacyFeeClaimsConfig$1);
82
+ private assertBase;
83
+ /**
84
+ * Get a transaction config for claiming legacy creator fees.
85
+ *
86
+ * @param input Token address, version, and locker params (for v0/v1)
87
+ * @returns Transaction config
88
+ */
89
+ getClaimLegacyCreatorFeesTransaction(input: ClaimLegacyCreatorFeesInput): LegacyClaimTransactionConfig;
90
+ /**
91
+ * Get a transaction config for claiming via meta-locker (some v0 tokens).
92
+ *
93
+ * @param locker The locker contract address
94
+ * @param positionId The Uniswap V3 position NFT ID
95
+ * @returns Transaction config
96
+ */
97
+ getMetaLockerClaimTransaction(locker: `0x${string}`, positionId: bigint): LegacyClaimTransactionConfig;
98
+ /**
99
+ * Simulate claiming legacy creator fees.
100
+ *
101
+ * @param input Token address, version, and locker params (for v0/v1)
102
+ * @param account Optional account to simulate from
103
+ * @returns Simulation result or error
104
+ */
105
+ claimLegacyCreatorFeesSimulate(input: ClaimLegacyCreatorFeesInput, account?: Account): Promise<viem.SimulateContractReturnType<Abi | readonly unknown[], string, readonly unknown[], Chain | undefined, undefined, undefined, undefined, readonly [never], undefined> | {
106
+ error: ClankerError;
107
+ }>;
108
+ /**
109
+ * Claim legacy creator fees.
110
+ *
111
+ * @param input Token address, version, and locker params (for v0/v1)
112
+ * @returns Transaction hash or error
113
+ */
114
+ claimLegacyCreatorFees(input: ClaimLegacyCreatorFeesInput): Promise<{
115
+ txHash: `0x${string}`;
116
+ error: undefined;
117
+ } | {
118
+ txHash: undefined;
119
+ error: ClankerError;
120
+ }>;
121
+ }
122
+ /**
123
+ * Get a transaction config for claiming legacy creator fees.
124
+ *
125
+ * @param input Token address, version, and locker params (for v0/v1)
126
+ * @returns Transaction config
127
+ *
128
+ * @example
129
+ * ```ts
130
+ * // v3.1 token - simple
131
+ * const tx = getClaimLegacyCreatorFeesTransaction({
132
+ * token: '0x...',
133
+ * version: 3.1
134
+ * });
135
+ *
136
+ * // v1 token - need locker info
137
+ * const tx = getClaimLegacyCreatorFeesTransaction({
138
+ * token: '0x...',
139
+ * version: 1,
140
+ * lockerParams: { locker: '0x...', positionId: 123n, recipient: '0x...' }
141
+ * });
142
+ *
143
+ * await walletClient.writeContract(tx);
144
+ * ```
145
+ */
146
+ declare function getClaimLegacyCreatorFeesTransaction(input: ClaimLegacyCreatorFeesInput): LegacyClaimTransactionConfig;
147
+
148
+ /**
149
+ * Base chain ID
150
+ */
151
+ declare const BASE_CHAIN_ID: 8453;
152
+ /**
153
+ * Uniswap V3 addresses on Base
154
+ */
155
+ declare const UNISWAP_V3_BASE: {
156
+ readonly factory: "0x33128a8fC17869897dcE68Ed026d694621f6FDfD";
157
+ readonly nonfungiblePositionManager: "0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1";
158
+ readonly weth: "0x4200000000000000000000000000000000000006";
159
+ };
160
+ /**
161
+ * Clanker factories on Base (v0–v3.1)
162
+ */
163
+ declare const CLANKER_FACTORIES_BASE: {
164
+ readonly clanker_v0: "0x250c9FB2b411B48273f69879007803790A6AeA47";
165
+ readonly clanker_v1: "0x9B84fcE5Dcd9a38d2D01d5D72373F6b6b067c3e1";
166
+ readonly clanker_v2: "0x732560fa1d1A76350b1A500155BA978031B53833";
167
+ readonly clanker_v3: "0x375C15db32D28cEcdcAB5C03Ab889bf15cbD2c5E";
168
+ readonly clanker_v3_presale: "0x71cDc0bDF30F5601fb0ac80Cf1d20B771342C035";
169
+ readonly clanker_v3_1: "0x2A787b2362021cC3eEa3C24C4748a6cD5B687382";
170
+ };
171
+ /**
172
+ * Legacy token type labels for v0–v3.1
173
+ */
174
+ type LegacyTokenType = 'proxy' | 'clanker' | 'clanker_v2' | 'clanker_v3' | 'clanker_v3_1';
175
+ declare const ClankerClaimRewardsAbi: readonly [{
176
+ readonly type: "function";
177
+ readonly name: "claimRewards";
178
+ readonly stateMutability: "nonpayable";
179
+ readonly inputs: readonly [{
180
+ readonly name: "token";
181
+ readonly type: "address";
182
+ }];
183
+ readonly outputs: readonly [];
184
+ }];
185
+ declare const LockerCollectFeesAbi: readonly [{
186
+ readonly type: "function";
187
+ readonly name: "collectFees";
188
+ readonly stateMutability: "nonpayable";
189
+ readonly inputs: readonly [{
190
+ readonly name: "_recipient";
191
+ readonly type: "address";
192
+ }, {
193
+ readonly name: "_tokenId";
194
+ readonly type: "uint256";
195
+ }];
196
+ readonly outputs: readonly [];
197
+ }];
198
+ declare const MetaLockerCollectFeesAbi: readonly [{
199
+ readonly type: "function";
200
+ readonly name: "collectFees";
201
+ readonly stateMutability: "nonpayable";
202
+ readonly inputs: readonly [{
203
+ readonly name: "_tokenId";
204
+ readonly type: "uint256";
205
+ }];
206
+ readonly outputs: readonly [];
207
+ }];
208
+ declare const ClankerTokenDeployerAbi: readonly [{
209
+ readonly type: "function";
210
+ readonly name: "deployer";
211
+ readonly stateMutability: "view";
212
+ readonly inputs: readonly [];
213
+ readonly outputs: readonly [{
214
+ readonly name: "";
215
+ readonly type: "address";
216
+ }];
217
+ }];
218
+ declare const NonfungiblePositionManagerOwnerOfAbi: readonly [{
219
+ readonly type: "function";
220
+ readonly name: "ownerOf";
221
+ readonly stateMutability: "view";
222
+ readonly inputs: readonly [{
223
+ readonly name: "tokenId";
224
+ readonly type: "uint256";
225
+ }];
226
+ readonly outputs: readonly [{
227
+ readonly name: "";
228
+ readonly type: "address";
229
+ }];
230
+ }];
231
+ declare const NonfungiblePositionManagerPositionsAbi: readonly [{
232
+ readonly type: "function";
233
+ readonly name: "positions";
234
+ readonly stateMutability: "view";
235
+ readonly inputs: readonly [{
236
+ readonly name: "tokenId";
237
+ readonly type: "uint256";
238
+ }];
239
+ readonly outputs: readonly [{
240
+ readonly name: "nonce";
241
+ readonly type: "uint96";
242
+ }, {
243
+ readonly name: "operator";
244
+ readonly type: "address";
245
+ }, {
246
+ readonly name: "token0";
247
+ readonly type: "address";
248
+ }, {
249
+ readonly name: "token1";
250
+ readonly type: "address";
251
+ }, {
252
+ readonly name: "fee";
253
+ readonly type: "uint24";
254
+ }, {
255
+ readonly name: "tickLower";
256
+ readonly type: "int24";
257
+ }, {
258
+ readonly name: "tickUpper";
259
+ readonly type: "int24";
260
+ }, {
261
+ readonly name: "liquidity";
262
+ readonly type: "uint128";
263
+ }, {
264
+ readonly name: "feeGrowthInside0LastX128";
265
+ readonly type: "uint256";
266
+ }, {
267
+ readonly name: "feeGrowthInside1LastX128";
268
+ readonly type: "uint256";
269
+ }, {
270
+ readonly name: "tokensOwed0";
271
+ readonly type: "uint128";
272
+ }, {
273
+ readonly name: "tokensOwed1";
274
+ readonly type: "uint128";
275
+ }];
276
+ }];
277
+ declare const NonfungiblePositionManagerCollectAbi: readonly [{
278
+ readonly type: "function";
279
+ readonly name: "collect";
280
+ readonly stateMutability: "payable";
281
+ readonly inputs: readonly [{
282
+ readonly name: "params";
283
+ readonly type: "tuple";
284
+ readonly components: readonly [{
285
+ readonly name: "tokenId";
286
+ readonly type: "uint256";
287
+ }, {
288
+ readonly name: "recipient";
289
+ readonly type: "address";
290
+ }, {
291
+ readonly name: "amount0Max";
292
+ readonly type: "uint128";
293
+ }, {
294
+ readonly name: "amount1Max";
295
+ readonly type: "uint128";
296
+ }];
297
+ }];
298
+ readonly outputs: readonly [{
299
+ readonly name: "amount0";
300
+ readonly type: "uint256";
301
+ }, {
302
+ readonly name: "amount1";
303
+ readonly type: "uint256";
304
+ }];
305
+ }];
4
306
  /**
5
307
  * Contract address for ClankerSafeErc20Spender on Base network
6
308
  */
@@ -9,6 +311,54 @@ type LegacyFeeClaimsConfig = {
9
311
  wallet?: WalletClient<Transport, Chain, Account>;
10
312
  publicClient?: PublicClient;
11
313
  };
314
+ /**
315
+ * Input arguments for building a legacy fee claim transaction
316
+ */
317
+ type LegacyClaimArgs = {
318
+ /** Must be 8453 (Base) */
319
+ chainId: number;
320
+ /** The Clanker token contract address */
321
+ token: `0x${string}`;
322
+ /** Token type label (proxy, clanker, clanker_v2, clanker_v3, clanker_v3_1) */
323
+ tokenType?: LegacyTokenType;
324
+ /** Factory address (required for v2–v3.1 factory claim) */
325
+ factory?: `0x${string}`;
326
+ /** Locker address (required for v0–v1 locker claim) */
327
+ locker?: `0x${string}`;
328
+ /** Uniswap V3 position NFT ID (required for v0–v1 claim and claimable estimation) */
329
+ positionId?: bigint;
330
+ /** Recipient address (required for Locker.collectFees) */
331
+ recipient?: `0x${string}`;
332
+ /** Wallet address for v1 deployer gating and optional simulate account */
333
+ walletAddress?: `0x${string}`;
334
+ };
335
+ /** @deprecated Use LegacyClaimArgs instead */
336
+ type LegacyClaimFeesInput = LegacyClaimArgs;
337
+ /**
338
+ * Transaction kind for legacy fee claims
339
+ */
340
+ type LegacyClaimTxKind = 'factory.claimRewards' | 'locker.collectFees' | 'metaLocker.collectFees';
341
+ /**
342
+ * Transaction output for legacy fee claims
343
+ */
344
+ type LegacyClaimTx = {
345
+ kind: LegacyClaimTxKind;
346
+ to: `0x${string}`;
347
+ data: `0x${string}`;
348
+ value?: bigint;
349
+ };
350
+ /** @deprecated Use LegacyClaimTx instead */
351
+ type LegacyClaimFeesTransaction = LegacyClaimTx;
352
+ /**
353
+ * Result of estimating claimable fees
354
+ */
355
+ type LegacyClaimableFees = {
356
+ positionOwner: `0x${string}`;
357
+ token0: `0x${string}`;
358
+ token1: `0x${string}`;
359
+ amount0: bigint;
360
+ amount1: bigint;
361
+ };
12
362
  /**
13
363
  * SDK for claiming legacy fees from Clanker v0-v3.1 tokens.
14
364
  *
@@ -24,6 +374,24 @@ declare class LegacyFeeClaims {
24
374
  readonly wallet?: WalletClient<Transport, Chain, Account>;
25
375
  readonly publicClient?: PublicClient;
26
376
  constructor(config?: LegacyFeeClaimsConfig);
377
+ private assertBaseChain;
378
+ /**
379
+ * Build a Base-only transaction for claiming legacy fees (v0-v3.1).
380
+ *
381
+ * @param args Claim arguments
382
+ * @returns Transaction object with { kind, to, data, value? }
383
+ */
384
+ getClaimLegacyFeesTransaction(args: LegacyClaimArgs): Promise<LegacyClaimTx>;
385
+ /**
386
+ * Estimate claimable Uniswap v3 LP fees for a legacy position on Base.
387
+ *
388
+ * @param opts Options with chainId and positionId
389
+ * @returns Claimable fees with position owner, token0, token1, amount0, amount1
390
+ */
391
+ getLegacyClaimableFees(opts: {
392
+ chainId: number;
393
+ positionId: bigint;
394
+ }): Promise<LegacyClaimableFees>;
27
395
  /**
28
396
  * Get an abi-typed transaction for initializing token creator ownership.
29
397
  *
@@ -2682,5 +3050,29 @@ declare function getTokenCreatorTransferTransaction({ safe, token, recipient, }:
2682
3050
  functionName: "tokenCreatorTransfer";
2683
3051
  args: readonly [`0x${string}`, `0x${string}`, `0x${string}`];
2684
3052
  };
3053
+ /**
3054
+ * Build a claim transaction for legacy Clanker v0–v3.1 fees on Base.
3055
+ *
3056
+ * - v2/v3/v3.1: call factory.claimRewards(token)
3057
+ * - v0/v1: call locker.collectFees(recipient, tokenId) or metaLocker.collectFees(tokenId)
3058
+ *
3059
+ * @param publicClient Viem public client for Base
3060
+ * @param args Claim arguments
3061
+ * @returns Transaction object with { kind, to, data, value? }
3062
+ */
3063
+ declare function getClaimLegacyFeesTransaction(publicClient: PublicClient, args: LegacyClaimArgs): Promise<LegacyClaimTx>;
3064
+ /**
3065
+ * Estimate claimable Uniswap V3 LP fees for a legacy position on Base.
3066
+ *
3067
+ * Reads ownerOf(positionId) and simulates collect() to get the claimable amounts.
3068
+ *
3069
+ * @param publicClient Viem public client for Base
3070
+ * @param opts Options with chainId and positionId
3071
+ * @returns Claimable fees with positionOwner, token0, token1, amount0, amount1
3072
+ */
3073
+ declare function getLegacyClaimableFees(publicClient: PublicClient, opts: {
3074
+ chainId: number;
3075
+ positionId: bigint;
3076
+ }): Promise<LegacyClaimableFees>;
2685
3077
 
2686
- export { EXPECTED_MERKLE_ROOT, LEGACY_FEE_CLAIMS_ADDRESS, LegacyFeeClaims, type MerkleProofResult, type TokenCreatorEntry, getInitializeTokenCreatorTransaction, getTokenCreatorMerkleProof, getTokenCreatorTransferTransaction, getUpdateTokenCreatorTransaction, parseTokenCreatorCSV };
3078
+ export { BASE_CHAIN_ID, CLANKER_FACTORIES_BASE, type ClaimLegacyCreatorFeesInput, ClankerClaimRewardsAbi, ClankerTokenDeployerAbi, EXPECTED_MERKLE_ROOT, LEGACY_FACTORIES, LEGACY_FEE_CLAIMS_ADDRESS, type LegacyClaimArgs, type LegacyClaimFeesInput, type LegacyClaimFeesTransaction, type LegacyClaimTransactionConfig, type LegacyClaimTx, type LegacyClaimTxKind, type LegacyClaimableFees, LegacyCreatorFees, LegacyFeeClaims, type LegacyTokenType, type LegacyVersion, LockerCollectFeesAbi, type LockerParams, type MerkleProofResult, MetaLockerCollectFeesAbi, NonfungiblePositionManagerCollectAbi, NonfungiblePositionManagerOwnerOfAbi, NonfungiblePositionManagerPositionsAbi, type TokenCreatorEntry, UNISWAP_V3_BASE, getClaimLegacyCreatorFeesTransaction, getClaimLegacyFeesTransaction, getInitializeTokenCreatorTransaction, getLegacyClaimableFees, getTokenCreatorMerkleProof, getTokenCreatorTransferTransaction, getUpdateTokenCreatorTransaction, parseTokenCreatorCSV };