@aboutcircles/sdk 0.1.30 → 0.1.31

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.
@@ -1,7 +1,7 @@
1
1
  import type { Address, AvatarRow, ContractRunner, TokenBalanceRow, GroupMembershipRow, GroupRow, TransactionRequest } from '@aboutcircles/sdk-types';
2
2
  import type { TransactionReceipt, Hex } from 'viem';
3
3
  import type { Core } from '@aboutcircles/sdk-core';
4
- import { CommonAvatar, type PathfindingOptions } from './CommonAvatar.js';
4
+ import { CommonAvatar } from './CommonAvatar.js';
5
5
  import { type ProxyInviter, type ReferralPreviewList } from '@aboutcircles/sdk-invitations';
6
6
  /**
7
7
  * HumanAvatar class implementation
@@ -16,41 +16,6 @@ export declare class HumanAvatar extends CommonAvatar {
16
16
  getTotal: () => Promise<bigint>;
17
17
  getTokenBalances: () => Promise<TokenBalanceRow[]>;
18
18
  getTotalSupply: () => Promise<bigint>;
19
- /**
20
- * Get the maximum amount that can be replenished (converted to unwrapped personal CRC)
21
- * This calculates how much of your wrapped tokens and other tokens can be converted
22
- * into your own unwrapped ERC1155 personal CRC tokens using pathfinding
23
- *
24
- * @param options Optional pathfinding options
25
- * @returns Maximum replenishable amount in atto-circles
26
- *
27
- * @example
28
- * ```typescript
29
- * const maxReplenishable = await avatar.balances.getMaxReplenishable();
30
- * console.log('Can replenish:', CirclesConverter.attoCirclesToCircles(maxReplenishable), 'CRC');
31
- * ```
32
- */
33
- getMaxReplenishable: (options?: PathfindingOptions) => Promise<bigint>;
34
- /**
35
- * Replenish unwrapped personal CRC tokens by converting wrapped/other tokens
36
- *
37
- * This method uses pathfinding to find the best way to convert your available tokens
38
- * (including wrapped tokens) into unwrapped ERC1155 personal CRC tokens.
39
- *
40
- * Useful when you have wrapped tokens or other people's tokens and want to
41
- * convert them to your own personal unwrapped tokens for transfers.
42
- *
43
- * @param options Optional pathfinding options
44
- * @returns Transaction receipt
45
- *
46
- * @example
47
- * ```typescript
48
- * // Convert all available wrapped/other tokens to unwrapped personal CRC
49
- * const receipt = await avatar.balances.replenish();
50
- * console.log('Replenished personal tokens, tx hash:', receipt.hash);
51
- * ```
52
- */
53
- replenish: (options?: PathfindingOptions) => Promise<TransactionReceipt>;
54
19
  };
55
20
  private readonly _invitations;
56
21
  private readonly _inviteFarm;
