clanker-sdk 4.1.6 → 4.1.8

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.
@@ -24,7 +24,12 @@ declare class Clanker {
24
24
  * @param rewardRecipient The recipient to claim for
25
25
  * @returns Abi transaction
26
26
  */
27
- getClaimRewardsTransaction(token: `0x${string}`, rewardRecipient: `0x${string}`): Promise<ClankerTransactionConfig<typeof ClankerFeeLocker_abi>>;
27
+ getClaimRewardsTransaction({ token, rewardRecipient }: {
28
+ token: `0x${string}`;
29
+ rewardRecipient: `0x${string}`;
30
+ }, options?: {
31
+ chain?: Chain;
32
+ }): Promise<ClankerTransactionConfig<typeof ClankerFeeLocker_abi>>;
28
33
  /**
29
34
  * Simulate claiming rewards. Will use the wallet account on the Clanker class or
30
35
  * the passed-in account.
@@ -34,7 +39,10 @@ declare class Clanker {
34
39
  * @param account Optional account to simulate calling claiming for
35
40
  * @returns The simulated output
36
41
  */
37
- claimRewardsSimulate(token: `0x${string}`, rewardRecipient: `0x${string}`, account?: Account): Promise<(viem.SimulateContractReturnType<readonly [{
42
+ claimRewardsSimulate({ token, rewardRecipient }: {
43
+ token: `0x${string}`;
44
+ rewardRecipient: `0x${string}`;
45
+ }, account?: Account): Promise<(viem.SimulateContractReturnType<readonly [{
38
46
  readonly inputs: readonly [{
39
47
  readonly internalType: "address";
40
48
  readonly name: "owner_";
@@ -337,7 +345,10 @@ declare class Clanker {
337
345
  * @param rewardRecipient The recipient to claim for
338
346
  * @returns Transaction hash of the claim or error
339
347
  */
340
- claimRewards(token: `0x${string}`, rewardRecipient: `0x${string}`): Promise<{
348
+ claimRewards({ token, rewardRecipient, }: {
349
+ token: `0x${string}`;
350
+ rewardRecipient: `0x${string}`;
351
+ }): Promise<{
341
352
  txHash: `0x${string}`;
342
353
  error: undefined;
343
354
  } | {
@@ -351,8 +362,13 @@ declare class Clanker {
351
362
  * @param rewardRecipient The recipient to check rewards for
352
363
  * @returns Abi transaction
353
364
  */
354
- getAvailableRewardsTransaction(token: `0x${string}`, rewardRecipient: `0x${string}`): Promise<{
355
- readonly address: "0xF3622742b1E446D92e45E22923Ef11C2fcD55D68";
365
+ getAvailableRewardsTransaction({ token, rewardRecipient }: {
366
+ token: `0x${string}`;
367
+ rewardRecipient: `0x${string}`;
368
+ }, options?: {
369
+ chain?: Chain;
370
+ }): Promise<{
371
+ readonly address: `0x${string}`;
356
372
  readonly abi: readonly [{
357
373
  readonly inputs: readonly [{
358
374
  readonly internalType: "address";
@@ -652,7 +668,10 @@ declare class Clanker {
652
668
  * @param rewardRecipient The recipient to check rewards for
653
669
  * @returns Amount of rewards for the `token` and `rewardRecipient`
654
670
  */
655
- availableRewards(token: `0x${string}`, rewardRecipient: `0x${string}`): Promise<bigint>;
671
+ availableRewards({ token, rewardRecipient, }: {
672
+ token: `0x${string}`;
673
+ rewardRecipient: `0x${string}`;
674
+ }): Promise<bigint>;
656
675
  /**
657
676
  * Get an abi-typed transaction for deploying a clanker.
658
677
  *
package/dist/v4/index.js CHANGED
@@ -1,3 +1,6 @@
1
+ // src/v4/index.ts
2
+ import { base as base3 } from "viem/chains";
3
+
1
4
  // src/abi/v4/ClankerFeeLocker.ts
2
5
  var ClankerFeeLocker_abi = [
3
6
  {
@@ -3928,9 +3931,15 @@ var Clanker = class {
3928
3931
  * @param rewardRecipient The recipient to claim for
3929
3932
  * @returns Abi transaction
3930
3933
  */
3931
- async getClaimRewardsTransaction(token, rewardRecipient) {
3934
+ async getClaimRewardsTransaction({ token, rewardRecipient }, options) {
3935
+ const chain = this.publicClient?.chain || options?.chain || base3;
3936
+ const config = clankerConfigFor(
3937
+ chain.id,
3938
+ "clanker_v4"
3939
+ );
3940
+ if (!config) throw new Error(`Clanker is not ready on ${chain.id}`);
3932
3941
  return {
3933
- address: CLANKERS.clanker_v4.related.feeLocker,
3942
+ address: config?.related.feeLocker,
3934
3943
  abi: ClankerFeeLocker_abi,
3935
3944
  functionName: "claim",
3936
3945
  args: [rewardRecipient, token]
@@ -3945,11 +3954,11 @@ var Clanker = class {
3945
3954
  * @param account Optional account to simulate calling claiming for
3946
3955
  * @returns The simulated output
3947
3956
  */
3948
- async claimRewardsSimulate(token, rewardRecipient, account) {
3957
+ async claimRewardsSimulate({ token, rewardRecipient }, account) {
3949
3958
  const acc = account || this.wallet?.account;
3950
3959
  if (!acc) throw new Error("Account or wallet client required for simulation");
3951
3960
  if (!this.publicClient) throw new Error("Public client required");
3952
- const input = await this.getClaimRewardsTransaction(token, rewardRecipient);
3961
+ const input = await this.getClaimRewardsTransaction({ token, rewardRecipient });
3953
3962
  return simulateClankerContract(this.publicClient, acc, input);
3954
3963
  }
3955
3964
  /**
@@ -3959,10 +3968,13 @@ var Clanker = class {
3959
3968
  * @param rewardRecipient The recipient to claim for
3960
3969
  * @returns Transaction hash of the claim or error
3961
3970
  */
3962
- async claimRewards(token, rewardRecipient) {
3971
+ async claimRewards({
3972
+ token,
3973
+ rewardRecipient
3974
+ }) {
3963
3975
  if (!this.wallet) throw new Error("Wallet client required");
3964
3976
  if (!this.publicClient) throw new Error("Public client required");
3965
- const input = await this.getClaimRewardsTransaction(token, rewardRecipient);
3977
+ const input = await this.getClaimRewardsTransaction({ token, rewardRecipient });
3966
3978
  return writeClankerContract(this.publicClient, this.wallet, input);
3967
3979
  }
3968
3980
  /**
@@ -3972,9 +3984,15 @@ var Clanker = class {
3972
3984
  * @param rewardRecipient The recipient to check rewards for
3973
3985
  * @returns Abi transaction
3974
3986
  */
3975
- async getAvailableRewardsTransaction(token, rewardRecipient) {
3987
+ async getAvailableRewardsTransaction({ token, rewardRecipient }, options) {
3988
+ const chain = this.publicClient?.chain || options?.chain || base3;
3989
+ const config = clankerConfigFor(
3990
+ chain.id,
3991
+ "clanker_v4"
3992
+ );
3993
+ if (!config) throw new Error(`Clanker is not ready on ${chain.id}`);
3976
3994
  return {
3977
- address: CLANKERS.clanker_v4.related.feeLocker,
3995
+ address: config.related.feeLocker,
3978
3996
  abi: ClankerFeeLocker_abi,
3979
3997
  functionName: "availableFees",
3980
3998
  args: [rewardRecipient, token]
@@ -3987,10 +4005,13 @@ var Clanker = class {
3987
4005
  * @param rewardRecipient The recipient to check rewards for
3988
4006
  * @returns Amount of rewards for the `token` and `rewardRecipient`
3989
4007
  */
3990
- async availableRewards(token, rewardRecipient) {
4008
+ async availableRewards({
4009
+ token,
4010
+ rewardRecipient
4011
+ }) {
3991
4012
  if (!rewardRecipient) throw new Error("Account required for simulation");
3992
4013
  if (!this.publicClient) throw new Error("Public client required for deployment");
3993
- const tx = await this.getAvailableRewardsTransaction(token, rewardRecipient);
4014
+ const tx = await this.getAvailableRewardsTransaction({ token, rewardRecipient });
3994
4015
  return this.publicClient.readContract(tx);
3995
4016
  }
3996
4017
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clanker-sdk",
3
- "version": "4.1.6",
3
+ "version": "4.1.8",
4
4
  "description": "SDK for deploying tokens on Base using Clanker",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",