@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
package/dist/rpc.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { RpcClient } from './client';
|
|
2
|
+
import { PathfinderMethods, QueryMethods, TrustMethods, BalanceMethods, AvatarMethods, ProfileMethods, TokenMethods, InvitationMethods, TransactionMethods, GroupMethods, } from './methods';
|
|
3
|
+
/**
|
|
4
|
+
* Main RPC class for Circles protocol RPC interactions
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // Use default RPC endpoint
|
|
9
|
+
* const rpc = new CirclesRpc();
|
|
10
|
+
*
|
|
11
|
+
* // Use custom RPC endpoint
|
|
12
|
+
* const rpc = new CirclesRpc('https://rpc.circlesubi.network/');
|
|
13
|
+
*
|
|
14
|
+
* // Find a path
|
|
15
|
+
* const path = await rpc.pathfinder.findPath({
|
|
16
|
+
* Source: '0x749c930256b47049cb65adcd7c25e72d5de44b3b',
|
|
17
|
+
* Sink: '0xde374ece6fa50e781e81aac78e811b33d16912c7',
|
|
18
|
+
* TargetFlow: '99999999999999999999999999999999999'
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // Query trust relations
|
|
22
|
+
* const trustRelations = await rpc.query.query({
|
|
23
|
+
* Namespace: 'V_CrcV2',
|
|
24
|
+
* Table: 'TrustRelations',
|
|
25
|
+
* Columns: [],
|
|
26
|
+
* Filter: [],
|
|
27
|
+
* Order: []
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* // Get profile
|
|
31
|
+
* const profile = await rpc.profile.getProfileByAddress('0xc3a1428c04c426cdf513c6fc8e09f55ddaf50cd7');
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export class CirclesRpc {
|
|
35
|
+
client;
|
|
36
|
+
pathfinder;
|
|
37
|
+
query;
|
|
38
|
+
trust;
|
|
39
|
+
balance;
|
|
40
|
+
avatar;
|
|
41
|
+
profile;
|
|
42
|
+
token;
|
|
43
|
+
invitation;
|
|
44
|
+
transaction;
|
|
45
|
+
group;
|
|
46
|
+
/**
|
|
47
|
+
* Create a new CirclesRpc instance
|
|
48
|
+
*
|
|
49
|
+
* @param rpcUrl RPC URL to use (defaults to https://rpc.circlesubi.network/)
|
|
50
|
+
*/
|
|
51
|
+
constructor(rpcUrl = 'https://rpc.circlesubi.network/') {
|
|
52
|
+
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);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Update the RPC URL
|
|
66
|
+
*/
|
|
67
|
+
setRpcUrl(rpcUrl) {
|
|
68
|
+
this.client.setRpcUrl(rpcUrl);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get the current RPC URL
|
|
72
|
+
*/
|
|
73
|
+
getRpcUrl() {
|
|
74
|
+
return this.client.getRpcUrl();
|
|
75
|
+
}
|
|
76
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Address } from '@aboutcircles/sdk-types';
|
|
2
|
+
/**
|
|
3
|
+
* RPC-specific types
|
|
4
|
+
* These types are specific to the RPC package and not shared across multiple packages
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Transaction history row (base data from RPC)
|
|
8
|
+
* Might include conversions between different circle representations
|
|
9
|
+
*/
|
|
10
|
+
export interface TransactionHistoryRow {
|
|
11
|
+
blockNumber: number;
|
|
12
|
+
timestamp: number;
|
|
13
|
+
transactionIndex: number;
|
|
14
|
+
logIndex: number;
|
|
15
|
+
transactionHash: string;
|
|
16
|
+
version: number;
|
|
17
|
+
from: Address;
|
|
18
|
+
to: Address;
|
|
19
|
+
id: string;
|
|
20
|
+
tokenAddress: Address;
|
|
21
|
+
value: string;
|
|
22
|
+
/** Human-readable circle amount (demurraged) */
|
|
23
|
+
circles?: number;
|
|
24
|
+
/** Atto-circles (demurraged, 18 decimals) */
|
|
25
|
+
attoCircles?: bigint;
|
|
26
|
+
/** Static circles (inflationary, human-readable) */
|
|
27
|
+
staticCircles?: number;
|
|
28
|
+
/** Atto-static circles (inflationary, 18 decimals) */
|
|
29
|
+
staticAttoCircles?: bigint;
|
|
30
|
+
/** Time Circles (CRC) human-readable */
|
|
31
|
+
crc?: number;
|
|
32
|
+
/** Atto-CRC (18 decimals) */
|
|
33
|
+
attoCrc?: bigint;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Search result profile with additional metadata
|
|
37
|
+
*/
|
|
38
|
+
export interface SearchResultProfile {
|
|
39
|
+
address: Address;
|
|
40
|
+
name: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
previewImageUrl?: string;
|
|
43
|
+
imageUrl?: string;
|
|
44
|
+
location?: string;
|
|
45
|
+
geoLocation?: [number, number];
|
|
46
|
+
extensions?: Record<string, any>;
|
|
47
|
+
avatarType?: string;
|
|
48
|
+
CID?: string;
|
|
49
|
+
lastUpdatedAt?: number;
|
|
50
|
+
registeredName?: string | null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Row type for GroupTokenHoldersBalance view table
|
|
54
|
+
*/
|
|
55
|
+
export interface GroupTokenHolderRow {
|
|
56
|
+
group: Address;
|
|
57
|
+
holder: Address;
|
|
58
|
+
totalBalance: bigint;
|
|
59
|
+
demurragedTotalBalance: bigint;
|
|
60
|
+
fractionOwnership: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Configuration for a cursor column in pagination
|
|
64
|
+
*/
|
|
65
|
+
export interface CursorColumn {
|
|
66
|
+
name: string;
|
|
67
|
+
sortOrder: 'ASC' | 'DESC';
|
|
68
|
+
toValue?: (value: any) => string | number | boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Flexible paged result that works with both event-based and custom cursors
|
|
72
|
+
*/
|
|
73
|
+
export interface FlexiblePagedResult<TRow> {
|
|
74
|
+
limit: number;
|
|
75
|
+
size: number;
|
|
76
|
+
firstCursor?: Record<string, any>;
|
|
77
|
+
lastCursor?: Record<string, any>;
|
|
78
|
+
sortOrder: 'ASC' | 'DESC';
|
|
79
|
+
hasMore: boolean;
|
|
80
|
+
results: TRow[];
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEvD;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,OAAO,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,wCAAwC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,IAAI;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,IAAI,EAAE,CAAC;CACjB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Address, FindPathParams } from '@aboutcircles/sdk-types';
|
|
2
|
+
/**
|
|
3
|
+
* Normalize an address to lowercase (required by the indexer)
|
|
4
|
+
*/
|
|
5
|
+
export declare function normalizeAddress(address: Address): Address;
|
|
6
|
+
/**
|
|
7
|
+
* Normalize an array of addresses to lowercase
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeAddresses(addresses: Address[]): Address[];
|
|
10
|
+
/**
|
|
11
|
+
* Convert an address to EIP-55 checksummed format
|
|
12
|
+
*/
|
|
13
|
+
export declare function checksumAddress(address: Address): Address;
|
|
14
|
+
/**
|
|
15
|
+
* Recursively checksum all address strings in an object, array, or primitive value
|
|
16
|
+
*/
|
|
17
|
+
export declare function checksumAddresses<T>(value: T): T;
|
|
18
|
+
/**
|
|
19
|
+
* Normalize and convert FindPathParams for RPC call
|
|
20
|
+
* Converts camelCase to PascalCase and bigint to human-readable numbers
|
|
21
|
+
*/
|
|
22
|
+
export declare function normalizeFindPathParams(params: FindPathParams): Record<string, unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* Convert string numeric values to bigint in an object
|
|
25
|
+
*/
|
|
26
|
+
export declare function parseStringsToBigInt<T extends Record<string, unknown>>(obj: T): T;
|
|
27
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAoB,MAAM,yBAAyB,CAAC;AAGzF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAE1D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAElE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAEzD;AAWD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CA6BhD;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmBvF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CA2BjF"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { checksumAddress as toChecksumAddress } from '@aboutcircles/sdk-utils';
|
|
2
|
+
/**
|
|
3
|
+
* Normalize an address to lowercase (required by the indexer)
|
|
4
|
+
*/
|
|
5
|
+
export function normalizeAddress(address) {
|
|
6
|
+
return address.toLowerCase();
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Normalize an array of addresses to lowercase
|
|
10
|
+
*/
|
|
11
|
+
export function normalizeAddresses(addresses) {
|
|
12
|
+
return addresses.map(addr => normalizeAddress(addr));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Convert an address to EIP-55 checksummed format
|
|
16
|
+
*/
|
|
17
|
+
export function checksumAddress(address) {
|
|
18
|
+
return toChecksumAddress(address);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Detect if a value is an Ethereum address (40 hex chars, optionally prefixed with 0x)
|
|
22
|
+
*/
|
|
23
|
+
function isAddress(value) {
|
|
24
|
+
if (typeof value !== 'string')
|
|
25
|
+
return false;
|
|
26
|
+
const cleaned = value.replace('0x', '');
|
|
27
|
+
return cleaned.length === 40 && /^[0-9a-fA-F]{40}$/.test(cleaned);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Recursively checksum all address strings in an object, array, or primitive value
|
|
31
|
+
*/
|
|
32
|
+
export function checksumAddresses(value) {
|
|
33
|
+
// Handle null/undefined
|
|
34
|
+
if (value === null || value === undefined) {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
// Handle address strings
|
|
38
|
+
if (isAddress(value)) {
|
|
39
|
+
return checksumAddress(value);
|
|
40
|
+
}
|
|
41
|
+
// Handle arrays
|
|
42
|
+
if (Array.isArray(value)) {
|
|
43
|
+
return value.map(item => checksumAddresses(item));
|
|
44
|
+
}
|
|
45
|
+
// Handle objects
|
|
46
|
+
if (typeof value === 'object' && value !== null) {
|
|
47
|
+
const result = {};
|
|
48
|
+
for (const key in value) {
|
|
49
|
+
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
|
50
|
+
result[key] = checksumAddresses(value[key]);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
// Return primitives as-is
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Normalize and convert FindPathParams for RPC call
|
|
60
|
+
* Converts camelCase to PascalCase and bigint to human-readable numbers
|
|
61
|
+
*/
|
|
62
|
+
export function normalizeFindPathParams(params) {
|
|
63
|
+
return {
|
|
64
|
+
Source: normalizeAddress(params.from),
|
|
65
|
+
Sink: normalizeAddress(params.to),
|
|
66
|
+
TargetFlow: params.targetFlow.toString(),
|
|
67
|
+
WithWrap: params.useWrappedBalances,
|
|
68
|
+
FromTokens: params.fromTokens?.map(normalizeAddress),
|
|
69
|
+
ToTokens: params.toTokens?.map(normalizeAddress),
|
|
70
|
+
ExcludedFromTokens: params.excludeFromTokens?.map(normalizeAddress),
|
|
71
|
+
ExcludedToTokens: params.excludeToTokens?.map(normalizeAddress),
|
|
72
|
+
SimulatedBalances: params.simulatedBalances?.map((balance) => ({
|
|
73
|
+
Holder: normalizeAddress(balance.holder),
|
|
74
|
+
Token: normalizeAddress(balance.token),
|
|
75
|
+
Amount: balance.amount.toString(),
|
|
76
|
+
IsWrapped: balance.isWrapped,
|
|
77
|
+
IsStatic: balance.isStatic,
|
|
78
|
+
})),
|
|
79
|
+
MaxTransfers: params.maxTransfers,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Convert string numeric values to bigint in an object
|
|
84
|
+
*/
|
|
85
|
+
export function parseStringsToBigInt(obj) {
|
|
86
|
+
const result = {};
|
|
87
|
+
for (const key in obj) {
|
|
88
|
+
const value = obj[key];
|
|
89
|
+
if (value === null || value === undefined) {
|
|
90
|
+
result[key] = value;
|
|
91
|
+
}
|
|
92
|
+
else if (typeof value === 'string' && /^\d+$/.test(value)) {
|
|
93
|
+
// Convert numeric strings to bigint
|
|
94
|
+
result[key] = BigInt(value);
|
|
95
|
+
}
|
|
96
|
+
else if (typeof value === 'object' && !Array.isArray(value)) {
|
|
97
|
+
// Recursively process nested objects
|
|
98
|
+
result[key] = parseStringsToBigInt(value);
|
|
99
|
+
}
|
|
100
|
+
else if (Array.isArray(value)) {
|
|
101
|
+
// Process arrays
|
|
102
|
+
result[key] = value.map(item => typeof item === 'object' && item !== null
|
|
103
|
+
? parseStringsToBigInt(item)
|
|
104
|
+
: item);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
result[key] = value;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
111
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aboutcircles/sdk-rpc",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Circles RPC wrapper",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "bun build ./src/index.ts --outdir ./dist --format esm --splitting && tsc --emitDeclarationOnly",
|
|
20
|
+
"dev": "tsc --watch"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@aboutcircles/sdk-types": "*",
|
|
24
|
+
"@aboutcircles/sdk-utils": "*"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@esbuild-kit/esm-loader": "^2.6.5",
|
|
28
|
+
"@types/bun": "^1.2.23",
|
|
29
|
+
"esbuild": "^0.25.10",
|
|
30
|
+
"typescript": "^5.0.4"
|
|
31
|
+
}
|
|
32
|
+
}
|