@aboutcircles/sdk 0.1.11 → 0.1.12

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.
@@ -2,7 +2,7 @@ import type { Address, AvatarRow, ContractRunner, TokenBalanceRow, GroupMembersh
2
2
  import type { TransactionReceipt, Hex } from 'viem';
3
3
  import type { Core } from '@aboutcircles/sdk-core';
4
4
  import { CommonAvatar, type PathfindingOptions } from './CommonAvatar';
5
- import { type ProxyInviter } from '@aboutcircles/sdk-invitations';
5
+ import { type ProxyInviter, type ReferralPreviewList } from '@aboutcircles/sdk-invitations';
6
6
  /**
7
7
  * HumanAvatar class implementation
8
8
  * Provides a simplified, user-friendly wrapper around Circles protocol for human avatars
@@ -52,118 +52,60 @@ export declare class HumanAvatar extends CommonAvatar {
52
52
  */
53
53
  replenish: (options?: PathfindingOptions) => Promise<TransactionReceipt>;
54
54
  };
55
+ private readonly _invitations;
56
+ private readonly _inviteFarm;
55
57
  readonly invitation: {
56
58
  /**
57
- * Get a referral code for inviting a new user who doesn't have a Safe wallet yet
58
- *
59
- * This function:
60
- * 1. Generates a new private key and signer address for the invitee
61
- * 2. Finds proxy inviters (intermediaries in trust graph)
62
- * 3. Builds transaction batch to transfer 96 CRC to the invitation module
63
- * 4. Saves the referral data to the backend
64
- * 5. Returns transactions and the generated private key
65
- *
66
- * The private key should be shared with the invitee to claim their account.
67
- *
68
- * Requirements:
69
- * - You must have at least 96 CRC available (directly or via proxy inviters)
70
- * - Referrals service must be configured
71
- *
72
- * @returns Object containing transactions to execute and the private key to share
73
- *
74
- * @example
75
- * ```typescript
76
- * const { transactions, privateKey } = await avatar.invitation.getReferralCode();
77
- * // Execute transactions
78
- * await avatar.runner.sendTransaction(transactions);
79
- * // Share privateKey with invitee
80
- * ```
59
+ * Get a referral code for inviting a new user who doesn't have a Safe wallet yet.
60
+ * Generates private key, finds proxy inviters, builds tx batch, saves referral data.
61
+ * @returns Transactions to execute and the private key to share with invitee
81
62
  */
82
63
  getReferralCode: () => Promise<{
83
64
  transactions: TransactionRequest[];
84
- privateKey: `0x${string}`;
65
+ privateKey: Hex;
85
66
  }>;
86
67
  /**
87
- * Invite a user who already has a Safe wallet but is not yet registered in Circles
88
- *
89
- * Use this when inviting someone who has an existing Safe wallet but is not
90
- * yet registered in Circles Hub.
91
- *
92
- * @param invitee Address of the invitee (must have existing Safe wallet, NOT registered in Circles)
93
- * @returns Array of transactions to execute
94
- *
95
- * @example
96
- * ```typescript
97
- * const transactions = await avatar.invitation.invite('0xInviteeAddress');
98
- * await avatar.runner.sendTransaction(transactions);
99
- * ```
68
+ * Invite a user who already has a Safe wallet but is not yet registered in Circles.
69
+ * @param invitee Address of the invitee (must have existing Safe, NOT registered in Circles)
100
70
  */
101
71
  invite: (invitee: Address) => Promise<TransactionRequest[]>;
102
72
  /**
103
- * Get proxy inviters who can facilitate invitations
104
- *
105
- * Proxy inviters are addresses that:
106
- * - Trust this avatar (or have mutual trust)
107
- * - Are trusted by the invitation module
108
- * - Have sufficient balance to cover invitation fees (96 CRC per invite)
109
- *
110
- * @returns Array of proxy inviters with their addresses and possible invite counts
111
- *
112
- * @example
113
- * ```typescript
114
- * const proxyInviters = await avatar.invitation.getProxyInviters();
115
- * proxyInviters.forEach(inviter => {
116
- * console.log(`${inviter.address}: can invite ${inviter.possibleInvites} people`);
117
- * });
118
- * ```
73
+ * Get proxy inviters who can facilitate invitations.
74
+ * These are addresses that trust this avatar, are trusted by the invitation module,
75
+ * and have sufficient balance (96 CRC per invite).
119
76
  */
120
77
  getProxyInviters: () => Promise<ProxyInviter[]>;
121
78
  /**
122
- * Find a path from this avatar to the invitation module
123
- *
79
+ * Find a path from this avatar to the invitation module.
124
80
  * @param proxyInviterAddress Optional specific proxy inviter to route through
125
- * @returns PathfindingResult containing the transfer path
126
- *
127
- * @example
128
- * ```typescript
129
- * const path = await avatar.invitation.findInvitePath();
130
- * console.log('Max flow:', path.maxFlow);
131
- * ```
132
81
  */
133
82
  findInvitePath: (proxyInviterAddress?: Address) => Promise<import("@aboutcircles/sdk-types").PathfindingResult>;
134
83
  /**
135
- * Compute the deterministic Safe address for a given signer
136
- *
137
- * Uses CREATE2 to predict the Safe address without deployment.
138
- *
84
+ * Compute the deterministic Safe address for a given signer using CREATE2.
139
85
  * @param signer The signer public address
140
- * @returns The deterministic Safe address
141
- *
142
- * @example
143
- * ```typescript
144
- * const safeAddress = avatar.invitation.computeAddress('0xSignerAddress');
145
- * ```
146
86
  */
147
87
  computeAddress: (signer: Address) => Address;
148
88
  /**
149
- * Generate new invitations using the InvitationFarm
150
- *
89
+ * Generate batch invitations using the InvitationFarm.
151
90
  * @param count Number of invitations to generate
152
- * @returns Promise containing secrets, signers, and transaction receipt
153
- *
154
- * @example
155
- * ```typescript
156
- * const result = await avatar.invitation.generateInvites(5);
157
- * result.secrets.forEach((secret, i) => {
158
- * console.log(`Invite ${i + 1}: ${result.signers[i]}`);
159
- * });
160
- * ```
161
91
  */
162
92
  generateInvites: (count: number) => Promise<{
163
93
  secrets: Hex[];
164
94
  signers: Address[];
165
95
  transactionReceipt: TransactionReceipt;
166
96
  }>;
97
+ /** Get the remaining invite quota for this avatar */
98
+ getQuota: () => Promise<bigint>;
99
+ /** Get the invitation fee (96 CRC) */
100
+ getInvitationFee: () => Promise<bigint>;
101
+ /** Get the invitation module address from the farm */
102
+ getInvitationModule: () => Promise<Address>;
103
+ /**
104
+ * List referrals for this avatar with key previews.
105
+ * @param limit Max referrals to return (default 10)
106
+ * @param offset Pagination offset (default 0)
107
+ */
108
+ listReferrals: (limit?: number, offset?: number) => Promise<ReferralPreviewList>;
167
109
  };