@@ -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,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAInD,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAA2B,KAAK,YAAY,EAA0B,KAAK,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAE7I;;;;;;GAMG;AACH,qBAAa,WAAY,SAAQ,YAAY;gBAEzC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,cAAc,CAAC,EAAE,cAAc,EAC/B,UAAU,CAAC,EAAE,SAAS;IASxB,SAAgB,QAAQ;wBACF,OAAO,CAAC,MAAM,CAAC;gCAIP,OAAO,CAAC,eAAe,EAAE,CAAC;8BAI5B,OAAO,CAAC,MAAM,CAAC;QAIzC;;;;;;;;;;;;;WAaG;wCAEmC,kBAAkB,KAAG,OAAO,CAAC,MAAM,CAAC;QAiB1E;;;;;;;;;;;;;;;;;;WAkBG;8BACyB,kBAAkB,KAAG,OAAO,CAAC,kBAAkB,CAAC;MAqB5E;IAcF,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqC;IAClE,OAAO,CAAC,QAAQ,CAAC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AC,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;QAInC;;;;;;;;;;;;;;;;;;;;;WAqBG;iDAC2C,MAAM,KAAQ,OAAO,CAAC,QAAQ,EAAE,CAAC;MAkB/E;CAaH"}
@@ -27,66 +27,6 @@ export class HumanAvatar extends CommonAvatar {
27
27
  getTotalSupply: async () => {
28
28
  throw SdkError.unsupportedOperation('getTotalSupply', 'This method is not yet implemented');
29
29
  },
30
- /**
31
- * Get the maximum amount that can be replenished (converted to unwrapped personal CRC)
32
- * This calculates how much of your wrapped tokens and other tokens can be converted
33
- * into your own unwrapped ERC1155 personal CRC tokens using pathfinding
34
- *
35
- * @param options Optional pathfinding options
36
- * @returns Maximum replenishable amount in atto-circles
37
- *
38
- * @example
39
- * ```typescript
40
- * const maxReplenishable = await avatar.balances.getMaxReplenishable();
41
- * console.log('Can replenish:', CirclesConverter.attoCirclesToCircles(maxReplenishable), 'CRC');
42
- * ```
43
- */
44
- //@todo improve calculation
45
- getMaxReplenishable: async (options) => {
46
- const addr = this.address.toLowerCase();
47
- // Find maximum flow from avatar to itself, targeting personal tokens as destination
48
- // This effectively asks: "How much can I convert to my own personal tokens?"
49
- // @todo add sim trust
50
- const maxFlow = await this.rpc.pathfinder.findMaxFlow({
51
- from: addr,
52
- to: addr,
53
- toTokens: [addr], // Destination token is sender's own personal CRC
54
- useWrappedBalances: true, // Include wrapped tokens
55
- ...options,
56
- });
57
- return maxFlow;
58
- },
59
- /**
60
- * Replenish unwrapped personal CRC tokens by converting wrapped/other tokens
61
- *
62
- * This method uses pathfinding to find the best way to convert your available tokens
63
- * (including wrapped tokens) into unwrapped ERC1155 personal CRC tokens.
64
- *
65
- * Useful when you have wrapped tokens or other people's tokens and want to
66
- * convert them to your own personal unwrapped tokens for transfers.
67
- *
68
- * @param options Optional pathfinding options
69
- * @returns Transaction receipt
70
- *
71
- * @example
72
- * ```typescript
73
- * // Convert all available wrapped/other tokens to unwrapped personal CRC
74
- * const receipt = await avatar.balances.replenish();
75
- * console.log('Replenished personal tokens, tx hash:', receipt.hash);
76
- * ```
77
- */
78
- replenish: async (options) => {
79
- // First, get the maximum replenishable amount
80
- const maxAmount = await this.balances.getMaxReplenishable(options);
81
- if (maxAmount === 0n) {
82
- throw SdkError.configError('No tokens available to replenish', { message: 'You may not have any wrapped tokens or convertible tokens' });
83
- }
84
- // Construct replenish transactions using TransferBuilder
85
- const transactions = await this.transferBuilder.constructReplenish(this.address, this.address, // tokenId is own address (replenishing own tokens)
86
- maxAmount);
87
- // Execute the constructed transactions
88
- return await this.runner.sendTransaction(transactions);
89
- },
90
30
  };
91
31
  // ============================================================================
92
32
  // Transfer methods are inherited from CommonAvatar
@@ -1,7 +1,7 @@
1
1
  import type { Address, AvatarRow, ContractRunner, TokenBalanceRow } from '@aboutcircles/sdk-types';
2
2
  import type { TransactionReceipt } from 'viem';
3
3
  import type { Core } from '@aboutcircles/sdk-core';
4
- import { CommonAvatar, type PathfindingOptions } from './CommonAvatar.js';
4
+ import { CommonAvatar } from './CommonAvatar.js';
5
5
  /**
6
6
  * OrganisationAvatar class implementation
7
7
  * Provides a simplified, user-friendly wrapper around Circles protocol for organisation avatars
@@ -16,41 +16,6 @@ export declare class OrganisationAvatar extends CommonAvatar {
16
16
  getTotal: () => Promise<bigint>;
17
17
  getTokenBalances: () => Promise<TokenBalanceRow[]>;
18
18
  getTotalSupply: () => Promise<bigint>;
19
- /**
20
- * Get the maximum amount that can be replenished (converted to unwrapped personal CRC)
21
- * This calculates how much of your wrapped tokens and other tokens can be converted
22
- * into your own unwrapped ERC1155 personal CRC tokens using pathfinding
23
- *
24
- * @param options Optional pathfinding options
25
- * @returns Maximum replenishable amount in atto-circles
26
- *
27
- * @example
28
- * ```typescript
29
- * const maxReplenishable = await avatar.balances.getMaxReplenishable();
30
- * console.log('Can replenish:', CirclesConverter.attoCirclesToCircles(maxReplenishable), 'CRC');
31
- * ```
32
- */
33
- getMaxReplenishable: (options?: PathfindingOptions) => Promise<bigint>;
34
- /**
35
- * Replenish unwrapped personal CRC tokens by converting wrapped/other tokens
36
- *
37
- * This method uses pathfinding to find the best way to convert your available tokens
38
- * (including wrapped tokens) into unwrapped ERC1155 personal CRC tokens.
39
- *
40
- * Useful when you have wrapped tokens or other people's tokens and want to
41
- * convert them to your own personal unwrapped tokens for transfers.
42
- *
43
- * @param options Optional pathfinding options
44
- * @returns Transaction receipt
45
- *
46
- * @example
47
- * ```typescript
48
- * // Convert all available wrapped/other tokens to unwrapped personal CRC
49
- * const receipt = await avatar.balances.replenish();
50
- * console.log('Replenished personal tokens, tx hash:', receipt.hash);
51
- * ```
52
- */
53
- replenish: (options?: PathfindingOptions) => Promise<TransactionReceipt>;
54
19
  };
