@aboutcircles/sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,64 @@
1
+ /**
2
+ * SDK Package Error Types
3
+ */
4
+ import { CirclesError } from '@aboutcircles/sdk-utils';
5
+ /**
6
+ * SDK-specific error sources
7
+ */
8
+ export type SdkErrorSource = 'SDK' | 'SDK_INITIALIZATION' | 'SDK_CONFIG' | 'SDK_OPERATION';
9
+ /**
10
+ * SDK-related errors
11
+ */
12
+ export declare class SdkError extends CirclesError<SdkErrorSource> {
13
+ constructor(message: string, options?: {
14
+ code?: string | number;
15
+ source?: SdkErrorSource;
16
+ cause?: unknown;
17
+ context?: Record<string, any>;
18
+ });
19
+ /**
20
+ * Create error for uninitialized components
21
+ */
22
+ static notInitialized(component: string): SdkError;
23
+ /**
24
+ * Create error for unsupported operations
25
+ */
26
+ static unsupportedOperation(operation: string, reason?: string): SdkError;
27
+ /**
28
+ * Create error for configuration issues
29
+ */
30
+ static configError(message: string, context?: Record<string, any>): SdkError;
31
+ /**
32
+ * Create error for failed operations
33
+ */
34
+ static operationFailed(operation: string, reason: string, cause?: unknown): SdkError;
35
+ /**
36
+ * Create error for missing contract runner
37
+ */
38
+ static missingContractRunner(operation?: string): SdkError;
39
+ /**
40
+ * Create error for avatar not found
41
+ */
42
+ static avatarNotFound(address: string): SdkError;
43
+ /**
44
+ * Create error for invalid profile
45
+ */
46
+ static invalidProfile(reason: string, context?: Record<string, any>): SdkError;
47
+ /**
48
+ * Create error for profile operation failures
49
+ */
50
+ static profileOperationFailed(operation: string, reason: string, cause?: unknown): SdkError;
51
+ /**
52
+ * Create error for insufficient balance
53
+ */
54
+ static insufficientBalance(required: string, available: string, token?: string): SdkError;
55
+ /**
56
+ * Create error for transaction extraction failures
57
+ */
58
+ static transactionDataExtractionFailed(dataType: string, reason?: string): SdkError;
59
+ /**
60
+ * Create error for registration failures
61
+ */
62
+ static registrationFailed(avatarType: string, reason: string, cause?: unknown): SdkError;
63
+ }
64
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,KAAK,GACL,oBAAoB,GACpB,YAAY,GACZ,eAAe,CAAC;AAEpB;;GAEG;AACH,qBAAa,QAAS,SAAQ,YAAY,CAAC,cAAc,CAAC;gBAEtD,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACvB,MAAM,CAAC,EAAE,cAAc,CAAC;QACxB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC/B;IAKH;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,QAAQ;IAQlD;;OAEG;IACH,MAAM,CAAC,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ;IAWzE;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,QAAQ;IAQ5E;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ;IASpF;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ;IAa1D;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ;IAQhD;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,QAAQ;IAQ9E;;OAEG;IACH,MAAM,CAAC,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ;IAS3F;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ;IAazF;;OAEG;IACH,MAAM,CAAC,+BAA+B,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ;IAanF;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ;CAQzF"}
package/dist/errors.js ADDED
@@ -0,0 +1,131 @@
1
+ /**
2
+ * SDK Package Error Types
3
+ */
4
+ import { CirclesError } from '@aboutcircles/sdk-utils';
5
+ /**
6
+ * SDK-related errors
7
+ */
8
+ export class SdkError extends CirclesError {
9
+ constructor(message, options) {
10
+ super('SdkError', message, { ...options, source: options?.source ?? 'SDK' });
11
+ }
12
+ /**
13
+ * Create error for uninitialized components
14
+ */
15
+ static notInitialized(component) {
16
+ return new SdkError(`${component} is not initialized`, {
17
+ code: 'SDK_NOT_INITIALIZED',
18
+ source: 'SDK_INITIALIZATION',
19
+ context: { component },
20
+ });
21
+ }
22
+ /**
23
+ * Create error for unsupported operations
24
+ */
25
+ static unsupportedOperation(operation, reason) {
26
+ return new SdkError(reason ? `Operation '${operation}' is not supported: ${reason}` : `Operation '${operation}' is not supported`, {
27
+ code: 'SDK_UNSUPPORTED_OPERATION',
28
+ source: 'SDK_OPERATION',
29
+ context: { operation, reason },
30
+ });
31
+ }
32
+ /**
33
+ * Create error for configuration issues
34
+ */
35
+ static configError(message, context) {
36
+ return new SdkError(message, {
37
+ code: 'SDK_CONFIG_ERROR',
38
+ source: 'SDK_CONFIG',
39
+ context,
40
+ });
41
+ }
42
+ /**
43
+ * Create error for failed operations
44
+ */
45
+ static operationFailed(operation, reason, cause) {
46
+ return new SdkError(`Operation '${operation}' failed: ${reason}`, {
47
+ code: 'SDK_OPERATION_FAILED',
48
+ source: 'SDK_OPERATION',
49
+ cause,
50
+ context: { operation, reason },
51
+ });
52
+ }
53
+ /**
54
+ * Create error for missing contract runner
55
+ */
56
+ static missingContractRunner(operation) {
57
+ return new SdkError(operation
58
+ ? `${operation} requires a contract runner. Initialize SDK with a ContractRunner.`
59
+ : 'Operation requires a contract runner. Initialize SDK with a ContractRunner.', {
60
+ code: 'SDK_MISSING_CONTRACT_RUNNER',
61
+ source: 'SDK_INITIALIZATION',
62
+ context: { operation },
63
+ });
64
+ }
65
+ /**
66
+ * Create error for avatar not found
67
+ */
68
+ static avatarNotFound(address) {
69
+ return new SdkError(`Avatar not found at address: ${address}`, {
70
+ code: 'SDK_AVATAR_NOT_FOUND',
71
+ source: 'SDK_OPERATION',
72
+ context: { address },
73
+ });
74
+ }
75
+ /**
76
+ * Create error for invalid profile
77
+ */
78
+ static invalidProfile(reason, context) {
79
+ return new SdkError(`Invalid profile: ${reason}`, {
80
+ code: 'SDK_INVALID_PROFILE',
81
+ source: 'SDK_OPERATION',
82
+ context,
83
+ });
84
+ }
85
+ /**
86
+ * Create error for profile operation failures
87
+ */
88
+ static profileOperationFailed(operation, reason, cause) {
89
+ return new SdkError(`Profile ${operation} failed: ${reason}`, {
90
+ code: 'SDK_PROFILE_OPERATION_FAILED',
91
+ source: 'SDK_OPERATION',
92
+ cause,
93
+ context: { operation, reason },
94
+ });
95
+ }
96
+ /**
97
+ * Create error for insufficient balance
98
+ */
99
+ static insufficientBalance(required, available, token) {
100
+ return new SdkError(token
101
+ ? `Insufficient ${token} balance. Required: ${required}, Available: ${available}`
102
+ : `Insufficient balance. Required: ${required}, Available: ${available}`, {
103
+ code: 'SDK_INSUFFICIENT_BALANCE',
104
+ source: 'SDK_OPERATION',
105
+ context: { required, available, token },
106
+ });
107
+ }
108
+ /**
109
+ * Create error for transaction extraction failures
110
+ */
111
+ static transactionDataExtractionFailed(dataType, reason) {
112
+ return new SdkError(reason
113
+ ? `Failed to extract ${dataType} from transaction: ${reason}`
114
+ : `Failed to extract ${dataType} from transaction`, {
115
+ code: 'SDK_TX_DATA_EXTRACTION_FAILED',
116
+ source: 'SDK_OPERATION',
117
+ context: { dataType, reason },
118
+ });
119
+ }
120
+ /**
121
+ * Create error for registration failures
122
+ */
123
+ static registrationFailed(avatarType, reason, cause) {
124
+ return new SdkError(`Failed to register ${avatarType}: ${reason}`, {
125
+ code: 'SDK_REGISTRATION_FAILED',
126
+ source: 'SDK_OPERATION',
127
+ cause,
128
+ context: { avatarType, reason },
129
+ });
130
+ }
131
+ }
@@ -0,0 +1,25 @@
1
+ var __create = Object.create;
2
+ var __getProtoOf = Object.getPrototypeOf;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __toESM = (mod, isNodeMode, target) => {
7
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
8
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
9
+ for (let key of __getOwnPropNames(mod))
10
+ if (!__hasOwnProp.call(to, key))
11
+ __defProp(to, key, {
12
+ get: () => mod[key],
13
+ enumerable: true
14
+ });
15
+ return to;
16
+ };
17
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
18
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
19
+ }) : x)(function(x) {
20
+ if (typeof require !== "undefined")
21
+ return require.apply(this, arguments);
22
+ throw Error('Dynamic require of "' + x + '" is not supported');
23
+ });
24
+
25
+ export { __toESM, __require };
@@ -0,0 +1,356 @@
1
+ // ../../node_modules/@noble/hashes/esm/crypto.js
2
+ var crypto = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : undefined;
3
+
4
+ // ../../node_modules/@noble/hashes/esm/utils.js
5
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
6
+ function isBytes(a) {
7
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
8
+ }
9
+ function anumber(n) {
10
+ if (!Number.isSafeInteger(n) || n < 0)
11
+ throw new Error("positive integer expected, got " + n);
12
+ }
13
+ function abytes(b, ...lengths) {
14
+ if (!isBytes(b))
15
+ throw new Error("Uint8Array expected");
16
+ if (lengths.length > 0 && !lengths.includes(b.length))
17
+ throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
18
+ }
19
+ function ahash(h) {
20
+ if (typeof h !== "function" || typeof h.create !== "function")
21
+ throw new Error("Hash should be wrapped by utils.createHasher");
22
+ anumber(h.outputLen);
23
+ anumber(h.blockLen);
24
+ }
25
+ function aexists(instance, checkFinished = true) {
26
+ if (instance.destroyed)
27
+ throw new Error("Hash instance has been destroyed");
28
+ if (checkFinished && instance.finished)
29
+ throw new Error("Hash#digest() has already been called");
30
+ }
31
+ function aoutput(out, instance) {
32
+ abytes(out);
33
+ const min = instance.outputLen;
34
+ if (out.length < min) {
35
+ throw new Error("digestInto() expects output buffer of length at least " + min);
36
+ }
37
+ }
38
+ function u32(arr) {
39
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
40
+ }
41
+ function clean(...arrays) {
42
+ for (let i = 0;i < arrays.length; i++) {
43
+ arrays[i].fill(0);
44
+ }
45
+ }
46
+ function createView(arr) {
47
+ return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
48
+ }
49
+ function rotr(word, shift) {
50
+ return word << 32 - shift | word >>> shift;
51
+ }
52
+ var isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
53
+ function byteSwap(word) {
54
+ return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
55
+ }
56
+ function byteSwap32(arr) {
57
+ for (let i = 0;i < arr.length; i++) {
58
+ arr[i] = byteSwap(arr[i]);
59
+ }
60
+ return arr;
61
+ }
62
+ var swap32IfBE = isLE ? (u) => u : byteSwap32;
63
+ function utf8ToBytes(str) {
64
+ if (typeof str !== "string")
65
+ throw new Error("string expected");
66
+ return new Uint8Array(new TextEncoder().encode(str));
67
+ }
68
+ function toBytes(data) {
69
+ if (typeof data === "string")
70
+ data = utf8ToBytes(data);
71
+ abytes(data);
72
+ return data;
73
+ }
74
+ function concatBytes(...arrays) {
75
+ let sum = 0;
76
+ for (let i = 0;i < arrays.length; i++) {
77
+ const a = arrays[i];
78
+ abytes(a);
79
+ sum += a.length;
80
+ }
81
+ const res = new Uint8Array(sum);
82
+ for (let i = 0, pad = 0;i < arrays.length; i++) {
83
+ const a = arrays[i];
84
+ res.set(a, pad);
85
+ pad += a.length;
86
+ }
87
+ return res;
88
+ }
89
+ class Hash {
90
+ }
91
+ function createHasher(hashCons) {
92
+ const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
93
+ const tmp = hashCons();
94
+ hashC.outputLen = tmp.outputLen;
95
+ hashC.blockLen = tmp.blockLen;
96
+ hashC.create = () => hashCons();
97
+ return hashC;
98
+ }
99
+ function randomBytes(bytesLength = 32) {
100
+ if (crypto && typeof crypto.getRandomValues === "function") {
101
+ return crypto.getRandomValues(new Uint8Array(bytesLength));
102
+ }
103
+ if (crypto && typeof crypto.randomBytes === "function") {
104
+ return Uint8Array.from(crypto.randomBytes(bytesLength));
105
+ }
106
+ throw new Error("crypto.getRandomValues must be defined");
107
+ }
108
+
109
+ // ../../node_modules/@noble/curves/esm/abstract/utils.js
110
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
111
+ var _0n = /* @__PURE__ */ BigInt(0);
112
+ var _1n = /* @__PURE__ */ BigInt(1);
113
+ function isBytes2(a) {
114
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
115
+ }
116
+ function abytes2(item) {
117
+ if (!isBytes2(item))
118
+ throw new Error("Uint8Array expected");
119
+ }
120
+ function abool(title, value) {
121
+ if (typeof value !== "boolean")
122
+ throw new Error(title + " boolean expected, got " + value);
123
+ }
124
+ function numberToHexUnpadded(num) {
125
+ const hex = num.toString(16);
126
+ return hex.length & 1 ? "0" + hex : hex;
127
+ }
128
+ function hexToNumber(hex) {
129
+ if (typeof hex !== "string")
130
+ throw new Error("hex string expected, got " + typeof hex);
131
+ return hex === "" ? _0n : BigInt("0x" + hex);
132
+ }
133
+ var hasHexBuiltin = typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function";
134
+ var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
135
+ function bytesToHex(bytes) {
136
+ abytes2(bytes);
137
+ if (hasHexBuiltin)
138
+ return bytes.toHex();
139
+ let hex = "";
140
+ for (let i = 0;i < bytes.length; i++) {
141
+ hex += hexes[bytes[i]];
142
+ }
143
+ return hex;
144
+ }
145
+ var asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
146
+ function asciiToBase16(ch) {
147
+ if (ch >= asciis._0 && ch <= asciis._9)
148
+ return ch - asciis._0;
149
+ if (ch >= asciis.A && ch <= asciis.F)
150
+ return ch - (asciis.A - 10);
151
+ if (ch >= asciis.a && ch <= asciis.f)
152
+ return ch - (asciis.a - 10);
153
+ return;
154
+ }
155
+ function hexToBytes(hex) {
156
+ if (typeof hex !== "string")
157
+ throw new Error("hex string expected, got " + typeof hex);
158
+ if (hasHexBuiltin)
159
+ return Uint8Array.fromHex(hex);
160
+ const hl = hex.length;
161
+ const al = hl / 2;
162
+ if (hl % 2)
163
+ throw new Error("hex string expected, got unpadded hex of length " + hl);
164
+ const array = new Uint8Array(al);
165
+ for (let ai = 0, hi = 0;ai < al; ai++, hi += 2) {
166
+ const n1 = asciiToBase16(hex.charCodeAt(hi));
167
+ const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
168
+ if (n1 === undefined || n2 === undefined) {
169
+ const char = hex[hi] + hex[hi + 1];
170
+ throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
171
+ }
172
+ array[ai] = n1 * 16 + n2;
173
+ }
174
+ return array;
175
+ }
176
+ function bytesToNumberBE(bytes) {
177
+ return hexToNumber(bytesToHex(bytes));
178
+ }
179
+ function bytesToNumberLE(bytes) {
180
+ abytes2(bytes);
181
+ return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));
182
+ }
183
+ function numberToBytesBE(n, len) {
184
+ return hexToBytes(n.toString(16).padStart(len * 2, "0"));
185
+ }
186
+ function numberToBytesLE(n, len) {
187
+ return numberToBytesBE(n, len).reverse();
188
+ }
189
+ function ensureBytes(title, hex, expectedLength) {
190
+ let res;
191
+ if (typeof hex === "string") {
192
+ try {
193
+ res = hexToBytes(hex);
194
+ } catch (e) {
195
+ throw new Error(title + " must be hex string or Uint8Array, cause: " + e);
196
+ }
197
+ } else if (isBytes2(hex)) {
198
+ res = Uint8Array.from(hex);
199
+ } else {
200
+ throw new Error(title + " must be hex string or Uint8Array");
201
+ }
202
+ const len = res.length;
203
+ if (typeof expectedLength === "number" && len !== expectedLength)
204
+ throw new Error(title + " of length " + expectedLength + " expected, got " + len);
205
+ return res;
206
+ }
207
+ function concatBytes2(...arrays) {
208
+ let sum = 0;
209
+ for (let i = 0;i < arrays.length; i++) {
210
+ const a = arrays[i];
211
+ abytes2(a);
212
+ sum += a.length;
213
+ }
214
+ const res = new Uint8Array(sum);
215
+ for (let i = 0, pad = 0;i < arrays.length; i++) {
216
+ const a = arrays[i];
217
+ res.set(a, pad);
218
+ pad += a.length;
219
+ }
220
+ return res;
221
+ }
222
+ function utf8ToBytes2(str) {
223
+ if (typeof str !== "string")
224
+ throw new Error("string expected");
225
+ return new Uint8Array(new TextEncoder().encode(str));
226
+ }
227
+ var isPosBig = (n) => typeof n === "bigint" && _0n <= n;
228
+ function inRange(n, min, max) {
229
+ return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;
230
+ }
231
+ function aInRange(title, n, min, max) {
232
+ if (!inRange(n, min, max))
233
+ throw new Error("expected valid " + title + ": " + min + " <= n < " + max + ", got " + n);
234
+ }
235
+ function bitLen(n) {
236
+ let len;
237
+ for (len = 0;n > _0n; n >>= _1n, len += 1)
238
+ ;
239
+ return len;
240
+ }
241
+ var bitMask = (n) => (_1n << BigInt(n)) - _1n;
242
+ var u8n = (len) => new Uint8Array(len);
243
+ var u8fr = (arr) => Uint8Array.from(arr);
244
+ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
245
+ if (typeof hashLen !== "number" || hashLen < 2)
246
+ throw new Error("hashLen must be a number");
247
+ if (typeof qByteLen !== "number" || qByteLen < 2)
248
+ throw new Error("qByteLen must be a number");
249
+ if (typeof hmacFn !== "function")
250
+ throw new Error("hmacFn must be a function");
251
+ let v = u8n(hashLen);
252
+ let k = u8n(hashLen);
253
+ let i = 0;
254
+ const reset = () => {
255
+ v.fill(1);
256
+ k.fill(0);
257
+ i = 0;
258
+ };
259
+ const h = (...b) => hmacFn(k, v, ...b);
260
+ const reseed = (seed = u8n(0)) => {
261
+ k = h(u8fr([0]), seed);
262
+ v = h();
263
+ if (seed.length === 0)
264
+ return;
265
+ k = h(u8fr([1]), seed);
266
+ v = h();
267
+ };
268
+ const gen = () => {
269
+ if (i++ >= 1000)
270
+ throw new Error("drbg: tried 1000 values");
271
+ let len = 0;
272
+ const out = [];
273
+ while (len < qByteLen) {
274
+ v = h();
275
+ const sl = v.slice();
276
+ out.push(sl);
277
+ len += v.length;
278
+ }
279
+ return concatBytes2(...out);
280
+ };
281
+ const genUntil = (seed, pred) => {
282
+ reset();
283
+ reseed(seed);
284
+ let res = undefined;
285
+ while (!(res = pred(gen())))
286
+ reseed();
287
+ reset();
288
+ return res;
289
+ };
290
+ return genUntil;
291
+ }
292
+ var validatorFns = {
293
+ bigint: (val) => typeof val === "bigint",
294
+ function: (val) => typeof val === "function",
295
+ boolean: (val) => typeof val === "boolean",
296
+ string: (val) => typeof val === "string",
297
+ stringOrUint8Array: (val) => typeof val === "string" || isBytes2(val),
298
+ isSafeInteger: (val) => Number.isSafeInteger(val),
299
+ array: (val) => Array.isArray(val),
300
+ field: (val, object) => object.Fp.isValid(val),
301
+ hash: (val) => typeof val === "function" && Number.isSafeInteger(val.outputLen)
302
+ };
303
+ function validateObject(object, validators, optValidators = {}) {
304
+ const checkField = (fieldName, type, isOptional) => {
305
+ const checkVal = validatorFns[type];
306
+ if (typeof checkVal !== "function")
307
+ throw new Error("invalid validator function");
308
+ const val = object[fieldName];
309
+ if (isOptional && val === undefined)
310
+ return;
311
+ if (!checkVal(val, object)) {
312
+ throw new Error("param " + String(fieldName) + " is invalid. Expected " + type + ", got " + val);
313
+ }
314
+ };
315
+ for (const [fieldName, type] of Object.entries(validators))
316
+ checkField(fieldName, type, false);
317
+ for (const [fieldName, type] of Object.entries(optValidators))
318
+ checkField(fieldName, type, true);
319
+ return object;
320
+ }
321
+ function memoized(fn) {
322
+ const map = new WeakMap;
323
+ return (arg, ...args) => {
324
+ const val = map.get(arg);
325
+ if (val !== undefined)
326
+ return val;
327
+ const computed = fn(arg, ...args);
328
+ map.set(arg, computed);
329
+ return computed;
330
+ };
331
+ }
332
+
333
+ // ../../node_modules/@noble/hashes/esm/_u64.js
334
+ var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
335
+ var _32n = /* @__PURE__ */ BigInt(32);
336
+ function fromBig(n, le = false) {
337
+ if (le)
338
+ return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
339
+ return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
340
+ }
341
+ function split(lst, le = false) {
342
+ const len = lst.length;
343
+ let Ah = new Uint32Array(len);
344
+ let Al = new Uint32Array(len);
345
+ for (let i = 0;i < len; i++) {
346
+ const { h, l } = fromBig(lst[i], le);
347
+ [Ah[i], Al[i]] = [h, l];
348
+ }
349
+ return [Ah, Al];
350
+ }
351
+ var rotlSH = (h, l, s) => h << s | l >>> 32 - s;
352
+ var rotlSL = (h, l, s) => l << s | h >>> 32 - s;
353
+ var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
354
+ var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
355
+
356
+ export { split, rotlSH, rotlSL, rotlBH, rotlBL, anumber, abytes, ahash, aexists, aoutput, u32, clean, createView, rotr, swap32IfBE, toBytes, concatBytes, Hash, createHasher, randomBytes, isBytes2 as isBytes, abytes2 as abytes1, abool, numberToHexUnpadded, bytesToHex, hexToBytes, bytesToNumberBE, bytesToNumberLE, numberToBytesBE, numberToBytesLE, ensureBytes, concatBytes2 as concatBytes1, utf8ToBytes2 as utf8ToBytes, inRange, aInRange, bitLen, bitMask, createHmacDrbg, validateObject, memoized };
@@ -0,0 +1,12 @@
1
+ export { Sdk } from './Sdk';
2
+ export { HumanAvatar, OrganisationAvatar, BaseGroupAvatar } from './avatars';
3
+ export type { PathfindingOptions } from './avatars';
4
+ export type { TransactionReceipt } from 'viem';
5
+ import type { HumanAvatar, BaseGroupAvatar, OrganisationAvatar } from './avatars';
6
+ export type Avatar = HumanAvatar | BaseGroupAvatar | OrganisationAvatar;
7
+ export { SdkError } from './errors';
8
+ export type { SdkErrorSource } from './errors';
9
+ export type { AggregatedTrustRelation, TrustRelationType, CirclesEvent, CirclesEventType, Observable, TransactionHistoryRow, SearchResultProfile, GroupTokenHolderRow, } from '@aboutcircles/sdk-rpc';
10
+ export type { AvatarRow, TokenBalanceRow, TrustRelationRow, CirclesQuery, GroupType, ContractRunner } from '@aboutcircles/sdk-types';
11
+ export type { CirclesData } from './types';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC7E,YAAY,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpD,YAAY,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAG/C,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAClF,MAAM,MAAM,MAAM,GAAG,WAAW,GAAG,eAAe,GAAG,kBAAkB,CAAC;AAGxE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,YAAY,EACV,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGrI,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}