@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.
Files changed (68) hide show
  1. package/README.md +169 -0
  2. package/dist/client.d.ts +58 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/client.js +194 -0
  5. package/dist/errors.d.ts +44 -0
  6. package/dist/errors.d.ts.map +1 -0
  7. package/dist/errors.js +63 -0
  8. package/dist/events/index.d.ts +8 -0
  9. package/dist/events/index.d.ts.map +1 -0
  10. package/dist/events/index.js +8 -0
  11. package/dist/events/observable.d.ts +23 -0
  12. package/dist/events/observable.d.ts.map +1 -0
  13. package/dist/events/observable.js +37 -0
  14. package/dist/events/parser.d.ts +10 -0
  15. package/dist/events/parser.d.ts.map +1 -0
  16. package/dist/events/parser.js +103 -0
  17. package/dist/events/types.d.ts +7 -0
  18. package/dist/events/types.d.ts.map +1 -0
  19. package/dist/events/types.js +11 -0
  20. package/dist/index.d.ts +12 -0
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.js +2654 -0
  23. package/dist/methods/avatar.d.ts +51 -0
  24. package/dist/methods/avatar.d.ts.map +1 -0
  25. package/dist/methods/avatar.js +64 -0
  26. package/dist/methods/balance.d.ts +37 -0
  27. package/dist/methods/balance.d.ts.map +1 -0
  28. package/dist/methods/balance.js +50 -0
  29. package/dist/methods/group.d.ts +145 -0
  30. package/dist/methods/group.d.ts.map +1 -0
  31. package/dist/methods/group.js +380 -0
  32. package/dist/methods/index.d.ts +11 -0
  33. package/dist/methods/index.d.ts.map +1 -0
  34. package/dist/methods/index.js +10 -0
  35. package/dist/methods/invitation.d.ts +61 -0
  36. package/dist/methods/invitation.d.ts.map +1 -0
  37. package/dist/methods/invitation.js +230 -0
  38. package/dist/methods/pathfinder.d.ts +41 -0
  39. package/dist/methods/pathfinder.d.ts.map +1 -0
  40. package/dist/methods/pathfinder.js +53 -0
  41. package/dist/methods/profile.d.ts +109 -0
  42. package/dist/methods/profile.d.ts.map +1 -0
  43. package/dist/methods/profile.js +166 -0
  44. package/dist/methods/query.d.ts +79 -0
  45. package/dist/methods/query.d.ts.map +1 -0
  46. package/dist/methods/query.js +87 -0
  47. package/dist/methods/token.d.ts +61 -0
  48. package/dist/methods/token.d.ts.map +1 -0
  49. package/dist/methods/token.js +99 -0
  50. package/dist/methods/transaction.d.ts +41 -0
  51. package/dist/methods/transaction.d.ts.map +1 -0
  52. package/dist/methods/transaction.js +111 -0
  53. package/dist/methods/trust.d.ts +114 -0
  54. package/dist/methods/trust.d.ts.map +1 -0
  55. package/dist/methods/trust.js +245 -0
  56. package/dist/pagedQuery.d.ts +106 -0
  57. package/dist/pagedQuery.d.ts.map +1 -0
  58. package/dist/pagedQuery.js +254 -0
  59. package/dist/rpc.d.ts +61 -0
  60. package/dist/rpc.d.ts.map +1 -0
  61. package/dist/rpc.js +76 -0
  62. package/dist/types.d.ts +82 -0
  63. package/dist/types.d.ts.map +1 -0
  64. package/dist/types.js +1 -0
  65. package/dist/utils.d.ts +27 -0
  66. package/dist/utils.d.ts.map +1 -0
  67. package/dist/utils.js +111 -0
  68. package/package.json +32 -0