55
20
  readonly groupToken: {
56
21
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"OrganisationAvatar.d.ts","sourceRoot":"","sources":["../../src/avatars/OrganisationAvatar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,cAAc,EACd,eAAe,EAEhB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAInD,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE1E;;;;;;;GAOG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;gBAEhD,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,cAAc,CAAC,EAAE,cAAc,EAC/B,UAAU,CAAC,EAAE,SAAS;IASxB,SAAgB,QAAQ;wBACF,OAAO,CAAC,MAAM,CAAC;gCAIP,OAAO,C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AAC,OAAO,CAAC;YAQvD;;;;eAIG;6CACoC,OAAO,KAAG,OAAO,CAAC,OAAO,EAAE,CAAC;;MASrE;IAGF,SAAgB,KAAK;;YAlFjB;;;;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;;MAcrE;CASH"}
@@ -27,64 +27,6 @@ export class OrganisationAvatar extends CommonAvatar {
27
27
  getTotalSupply: async () => {
28
28
  throw SdkError.unsupportedOperation('getTotalSupply', 'This method is not yet implemented');
29
29
  },
30
- /**
31
- * Get the maximum amount that can be replenished (converted to unwrapped personal CRC)
32
- * This calculates how much of your wrapped tokens and other tokens can be converted
33
- * into your own unwrapped ERC1155 personal CRC tokens using pathfinding
34
- *
35
- * @param options Optional pathfinding options
36
- * @returns Maximum replenishable amount in atto-circles
37
- *
38
- * @example
39
- * ```typescript
40
- * const maxReplenishable = await avatar.balances.getMaxReplenishable();
41
- * console.log('Can replenish:', CirclesConverter.attoCirclesToCircles(maxReplenishable), 'CRC');
42
- * ```
43
- */
44
- getMaxReplenishable: async (options) => {
45
- const addr = this.address.toLowerCase();
46
- // Find maximum flow from avatar to itself, targeting personal tokens as destination
47
- // This effectively asks: "How much can I convert to my own personal tokens?"
48
- const maxFlow = await this.rpc.pathfinder.findMaxFlow({
49
- from: addr,
50
- to: addr,
51
- toTokens: [addr], // Destination token is sender's own personal CRC
52
- useWrappedBalances: true, // Include wrapped tokens
53
- ...options,
54
- });
55
- return maxFlow;
56
- },
57
- /**
58
- * Replenish unwrapped personal CRC tokens by converting wrapped/other tokens
59
- *
60
- * This method uses pathfinding to find the best way to convert your available tokens
61
- * (including wrapped tokens) into unwrapped ERC1155 personal CRC tokens.
62
- *
63
- * Useful when you have wrapped tokens or other people's tokens and want to
64
- * convert them to your own personal unwrapped tokens for transfers.
65
- *
66
- * @param options Optional pathfinding options
67
- * @returns Transaction receipt
68
- *
69
- * @example
70
- * ```typescript
71
- * // Convert all available wrapped/other tokens to unwrapped personal CRC
72
- * const receipt = await avatar.balances.replenish();
73
- * console.log('Replenished personal tokens, tx hash:', receipt.hash);
74
- * ```
75
- */
76
- replenish: async (options) => {
77
- // First, get the maximum replenishable amount
78
- const maxAmount = await this.balances.getMaxReplenishable(options);
79
- if (maxAmount === 0n) {
80
- throw SdkError.configError('No tokens available to replenish', { message: 'You may not have any wrapped tokens or convertible tokens' });
81
- }
82
- // Construct replenish transactions using TransferBuilder
83
- const transactions = await this.transferBuilder.constructReplenish(this.address, this.address, // tokenId is own address (replenishing own tokens)
84
- maxAmount);
85
- // Execute the constructed transactions
86
- return await this.runner.sendTransaction(transactions);
87
- },
88
30
  };
89
31
  // ============================================================================
90
32
  // Transfer methods are inherited from CommonAvatar