@aboutcircles/sdk-rpc 0.1.0
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/README.md +169 -0
- package/dist/client.d.ts +58 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +194 -0
- package/dist/errors.d.ts +44 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +63 -0
- package/dist/events/index.d.ts +8 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +8 -0
- package/dist/events/observable.d.ts +23 -0
- package/dist/events/observable.d.ts.map +1 -0
- package/dist/events/observable.js +37 -0
- package/dist/events/parser.d.ts +10 -0
- package/dist/events/parser.d.ts.map +1 -0
- package/dist/events/parser.js +103 -0
- package/dist/events/types.d.ts +7 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/events/types.js +11 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2654 -0
- package/dist/methods/avatar.d.ts +51 -0
- package/dist/methods/avatar.d.ts.map +1 -0
- package/dist/methods/avatar.js +64 -0
- package/dist/methods/balance.d.ts +37 -0
- package/dist/methods/balance.d.ts.map +1 -0
- package/dist/methods/balance.js +50 -0
- package/dist/methods/group.d.ts +145 -0
- package/dist/methods/group.d.ts.map +1 -0
- package/dist/methods/group.js +380 -0
- package/dist/methods/index.d.ts +11 -0
- package/dist/methods/index.d.ts.map +1 -0
- package/dist/methods/index.js +10 -0
- package/dist/methods/invitation.d.ts +61 -0
- package/dist/methods/invitation.d.ts.map +1 -0
- package/dist/methods/invitation.js +230 -0
- package/dist/methods/pathfinder.d.ts +41 -0
- package/dist/methods/pathfinder.d.ts.map +1 -0
- package/dist/methods/pathfinder.js +53 -0
- package/dist/methods/profile.d.ts +109 -0
- package/dist/methods/profile.d.ts.map +1 -0
- package/dist/methods/profile.js +166 -0
- package/dist/methods/query.d.ts +79 -0
- package/dist/methods/query.d.ts.map +1 -0
- package/dist/methods/query.js +87 -0
- package/dist/methods/token.d.ts +61 -0
- package/dist/methods/token.d.ts.map +1 -0
- package/dist/methods/token.js +99 -0
- package/dist/methods/transaction.d.ts +41 -0
- package/dist/methods/transaction.d.ts.map +1 -0
- package/dist/methods/transaction.js +111 -0
- package/dist/methods/trust.d.ts +114 -0
- package/dist/methods/trust.d.ts.map +1 -0
- package/dist/methods/trust.js +245 -0
- package/dist/pagedQuery.d.ts +106 -0
- package/dist/pagedQuery.d.ts.map +1 -0
- package/dist/pagedQuery.js +254 -0
- package/dist/rpc.d.ts +61 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +76 -0
- package/dist/types.d.ts +82 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +27 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +111 -0
- package/package.json +32 -0
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { normalizeAddress, checksumAddresses } from '../utils';
|
|
2
|
+
import { PagedQuery } from '../pagedQuery';
|
|
3
|
+
/**
|
|
4
|
+
* Group query RPC methods
|
|
5
|
+
*/
|
|
6
|
+
export class GroupMethods {
|
|
7
|
+
client;
|
|
8
|
+
constructor(client) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Find groups with optional filters
|
|
13
|
+
*
|
|
14
|
+
* This is a convenience method that fetches all pages using cursor-based pagination
|
|
15
|
+
* and returns the combined results up to the specified limit.
|
|
16
|
+
*
|
|
17
|
+
* @param limit - Maximum number of groups to return (default: 50)
|
|
18
|
+
* @param params - Optional query parameters to filter groups
|
|
19
|
+
* @returns Array of group rows
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* // Find all groups
|
|
24
|
+
* const allGroups = await rpc.group.findGroups(50);
|
|
25
|
+
*
|
|
26
|
+
* // Find groups by name prefix
|
|
27
|
+
* const groups = await rpc.group.findGroups(50, {
|
|
28
|
+
* nameStartsWith: 'Community'
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* // Find groups by owner (single)
|
|
32
|
+
* const myGroups = await rpc.group.findGroups(50, {
|
|
33
|
+
* ownerIn: ['0xde374ece6fa50e781e81aac78e811b33d16912c7']
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // Find groups by multiple owners (OR query)
|
|
37
|
+
* const multiOwnerGroups = await rpc.group.findGroups(50, {
|
|
38
|
+
* ownerIn: ['0xOwner1...', '0xOwner2...']
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
async findGroups(limit = 50, params) {
|
|
43
|
+
// Create the paged query
|
|
44
|
+
const query = this.getGroups(limit, params, 'DESC');
|
|
45
|
+
const results = [];
|
|
46
|
+
// Fetch all pages up to the limit
|
|
47
|
+
while (await query.queryNextPage()) {
|
|
48
|
+
results.push(...query.currentPage.results);
|
|
49
|
+
// If we have enough results, break
|
|
50
|
+
if (results.length >= limit) {
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
// If no more pages, break
|
|
54
|
+
if (!query.currentPage.hasMore) {
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Apply limit
|
|
59
|
+
return results.slice(0, limit);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get group memberships for an avatar using cursor-based pagination
|
|
63
|
+
*
|
|
64
|
+
* @param avatar - Avatar address to query group memberships for
|
|
65
|
+
* @param limit - Number of memberships per page (default: 50)
|
|
66
|
+
* @param sortOrder - Sort order for results (default: 'DESC')
|
|
67
|
+
* @returns PagedQuery instance for iterating through memberships
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const query = rpc.group.getGroupMemberships(
|
|
72
|
+
* '0xde374ece6fa50e781e81aac78e811b33d16912c7',
|
|
73
|
+
* 50
|
|
74
|
+
* );
|
|
75
|
+
* await query.queryNextPage();
|
|
76
|
+
* console.log(query.currentPage.results);
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
getGroupMemberships(avatar, limit = 50, sortOrder = 'DESC') {
|
|
80
|
+
const normalized = normalizeAddress(avatar);
|
|
81
|
+
return new PagedQuery(this.client, {
|
|
82
|
+
namespace: 'V_CrcV2',
|
|
83
|
+
table: 'GroupMemberships',
|
|
84
|
+
sortOrder,
|
|
85
|
+
columns: [
|
|
86
|
+
'blockNumber',
|
|
87
|
+
'timestamp',
|
|
88
|
+
'transactionIndex',
|
|
89
|
+
'logIndex',
|
|
90
|
+
'transactionHash',
|
|
91
|
+
'group',
|
|
92
|
+
'member',
|
|
93
|
+
'expiryTime',
|
|
94
|
+
],
|
|
95
|
+
filter: [
|
|
96
|
+
{
|
|
97
|
+
Type: 'FilterPredicate',
|
|
98
|
+
FilterType: 'Equals',
|
|
99
|
+
Column: 'member',
|
|
100
|
+
Value: normalized,
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
limit,
|
|
104
|
+
}, (row) => checksumAddresses(row));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Get holders of a group token using cursor-based pagination
|
|
108
|
+
*
|
|
109
|
+
* Returns a PagedQuery instance that can be used to fetch holders page by page.
|
|
110
|
+
* Results are ordered by totalBalance DESC (highest first), with holder address as tie-breaker.
|
|
111
|
+
*
|
|
112
|
+
* Note: Pagination uses holder address as cursor because totalBalance (BigInt) values
|
|
113
|
+
* cannot be reliably passed through JSON-RPC filters. This means pagination boundaries
|
|
114
|
+
* are based on holder addresses, not balances.
|
|
115
|
+
*
|
|
116
|
+
* @param groupAddress - The address of the group token
|
|
117
|
+
* @param limit - Number of holders per page (default: 100)
|
|
118
|
+
* @returns PagedQuery instance for iterating through group token holders
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* const query = rpc.group.getGroupHolders('0xGroupAddress...', 50);
|
|
123
|
+
*
|
|
124
|
+
* // Get first page (ordered by totalBalance DESC)
|
|
125
|
+
* await query.queryNextPage();
|
|
126
|
+
* console.log(query.currentPage.results[0]); // Holder with highest balance
|
|
127
|
+
*
|
|
128
|
+
* // Get next page if available
|
|
129
|
+
* if (query.currentPage.hasMore) {
|
|
130
|
+
* await query.queryNextPage();
|
|
131
|
+
* }
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
getGroupHolders(groupAddress, limit = 100) {
|
|
135
|
+
const normalized = normalizeAddress(groupAddress);
|
|
136
|
+
return new PagedQuery(this.client, {
|
|
137
|
+
namespace: 'V_CrcV2',
|
|
138
|
+
table: 'GroupTokenHoldersBalance',
|
|
139
|
+
sortOrder: 'DESC',
|
|
140
|
+
columns: ['group', 'holder', 'totalBalance', 'demurragedTotalBalance', 'fractionOwnership'],
|
|
141
|
+
cursorColumns: [
|
|
142
|
+
{
|
|
143
|
+
name: 'holder',
|
|
144
|
+
sortOrder: 'ASC', // Use holder for cursor-based pagination
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
orderColumns: [
|
|
148
|
+
{ Column: 'totalBalance', SortOrder: 'DESC' },
|
|
149
|
+
{ Column: 'holder', SortOrder: 'ASC' },
|
|
150
|
+
],
|
|
151
|
+
filter: [
|
|
152
|
+
{
|
|
153
|
+
Type: 'FilterPredicate',
|
|
154
|
+
FilterType: 'Equals',
|
|
155
|
+
Column: 'group',
|
|
156
|
+
Value: normalized,
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
limit,
|
|
160
|
+
rowTransformer: (row) => {
|
|
161
|
+
// Convert string values to bigint for specific fields
|
|
162
|
+
const transformed = {
|
|
163
|
+
...row,
|
|
164
|
+
totalBalance: BigInt(row.totalBalance),
|
|
165
|
+
demurragedTotalBalance: BigInt(row.demurragedTotalBalance),
|
|
166
|
+
};
|
|
167
|
+
return checksumAddresses(transformed);
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Get members of a group using cursor-based pagination
|
|
173
|
+
*
|
|
174
|
+
* Returns a PagedQuery instance that can be used to fetch members page by page
|
|
175
|
+
* using cursor-based pagination.
|
|
176
|
+
*
|
|
177
|
+
* @param groupAddress - The address of the group to query members for
|
|
178
|
+
* @param limit - Number of members per page (default: 100)
|
|
179
|
+
* @param sortOrder - Sort order for results (default: 'DESC')
|
|
180
|
+
* @returns PagedQuery instance for iterating through group members
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* const query = rpc.group.getGroupMembers('0xGroupAddress...', 100);
|
|
185
|
+
*
|
|
186
|
+
* // Get first page
|
|
187
|
+
* await query.queryNextPage();
|
|
188
|
+
* console.log(query.currentPage.results);
|
|
189
|
+
*
|
|
190
|
+
* // Get next page if available
|
|
191
|
+
* if (query.currentPage.hasMore) {
|
|
192
|
+
* await query.queryNextPage();
|
|
193
|
+
* console.log(query.currentPage.results);
|
|
194
|
+
* }
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
getGroupMembers(groupAddress, limit = 100, sortOrder = 'DESC') {
|
|
198
|
+
const normalized = normalizeAddress(groupAddress);
|
|
199
|
+
return new PagedQuery(this.client, {
|
|
200
|
+
namespace: 'V_CrcV2',
|
|
201
|
+
table: 'GroupMemberships',
|
|
202
|
+
sortOrder,
|
|
203
|
+
columns: [
|
|
204
|
+
'blockNumber',
|
|
205
|
+
'timestamp',
|
|
206
|
+
'transactionIndex',
|
|
207
|
+
'logIndex',
|
|
208
|
+
'transactionHash',
|
|
209
|
+
'group',
|
|
210
|
+
'member',
|
|
211
|
+
'expiryTime',
|
|
212
|
+
],
|
|
213
|
+
filter: [
|
|
214
|
+
{
|
|
215
|
+
Type: 'FilterPredicate',
|
|
216
|
+
FilterType: 'Equals',
|
|
217
|
+
Column: 'group',
|
|
218
|
+
Value: normalized,
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
limit,
|
|
222
|
+
}, (row) => checksumAddresses(row));
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Get groups using cursor-based pagination
|
|
226
|
+
*
|
|
227
|
+
* Returns a PagedQuery instance that can be used to fetch groups page by page
|
|
228
|
+
* using cursor-based pagination.
|
|
229
|
+
*
|
|
230
|
+
* @param limit - Number of groups per page (default: 50)
|
|
231
|
+
* @param params - Optional query parameters to filter groups
|
|
232
|
+
* @param sortOrder - Sort order for results (default: 'DESC')
|
|
233
|
+
* @returns PagedQuery instance for iterating through groups
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```typescript
|
|
237
|
+
* // Query all groups
|
|
238
|
+
* const query = rpc.group.getGroups(50);
|
|
239
|
+
*
|
|
240
|
+
* // Query groups by owner(s)
|
|
241
|
+
* const myGroupsQuery = rpc.group.getGroups(50, {
|
|
242
|
+
* ownerIn: ['0xMyAddress...']
|
|
243
|
+
* });
|
|
244
|
+
*
|
|
245
|
+
* await myGroupsQuery.queryNextPage();
|
|
246
|
+
* console.log(myGroupsQuery.currentPage.results);
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
getGroups(limit = 50, params, sortOrder = 'DESC') {
|
|
250
|
+
const filter = [];
|
|
251
|
+
if (params) {
|
|
252
|
+
if (params.nameStartsWith) {
|
|
253
|
+
filter.push({
|
|
254
|
+
Type: 'FilterPredicate',
|
|
255
|
+
FilterType: 'Like',
|
|
256
|
+
Column: 'name',
|
|
257
|
+
Value: params.nameStartsWith + '%',
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
if (params.symbolStartsWith) {
|
|
261
|
+
filter.push({
|
|
262
|
+
Type: 'FilterPredicate',
|
|
263
|
+
FilterType: 'Like',
|
|
264
|
+
Column: 'symbol',
|
|
265
|
+
Value: params.symbolStartsWith + '%',
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
if (params.groupAddressIn && params.groupAddressIn.length > 0) {
|
|
269
|
+
// Create an OR conjunction for matching any of the group addresses
|
|
270
|
+
const addressPredicates = params.groupAddressIn.map((addr) => ({
|
|
271
|
+
Type: 'FilterPredicate',
|
|
272
|
+
FilterType: 'Equals',
|
|
273
|
+
Column: 'group',
|
|
274
|
+
Value: normalizeAddress(addr),
|
|
275
|
+
}));
|
|
276
|
+
if (addressPredicates.length === 1) {
|
|
277
|
+
filter.push(addressPredicates[0]);
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
filter.push({
|
|
281
|
+
Type: 'Conjunction',
|
|
282
|
+
ConjunctionType: 'Or',
|
|
283
|
+
Predicates: addressPredicates,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (params.groupTypeIn && params.groupTypeIn.length > 0) {
|
|
288
|
+
// Create an OR conjunction for matching any of the group types
|
|
289
|
+
const typePredicates = params.groupTypeIn.map((type) => ({
|
|
290
|
+
Type: 'FilterPredicate',
|
|
291
|
+
FilterType: 'Equals',
|
|
292
|
+
Column: 'type',
|
|
293
|
+
Value: type,
|
|
294
|
+
}));
|
|
295
|
+
if (typePredicates.length === 1) {
|
|
296
|
+
filter.push(typePredicates[0]);
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
filter.push({
|
|
300
|
+
Type: 'Conjunction',
|
|
301
|
+
ConjunctionType: 'Or',
|
|
302
|
+
Predicates: typePredicates,
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
if (params.ownerIn && params.ownerIn.length > 0) {
|
|
307
|
+
// Create an OR conjunction for matching any of the owners
|
|
308
|
+
const ownerPredicates = params.ownerIn.map((addr) => ({
|
|
309
|
+
Type: 'FilterPredicate',
|
|
310
|
+
FilterType: 'Equals',
|
|
311
|
+
Column: 'owner',
|
|
312
|
+
Value: normalizeAddress(addr),
|
|
313
|
+
}));
|
|
314
|
+
if (ownerPredicates.length === 1) {
|
|
315
|
+
filter.push(ownerPredicates[0]);
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
filter.push({
|
|
319
|
+
Type: 'Conjunction',
|
|
320
|
+
ConjunctionType: 'Or',
|
|
321
|
+
Predicates: ownerPredicates,
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
if (params.mintHandlerEquals) {
|
|
326
|
+
filter.push({
|
|
327
|
+
Type: 'FilterPredicate',
|
|
328
|
+
FilterType: 'Equals',
|
|
329
|
+
Column: 'mintHandler',
|
|
330
|
+
Value: normalizeAddress(params.mintHandlerEquals),
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
if (params.treasuryEquals) {
|
|
334
|
+
filter.push({
|
|
335
|
+
Type: 'FilterPredicate',
|
|
336
|
+
FilterType: 'Equals',
|
|
337
|
+
Column: 'treasury',
|
|
338
|
+
Value: normalizeAddress(params.treasuryEquals),
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
const finalFilter = filter.length > 1
|
|
343
|
+
? [
|
|
344
|
+
{
|
|
345
|
+
Type: 'Conjunction',
|
|
346
|
+
ConjunctionType: 'And',
|
|
347
|
+
Predicates: filter,
|
|
348
|
+
},
|
|
349
|
+
]
|
|
350
|
+
: filter;
|
|
351
|
+
return new PagedQuery(this.client, {
|
|
352
|
+
namespace: 'V_CrcV2',
|
|
353
|
+
table: 'Groups',
|
|
354
|
+
sortOrder,
|
|
355
|
+
columns: [
|
|
356
|
+
'blockNumber',
|
|
357
|
+
'timestamp',
|
|
358
|
+
'transactionIndex',
|
|
359
|
+
'logIndex',
|
|
360
|
+
'transactionHash',
|
|
361
|
+
'group',
|
|
362
|
+
'type',
|
|
363
|
+
'owner',
|
|
364
|
+
'mintPolicy',
|
|
365
|
+
'mintHandler',
|
|
366
|
+
'treasury',
|
|
367
|
+
'service',
|
|
368
|
+
'feeCollection',
|
|
369
|
+
'memberCount',
|
|
370
|
+
'name',
|
|
371
|
+
'symbol',
|
|
372
|
+
'cidV0Digest',
|
|
373
|
+
'erc20WrapperDemurraged',
|
|
374
|
+
'erc20WrapperStatic',
|
|
375
|
+
],
|
|
376
|
+
filter: finalFilter,
|
|
377
|
+
limit,
|
|
378
|
+
}, (row) => checksumAddresses(row));
|
|
379
|
+
}
|
|
380
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { PathfinderMethods } from './pathfinder';
|
|
2
|
+
export { QueryMethods } from './query';
|
|
3
|
+
export { TrustMethods } from './trust';
|
|
4
|
+
export { BalanceMethods } from './balance';
|
|
5
|
+
export { AvatarMethods } from './avatar';
|
|
6
|
+
export { ProfileMethods } from './profile';
|
|
7
|
+
export { TokenMethods } from './token';
|
|
8
|
+
export { InvitationMethods } from './invitation';
|
|
9
|
+
export { TransactionMethods } from './transaction';
|
|
10
|
+
export { GroupMethods } from './group';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/methods/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { PathfinderMethods } from './pathfinder';
|
|
2
|
+
export { QueryMethods } from './query';
|
|
3
|
+
export { TrustMethods } from './trust';
|
|
4
|
+
export { BalanceMethods } from './balance';
|
|
5
|
+
export { AvatarMethods } from './avatar';
|
|
6
|
+
export { ProfileMethods } from './profile';
|
|
7
|
+
export { TokenMethods } from './token';
|
|
8
|
+
export { InvitationMethods } from './invitation';
|
|
9
|
+
export { TransactionMethods } from './transaction';
|
|
10
|
+
export { GroupMethods } from './group';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { RpcClient } from '../client';
|
|
2
|
+
import type { Address, AvatarInfo } from '@aboutcircles/sdk-types';
|
|
3
|
+
/**
|
|
4
|
+
* Invitation RPC methods
|
|
5
|
+
*/
|
|
6
|
+
export declare class InvitationMethods {
|
|
7
|
+
private client;
|
|
8
|
+
constructor(client: RpcClient);
|
|
9
|
+
private transformQueryResponse;
|
|
10
|
+
/**
|
|
11
|
+
* Get the avatar that invited a specific avatar
|
|
12
|
+
*
|
|
13
|
+
* @param address - The address of the invited avatar
|
|
14
|
+
* @returns The address of the inviting avatar or undefined if not found
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const inviter = await rpc.invitation.getInvitedBy('0xde374ece6fa50e781e81aac78e811b33d16912c7');
|
|
19
|
+
* console.log(inviter); // '0x...'
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
getInvitedBy(address: Address): Promise<Address | undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* Get the list of avatars who have invited this avatar
|
|
25
|
+
* Checks v2 trust relations and validates that inviters have enough balance
|
|
26
|
+
*
|
|
27
|
+
* @param address - The address to check for invitations
|
|
28
|
+
* @returns Array of avatar info for valid inviters
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const invitations = await rpc.invitation.getInvitations('0xde374ece6fa50e781e81aac78e811b33d16912c7');
|
|
33
|
+
* console.log(invitations); // Array of AvatarInfo
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
getInvitations(address: Address): Promise<AvatarInfo[]>;
|
|
37
|
+
/**
|
|
38
|
+
* Get the list of accounts that were invited by a specific avatar
|
|
39
|
+
*
|
|
40
|
+
* @param address - The address of the inviter
|
|
41
|
+
* @param accepted - If true, returns accepted invitations; if false, returns pending invitations
|
|
42
|
+
* @returns Array of invited addresses
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* // Get accepted invitations
|
|
47
|
+
* const accepted = await rpc.invitation.getInvitationsFrom(
|
|
48
|
+
* '0xde374ece6fa50e781e81aac78e811b33d16912c7',
|
|
49
|
+
* true
|
|
50
|
+
* );
|
|
51
|
+
*
|
|
52
|
+
* // Get pending invitations
|
|
53
|
+
* const pending = await rpc.invitation.getInvitationsFrom(
|
|
54
|
+
* '0xde374ece6fa50e781e81aac78e811b33d16912c7',
|
|
55
|
+
* false
|
|
56
|
+
* );
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
getInvitationsFrom(address: Address, accepted?: boolean): Promise<Address[]>;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=invitation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invitation.d.ts","sourceRoot":"","sources":["../../src/methods/invitation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAsC,MAAM,yBAAyB,CAAC;AAOvG;;GAEG;AACH,qBAAa,iBAAiB;IAChB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC,OAAO,CAAC,sBAAsB;IAW9B;;;;;;;;;;;OAWG;IACG,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IAgClE;;;;;;;;;;;;OAYG;IACG,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAqF7D;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,kBAAkB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,GAAE,OAAe,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAoF1F"}
|