@aboutcircles/sdk-rpc 0.1.5 → 0.1.6

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,5 +1,5 @@
1
1
  import { normalizeAddress, parseStringsToBigInt, checksumAddresses } from '../utils';
2
- import { CirclesConverter } from '@aboutcircles/sdk-utils';
2
+ import { CirclesConverter } from '@aboutcircles/sdk-utils/circlesConverter';
3
3
  /**
4
4
  * Balance query RPC methods
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"pathfinder.d.ts","sourceRoot":"","sources":["../../src/methods/pathfinder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGjF;;GAEG;AACH,qBAAa,iBAAiB;IAChB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC;;;;;;;;;;;;;;OAcG;IACG,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAYlE;;;;;;;;;;;;;OAaG;IACG,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAQ/E"}
1
+ {"version":3,"file":"pathfinder.d.ts","sourceRoot":"","sources":["../../src/methods/pathfinder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAIjF;;GAEG;AACH,qBAAa,iBAAiB;IAChB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC;;;;;;;;;;;;;;OAcG;IACG,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAYlE;;;;;;;;;;;;;OAaG;IACG,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAO/E"}
@@ -1,4 +1,5 @@
1
1
  import { normalizeFindPathParams, parseStringsToBigInt, checksumAddresses } from '../utils';
2
+ import { MAX_FLOW } from '@aboutcircles/sdk-utils/constants';
2
3
  /**
3
4
  * Circles V1 and V2 balance and pathfinding methods
4
5
  */
