@aboutcircles/sdk-rpc 0.1.25 → 0.1.27
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/dist/client.d.ts +2 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -2
- package/dist/events/index.d.ts +4 -4
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +3 -3
- package/dist/events/parser.d.ts +1 -1
- package/dist/events/parser.d.ts.map +1 -1
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/methods/avatar.d.ts +1 -1
- package/dist/methods/avatar.d.ts.map +1 -1
- package/dist/methods/avatar.js +1 -1
- package/dist/methods/balance.d.ts +1 -1
- package/dist/methods/balance.d.ts.map +1 -1
- package/dist/methods/balance.js +1 -1
- package/dist/methods/group.d.ts +3 -3
- package/dist/methods/group.d.ts.map +1 -1
- package/dist/methods/group.js +2 -2
- package/dist/methods/index.d.ts +10 -10
- package/dist/methods/index.d.ts.map +1 -1
- package/dist/methods/index.js +10 -10
- package/dist/methods/invitation.d.ts +1 -1
- package/dist/methods/invitation.d.ts.map +1 -1
- package/dist/methods/invitation.js +1 -1
- package/dist/methods/pathfinder.d.ts +1 -1
- package/dist/methods/pathfinder.d.ts.map +1 -1
- package/dist/methods/pathfinder.js +1 -1
- package/dist/methods/profile.d.ts +2 -2
- package/dist/methods/profile.d.ts.map +1 -1
- package/dist/methods/profile.js +1 -1
- package/dist/methods/query.d.ts +1 -1
- package/dist/methods/query.d.ts.map +1 -1
- package/dist/methods/query.js +1 -1
- package/dist/methods/token.d.ts +2 -2
- package/dist/methods/token.d.ts.map +1 -1
- package/dist/methods/token.js +2 -2
- package/dist/methods/transaction.d.ts +3 -3
- package/dist/methods/transaction.d.ts.map +1 -1
- package/dist/methods/transaction.js +2 -2
- package/dist/methods/trust.d.ts +2 -2
- package/dist/methods/trust.d.ts.map +1 -1
- package/dist/methods/trust.js +2 -2
- package/dist/pagedQuery.d.ts +2 -2
- package/dist/pagedQuery.d.ts.map +1 -1
- package/dist/rpc.d.ts +2 -2
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +2 -2
- package/package.json +1 -1
- package/dist/methods/sdk.d.ts +0 -150
- package/dist/methods/sdk.d.ts.map +0 -1
- package/dist/methods/sdk.js +0 -173
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address } from '@aboutcircles/sdk-types';
|
|
2
|
-
import { Observable } from './events';
|
|
3
|
-
import type { CirclesEvent } from './events';
|
|
2
|
+
import { Observable } from './events/index.js';
|
|
3
|
+
import type { CirclesEvent } from './events/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Base RPC client for making JSON-RPC calls to Circles RPC endpoints
|
|
6
6
|
* Supports both HTTP requests and WebSocket subscriptions
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmC,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACxF,OAAO,EAAE,UAAU,EAA+B,MAAM,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmC,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACxF,OAAO,EAAE,UAAU,EAA+B,MAAM,mBAAmB,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD;;;GAGG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAa;IAG9B,OAAO,CAAC,SAAS,CAA0B;IAC3C,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,gBAAgB,CAA2B;IACnD,OAAO,CAAC,qBAAqB,CAEtB;IAGP,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAQ;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAU;gBAEzB,MAAM,EAAE,MAAM;IAI1B;;OAEG;IACG,IAAI,CAAC,OAAO,GAAG,OAAO,EAAE,EAAE,OAAO,GAAG,OAAO,EAC/C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,OAAO,CAAC;IA6CnB;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI/B;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,OAAO,CAAC,OAAO;IAiDf;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAqBzB;;;OAGG;YACW,SAAS;IAWvB;;;OAGG;IACH,OAAO,CAAC,WAAW;IAmBnB;;;;OAIG;IACG,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;CAsBtE"}
|
package/dist/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Observable, parseRpcSubscriptionMessage } from './events';
|
|
2
|
-
import { RpcError } from './errors';
|
|
1
|
+
import { Observable, parseRpcSubscriptionMessage } from './events/index.js';
|
|
2
|
+
import { RpcError } from './errors.js';
|
|
3
3
|
/**
|
|
4
4
|
* Base RPC client for making JSON-RPC calls to Circles RPC endpoints
|
|
5
5
|
* Supports both HTTP requests and WebSocket subscriptions
|
package/dist/events/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Event observation and subscription system
|
|
3
3
|
*/
|
|
4
|
-
export type { CirclesEvent, CirclesEventType, CirclesBaseEvent, CirclesEventOfType, RpcSubscriptionEvent, } from './types';
|
|
5
|
-
export { isCirclesEvent } from './types';
|
|
6
|
-
export { parseRpcEvent, parseRpcSubscriptionMessage } from './parser';
|
|
7
|
-
export { Observable } from './observable';
|
|
4
|
+
export type { CirclesEvent, CirclesEventType, CirclesBaseEvent, CirclesEventOfType, RpcSubscriptionEvent, } from './types.js';
|
|
5
|
+
export { isCirclesEvent } from './types.js';
|
|
6
|
+
export { parseRpcEvent, parseRpcSubscriptionMessage } from './parser.js';
|
|
7
|
+
export { Observable } from './observable.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/events/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Event observation and subscription system
|
|
3
3
|
*/
|
|
4
|
-
export { isCirclesEvent } from './types';
|
|
4
|
+
export { isCirclesEvent } from './types.js';
|
|
5
5
|
// Parser
|
|
6
|
-
export { parseRpcEvent, parseRpcSubscriptionMessage } from './parser';
|
|
6
|
+
export { parseRpcEvent, parseRpcSubscriptionMessage } from './parser.js';
|
|
7
7
|
// Observable
|
|
8
|
-
export { Observable } from './observable';
|
|
8
|
+
export { Observable } from './observable.js';
|
package/dist/events/parser.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/events/parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/events/parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAgFrE;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,oBAAoB,GAAG,YAAY,CAwB1E;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,YAAY,EAAE,CAE3F"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { CirclesRpc } from './rpc';
|
|
2
|
-
export { RpcClient } from './client';
|
|
3
|
-
export { PathfinderMethods, QueryMethods, TrustMethods, BalanceMethods, AvatarMethods, ProfileMethods, TokenMethods, InvitationMethods, TransactionMethods, GroupMethods, } from './methods';
|
|
4
|
-
export type { TransactionHistoryRow, SearchResultProfile, GroupTokenHolderRow, CursorColumn, FlexiblePagedResult, } from './types';
|
|
1
|
+
export { CirclesRpc } from './rpc.js';
|
|
2
|
+
export { RpcClient } from './client.js';
|
|
3
|
+
export { PathfinderMethods, QueryMethods, TrustMethods, BalanceMethods, AvatarMethods, ProfileMethods, TokenMethods, InvitationMethods, TransactionMethods, GroupMethods, } from './methods/index.js';
|
|
4
|
+
export type { TransactionHistoryRow, SearchResultProfile, GroupTokenHolderRow, CursorColumn, FlexiblePagedResult, } from './types.js';
|
|
5
5
|
export type { TrustRelationType, AggregatedTrustRelation } from '@aboutcircles/sdk-types';
|
|
6
|
-
export { RpcError } from './errors';
|
|
7
|
-
export type { RpcErrorSource } from './errors';
|
|
8
|
-
export { normalizeAddress, normalizeAddresses, parseStringsToBigInt } from './utils';
|
|
9
|
-
export { PagedQuery } from './pagedQuery';
|
|
10
|
-
export { Observable, parseRpcEvent, parseRpcSubscriptionMessage, isCirclesEvent, } from './events';
|
|
11
|
-
export type { CirclesEvent, CirclesEventType, CirclesBaseEvent, CirclesEventOfType, RpcSubscriptionEvent, } from './events';
|
|
6
|
+
export { RpcError } from './errors.js';
|
|
7
|
+
export type { RpcErrorSource } from './errors.js';
|
|
8
|
+
export { normalizeAddress, normalizeAddresses, parseStringsToBigInt } from './utils.js';
|
|
9
|
+
export { PagedQuery } from './pagedQuery.js';
|
|
10
|
+
export { Observable, parseRpcEvent, parseRpcSubscriptionMessage, isCirclesEvent, } from './events/index.js';
|
|
11
|
+
export type { CirclesEvent, CirclesEventType, CirclesBaseEvent, CirclesEventOfType, RpcSubscriptionEvent, } from './events/index.js';
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EACV,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAG1F,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGxF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EACL,UAAU,EACV,aAAa,EACb,2BAA2B,EAC3B,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function i(J){return J&&typeof J==="object"&&typeof J.$event==="string"&&typeof J.blockNumber==="number"&&typeof J.transactionIndex==="number"&&typeof J.logIndex==="number"}var n=(J)=>BigInt(J),
|
|
2
|
-
Context: ${JSON.stringify(this.context,null,2)}`;return J}}class X extends v{constructor(J,Z){super("RpcError",J,{...Z,source:Z?.source??"RPC_REQUEST"})}static connectionFailed(J,Z){return new X("Failed to connect to RPC endpoint",{code:"RPC_CONNECTION_FAILED",source:"RPC_CONNECTION",cause:Z,context:{url:J}})}static timeout(J,Z){return new X("RPC request timed out",{code:"RPC_TIMEOUT",source:"RPC_TIMEOUT",context:{method:J,timeout:Z}})}static invalidResponse(J,Z){return new X("Invalid RPC response",{code:"RPC_INVALID_RESPONSE",source:"RPC_RESPONSE",context:{method:J,response:Z}})}static fromJsonRpcError(J){return new X(J.message,{code:J.code,source:"RPC_RESPONSE",context:{data:J.data}})}static websocketError(J,Z){return new X(J,{code:"RPC_WEBSOCKET_ERROR",source:"RPC_WEBSOCKET",cause:Z})}}class A{rpcUrl;requestId=0;websocket=null;websocketConnected=!1;pendingResponses={};subscriptionListeners={};reconnectAttempt=0;initialBackoff=2000;maxBackoff=120000;constructor(J){this.rpcUrl=J}async call(J,Z){this.requestId++;let $={jsonrpc:"2.0",id:this.requestId,method:J,params:Z};try{let G=await fetch(this.rpcUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)});if(!G.ok)throw X.connectionFailed(this.rpcUrl,Error(`HTTP ${G.status}: ${G.statusText}`));let Y=await G.json();if(Y.error)throw X.fromJsonRpcError(Y.error);if(Y.result===void 0)throw X.invalidResponse(J,Y);return Y.result}catch(G){if(G instanceof X)throw G;throw X.connectionFailed(this.rpcUrl,G)}}setRpcUrl(J){this.rpcUrl=J}getRpcUrl(){return this.rpcUrl}connect(){return new Promise((J)=>{let Z=this.rpcUrl.replace("http","ws");if(Z.endsWith("/"))Z+="ws";else Z+="/ws";this.websocket=new WebSocket(Z),this.websocket.onopen=()=>{console.log("WebSocket connected"),this.websocketConnected=!0,this.reconnectAttempt=0,J()},this.websocket.onmessage=($)=>{let G=JSON.parse($.data),{id:Y,method:W,params:K}=G;if(Y!==void 0&&this.pendingResponses[Y])this.pendingResponses[Y].resolve(G),delete this.pendingResponses[Y];if(W==="eth_subscription"&&K){let{subscription:M,result:N}=K;if(this.subscriptionListeners[M])this.subscriptionListeners[M].forEach((q)=>q(N))}},this.websocket.onclose=()=>{console.warn("WebSocket closed"),this.websocketConnected=!1},this.websocket.onerror=($)=>{console.error("WebSocket error:",$),this.websocketConnected=!1,this.scheduleReconnect()}})}scheduleReconnect(){let J=Math.min(this.initialBackoff*Math.pow(2,this.reconnectAttempt),this.maxBackoff),Z=J*(Math.random()*0.5),$=J+Z;console.log(`Reconnecting in ${Math.round($)}ms (attempt #${this.reconnectAttempt+1})`),this.reconnectAttempt++,setTimeout(()=>{this.reconnect()},$)}async reconnect(){if(this.websocketConnected)return;try{await this.connect(),console.log("Reconnection successful")}catch(J){console.error("Reconnection attempt failed:",J),this.scheduleReconnect()}}sendMessage(J,Z,$=5000){if(!this.websocket||this.websocket.readyState!==WebSocket.OPEN)return Promise.reject(X.connectionFailed(this.rpcUrl));let G=this.requestId++,Y={jsonrpc:"2.0",method:J,params:Z,id:G};return new Promise((W,K)=>{this.pendingResponses[G]={resolve:W,reject:K},this.websocket.send(JSON.stringify(Y)),setTimeout(()=>{if(this.pendingResponses[G])this.pendingResponses[G].reject(X.timeout(J,$)),delete this.pendingResponses[G]},$)})}async subscribe(J){let Z=J?.toLowerCase();if(!this.websocketConnected)await this.connect();let $=O.create(),G=JSON.stringify(Z?{address:Z}:{}),W=(await this.sendMessage("eth_subscribe",["circles",G])).result;if(!this.subscriptionListeners[W])this.subscriptionListeners[W]=[];return this.subscriptionListeners[W].push((K)=>{x(K).forEach((M)=>$.emit(M))}),$.property}}var b=BigInt(4294967295),o=BigInt(32);function OJ(J,Z=!1){if(Z)return{h:Number(J&b),l:Number(J>>o&b)};return{h:Number(J>>o&b)|0,l:Number(J&b)|0}}function t(J,Z=!1){let $=J.length,G=new Uint32Array($),Y=new Uint32Array($);for(let W=0;W<$;W++){let{h:K,l:M}=OJ(J[W],Z);[G[W],Y[W]]=[K,M]}return[G,Y]}var a=(J,Z,$)=>J<<$|Z>>>32-$,s=(J,Z,$)=>Z<<$|J>>>32-$,r=(J,Z,$)=>Z<<$-32|J>>>64-$,e=(J,Z,$)=>J<<$-32|Z>>>64-$;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function IJ(J){return J instanceof Uint8Array||ArrayBuffer.isView(J)&&J.constructor.name==="Uint8Array"}function y(J){if(!Number.isSafeInteger(J)||J<0)throw Error("positive integer expected, got "+J)}function L(J,...Z){if(!IJ(J))throw Error("Uint8Array expected");if(Z.length>0&&!Z.includes(J.length))throw Error("Uint8Array expected of length "+Z+", got length="+J.length)}function h(J,Z=!0){if(J.destroyed)throw Error("Hash instance has been destroyed");if(Z&&J.finished)throw Error("Hash#digest() has already been called")}function JJ(J,Z){L(J);let $=Z.outputLen;if(J.length<$)throw Error("digestInto() expects output buffer of length at least "+$)}function ZJ(J){return new Uint32Array(J.buffer,J.byteOffset,Math.floor(J.byteLength/4))}function m(...J){for(let Z=0;Z<J.length;Z++)J[Z].fill(0)}var LJ=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function zJ(J){return J<<24&4278190080|J<<8&16711680|J>>>8&65280|J>>>24&255}function _J(J){for(let Z=0;Z<J.length;Z++)J[Z]=zJ(J[Z]);return J}var p=LJ?(J)=>J:_J;function BJ(J){if(typeof J!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(J))}function u(J){if(typeof J==="string")J=BJ(J);return L(J),J}class c{}function $J(J){let Z=(G)=>J().update(u(G)).digest(),$=J();return Z.outputLen=$.outputLen,Z.blockLen=$.blockLen,Z.create=()=>J(),Z}var RJ=BigInt(0),z=BigInt(1),TJ=BigInt(2),EJ=BigInt(7),SJ=BigInt(256),HJ=BigInt(113),WJ=[],KJ=[],QJ=[];for(let J=0,Z=z,$=1,G=0;J<24;J++){[$,G]=[G,(2*$+3*G)%5],WJ.push(2*(5*G+$)),KJ.push((J+1)*(J+2)/2%64);let Y=RJ;for(let W=0;W<7;W++)if(Z=(Z<<z^(Z>>EJ)*HJ)%SJ,Z&TJ)Y^=z<<(z<<BigInt(W))-z;QJ.push(Y)}var MJ=t(QJ,!0),wJ=MJ[0],kJ=MJ[1],GJ=(J,Z,$)=>$>32?r(J,Z,$):a(J,Z,$),YJ=(J,Z,$)=>$>32?e(J,Z,$):s(J,Z,$);function CJ(J,Z=24){let $=new Uint32Array(10);for(let G=24-Z;G<24;G++){for(let K=0;K<10;K++)$[K]=J[K]^J[K+10]^J[K+20]^J[K+30]^J[K+40];for(let K=0;K<10;K+=2){let M=(K+8)%10,N=(K+2)%10,q=$[N],U=$[N+1],d=GJ(q,U,1)^$[M],g=YJ(q,U,1)^$[M+1];for(let P=0;P<50;P+=10)J[K+P]^=d,J[K+P+1]^=g}let Y=J[2],W=J[3];for(let K=0;K<24;K++){let M=KJ[K],N=GJ(Y,W,M),q=YJ(Y,W,M),U=WJ[K];Y=J[U],W=J[U+1],J[U]=N,J[U+1]=q}for(let K=0;K<50;K+=10){for(let M=0;M<10;M++)$[M]=J[K+M];for(let M=0;M<10;M++)J[K+M]^=~$[(M+2)%10]&$[(M+4)%10]}J[0]^=wJ[G],J[1]^=kJ[G]}m($)}class l extends c{constructor(J,Z,$,G=!1,Y=24){super();if(this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=J,this.suffix=Z,this.outputLen=$,this.enableXOF=G,this.rounds=Y,y($),!(0<J&&J<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=ZJ(this.state)}clone(){return this._cloneInto()}keccak(){p(this.state32),CJ(this.state32,this.rounds),p(this.state32),this.posOut=0,this.pos=0}update(J){h(this),J=u(J),L(J);let{blockLen:Z,state:$}=this,G=J.length;for(let Y=0;Y<G;){let W=Math.min(Z-this.pos,G-Y);for(let K=0;K<W;K++)$[this.pos++]^=J[Y++];if(this.pos===Z)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:J,suffix:Z,pos:$,blockLen:G}=this;if(J[$]^=Z,(Z&128)!==0&&$===G-1)this.keccak();J[G-1]^=128,this.keccak()}writeInto(J){h(this,!1),L(J),this.finish();let Z=this.state,{blockLen:$}=this;for(let G=0,Y=J.length;G<Y;){if(this.posOut>=$)this.keccak();let W=Math.min($-this.posOut,Y-G);J.set(Z.subarray(this.posOut,this.posOut+W),G),this.posOut+=W,G+=W}return J}xofInto(J){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(J)}xof(J){return y(J),this.xofInto(new Uint8Array(J))}digestInto(J){if(JJ(J,this),this.finished)throw Error("digest() was already called");return this.writeInto(J),this.destroy(),J}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,m(this.state)}_cloneInto(J){let{blockLen:Z,suffix:$,outputLen:G,rounds:Y,enableXOF:W}=this;return J||(J=new l(Z,$,G,W,Y)),J.state32.set(this.state32),J.pos=this.pos,J.posOut=this.posOut,J.finished=this.finished,J.rounds=Y,J.suffix=$,J.outputLen=G,J.enableXOF=W,J.destroyed=this.destroyed,J}}var gJ=(J,Z,$)=>$J(()=>new l(Z,J,$));var VJ=(()=>gJ(1,136,32))();var qJ=[];for(let J=0;J<256;J++)qJ[J]=J.toString(16).padStart(2,"0");function NJ(J){let Z="0x";for(let $=0;$<J.length;$++)Z+=qJ[J[$]];return Z}function UJ(J){let Z=J.toLowerCase().replace("0x",""),$=NJ(VJ(new TextEncoder().encode(Z))).slice(2),G="0x";for(let Y=0;Y<Z.length;Y++)G+=parseInt($[Y],16)>=8?Z[Y].toUpperCase():Z[Y];return G}function Q(J){return J.toLowerCase()}function xJ(J){return J.map((Z)=>Q(Z))}function AJ(J){return UJ(J)}function bJ(J){if(typeof J!=="string")return!1;let Z=J.replace("0x","");return Z.length===40&&/^[0-9a-fA-F]{40}$/.test(Z)}function V(J){if(J===null||J===void 0)return J;if(bJ(J))return AJ(J);if(Array.isArray(J))return J.map((Z)=>V(Z));if(typeof J==="object"&&J!==null){let Z={};for(let $ in J)if(Object.prototype.hasOwnProperty.call(J,$))Z[$]=V(J[$]);return Z}return J}function XJ(J){return{Source:Q(J.from),Sink:Q(J.to),TargetFlow:J.targetFlow.toString(),WithWrap:J.useWrappedBalances,FromTokens:J.fromTokens?.map(Q),ToTokens:J.toTokens?.map(Q),ExcludedFromTokens:J.excludeFromTokens?.map(Q),ExcludedToTokens:J.excludeToTokens?.map(Q),SimulatedBalances:J.simulatedBalances?.map((Z)=>({Holder:Q(Z.holder),Token:Q(Z.token),Amount:Z.amount.toString(),IsWrapped:Z.isWrapped,IsStatic:Z.isStatic})),SimulatedTrusts:J.simulatedTrusts?.map((Z)=>({Truster:Q(Z.truster),Trustee:Q(Z.trustee)})),MaxTransfers:J.maxTransfers}}function F(J){let Z={};for(let $ in J){let G=J[$];if(G===null||G===void 0)Z[$]=G;else if(typeof G==="string"&&/^\d+$/.test(G))Z[$]=BigInt(G);else if(typeof G==="object"&&!Array.isArray(G))Z[$]=F(G);else if(Array.isArray(G))Z[$]=G.map((Y)=>typeof Y==="object"&&Y!==null?F(Y):Y);else Z[$]=G}return Z}var VZ=BigInt(96)*BigInt(1000000000000000000),jJ=BigInt("9999999999999999999999999999999999999");class _{client;constructor(J){this.client=J}async findPath(J){let Z=XJ(J),$=await this.client.call("circlesV2_findPath",[Z]),G=F($);return V(G)}async findMaxFlow(J){let Z=await this.findPath({...J,targetFlow:jJ});return BigInt(Z.maxFlow)}}class B{client;constructor(J){this.client=J}async query(J){let Z=await this.client.call("circles_query",[J]);return V(Z)}async tables(){return this.client.call("circles_tables",[])}async events(J,Z,$=null,G=null,Y=!1){let W=await this.client.call("circles_events",[J,Z,$,G,Y]);return V(W)}}var fJ=[{name:"blockNumber",sortOrder:"DESC"},{name:"transactionIndex",sortOrder:"DESC"},{name:"logIndex",sortOrder:"DESC"}];class j{params;client;rowTransformer;cursorColumns;orderColumns;get currentPage(){return this._currentPage}_currentPage;constructor(J,Z,$){this.client=J,this.params=Z,this.rowTransformer=$||Z.rowTransformer,this.orderColumns=Z.orderColumns,this.cursorColumns=Z.cursorColumns||this.buildEventCursorColumns()}buildEventCursorColumns(){let J=fJ.map((Z)=>({...Z,sortOrder:this.params.sortOrder}));if(this.params.table==="TransferBatch")J.push({name:"batchIndex",sortOrder:this.params.sortOrder});return J}transformCursorValue(J,Z){if(Z)return Z(J);if(typeof J==="bigint")return J.toString();return J}createEqualityPredicate(J,Z){return{Type:"FilterPredicate",FilterType:"Equals",Column:J.name,Value:this.transformCursorValue(Z,J.toValue)}}createComparisonPredicate(J,Z){return{Type:"FilterPredicate",FilterType:J.sortOrder==="ASC"?"GreaterThan":"LessThan",Column:J.name,Value:this.transformCursorValue(Z,J.toValue)}}buildCursorFilter(J){if(!J)return[];let Z=[];for(let $=0;$<this.cursorColumns.length;$++){let G=this.cursorColumns[$],Y=J[G.name];if(Y===void 0)continue;if($===0)Z.push(this.createComparisonPredicate(G,Y));else{let W=[];for(let K=0;K<$;K++){let M=this.cursorColumns[K],N=J[M.name];if(N!==void 0)W.push(this.createEqualityPredicate(M,N))}W.push(this.createComparisonPredicate(G,Y)),Z.push({Type:"Conjunction",ConjunctionType:"And",Predicates:W})}}if(Z.length===0)return[];return[{Type:"Conjunction",ConjunctionType:"Or",Predicates:Z}]}buildOrderBy(){if(this.orderColumns&&this.orderColumns.length>0)return this.orderColumns;return this.cursorColumns.map((J)=>({Column:J.name,SortOrder:J.sortOrder}))}combineFilters(J,Z){if(!J?.length&&!Z?.length)return[];if(!J?.length)return Z||[];if(!Z?.length)return J;return[{Type:"Conjunction",ConjunctionType:"And",Predicates:[...J,...Z]}]}rowsToObjects(J){let{columns:Z,rows:$}=J;return $.map((G)=>{let Y={};return Z.forEach((W,K)=>{Y[W]=G[K]}),this.rowTransformer?this.rowTransformer(Y):Y})}rowToCursor(J){let Z={};for(let $ of this.cursorColumns)Z[$.name]=J[$.name];return Z}getCursors(J){if(J.length===0)return{};return{first:this.rowToCursor(J[0]),last:this.rowToCursor(J[J.length-1])}}async queryNextPage(){let J=this.buildCursorFilter(this._currentPage?.lastCursor),Z=this.combineFilters(this.params.filter,J),$={Namespace:this.params.namespace,Table:this.params.table,Columns:this.params.columns,Filter:Z,Order:this.buildOrderBy(),Limit:this.params.limit},G=await this.client.call("circles_query",[$]),Y=this.rowsToObjects(G),W=this.getCursors(Y);return this._currentPage={limit:this.params.limit,size:Y.length,firstCursor:W.first,lastCursor:W.last,sortOrder:this.params.sortOrder,hasMore:Y.length===this.params.limit,results:Y},Y.length>0}reset(){this._currentPage=void 0}}class R{client;constructor(J){this.client=J}transformQueryResponse(J){let{columns:Z,rows:$}=J;return $.map((G)=>{let Y={};return Z.forEach((W,K)=>{Y[W]=G[K]}),Y})}async getCommonTrust(J,Z){let $=await this.client.call("circles_getCommonTrust",[Q(J),Q(Z)]);return V($)}getTrustRelations(J,Z=100,$="DESC"){let G=Q(J),Y=[{Type:"Conjunction",ConjunctionType:"And",Predicates:[{Type:"FilterPredicate",FilterType:"Equals",Column:"version",Value:2},{Type:"Conjunction",ConjunctionType:"Or",Predicates:[{Type:"FilterPredicate",FilterType:"Equals",Column:"trustee",Value:G},{Type:"FilterPredicate",FilterType:"Equals",Column:"truster",Value:G}]}]}];return new j(this.client,{namespace:"V_Crc",table:"TrustRelations",sortOrder:$,columns:["blockNumber","timestamp","transactionIndex","logIndex","transactionHash","version","trustee","truster","expiryTime"],filter:Y,limit:Z},(W)=>V(W))}async getAggregatedTrustRelations(J){let Z=Q(J),$=this.getTrustRelations(Z,1000),G=[];while(await $.queryNextPage())if(G.push(...$.currentPage.results),!$.currentPage.hasMore)break;let Y={};G.forEach((K)=>{let M=Q(K.truster),N=Q(K.trustee),q=M!==Z?K.truster:K.trustee;if(!Y[q])Y[q]=[];Y[q].push(K)});let W=Object.entries(Y).filter(([K])=>Q(K)!==Z).map(([K,M])=>{let N=Math.max(...M.map((U)=>U.timestamp)),q;if(M.length===2)q="mutuallyTrusts";else if(Q(M[0]?.trustee)===Z)q="trustedBy";else if(Q(M[0]?.truster)===Z)q="trusts";else throw Error("Unexpected trust list row. Couldn't determine trust relation.");return{subjectAvatar:Z,relation:q,objectAvatar:K,timestamp:N}});return V(W)}async getTrustedBy(J){let Z=Q(J),G=(await this.getAggregatedTrustRelations(Z)).filter((Y)=>Y.relation==="trustedBy");return V(G)}async getTrusts(J){let Z=Q(J),G=(await this.getAggregatedTrustRelations(Z)).filter((Y)=>Y.relation==="trusts");return V(G)}async getMutualTrusts(J){let Z=Q(J),G=(await this.getAggregatedTrustRelations(Z)).filter((Y)=>Y.relation==="mutuallyTrusts");return V(G)}}class D{static ONE_64=1n<<64n;static GAMMA_64=18443079296116538654n;static BETA_64=18450409579521241655n;static SECONDS_PER_DAY=86400n;static INFLATION_DAY_ZERO_UNIX=1602720000n;static ATTO_FACTOR=1000000000000000000n;static FACTOR_1E12=1000000000000n;static V1_ACCURACY=100000000n;static V1_INFLATION_PCT_NUM=107n;static V1_INFLATION_PCT_DEN=100n;static PERIOD_SEC=31556952n;static mul64(J,Z){return J*Z>>64n}static mulU(J,Z){return J*Z>>64n}static pow64(J,Z){let $=J,G=Z,Y=this.ONE_64;while(G>0n){if((G&1n)===1n)Y=this.mul64(Y,$);$=this.mul64($,$),G>>=1n}return Y}static ONE_36=1000000000000000000000000000000000000000n;static GAMMA_36=999801332008598957430613406568191166n;static BETA_36=1000198707468214629156271489013303962n;static mul36(J,Z){return J*Z/this.ONE_36}static pow36(J,Z){let $=this.ONE_36,G=J,Y=Z;while(Y>0n){if((Y&1n)===1n)$=this.mul36($,G);G=this.mul36(G,G),Y>>=1n}return $}static attoCirclesToCircles(J){if(J===0n)return 0;let Z=J/this.ATTO_FACTOR,$=J%this.ATTO_FACTOR,G=BigInt(Number.MAX_SAFE_INTEGER);if(Z>G||Z<-G)throw RangeError("Atto value’s integer component exceeds JS double precision.");return Number(Z)+Number($)/Number(this.ATTO_FACTOR)}static circlesToAttoCircles(J){return BigInt(Math.trunc(J*Number(this.ATTO_FACTOR)))}static inflationaryToDemurrage(J,Z){return this.mulU(this.pow64(this.GAMMA_64,Z),J)}static demurrageToInflationary(J,Z){return this.mulU(this.pow64(this.BETA_64,Z),J)}static dayFromTimestamp(J){return(J-this.INFLATION_DAY_ZERO_UNIX)/this.SECONDS_PER_DAY}static attoCirclesToAttoStaticCircles(J,Z=BigInt(Math.floor(Date.now()/1000))){return this.demurrageToInflationary(J,this.dayFromTimestamp(Z))}static attoStaticCirclesToAttoCircles(J,Z=BigInt(Math.floor(Date.now()/1000))){return this.inflationaryToDemurrage(J,this.dayFromTimestamp(Z))}static inflationaryToDemurrageExact(J,Z){let $=this.pow36(this.GAMMA_36,Z);return J*$/this.ONE_36}static demurrageToInflationaryExact(J,Z){let $=this.pow36(this.BETA_36,Z);return J*$/this.ONE_36}static attoCirclesToAttoStaticCirclesExact(J,Z=BigInt(Math.floor(Date.now()/1000))){let $=this.dayFromTimestamp(Z);return this.demurrageToInflationaryExact(J,$)}static attoStaticCirclesToAttoCirclesExact(J,Z=BigInt(Math.floor(Date.now()/1000))){let $=this.dayFromTimestamp(Z);return this.inflationaryToDemurrageExact(J,$)}static truncateToInt64(J){let Z=J/this.FACTOR_1E12,$=9223372036854775807n;return Z>$?$:Z}static blowUpToBigInt(J){return J*this.FACTOR_1E12}static truncateToSixDecimals(J){return this.blowUpToBigInt(this.truncateToInt64(J))}static v1InflateFactor(J){if(J===0n)return this.V1_ACCURACY;return this.V1_ACCURACY*this.V1_INFLATION_PCT_NUM**J/this.V1_INFLATION_PCT_DEN**J}static attoCrcToAttoCircles(J,Z){let $=Z-this.INFLATION_DAY_ZERO_UNIX,G=$/this.PERIOD_SEC,Y=$%this.PERIOD_SEC,W=this.v1InflateFactor(G),K=this.v1InflateFactor(G+1n);return this.v1ToDemurrage(J,W,K,Y,this.PERIOD_SEC)}static attoCirclesToAttoCrc(J,Z){let $=Z-this.INFLATION_DAY_ZERO_UNIX,G=$/this.PERIOD_SEC,Y=$%this.PERIOD_SEC,W=this.v1InflateFactor(G),K=this.v1InflateFactor(G+1n),M=W*(this.PERIOD_SEC-Y)+K*Y;return J*3n*this.V1_ACCURACY*this.PERIOD_SEC/M}static v1ToDemurrage(J,Z,$,G,Y){let W=Z*(Y-G)+$*G;return J*3n*this.V1_ACCURACY*Y/W}}class T{client;constructor(J){this.client=J}async getTotalBalance(J,Z=!0){let $=await this.client.call("circlesV2_getTotalBalance",[Q(J),Z]);return D.circlesToAttoCircles($)}async getTokenBalances(J){let $=(await this.client.call("circles_getTokenBalances",[Q(J)])).map((G)=>F(G));return V($)}}class E{client;constructor(J){this.client=J}async getAvatarInfo(J){let Z=await this.getAvatarInfoBatch([J]);return Z.length>0?Z[0]:void 0}async getAvatarInfoBatch(J){if(J.length===0)return[];let Z=J.map((G)=>Q(G)),$=await this.client.call("circles_getAvatarInfoBatch",[Z]);return V($)}async getNetworkSnapshot(){let J=await this.client.call("circles_getNetworkSnapshot",[]);return V(J)}}class S{client;constructor(J){this.client=J}async getProfileByCid(J){return this.client.call("circles_getProfileByCid",[J])}async getProfileByCidBatch(J){return this.client.call("circles_getProfileByCidBatch",[J])}async getProfileByAddress(J){return this.client.call("circles_getProfileByAddress",[Q(J)])}async getProfileByAddressBatch(J){return this.client.call("circles_getProfileByAddressBatch",[J.map((Z)=>Z===null?null:Q(Z))])}async searchProfiles(J,Z=10,$=0,G){return this.client.call("circles_searchProfiles",[J.toLowerCase(),Z,$,G])}async searchByAddressOrName(J,Z=10,$=0,G){let Y=[],W=/^0x[a-fA-F0-9]{40}$/.test(J);if(W)try{let K=await this.getProfileByAddress(J);if(K){let M={...K,address:J};if(!G||!M.avatarType||G.includes(M.avatarType))Y.push(M)}}catch(K){console.warn("Failed to get profile by address:",K)}try{let K=await this.searchProfiles(J,Z,$,G);if(W&&Y.length>0){let M=J.toLowerCase(),N=K.filter((q)=>q.address?.toLowerCase()!==M);Y.push(...N)}else Y.push(...K)}catch(K){console.warn("Failed to search profiles by text:",K)}return Y.slice(0,Z)}}class H{client;constructor(J){this.client=J}async getTokenInfo(J){let Z=await this.getTokenInfoBatch([J]);return Z.length>0?Z[0]:void 0}async getTokenInfoBatch(J){if(J.length===0)return[];let Z=J.map((Y)=>Q(Y)),G=(await this.client.call("circles_getTokenInfoBatch",[Z])).map((Y)=>F(Y));return V(G)}getTokenHolders(J,Z=100,$="DESC"){let G=Q(J);return new j(this.client,{namespace:"V_CrcV2",table:"BalancesByAccountAndToken",columns:["account","tokenAddress","demurragedTotalBalance"],filter:[{Type:"FilterPredicate",FilterType:"Equals",Column:"tokenAddress",Value:G}],cursorColumns:[{name:"demurragedTotalBalance",sortOrder:$},{name:"account",sortOrder:"ASC"}],orderColumns:[{Column:"demurragedTotalBalance",SortOrder:$},{Column:"account",SortOrder:"ASC"}],limit:Z,sortOrder:$},(Y)=>({account:Y.account,tokenAddress:Y.tokenAddress,demurragedTotalBalance:Y.demurragedTotalBalance}))}}class w{client;constructor(J){this.client=J}transformQueryResponse(J){let{columns:Z,rows:$}=J;return $.map((G)=>{let Y={};return Z.forEach((W,K)=>{Y[W]=G[K]}),Y})}async getInvitedBy(J){let Z=Q(J),$=await this.client.call("circles_query",[{Namespace:"CrcV2",Table:"RegisterHuman",Columns:["inviter"],Filter:[{Type:"FilterPredicate",FilterType:"Equals",Column:"avatar",Value:Z}],Order:[{Column:"blockNumber",SortOrder:"DESC"}],Limit:1}]);if($.length>0)return V($[0].inviter);return}async getInvitations(J){let Z=Q(J),$=96,G=await this.client.call("circles_getAvatarInfoBatch",[[Z]]);if((G.length>0?G[0]:void 0)?.version===2)return[];let W=await this.client.call("circles_query",[{Namespace:"V_Crc",Table:"TrustRelations",Columns:["truster","trustee"],Filter:[{Type:"Conjunction",ConjunctionType:"And",Predicates:[{Type:"FilterPredicate",FilterType:"Equals",Column:"version",Value:2},{Type:"FilterPredicate",FilterType:"Equals",Column:"trustee",Value:Z}]}],Order:[]}]),M=this.transformQueryResponse(W).map((U)=>U.truster);if(M.length===0)return[];let N=await this.client.call("circles_getAvatarInfoBatch",[M]),q=[];for(let U of N){if(!U?.isHuman)continue;let g=(await this.client.call("circles_getTokenBalances",[U.avatar])).find((P)=>Q(P.tokenAddress)===Q(U.avatar));if(g&&g.circles>=96)q.push(U)}return V(q)}async getInvitationsFrom(J,Z=!1){let $=Q(J);if(Z){let G=await this.client.call("circles_query",[{Namespace:"CrcV2",Table:"RegisterHuman",Columns:["avatar"],Filter:[{Type:"FilterPredicate",FilterType:"Equals",Column:"inviter",Value:$}],Order:[{Column:"blockNumber",SortOrder:"DESC"}]}]),W=this.transformQueryResponse(G).map((K)=>K.avatar);return V(W)}else{let G=await this.client.call("circles_query",[{Namespace:"V_Crc",Table:"TrustRelations",Columns:["trustee","truster"],Filter:[{Type:"Conjunction",ConjunctionType:"And",Predicates:[{Type:"FilterPredicate",FilterType:"Equals",Column:"version",Value:2},{Type:"FilterPredicate",FilterType:"Equals",Column:"truster",Value:$}]}],Order:[]}]),W=this.transformQueryResponse(G).map((q)=>q.trustee);if(W.length===0)return[];let K=await this.client.call("circles_getAvatarInfoBatch",[W]),M=new Set(K.filter((q)=>q!==null).map((q)=>Q(q.avatar))),N=W.filter((q)=>!M.has(Q(q)));return V(N)}}}function vJ(J,Z){let $=BigInt(J),G=D.attoCirclesToCircles($),Y=D.attoCirclesToAttoCrc($,BigInt(Z)),W=D.attoCirclesToCircles(Y),K=D.attoCirclesToAttoStaticCircles($,BigInt(Z)),M=D.attoCirclesToCircles(K);return{attoCircles:$,circles:G,staticAttoCircles:K,staticCircles:M,attoCrc:Y,crc:W}}class k{client;constructor(J){this.client=J}getTransactionHistory(J,Z=50,$="DESC"){let G=Q(J),Y=[{Type:"Conjunction",ConjunctionType:"And",Predicates:[{Type:"FilterPredicate",FilterType:"Equals",Column:"version",Value:2},{Type:"Conjunction",ConjunctionType:"Or",Predicates:[{Type:"FilterPredicate",FilterType:"Equals",Column:"from",Value:G},{Type:"FilterPredicate",FilterType:"Equals",Column:"to",Value:G}]}]}];return new j(this.client,{namespace:"V_Crc",table:"TransferSummary",sortOrder:$,columns:[],filter:Y,limit:Z},(W)=>{let K=vJ(W.value,W.timestamp),M={...W,...K};return V(M)})}}class C{client;constructor(J){this.client=J}async findGroups(J=50,Z){let $=this.getGroups(J,Z,"DESC"),G=[];while(await $.queryNextPage()){if(G.push(...$.currentPage.results),G.length>=J)break;if(!$.currentPage.hasMore)break}return G.slice(0,J)}getGroupMemberships(J,Z=50,$="DESC"){let G=Q(J);return new j(this.client,{namespace:"V_CrcV2",table:"GroupMemberships",sortOrder:$,columns:["blockNumber","timestamp","transactionIndex","logIndex","transactionHash","group","member","expiryTime"],filter:[{Type:"FilterPredicate",FilterType:"Equals",Column:"member",Value:G}],limit:Z},(Y)=>V(Y))}getGroupHolders(J,Z=100){let $=Q(J);return new j(this.client,{namespace:"V_CrcV2",table:"GroupTokenHoldersBalance",sortOrder:"DESC",columns:["group","holder","totalBalance","demurragedTotalBalance","fractionOwnership"],cursorColumns:[{name:"holder",sortOrder:"ASC"}],orderColumns:[{Column:"totalBalance",SortOrder:"DESC"},{Column:"holder",SortOrder:"ASC"}],filter:[{Type:"FilterPredicate",FilterType:"Equals",Column:"group",Value:$}],limit:Z,rowTransformer:(G)=>{let Y={...G,totalBalance:BigInt(G.totalBalance),demurragedTotalBalance:BigInt(G.demurragedTotalBalance)};return V(Y)}})}getGroupMembers(J,Z=100,$="DESC"){let G=Q(J);return new j(this.client,{namespace:"V_CrcV2",table:"GroupMemberships",sortOrder:$,columns:["blockNumber","timestamp","transactionIndex","logIndex","transactionHash","group","member","expiryTime"],filter:[{Type:"FilterPredicate",FilterType:"Equals",Column:"group",Value:G}],limit:Z},(Y)=>V(Y))}getGroups(J=50,Z,$="DESC"){let G=[];if(Z){if(Z.nameStartsWith)G.push({Type:"FilterPredicate",FilterType:"Like",Column:"name",Value:Z.nameStartsWith+"%"});if(Z.symbolStartsWith)G.push({Type:"FilterPredicate",FilterType:"Like",Column:"symbol",Value:Z.symbolStartsWith+"%"});if(Z.groupAddressIn&&Z.groupAddressIn.length>0){let W=Z.groupAddressIn.map((K)=>({Type:"FilterPredicate",FilterType:"Equals",Column:"group",Value:Q(K)}));if(W.length===1)G.push(W[0]);else G.push({Type:"Conjunction",ConjunctionType:"Or",Predicates:W})}if(Z.groupTypeIn&&Z.groupTypeIn.length>0){let W=Z.groupTypeIn.map((K)=>({Type:"FilterPredicate",FilterType:"Equals",Column:"type",Value:K}));if(W.length===1)G.push(W[0]);else G.push({Type:"Conjunction",ConjunctionType:"Or",Predicates:W})}if(Z.ownerIn&&Z.ownerIn.length>0){let W=Z.ownerIn.map((K)=>({Type:"FilterPredicate",FilterType:"Equals",Column:"owner",Value:Q(K)}));if(W.length===1)G.push(W[0]);else G.push({Type:"Conjunction",ConjunctionType:"Or",Predicates:W})}if(Z.mintHandlerEquals)G.push({Type:"FilterPredicate",FilterType:"Equals",Column:"mintHandler",Value:Q(Z.mintHandlerEquals)});if(Z.treasuryEquals)G.push({Type:"FilterPredicate",FilterType:"Equals",Column:"treasury",Value:Q(Z.treasuryEquals)})}let Y=G.length>1?[{Type:"Conjunction",ConjunctionType:"And",Predicates:G}]:G;return new j(this.client,{namespace:"V_CrcV2",table:"Groups",sortOrder:$,columns:["blockNumber","timestamp","transactionIndex","logIndex","transactionHash","group","type","owner","mintPolicy","mintHandler","treasury","service","feeCollection","memberCount","name","symbol","cidV0Digest","erc20WrapperDemurraged","erc20WrapperStatic"],filter:Y,limit:J},(W)=>V(W))}}class FJ{client;_pathfinder;_query;_trust;_balance;_avatar;_profile;_token;_invitation;_transaction;_group;constructor(J="https://rpc.circlesubi.network/"){this.client=new A(J)}get pathfinder(){if(!this._pathfinder)this._pathfinder=new _(this.client);return this._pathfinder}get query(){if(!this._query)this._query=new B(this.client);return this._query}get trust(){if(!this._trust)this._trust=new R(this.client);return this._trust}get balance(){if(!this._balance)this._balance=new T(this.client);return this._balance}get avatar(){if(!this._avatar)this._avatar=new E(this.client);return this._avatar}get profile(){if(!this._profile)this._profile=new S(this.client);return this._profile}get token(){if(!this._token)this._token=new H(this.client);return this._token}get invitation(){if(!this._invitation)this._invitation=new w(this.client);return this._invitation}get transaction(){if(!this._transaction)this._transaction=new k(this.client);return this._transaction}get group(){if(!this._group)this._group=new C(this.client);return this._group}setRpcUrl(J){this.client.setRpcUrl(J)}getRpcUrl(){return this.client.getRpcUrl()}}export{F as parseStringsToBigInt,x as parseRpcSubscriptionMessage,f as parseRpcEvent,xJ as normalizeAddresses,Q as normalizeAddress,i as isCirclesEvent,R as TrustMethods,k as TransactionMethods,H as TokenMethods,X as RpcError,A as RpcClient,B as QueryMethods,S as ProfileMethods,_ as PathfinderMethods,j as PagedQuery,O as Observable,w as InvitationMethods,C as GroupMethods,FJ as CirclesRpc,T as BalanceMethods,E as AvatarMethods};
|
|
1
|
+
function i(J){return J&&typeof J==="object"&&typeof J.$event==="string"&&typeof J.blockNumber==="number"&&typeof J.transactionIndex==="number"&&typeof J.logIndex==="number"}var n=(J)=>BigInt(J),L=(J)=>parseInt(J,16),PJ=(J)=>{if(J.startsWith("0x"))J=J.slice(2);if(J.length%2!==0)throw Error("Invalid hex string");let Z=new Uint8Array(J.length/2);for(let $=0;$<J.length;$+=2)Z[$/2]=parseInt(J.substr($,2),16);return Z};function jJ(J,Z){if(typeof Z==="string"&&Z.startsWith("0x")){let $=Z.slice(2);if($.length===40)return Z;if($.length===64){if(J.toLowerCase().includes("digest")||J.toLowerCase().includes("data")||J.toLowerCase().includes("bytes"))return PJ(Z);try{return n(Z)}catch{return Z}}try{let G=L(Z);if(G<Number.MAX_SAFE_INTEGER)return G;return n(Z)}catch{return Z}}if(Z==="true")return!0;if(Z==="false")return!1;return Z}function f(J){let{event:Z,values:$}=J,G={$event:Z,blockNumber:$.blockNumber?L($.blockNumber):0,timestamp:$.timestamp?L($.timestamp):void 0,transactionIndex:$.transactionIndex?L($.transactionIndex):0,logIndex:$.logIndex?L($.logIndex):0,transactionHash:$.transactionHash};for(let[Y,W]of Object.entries($)){if(["blockNumber","timestamp","transactionIndex","logIndex","transactionHash"].includes(Y))continue;G[Y]=jJ(Y,W)}return G}function A(J){return J.map(f)}class O{_subscribers=[];subscribe(J){return this._subscribers.push(J),()=>{let Z=this._subscribers.indexOf(J);if(Z>-1)this._subscribers.splice(Z,1)}}constructor(){this._subscribers=[]}emit(J){this._subscribers.forEach((Z)=>Z(J))}static create(){let J=new O;return{property:J,emit:(Z)=>J.emit(Z)}}}class v extends Error{name;code;source;cause;context;constructor(J,Z,$){super(Z);if(this.name=J,this.code=$?.code,this.source=$?.source??"UNKNOWN",this.cause=$?.cause,this.context=$?.context,Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,message:this.message,code:this.code,source:this.source,context:this.context,cause:this.cause instanceof Error?{name:this.cause.name,message:this.cause.message}:this.cause,stack:this.stack}}toString(){let J=`[${this.source}] ${this.name}: ${this.message}`;if(this.code)J+=` (Code: ${this.code})`;if(this.context)J+=`
|
|
2
|
+
Context: ${JSON.stringify(this.context,null,2)}`;return J}}class X extends v{constructor(J,Z){super("RpcError",J,{...Z,source:Z?.source??"RPC_REQUEST"})}static connectionFailed(J,Z){return new X("Failed to connect to RPC endpoint",{code:"RPC_CONNECTION_FAILED",source:"RPC_CONNECTION",cause:Z,context:{url:J}})}static timeout(J,Z){return new X("RPC request timed out",{code:"RPC_TIMEOUT",source:"RPC_TIMEOUT",context:{method:J,timeout:Z}})}static invalidResponse(J,Z){return new X("Invalid RPC response",{code:"RPC_INVALID_RESPONSE",source:"RPC_RESPONSE",context:{method:J,response:Z}})}static fromJsonRpcError(J){return new X(J.message,{code:J.code,source:"RPC_RESPONSE",context:{data:J.data}})}static websocketError(J,Z){return new X(J,{code:"RPC_WEBSOCKET_ERROR",source:"RPC_WEBSOCKET",cause:Z})}}class x{rpcUrl;requestId=0;websocket=null;websocketConnected=!1;pendingResponses={};subscriptionListeners={};reconnectAttempt=0;initialBackoff=2000;maxBackoff=120000;constructor(J){this.rpcUrl=J}async call(J,Z){this.requestId++;let $={jsonrpc:"2.0",id:this.requestId,method:J,params:Z};try{let G=await fetch(this.rpcUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)});if(!G.ok)throw X.connectionFailed(this.rpcUrl,Error(`HTTP ${G.status}: ${G.statusText}`));let Y=await G.json();if(Y.error)throw X.fromJsonRpcError(Y.error);if(Y.result===void 0)throw X.invalidResponse(J,Y);return Y.result}catch(G){if(G instanceof X)throw G;throw X.connectionFailed(this.rpcUrl,G)}}setRpcUrl(J){this.rpcUrl=J}getRpcUrl(){return this.rpcUrl}connect(){return new Promise((J)=>{let Z=this.rpcUrl.replace("http","ws");if(Z.endsWith("/"))Z+="ws";else Z+="/ws";this.websocket=new WebSocket(Z),this.websocket.onopen=()=>{console.log("WebSocket connected"),this.websocketConnected=!0,this.reconnectAttempt=0,J()},this.websocket.onmessage=($)=>{let G=JSON.parse($.data),{id:Y,method:W,params:K}=G;if(Y!==void 0&&this.pendingResponses[Y])this.pendingResponses[Y].resolve(G),delete this.pendingResponses[Y];if(W==="eth_subscription"&&K){let{subscription:M,result:N}=K;if(this.subscriptionListeners[M])this.subscriptionListeners[M].forEach((q)=>q(N))}},this.websocket.onclose=()=>{console.warn("WebSocket closed"),this.websocketConnected=!1},this.websocket.onerror=($)=>{console.error("WebSocket error:",$),this.websocketConnected=!1,this.scheduleReconnect()}})}scheduleReconnect(){let J=Math.min(this.initialBackoff*Math.pow(2,this.reconnectAttempt),this.maxBackoff),Z=J*(Math.random()*0.5),$=J+Z;console.log(`Reconnecting in ${Math.round($)}ms (attempt #${this.reconnectAttempt+1})`),this.reconnectAttempt++,setTimeout(()=>{this.reconnect()},$)}async reconnect(){if(this.websocketConnected)return;try{await this.connect(),console.log("Reconnection successful")}catch(J){console.error("Reconnection attempt failed:",J),this.scheduleReconnect()}}sendMessage(J,Z,$=5000){if(!this.websocket||this.websocket.readyState!==WebSocket.OPEN)return Promise.reject(X.connectionFailed(this.rpcUrl));let G=this.requestId++,Y={jsonrpc:"2.0",method:J,params:Z,id:G};return new Promise((W,K)=>{this.pendingResponses[G]={resolve:W,reject:K},this.websocket.send(JSON.stringify(Y)),setTimeout(()=>{if(this.pendingResponses[G])this.pendingResponses[G].reject(X.timeout(J,$)),delete this.pendingResponses[G]},$)})}async subscribe(J){let Z=J?.toLowerCase();if(!this.websocketConnected)await this.connect();let $=O.create(),G=JSON.stringify(Z?{address:Z}:{}),W=(await this.sendMessage("eth_subscribe",["circles",G])).result;if(!this.subscriptionListeners[W])this.subscriptionListeners[W]=[];return this.subscriptionListeners[W].push((K)=>{A(K).forEach((M)=>$.emit(M))}),$.property}}var b=BigInt(4294967295),o=BigInt(32);function OJ(J,Z=!1){if(Z)return{h:Number(J&b),l:Number(J>>o&b)};return{h:Number(J>>o&b)|0,l:Number(J&b)|0}}function t(J,Z=!1){let $=J.length,G=new Uint32Array($),Y=new Uint32Array($);for(let W=0;W<$;W++){let{h:K,l:M}=OJ(J[W],Z);[G[W],Y[W]]=[K,M]}return[G,Y]}var a=(J,Z,$)=>J<<$|Z>>>32-$,r=(J,Z,$)=>Z<<$|J>>>32-$,s=(J,Z,$)=>Z<<$-32|J>>>64-$,e=(J,Z,$)=>J<<$-32|Z>>>64-$;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function LJ(J){return J instanceof Uint8Array||ArrayBuffer.isView(J)&&J.constructor.name==="Uint8Array"}function y(J){if(!Number.isSafeInteger(J)||J<0)throw Error("positive integer expected, got "+J)}function z(J,...Z){if(!LJ(J))throw Error("Uint8Array expected");if(Z.length>0&&!Z.includes(J.length))throw Error("Uint8Array expected of length "+Z+", got length="+J.length)}function h(J,Z=!0){if(J.destroyed)throw Error("Hash instance has been destroyed");if(Z&&J.finished)throw Error("Hash#digest() has already been called")}function JJ(J,Z){z(J);let $=Z.outputLen;if(J.length<$)throw Error("digestInto() expects output buffer of length at least "+$)}function ZJ(J){return new Uint32Array(J.buffer,J.byteOffset,Math.floor(J.byteLength/4))}function m(...J){for(let Z=0;Z<J.length;Z++)J[Z].fill(0)}var zJ=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();function IJ(J){return J<<24&4278190080|J<<8&16711680|J>>>8&65280|J>>>24&255}function _J(J){for(let Z=0;Z<J.length;Z++)J[Z]=IJ(J[Z]);return J}var p=zJ?(J)=>J:_J;function BJ(J){if(typeof J!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(J))}function u(J){if(typeof J==="string")J=BJ(J);return z(J),J}class c{}function $J(J){let Z=(G)=>J().update(u(G)).digest(),$=J();return Z.outputLen=$.outputLen,Z.blockLen=$.blockLen,Z.create=()=>J(),Z}var RJ=BigInt(0),I=BigInt(1),TJ=BigInt(2),EJ=BigInt(7),SJ=BigInt(256),HJ=BigInt(113),WJ=[],KJ=[],QJ=[];for(let J=0,Z=I,$=1,G=0;J<24;J++){[$,G]=[G,(2*$+3*G)%5],WJ.push(2*(5*G+$)),KJ.push((J+1)*(J+2)/2%64);let Y=RJ;for(let W=0;W<7;W++)if(Z=(Z<<I^(Z>>EJ)*HJ)%SJ,Z&TJ)Y^=I<<(I<<BigInt(W))-I;QJ.push(Y)}var MJ=t(QJ,!0),kJ=MJ[0],CJ=MJ[1],GJ=(J,Z,$)=>$>32?s(J,Z,$):a(J,Z,$),YJ=(J,Z,$)=>$>32?e(J,Z,$):r(J,Z,$);function wJ(J,Z=24){let $=new Uint32Array(10);for(let G=24-Z;G<24;G++){for(let K=0;K<10;K++)$[K]=J[K]^J[K+10]^J[K+20]^J[K+30]^J[K+40];for(let K=0;K<10;K+=2){let M=(K+8)%10,N=(K+2)%10,q=$[N],U=$[N+1],d=GJ(q,U,1)^$[M],g=YJ(q,U,1)^$[M+1];for(let j=0;j<50;j+=10)J[K+j]^=d,J[K+j+1]^=g}let Y=J[2],W=J[3];for(let K=0;K<24;K++){let M=KJ[K],N=GJ(Y,W,M),q=YJ(Y,W,M),U=WJ[K];Y=J[U],W=J[U+1],J[U]=N,J[U+1]=q}for(let K=0;K<50;K+=10){for(let M=0;M<10;M++)$[M]=J[K+M];for(let M=0;M<10;M++)J[K+M]^=~$[(M+2)%10]&$[(M+4)%10]}J[0]^=kJ[G],J[1]^=CJ[G]}m($)}class l extends c{constructor(J,Z,$,G=!1,Y=24){super();if(this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=J,this.suffix=Z,this.outputLen=$,this.enableXOF=G,this.rounds=Y,y($),!(0<J&&J<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=ZJ(this.state)}clone(){return this._cloneInto()}keccak(){p(this.state32),wJ(this.state32,this.rounds),p(this.state32),this.posOut=0,this.pos=0}update(J){h(this),J=u(J),z(J);let{blockLen:Z,state:$}=this,G=J.length;for(let Y=0;Y<G;){let W=Math.min(Z-this.pos,G-Y);for(let K=0;K<W;K++)$[this.pos++]^=J[Y++];if(this.pos===Z)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:J,suffix:Z,pos:$,blockLen:G}=this;if(J[$]^=Z,(Z&128)!==0&&$===G-1)this.keccak();J[G-1]^=128,this.keccak()}writeInto(J){h(this,!1),z(J),this.finish();let Z=this.state,{blockLen:$}=this;for(let G=0,Y=J.length;G<Y;){if(this.posOut>=$)this.keccak();let W=Math.min($-this.posOut,Y-G);J.set(Z.subarray(this.posOut,this.posOut+W),G),this.posOut+=W,G+=W}return J}xofInto(J){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(J)}xof(J){return y(J),this.xofInto(new Uint8Array(J))}digestInto(J){if(JJ(J,this),this.finished)throw Error("digest() was already called");return this.writeInto(J),this.destroy(),J}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,m(this.state)}_cloneInto(J){let{blockLen:Z,suffix:$,outputLen:G,rounds:Y,enableXOF:W}=this;return J||(J=new l(Z,$,G,W,Y)),J.state32.set(this.state32),J.pos=this.pos,J.posOut=this.posOut,J.finished=this.finished,J.rounds=Y,J.suffix=$,J.outputLen=G,J.enableXOF=W,J.destroyed=this.destroyed,J}}var gJ=(J,Z,$)=>$J(()=>new l(Z,J,$));var VJ=(()=>gJ(1,136,32))();var qJ=[];for(let J=0;J<256;J++)qJ[J]=J.toString(16).padStart(2,"0");function NJ(J){let Z="0x";for(let $=0;$<J.length;$++)Z+=qJ[J[$]];return Z}function UJ(J){let Z=J.toLowerCase().replace("0x",""),$=NJ(VJ(new TextEncoder().encode(Z))).slice(2),G="0x";for(let Y=0;Y<Z.length;Y++)G+=parseInt($[Y],16)>=8?Z[Y].toUpperCase():Z[Y];return G}function Q(J){return J.toLowerCase()}function AJ(J){return J.map((Z)=>Q(Z))}function xJ(J){return UJ(J)}function bJ(J){if(typeof J!=="string")return!1;let Z=J.replace("0x","");return Z.length===40&&/^[0-9a-fA-F]{40}$/.test(Z)}function V(J){if(J===null||J===void 0)return J;if(bJ(J))return xJ(J);if(Array.isArray(J))return J.map((Z)=>V(Z));if(typeof J==="object"&&J!==null){let Z={};for(let $ in J)if(Object.prototype.hasOwnProperty.call(J,$))Z[$]=V(J[$]);return Z}return J}function XJ(J){return{Source:Q(J.from),Sink:Q(J.to),TargetFlow:J.targetFlow.toString(),WithWrap:J.useWrappedBalances,FromTokens:J.fromTokens?.map(Q),ToTokens:J.toTokens?.map(Q),ExcludedFromTokens:J.excludeFromTokens?.map(Q),ExcludedToTokens:J.excludeToTokens?.map(Q),SimulatedBalances:J.simulatedBalances?.map((Z)=>({Holder:Q(Z.holder),Token:Q(Z.token),Amount:Z.amount.toString(),IsWrapped:Z.isWrapped,IsStatic:Z.isStatic})),SimulatedTrusts:J.simulatedTrusts?.map((Z)=>({Truster:Q(Z.truster),Trustee:Q(Z.trustee)})),MaxTransfers:J.maxTransfers}}function D(J){let Z={};for(let $ in J){let G=J[$];if(G===null||G===void 0)Z[$]=G;else if(typeof G==="string"&&/^\d+$/.test(G))Z[$]=BigInt(G);else if(typeof G==="object"&&!Array.isArray(G))Z[$]=D(G);else if(Array.isArray(G))Z[$]=G.map((Y)=>typeof Y==="object"&&Y!==null?D(Y):Y);else Z[$]=G}return Z}var VZ=BigInt(96)*BigInt(1000000000000000000),FJ=BigInt("9999999999999999999999999999999999999");class _{client;constructor(J){this.client=J}async findPath(J){let Z=XJ(J),$=await this.client.call("circlesV2_findPath",[Z]),G=D($);return V(G)}async findMaxFlow(J){let Z=await this.findPath({...J,targetFlow:FJ});return BigInt(Z.maxFlow)}}class B{client;constructor(J){this.client=J}async query(J){let Z=await this.client.call("circles_query",[J]);return V(Z)}async tables(){return this.client.call("circles_tables",[])}async events(J,Z,$=null,G=null,Y=!1){let W=await this.client.call("circles_events",[J,Z,$,G,Y]);return V(W)}}var fJ=[{name:"blockNumber",sortOrder:"DESC"},{name:"transactionIndex",sortOrder:"DESC"},{name:"logIndex",sortOrder:"DESC"}];class F{params;client;rowTransformer;cursorColumns;orderColumns;get currentPage(){return this._currentPage}_currentPage;constructor(J,Z,$){this.client=J,this.params=Z,this.rowTransformer=$||Z.rowTransformer,this.orderColumns=Z.orderColumns,this.cursorColumns=Z.cursorColumns||this.buildEventCursorColumns()}buildEventCursorColumns(){let J=fJ.map((Z)=>({...Z,sortOrder:this.params.sortOrder}));if(this.params.table==="TransferBatch")J.push({name:"batchIndex",sortOrder:this.params.sortOrder});return J}transformCursorValue(J,Z){if(Z)return Z(J);if(typeof J==="bigint")return J.toString();return J}createEqualityPredicate(J,Z){return{Type:"FilterPredicate",FilterType:"Equals",Column:J.name,Value:this.transformCursorValue(Z,J.toValue)}}createComparisonPredicate(J,Z){return{Type:"FilterPredicate",FilterType:J.sortOrder==="ASC"?"GreaterThan":"LessThan",Column:J.name,Value:this.transformCursorValue(Z,J.toValue)}}buildCursorFilter(J){if(!J)return[];let Z=[];for(let $=0;$<this.cursorColumns.length;$++){let G=this.cursorColumns[$],Y=J[G.name];if(Y===void 0)continue;if($===0)Z.push(this.createComparisonPredicate(G,Y));else{let W=[];for(let K=0;K<$;K++){let M=this.cursorColumns[K],N=J[M.name];if(N!==void 0)W.push(this.createEqualityPredicate(M,N))}W.push(this.createComparisonPredicate(G,Y)),Z.push({Type:"Conjunction",ConjunctionType:"And",Predicates:W})}}if(Z.length===0)return[];return[{Type:"Conjunction",ConjunctionType:"Or",Predicates:Z}]}buildOrderBy(){if(this.orderColumns&&this.orderColumns.length>0)return this.orderColumns;return this.cursorColumns.map((J)=>({Column:J.name,SortOrder:J.sortOrder}))}combineFilters(J,Z){if(!J?.length&&!Z?.length)return[];if(!J?.length)return Z||[];if(!Z?.length)return J;return[{Type:"Conjunction",ConjunctionType:"And",Predicates:[...J,...Z]}]}rowsToObjects(J){let{columns:Z,rows:$}=J;return $.map((G)=>{let Y={};return Z.forEach((W,K)=>{Y[W]=G[K]}),this.rowTransformer?this.rowTransformer(Y):Y})}rowToCursor(J){let Z={};for(let $ of this.cursorColumns)Z[$.name]=J[$.name];return Z}getCursors(J){if(J.length===0)return{};return{first:this.rowToCursor(J[0]),last:this.rowToCursor(J[J.length-1])}}async queryNextPage(){let J=this.buildCursorFilter(this._currentPage?.lastCursor),Z=this.combineFilters(this.params.filter,J),$={Namespace:this.params.namespace,Table:this.params.table,Columns:this.params.columns,Filter:Z,Order:this.buildOrderBy(),Limit:this.params.limit},G=await this.client.call("circles_query",[$]),Y=this.rowsToObjects(G),W=this.getCursors(Y);return this._currentPage={limit:this.params.limit,size:Y.length,firstCursor:W.first,lastCursor:W.last,sortOrder:this.params.sortOrder,hasMore:Y.length===this.params.limit,results:Y},Y.length>0}reset(){this._currentPage=void 0}}class R{client;constructor(J){this.client=J}transformQueryResponse(J){let{columns:Z,rows:$}=J;return $.map((G)=>{let Y={};return Z.forEach((W,K)=>{Y[W]=G[K]}),Y})}async getCommonTrust(J,Z){let $=await this.client.call("circles_getCommonTrust",[Q(J),Q(Z)]);return V($)}getTrustRelations(J,Z=100,$="DESC"){let G=Q(J),Y=[{Type:"Conjunction",ConjunctionType:"And",Predicates:[{Type:"FilterPredicate",FilterType:"Equals",Column:"version",Value:2},{Type:"Conjunction",ConjunctionType:"Or",Predicates:[{Type:"FilterPredicate",FilterType:"Equals",Column:"trustee",Value:G},{Type:"FilterPredicate",FilterType:"Equals",Column:"truster",Value:G}]}]}];return new F(this.client,{namespace:"V_Crc",table:"TrustRelations",sortOrder:$,columns:["blockNumber","timestamp","transactionIndex","logIndex","transactionHash","version","trustee","truster","expiryTime"],filter:Y,limit:Z},(W)=>V(W))}async getAggregatedTrustRelations(J){let Z=Q(J),$=this.getTrustRelations(Z,1000),G=[];while(await $.queryNextPage())if(G.push(...$.currentPage.results),!$.currentPage.hasMore)break;let Y={};G.forEach((K)=>{let M=Q(K.truster),N=Q(K.trustee),q=M!==Z?K.truster:K.trustee;if(!Y[q])Y[q]=[];Y[q].push(K)});let W=Object.entries(Y).filter(([K])=>Q(K)!==Z).map(([K,M])=>{let N=Math.max(...M.map((U)=>U.timestamp)),q;if(M.length===2)q="mutuallyTrusts";else if(Q(M[0]?.trustee)===Z)q="trustedBy";else if(Q(M[0]?.truster)===Z)q="trusts";else throw Error("Unexpected trust list row. Couldn't determine trust relation.");return{subjectAvatar:Z,relation:q,objectAvatar:K,timestamp:N}});return V(W)}async getTrustedBy(J){let Z=Q(J),G=(await this.getAggregatedTrustRelations(Z)).filter((Y)=>Y.relation==="trustedBy");return V(G)}async getTrusts(J){let Z=Q(J),G=(await this.getAggregatedTrustRelations(Z)).filter((Y)=>Y.relation==="trusts");return V(G)}async getMutualTrusts(J){let Z=Q(J),G=(await this.getAggregatedTrustRelations(Z)).filter((Y)=>Y.relation==="mutuallyTrusts");return V(G)}}class P{static ONE_64=1n<<64n;static GAMMA_64=18443079296116538654n;static BETA_64=18450409579521241655n;static SECONDS_PER_DAY=86400n;static INFLATION_DAY_ZERO_UNIX=1602720000n;static ATTO_FACTOR=1000000000000000000n;static FACTOR_1E12=1000000000000n;static V1_ACCURACY=100000000n;static V1_INFLATION_PCT_NUM=107n;static V1_INFLATION_PCT_DEN=100n;static PERIOD_SEC=31556952n;static mul64(J,Z){return J*Z>>64n}static mulU(J,Z){return J*Z>>64n}static pow64(J,Z){let $=J,G=Z,Y=this.ONE_64;while(G>0n){if((G&1n)===1n)Y=this.mul64(Y,$);$=this.mul64($,$),G>>=1n}return Y}static ONE_36=1000000000000000000000000000000000000000n;static GAMMA_36=999801332008598957430613406568191166n;static BETA_36=1000198707468214629156271489013303962n;static mul36(J,Z){return J*Z/this.ONE_36}static pow36(J,Z){let $=this.ONE_36,G=J,Y=Z;while(Y>0n){if((Y&1n)===1n)$=this.mul36($,G);G=this.mul36(G,G),Y>>=1n}return $}static attoCirclesToCircles(J){if(J===0n)return 0;let Z=J/this.ATTO_FACTOR,$=J%this.ATTO_FACTOR,G=BigInt(Number.MAX_SAFE_INTEGER);if(Z>G||Z<-G)throw RangeError("Atto value’s integer component exceeds JS double precision.");return Number(Z)+Number($)/Number(this.ATTO_FACTOR)}static circlesToAttoCircles(J){return BigInt(Math.trunc(J*Number(this.ATTO_FACTOR)))}static inflationaryToDemurrage(J,Z){return this.mulU(this.pow64(this.GAMMA_64,Z),J)}static demurrageToInflationary(J,Z){return this.mulU(this.pow64(this.BETA_64,Z),J)}static dayFromTimestamp(J){return(J-this.INFLATION_DAY_ZERO_UNIX)/this.SECONDS_PER_DAY}static attoCirclesToAttoStaticCircles(J,Z=BigInt(Math.floor(Date.now()/1000))){return this.demurrageToInflationary(J,this.dayFromTimestamp(Z))}static attoStaticCirclesToAttoCircles(J,Z=BigInt(Math.floor(Date.now()/1000))){return this.inflationaryToDemurrage(J,this.dayFromTimestamp(Z))}static inflationaryToDemurrageExact(J,Z){let $=this.pow36(this.GAMMA_36,Z);return J*$/this.ONE_36}static demurrageToInflationaryExact(J,Z){let $=this.pow36(this.BETA_36,Z);return J*$/this.ONE_36}static attoCirclesToAttoStaticCirclesExact(J,Z=BigInt(Math.floor(Date.now()/1000))){let $=this.dayFromTimestamp(Z);return this.demurrageToInflationaryExact(J,$)}static attoStaticCirclesToAttoCirclesExact(J,Z=BigInt(Math.floor(Date.now()/1000))){let $=this.dayFromTimestamp(Z);return this.inflationaryToDemurrageExact(J,$)}static truncateToInt64(J){let Z=J/this.FACTOR_1E12,$=9223372036854775807n;return Z>$?$:Z}static blowUpToBigInt(J){return J*this.FACTOR_1E12}static truncateToSixDecimals(J){return this.blowUpToBigInt(this.truncateToInt64(J))}static v1InflateFactor(J){if(J===0n)return this.V1_ACCURACY;return this.V1_ACCURACY*this.V1_INFLATION_PCT_NUM**J/this.V1_INFLATION_PCT_DEN**J}static attoCrcToAttoCircles(J,Z){let $=Z-this.INFLATION_DAY_ZERO_UNIX,G=$/this.PERIOD_SEC,Y=$%this.PERIOD_SEC,W=this.v1InflateFactor(G),K=this.v1InflateFactor(G+1n);return this.v1ToDemurrage(J,W,K,Y,this.PERIOD_SEC)}static attoCirclesToAttoCrc(J,Z){let $=Z-this.INFLATION_DAY_ZERO_UNIX,G=$/this.PERIOD_SEC,Y=$%this.PERIOD_SEC,W=this.v1InflateFactor(G),K=this.v1InflateFactor(G+1n),M=W*(this.PERIOD_SEC-Y)+K*Y;return J*3n*this.V1_ACCURACY*this.PERIOD_SEC/M}static v1ToDemurrage(J,Z,$,G,Y){let W=Z*(Y-G)+$*G;return J*3n*this.V1_ACCURACY*Y/W}}class T{client;constructor(J){this.client=J}async getTotalBalance(J,Z=!0){let $=await this.client.call("circlesV2_getTotalBalance",[Q(J),Z]);return P.circlesToAttoCircles($)}async getTokenBalances(J){let $=(await this.client.call("circles_getTokenBalances",[Q(J)])).map((G)=>D(G));return V($)}}class E{client;constructor(J){this.client=J}async getAvatarInfo(J){let Z=await this.getAvatarInfoBatch([J]);return Z.length>0?Z[0]:void 0}async getAvatarInfoBatch(J){if(J.length===0)return[];let Z=J.map((G)=>Q(G)),$=await this.client.call("circles_getAvatarInfoBatch",[Z]);return V($)}async getNetworkSnapshot(){let J=await this.client.call("circles_getNetworkSnapshot",[]);return V(J)}}class S{client;constructor(J){this.client=J}async getProfileByCid(J){return this.client.call("circles_getProfileByCid",[J])}async getProfileByCidBatch(J){return this.client.call("circles_getProfileByCidBatch",[J])}async getProfileByAddress(J){return this.client.call("circles_getProfileByAddress",[Q(J)])}async getProfileByAddressBatch(J){return this.client.call("circles_getProfileByAddressBatch",[J.map((Z)=>Z===null?null:Q(Z))])}async searchProfiles(J,Z=10,$=0,G){return this.client.call("circles_searchProfiles",[J.toLowerCase(),Z,$,G])}async searchByAddressOrName(J,Z=10,$=0,G){let Y=[],W=/^0x[a-fA-F0-9]{40}$/.test(J);if(W)try{let K=await this.getProfileByAddress(J);if(K){let M={...K,address:J};if(!G||!M.avatarType||G.includes(M.avatarType))Y.push(M)}}catch(K){console.warn("Failed to get profile by address:",K)}try{let K=await this.searchProfiles(J,Z,$,G);if(W&&Y.length>0){let M=J.toLowerCase(),N=K.filter((q)=>q.address?.toLowerCase()!==M);Y.push(...N)}else Y.push(...K)}catch(K){console.warn("Failed to search profiles by text:",K)}return Y.slice(0,Z)}}class H{client;constructor(J){this.client=J}async getTokenInfo(J){let Z=await this.getTokenInfoBatch([J]);return Z.length>0?Z[0]:void 0}async getTokenInfoBatch(J){if(J.length===0)return[];let Z=J.map((Y)=>Q(Y)),G=(await this.client.call("circles_getTokenInfoBatch",[Z])).map((Y)=>D(Y));return V(G)}getTokenHolders(J,Z=100,$="DESC"){let G=Q(J);return new F(this.client,{namespace:"V_CrcV2",table:"BalancesByAccountAndToken",columns:["account","tokenAddress","demurragedTotalBalance"],filter:[{Type:"FilterPredicate",FilterType:"Equals",Column:"tokenAddress",Value:G}],cursorColumns:[{name:"demurragedTotalBalance",sortOrder:$},{name:"account",sortOrder:"ASC"}],orderColumns:[{Column:"demurragedTotalBalance",SortOrder:$},{Column:"account",SortOrder:"ASC"}],limit:Z,sortOrder:$},(Y)=>({account:Y.account,tokenAddress:Y.tokenAddress,demurragedTotalBalance:Y.demurragedTotalBalance}))}}class k{client;constructor(J){this.client=J}transformQueryResponse(J){let{columns:Z,rows:$}=J;return $.map((G)=>{let Y={};return Z.forEach((W,K)=>{Y[W]=G[K]}),Y})}async getInvitedBy(J){let Z=Q(J),$=await this.client.call("circles_query",[{Namespace:"CrcV2",Table:"RegisterHuman",Columns:["inviter"],Filter:[{Type:"FilterPredicate",FilterType:"Equals",Column:"avatar",Value:Z}],Order:[{Column:"blockNumber",SortOrder:"DESC"}],Limit:1}]);if($.length>0)return V($[0].inviter);return}async getInvitations(J){let Z=Q(J),$=96,G=await this.client.call("circles_getAvatarInfoBatch",[[Z]]);if((G.length>0?G[0]:void 0)?.version===2)return[];let W=await this.client.call("circles_query",[{Namespace:"V_Crc",Table:"TrustRelations",Columns:["truster","trustee"],Filter:[{Type:"Conjunction",ConjunctionType:"And",Predicates:[{Type:"FilterPredicate",FilterType:"Equals",Column:"version",Value:2},{Type:"FilterPredicate",FilterType:"Equals",Column:"trustee",Value:Z}]}],Order:[]}]),M=this.transformQueryResponse(W).map((U)=>U.truster);if(M.length===0)return[];let N=await this.client.call("circles_getAvatarInfoBatch",[M]),q=[];for(let U of N){if(!U?.isHuman)continue;let g=(await this.client.call("circles_getTokenBalances",[U.avatar])).find((j)=>Q(j.tokenAddress)===Q(U.avatar));if(g&&g.circles>=96)q.push(U)}return V(q)}async getInvitationsFrom(J,Z=!1){let $=Q(J);if(Z){let G=await this.client.call("circles_query",[{Namespace:"CrcV2",Table:"RegisterHuman",Columns:["avatar"],Filter:[{Type:"FilterPredicate",FilterType:"Equals",Column:"inviter",Value:$}],Order:[{Column:"blockNumber",SortOrder:"DESC"}]}]),W=this.transformQueryResponse(G).map((K)=>K.avatar);return V(W)}else{let G=await this.client.call("circles_query",[{Namespace:"V_Crc",Table:"TrustRelations",Columns:["trustee","truster"],Filter:[{Type:"Conjunction",ConjunctionType:"And",Predicates:[{Type:"FilterPredicate",FilterType:"Equals",Column:"version",Value:2},{Type:"FilterPredicate",FilterType:"Equals",Column:"truster",Value:$}]}],Order:[]}]),W=this.transformQueryResponse(G).map((q)=>q.trustee);if(W.length===0)return[];let K=await this.client.call("circles_getAvatarInfoBatch",[W]),M=new Set(K.filter((q)=>q!==null).map((q)=>Q(q.avatar))),N=W.filter((q)=>!M.has(Q(q)));return V(N)}}}function vJ(J,Z){let $=BigInt(J),G=P.attoCirclesToCircles($),Y=P.attoCirclesToAttoCrc($,BigInt(Z)),W=P.attoCirclesToCircles(Y),K=P.attoCirclesToAttoStaticCircles($,BigInt(Z)),M=P.attoCirclesToCircles(K);return{attoCircles:$,circles:G,staticAttoCircles:K,staticCircles:M,attoCrc:Y,crc:W}}class C{client;constructor(J){this.client=J}getTransactionHistory(J,Z=50,$="DESC"){let G=Q(J),Y=[{Type:"Conjunction",ConjunctionType:"And",Predicates:[{Type:"FilterPredicate",FilterType:"Equals",Column:"version",Value:2},{Type:"Conjunction",ConjunctionType:"Or",Predicates:[{Type:"FilterPredicate",FilterType:"Equals",Column:"from",Value:G},{Type:"FilterPredicate",FilterType:"Equals",Column:"to",Value:G}]}]}];return new F(this.client,{namespace:"V_Crc",table:"TransferSummary",sortOrder:$,columns:[],filter:Y,limit:Z},(W)=>{let K=vJ(W.value,W.timestamp),M={...W,...K};return V(M)})}}class w{client;constructor(J){this.client=J}async findGroups(J=50,Z){let $=this.getGroups(J,Z,"DESC"),G=[];while(await $.queryNextPage()){if(G.push(...$.currentPage.results),G.length>=J)break;if(!$.currentPage.hasMore)break}return G.slice(0,J)}getGroupMemberships(J,Z=50,$="DESC"){let G=Q(J);return new F(this.client,{namespace:"V_CrcV2",table:"GroupMemberships",sortOrder:$,columns:["blockNumber","timestamp","transactionIndex","logIndex","transactionHash","group","member","expiryTime"],filter:[{Type:"FilterPredicate",FilterType:"Equals",Column:"member",Value:G}],limit:Z},(Y)=>V(Y))}getGroupHolders(J,Z=100){let $=Q(J);return new F(this.client,{namespace:"V_CrcV2",table:"GroupTokenHoldersBalance",sortOrder:"DESC",columns:["group","holder","totalBalance","demurragedTotalBalance","fractionOwnership"],cursorColumns:[{name:"holder",sortOrder:"ASC"}],orderColumns:[{Column:"totalBalance",SortOrder:"DESC"},{Column:"holder",SortOrder:"ASC"}],filter:[{Type:"FilterPredicate",FilterType:"Equals",Column:"group",Value:$}],limit:Z,rowTransformer:(G)=>{let Y={...G,totalBalance:BigInt(G.totalBalance),demurragedTotalBalance:BigInt(G.demurragedTotalBalance)};return V(Y)}})}getGroupMembers(J,Z=100,$="DESC"){let G=Q(J);return new F(this.client,{namespace:"V_CrcV2",table:"GroupMemberships",sortOrder:$,columns:["blockNumber","timestamp","transactionIndex","logIndex","transactionHash","group","member","expiryTime"],filter:[{Type:"FilterPredicate",FilterType:"Equals",Column:"group",Value:G}],limit:Z},(Y)=>V(Y))}getGroups(J=50,Z,$="DESC"){let G=[];if(Z){if(Z.nameStartsWith)G.push({Type:"FilterPredicate",FilterType:"Like",Column:"name",Value:Z.nameStartsWith+"%"});if(Z.symbolStartsWith)G.push({Type:"FilterPredicate",FilterType:"Like",Column:"symbol",Value:Z.symbolStartsWith+"%"});if(Z.groupAddressIn&&Z.groupAddressIn.length>0){let W=Z.groupAddressIn.map((K)=>({Type:"FilterPredicate",FilterType:"Equals",Column:"group",Value:Q(K)}));if(W.length===1)G.push(W[0]);else G.push({Type:"Conjunction",ConjunctionType:"Or",Predicates:W})}if(Z.groupTypeIn&&Z.groupTypeIn.length>0){let W=Z.groupTypeIn.map((K)=>({Type:"FilterPredicate",FilterType:"Equals",Column:"type",Value:K}));if(W.length===1)G.push(W[0]);else G.push({Type:"Conjunction",ConjunctionType:"Or",Predicates:W})}if(Z.ownerIn&&Z.ownerIn.length>0){let W=Z.ownerIn.map((K)=>({Type:"FilterPredicate",FilterType:"Equals",Column:"owner",Value:Q(K)}));if(W.length===1)G.push(W[0]);else G.push({Type:"Conjunction",ConjunctionType:"Or",Predicates:W})}if(Z.mintHandlerEquals)G.push({Type:"FilterPredicate",FilterType:"Equals",Column:"mintHandler",Value:Q(Z.mintHandlerEquals)});if(Z.treasuryEquals)G.push({Type:"FilterPredicate",FilterType:"Equals",Column:"treasury",Value:Q(Z.treasuryEquals)})}let Y=G.length>1?[{Type:"Conjunction",ConjunctionType:"And",Predicates:G}]:G;return new F(this.client,{namespace:"V_CrcV2",table:"Groups",sortOrder:$,columns:["blockNumber","timestamp","transactionIndex","logIndex","transactionHash","group","type","owner","mintPolicy","mintHandler","treasury","service","feeCollection","memberCount","name","symbol","cidV0Digest","erc20WrapperDemurraged","erc20WrapperStatic"],filter:Y,limit:J},(W)=>V(W))}}class DJ{client;_pathfinder;_query;_trust;_balance;_avatar;_profile;_token;_invitation;_transaction;_group;constructor(J="https://rpc.circlesubi.network/"){this.client=new x(J)}get pathfinder(){if(!this._pathfinder)this._pathfinder=new _(this.client);return this._pathfinder}get query(){if(!this._query)this._query=new B(this.client);return this._query}get trust(){if(!this._trust)this._trust=new R(this.client);return this._trust}get balance(){if(!this._balance)this._balance=new T(this.client);return this._balance}get avatar(){if(!this._avatar)this._avatar=new E(this.client);return this._avatar}get profile(){if(!this._profile)this._profile=new S(this.client);return this._profile}get token(){if(!this._token)this._token=new H(this.client);return this._token}get invitation(){if(!this._invitation)this._invitation=new k(this.client);return this._invitation}get transaction(){if(!this._transaction)this._transaction=new C(this.client);return this._transaction}get group(){if(!this._group)this._group=new w(this.client);return this._group}setRpcUrl(J){this.client.setRpcUrl(J)}getRpcUrl(){return this.client.getRpcUrl()}}export{D as parseStringsToBigInt,A as parseRpcSubscriptionMessage,f as parseRpcEvent,AJ as normalizeAddresses,Q as normalizeAddress,i as isCirclesEvent,R as TrustMethods,C as TransactionMethods,H as TokenMethods,X as RpcError,x as RpcClient,B as QueryMethods,S as ProfileMethods,_ as PathfinderMethods,F as PagedQuery,O as Observable,k as InvitationMethods,w as GroupMethods,DJ as CirclesRpc,T as BalanceMethods,E as AvatarMethods};
|
package/dist/methods/avatar.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../src/methods/avatar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../src/methods/avatar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAGpF;;GAEG;AACH,qBAAa,aAAa;IACZ,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC;;;;;;;;;;;OAWG;IACG,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAKtE;;;;;;;;;;;;;OAaG;IACG,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAcrE;;;;;;;;;;;OAWG;IACG,kBAAkB,IAAI,OAAO,CAAC,eAAe,CAAC;CAOrD"}
|
package/dist/methods/avatar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../src/methods/balance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../src/methods/balance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIrE;;GAEG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC;;;;;;;;;;;;OAYG;IACG,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,GAAE,OAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAQvF;;;;;;;;;;;OAWG;IACG,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;CAOlE"}
|
package/dist/methods/balance.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { normalizeAddress, parseStringsToBigInt, checksumAddresses } from '../utils';
|
|
1
|
+
import { normalizeAddress, parseStringsToBigInt, checksumAddresses } from '../utils.js';
|
|
2
2
|
import { CirclesConverter } from '@aboutcircles/sdk-utils/circlesConverter';
|
|
3
3
|
/**
|
|
4
4
|
* Balance query RPC methods
|
package/dist/methods/group.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { RpcClient } from '../client';
|
|
1
|
+
import type { RpcClient } from '../client.js';
|
|
2
2
|
import type { Address, GroupRow, GroupMembershipRow, GroupQueryParams } from '@aboutcircles/sdk-types';
|
|
3
|
-
import type { GroupTokenHolderRow } from '../types';
|
|
4
|
-
import { PagedQuery } from '../pagedQuery';
|
|
3
|
+
import type { GroupTokenHolderRow } from '../types.js';
|
|
4
|
+
import { PagedQuery } from '../pagedQuery.js';
|
|
5
5
|
/**
|
|
6
6
|
* Group query RPC methods
|
|
7
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../src/methods/group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../src/methods/group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,gBAAgB,EAAU,MAAM,yBAAyB,CAAC;AAC/G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;GAEG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACG,UAAU,CACd,KAAK,GAAE,MAAW,EAClB,MAAM,CAAC,EAAE,gBAAgB,GACxB,OAAO,CAAC,QAAQ,EAAE,CAAC;IAwBtB;;;;;;;;;;;;;;;;;OAiBG;IACH,mBAAmB,CACjB,MAAM,EAAE,OAAO,EACf,KAAK,GAAE,MAAW,EAClB,SAAS,GAAE,KAAK,GAAG,MAAe,GACjC,UAAU,CAAC,kBAAkB,CAAC;IAiCjC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,eAAe,CACb,YAAY,EAAE,OAAO,EACrB,KAAK,GAAE,MAAY,GAClB,UAAU,CAAC,mBAAmB,CAAC;IAuClC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,eAAe,CACb,YAAY,EAAE,OAAO,EACrB,KAAK,GAAE,MAAY,EACnB,SAAS,GAAE,KAAK,GAAG,MAAe,GACjC,UAAU,CAAC,kBAAkB,CAAC;IAiCjC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,SAAS,CACP,KAAK,GAAE,MAAW,EAClB,MAAM,CAAC,EAAE,gBAAgB,EACzB,SAAS,GAAE,KAAK,GAAG,MAAe,GACjC,UAAU,CAAC,QAAQ,CAAC;CAiJxB"}
|
package/dist/methods/group.js
CHANGED
package/dist/methods/index.d.ts
CHANGED
|
@@ -1,11 +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';
|
|
1
|
+
export { PathfinderMethods } from './pathfinder.js';
|
|
2
|
+
export { QueryMethods } from './query.js';
|
|
3
|
+
export { TrustMethods } from './trust.js';
|
|
4
|
+
export { BalanceMethods } from './balance.js';
|
|
5
|
+
export { AvatarMethods } from './avatar.js';
|
|
6
|
+
export { ProfileMethods } from './profile.js';
|
|
7
|
+
export { TokenMethods } from './token.js';
|
|
8
|
+
export { InvitationMethods } from './invitation.js';
|
|
9
|
+
export { TransactionMethods } from './transaction.js';
|
|
10
|
+
export { GroupMethods } from './group.js';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/methods/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/methods/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/methods/index.js
CHANGED
|
@@ -1,10 +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';
|
|
1
|
+
export { PathfinderMethods } from './pathfinder.js';
|
|
2
|
+
export { QueryMethods } from './query.js';
|
|
3
|
+
export { TrustMethods } from './trust.js';
|
|
4
|
+
export { BalanceMethods } from './balance.js';
|
|
5
|
+
export { AvatarMethods } from './avatar.js';
|
|
6
|
+
export { ProfileMethods } from './profile.js';
|
|
7
|
+
export { TokenMethods } from './token.js';
|
|
8
|
+
export { InvitationMethods } from './invitation.js';
|
|
9
|
+
export { TransactionMethods } from './transaction.js';
|
|
10
|
+
export { GroupMethods } from './group.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invitation.d.ts","sourceRoot":"","sources":["../../src/methods/invitation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"invitation.d.ts","sourceRoot":"","sources":["../../src/methods/invitation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pathfinder.d.ts","sourceRoot":"","sources":["../../src/methods/pathfinder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pathfinder.d.ts","sourceRoot":"","sources":["../../src/methods/pathfinder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,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,4 @@
|
|
|
1
|
-
import { normalizeFindPathParams, parseStringsToBigInt, checksumAddresses } from '../utils';
|
|
1
|
+
import { normalizeFindPathParams, parseStringsToBigInt, checksumAddresses } from '../utils.js';
|
|
2
2
|
import { MAX_FLOW } from '@aboutcircles/sdk-utils/constants';
|
|
3
3
|
/**
|
|
4
4
|
* Circles V1 and V2 balance and pathfinding methods
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { RpcClient } from '../client';
|
|
1
|
+
import type { RpcClient } from '../client.js';
|
|
2
2
|
import type { Address, Profile } from '@aboutcircles/sdk-types';
|
|
3
|
-
import type { SearchResultProfile } from '../types';
|
|
3
|
+
import type { SearchResultProfile } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Profile RPC methods
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/methods/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/methods/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD;;GAEG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC;;;;;;;;;;;OAWG;IACG,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAI3D;;;;;;;;;;;;;;OAcG;IACG,oBAAoB,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC;IAOhF;;;;;;;;;;;OAWG;IACG,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAMpE;;;;;;;;;;;;;;OAcG;IACG,wBAAwB,CAAC,SAAS,EAAE,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC;IAO1F;;;;;;;;;;;;;;;;;OAiBG;IACG,cAAc,CAClB,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAW,EAClB,MAAM,GAAE,MAAU,EAClB,WAAW,CAAC,EAAE,MAAM,EAAE,GACrB,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAYjC;;;;;;;;;;;;;;;;;;;OAmBG;IACG,qBAAqB,CACzB,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAW,EAClB,MAAM,GAAE,MAAU,EAClB,WAAW,CAAC,EAAE,MAAM,EAAE,GACrB,OAAO,CAAC,mBAAmB,EAAE,CAAC;CA8ClC"}
|
package/dist/methods/profile.js
CHANGED
package/dist/methods/query.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/methods/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/methods/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGjF;;GAEG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACG,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAK3D;;;;;;;;;;OAUG;IACG,MAAM,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;IAIpC;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,MAAM,CAAC,CAAC,GAAG,OAAO,EACtB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,UAAU,GAAE,SAAS,EAAE,GAAG,IAAW,EACrC,OAAO,GAAE,MAAM,GAAG,IAAW,EAC7B,sBAAsB,GAAE,OAAe,GACtC,OAAO,CAAC,CAAC,EAAE,CAAC;CAOhB"}
|
package/dist/methods/query.js
CHANGED
package/dist/methods/token.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { RpcClient } from '../client';
|
|
1
|
+
import type { RpcClient } from '../client.js';
|
|
2
2
|
import type { Address, TokenInfo, TokenHolder, SortOrder } from '@aboutcircles/sdk-types';
|
|
3
|
-
import { PagedQuery } from '../pagedQuery';
|
|
3
|
+
import { PagedQuery } from '../pagedQuery.js';
|
|
4
4
|
/**
|
|
5
5
|
* Token information RPC methods
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/methods/token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/methods/token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAE1F,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;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"}
|
package/dist/methods/token.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { normalizeAddress, parseStringsToBigInt, checksumAddresses } from '../utils';
|
|
2
|
-
import { PagedQuery } from '../pagedQuery';
|
|
1
|
+
import { normalizeAddress, parseStringsToBigInt, checksumAddresses } from '../utils.js';
|
|
2
|
+
import { PagedQuery } from '../pagedQuery.js';
|
|
3
3
|
/**
|
|
4
4
|
* Token information RPC methods
|
|
5
5
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { RpcClient } from '../client';
|
|
1
|
+
import type { RpcClient } from '../client.js';
|
|
2
2
|
import type { Address } from '@aboutcircles/sdk-types';
|
|
3
|
-
import type { TransactionHistoryRow } from '../types';
|
|
4
|
-
import { PagedQuery } from '../pagedQuery';
|
|
3
|
+
import type { TransactionHistoryRow } from '../types.js';
|
|
4
|
+
import { PagedQuery } from '../pagedQuery.js';
|
|
5
5
|
/**
|
|
6
6
|
* Transaction history RPC methods
|
|
7
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/methods/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/methods/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAU,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGzD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAiC9C;;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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { normalizeAddress, checksumAddresses } from '../utils';
|
|
1
|
+
import { normalizeAddress, checksumAddresses } from '../utils.js';
|
|
2
2
|
import { CirclesConverter } from '@aboutcircles/sdk-utils/circlesConverter';
|
|
3
|
-
import { PagedQuery } from '../pagedQuery';
|
|
3
|
+
import { PagedQuery } from '../pagedQuery.js';
|
|
4
4
|
/**
|
|
5
5
|
* Calculate circle amounts for v2 transactions
|
|
6
6
|
*/
|
package/dist/methods/trust.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { RpcClient } from '../client';
|
|
1
|
+
import type { RpcClient } from '../client.js';
|
|
2
2
|
import type { Address, TrustRelation, AggregatedTrustRelation } from '@aboutcircles/sdk-types';
|
|
3
|
-
import { PagedQuery } from '../pagedQuery';
|
|
3
|
+
import { PagedQuery } from '../pagedQuery.js';
|
|
4
4
|
/**
|
|
5
5
|
* Trust relation RPC methods
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trust.d.ts","sourceRoot":"","sources":["../../src/methods/trust.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"trust.d.ts","sourceRoot":"","sources":["../../src/methods/trust.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAmD,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEhJ,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;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"}
|
package/dist/methods/trust.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { normalizeAddress, checksumAddresses } from '../utils';
|
|
2
|
-
import { PagedQuery } from '../pagedQuery';
|
|
1
|
+
import { normalizeAddress, checksumAddresses } from '../utils.js';
|
|
2
|
+
import { PagedQuery } from '../pagedQuery.js';
|
|
3
3
|
/**
|
|
4
4
|
* Trust relation RPC methods
|
|
5
5
|
*/
|
package/dist/pagedQuery.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { RpcClient } from './client';
|
|
1
|
+
import type { RpcClient } from './client.js';
|
|
2
2
|
import type { PagedQueryParams, OrderBy } from '@aboutcircles/sdk-types';
|
|
3
|
-
import type { CursorColumn, FlexiblePagedResult } from './types';
|
|
3
|
+
import type { CursorColumn, FlexiblePagedResult } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* A class for querying Circles RPC nodes with cursor-based pagination.
|
|
6
6
|
* Supports both event-based pagination (default) and custom cursor pagination (for view tables).
|
package/dist/pagedQuery.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagedQuery.d.ts","sourceRoot":"","sources":["../src/pagedQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pagedQuery.d.ts","sourceRoot":"","sources":["../src/pagedQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EACV,gBAAgB,EAEhB,OAAO,EAGR,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAWpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,UAAU,CAAC,IAAI,GAAG,GAAG;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAIrB;IACF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAqB;IACrD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAiB;IAC/C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAY;IAE1C,IAAI,WAAW,IAAI,mBAAmB,CAAC,IAAI,CAAC,GAAG,SAAS,CAEvD;IAED,OAAO,CAAC,YAAY,CAAC,CAA4B;gBAG/C,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,gBAAgB,GAAG;QACzB,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;QAC/B,YAAY,CAAC,EAAE,OAAO,EAAE,CAAC;QACzB,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAA;KACpC,EACD,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI;IAWrC;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAc/B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAM5B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAS/B;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAWjC;;;;;;;;;OASG;IACH,OAAO,CAAC,iBAAiB;IAgDzB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAWpB;;OAEG;IACH,OAAO,CAAC,cAAc;IAYtB;;OAEG;IACH,OAAO,CAAC,aAAa;IAarB;;OAEG;IACH,OAAO,CAAC,WAAW;IAUnB;;OAEG;IACH,OAAO,CAAC,UAAU;IASlB;;;;OAIG;IACU,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IA8B9C;;OAEG;IACI,KAAK,IAAI,IAAI;CAGrB"}
|
package/dist/rpc.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RpcClient } from './client';
|
|
2
|
-
import { PathfinderMethods, QueryMethods, TrustMethods, BalanceMethods, AvatarMethods, ProfileMethods, TokenMethods, InvitationMethods, TransactionMethods, GroupMethods } from './methods';
|
|
1
|
+
import { RpcClient } from './client.js';
|
|
2
|
+
import { PathfinderMethods, QueryMethods, TrustMethods, BalanceMethods, AvatarMethods, ProfileMethods, TokenMethods, InvitationMethods, TransactionMethods, GroupMethods } from './methods/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Main RPC class for Circles protocol RPC interactions
|
|
5
5
|
*
|
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,
|
|
1
|
+
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACb,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,UAAU;IACrB,SAAgB,MAAM,EAAE,SAAS,CAAC;IAElC,OAAO,CAAC,WAAW,CAAC,CAAoB;IACxC,OAAO,CAAC,MAAM,CAAC,CAAe;IAC9B,OAAO,CAAC,MAAM,CAAC,CAAe;IAC9B,OAAO,CAAC,QAAQ,CAAC,CAAiB;IAClC,OAAO,CAAC,OAAO,CAAC,CAAgB;IAChC,OAAO,CAAC,QAAQ,CAAC,CAAiB;IAClC,OAAO,CAAC,MAAM,CAAC,CAAe;IAC9B,OAAO,CAAC,WAAW,CAAC,CAAoB;IACxC,OAAO,CAAC,YAAY,CAAC,CAAqB;IAC1C,OAAO,CAAC,MAAM,CAAC,CAAe;IAE9B;;;;OAIG;gBACS,MAAM,GAAE,MAA0C;IAI9D,IAAI,UAAU,IAAI,iBAAiB,CAKlC;IAED,IAAI,KAAK,IAAI,YAAY,CAKxB;IAED,IAAI,KAAK,IAAI,YAAY,CAKxB;IAED,IAAI,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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RpcClient } from './client';
|
|
2
|
-
import { PathfinderMethods, QueryMethods, TrustMethods, BalanceMethods, AvatarMethods, ProfileMethods, TokenMethods, InvitationMethods, TransactionMethods, GroupMethods, } from './methods';
|
|
1
|
+
import { RpcClient } from './client.js';
|
|
2
|
+
import { PathfinderMethods, QueryMethods, TrustMethods, BalanceMethods, AvatarMethods, ProfileMethods, TokenMethods, InvitationMethods, TransactionMethods, GroupMethods, } from './methods/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Main RPC class for Circles protocol RPC interactions
|
|
5
5
|
*
|
package/package.json
CHANGED
package/dist/methods/sdk.d.ts
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import type { Address, ProfileView, TrustNetworkSummary, AggregatedTrustRelationsResponse, ValidInvitersResponse, PagedResponse, EnrichedTransaction, ProfileSearchResponse } from '@aboutcircles/sdk-types';
|
|
2
|
-
import type { RpcClient } from '../client';
|
|
3
|
-
/**
|
|
4
|
-
* SDK Enablement RPC methods
|
|
5
|
-
* These methods reduce SDK round-trips by consolidating common multi-call patterns
|
|
6
|
-
*/
|
|
7
|
-
export declare class SdkMethods {
|
|
8
|
-
private client;
|
|
9
|
-
constructor(client: RpcClient);
|
|
10
|
-
/**
|
|
11
|
-
* Get a complete profile view combining avatar info, profile data, trust stats, and balances
|
|
12
|
-
*
|
|
13
|
-
* Replaces 6-7 separate RPC calls:
|
|
14
|
-
* - circles_getAvatarInfo
|
|
15
|
-
* - circles_getProfileByAddress
|
|
16
|
-
* - circles_getTrustRelations
|
|
17
|
-
* - circles_getTotalBalance (v1)
|
|
18
|
-
* - circlesV2_getTotalBalance (v2)
|
|
19
|
-
*
|
|
20
|
-
* @param address - Avatar address to query
|
|
21
|
-
* @returns Consolidated profile view with all data
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```typescript
|
|
25
|
-
* const profileView = await rpc.sdk.getProfileView('0xde374ece6fa50e781e81aac78e811b33d16912c7');
|
|
26
|
-
* console.log(`${profileView.profile?.name} has ${profileView.trustStats.trustsCount} trusts`);
|
|
27
|
-
* console.log(`V2 Balance: ${profileView.v2Balance}`);
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
getProfileView(address: Address): Promise<ProfileView>;
|
|
31
|
-
/**
|
|
32
|
-
* Get aggregated trust network summary including mutual trusts and network reach
|
|
33
|
-
*
|
|
34
|
-
* Server-side aggregation reduces client-side processing and provides ready-to-display statistics.
|
|
35
|
-
* Network reach = (trusts ∪ trustedBy).count = trustsCount + trustedByCount - mutualTrustsCount
|
|
36
|
-
*
|
|
37
|
-
* @param address - Avatar address to query
|
|
38
|
-
* @param maxDepth - Maximum network depth to analyze (default: 2)
|
|
39
|
-
* @returns Trust network summary with aggregated metrics
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* ```typescript
|
|
43
|
-
* const summary = await rpc.sdk.getTrustNetworkSummary('0xde374ece6fa50e781e81aac78e811b33d16912c7');
|
|
44
|
-
* console.log(`Network reach: ${summary.networkReach}`);
|
|
45
|
-
* console.log(`Mutual trusts: ${summary.mutualTrustsCount}`);
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
getTrustNetworkSummary(address: Address, maxDepth?: number): Promise<TrustNetworkSummary>;
|
|
49
|
-
/**
|
|
50
|
-
* Get trust relations categorized by type (mutual, one-way trusts, one-way trusted-by)
|
|
51
|
-
*
|
|
52
|
-
* Replaces client-side categorization + multiple getAvatarInfo calls.
|
|
53
|
-
* Returns relationships organized for easy UI rendering (different icons/colors per type).
|
|
54
|
-
*
|
|
55
|
-
* @param address - Avatar address to query
|
|
56
|
-
* @returns Trust relations categorized with enriched avatar info
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* ```typescript
|
|
60
|
-
* const relations = await rpc.sdk.getAggregatedTrustRelations('0xde374ece6fa50e781e81aac78e811b33d16912c7');
|
|
61
|
-
* console.log(`Mutual trusts: ${relations.mutual.length}`);
|
|
62
|
-
* console.log(`One-way trusts: ${relations.trusts.length}`);
|
|
63
|
-
* console.log(`Trusted by: ${relations.trustedBy.length}`);
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
getAggregatedTrustRelations(address: Address): Promise<AggregatedTrustRelationsResponse>;
|
|
67
|
-
/**
|
|
68
|
-
* Get list of addresses that trust you AND have sufficient balance to invite
|
|
69
|
-
*
|
|
70
|
-
* Useful for invitation flows and invitation escrow scenarios.
|
|
71
|
-
* Server-side filtering reduces data transfer and client-side processing.
|
|
72
|
-
*
|
|
73
|
-
* @param address - Avatar address to query
|
|
74
|
-
* @param minimumBalance - Optional minimum balance threshold (as TimeCircles string)
|
|
75
|
-
* @returns List of valid inviters with balances and avatar info
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```typescript
|
|
79
|
-
* // Find all potential inviters
|
|
80
|
-
* const inviters = await rpc.sdk.getValidInviters('0xde374ece6fa50e781e81aac78e811b33d16912c7');
|
|
81
|
-
*
|
|
82
|
-
* // Find inviters with at least 50 CRC balance
|
|
83
|
-
* const richInviters = await rpc.sdk.getValidInviters(
|
|
84
|
-
* '0xde374ece6fa50e781e81aac78e811b33d16912c7',
|
|
85
|
-
* '50.0'
|
|
86
|
-
* );
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
getValidInviters(address: Address, minimumBalance?: string): Promise<ValidInvitersResponse>;
|
|
90
|
-
/**
|
|
91
|
-
* Get transaction history with enriched participant profiles and metadata
|
|
92
|
-
*
|
|
93
|
-
* Replaces circles_events + multiple getProfileByAddress calls + client-side event processing.
|
|
94
|
-
* Returns transaction history ready for UI display with participant names and avatars.
|
|
95
|
-
*
|
|
96
|
-
* @param address - Avatar address to query
|
|
97
|
-
* @param fromBlock - Starting block number
|
|
98
|
-
* @param toBlock - Optional ending block number (null for latest)
|
|
99
|
-
* @param limit - Maximum number of transactions (default: 50)
|
|
100
|
-
* @returns Enriched transaction history with participant profiles
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```typescript
|
|
104
|
-
* const history = await rpc.sdk.getTransactionHistoryEnriched(
|
|
105
|
-
* '0xde374ece6fa50e781e81aac78e811b33d16912c7',
|
|
106
|
-
* 30282299,
|
|
107
|
-
* null,
|
|
108
|
-
* 20
|
|
109
|
-
* );
|
|
110
|
-
*
|
|
111
|
-
* for (const tx of history.transactions) {
|
|
112
|
-
* const from = tx.event.values.from;
|
|
113
|
-
* const fromProfile = tx.participants[from]?.profile;
|
|
114
|
-
* console.log(`From: ${fromProfile?.name || from}`);
|
|
115
|
-
* }
|
|
116
|
-
* ```
|
|
117
|
-
*/
|
|
118
|
-
getTransactionHistoryEnriched(address: Address, fromBlock?: number, toBlock?: number | null, limit?: number, cursor?: string | null): Promise<PagedResponse<EnrichedTransaction>>;
|
|
119
|
-
/**
|
|
120
|
-
* Unified search across profiles by address prefix OR name/description text
|
|
121
|
-
*
|
|
122
|
-
* Combines address lookup and full-text search in a single endpoint.
|
|
123
|
-
* Automatically detects search type based on query format (0x prefix = address search).
|
|
124
|
-
*
|
|
125
|
-
* @param query - Search query (address prefix or name/description text)
|
|
126
|
-
* @param limit - Maximum number of results (default: 20)
|
|
127
|
-
* @param offset - Pagination offset (default: 0)
|
|
128
|
-
* @param types - Optional array of avatar types to filter by
|
|
129
|
-
* @returns Unified search results with profiles
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* ```typescript
|
|
133
|
-
* // Search by name
|
|
134
|
-
* const byName = await rpc.sdk.searchProfileByAddressOrName('Alice');
|
|
135
|
-
*
|
|
136
|
-
* // Search by address prefix
|
|
137
|
-
* const byAddress = await rpc.sdk.searchProfileByAddressOrName('0xde374');
|
|
138
|
-
*
|
|
139
|
-
* // Search with filters
|
|
140
|
-
* const filtered = await rpc.sdk.searchProfileByAddressOrName(
|
|
141
|
-
* 'developer',
|
|
142
|
-
* 10,
|
|
143
|
-
* 0,
|
|
144
|
-
* ['CrcV2_RegisterHuman']
|
|
145
|
-
* );
|
|
146
|
-
* ```
|
|
147
|
-
*/
|
|
148
|
-
searchProfileByAddressOrName(query: string, limit?: number, offset?: number, types?: string[]): Promise<ProfileSearchResponse>;
|
|
149
|
-
}
|
|
150
|
-
//# sourceMappingURL=sdk.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/methods/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,mBAAmB,EACnB,gCAAgC,EAChC,qBAAqB,EACrB,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C;;;GAGG;AACH,qBAAa,UAAU;IACT,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,SAAS;IAErC;;;;;;;;;;;;;;;;;;;OAmBG;IACG,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC;IAQ5D;;;;;;;;;;;;;;;;OAgBG;IACG,sBAAsB,CAC1B,OAAO,EAAE,OAAO,EAChB,QAAQ,GAAE,MAAU,GACnB,OAAO,CAAC,mBAAmB,CAAC;IAQ/B;;;;;;;;;;;;;;;;OAgBG;IACG,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,gCAAgC,CAAC;IAQ9F;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,gBAAgB,CACpB,OAAO,EAAE,OAAO,EAChB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,qBAAqB,CAAC;IAUjC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACG,6BAA6B,CACjC,OAAO,EAAE,OAAO,EAChB,SAAS,GAAE,MAAU,EACrB,OAAO,GAAE,MAAM,GAAG,IAAW,EAC7B,KAAK,GAAE,MAAW,EAClB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GACrB,OAAO,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAc9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,4BAA4B,CAChC,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAW,EAClB,MAAM,GAAE,MAAU,EAClB,KAAK,CAAC,EAAE,MAAM,EAAE,GACf,OAAO,CAAC,qBAAqB,CAAC;CAMlC"}
|
package/dist/methods/sdk.js
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { normalizeAddress, checksumAddresses } from '../utils';
|
|
2
|
-
/**
|
|
3
|
-
* SDK Enablement RPC methods
|
|
4
|
-
* These methods reduce SDK round-trips by consolidating common multi-call patterns
|
|
5
|
-
*/
|
|
6
|
-
export class SdkMethods {
|
|
7
|
-
client;
|
|
8
|
-
constructor(client) {
|
|
9
|
-
this.client = client;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Get a complete profile view combining avatar info, profile data, trust stats, and balances
|
|
13
|
-
*
|
|
14
|
-
* Replaces 6-7 separate RPC calls:
|
|
15
|
-
* - circles_getAvatarInfo
|
|
16
|
-
* - circles_getProfileByAddress
|
|
17
|
-
* - circles_getTrustRelations
|
|
18
|
-
* - circles_getTotalBalance (v1)
|
|
19
|
-
* - circlesV2_getTotalBalance (v2)
|
|
20
|
-
*
|
|
21
|
-
* @param address - Avatar address to query
|
|
22
|
-
* @returns Consolidated profile view with all data
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* ```typescript
|
|
26
|
-
* const profileView = await rpc.sdk.getProfileView('0xde374ece6fa50e781e81aac78e811b33d16912c7');
|
|
27
|
-
* console.log(`${profileView.profile?.name} has ${profileView.trustStats.trustsCount} trusts`);
|
|
28
|
-
* console.log(`V2 Balance: ${profileView.v2Balance}`);
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
async getProfileView(address) {
|
|
32
|
-
const normalizedAddress = normalizeAddress(address);
|
|
33
|
-
return this.client.call('circles_getProfileView', [normalizedAddress]);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Get aggregated trust network summary including mutual trusts and network reach
|
|
37
|
-
*
|
|
38
|
-
* Server-side aggregation reduces client-side processing and provides ready-to-display statistics.
|
|
39
|
-
* Network reach = (trusts ∪ trustedBy).count = trustsCount + trustedByCount - mutualTrustsCount
|
|
40
|
-
*
|
|
41
|
-
* @param address - Avatar address to query
|
|
42
|
-
* @param maxDepth - Maximum network depth to analyze (default: 2)
|
|
43
|
-
* @returns Trust network summary with aggregated metrics
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```typescript
|
|
47
|
-
* const summary = await rpc.sdk.getTrustNetworkSummary('0xde374ece6fa50e781e81aac78e811b33d16912c7');
|
|
48
|
-
* console.log(`Network reach: ${summary.networkReach}`);
|
|
49
|
-
* console.log(`Mutual trusts: ${summary.mutualTrustsCount}`);
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
async getTrustNetworkSummary(address, maxDepth = 2) {
|
|
53
|
-
const normalizedAddress = normalizeAddress(address);
|
|
54
|
-
return this.client.call('circles_getTrustNetworkSummary', [normalizedAddress, maxDepth]);
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Get trust relations categorized by type (mutual, one-way trusts, one-way trusted-by)
|
|
58
|
-
*
|
|
59
|
-
* Replaces client-side categorization + multiple getAvatarInfo calls.
|
|
60
|
-
* Returns relationships organized for easy UI rendering (different icons/colors per type).
|
|
61
|
-
*
|
|
62
|
-
* @param address - Avatar address to query
|
|
63
|
-
* @returns Trust relations categorized with enriched avatar info
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```typescript
|
|
67
|
-
* const relations = await rpc.sdk.getAggregatedTrustRelations('0xde374ece6fa50e781e81aac78e811b33d16912c7');
|
|
68
|
-
* console.log(`Mutual trusts: ${relations.mutual.length}`);
|
|
69
|
-
* console.log(`One-way trusts: ${relations.trusts.length}`);
|
|
70
|
-
* console.log(`Trusted by: ${relations.trustedBy.length}`);
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
73
|
-
async getAggregatedTrustRelations(address) {
|
|
74
|
-
const normalizedAddress = normalizeAddress(address);
|
|
75
|
-
return this.client.call('circles_getAggregatedTrustRelations', [normalizedAddress]);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Get list of addresses that trust you AND have sufficient balance to invite
|
|
79
|
-
*
|
|
80
|
-
* Useful for invitation flows and invitation escrow scenarios.
|
|
81
|
-
* Server-side filtering reduces data transfer and client-side processing.
|
|
82
|
-
*
|
|
83
|
-
* @param address - Avatar address to query
|
|
84
|
-
* @param minimumBalance - Optional minimum balance threshold (as TimeCircles string)
|
|
85
|
-
* @returns List of valid inviters with balances and avatar info
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```typescript
|
|
89
|
-
* // Find all potential inviters
|
|
90
|
-
* const inviters = await rpc.sdk.getValidInviters('0xde374ece6fa50e781e81aac78e811b33d16912c7');
|
|
91
|
-
*
|
|
92
|
-
* // Find inviters with at least 50 CRC balance
|
|
93
|
-
* const richInviters = await rpc.sdk.getValidInviters(
|
|
94
|
-
* '0xde374ece6fa50e781e81aac78e811b33d16912c7',
|
|
95
|
-
* '50.0'
|
|
96
|
-
* );
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
async getValidInviters(address, minimumBalance) {
|
|
100
|
-
const normalizedAddress = normalizeAddress(address);
|
|
101
|
-
const response = await this.client.call('circles_getValidInviters', minimumBalance ? [normalizedAddress, minimumBalance] : [normalizedAddress]);
|
|
102
|
-
return checksumAddresses(response);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Get transaction history with enriched participant profiles and metadata
|
|
106
|
-
*
|
|
107
|
-
* Replaces circles_events + multiple getProfileByAddress calls + client-side event processing.
|
|
108
|
-
* Returns transaction history ready for UI display with participant names and avatars.
|
|
109
|
-
*
|
|
110
|
-
* @param address - Avatar address to query
|
|
111
|
-
* @param fromBlock - Starting block number
|
|
112
|
-
* @param toBlock - Optional ending block number (null for latest)
|
|
113
|
-
* @param limit - Maximum number of transactions (default: 50)
|
|
114
|
-
* @returns Enriched transaction history with participant profiles
|
|
115
|
-
*
|
|
116
|
-
* @example
|
|
117
|
-
* ```typescript
|
|
118
|
-
* const history = await rpc.sdk.getTransactionHistoryEnriched(
|
|
119
|
-
* '0xde374ece6fa50e781e81aac78e811b33d16912c7',
|
|
120
|
-
* 30282299,
|
|
121
|
-
* null,
|
|
122
|
-
* 20
|
|
123
|
-
* );
|
|
124
|
-
*
|
|
125
|
-
* for (const tx of history.transactions) {
|
|
126
|
-
* const from = tx.event.values.from;
|
|
127
|
-
* const fromProfile = tx.participants[from]?.profile;
|
|
128
|
-
* console.log(`From: ${fromProfile?.name || from}`);
|
|
129
|
-
* }
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
|
-
async getTransactionHistoryEnriched(address, fromBlock = 0, toBlock = null, limit = 50, cursor) {
|
|
133
|
-
const normalizedAddress = normalizeAddress(address);
|
|
134
|
-
const response = await this.client.call('circles_getTransactionHistoryEnriched', [normalizedAddress, fromBlock, toBlock, limit, cursor ?? null]);
|
|
135
|
-
return {
|
|
136
|
-
hasMore: response.hasMore,
|
|
137
|
-
nextCursor: response.nextCursor,
|
|
138
|
-
results: checksumAddresses(response.results),
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Unified search across profiles by address prefix OR name/description text
|
|
143
|
-
*
|
|
144
|
-
* Combines address lookup and full-text search in a single endpoint.
|
|
145
|
-
* Automatically detects search type based on query format (0x prefix = address search).
|
|
146
|
-
*
|
|
147
|
-
* @param query - Search query (address prefix or name/description text)
|
|
148
|
-
* @param limit - Maximum number of results (default: 20)
|
|
149
|
-
* @param offset - Pagination offset (default: 0)
|
|
150
|
-
* @param types - Optional array of avatar types to filter by
|
|
151
|
-
* @returns Unified search results with profiles
|
|
152
|
-
*
|
|
153
|
-
* @example
|
|
154
|
-
* ```typescript
|
|
155
|
-
* // Search by name
|
|
156
|
-
* const byName = await rpc.sdk.searchProfileByAddressOrName('Alice');
|
|
157
|
-
*
|
|
158
|
-
* // Search by address prefix
|
|
159
|
-
* const byAddress = await rpc.sdk.searchProfileByAddressOrName('0xde374');
|
|
160
|
-
*
|
|
161
|
-
* // Search with filters
|
|
162
|
-
* const filtered = await rpc.sdk.searchProfileByAddressOrName(
|
|
163
|
-
* 'developer',
|
|
164
|
-
* 10,
|
|
165
|
-
* 0,
|
|
166
|
-
* ['CrcV2_RegisterHuman']
|
|
167
|
-
* );
|
|
168
|
-
* ```
|
|
169
|
-
*/
|
|
170
|
-
async searchProfileByAddressOrName(query, limit = 20, offset = 0, types) {
|
|
171
|
-
return this.client.call('circles_searchProfileByAddressOrName', types ? [query, limit, offset, types] : [query, limit, offset]);
|
|
172
|
-
}
|
|
173
|
-
}
|