@@ -0,0 +1,87 @@
1
+ import { checksumAddresses } from '../utils';
2
+ /**
3
+ * Query and table RPC methods
4
+ */
5
+ export class QueryMethods {
6
+ client;
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ /**
11
+ * Query tables with filters
12
+ *
13
+ * @param params - Query parameters including namespace, table, columns, filters, and ordering
14
+ * @returns Array of query results
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const results = await rpc.query.query({
19
+ * Namespace: 'V_CrcV2',
20
+ * Table: 'TrustRelations',
21
+ * Columns: [],
22
+ * Filter: [{
23
+ * Type: 'Conjunction',
24
+ * ConjunctionType: 'Or',
25
+ * Predicates: [
26
+ * {
27
+ * Type: 'FilterPredicate',
28
+ * FilterType: 'Equals',
29
+ * Column: 'truster',
30
+ * Value: '0xae3a29a9ff24d0e936a5579bae5c4179c4dff565'
31
+ * },
32
+ * {
33
+ * Type: 'FilterPredicate',
34
+ * FilterType: 'Equals',
35
+ * Column: 'trustee',
36
+ * Value: '0xae3a29a9ff24d0e936a5579bae5c4179c4dff565'
37
+ * }
38
+ * ]
39
+ * }],
40
+ * Order: []
41
+ * });
42
+ * ```
43
+ */
44
+ async query(params) {
45
+ const result = await this.client.call('circles_query', [params]);
46
+ return checksumAddresses(result);
47
+ }
48
+ /**
49
+ * Return all available namespaces and tables which can be queried
50
+ *
51
+ * @returns Array of table information
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * const tables = await rpc.query.tables();
56
+ * console.log(tables);
57
+ * ```
58
+ */
59
+ async tables() {
60
+ return this.client.call('circles_tables', []);
61
+ }
62
+ /**
63
+ * Query events of specific types within a block range
64
+ *
65
+ * @param fromBlock - Starting block number (null for genesis)
66
+ * @param toBlock - Ending block number (null for latest)
67
+ * @param eventTypes - Array of event types to filter (null for all)
68
+ * @param address - Optional address filter
69
+ * @param includeTransactionData - Whether to include transaction data
70
+ * @returns Array of events
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * const events = await rpc.query.events(
75
+ * 38000000,
76
+ * null,
77
+ * ['CrcV1_Trust'],
78
+ * null,
79
+ * false
80
+ * );
81
+ * ```
82
+ */
83
+ async events(fromBlock, toBlock, eventTypes = null, address = null, includeTransactionData = false) {
84
+ const result = await this.client.call('circles_events', [fromBlock, toBlock, eventTypes, address, includeTransactionData]);
85
+ return checksumAddresses(result);
86
+ }
87
+ }
@@ -0,0 +1,61 @@
1
+ import type { RpcClient } from '../client';
2
+ import type { Address, TokenInfo, TokenHolder, SortOrder } from '@aboutcircles/sdk-types';
3
+ import { PagedQuery } from '../pagedQuery';
4
+ /**
5
+ * Token information RPC methods
6
+ */
7
+ export declare class TokenMethods {
8
+ private client;
9
+ constructor(client: RpcClient);
10
+ /**
11
+ * Get token information for a specific token address
12
+ *
13
+ * @param address - The token address to query
14
+ * @returns Token information or undefined if not found
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const tokenInfo = await rpc.token.getTokenInfo('0x0d8c4901dd270fe101b8014a5dbecc4e4432eb1e');
19
+ * console.log(tokenInfo);
20
+ * ```
21
+ */
22
+ getTokenInfo(address: Address): Promise<TokenInfo | undefined>;
23
+ /**
24
+ * Get token information for multiple token addresses in batch
25
+ *
26
+ * @param addresses - Array of token addresses to query
27
+ * @returns Array of token information objects
28
+ *
29
+ * @example
30
+ * ```typescript
31
+ * const tokenInfos = await rpc.token.getTokenInfoBatch([
32
+ * '0x0d8c4901dd270fe101b8014a5dbecc4e4432eb1e',
33
+ * '0x86533d1ada8ffbe7b6f7244f9a1b707f7f3e239b'
34
+ * ]);
35
+ * ```
36
+ */
37
+ getTokenInfoBatch(addresses: Address[]): Promise<TokenInfo[]>;
38
+ /**
39
+ * Get token holders for a specific token address with pagination
40
+ *
41
+ * @param tokenAddress - The token address to query holders for
42
+ * @param limit - Maximum number of results per page (default: 100)
43
+ * @param sortOrder - Sort order for results (default: 'DESC' - highest balance first)
44
+ * @returns PagedQuery instance for token holders
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * const holdersQuery = rpc.token.getTokenHolders('0x42cedde51198d1773590311e2a340dc06b24cb37', 10);
49
+ *
50
+ * while (await holdersQuery.queryNextPage()) {
51
+ * const page = holdersQuery.currentPage!;
52
+ * console.log(`Found ${page.size} holders`);
53
+ * page.results.forEach(holder => {
54
+ * console.log(`${holder.account}: ${holder.demurragedTotalBalance}`);
55
+ * });
56
+ * }
57
+ * ```
58
+ */
59
+ getTokenHolders(tokenAddress: Address, limit?: number, sortOrder?: SortOrder): PagedQuery<TokenHolder>;
60
+ }
61
+ //# sourceMappingURL=token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/methods/token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAE1F,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;GAEG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC;;;;;;;;;;;OAWG;IACG,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAKpE;;;;;;;;;;;;;OAaG;IACG,iBAAiB,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAenE;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,eAAe,CACb,YAAY,EAAE,OAAO,EACrB,KAAK,GAAE,MAAY,EACnB,SAAS,GAAE,SAAkB,GAC5B,UAAU,CAAC,WAAW,CAAC;CAiC3B"}
@@ -0,0 +1,99 @@
1
+ import { normalizeAddress, parseStringsToBigInt, checksumAddresses } from '../utils';
2
+ import { PagedQuery } from '../pagedQuery';
3
+ /**
4
+ * Token information RPC methods
5
+ */
6
+ export class TokenMethods {
7
+ client;
8
+ constructor(client) {
9
+ this.client = client;
10
+ }
11
+ /**
12
+ * Get token information for a specific token address
13
+ *
14
+ * @param address - The token address to query
15
+ * @returns Token information or undefined if not found
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * const tokenInfo = await rpc.token.getTokenInfo('0x0d8c4901dd270fe101b8014a5dbecc4e4432eb1e');
20
+ * console.log(tokenInfo);
21
+ * ```
22
+ */
23
+ async getTokenInfo(address) {
24
+ const results = await this.getTokenInfoBatch([address]);
25
+ return results.length > 0 ? results[0] : undefined;
26
+ }
27
+ /**
28
+ * Get token information for multiple token addresses in batch
29
+ *
30
+ * @param addresses - Array of token addresses to query
31
+ * @returns Array of token information objects
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * const tokenInfos = await rpc.token.getTokenInfoBatch([
36
+ * '0x0d8c4901dd270fe101b8014a5dbecc4e4432eb1e',
37
+ * '0x86533d1ada8ffbe7b6f7244f9a1b707f7f3e239b'
38
+ * ]);
39
+ * ```
40
+ */
41
+ async getTokenInfoBatch(addresses) {
42
+ if (addresses.length === 0) {
43
+ return [];
44
+ }
45
+ const normalizedAddresses = addresses.map(addr => normalizeAddress(addr));
46
+ const result = await this.client.call('circles_getTokenInfoBatch', [normalizedAddresses]);
47
+ const parsed = result.map(item => parseStringsToBigInt(item));
48
+ return checksumAddresses(parsed);
49
+ }
50
+ /**
51
+ * Get token holders for a specific token address with pagination
52
+ *
53
+ * @param tokenAddress - The token address to query holders for
54
+ * @param limit - Maximum number of results per page (default: 100)
55
+ * @param sortOrder - Sort order for results (default: 'DESC' - highest balance first)
56
+ * @returns PagedQuery instance for token holders
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * const holdersQuery = rpc.token.getTokenHolders('0x42cedde51198d1773590311e2a340dc06b24cb37', 10);
61
+ *
62
+ * while (await holdersQuery.queryNextPage()) {
63
+ * const page = holdersQuery.currentPage!;
64
+ * console.log(`Found ${page.size} holders`);
65
+ * page.results.forEach(holder => {
66
+ * console.log(`${holder.account}: ${holder.demurragedTotalBalance}`);
67
+ * });
68
+ * }
69
+ * ```
70
+ */
71
+ getTokenHolders(tokenAddress, limit = 100, sortOrder = 'DESC') {
72
+ const normalizedTokenAddress = normalizeAddress(tokenAddress);
73
+ return new PagedQuery(this.client, {
74
+ namespace: 'V_CrcV2',
75
+ table: 'BalancesByAccountAndToken',
76
+ columns: ['account', 'tokenAddress', 'demurragedTotalBalance'],
77
+ filter: [{
78
+ Type: 'FilterPredicate',
79
+ FilterType: 'Equals',
80
+ Column: 'tokenAddress',
81
+ Value: normalizedTokenAddress
82
+ }],
83
+ cursorColumns: [
84
+ { name: 'demurragedTotalBalance', sortOrder },
85
+ { name: 'account', sortOrder: 'ASC' } // Secondary sort for deterministic ordering
86
+ ],
87
+ orderColumns: [
88
+ { Column: 'demurragedTotalBalance', SortOrder: sortOrder },
89
+ { Column: 'account', SortOrder: 'ASC' }
90
+ ],
91
+ limit,
92
+ sortOrder
93
+ }, (row) => ({
94
+ account: row.account,
95
+ tokenAddress: row.tokenAddress,
96
+ demurragedTotalBalance: row.demurragedTotalBalance
97
+ }));
98
+ }
99
+ }
@@ -0,0 +1,41 @@
1
+ import type { RpcClient } from '../client';
2
+ import type { Address } from '@aboutcircles/sdk-types';
3
+ import type { TransactionHistoryRow } from '../types';
4
+ import { PagedQuery } from '../pagedQuery';
5
+ /**
6
+ * Transaction history RPC methods
7
+ */
8
+ export declare class TransactionMethods {
9
+ private client;
10
+ constructor(client: RpcClient);
11
+ /**
12
+ * Get transaction history for an address using cursor-based pagination
13
+ *
14
+ * Returns a PagedQuery instance that can be used to fetch transaction history page by page.
15
+ * Automatically calculates circle amounts for each v2 transaction.
16
+ *
17
+ * @param avatar - Avatar address to query transaction history for
18
+ * @param limit - Number of transactions per page (default: 50)
19
+ * @param sortOrder - Sort order for results (default: 'DESC')
20
+ * @returns PagedQuery instance for iterating through transaction history
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const query = rpc.transaction.getTransactionHistory('0xAvatar...', 50);
25
+ *
26
+ * // Get first page
27
+ * await query.queryNextPage();
28
+ * query.currentPage.results.forEach(tx => {
29
+ * console.log(`${tx.from} -> ${tx.to}: ${tx.circles} CRC`);
30
+ * });
31
+ *
32
+ * // Get next page if available
33
+ * if (query.currentPage.hasMore) {
34
+ * await query.queryNextPage();
35
+ * // Process next page...
36
+ * }
37
+ * ```
38
+ */
39
+ getTransactionHistory(avatar: Address, limit?: number, sortOrder?: 'ASC' | 'DESC'): PagedQuery<TransactionHistoryRow>;
40
+ }
41
+ //# sourceMappingURL=transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/methods/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAU,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAiC3C;;GAEG;AACH,qBAAa,kBAAkB;IACjB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,qBAAqB,CACnB,MAAM,EAAE,OAAO,EACf,KAAK,GAAE,MAAW,EAClB,SAAS,GAAE,KAAK,GAAG,MAAe,GACjC,UAAU,CAAC,qBAAqB,CAAC;CAyDrC"}
@@ -0,0 +1,111 @@
1
+ import { normalizeAddress, checksumAddresses } from '../utils';
2
+ import { CirclesConverter } from '@aboutcircles/sdk-utils';
3
+ import { PagedQuery } from '../pagedQuery';
4
+ /**
5
+ * Calculate circle amounts for v2 transactions
6
+ */
7
+ function calculateCircleAmounts(value, timestamp) {
8
+ // v2: value is attoCircles (demurraged)
9
+ const attoCircles = BigInt(value);
10
+ const circles = CirclesConverter.attoCirclesToCircles(attoCircles);
11
+ const attoCrc = CirclesConverter.attoCirclesToAttoCrc(attoCircles, BigInt(timestamp));
12
+ const crc = CirclesConverter.attoCirclesToCircles(attoCrc);
13
+ const staticAttoCircles = CirclesConverter.attoCirclesToAttoStaticCircles(attoCircles, BigInt(timestamp));
14
+ const staticCircles = CirclesConverter.attoCirclesToCircles(staticAttoCircles);
15
+ return {
16
+ attoCircles,
17
+ circles,
18
+ staticAttoCircles,
19
+ staticCircles,
20
+ attoCrc,
21
+ crc,
22
+ };
23
+ }
24
+ /**
25
+ * Transaction history RPC methods
26
+ */
27
+ export class TransactionMethods {
28
+ client;
29
+ constructor(client) {
30
+ this.client = client;
31
+ }
32
+ /**
33
+ * Get transaction history for an address using cursor-based pagination
34
+ *
35
+ * Returns a PagedQuery instance that can be used to fetch transaction history page by page.
36
+ * Automatically calculates circle amounts for each v2 transaction.
37
+ *
38
+ * @param avatar - Avatar address to query transaction history for
39
+ * @param limit - Number of transactions per page (default: 50)
40
+ * @param sortOrder - Sort order for results (default: 'DESC')
41
+ * @returns PagedQuery instance for iterating through transaction history
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const query = rpc.transaction.getTransactionHistory('0xAvatar...', 50);
46
+ *
47
+ * // Get first page
48
+ * await query.queryNextPage();
49
+ * query.currentPage.results.forEach(tx => {
50
+ * console.log(`${tx.from} -> ${tx.to}: ${tx.circles} CRC`);
51
+ * });
52
+ *
53
+ * // Get next page if available
54
+ * if (query.currentPage.hasMore) {
55
+ * await query.queryNextPage();
56
+ * // Process next page...
57
+ * }
58
+ * ```
59
+ */
60
+ getTransactionHistory(avatar, limit = 50, sortOrder = 'DESC') {
61
+ const normalized = normalizeAddress(avatar);
62
+ const filter = [
63
+ {
64
+ Type: 'Conjunction',
65
+ ConjunctionType: 'And',
66
+ Predicates: [
67
+ {
68
+ Type: 'FilterPredicate',
69
+ FilterType: 'Equals',
70
+ Column: 'version',
71
+ Value: 2,
72
+ },
73
+ {
74
+ Type: 'Conjunction',
75
+ ConjunctionType: 'Or',
76
+ Predicates: [
77
+ {
78
+ Type: 'FilterPredicate',
79
+ FilterType: 'Equals',
80
+ Column: 'from',
81
+ Value: normalized,
82
+ },
83
+ {
84
+ Type: 'FilterPredicate',
85
+ FilterType: 'Equals',
86
+ Column: 'to',
87
+ Value: normalized,
88
+ },
89
+ ],
90
+ },
91
+ ],
92
+ },
93
+ ];
94
+ return new PagedQuery(this.client, {
95
+ namespace: 'V_Crc',
96
+ table: 'TransferSummary',
97
+ sortOrder,
98
+ columns: [], // Empty array returns all columns
99
+ filter,
100
+ limit,
101
+ }, (row) => {
102
+ // Calculate circle amounts
103
+ const amounts = calculateCircleAmounts(row.value, row.timestamp);
104
+ const result = {
105
+ ...row,
106
+ ...amounts,
107
+ };
108
+ return checksumAddresses(result);
109
+ });
110
+ }
111
+ }
@@ -0,0 +1,114 @@
1
+ import type { RpcClient } from '../client';
2
+ import type { Address, TrustRelation, AggregatedTrustRelation } from '@aboutcircles/sdk-types';
3
+ import { PagedQuery } from '../pagedQuery';
4
+ /**
5
+ * Trust relation RPC methods
6
+ */
7
+ export declare class TrustMethods {
8
+ private client;
9
+ constructor(client: RpcClient);
10
+ private transformQueryResponse;
11
+ /**
12
+ * Query the common trust relations of two addresses
13
+ * (only common outgoing trust relations are considered)
14
+ *
15
+ * @param address1 - First address
16
+ * @param address2 - Second address
17
+ * @returns Array of common trusted addresses
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * const commonTrust = await rpc.trust.getCommonTrust(
22
+ * '0xde374ece6fa50e781e81aac78e811b33d16912c7',
23
+ * '0xe8fc7a2d0573e5164597b05f14fa9a7fca7b215c'
24
+ * );
25
+ * ```
26
+ */
27
+ getCommonTrust(address1: Address, address2: Address): Promise<Address[]>;
28
+ /**
29
+ * Get trust relations for an address using cursor-based pagination
30
+ *
31
+ * Returns a PagedQuery instance for iterating through all v2 trust relations for the given avatar.
32
+ *
33
+ * @param avatar - Avatar address to query trust relations for
34
+ * @param limit - Number of trust relations per page (default: 100)
35
+ * @param sortOrder - Sort order for results (default: 'DESC')
36
+ * @returns PagedQuery instance for iterating through trust relations
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * const query = rpc.trust.getTrustRelations('0xAvatar...', 100);
41
+ *
42
+ * // Get first page
43
+ * await query.queryNextPage();
44
+ * query.currentPage.results.forEach(relation => {
45
+ * console.log(`${relation.truster} trusts ${relation.trustee}`);
46
+ * });
47
+ * ```
48
+ */
49
+ getTrustRelations(avatar: Address, limit?: number, sortOrder?: 'ASC' | 'DESC'): PagedQuery<TrustRelation>;
50
+ /**
51
+ * Get aggregated trust relations for an address
52
+ * Groups trust relations by counterpart and determines relationship type
53
+ *
54
+ * Note: This method fetches ALL trust relations for aggregation.
55
+ *
56
+ * @param avatar - Avatar address to query trust relations for
57
+ * @returns Aggregated trust relations with relationship types
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * const aggregated = await rpc.trust.getAggregatedTrustRelations(
62
+ * '0xde374ece6fa50e781e81aac78e811b33d16912c7'
63
+ * );
64
+ * // Returns: [
65
+ * // { subjectAvatar: '0x...', relation: 'mutuallyTrusts', objectAvatar: '0x...', timestamp: 123 },
66
+ * // { subjectAvatar: '0x...', relation: 'trusts', objectAvatar: '0x...', timestamp: 456 }
67
+ * // ]
68
+ * ```
69
+ */
70
+ getAggregatedTrustRelations(avatar: Address): Promise<AggregatedTrustRelation[]>;
71
+ /**
72
+ * Get addresses that trust the given avatar (incoming trust)
73
+ *
74
+ * @param avatar - Avatar address to query
75
+ * @returns Array of trust relations where others trust this avatar
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * const trustedBy = await rpc.trust.getTrustedBy(
80
+ * '0xde374ece6fa50e781e81aac78e811b33d16912c7'
81
+ * );
82
+ * ```
83
+ */
84
+ getTrustedBy(avatar: Address): Promise<AggregatedTrustRelation[]>;
85
+ /**
86
+ * Get addresses that the given avatar trusts (outgoing trust)
87
+ *
88
+ * @param avatar - Avatar address to query
89
+ * @returns Array of trust relations where this avatar trusts others
90
+ *
91
+ * @example
92
+ * ```typescript
93
+ * const trusts = await rpc.trust.getTrusts(
94
+ * '0xde374ece6fa50e781e81aac78e811b33d16912c7'
95
+ * );
96
+ * ```
97
+ */
98
+ getTrusts(avatar: Address): Promise<AggregatedTrustRelation[]>;
99
+ /**
100
+ * Get mutual trust relations for the given avatar
101
+ *
102
+ * @param avatar - Avatar address to query
103
+ * @returns Array of trust relations where both parties trust each other
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * const mutualTrusts = await rpc.trust.getMutualTrusts(
108
+ * '0xde374ece6fa50e781e81aac78e811b33d16912c7'
109
+ * );
110
+ * ```
111
+ */
112
+ getMutualTrusts(avatar: Address): Promise<AggregatedTrustRelation[]>;
113
+ }
114
+ //# sourceMappingURL=trust.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trust.d.ts","sourceRoot":"","sources":["../../src/methods/trust.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAmD,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEhJ,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;GAEG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC,OAAO,CAAC,sBAAsB;IAW9B;;;;;;;;;;;;;;;OAeG;IAEG,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAQ9E;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,iBAAiB,CACf,MAAM,EAAE,OAAO,EACf,KAAK,GAAE,MAAY,EACnB,SAAS,GAAE,KAAK,GAAG,MAAe,GACjC,UAAU,CAAC,aAAa,CAAC;IA4D5B;;;;;;;;;;;;;;;;;;;OAmBG;IACG,2BAA2B,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAuDtF;;;;;;;;;;;;OAYG;IACG,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAOvE;;;;;;;;;;;;OAYG;IACG,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC;IAOpE;;;;;;;;;;;;OAYG;IACG,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC;CAM3E"}