@@ -43,10 +44,9 @@ export class PathfinderMethods {
43
44
  * ```
44
45
  */
45
46
  async findMaxFlow(params) {
46
- const targetFlow = 9999999999999999999999999999999999999n;
47
47
  const path = await this.findPath({
48
48
  ...params,
49
- targetFlow
49
+ targetFlow: MAX_FLOW
50
50
  });
51
51
  return BigInt(path.maxFlow);
52
52
  }
@@ -1,5 +1,5 @@
1
1
  import { normalizeAddress, checksumAddresses } from '../utils';
2
- import { CirclesConverter } from '@aboutcircles/sdk-utils';
2
+ import { CirclesConverter } from '@aboutcircles/sdk-utils/circlesConverter';
3
3
  import { PagedQuery } from '../pagedQuery';
4
4
  /**
5
5
  * Calculate circle amounts for v2 transactions
package/dist/rpc.d.ts CHANGED
@@ -3,6 +3,9 @@ import { PathfinderMethods, QueryMethods, TrustMethods, BalanceMethods, AvatarMe
3
3
  /**
4
4
  * Main RPC class for Circles protocol RPC interactions
5
5
  *
6
+ * Uses lazy initialization - method modules are only created when first accessed.
7
+ * This reduces initial memory footprint and instantiation overhead.
8
+ *
6
9
  * @example
7
10
  * ```typescript
8
11
  * // Use default RPC endpoint
@@ -33,22 +36,32 @@ import { PathfinderMethods, QueryMethods, TrustMethods, BalanceMethods, AvatarMe
33
36
  */
34
37
  export declare class CirclesRpc {
35
38
  readonly client: RpcClient;
36
- readonly pathfinder: PathfinderMethods;
37
- readonly query: QueryMethods;
38
- readonly trust: TrustMethods;
39
- readonly balance: BalanceMethods;
40
- readonly avatar: AvatarMethods;
41
- readonly profile: ProfileMethods;
42
- readonly token: TokenMethods;
43
- readonly invitation: InvitationMethods;
44
- readonly transaction: TransactionMethods;
45
- readonly group: GroupMethods;
39
+ private _pathfinder?;
40
+ private _query?;
41
+ private _trust?;
42
+ private _balance?;
43
+ private _avatar?;
44
+ private _profile?;
45
+ private _token?;
46
+ private _invitation?;
47
+ private _transaction?;
48
+ private _group?;
46
49
  /**
47
50
  * Create a new CirclesRpc instance
48
51
  *
49
52
  * @param rpcUrl RPC URL to use (defaults to https://rpc.circlesubi.network/)
50
53
  */
51
54
  constructor(rpcUrl?: string);
55
+ get pathfinder(): PathfinderMethods;
56
+ get query(): QueryMethods;
57
+ get trust(): TrustMethods;
58
+ get balance(): BalanceMethods;
59
+ get avatar(): AvatarMethods;
60
+ get profile(): ProfileMethods;
61
+ get token(): TokenMethods;
62
+ get invitation(): InvitationMethods;
63
+ get transaction(): TransactionMethods;
64
+ get group(): GroupMethods;
52
65
  /**
53
66
  * Update the RPC URL
54
67
  */
package/dist/rpc.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACb,MAAM,WAAW,CAAC;AAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,UAAU;IACrB,SAAgB,MAAM,EAAE,SAAS,CAAC;IAClC,SAAgB,UAAU,EAAE,iBAAiB,CAAC;IAC9C,SAAgB,KAAK,EAAE,YAAY,CAAC;IACpC,SAAgB,KAAK,EAAE,YAAY,CAAC;IACpC,SAAgB,OAAO,EAAE,cAAc,CAAC;IACxC,SAAgB,MAAM,EAAE,aAAa,CAAC;IACtC,SAAgB,OAAO,EAAE,cAAc,CA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I,OAAO,IAAI,cAAc,CAK5B;IAED,IAAI,MAAM,IAAI,aAAa,CAK1B;IAED,IAAI,OAAO,IAAI,cAAc,CAK5B;IAED,IAAI,KAAK,IAAI,YAAY,CAKxB;IAED,IAAI,UAAU,IAAI,iBAAiB,CAKlC;IAED,IAAI,WAAW,IAAI,kBAAkB,CAKpC;IAED,IAAI,KAAK,IAAI,YAAY,CAKxB;IAED;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI/B;;OAEG;IACH,SAAS,IAAI,MAAM;CAGpB"}
package/dist/rpc.js CHANGED
@@ -3,6 +3,9 @@ import { PathfinderMethods, QueryMethods, TrustMethods, BalanceMethods, AvatarMe
3
3
  /**
4
4
  * Main RPC class for Circles protocol RPC interactions
5
5
  *
6
+ * Uses lazy initialization - method modules are only created when first accessed.
7
+ * This reduces initial memory footprint and instantiation overhead.
8
+ *
6
9
  * @example
7
10
  * ```typescript
8
11
  * // Use default RPC endpoint
@@ -33,16 +36,16 @@ import { PathfinderMethods, QueryMethods, TrustMethods, BalanceMethods, AvatarMe
33
36
  */
34
37
  export class CirclesRpc {
35
38
  client;
36
- pathfinder;
37
- query;
38
- trust;
39
- balance;
40
- avatar;
41
- profile;
42
- token;
43
- invitation;
44
- transaction;
45
- group;
39
+ _pathfinder;
40
+ _query;
41
+ _trust;
42
+ _balance;
43
+ _avatar;
44
+ _profile;
45
+ _token;
46
+ _invitation;
47
+ _transaction;
48
+ _group;
46
49
  /**
47
50
  * Create a new CirclesRpc instance
48
51
  *
@@ -50,16 +53,66 @@ export class CirclesRpc {
50
53
  */
51
54
  constructor(rpcUrl = 'https://rpc.circlesubi.network/') {
52
55
  this.client = new RpcClient(rpcUrl);
53
- this.pathfinder = new PathfinderMethods(this.client);
54
- this.query = new QueryMethods(this.client);
55
- this.trust = new TrustMethods(this.client);
56
- this.balance = new BalanceMethods(this.client);
57
- this.avatar = new AvatarMethods(this.client);
58
- this.profile = new ProfileMethods(this.client);
59
- this.token = new TokenMethods(this.client);
60
- this.invitation = new InvitationMethods(this.client);
61
- this.transaction = new TransactionMethods(this.client);
62
- this.group = new GroupMethods(this.client);
56
+ }
57
+ get pathfinder() {
58
+ if (!this._pathfinder) {
59
+ this._pathfinder = new PathfinderMethods(this.client);
60
+ }
61
+ return this._pathfinder;
62
+ }
63
+ get query() {
64
+ if (!this._query) {
65
+ this._query = new QueryMethods(this.client);
66
+ }
67
+ return this._query;
68
+ }
69
+ get trust() {
70
+ if (!this._trust) {
71
+ this._trust = new TrustMethods(this.client);
72
+ }
73
+ return this._trust;
74
+ }
75
+ get balance() {
76
+ if (!this._balance) {
77
+ this._balance = new BalanceMethods(this.client);
78
+ }
79
+ return this._balance;
80
+ }
81
+ get avatar() {
82
+ if (!this._avatar) {
83
+ this._avatar = new AvatarMethods(this.client);
84
+ }
85
+ return this._avatar;
86
+ }
87
+ get profile() {
88
+ if (!this._profile) {
89
+ this._profile = new ProfileMethods(this.client);
90
+ }
91
+ return this._profile;
92
+ }
93
+ get token() {
94
+ if (!this._token) {
95
+ this._token = new TokenMethods(this.client);
96
+ }
97
+ return this._token;
98
+ }
99
+ get invitation() {
100
+ if (!this._invitation) {
101
+ this._invitation = new InvitationMethods(this.client);
102
+ }
103
+ return this._invitation;
104
+ }
105
+ get transaction() {
106
+ if (!this._transaction) {
107
+ this._transaction = new TransactionMethods(this.client);
108
+ }
109
+ return this._transaction;
110
+ }
111
+ get group() {
112
+ if (!this._group) {
113
+ this._group = new GroupMethods(this.client);
114
+ }
115
+ return this._group;
63
116
  }
64
117
  /**
65
118
  * Update the RPC URL
package/dist/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- import { checksumAddress as toChecksumAddress } from '@aboutcircles/sdk-utils';
1
+ import { checksumAddress as toChecksumAddress } from '@aboutcircles/sdk-utils/abi';
2
2
  /**
3
3
  * Normalize an address to lowercase (required by the indexer)
4
4
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aboutcircles/sdk-rpc",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Circles RPC wrapper",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "license": "MIT",
23
23
  "scripts": {
24
- "build": "bun build ./src/index.ts --outdir ./dist --format esm --splitting && tsc --emitDeclarationOnly",
24
+ "build": "bun build ./src/index.ts --outdir ./dist --format esm --minify --splitting && tsc --emitDeclarationOnly",
25
25
  "dev": "tsc --watch"
26
26
  },
27
27
  "dependencies": {