168
110
  readonly personalToken: {
169
111
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"HumanAvatar.d.ts","sourceRoot":"","sources":["../../src/avatars/HumanAvatar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,QAAQ,EAER,kB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OAAO,UACN,MAAM,KACb,OAAO,CAAC,kBAAkB,CAAC;QAqB9B;;;;;;;;;;;;;WAaG;sCACiC,OAAO,KAAG,OAAO,CAAC,MAAM,CAAC;QAiB7D;;;;;;;;;;;;;;;;WAgBG;wBAGM,OAAO,UACN,MAAM,KACb,OAAO,CAAC,kBAAkB,CAAC;;YA0F5B;;;;eAIG;2BACkB,OAAO,KAAG,OAAO,CAAC,OAAO,CAAC;YAQ/C;;;;eAIG;iCACwB,OAAO,KAAG,OAAO,CAAC,OAAO,CAAC;YAQrD;;;;eAIG;8BACqB,OAAO,KAAG,OAAO,CAAC,OAAO,CAAC;YAQlD;;;;eAIG;6BACoB,OAAO,KAAG,OAAO,CAAC,OAAO,CAAC;YAQjD;;;;eAIG;mCAC0B,OAAO,KAAG,OAAO,CAAC,OAAO,CAAC;YAQvD;;;;eAIG;6CACoC,OAAO,KAAG,OAAO,CAAC,OAAO,EAAE,CAAC;;MAUrE;IAGF,SAAgB,KAAK;;YAnFjB;;;;eAIG;2BACkB,OAAO,KAAG,OAAO,CAAC,OAAO,CAAC;YAQ/C;;;;eAIG;iCACwB,OAAO,KAAG,OAAO,CAAC,OAAO,CAAC;YAQrD;;;;eAIG;8BACqB,OAAO,KAAG,OAAO,CAAC,OAAO,CAAC;YAQlD;;;;eAIG;6BACoB,OAAO,KAAG,OAAO,CAAC,OAAO,CAAC;YAQjD;;;;eAIG;mCAC0B,OAAO,KAAG,OAAO,CAAC,OAAO,CAAC;YAQvD;;;;eAIG;6CACoC,OAAO,KAAG,OAAO,CAAC,OAAO,EAAE,CAAC;;QAgBrE;;;;;;;;;;;;;;;;;;;;;;;;;;WA0BG;sCAC0B,MAAM,cAAkB,KAAK,GAAG,MAAM;QAInE;;;;;;;;;;;;;;;;;;;;;WAqBG;iDAC2C,MAAM,KAAQ,OAAO,CAAC,QAAQ,EAAE,CAAC;MAyB/E;CAaH"}
@@ -94,129 +94,55 @@ export class HumanAvatar extends CommonAvatar {
94
94
  // ============================================================================
95
95
  // Trust methods are inherited from CommonAvatar
96
96
  // ============================================================================
97
- // Invitation methods using the new Invitations module
97
+ // ============================================================================
98
+ // Invitation methods using the Invitations module
99
+ // ============================================================================
100
+ _invitations = new Invitations(this.core.config);
101
+ _inviteFarm = new InviteFarm(this.core.config);
98
102
  invitation = {
99
103
  /**
100
- * Get a referral code for inviting a new user who doesn't have a Safe wallet yet
101
- *
102
- * This function:
103
- * 1. Generates a new private key and signer address for the invitee
104
- * 2. Finds proxy inviters (intermediaries in trust graph)
105
- * 3. Builds transaction batch to transfer 96 CRC to the invitation module
106
- * 4. Saves the referral data to the backend
107
- * 5. Returns transactions and the generated private key
108
- *
109
- * The private key should be shared with the invitee to claim their account.
110
- *
111
- * Requirements:
112
- * - You must have at least 96 CRC available (directly or via proxy inviters)
113
- * - Referrals service must be configured
114
- *
115
- * @returns Object containing transactions to execute and the private key to share
116
- *
117
- * @example
118
- * ```typescript
119
- * const { transactions, privateKey } = await avatar.invitation.getReferralCode();
120
- * // Execute transactions
121
- * await avatar.runner.sendTransaction(transactions);
122
- * // Share privateKey with invitee
123
- * ```
104
+ * Get a referral code for inviting a new user who doesn't have a Safe wallet yet.
105
+ * Generates private key, finds proxy inviters, builds tx batch, saves referral data.
106
+ * @returns Transactions to execute and the private key to share with invitee
124
107
  */
125
108
  getReferralCode: async () => {
126
- const invitations = new Invitations(this.core.config);
127
- return await invitations.generateReferral(this.address);
109
+ return this._invitations.generateReferral(this.address);
128
110
  },
129
111
  /**
130
- * Invite a user who already has a Safe wallet but is not yet registered in Circles
131
- *
132
- * Use this when inviting someone who has an existing Safe wallet but is not
133
- * yet registered in Circles Hub.
134
- *
135
- * @param invitee Address of the invitee (must have existing Safe wallet, NOT registered in Circles)
136
- * @returns Array of transactions to execute
137
- *
138
- * @example
139
- * ```typescript
140
- * const transactions = await avatar.invitation.invite('0xInviteeAddress');
141
- * await avatar.runner.sendTransaction(transactions);
142
- * ```
112
+ * Invite a user who already has a Safe wallet but is not yet registered in Circles.
113
+ * @param invitee Address of the invitee (must have existing Safe, NOT registered in Circles)
143
114
  */
144
115
  invite: async (invitee) => {
145
- const invitations = new Invitations(this.core.config);
146
- return await invitations.generateInvite(this.address, invitee);
116
+ return this._invitations.generateInvite(this.address, invitee);
147
117
  },
148
118
  /**
149
- * Get proxy inviters who can facilitate invitations
150
- *
151
- * Proxy inviters are addresses that:
152
- * - Trust this avatar (or have mutual trust)
153
- * - Are trusted by the invitation module
154
- * - Have sufficient balance to cover invitation fees (96 CRC per invite)
155
- *
156
- * @returns Array of proxy inviters with their addresses and possible invite counts
157
- *
158
- * @example
159
- * ```typescript
160
- * const proxyInviters = await avatar.invitation.getProxyInviters();
161
- * proxyInviters.forEach(inviter => {
162
- * console.log(`${inviter.address}: can invite ${inviter.possibleInvites} people`);
163
- * });
164
- * ```
119
+ * Get proxy inviters who can facilitate invitations.
120
+ * These are addresses that trust this avatar, are trusted by the invitation module,
121
+ * and have sufficient balance (96 CRC per invite).
165
122
  */
166
123
  getProxyInviters: async () => {
167
- const invitations = new Invitations(this.core.config);
168
- return await invitations.getRealInviters(this.address);
124
+ return this._invitations.getRealInviters(this.address);
169
125
  },
170
126
  /**
171
- * Find a path from this avatar to the invitation module
172
- *
127
+ * Find a path from this avatar to the invitation module.
173
128
  * @param proxyInviterAddress Optional specific proxy inviter to route through
174
- * @returns PathfindingResult containing the transfer path
175
- *
176
- * @example
177
- * ```typescript
178
- * const path = await avatar.invitation.findInvitePath();
179
- * console.log('Max flow:', path.maxFlow);
180
- * ```
181
129
  */
182
130
  findInvitePath: async (proxyInviterAddress) => {
183
- const invitations = new Invitations(this.core.config);
184
- return await invitations.findInvitePath(this.address, proxyInviterAddress);
131
+ return this._invitations.findInvitePath(this.address, proxyInviterAddress);
185
132
  },
186
133
  /**
187
- * Compute the deterministic Safe address for a given signer
188
- *
189
- * Uses CREATE2 to predict the Safe address without deployment.
190
- *
134
+ * Compute the deterministic Safe address for a given signer using CREATE2.
191
135
  * @param signer The signer public address
192
- * @returns The deterministic Safe address
193
- *
194
- * @example
195
- * ```typescript
196
- * const safeAddress = avatar.invitation.computeAddress('0xSignerAddress');
197
- * ```
198
136
  */
199
137
  computeAddress: (signer) => {
200
- const invitations = new Invitations(this.core.config);
201
- return invitations.computeAddress(signer);
138
+ return this._invitations.computeAddress(signer);
202
139
  },
203
140
  /**
204
- * Generate new invitations using the InvitationFarm
205
- *
141
+ * Generate batch invitations using the InvitationFarm.
206
142
  * @param count Number of invitations to generate
207
- * @returns Promise containing secrets, signers, and transaction receipt
208
- *
209
- * @example
210
- * ```typescript
211
- * const result = await avatar.invitation.generateInvites(5);
212
- * result.secrets.forEach((secret, i) => {
213
- * console.log(`Invite ${i + 1}: ${result.signers[i]}`);
214
- * });
215
- * ```
216
143
  */
217
144
  generateInvites: async (count) => {
218
- const farm = new InviteFarm(this.core.config);
219
- const result = await farm.generateInvites(this.address, count);
145
+ const result = await this._inviteFarm.generateInvites(this.address, count);
220
146
  const receipt = await this.runner.sendTransaction(result.transactions);
221
147
  return {
222
148
  secrets: result.invites.map((inv) => inv.secret),
@@ -224,6 +150,26 @@ export class HumanAvatar extends CommonAvatar {
224
150
  transactionReceipt: receipt,
225
151
  };
226
152
  },
153
+ /** Get the remaining invite quota for this avatar */
154
+ getQuota: async () => {
155
+ return this._inviteFarm.getQuota(this.address);
156
+ },
157
+ /** Get the invitation fee (96 CRC) */
158
+ getInvitationFee: async () => {
159
+ return this._inviteFarm.getInvitationFee();
160
+ },
161
+ /** Get the invitation module address from the farm */
162
+ getInvitationModule: async () => {
163
+ return this._inviteFarm.getInvitationModule();
164
+ },
165
+ /**
166
+ * List referrals for this avatar with key previews.
167
+ * @param limit Max referrals to return (default 10)
168
+ * @param offset Pagination offset (default 0)
169
+ */
170
+ listReferrals: async (limit = 10, offset = 0) => {
171
+ return this._inviteFarm.listReferrals(this.address, limit, offset);
172
+ },
227
173
  };
228
174
  // Personal token / Minting methods
229
175
  personalToken = {