@aboutcircles/sdk 0.1.24 → 0.1.25
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/Sdk.d.ts +41 -0
- package/dist/Sdk.d.ts.map +1 -1
- package/dist/Sdk.js +61 -0
- package/dist/ccip-bj4hszbh.js +4584 -0
- package/dist/ccip-dw9vbgp0.js +4533 -0
- package/dist/index-3hqyeswk.js +25 -0
- package/dist/index-pps0tkk3.js +356 -0
- package/dist/index.js +10417 -10104
- package/dist/native-45v6vh69.js +20 -0
- package/dist/secp256k1-mjj44cj6.js +2115 -0
- package/dist/secp256k1-qqsamwnk.js +2117 -0
- package/package.json +1 -1
package/dist/Sdk.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export declare class Sdk {
|
|
|
36
36
|
readonly core: Core;
|
|
37
37
|
readonly rpc: CirclesRpc;
|
|
38
38
|
private readonly profilesClient;
|
|
39
|
+
private readonly referralsClient?;
|
|
39
40
|
readonly data: CirclesData;
|
|
40
41
|
/**
|
|
41
42
|
* Create a new Sdk instance
|
|
@@ -149,6 +150,46 @@ export declare class Sdk {
|
|
|
149
150
|
*/
|
|
150
151
|
get: (cid: string) => Promise<Profile | undefined>;
|
|
151
152
|
};
|
|
153
|
+
/**
|
|
154
|
+
* Referral/invitation management methods
|
|
155
|
+
*
|
|
156
|
+
* The referrals backend enables users to invite others via referral links.
|
|
157
|
+
* Requires referralsServiceUrl to be configured in CirclesConfig.
|
|
158
|
+
*/
|
|
159
|
+
readonly referrals: {
|
|
160
|
+
/**
|
|
161
|
+
* Store a referral private key
|
|
162
|
+
*
|
|
163
|
+
* The private key is validated on-chain via ReferralsModule.accounts() to ensure
|
|
164
|
+
* the account exists and has not been claimed. The inviter address is self-declared
|
|
165
|
+
* for dashboard visibility only.
|
|
166
|
+
*
|
|
167
|
+
* @param privateKey - The referral private key (0x-prefixed, 64 hex chars)
|
|
168
|
+
* @param inviter - Self-declared inviter address for dashboard visibility
|
|
169
|
+
* @throws Error if referrals service not configured or validation fails
|
|
170
|
+
*/
|
|
171
|
+
store: (privateKey: string, inviter: Address) => Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Retrieve referral info by private key
|
|
174
|
+
*
|
|
175
|
+
* This is a public endpoint - no authentication required.
|
|
176
|
+
* Used by invitees to look up who invited them.
|
|
177
|
+
*
|
|
178
|
+
* @param privateKey - The referral private key
|
|
179
|
+
* @returns Referral info including inviter and status
|
|
180
|
+
* @throws Error if referrals service not configured or referral not found
|
|
181
|
+
*/
|
|
182
|
+
retrieve: (privateKey: string) => Promise<import("@aboutcircles/sdk-invitations").ReferralInfo>;
|
|
183
|
+
/**
|
|
184
|
+
* List all referrals created by the authenticated user
|
|
185
|
+
*
|
|
186
|
+
* Requires authentication - must configure a token provider.
|
|
187
|
+
*
|
|
188
|
+
* @returns List of referrals with their status and metadata
|
|
189
|
+
* @throws Error if referrals service not configured or not authenticated
|
|
190
|
+
*/
|
|
191
|
+
listMine: () => Promise<import("@aboutcircles/sdk-invitations").ReferralList>;
|
|
192
|
+
};
|
|
152
193
|
/**
|
|
153
194
|
* Token utilities
|
|
154
195
|
*/
|
package/dist/Sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sdk.d.ts","sourceRoot":"","sources":["../src/Sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,aAAa,EACb,cAAc,EACd,OAAO,EAEP,YAAY,EACZ,SAAS,EAEV,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAiB,IAAI,EAAkC,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"Sdk.d.ts","sourceRoot":"","sources":["../src/Sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,aAAa,EACb,cAAc,EACd,OAAO,EAEP,YAAY,EACZ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esConfig, Core, CirclesType, BaseGroupContract } from '@aboutcircles/sdk-core';
|
|
2
2
|
import { Profiles } from '@aboutcircles/sdk-profiles';
|
|
3
|
+
import { Referrals } from '@aboutcircles/sdk-invitations';
|
|
3
4
|
import { CirclesRpc, PagedQuery } from '@aboutcircles/sdk-rpc';
|
|
4
5
|
import { cidV0ToHex } from '@aboutcircles/sdk-utils';
|
|
5
6
|
import { HumanAvatar, OrganisationAvatar, BaseGroupAvatar } from './avatars';
|
|
@@ -39,6 +40,7 @@ export class Sdk {
|
|
|
39
40
|
core;
|
|
40
41
|
rpc;
|
|
41
42
|
profilesClient;
|
|
43
|
+
referralsClient;
|
|
42
44
|
data = {
|
|
43
45
|
getAvatar: async (address) => {
|
|
44
46
|
return await this.rpc.avatar.getAvatarInfo(address);
|
|
@@ -63,6 +65,10 @@ export class Sdk {
|
|
|
63
65
|
this.core = new Core(config);
|
|
64
66
|
this.rpc = new CirclesRpc(config.circlesRpcUrl);
|
|
65
67
|
this.profilesClient = new Profiles(config.profileServiceUrl);
|
|
68
|
+
// Initialize referrals client if service URL is configured
|
|
69
|
+
if (config.referralsServiceUrl) {
|
|
70
|
+
this.referralsClient = new Referrals(config.referralsServiceUrl);
|
|
71
|
+
}
|
|
66
72
|
// Validate and extract sender address from contract runner
|
|
67
73
|
if (contractRunner) {
|
|
68
74
|
if (!contractRunner.sendTransaction) {
|
|
@@ -335,6 +341,61 @@ export class Sdk {
|
|
|
335
341
|
return await this.profilesClient.get(cid);
|
|
336
342
|
},
|
|
337
343
|
};
|
|
344
|
+
/**
|
|
345
|
+
* Referral/invitation management methods
|
|
346
|
+
*
|
|
347
|
+
* The referrals backend enables users to invite others via referral links.
|
|
348
|
+
* Requires referralsServiceUrl to be configured in CirclesConfig.
|
|
349
|
+
*/
|
|
350
|
+
referrals = {
|
|
351
|
+
/**
|
|
352
|
+
* Store a referral private key
|
|
353
|
+
*
|
|
354
|
+
* The private key is validated on-chain via ReferralsModule.accounts() to ensure
|
|
355
|
+
* the account exists and has not been claimed. The inviter address is self-declared
|
|
356
|
+
* for dashboard visibility only.
|
|
357
|
+
*
|
|
358
|
+
* @param privateKey - The referral private key (0x-prefixed, 64 hex chars)
|
|
359
|
+
* @param inviter - Self-declared inviter address for dashboard visibility
|
|
360
|
+
* @throws Error if referrals service not configured or validation fails
|
|
361
|
+
*/
|
|
362
|
+
store: async (privateKey, inviter) => {
|
|
363
|
+
if (!this.referralsClient) {
|
|
364
|
+
throw SdkError.configError('Referrals service not configured. Set referralsServiceUrl in CirclesConfig.');
|
|
365
|
+
}
|
|
366
|
+
return await this.referralsClient.store(privateKey, inviter);
|
|
367
|
+
},
|
|
368
|
+
/**
|
|
369
|
+
* Retrieve referral info by private key
|
|
370
|
+
*
|
|
371
|
+
* This is a public endpoint - no authentication required.
|
|
372
|
+
* Used by invitees to look up who invited them.
|
|
373
|
+
*
|
|
374
|
+
* @param privateKey - The referral private key
|
|
375
|
+
* @returns Referral info including inviter and status
|
|
376
|
+
* @throws Error if referrals service not configured or referral not found
|
|
377
|
+
*/
|
|
378
|
+
retrieve: async (privateKey) => {
|
|
379
|
+
if (!this.referralsClient) {
|
|
380
|
+
throw SdkError.configError('Referrals service not configured. Set referralsServiceUrl in CirclesConfig.');
|
|
381
|
+
}
|
|
382
|
+
return await this.referralsClient.retrieve(privateKey);
|
|
383
|
+
},
|
|
384
|
+
/**
|
|
385
|
+
* List all referrals created by the authenticated user
|
|
386
|
+
*
|
|
387
|
+
* Requires authentication - must configure a token provider.
|
|
388
|
+
*
|
|
389
|
+
* @returns List of referrals with their status and metadata
|
|
390
|
+
* @throws Error if referrals service not configured or not authenticated
|
|
391
|
+
*/
|
|
392
|
+
listMine: async () => {
|
|
393
|
+
if (!this.referralsClient) {
|
|
394
|
+
throw SdkError.configError('Referrals service not configured. Set referralsServiceUrl in CirclesConfig.');
|
|
395
|
+
}
|
|
396
|
+
return await this.referralsClient.listMine();
|
|
397
|
+
},
|
|
398
|
+
};
|
|
338
399
|
/**
|
|
339
400
|
* Token utilities
|
|
340
401
|
*/
|