@wishknish/knishio-client-ts 0.7.0 → 0.7.1
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/index.cjs +235 -194
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1833 -0
- package/dist/index.d.ts +1833 -0
- package/dist/index.iife.js +238 -181
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +235 -194
- package/dist/index.js.map +1 -1
- package/package.json +5 -7
- package/src/KnishIOClient.ts +183 -231
- package/src/core/Atom.ts +1 -1
- package/src/core/Molecule.ts +0 -1
- package/src/core/Wallet.ts +71 -8
- package/src/libraries/CheckMolecule.ts +3 -3
- package/src/libraries/GraphQLClient.ts +61 -23
- package/src/libraries/array.ts +2 -2
- package/src/libraries/crypto.ts +28 -25
- package/src/libraries/strings.ts +3 -3
- package/src/mutation/MutationProposeMolecule.ts +2 -1
- package/src/query/Query.ts +2 -1
- package/src/query/QueryAtom.ts +4 -3
- package/src/query/QueryBalance.ts +2 -1
- package/src/query/QueryBatch.ts +4 -3
- package/src/query/QueryContinuId.ts +4 -3
- package/src/query/QueryMetaType.ts +4 -3
- package/src/query/QueryMetaTypeViaAtom.ts +4 -3
- package/src/query/QueryWalletBundle.ts +2 -1
- package/src/query/QueryWalletList.ts +4 -3
- package/src/response/EnhancedResponse.ts +19 -24
- package/src/response/Response.ts +3 -3
- package/src/response/ResponseAtom.ts +1 -1
- package/src/response/ResponseAuthorizationGuest.ts +1 -1
- package/src/response/ResponseBalance.ts +1 -1
- package/src/response/ResponseContinuId.ts +1 -1
- package/src/response/ResponseMetaType.ts +1 -1
- package/src/response/ResponseMetaTypeViaAtom.ts +1 -1
- package/src/response/ResponsePolicy.ts +1 -1
- package/src/response/ResponseProposeMolecule.ts +4 -5
- package/src/response/ResponseQueryActiveSession.ts +1 -1
- package/src/response/ResponseQueryUserActivity.ts +1 -1
- package/src/response/ResponseRequestAuthorizationGuest.ts +1 -1
- package/src/response/ResponseTransferTokens.ts +1 -1
- package/src/response/ResponseWalletBundle.ts +1 -1
- package/src/response/ResponseWalletList.ts +1 -1
- package/src/types/graphql.ts +8 -0
- package/src/types/index.ts +2 -7
- package/src/types/response.ts +12 -7
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1833 @@
|
|
|
1
|
+
import { TypedDocumentNode } from '@urql/core';
|
|
2
|
+
|
|
3
|
+
declare const ISOTOPES: readonly ["C", "V", "U", "T", "M", "I", "R", "B", "F"];
|
|
4
|
+
type AtomIsotope = typeof ISOTOPES[number];
|
|
5
|
+
declare const ERROR_TYPES: readonly ["ATOM_INDEX_ERROR", "ATOMS_MISSING_ERROR", "AUTHORIZATION_REJECTED_ERROR", "BALANCE_INSUFFICIENT_ERROR", "BATCH_ID_ERROR", "CODE_ERROR", "DECRYPTION_KEY_ERROR", "INVALID_RESPONSE_ERROR", "META_MISSING_ERROR", "MOLECULAR_HASH_MISMATCH_ERROR", "MOLECULAR_HASH_MISSING_ERROR", "NEGATIVE_AMOUNT_ERROR", "POLICY_INVALID_ERROR", "RULE_ARGUMENT_ERROR", "SIGNATURE_MALFORMED_ERROR", "SIGNATURE_MISMATCH_ERROR", "STACKABLE_UNIT_AMOUNT_ERROR", "STACKABLE_UNIT_DECIMALS_ERROR", "TRANSFER_BALANCE_ERROR", "TRANSFER_MALFORMED_ERROR", "TRANSFER_MISMATCHED_ERROR", "TRANSFER_REMAINDER_ERROR", "TRANSFER_TO_SELF_ERROR", "TRANSFER_UNBALANCED_ERROR", "UNAUTHENTICATED_ERROR", "WALLET_CREDENTIAL_ERROR", "WALLET_SHADOW_ERROR", "WRONG_TOKEN_TYPE_ERROR"];
|
|
6
|
+
type KnishIOErrorType = typeof ERROR_TYPES[number];
|
|
7
|
+
declare const HEX_CHARS: readonly ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
|
|
8
|
+
type HexChar = typeof HEX_CHARS[number];
|
|
9
|
+
declare const BASE17_CHARS: readonly ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g"];
|
|
10
|
+
type Base17Char = typeof BASE17_CHARS[number];
|
|
11
|
+
type HexPattern = `${HexChar}${string}`;
|
|
12
|
+
type Base17Pattern = `${Base17Char}${string}`;
|
|
13
|
+
type WalletAddressPattern = `${HexChar}${HexChar}${string}` & {
|
|
14
|
+
length: 64;
|
|
15
|
+
};
|
|
16
|
+
type BundleHashPattern = `${HexChar}${HexChar}${string}` & {
|
|
17
|
+
length: 64;
|
|
18
|
+
};
|
|
19
|
+
type PositionPattern = `${HexChar}${HexChar}${string}` & {
|
|
20
|
+
length: 64;
|
|
21
|
+
};
|
|
22
|
+
type TokenSlugPattern = `${Uppercase<string>}`;
|
|
23
|
+
|
|
24
|
+
type HashAlgorithm = 'SHAKE256' | 'SHA3-256' | 'BLAKE2B';
|
|
25
|
+
type SignatureAlgorithm = 'XMSS' | 'ML-KEM768' | 'SPHINCS+';
|
|
26
|
+
interface SHAKE256Options {
|
|
27
|
+
input: string | Uint8Array;
|
|
28
|
+
outputLength: number;
|
|
29
|
+
encoding?: 'hex' | 'base64' | 'bytes';
|
|
30
|
+
}
|
|
31
|
+
interface KeyGenerationOptions {
|
|
32
|
+
secret?: string | null;
|
|
33
|
+
token?: TokenSlug | string | null;
|
|
34
|
+
position?: Position | string | null;
|
|
35
|
+
algorithm?: SignatureAlgorithm;
|
|
36
|
+
keyLength?: number;
|
|
37
|
+
}
|
|
38
|
+
interface PrivateKey {
|
|
39
|
+
readonly key: string;
|
|
40
|
+
readonly algorithm: SignatureAlgorithm;
|
|
41
|
+
readonly length: number;
|
|
42
|
+
readonly createdAt: number;
|
|
43
|
+
}
|
|
44
|
+
interface PublicKey {
|
|
45
|
+
readonly key: string;
|
|
46
|
+
readonly address: WalletAddress;
|
|
47
|
+
readonly algorithm: SignatureAlgorithm;
|
|
48
|
+
readonly length: number;
|
|
49
|
+
readonly createdAt: number;
|
|
50
|
+
}
|
|
51
|
+
interface SignatureOptions {
|
|
52
|
+
message: string | Uint8Array;
|
|
53
|
+
privateKey: PrivateKey | string;
|
|
54
|
+
algorithm?: SignatureAlgorithm;
|
|
55
|
+
oneTimeUse?: boolean;
|
|
56
|
+
}
|
|
57
|
+
interface VerificationOptions {
|
|
58
|
+
message: string | Uint8Array;
|
|
59
|
+
signature: string;
|
|
60
|
+
publicKey: PublicKey | string;
|
|
61
|
+
algorithm?: SignatureAlgorithm;
|
|
62
|
+
}
|
|
63
|
+
interface BundleHashOptions {
|
|
64
|
+
secret: string;
|
|
65
|
+
source?: string | null;
|
|
66
|
+
algorithm?: HashAlgorithm;
|
|
67
|
+
}
|
|
68
|
+
interface PositionGenerationOptions {
|
|
69
|
+
entropy?: Uint8Array | null;
|
|
70
|
+
algorithm?: HashAlgorithm;
|
|
71
|
+
length?: number;
|
|
72
|
+
}
|
|
73
|
+
interface SecretGenerationOptions {
|
|
74
|
+
seed?: string | null;
|
|
75
|
+
length?: number;
|
|
76
|
+
algorithm?: HashAlgorithm;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
interface GraphQLRequest$1 {
|
|
80
|
+
query: string;
|
|
81
|
+
variables?: Record<string, unknown>;
|
|
82
|
+
operationName?: string | null;
|
|
83
|
+
}
|
|
84
|
+
interface GraphQLResponse$1<T = unknown> {
|
|
85
|
+
data?: T | null;
|
|
86
|
+
errors?: GraphQLError[] | null;
|
|
87
|
+
extensions?: Record<string, unknown> | null;
|
|
88
|
+
}
|
|
89
|
+
interface GraphQLError {
|
|
90
|
+
message: string;
|
|
91
|
+
locations?: Array<{
|
|
92
|
+
line: number;
|
|
93
|
+
column: number;
|
|
94
|
+
}>;
|
|
95
|
+
path?: Array<string | number>;
|
|
96
|
+
extensions?: Record<string, unknown>;
|
|
97
|
+
}
|
|
98
|
+
interface GraphQLVariables {
|
|
99
|
+
[key: string]: unknown;
|
|
100
|
+
}
|
|
101
|
+
interface QueryOperation<TVariables = GraphQLVariables, TResult = unknown> {
|
|
102
|
+
query(): string;
|
|
103
|
+
variables: TVariables;
|
|
104
|
+
createResponse(data: unknown): TResult;
|
|
105
|
+
getVariables(): TVariables;
|
|
106
|
+
}
|
|
107
|
+
interface MutationOperation<TVariables = GraphQLVariables, TResult = unknown> {
|
|
108
|
+
createRequest(variables: TVariables): GraphQLRequest$1;
|
|
109
|
+
createResponse(data: unknown): TResult;
|
|
110
|
+
fillMolecule?(variables: TVariables): Promise<void>;
|
|
111
|
+
}
|
|
112
|
+
interface GraphQLClient$1 {
|
|
113
|
+
query<TResult = unknown, TVariables = GraphQLVariables>(request: GraphQLRequest$1, variables?: TVariables): Promise<GraphQLResponse$1<TResult>>;
|
|
114
|
+
mutation<TResult = unknown, TVariables = GraphQLVariables>(request: GraphQLRequest$1, variables?: TVariables): Promise<GraphQLResponse$1<TResult>>;
|
|
115
|
+
mutate<TResult = unknown, TVariables = GraphQLVariables>(request: GraphQLRequest$1, variables?: TVariables): Promise<GraphQLResponse$1<TResult>>;
|
|
116
|
+
subscription<TResult = unknown, TVariables = GraphQLVariables>(request: GraphQLRequest$1, variables?: TVariables): AsyncIterableIterator<GraphQLResponse$1<TResult>>;
|
|
117
|
+
getUri(): string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
type WalletAddress = WalletAddressPattern & {
|
|
121
|
+
readonly __brand: 'WalletAddress';
|
|
122
|
+
};
|
|
123
|
+
type BundleHash = BundleHashPattern & {
|
|
124
|
+
readonly __brand: 'BundleHash';
|
|
125
|
+
};
|
|
126
|
+
type Position = PositionPattern & {
|
|
127
|
+
readonly __brand: 'Position';
|
|
128
|
+
};
|
|
129
|
+
type MolecularHash = Base17Pattern & {
|
|
130
|
+
readonly __brand: 'MolecularHash';
|
|
131
|
+
};
|
|
132
|
+
type TokenSlug = TokenSlugPattern & {
|
|
133
|
+
readonly __brand: 'TokenSlug';
|
|
134
|
+
};
|
|
135
|
+
type MetaType = string & {
|
|
136
|
+
readonly __brand: 'MetaType';
|
|
137
|
+
};
|
|
138
|
+
type MetaId = string & {
|
|
139
|
+
readonly __brand: 'MetaId';
|
|
140
|
+
};
|
|
141
|
+
type BatchId = string & {
|
|
142
|
+
readonly __brand: 'BatchId';
|
|
143
|
+
};
|
|
144
|
+
type CellSlug = string & {
|
|
145
|
+
readonly __brand: 'CellSlug';
|
|
146
|
+
};
|
|
147
|
+
type HexString = HexPattern & {
|
|
148
|
+
readonly __hex: true;
|
|
149
|
+
};
|
|
150
|
+
type Base17Hash = Base17Pattern & {
|
|
151
|
+
readonly __base17: true;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
type HttpUrl = `http://${string}`;
|
|
155
|
+
type HttpsUrl = `https://${string}`;
|
|
156
|
+
interface MetaData {
|
|
157
|
+
[key: string]: string | number | boolean | null | MetaData | MetaData[];
|
|
158
|
+
}
|
|
159
|
+
interface AtomMetaData$1 extends MetaData {
|
|
160
|
+
readonly key: string;
|
|
161
|
+
readonly value: string | number | boolean | null;
|
|
162
|
+
}
|
|
163
|
+
interface AtomParams {
|
|
164
|
+
position?: string | null;
|
|
165
|
+
walletAddress?: WalletAddress | null;
|
|
166
|
+
isotope?: AtomIsotope;
|
|
167
|
+
token?: TokenSlug | string;
|
|
168
|
+
value?: string | number | null;
|
|
169
|
+
batchId?: BatchId | string | null;
|
|
170
|
+
metaType?: MetaType | string | null;
|
|
171
|
+
metaId?: MetaId | string | null;
|
|
172
|
+
meta?: AtomMetaData$1[] | null;
|
|
173
|
+
otsFragment?: string | null;
|
|
174
|
+
index?: number | null;
|
|
175
|
+
createdAt?: string | null;
|
|
176
|
+
version?: number | null;
|
|
177
|
+
}
|
|
178
|
+
interface WalletParams {
|
|
179
|
+
secret?: string | null;
|
|
180
|
+
bundle?: BundleHash | string | null;
|
|
181
|
+
token?: TokenSlug | string;
|
|
182
|
+
address?: WalletAddress | string | null;
|
|
183
|
+
position?: Position | string | null;
|
|
184
|
+
batchId?: BatchId | string | null;
|
|
185
|
+
characters?: string | null;
|
|
186
|
+
}
|
|
187
|
+
interface MoleculeParams {
|
|
188
|
+
secret?: string | null;
|
|
189
|
+
bundle?: BundleHash | string | null;
|
|
190
|
+
sourceWallet?: WalletParams | null;
|
|
191
|
+
remainderWallet?: WalletParams | null;
|
|
192
|
+
cellSlug?: CellSlug | string | null;
|
|
193
|
+
version?: number;
|
|
194
|
+
}
|
|
195
|
+
interface KnishIOClientConfig {
|
|
196
|
+
readonly uri?: HttpUrl | HttpsUrl | readonly (HttpUrl | HttpsUrl)[];
|
|
197
|
+
readonly cellSlug?: CellSlug | string | null;
|
|
198
|
+
readonly client?: unknown | null;
|
|
199
|
+
readonly socket?: unknown | null;
|
|
200
|
+
readonly serverSdkVersion?: 3 | 4 | 5;
|
|
201
|
+
readonly logging?: boolean;
|
|
202
|
+
readonly timeout?: number;
|
|
203
|
+
readonly retryAttempts?: number;
|
|
204
|
+
}
|
|
205
|
+
interface AuthParams {
|
|
206
|
+
cellSlug?: CellSlug | string | null;
|
|
207
|
+
encrypt?: boolean;
|
|
208
|
+
callback?: (response: unknown) => void;
|
|
209
|
+
}
|
|
210
|
+
interface TransferParams {
|
|
211
|
+
recipient: WalletAddress | string;
|
|
212
|
+
amount: number | string;
|
|
213
|
+
token?: TokenSlug | string;
|
|
214
|
+
callbackUrl?: string | null;
|
|
215
|
+
metaType?: MetaType | string | null;
|
|
216
|
+
metaId?: MetaId | string | null;
|
|
217
|
+
meta?: MetaData | null;
|
|
218
|
+
}
|
|
219
|
+
interface CreateTokenParams {
|
|
220
|
+
token: TokenSlug | string;
|
|
221
|
+
amount: number | string;
|
|
222
|
+
metaType?: MetaType | string | null;
|
|
223
|
+
metaId?: MetaId | string | null;
|
|
224
|
+
meta?: MetaData | null;
|
|
225
|
+
fungible?: boolean;
|
|
226
|
+
splittable?: number;
|
|
227
|
+
supplyToken?: TokenSlug | string | null;
|
|
228
|
+
}
|
|
229
|
+
interface RequestTokensParams {
|
|
230
|
+
amount: number | string;
|
|
231
|
+
token?: TokenSlug | string;
|
|
232
|
+
metaType?: MetaType | string | null;
|
|
233
|
+
metaId?: MetaId | string | null;
|
|
234
|
+
meta?: MetaData | null;
|
|
235
|
+
}
|
|
236
|
+
interface BalanceQueryParams {
|
|
237
|
+
address?: WalletAddress | string | null;
|
|
238
|
+
bundleHash?: BundleHash | string | null;
|
|
239
|
+
token?: TokenSlug | string | null;
|
|
240
|
+
type?: 'token' | 'user' | null;
|
|
241
|
+
}
|
|
242
|
+
interface MetaQueryParams {
|
|
243
|
+
metaType: MetaType | string;
|
|
244
|
+
metaId?: MetaId | string | null;
|
|
245
|
+
key?: string | null;
|
|
246
|
+
value?: string | null;
|
|
247
|
+
latest?: boolean | null;
|
|
248
|
+
filter?: string | null;
|
|
249
|
+
queryArgs?: Record<string, unknown> | null;
|
|
250
|
+
count?: number | null;
|
|
251
|
+
countBy?: string | null;
|
|
252
|
+
cellSlug?: CellSlug | string | null;
|
|
253
|
+
}
|
|
254
|
+
interface WalletQueryParams {
|
|
255
|
+
bundleHash?: BundleHash | string | null;
|
|
256
|
+
tokenSlug?: TokenSlug | string | null;
|
|
257
|
+
unspent?: boolean | null;
|
|
258
|
+
}
|
|
259
|
+
interface BaseResponse<T = unknown> {
|
|
260
|
+
success(): boolean;
|
|
261
|
+
reason(): string | null;
|
|
262
|
+
data(): T | null;
|
|
263
|
+
payload(): Record<string, unknown> | null;
|
|
264
|
+
}
|
|
265
|
+
interface ValidationResult$1 {
|
|
266
|
+
valid: boolean;
|
|
267
|
+
error?: string | null;
|
|
268
|
+
expected?: string;
|
|
269
|
+
actual?: unknown;
|
|
270
|
+
}
|
|
271
|
+
interface GraphQLRequest {
|
|
272
|
+
query: string;
|
|
273
|
+
variables?: Record<string, unknown>;
|
|
274
|
+
operationName?: string | null;
|
|
275
|
+
}
|
|
276
|
+
interface GraphQLResponse<T = unknown> {
|
|
277
|
+
data?: T | null;
|
|
278
|
+
errors?: Array<{
|
|
279
|
+
message: string;
|
|
280
|
+
locations?: Array<{
|
|
281
|
+
line: number;
|
|
282
|
+
column: number;
|
|
283
|
+
}>;
|
|
284
|
+
path?: Array<string | number>;
|
|
285
|
+
extensions?: Record<string, unknown>;
|
|
286
|
+
}> | null;
|
|
287
|
+
extensions?: Record<string, unknown>;
|
|
288
|
+
}
|
|
289
|
+
interface ErrorContext {
|
|
290
|
+
readonly operation?: string;
|
|
291
|
+
readonly parameters?: Record<string, unknown>;
|
|
292
|
+
readonly timestamp?: number;
|
|
293
|
+
readonly stack?: string;
|
|
294
|
+
readonly reason?: string;
|
|
295
|
+
readonly expiresAt?: number;
|
|
296
|
+
readonly credentialType?: string;
|
|
297
|
+
readonly field?: string;
|
|
298
|
+
readonly value?: unknown;
|
|
299
|
+
readonly expected?: string;
|
|
300
|
+
readonly actual?: unknown;
|
|
301
|
+
readonly code?: string;
|
|
302
|
+
readonly severity?: 'low' | 'medium' | 'high';
|
|
303
|
+
readonly recoverable?: boolean;
|
|
304
|
+
readonly retryable?: boolean;
|
|
305
|
+
readonly [key: string]: unknown;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
declare global {
|
|
309
|
+
interface String {
|
|
310
|
+
toCamelCase(): string;
|
|
311
|
+
toSnakeCase(): string;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
declare function isHexString(value: string): value is HexString;
|
|
315
|
+
declare function isWalletAddress(value: string): value is WalletAddress;
|
|
316
|
+
declare function isBundleHash(value: string): value is BundleHash;
|
|
317
|
+
declare function isPosition(value: string): value is Position;
|
|
318
|
+
declare function isMolecularHash(value: string): value is MolecularHash;
|
|
319
|
+
declare function isAtomIsotope(value: string): value is AtomIsotope;
|
|
320
|
+
declare function createWalletAddress(value: string): WalletAddress;
|
|
321
|
+
declare function createBundleHash(value: string): BundleHash;
|
|
322
|
+
declare function createPosition(value: string): Position;
|
|
323
|
+
declare function createTokenSlug(value: string): TokenSlug;
|
|
324
|
+
declare function createMolecularHash(value: string): MolecularHash;
|
|
325
|
+
|
|
326
|
+
interface AtomMetaData {
|
|
327
|
+
readonly key: string;
|
|
328
|
+
readonly value: string | number | boolean | null;
|
|
329
|
+
readonly [additionalProps: string]: unknown;
|
|
330
|
+
}
|
|
331
|
+
interface AtomCreationParams extends AtomParams {
|
|
332
|
+
version?: number;
|
|
333
|
+
}
|
|
334
|
+
interface AtomHashableData {
|
|
335
|
+
position: string;
|
|
336
|
+
walletAddress: string;
|
|
337
|
+
isotope: AtomIsotope;
|
|
338
|
+
token: string;
|
|
339
|
+
value: string | null;
|
|
340
|
+
batchId: string | null;
|
|
341
|
+
metaType: string | null;
|
|
342
|
+
metaId: string | null;
|
|
343
|
+
meta: AtomMetaData[] | null;
|
|
344
|
+
createdAt: string;
|
|
345
|
+
index: number;
|
|
346
|
+
}
|
|
347
|
+
declare class Atom {
|
|
348
|
+
position: string;
|
|
349
|
+
walletAddress: WalletAddress | string;
|
|
350
|
+
isotope: AtomIsotope;
|
|
351
|
+
token: TokenSlug | string;
|
|
352
|
+
value: string | number | null;
|
|
353
|
+
batchId: BatchId | string | null;
|
|
354
|
+
metaType: MetaType | string | null;
|
|
355
|
+
metaId: MetaId | string | null;
|
|
356
|
+
meta: AtomMetaData[];
|
|
357
|
+
otsFragment: string | null;
|
|
358
|
+
index: number | null;
|
|
359
|
+
createdAt: string;
|
|
360
|
+
version: number;
|
|
361
|
+
constructor({ position, walletAddress, isotope, token, value, batchId, metaType, metaId, meta, otsFragment, index, createdAt, version }?: AtomCreationParams);
|
|
362
|
+
aggregatedMeta(): Record<string, unknown>;
|
|
363
|
+
getHashableValues(): string[];
|
|
364
|
+
getStructuredData(): AtomHashableData;
|
|
365
|
+
toJSON(options?: {
|
|
366
|
+
includeOtsFragments?: boolean;
|
|
367
|
+
validateFields?: boolean;
|
|
368
|
+
}): AtomHashableData & {
|
|
369
|
+
otsFragment?: string | null;
|
|
370
|
+
};
|
|
371
|
+
clone(): Atom;
|
|
372
|
+
isValid(): boolean;
|
|
373
|
+
static getHashableProps(): string[];
|
|
374
|
+
static getUnclaimedProps(): string[];
|
|
375
|
+
static create(params: AtomCreationParams): Atom;
|
|
376
|
+
static fromJSON(json: string | Record<string, unknown>, options?: {
|
|
377
|
+
validateStructure?: boolean;
|
|
378
|
+
strictMode?: boolean;
|
|
379
|
+
}): Atom;
|
|
380
|
+
static jsonToObject(jsonData: Record<string, unknown>): Atom;
|
|
381
|
+
static hashAtoms({ atoms }: {
|
|
382
|
+
atoms: Atom[];
|
|
383
|
+
}): string;
|
|
384
|
+
static sortAtoms(atoms: Atom[]): Atom[];
|
|
385
|
+
static generateNextAtomIndex(atoms: Atom[]): number;
|
|
386
|
+
static isotopeFilter(isotopes: AtomIsotope | AtomIsotope[], atoms: Atom[]): Atom[];
|
|
387
|
+
static validateAtom(atom: unknown): atom is Atom;
|
|
388
|
+
static isIsotope(atom: Atom, isotope: AtomIsotope): boolean;
|
|
389
|
+
static getUniqueIsotopes(atoms: Atom[]): AtomIsotope[];
|
|
390
|
+
static calculateTotalValue(atoms: Atom[]): number;
|
|
391
|
+
static groupByIsotope(atoms: Atom[]): Record<AtomIsotope, Atom[]>;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
interface NormalizedMeta {
|
|
395
|
+
key: string;
|
|
396
|
+
value: string | number | boolean | null;
|
|
397
|
+
[additionalProps: string]: unknown;
|
|
398
|
+
}
|
|
399
|
+
interface MetaItem {
|
|
400
|
+
key: string;
|
|
401
|
+
value: unknown;
|
|
402
|
+
[props: string]: unknown;
|
|
403
|
+
}
|
|
404
|
+
interface AggregatedMetaResult {
|
|
405
|
+
[key: string]: unknown;
|
|
406
|
+
}
|
|
407
|
+
declare class Meta {
|
|
408
|
+
static normalizeMeta(meta: MetaData | MetaItem[] | null): NormalizedMeta[];
|
|
409
|
+
static aggregateMeta(metaItems: NormalizedMeta[] | MetaItem[] | null): AggregatedMetaResult;
|
|
410
|
+
static mergeMeta(...metaArrays: (NormalizedMeta[] | MetaItem[] | null)[]): NormalizedMeta[];
|
|
411
|
+
static filterMeta(metaItems: NormalizedMeta[] | MetaItem[] | null, filter: string | RegExp | ((item: NormalizedMeta) => boolean)): NormalizedMeta[];
|
|
412
|
+
static findMeta(metaItems: NormalizedMeta[] | MetaItem[] | null, key: string): NormalizedMeta | null;
|
|
413
|
+
static getMetaValue(metaItems: NormalizedMeta[] | MetaItem[] | null, key: string, defaultValue?: unknown): unknown;
|
|
414
|
+
static setMeta(metaItems: NormalizedMeta[] | MetaItem[] | null, key: string, value: unknown): NormalizedMeta[];
|
|
415
|
+
static removeMeta(metaItems: NormalizedMeta[] | MetaItem[] | null, key: string): NormalizedMeta[];
|
|
416
|
+
static toJSON(metaItems: NormalizedMeta[] | MetaItem[] | null): Record<string, unknown>;
|
|
417
|
+
static fromJSON(jsonData: Record<string, unknown>): NormalizedMeta[];
|
|
418
|
+
static validateMeta(metaItems: unknown): metaItems is NormalizedMeta[];
|
|
419
|
+
static getKeys(metaItems: NormalizedMeta[] | MetaItem[] | null): string[];
|
|
420
|
+
static hasKey(metaItems: NormalizedMeta[] | MetaItem[] | null, key: string): boolean;
|
|
421
|
+
static getStats(metaItems: NormalizedMeta[] | MetaItem[] | null): {
|
|
422
|
+
totalItems: number;
|
|
423
|
+
uniqueKeys: number;
|
|
424
|
+
keys: string[];
|
|
425
|
+
valueTypes: Record<string, number>;
|
|
426
|
+
};
|
|
427
|
+
static clone(metaItems: NormalizedMeta[] | MetaItem[] | null): NormalizedMeta[];
|
|
428
|
+
static sort(metaItems: NormalizedMeta[] | MetaItem[] | null, descending?: boolean): NormalizedMeta[];
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
declare class AtomMeta {
|
|
432
|
+
private meta;
|
|
433
|
+
constructor(meta?: Record<string, any> | NormalizedMeta[] | null);
|
|
434
|
+
merge(meta: Record<string, any> | NormalizedMeta[]): AtomMeta;
|
|
435
|
+
addContext(context?: string | null): AtomMeta;
|
|
436
|
+
setAtomWallet(wallet: any): AtomMeta;
|
|
437
|
+
setMetaWallet(wallet: any): AtomMeta;
|
|
438
|
+
setShadowWalletClaim(shadowWalletClaim: boolean | number): AtomMeta;
|
|
439
|
+
setSigningWallet(signingWallet: any): AtomMeta;
|
|
440
|
+
addPolicy(policy: Record<string, any>): AtomMeta;
|
|
441
|
+
get(): NormalizedMeta[];
|
|
442
|
+
toObject(): Record<string, any>;
|
|
443
|
+
toJSON(): string;
|
|
444
|
+
getValue(key: string, defaultValue?: any): any;
|
|
445
|
+
hasKey(key: string): boolean;
|
|
446
|
+
remove(key: string): AtomMeta;
|
|
447
|
+
clear(): AtomMeta;
|
|
448
|
+
count(): number;
|
|
449
|
+
clone(): AtomMeta;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
declare class Wallet {
|
|
453
|
+
token: string;
|
|
454
|
+
balance: number;
|
|
455
|
+
address: string | null;
|
|
456
|
+
position: string | null;
|
|
457
|
+
bundle: string | null;
|
|
458
|
+
batchId: string | null;
|
|
459
|
+
characters: string | null;
|
|
460
|
+
key: string | null;
|
|
461
|
+
privkey: any;
|
|
462
|
+
pubkey: any;
|
|
463
|
+
tokenUnits: any[];
|
|
464
|
+
tradeRates: Record<string, any>;
|
|
465
|
+
molecules: Record<string, any>;
|
|
466
|
+
tokenName?: string;
|
|
467
|
+
tokenAmount?: string;
|
|
468
|
+
tokenSupply?: string;
|
|
469
|
+
tokenFungibility?: string;
|
|
470
|
+
createdAt?: string;
|
|
471
|
+
constructor({ secret, bundle, token, address, position, batchId, characters }?: {
|
|
472
|
+
secret?: string | null;
|
|
473
|
+
bundle?: string | null;
|
|
474
|
+
token?: string;
|
|
475
|
+
address?: string | null;
|
|
476
|
+
position?: string | null;
|
|
477
|
+
batchId?: string | null;
|
|
478
|
+
characters?: string | null;
|
|
479
|
+
});
|
|
480
|
+
static create({ secret, bundle, token, batchId, characters }: {
|
|
481
|
+
secret?: string | null;
|
|
482
|
+
bundle?: string | null;
|
|
483
|
+
token?: string;
|
|
484
|
+
batchId?: string | null;
|
|
485
|
+
characters?: string | null;
|
|
486
|
+
}): Wallet;
|
|
487
|
+
static generateKey({ secret, token, position }: {
|
|
488
|
+
secret: string;
|
|
489
|
+
token: string;
|
|
490
|
+
position: string;
|
|
491
|
+
}): string;
|
|
492
|
+
static generateAddress(key: string): string;
|
|
493
|
+
static generatePosition(saltLength?: number): string;
|
|
494
|
+
static isBundleHash(maybeBundleHash: unknown): maybeBundleHash is string;
|
|
495
|
+
static getTokenUnits(unitsData: any[]): any[];
|
|
496
|
+
createRemainder(secret: string): Wallet;
|
|
497
|
+
initBatchId({ sourceWallet, isRemainder }: {
|
|
498
|
+
sourceWallet: Wallet;
|
|
499
|
+
isRemainder?: boolean;
|
|
500
|
+
}): void;
|
|
501
|
+
splitUnits(units: string[], remainderWallet: Wallet, recipientWallet?: Wallet | null): void;
|
|
502
|
+
getTokenUnitsData(): any[];
|
|
503
|
+
isShadow(): boolean;
|
|
504
|
+
initializeMLKEM(): void;
|
|
505
|
+
encryptMessage(message: any, recipientPubkey: string): Promise<{
|
|
506
|
+
cipherText: string;
|
|
507
|
+
encryptedMessage: string;
|
|
508
|
+
}>;
|
|
509
|
+
decryptMessage(encryptedData: {
|
|
510
|
+
cipherText: string;
|
|
511
|
+
encryptedMessage: string;
|
|
512
|
+
}): Promise<any>;
|
|
513
|
+
private encryptWithSharedSecret;
|
|
514
|
+
private decryptWithSharedSecret;
|
|
515
|
+
serializeKey(key: Uint8Array): string;
|
|
516
|
+
deserializeKey(serializedKey: string): Uint8Array;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
declare class Molecule {
|
|
520
|
+
status: string | null;
|
|
521
|
+
molecularHash: string | null;
|
|
522
|
+
createdAt: string;
|
|
523
|
+
cellSlugOrigin: string | null;
|
|
524
|
+
cellSlug: string | null;
|
|
525
|
+
secret: string | null;
|
|
526
|
+
bundle: string | null;
|
|
527
|
+
sourceWallet: Wallet | null;
|
|
528
|
+
remainderWallet: Wallet | null;
|
|
529
|
+
atoms: Atom[];
|
|
530
|
+
version: string | null;
|
|
531
|
+
local?: number;
|
|
532
|
+
constructor({ secret, bundle, sourceWallet, remainderWallet, cellSlug, version }?: {
|
|
533
|
+
secret?: string | null;
|
|
534
|
+
bundle?: string | null;
|
|
535
|
+
sourceWallet?: Wallet | null;
|
|
536
|
+
remainderWallet?: Wallet | null;
|
|
537
|
+
cellSlug?: string | null;
|
|
538
|
+
version?: string | number | null;
|
|
539
|
+
});
|
|
540
|
+
get cellSlugDelimiter(): string;
|
|
541
|
+
getIsotopes(isotopes: AtomIsotope | AtomIsotope[]): Atom[];
|
|
542
|
+
static isotopeFilter(isotopes: AtomIsotope | AtomIsotope[], atoms: Atom[]): Atom[];
|
|
543
|
+
static generateNextAtomIndex(atoms: Atom[]): number;
|
|
544
|
+
generateIndex(): number;
|
|
545
|
+
addAtom(atom: Atom): Molecule;
|
|
546
|
+
addContinuIdAtom(): Molecule;
|
|
547
|
+
initValue({ recipientWallet, amount }: {
|
|
548
|
+
recipientWallet: Wallet;
|
|
549
|
+
amount: number;
|
|
550
|
+
}): Molecule;
|
|
551
|
+
sign({ bundle, anonymous, compressed }?: {
|
|
552
|
+
bundle?: string | null;
|
|
553
|
+
anonymous?: boolean;
|
|
554
|
+
compressed?: boolean;
|
|
555
|
+
}): string | null;
|
|
556
|
+
check(senderWallet?: Wallet | null): boolean;
|
|
557
|
+
normalizedHash(): number[];
|
|
558
|
+
static enumerate(hash: string): number[];
|
|
559
|
+
static normalize(mappedHashArray: number[]): number[];
|
|
560
|
+
toJSON(options?: {
|
|
561
|
+
includeValidationContext?: boolean;
|
|
562
|
+
includeOtsFragments?: boolean;
|
|
563
|
+
secureMode?: boolean;
|
|
564
|
+
}): any;
|
|
565
|
+
cellSlugBase(): string;
|
|
566
|
+
initTokenCreation({ recipientWallet, amount, meta }: {
|
|
567
|
+
recipientWallet: Wallet;
|
|
568
|
+
amount: number;
|
|
569
|
+
meta: any;
|
|
570
|
+
}): Molecule;
|
|
571
|
+
burnToken({ amount, walletBundle }: {
|
|
572
|
+
amount: number;
|
|
573
|
+
walletBundle?: string | null;
|
|
574
|
+
}): Molecule;
|
|
575
|
+
initMeta({ meta, metaType, metaId, policy }: {
|
|
576
|
+
meta: any;
|
|
577
|
+
metaType: string;
|
|
578
|
+
metaId: string;
|
|
579
|
+
policy?: any;
|
|
580
|
+
}): Molecule;
|
|
581
|
+
initWalletCreation(wallet: Wallet, atomMeta?: AtomMeta | null): Molecule;
|
|
582
|
+
static fromJSON(json: string | any, options?: {
|
|
583
|
+
includeValidationContext?: boolean;
|
|
584
|
+
validateStructure?: boolean;
|
|
585
|
+
strictMode?: boolean;
|
|
586
|
+
}): Molecule;
|
|
587
|
+
static jsonToObject(json: string): Molecule;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
interface MoleculeStructure {
|
|
591
|
+
molecularHash: string | null;
|
|
592
|
+
atoms: Atom[];
|
|
593
|
+
status?: string | null;
|
|
594
|
+
createdAt?: string;
|
|
595
|
+
cellSlug?: string | null;
|
|
596
|
+
cellSlugOrigin?: string | null;
|
|
597
|
+
bundle?: string | null;
|
|
598
|
+
getIsotopes(isotope: string): Atom[];
|
|
599
|
+
normalizedHash(): number[];
|
|
600
|
+
}
|
|
601
|
+
declare class CheckMolecule {
|
|
602
|
+
private molecule;
|
|
603
|
+
constructor(molecule: MoleculeStructure);
|
|
604
|
+
verify(senderWallet?: Wallet | null): boolean;
|
|
605
|
+
continuId(): boolean;
|
|
606
|
+
batchId(): boolean;
|
|
607
|
+
isotopeI(): boolean;
|
|
608
|
+
isotopeU(): boolean;
|
|
609
|
+
isotopeM(): boolean;
|
|
610
|
+
isotopeC(): boolean;
|
|
611
|
+
isotopeT(): boolean;
|
|
612
|
+
isotopeR(): boolean;
|
|
613
|
+
isotopeV(senderWallet?: Wallet | null): boolean;
|
|
614
|
+
molecularHash(): boolean;
|
|
615
|
+
ots(): boolean;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
declare class Dot {
|
|
619
|
+
private static arr;
|
|
620
|
+
private static key;
|
|
621
|
+
private static __nextKey;
|
|
622
|
+
private static __next;
|
|
623
|
+
private static __init;
|
|
624
|
+
private static __tic;
|
|
625
|
+
static has(obj: any, keys: string): boolean;
|
|
626
|
+
static get(obj: any, keys: string, defaultValue?: any): any;
|
|
627
|
+
static set(obj: any, keys: string, value: any): any;
|
|
628
|
+
static delete(obj: any, keys: string): boolean;
|
|
629
|
+
static flatten(obj: any, prefix?: string): Record<string, any>;
|
|
630
|
+
static expand(obj: Record<string, any>): any;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
declare function deepCloning<T>(o: T, h?: any[]): T;
|
|
634
|
+
declare function chunkArray<T>(arr: T[], size: number): T[][];
|
|
635
|
+
declare function diff<T>(...arrays: T[][]): T[];
|
|
636
|
+
declare function intersect<T>(...arrays: T[][]): T[];
|
|
637
|
+
|
|
638
|
+
declare class GraphQLClient implements GraphQLClient$1 {
|
|
639
|
+
private $__client;
|
|
640
|
+
private $__authToken;
|
|
641
|
+
private $__pubkey;
|
|
642
|
+
private $__wallet;
|
|
643
|
+
private serverUri;
|
|
644
|
+
private socketUri;
|
|
645
|
+
private cipherLink;
|
|
646
|
+
private $__subscriptionManager;
|
|
647
|
+
constructor({ serverUri, socket, encrypt }: {
|
|
648
|
+
serverUri: string;
|
|
649
|
+
socket?: {
|
|
650
|
+
socketUri: string | null;
|
|
651
|
+
appKey?: string;
|
|
652
|
+
} | null;
|
|
653
|
+
encrypt?: boolean;
|
|
654
|
+
});
|
|
655
|
+
private createUrqlClient;
|
|
656
|
+
setAuthData({ token, pubkey, wallet }: {
|
|
657
|
+
token: string;
|
|
658
|
+
pubkey: string;
|
|
659
|
+
wallet?: Wallet;
|
|
660
|
+
}): void;
|
|
661
|
+
query<TResult = unknown, TVariables = GraphQLVariables>(request: GraphQLRequest, variables?: TVariables): Promise<GraphQLResponse<TResult>>;
|
|
662
|
+
mutation<TResult = unknown, TVariables = GraphQLVariables>(request: GraphQLRequest, variables?: TVariables): Promise<GraphQLResponse<TResult>>;
|
|
663
|
+
mutate<TResult = unknown, TVariables = GraphQLVariables>(request: GraphQLRequest, variables?: TVariables): Promise<GraphQLResponse<TResult>>;
|
|
664
|
+
subscription<TResult = unknown, TVariables = GraphQLVariables>(request: GraphQLRequest, variables?: TVariables): AsyncIterableIterator<GraphQLResponse<TResult>>;
|
|
665
|
+
subscribe(request: {
|
|
666
|
+
query: string;
|
|
667
|
+
variables?: Record<string, any>;
|
|
668
|
+
operationName?: string;
|
|
669
|
+
}, callback: (result: any) => void): {
|
|
670
|
+
unsubscribe: () => void;
|
|
671
|
+
};
|
|
672
|
+
private formatResponse;
|
|
673
|
+
unsubscribe(operationName: string): void;
|
|
674
|
+
unsubscribeAll(): void;
|
|
675
|
+
setEncryption(encrypt?: boolean): void;
|
|
676
|
+
getAuthToken(): string;
|
|
677
|
+
getPubKey(): string | null;
|
|
678
|
+
getWallet(): Wallet | null;
|
|
679
|
+
getServerUri(): string;
|
|
680
|
+
getSocketUri(): string | null;
|
|
681
|
+
getUri(): string;
|
|
682
|
+
setUri(uri: string): void;
|
|
683
|
+
socketDisconnect(): void;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
declare class AuthToken {
|
|
687
|
+
private $__token;
|
|
688
|
+
private $__expiresAt;
|
|
689
|
+
private $__pubkey;
|
|
690
|
+
private $__encrypt;
|
|
691
|
+
private $__wallet?;
|
|
692
|
+
constructor({ token, expiresAt, encrypt, pubkey }: {
|
|
693
|
+
token: string;
|
|
694
|
+
expiresAt: number;
|
|
695
|
+
encrypt: boolean;
|
|
696
|
+
pubkey: string;
|
|
697
|
+
});
|
|
698
|
+
static create(data: {
|
|
699
|
+
token: string;
|
|
700
|
+
expiresAt: number;
|
|
701
|
+
encrypt: boolean;
|
|
702
|
+
pubkey: string;
|
|
703
|
+
}, wallet: Wallet): AuthToken;
|
|
704
|
+
static restore(snapshot: {
|
|
705
|
+
token: string;
|
|
706
|
+
expiresAt: number;
|
|
707
|
+
pubkey: string;
|
|
708
|
+
encrypt: boolean;
|
|
709
|
+
wallet: {
|
|
710
|
+
position: string;
|
|
711
|
+
characters: string | null;
|
|
712
|
+
};
|
|
713
|
+
}, secret: string): AuthToken;
|
|
714
|
+
setWallet(wallet: Wallet): void;
|
|
715
|
+
getWallet(): Wallet | undefined;
|
|
716
|
+
getToken(): string;
|
|
717
|
+
getExpiresAt(): number;
|
|
718
|
+
getPubkey(): string;
|
|
719
|
+
isEncrypted(): boolean;
|
|
720
|
+
isExpired(): boolean;
|
|
721
|
+
getAuthData(): {
|
|
722
|
+
token: string;
|
|
723
|
+
pubkey: string;
|
|
724
|
+
wallet: Wallet | undefined;
|
|
725
|
+
};
|
|
726
|
+
toSnapshot(): {
|
|
727
|
+
token: string;
|
|
728
|
+
expiresAt: number;
|
|
729
|
+
pubkey: string;
|
|
730
|
+
encrypt: boolean;
|
|
731
|
+
wallet?: {
|
|
732
|
+
position: string | null;
|
|
733
|
+
characters: string | null;
|
|
734
|
+
};
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
interface UniversalResponse<T> {
|
|
739
|
+
success(): boolean;
|
|
740
|
+
payload(): T | null;
|
|
741
|
+
reason(): string | null;
|
|
742
|
+
data(): any;
|
|
743
|
+
}
|
|
744
|
+
interface ValidationResult<T> {
|
|
745
|
+
success: boolean;
|
|
746
|
+
data?: T;
|
|
747
|
+
error?: {
|
|
748
|
+
message: string;
|
|
749
|
+
details?: string[];
|
|
750
|
+
code?: string;
|
|
751
|
+
context?: Record<string, any>;
|
|
752
|
+
timestamp?: string;
|
|
753
|
+
operation?: string;
|
|
754
|
+
};
|
|
755
|
+
warnings?: string[];
|
|
756
|
+
}
|
|
757
|
+
interface ResponseError {
|
|
758
|
+
message: string;
|
|
759
|
+
code?: string | undefined;
|
|
760
|
+
details?: any;
|
|
761
|
+
context?: string | Record<string, any> | undefined;
|
|
762
|
+
timestamp?: string | undefined;
|
|
763
|
+
operation?: string | undefined;
|
|
764
|
+
}
|
|
765
|
+
interface EnhancedResponse<T> extends UniversalResponse<T> {
|
|
766
|
+
toValidationResult(): ValidationResult<T>;
|
|
767
|
+
map<U>(mapper: (value: T) => U): EnhancedResponse<U>;
|
|
768
|
+
flatMap<U>(mapper: (value: T) => EnhancedResponse<U>): EnhancedResponse<U>;
|
|
769
|
+
filter(predicate: (value: T) => boolean): EnhancedResponse<T>;
|
|
770
|
+
onSuccess(callback: (payload: T) => void): EnhancedResponse<T>;
|
|
771
|
+
onFailure(callback: (error: string) => void): EnhancedResponse<T>;
|
|
772
|
+
toPromise(): Promise<T>;
|
|
773
|
+
debug(label?: string): EnhancedResponse<T>;
|
|
774
|
+
}
|
|
775
|
+
interface ResponseMetadata {
|
|
776
|
+
timestamp: string;
|
|
777
|
+
operation: string;
|
|
778
|
+
duration?: number | undefined;
|
|
779
|
+
requestId?: string | undefined;
|
|
780
|
+
serverVersion?: string | undefined;
|
|
781
|
+
clientVersion: string;
|
|
782
|
+
warnings?: string[] | undefined;
|
|
783
|
+
error?: ResponseError | undefined;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
declare class StandardResponse<T> implements EnhancedResponse<T> {
|
|
787
|
+
private readonly _successful;
|
|
788
|
+
private readonly _payload;
|
|
789
|
+
private readonly _errorMessage;
|
|
790
|
+
private readonly _rawData;
|
|
791
|
+
private readonly _metadata;
|
|
792
|
+
constructor(successful: boolean, payload?: T | null, errorMessage?: string | null, rawData?: any, metadata?: Partial<ResponseMetadata>);
|
|
793
|
+
success(): boolean;
|
|
794
|
+
payload(): T | null;
|
|
795
|
+
reason(): string | null;
|
|
796
|
+
data(): any;
|
|
797
|
+
toValidationResult(): ValidationResult<T>;
|
|
798
|
+
map<U>(mapper: (value: T) => U): EnhancedResponse<U>;
|
|
799
|
+
flatMap<U>(mapper: (value: T) => EnhancedResponse<U>): EnhancedResponse<U>;
|
|
800
|
+
filter(predicate: (value: T) => boolean): EnhancedResponse<T>;
|
|
801
|
+
onSuccess(callback: (payload: T) => void): EnhancedResponse<T>;
|
|
802
|
+
onFailure(callback: (error: string) => void): EnhancedResponse<T>;
|
|
803
|
+
toPromise(): Promise<T>;
|
|
804
|
+
debug(label?: string): EnhancedResponse<T>;
|
|
805
|
+
static success<T>(payload: T, rawData?: any, metadata?: Partial<ResponseMetadata>): StandardResponse<T>;
|
|
806
|
+
static failure<T>(errorMessage: string | ResponseError, rawData?: any, metadata?: Partial<ResponseMetadata>): StandardResponse<T>;
|
|
807
|
+
static fromValidationResult<T>(result: ValidationResult<T>, rawData?: any, metadata?: Partial<ResponseMetadata>): StandardResponse<T>;
|
|
808
|
+
getErrorDetails(): ResponseError | null;
|
|
809
|
+
getMetadata(): ResponseMetadata;
|
|
810
|
+
validate(): ValidationResult<T>;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
declare class Response implements UniversalResponse<any> {
|
|
814
|
+
dataKey: string | null;
|
|
815
|
+
protected errorKey: string;
|
|
816
|
+
protected $__payload: any;
|
|
817
|
+
protected $__query: Query;
|
|
818
|
+
protected $__originResponse: any;
|
|
819
|
+
protected $__response: any;
|
|
820
|
+
constructor({ query, json, dataKey }: {
|
|
821
|
+
query: Query;
|
|
822
|
+
json: any;
|
|
823
|
+
dataKey?: string | null;
|
|
824
|
+
});
|
|
825
|
+
protected init(): void;
|
|
826
|
+
data(): any;
|
|
827
|
+
response(): any;
|
|
828
|
+
payload(): any;
|
|
829
|
+
success(): boolean;
|
|
830
|
+
error(): string | null;
|
|
831
|
+
reason(): string | null;
|
|
832
|
+
toEnhanced<T>(): StandardResponse<T>;
|
|
833
|
+
toValidationResult<T>(): ValidationResult<T>;
|
|
834
|
+
onSuccess(callback: (payload: any) => void): Response;
|
|
835
|
+
onFailure(callback: (error: string) => void): Response;
|
|
836
|
+
debug(label?: string): Response;
|
|
837
|
+
toPromise<T>(): Promise<T>;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
declare class Query {
|
|
841
|
+
protected client: GraphQLClient$1;
|
|
842
|
+
protected knishIOClient: any;
|
|
843
|
+
protected $__variables: Record<string, any> | null;
|
|
844
|
+
protected $__query: string | TypedDocumentNode<any, any> | null;
|
|
845
|
+
protected $__response: Response | null;
|
|
846
|
+
protected $__request: any;
|
|
847
|
+
constructor(graphQLClient: GraphQLClient$1, knishIOClient: any);
|
|
848
|
+
response(): Response | null;
|
|
849
|
+
createResponseRaw(response: any): Promise<Response>;
|
|
850
|
+
createResponse(json: any): Response;
|
|
851
|
+
compiledVariables(variables?: Record<string, any> | null): Record<string, any>;
|
|
852
|
+
variables(): Record<string, any> | null;
|
|
853
|
+
uri(): string;
|
|
854
|
+
createQuery({ variables }: {
|
|
855
|
+
variables?: Record<string, any> | null;
|
|
856
|
+
}): any;
|
|
857
|
+
createQueryContext(): Record<string, any>;
|
|
858
|
+
execute({ variables, context }?: {
|
|
859
|
+
variables?: Record<string, any>;
|
|
860
|
+
context?: Record<string, any>;
|
|
861
|
+
}): Promise<Response | null>;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
declare class Mutation extends Query {
|
|
865
|
+
createQuery({ variables }: {
|
|
866
|
+
variables?: Record<string, any> | null;
|
|
867
|
+
}): any;
|
|
868
|
+
execute({ variables, context }?: {
|
|
869
|
+
variables?: Record<string, any>;
|
|
870
|
+
context?: Record<string, any>;
|
|
871
|
+
}): Promise<Response | null>;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
declare class KnishIOClient {
|
|
875
|
+
private $__secret;
|
|
876
|
+
private $__bundle;
|
|
877
|
+
private $__cellSlug;
|
|
878
|
+
private $__encrypt;
|
|
879
|
+
private $__uris;
|
|
880
|
+
private $__client;
|
|
881
|
+
private $__serverSdkVersion;
|
|
882
|
+
private $__logging;
|
|
883
|
+
private $__authTokenObjects;
|
|
884
|
+
private $__authToken;
|
|
885
|
+
private $__remainderWallet;
|
|
886
|
+
private lastMoleculeQuery;
|
|
887
|
+
private abortControllers;
|
|
888
|
+
constructor(config: {
|
|
889
|
+
uri: string | string[];
|
|
890
|
+
cellSlug?: string | null;
|
|
891
|
+
client?: GraphQLClient | null;
|
|
892
|
+
socket?: {
|
|
893
|
+
socketUri: string | null;
|
|
894
|
+
appKey?: string;
|
|
895
|
+
} | null;
|
|
896
|
+
serverSdkVersion?: number;
|
|
897
|
+
logging?: boolean;
|
|
898
|
+
});
|
|
899
|
+
initialize({ uri, cellSlug, socket, client, serverSdkVersion, logging }: {
|
|
900
|
+
uri: string | string[];
|
|
901
|
+
cellSlug?: string | null;
|
|
902
|
+
socket?: {
|
|
903
|
+
socketUri: string | null;
|
|
904
|
+
appKey?: string;
|
|
905
|
+
} | null;
|
|
906
|
+
client?: GraphQLClient | null;
|
|
907
|
+
serverSdkVersion?: number;
|
|
908
|
+
logging?: boolean;
|
|
909
|
+
}): void;
|
|
910
|
+
getRandomUri(): string;
|
|
911
|
+
switchEncryption(encrypt: boolean): boolean;
|
|
912
|
+
deinitialize(): void;
|
|
913
|
+
subscribe(): GraphQLClient;
|
|
914
|
+
getServerSdkVersion(): number;
|
|
915
|
+
reset(): void;
|
|
916
|
+
client(): GraphQLClient;
|
|
917
|
+
setUri(uri: string | string[]): void;
|
|
918
|
+
getUri(): string[];
|
|
919
|
+
setCellSlug(cellSlug: string | null): void;
|
|
920
|
+
getCellSlug(): string | null;
|
|
921
|
+
hasSecret(): boolean;
|
|
922
|
+
getSecret(): string;
|
|
923
|
+
hasBundle(): boolean;
|
|
924
|
+
getBundle(): string;
|
|
925
|
+
setRemainderWallet(remainderWallet: Wallet): void;
|
|
926
|
+
getRemainderWallet(): Wallet | null;
|
|
927
|
+
createMolecule({ secret, bundle, sourceWallet, remainderWallet }?: {
|
|
928
|
+
secret?: string | null;
|
|
929
|
+
bundle?: string | null;
|
|
930
|
+
sourceWallet?: Wallet | null;
|
|
931
|
+
remainderWallet?: Wallet | null;
|
|
932
|
+
}): Promise<Molecule>;
|
|
933
|
+
createMoleculeMutation<T extends Mutation>({ mutationClass, molecule }: {
|
|
934
|
+
mutationClass: new (client: GraphQLClient, knishIOClient: KnishIOClient, molecule: Molecule) => T;
|
|
935
|
+
molecule?: Molecule | null;
|
|
936
|
+
}): Promise<T>;
|
|
937
|
+
executeQuery(query: Query | Mutation, variables?: Record<string, any> | null): Promise<Response | null>;
|
|
938
|
+
setSecret(secret: string): void;
|
|
939
|
+
setAuthToken(authToken: AuthToken): void;
|
|
940
|
+
getSourceWallet(): Promise<Wallet>;
|
|
941
|
+
transferToken({ bundleHash, token, amount, units, batchId, sourceWallet }: {
|
|
942
|
+
bundleHash: string;
|
|
943
|
+
token: string;
|
|
944
|
+
amount?: number | null;
|
|
945
|
+
units?: string[];
|
|
946
|
+
batchId?: string | null;
|
|
947
|
+
sourceWallet?: Wallet | null;
|
|
948
|
+
}): Promise<Response | null>;
|
|
949
|
+
requestAuthToken({ secret: _secret, seed: _seed, cellSlug: _cellSlug, encrypt: _encrypt }?: {
|
|
950
|
+
secret?: string | null;
|
|
951
|
+
seed?: string | null;
|
|
952
|
+
cellSlug?: string | null;
|
|
953
|
+
encrypt?: boolean;
|
|
954
|
+
}): Promise<Response | null>;
|
|
955
|
+
log(level: 'info' | 'warn' | 'error', message: string): void;
|
|
956
|
+
createQuery<T extends Query>(QueryClass: new (client: GraphQLClient, knishIOClient: KnishIOClient) => T): T;
|
|
957
|
+
createSubscribe<T>(SubscribeClass: new (client: GraphQLClient) => T): T;
|
|
958
|
+
hashSecret(secret: string, source?: string | null): string;
|
|
959
|
+
getAuthToken(): AuthToken | null;
|
|
960
|
+
cancelQuery(query: Query | Mutation, variables?: Record<string, any> | null): void;
|
|
961
|
+
cancelAllQueries(): void;
|
|
962
|
+
queryBalance({ token, bundle, type }: {
|
|
963
|
+
token: TokenSlug | string;
|
|
964
|
+
bundle?: BundleHash | string | null;
|
|
965
|
+
type?: 'regular' | 'stackable';
|
|
966
|
+
}): Promise<Response>;
|
|
967
|
+
querySourceWallet({ token, amount, type }: {
|
|
968
|
+
token: TokenSlug | string;
|
|
969
|
+
amount: number | string;
|
|
970
|
+
type?: 'regular' | 'stackable';
|
|
971
|
+
}): Promise<Wallet>;
|
|
972
|
+
queryWallets({ bundle, token, unspent }?: {
|
|
973
|
+
bundle?: BundleHash | string | null;
|
|
974
|
+
token?: TokenSlug | string | null;
|
|
975
|
+
unspent?: boolean;
|
|
976
|
+
}): Promise<Wallet[]>;
|
|
977
|
+
queryBundle({ bundle, fields: _fields, raw }?: {
|
|
978
|
+
bundle?: BundleHash | string | string[] | null;
|
|
979
|
+
fields?: string[] | null;
|
|
980
|
+
raw?: boolean;
|
|
981
|
+
}): Promise<any>;
|
|
982
|
+
queryContinuId({ bundle }: {
|
|
983
|
+
bundle: BundleHash | string;
|
|
984
|
+
}): Promise<Response>;
|
|
985
|
+
queryMeta({ metaType, metaId, key, value, latest, fields: _fields, filter, queryArgs, count, countBy, throughAtom, values, keys, atomValues }: {
|
|
986
|
+
metaType: MetaType | string;
|
|
987
|
+
metaId?: MetaId | string | null;
|
|
988
|
+
key?: string | null;
|
|
989
|
+
value?: string | null;
|
|
990
|
+
latest?: boolean | null;
|
|
991
|
+
fields?: string[] | null;
|
|
992
|
+
filter?: string | null;
|
|
993
|
+
queryArgs?: Record<string, any> | null;
|
|
994
|
+
count?: number | null;
|
|
995
|
+
countBy?: string | null;
|
|
996
|
+
throughAtom?: boolean | null;
|
|
997
|
+
values?: any[] | null;
|
|
998
|
+
keys?: string[] | null;
|
|
999
|
+
atomValues?: any[] | null;
|
|
1000
|
+
}): Promise<Response>;
|
|
1001
|
+
queryBatch({ batchId }: {
|
|
1002
|
+
batchId: BatchId | string;
|
|
1003
|
+
}): Promise<Response>;
|
|
1004
|
+
queryBatchHistory({ batchId }: {
|
|
1005
|
+
batchId: BatchId | string;
|
|
1006
|
+
}): Promise<Response>;
|
|
1007
|
+
queryAtom({ molecularHashes, molecularHash, bundleHashes, bundleHash, positions, position, walletAddresses, walletAddress, isotopes, isotope, tokenSlugs, tokenSlug, cellSlugs, cellSlug, batchIds, batchId, values, value, metaTypes, metaType, metaIds, metaId, indexes, index, filter, latest, queryArgs }?: {
|
|
1008
|
+
molecularHashes?: string[] | null;
|
|
1009
|
+
molecularHash?: string | null;
|
|
1010
|
+
bundleHashes?: string[] | null;
|
|
1011
|
+
bundleHash?: string | null;
|
|
1012
|
+
positions?: string[] | null;
|
|
1013
|
+
position?: string | null;
|
|
1014
|
+
walletAddresses?: string[] | null;
|
|
1015
|
+
walletAddress?: string | null;
|
|
1016
|
+
isotopes?: string[] | null;
|
|
1017
|
+
isotope?: string | null;
|
|
1018
|
+
tokenSlugs?: string[] | null;
|
|
1019
|
+
tokenSlug?: string | null;
|
|
1020
|
+
cellSlugs?: string[] | null;
|
|
1021
|
+
cellSlug?: string | null;
|
|
1022
|
+
batchIds?: string[] | null;
|
|
1023
|
+
batchId?: string | null;
|
|
1024
|
+
values?: any[] | null;
|
|
1025
|
+
value?: any | null;
|
|
1026
|
+
metaTypes?: string[] | null;
|
|
1027
|
+
metaType?: string | null;
|
|
1028
|
+
metaIds?: string[] | null;
|
|
1029
|
+
metaId?: string | null;
|
|
1030
|
+
indexes?: number[] | null;
|
|
1031
|
+
index?: number | null;
|
|
1032
|
+
filter?: string | null;
|
|
1033
|
+
latest?: boolean | null;
|
|
1034
|
+
queryArgs?: Record<string, any> | null;
|
|
1035
|
+
}): Promise<Response>;
|
|
1036
|
+
queryPolicy({ metaType, metaId }: {
|
|
1037
|
+
metaType: MetaType | string;
|
|
1038
|
+
metaId: MetaId | string;
|
|
1039
|
+
}): Promise<Response>;
|
|
1040
|
+
queryActiveSession({ bundleHash, metaType, metaId }: {
|
|
1041
|
+
bundleHash: BundleHash | string;
|
|
1042
|
+
metaType: MetaType | string;
|
|
1043
|
+
metaId: MetaId | string;
|
|
1044
|
+
}): Promise<Response>;
|
|
1045
|
+
queryUserActivity({ bundleHash, metaType, metaId, ipAddress, browser, osCpu, resolution, timeZone, countBy, interval }: {
|
|
1046
|
+
bundleHash: BundleHash | string;
|
|
1047
|
+
metaType: MetaType | string;
|
|
1048
|
+
metaId: MetaId | string;
|
|
1049
|
+
ipAddress?: string | null;
|
|
1050
|
+
browser?: string | null;
|
|
1051
|
+
osCpu?: string | null;
|
|
1052
|
+
resolution?: string | null;
|
|
1053
|
+
timeZone?: string | null;
|
|
1054
|
+
countBy?: string | null;
|
|
1055
|
+
interval?: string | null;
|
|
1056
|
+
}): Promise<Response>;
|
|
1057
|
+
queryToken({ token }: {
|
|
1058
|
+
token: TokenSlug | string;
|
|
1059
|
+
}): Promise<Response>;
|
|
1060
|
+
subscribeCreateMolecule({ bundle, closure }: {
|
|
1061
|
+
bundle: BundleHash | string | null;
|
|
1062
|
+
closure: (result: any) => void;
|
|
1063
|
+
}): Promise<string>;
|
|
1064
|
+
subscribeWalletStatus({ bundle, token, closure }: {
|
|
1065
|
+
bundle: BundleHash | string | null;
|
|
1066
|
+
token: TokenSlug | string;
|
|
1067
|
+
closure: (result: any) => void;
|
|
1068
|
+
}): Promise<string>;
|
|
1069
|
+
subscribeActiveWallet({ bundle, closure }: {
|
|
1070
|
+
bundle: BundleHash | string | null;
|
|
1071
|
+
closure: (result: any) => void;
|
|
1072
|
+
}): Promise<string>;
|
|
1073
|
+
subscribeActiveSession({ metaType, metaId, closure }: {
|
|
1074
|
+
metaType: MetaType | string;
|
|
1075
|
+
metaId: MetaId | string;
|
|
1076
|
+
closure: (result: any) => void;
|
|
1077
|
+
}): Promise<string>;
|
|
1078
|
+
unsubscribe(operationName: string): void;
|
|
1079
|
+
unsubscribeAll(): void;
|
|
1080
|
+
createToken({ token, amount, meta, batchId, units: _units }: {
|
|
1081
|
+
token: TokenSlug | string;
|
|
1082
|
+
amount?: number | string | null;
|
|
1083
|
+
meta?: Record<string, any> | null;
|
|
1084
|
+
batchId?: BatchId | string | null;
|
|
1085
|
+
units?: string[] | null;
|
|
1086
|
+
}): Promise<Response>;
|
|
1087
|
+
requestTokens({ token, to, amount, units: _units, meta, batchId }: {
|
|
1088
|
+
token: TokenSlug | string;
|
|
1089
|
+
to?: WalletAddress | string | null;
|
|
1090
|
+
amount?: number | string | null;
|
|
1091
|
+
units?: string[] | null;
|
|
1092
|
+
meta?: Record<string, any> | null;
|
|
1093
|
+
batchId?: BatchId | string | null;
|
|
1094
|
+
}): Promise<Response>;
|
|
1095
|
+
burnTokens({ token, amount, units: _units, sourceWallet }: {
|
|
1096
|
+
token: TokenSlug | string;
|
|
1097
|
+
amount?: number | string | null;
|
|
1098
|
+
units?: string[] | null;
|
|
1099
|
+
sourceWallet?: Wallet | null;
|
|
1100
|
+
}): Promise<Response>;
|
|
1101
|
+
replenishToken({ token, amount, units, sourceWallet: _sourceWallet }: {
|
|
1102
|
+
token: TokenSlug | string;
|
|
1103
|
+
amount?: number | string | null;
|
|
1104
|
+
units?: string[] | null;
|
|
1105
|
+
sourceWallet?: Wallet | null;
|
|
1106
|
+
}): Promise<Response>;
|
|
1107
|
+
fuseToken({ bundleHash: _bundleHash, tokenSlug, newTokenUnit: _newTokenUnit, fusedTokenUnitIds: _fusedTokenUnitIds, sourceWallet: _sourceWallet }: {
|
|
1108
|
+
bundleHash: BundleHash | string;
|
|
1109
|
+
tokenSlug: TokenSlug | string;
|
|
1110
|
+
newTokenUnit: string;
|
|
1111
|
+
fusedTokenUnitIds: string[];
|
|
1112
|
+
sourceWallet?: Wallet | null;
|
|
1113
|
+
}): Promise<Response>;
|
|
1114
|
+
createWallet({ token }: {
|
|
1115
|
+
token: TokenSlug | string;
|
|
1116
|
+
}): Promise<Response>;
|
|
1117
|
+
claimShadowWallet({ token, batchId, molecule: _molecule }: {
|
|
1118
|
+
token: TokenSlug | string;
|
|
1119
|
+
batchId?: BatchId | string | null;
|
|
1120
|
+
molecule?: Molecule | null;
|
|
1121
|
+
}): Promise<Response>;
|
|
1122
|
+
claimShadowWallets({ token }: {
|
|
1123
|
+
token: TokenSlug | string;
|
|
1124
|
+
}): Promise<Response[]>;
|
|
1125
|
+
createMeta({ metaType, metaId, meta, policy }: {
|
|
1126
|
+
metaType: MetaType | string;
|
|
1127
|
+
metaId: MetaId | string;
|
|
1128
|
+
meta?: Record<string, any> | null;
|
|
1129
|
+
policy?: any | null;
|
|
1130
|
+
}): Promise<Response>;
|
|
1131
|
+
createRule({ metaType, metaId, rule, policy }: {
|
|
1132
|
+
metaType: MetaType | string;
|
|
1133
|
+
metaId: MetaId | string;
|
|
1134
|
+
rule: any;
|
|
1135
|
+
policy?: any | null;
|
|
1136
|
+
}): Promise<Response>;
|
|
1137
|
+
createPolicy({ metaType, metaId, policy }: {
|
|
1138
|
+
metaType: MetaType | string;
|
|
1139
|
+
metaId: MetaId | string;
|
|
1140
|
+
policy?: any | null;
|
|
1141
|
+
}): Promise<Response>;
|
|
1142
|
+
createIdentifier({ type, contact, code }: {
|
|
1143
|
+
type: string;
|
|
1144
|
+
contact: string;
|
|
1145
|
+
code: string;
|
|
1146
|
+
}): Promise<Response>;
|
|
1147
|
+
linkIdentifier({ type, contact }: {
|
|
1148
|
+
type: string;
|
|
1149
|
+
contact: string;
|
|
1150
|
+
}): Promise<Response>;
|
|
1151
|
+
activeSession({ bundle, metaType, metaId, ipAddress, browser, osCpu, resolution, timeZone, json }: {
|
|
1152
|
+
bundle: BundleHash | string;
|
|
1153
|
+
metaType: MetaType | string;
|
|
1154
|
+
metaId: MetaId | string;
|
|
1155
|
+
ipAddress: string;
|
|
1156
|
+
browser: string;
|
|
1157
|
+
osCpu: string;
|
|
1158
|
+
resolution: string;
|
|
1159
|
+
timeZone: string;
|
|
1160
|
+
json?: any | null;
|
|
1161
|
+
}): Promise<Response>;
|
|
1162
|
+
depositBufferToken({ tokenSlug, amount, tradeRates, sourceWallet }: {
|
|
1163
|
+
tokenSlug: TokenSlug | string;
|
|
1164
|
+
amount: number | string;
|
|
1165
|
+
tradeRates: Record<string, number>;
|
|
1166
|
+
sourceWallet?: Wallet | null;
|
|
1167
|
+
}): Promise<Response>;
|
|
1168
|
+
withdrawBufferToken({ tokenSlug, amount, sourceWallet, signingWallet }: {
|
|
1169
|
+
tokenSlug: TokenSlug | string;
|
|
1170
|
+
amount: number | string;
|
|
1171
|
+
sourceWallet?: Wallet | null;
|
|
1172
|
+
signingWallet?: Wallet | null;
|
|
1173
|
+
}): Promise<Response>;
|
|
1174
|
+
requestGuestAuthToken({ cellSlug, encrypt }?: {
|
|
1175
|
+
cellSlug?: CellSlug | string | null;
|
|
1176
|
+
encrypt?: boolean;
|
|
1177
|
+
}): Promise<Response>;
|
|
1178
|
+
requestProfileAuthToken({ secret, encrypt }: {
|
|
1179
|
+
secret: string;
|
|
1180
|
+
encrypt?: boolean;
|
|
1181
|
+
}): Promise<Response>;
|
|
1182
|
+
cellSlug(): string | null;
|
|
1183
|
+
uri(): string[];
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
declare class ResponseBalance extends Response {
|
|
1187
|
+
constructor({ query, json }: {
|
|
1188
|
+
query: Query;
|
|
1189
|
+
json: Record<string, unknown>;
|
|
1190
|
+
});
|
|
1191
|
+
payload(): Wallet | null;
|
|
1192
|
+
static toClientWallet({ data, secret }: {
|
|
1193
|
+
data: any;
|
|
1194
|
+
secret?: string | null;
|
|
1195
|
+
}): Wallet;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
declare class QueryBalance extends Query {
|
|
1199
|
+
constructor(graphQLClient: GraphQLClient, knishIOClient: KnishIOClient);
|
|
1200
|
+
createResponse(json: Record<string, unknown>): ResponseBalance;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
declare class ResponseWalletBundle extends Response {
|
|
1204
|
+
constructor({ query, json }: {
|
|
1205
|
+
query: Query;
|
|
1206
|
+
json: Record<string, unknown>;
|
|
1207
|
+
});
|
|
1208
|
+
payload(): Record<string, any> | null;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
declare class QueryWalletBundle extends Query {
|
|
1212
|
+
constructor(graphQLClient: GraphQLClient, knishIOClient: KnishIOClient);
|
|
1213
|
+
createResponse(json: Record<string, unknown>): ResponseWalletBundle;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
declare class ResponseWalletList extends Response {
|
|
1217
|
+
constructor({ query, json }: {
|
|
1218
|
+
query: Query;
|
|
1219
|
+
json: any;
|
|
1220
|
+
});
|
|
1221
|
+
static toClientWallet({ data, secret }: {
|
|
1222
|
+
data: any;
|
|
1223
|
+
secret?: string | null;
|
|
1224
|
+
}): Wallet;
|
|
1225
|
+
getWallets(secret?: string | null): Wallet[] | null;
|
|
1226
|
+
payload(): Wallet[] | null;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
declare class QueryWalletList extends Query {
|
|
1230
|
+
constructor(graphQLClient: GraphQLClient$1, knishIOClient: KnishIOClient);
|
|
1231
|
+
createResponse(json: any): ResponseWalletList;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
declare class ResponseAtom extends Response {
|
|
1235
|
+
constructor({ query, json }: {
|
|
1236
|
+
query: Query;
|
|
1237
|
+
json: any;
|
|
1238
|
+
});
|
|
1239
|
+
payload(): any | null;
|
|
1240
|
+
metas(): any[];
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
declare class QueryAtom extends Query {
|
|
1244
|
+
constructor(graphQLClient: GraphQLClient$1, knishIOClient: KnishIOClient);
|
|
1245
|
+
static createVariables({ molecularHashes, molecularHash, bundleHashes, bundleHash, positions, position, walletAddresses, walletAddress, isotopes, isotope, tokenSlugs, tokenSlug, cellSlugs, cellSlug, batchIds, batchId, values, value, metaTypes, metaType, metaIds, metaId, indexes, index, filter, latest, queryArgs }: {
|
|
1246
|
+
molecularHashes?: string[];
|
|
1247
|
+
molecularHash?: string;
|
|
1248
|
+
bundleHashes?: string[];
|
|
1249
|
+
bundleHash?: string;
|
|
1250
|
+
positions?: string[];
|
|
1251
|
+
position?: string;
|
|
1252
|
+
walletAddresses?: string[];
|
|
1253
|
+
walletAddress?: string;
|
|
1254
|
+
isotopes?: string[];
|
|
1255
|
+
isotope?: string;
|
|
1256
|
+
tokenSlugs?: string[];
|
|
1257
|
+
tokenSlug?: string;
|
|
1258
|
+
cellSlugs?: string[];
|
|
1259
|
+
cellSlug?: string;
|
|
1260
|
+
batchIds?: string[];
|
|
1261
|
+
batchId?: string;
|
|
1262
|
+
values?: string[];
|
|
1263
|
+
value?: string | number;
|
|
1264
|
+
metaTypes?: string[];
|
|
1265
|
+
metaType?: string;
|
|
1266
|
+
metaIds?: string[];
|
|
1267
|
+
metaId?: string;
|
|
1268
|
+
indexes?: number[];
|
|
1269
|
+
index?: number;
|
|
1270
|
+
filter?: object[];
|
|
1271
|
+
latest?: boolean;
|
|
1272
|
+
queryArgs?: object;
|
|
1273
|
+
}): Record<string, any>;
|
|
1274
|
+
createResponse(json: any): ResponseAtom;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
declare class ResponseMetaType extends Response {
|
|
1278
|
+
constructor({ query, json }: {
|
|
1279
|
+
query: Query;
|
|
1280
|
+
json: any;
|
|
1281
|
+
});
|
|
1282
|
+
payload(): any | null;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
declare class QueryMetaType extends Query {
|
|
1286
|
+
constructor(graphQLClient: GraphQLClient$1, knishIOClient: KnishIOClient);
|
|
1287
|
+
static createVariables({ metaType, metaId, key, value, latest, filter, queryArgs, count, countBy, cellSlug }?: {
|
|
1288
|
+
metaType?: string | string[] | null;
|
|
1289
|
+
metaId?: string | string[] | null;
|
|
1290
|
+
key?: string | string[] | null;
|
|
1291
|
+
value?: string | string[] | null;
|
|
1292
|
+
latest?: boolean | null;
|
|
1293
|
+
filter?: any | null;
|
|
1294
|
+
queryArgs?: any | null;
|
|
1295
|
+
count?: string | null;
|
|
1296
|
+
countBy?: string | null;
|
|
1297
|
+
cellSlug?: string | null;
|
|
1298
|
+
}): Record<string, any>;
|
|
1299
|
+
createResponse(json: any): ResponseMetaType;
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
declare class ResponseMetaTypeViaAtom extends Response {
|
|
1303
|
+
constructor({ query, json }: {
|
|
1304
|
+
query: Query;
|
|
1305
|
+
json: any;
|
|
1306
|
+
});
|
|
1307
|
+
payload(): any | null;
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
declare class QueryMetaTypeViaAtom extends Query {
|
|
1311
|
+
constructor(graphQLClient: GraphQLClient$1, knishIOClient: KnishIOClient);
|
|
1312
|
+
static createVariables({ metaType, metaId, key, value, keys, values, atomValues, latest, filter, queryArgs, countBy, cellSlug }?: {
|
|
1313
|
+
metaType?: string | string[] | null;
|
|
1314
|
+
metaId?: string | string[] | null;
|
|
1315
|
+
key?: string | null;
|
|
1316
|
+
value?: string | null;
|
|
1317
|
+
keys?: string[] | null;
|
|
1318
|
+
values?: string[] | null;
|
|
1319
|
+
atomValues?: string[] | null;
|
|
1320
|
+
latest?: boolean | null;
|
|
1321
|
+
filter?: any[] | null;
|
|
1322
|
+
queryArgs?: any | null;
|
|
1323
|
+
countBy?: string | null;
|
|
1324
|
+
cellSlug?: string | string[] | null;
|
|
1325
|
+
}): Record<string, any>;
|
|
1326
|
+
createResponse(json: any): ResponseMetaTypeViaAtom;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
declare class ResponseContinuId extends Response {
|
|
1330
|
+
constructor({ query, json }: {
|
|
1331
|
+
query: Query;
|
|
1332
|
+
json: any;
|
|
1333
|
+
});
|
|
1334
|
+
payload(): Wallet | null;
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
declare class QueryContinuId extends Query {
|
|
1338
|
+
constructor(graphQLClient: GraphQLClient$1, knishIOClient: KnishIOClient);
|
|
1339
|
+
createResponse(json: any): ResponseContinuId;
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
declare class QueryBatch extends Query {
|
|
1343
|
+
constructor(graphQLClient: GraphQLClient$1, knishIOClient: KnishIOClient);
|
|
1344
|
+
static getFields(): string;
|
|
1345
|
+
createResponse(json: any): Response;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
declare class ResponseProposeMolecule extends Response {
|
|
1349
|
+
private $__clientMolecule;
|
|
1350
|
+
constructor({ query, json }: {
|
|
1351
|
+
query: Query;
|
|
1352
|
+
json: Record<string, unknown>;
|
|
1353
|
+
});
|
|
1354
|
+
init(): void;
|
|
1355
|
+
clientMolecule(): any;
|
|
1356
|
+
molecule(): Molecule | null;
|
|
1357
|
+
success(): boolean;
|
|
1358
|
+
status(): string;
|
|
1359
|
+
reason(): string;
|
|
1360
|
+
payload(): any;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
declare abstract class MutationProposeMolecule extends Mutation {
|
|
1364
|
+
protected $__molecule: Molecule;
|
|
1365
|
+
protected $__remainderWallet: any | null;
|
|
1366
|
+
constructor(graphQLClient: GraphQLClient, knishIOClient: KnishIOClient, molecule: Molecule);
|
|
1367
|
+
compiledVariables(variables?: Record<string, any> | null): Record<string, any>;
|
|
1368
|
+
createResponse(json: Record<string, unknown>): ResponseProposeMolecule;
|
|
1369
|
+
execute({ variables }?: {
|
|
1370
|
+
variables?: Record<string, any> | null;
|
|
1371
|
+
}): Promise<ResponseProposeMolecule | null>;
|
|
1372
|
+
remainderWallet(): any | null;
|
|
1373
|
+
molecule(): any;
|
|
1374
|
+
abstract fillMolecule(params: any): void;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
declare class ResponseTransferTokens extends ResponseProposeMolecule {
|
|
1378
|
+
payload(): {
|
|
1379
|
+
reason: string | null;
|
|
1380
|
+
status: string | null;
|
|
1381
|
+
};
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
declare class MutationTransferTokens extends MutationProposeMolecule {
|
|
1385
|
+
fillMolecule({ recipientWallet, amount }: {
|
|
1386
|
+
recipientWallet: Wallet;
|
|
1387
|
+
amount: number | string;
|
|
1388
|
+
}): void;
|
|
1389
|
+
createResponse(json: Record<string, unknown>): ResponseTransferTokens;
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
declare class ResponseCreateWallet extends ResponseProposeMolecule {
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
declare class MutationCreateWallet extends MutationProposeMolecule {
|
|
1396
|
+
fillMolecule(wallet: Wallet): void;
|
|
1397
|
+
createResponse(json: any): ResponseCreateWallet;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
declare class ResponseRequestAuthorization extends ResponseProposeMolecule {
|
|
1401
|
+
payloadKey(key: string): any;
|
|
1402
|
+
token(): string;
|
|
1403
|
+
time(): string;
|
|
1404
|
+
encrypt(): string;
|
|
1405
|
+
pubKey(): string;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
declare class MutationRequestAuthorization extends MutationProposeMolecule {
|
|
1409
|
+
fillMolecule({ meta }: {
|
|
1410
|
+
meta: any;
|
|
1411
|
+
}): void;
|
|
1412
|
+
createResponse(json: any): ResponseRequestAuthorization;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
declare class ResponseCreateMeta extends ResponseProposeMolecule {
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
declare class MutationCreateMeta extends MutationProposeMolecule {
|
|
1419
|
+
fillMolecule({ metaType, metaId, meta, policy }: {
|
|
1420
|
+
metaType: string;
|
|
1421
|
+
metaId: string;
|
|
1422
|
+
meta: any[] | any;
|
|
1423
|
+
policy: any;
|
|
1424
|
+
}): void;
|
|
1425
|
+
createResponse(json: any): ResponseCreateMeta;
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
declare class ResponseCreateToken extends ResponseProposeMolecule {
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
declare class MutationCreateToken extends MutationProposeMolecule {
|
|
1432
|
+
fillMolecule({ recipientWallet, amount, meta }: {
|
|
1433
|
+
recipientWallet: Wallet;
|
|
1434
|
+
amount: number | string;
|
|
1435
|
+
meta?: any | null;
|
|
1436
|
+
}): void;
|
|
1437
|
+
createResponse(json: any): ResponseCreateToken;
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
declare class ResponseRequestTokens extends ResponseProposeMolecule {
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
declare class MutationRequestTokens extends MutationProposeMolecule {
|
|
1444
|
+
fillMolecule({ token, amount, metaType, metaId, meta, batchId }: {
|
|
1445
|
+
token: string;
|
|
1446
|
+
amount: number | string;
|
|
1447
|
+
metaType: string;
|
|
1448
|
+
metaId: string;
|
|
1449
|
+
meta?: any | null;
|
|
1450
|
+
batchId?: string | null;
|
|
1451
|
+
}): void;
|
|
1452
|
+
createResponse(json: any): ResponseRequestTokens;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
declare class TokenUnit {
|
|
1456
|
+
id: string;
|
|
1457
|
+
name: string;
|
|
1458
|
+
metas: Record<string, any>;
|
|
1459
|
+
constructor(id: string, name: string, metas?: Record<string, any>);
|
|
1460
|
+
static createFromGraphQL(data: {
|
|
1461
|
+
id: string;
|
|
1462
|
+
name: string;
|
|
1463
|
+
metas?: any;
|
|
1464
|
+
}): TokenUnit;
|
|
1465
|
+
static createFromDB(data: [string, string, Record<string, any>?]): TokenUnit;
|
|
1466
|
+
getFragmentZone(): any | null;
|
|
1467
|
+
getFusedTokenUnits(): any | null;
|
|
1468
|
+
toData(): [string, string, Record<string, any>];
|
|
1469
|
+
toGraphQLResponse(): {
|
|
1470
|
+
id: string;
|
|
1471
|
+
name: string;
|
|
1472
|
+
metas: string;
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
declare class PolicyMeta {
|
|
1477
|
+
policy: Record<string, any>;
|
|
1478
|
+
constructor(policy?: Record<string, any>, metaKeys?: string[]);
|
|
1479
|
+
static normalizePolicy(policy?: Record<string, any>): Record<string, any>;
|
|
1480
|
+
fillDefault(metaKeys?: string[]): void;
|
|
1481
|
+
get(): Record<string, any>;
|
|
1482
|
+
toJson(): string;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
declare function chunkSubstr(str: string, size: number): string[];
|
|
1486
|
+
declare function randomString(length?: number, alphabet?: string): string;
|
|
1487
|
+
declare function charsetBaseConvert(src: string, fromBase: number, toBase: number, srcSymbolTable?: string, destSymbolTable?: string): string | number | boolean;
|
|
1488
|
+
declare function bufferToHexString(byteArray: Uint8Array | ArrayBuffer | number[]): string;
|
|
1489
|
+
declare function hexStringToBuffer(hexString: string): Uint8Array;
|
|
1490
|
+
declare function hexToBase64(hexString: string): string;
|
|
1491
|
+
declare function base64ToHex(base64String: string): string;
|
|
1492
|
+
declare function isHex(str: string): boolean;
|
|
1493
|
+
declare function isNumeric(str: string): boolean;
|
|
1494
|
+
declare function toCamelCase(str: string): string;
|
|
1495
|
+
declare function toSnakeCase(str: string): string;
|
|
1496
|
+
declare function capitalize(str: string): string;
|
|
1497
|
+
declare function truncate(str: string, length: number, ellipsis?: string): string;
|
|
1498
|
+
declare global {
|
|
1499
|
+
interface String {
|
|
1500
|
+
toCamelCase(): string;
|
|
1501
|
+
toSnakeCase(): string;
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
declare const CRYPTO_CONSTANTS: {
|
|
1506
|
+
readonly SECRET_LENGTH: 2048;
|
|
1507
|
+
readonly BUNDLE_HASH_LENGTH: 64;
|
|
1508
|
+
readonly POSITION_LENGTH: 64;
|
|
1509
|
+
readonly ADDRESS_LENGTH: 64;
|
|
1510
|
+
readonly MOLECULAR_HASH_OUTPUT_LENGTH: 256;
|
|
1511
|
+
readonly SHAKE256_OUTPUT_LENGTH: 256;
|
|
1512
|
+
readonly KEY_FRAGMENT_SIZE: 128;
|
|
1513
|
+
readonly HASH_ITERATIONS: 16;
|
|
1514
|
+
};
|
|
1515
|
+
declare function shake256(input: string, outputLength: number): string;
|
|
1516
|
+
declare function generateSecret(seed?: string | null, length?: number): string;
|
|
1517
|
+
declare function generateBundleHash(secret: string, source?: string | null): BundleHash;
|
|
1518
|
+
declare function generatePosition(): Position;
|
|
1519
|
+
declare function generateBatchId({ molecularHash, index }?: {
|
|
1520
|
+
molecularHash?: string | null;
|
|
1521
|
+
index?: number | null;
|
|
1522
|
+
}): string;
|
|
1523
|
+
declare function generateWalletKey({ secret, token, position }: {
|
|
1524
|
+
secret: string;
|
|
1525
|
+
token: string | null;
|
|
1526
|
+
position: string;
|
|
1527
|
+
}): string;
|
|
1528
|
+
declare function generateWalletAddress(key: string): string;
|
|
1529
|
+
declare function validateSecret(secret: string): boolean;
|
|
1530
|
+
declare function validateBundleHash(bundleHash: string): boolean;
|
|
1531
|
+
declare function validatePosition(position: string): boolean;
|
|
1532
|
+
declare function validateWalletAddress(address: string): boolean;
|
|
1533
|
+
declare function runCompatibilityTests(): {
|
|
1534
|
+
passed: boolean;
|
|
1535
|
+
results: Array<{
|
|
1536
|
+
test: string;
|
|
1537
|
+
passed: boolean;
|
|
1538
|
+
expected: string;
|
|
1539
|
+
actual: string;
|
|
1540
|
+
}>;
|
|
1541
|
+
};
|
|
1542
|
+
declare function convertToBase17(hexHash: string): string;
|
|
1543
|
+
declare function enumerateMolecularHash(hash: string): number[];
|
|
1544
|
+
declare function normalizeMolecularHash(mappedHashArray: number[]): number[];
|
|
1545
|
+
declare function generateOTSSignature(privateKey: string, molecularHash: string): string;
|
|
1546
|
+
declare function verifyOTSSignature(otsFragments: string, molecularHash: string, signingAddress: string): boolean;
|
|
1547
|
+
declare function validateOTSSignature(signature: string): boolean;
|
|
1548
|
+
declare function validateMolecularHashForSignature(hash: string): boolean;
|
|
1549
|
+
declare const EXTENDED_COMPATIBILITY_TEST_VECTORS: {
|
|
1550
|
+
readonly base17Conversion: readonly [{
|
|
1551
|
+
readonly input: "0000000000000000000000000000000000000000000000000000000000000000";
|
|
1552
|
+
readonly expected: "0000000000000000000000000000000000000000000000000000000000000000";
|
|
1553
|
+
}];
|
|
1554
|
+
readonly molecularEnumeration: readonly [{
|
|
1555
|
+
readonly input: "0000000000000000000000000000000000000000000000000000000000000000";
|
|
1556
|
+
readonly expected: readonly [-8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8];
|
|
1557
|
+
}];
|
|
1558
|
+
readonly shake256: readonly [{
|
|
1559
|
+
readonly input: "test";
|
|
1560
|
+
readonly outputLength: 256;
|
|
1561
|
+
readonly expected: "b54ff7255705a71ee2925e4a3e30e41aed489a579d5595e0df13e32e1e4dd202";
|
|
1562
|
+
}, {
|
|
1563
|
+
readonly input: "KnishIO";
|
|
1564
|
+
readonly outputLength: 256;
|
|
1565
|
+
readonly expected: "35e3c3f33aefb940baaf430855ccb441c24b7b0542f682b8543f4c9d3a077c6e";
|
|
1566
|
+
}];
|
|
1567
|
+
};
|
|
1568
|
+
declare function runExtendedCompatibilityTests(): {
|
|
1569
|
+
passed: boolean;
|
|
1570
|
+
results: Array<{
|
|
1571
|
+
test: string;
|
|
1572
|
+
passed: boolean;
|
|
1573
|
+
expected: any;
|
|
1574
|
+
actual: any;
|
|
1575
|
+
}>;
|
|
1576
|
+
};
|
|
1577
|
+
|
|
1578
|
+
interface BaseExceptionOptions {
|
|
1579
|
+
message?: string;
|
|
1580
|
+
cause?: Error | unknown;
|
|
1581
|
+
context?: ErrorContext;
|
|
1582
|
+
code?: string;
|
|
1583
|
+
details?: Record<string, unknown>;
|
|
1584
|
+
}
|
|
1585
|
+
declare class BaseException extends Error {
|
|
1586
|
+
readonly type: KnishIOErrorType;
|
|
1587
|
+
readonly context: ErrorContext | null;
|
|
1588
|
+
readonly code: string | null;
|
|
1589
|
+
readonly details: Record<string, unknown> | null;
|
|
1590
|
+
readonly timestamp: number;
|
|
1591
|
+
constructor(type: KnishIOErrorType, message: string, options?: BaseExceptionOptions);
|
|
1592
|
+
getFullMessage(): string;
|
|
1593
|
+
toJSON(): Record<string, unknown>;
|
|
1594
|
+
isType(type: KnishIOErrorType): boolean;
|
|
1595
|
+
getContextValue(key: keyof ErrorContext): unknown;
|
|
1596
|
+
withContext(additionalContext: Partial<ErrorContext>): this;
|
|
1597
|
+
static create<T extends BaseException>(this: new (type: KnishIOErrorType, message: string, options?: BaseExceptionOptions) => T, type: KnishIOErrorType, message: string, options?: BaseExceptionOptions): T;
|
|
1598
|
+
static isKnishIOException(error: unknown): error is BaseException;
|
|
1599
|
+
static getErrorType(error: unknown): KnishIOErrorType | null;
|
|
1600
|
+
static fromError(error: Error | unknown, type?: KnishIOErrorType, additionalContext?: Partial<ErrorContext>): BaseException;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
declare class AtomIndexException extends BaseException {
|
|
1604
|
+
constructor(message?: string, options?: BaseExceptionOptions);
|
|
1605
|
+
static indexConflict(index: number, existingIndex: number): AtomIndexException;
|
|
1606
|
+
static indexOutOfRange(index: number, maxIndex: number): AtomIndexException;
|
|
1607
|
+
static missingIndex(): AtomIndexException;
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
declare class AtomsMissingException extends BaseException {
|
|
1611
|
+
constructor(message?: string, options?: BaseExceptionOptions);
|
|
1612
|
+
static emptyMolecule(): AtomsMissingException;
|
|
1613
|
+
static missingIsotope(isotope: string): AtomsMissingException;
|
|
1614
|
+
static missingRemainder(expectedCount: number, actualCount: number): AtomsMissingException;
|
|
1615
|
+
static missingValueAtoms(): AtomsMissingException;
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
declare class MolecularHashMismatchException extends BaseException {
|
|
1619
|
+
constructor(message?: string, options?: BaseExceptionOptions);
|
|
1620
|
+
static hashMismatch(expected: string, actual: string): MolecularHashMismatchException;
|
|
1621
|
+
static invalidFormat(hash: string): MolecularHashMismatchException;
|
|
1622
|
+
static crossPlatformMismatch(sdk: string, expectedHash: string, actualHash: string): MolecularHashMismatchException;
|
|
1623
|
+
static atomIntegrityFailure(atomIndex: number): MolecularHashMismatchException;
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
declare class SignatureMismatchException extends BaseException {
|
|
1627
|
+
constructor(message?: string, options?: BaseExceptionOptions);
|
|
1628
|
+
static verificationFailed(publicKey: string, signature: string): SignatureMismatchException;
|
|
1629
|
+
static otsVerificationFailed(fragmentIndex: number): SignatureMismatchException;
|
|
1630
|
+
static crossPlatformMismatch(sdk: string): SignatureMismatchException;
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
declare class TransferBalanceException extends BaseException {
|
|
1634
|
+
constructor(message?: string, options?: BaseExceptionOptions);
|
|
1635
|
+
static insufficientBalance(required: string, available: string): TransferBalanceException;
|
|
1636
|
+
static negativeBalance(balance: string): TransferBalanceException;
|
|
1637
|
+
static calculationError(operation: string, details?: Record<string, unknown>): TransferBalanceException;
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
declare class WalletCredentialException extends BaseException {
|
|
1641
|
+
constructor(message?: string, options?: BaseExceptionOptions);
|
|
1642
|
+
static invalidSecret(): WalletCredentialException;
|
|
1643
|
+
static missingCredentials(): WalletCredentialException;
|
|
1644
|
+
static credentialsExpired(): WalletCredentialException;
|
|
1645
|
+
static bundleMismatch(expected: string, actual: string): WalletCredentialException;
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
declare class InvalidResponseException extends BaseException {
|
|
1649
|
+
constructor(message?: string, options?: BaseExceptionOptions);
|
|
1650
|
+
static malformedJson(error: string): InvalidResponseException;
|
|
1651
|
+
static graphqlError(errors: Array<{
|
|
1652
|
+
message: string;
|
|
1653
|
+
}>): InvalidResponseException;
|
|
1654
|
+
static missingData(operation: string): InvalidResponseException;
|
|
1655
|
+
static networkError(statusCode: number, statusText: string): InvalidResponseException;
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
declare class ExceptionFactory {
|
|
1659
|
+
static atomIndex: {
|
|
1660
|
+
indexConflict: typeof AtomIndexException.indexConflict;
|
|
1661
|
+
indexOutOfRange: typeof AtomIndexException.indexOutOfRange;
|
|
1662
|
+
missingIndex: typeof AtomIndexException.missingIndex;
|
|
1663
|
+
};
|
|
1664
|
+
static atomsMissing: {
|
|
1665
|
+
emptyMolecule: typeof AtomsMissingException.emptyMolecule;
|
|
1666
|
+
missingIsotope: typeof AtomsMissingException.missingIsotope;
|
|
1667
|
+
missingRemainder: typeof AtomsMissingException.missingRemainder;
|
|
1668
|
+
missingValueAtoms: typeof AtomsMissingException.missingValueAtoms;
|
|
1669
|
+
};
|
|
1670
|
+
static molecularHashMismatch: {
|
|
1671
|
+
hashMismatch: typeof MolecularHashMismatchException.hashMismatch;
|
|
1672
|
+
invalidFormat: typeof MolecularHashMismatchException.invalidFormat;
|
|
1673
|
+
crossPlatformMismatch: typeof MolecularHashMismatchException.crossPlatformMismatch;
|
|
1674
|
+
atomIntegrityFailure: typeof MolecularHashMismatchException.atomIntegrityFailure;
|
|
1675
|
+
};
|
|
1676
|
+
static signatureMismatch: {
|
|
1677
|
+
verificationFailed: typeof SignatureMismatchException.verificationFailed;
|
|
1678
|
+
otsVerificationFailed: typeof SignatureMismatchException.otsVerificationFailed;
|
|
1679
|
+
crossPlatformMismatch: typeof SignatureMismatchException.crossPlatformMismatch;
|
|
1680
|
+
};
|
|
1681
|
+
static transferBalance: {
|
|
1682
|
+
insufficientBalance: typeof TransferBalanceException.insufficientBalance;
|
|
1683
|
+
negativeBalance: typeof TransferBalanceException.negativeBalance;
|
|
1684
|
+
calculationError: typeof TransferBalanceException.calculationError;
|
|
1685
|
+
};
|
|
1686
|
+
static walletCredential: {
|
|
1687
|
+
invalidSecret: typeof WalletCredentialException.invalidSecret;
|
|
1688
|
+
missingCredentials: typeof WalletCredentialException.missingCredentials;
|
|
1689
|
+
credentialsExpired: typeof WalletCredentialException.credentialsExpired;
|
|
1690
|
+
bundleMismatch: typeof WalletCredentialException.bundleMismatch;
|
|
1691
|
+
};
|
|
1692
|
+
static invalidResponse: {
|
|
1693
|
+
malformedJson: typeof InvalidResponseException.malformedJson;
|
|
1694
|
+
graphqlError: typeof InvalidResponseException.graphqlError;
|
|
1695
|
+
missingData: typeof InvalidResponseException.missingData;
|
|
1696
|
+
networkError: typeof InvalidResponseException.networkError;
|
|
1697
|
+
};
|
|
1698
|
+
static fromError: typeof BaseException.fromError;
|
|
1699
|
+
}
|
|
1700
|
+
declare const EXCEPTION_TYPES: {
|
|
1701
|
+
readonly ATOM_INDEX_ERROR: "ATOM_INDEX_ERROR";
|
|
1702
|
+
readonly ATOMS_MISSING_ERROR: "ATOMS_MISSING_ERROR";
|
|
1703
|
+
readonly AUTHORIZATION_REJECTED_ERROR: "AUTHORIZATION_REJECTED_ERROR";
|
|
1704
|
+
readonly BALANCE_INSUFFICIENT_ERROR: "BALANCE_INSUFFICIENT_ERROR";
|
|
1705
|
+
readonly BATCH_ID_ERROR: "BATCH_ID_ERROR";
|
|
1706
|
+
readonly CODE_ERROR: "CODE_ERROR";
|
|
1707
|
+
readonly DECRYPTION_KEY_ERROR: "DECRYPTION_KEY_ERROR";
|
|
1708
|
+
readonly INVALID_RESPONSE_ERROR: "INVALID_RESPONSE_ERROR";
|
|
1709
|
+
readonly META_MISSING_ERROR: "META_MISSING_ERROR";
|
|
1710
|
+
readonly MOLECULAR_HASH_MISMATCH_ERROR: "MOLECULAR_HASH_MISMATCH_ERROR";
|
|
1711
|
+
readonly MOLECULAR_HASH_MISSING_ERROR: "MOLECULAR_HASH_MISSING_ERROR";
|
|
1712
|
+
readonly NEGATIVE_AMOUNT_ERROR: "NEGATIVE_AMOUNT_ERROR";
|
|
1713
|
+
readonly POLICY_INVALID_ERROR: "POLICY_INVALID_ERROR";
|
|
1714
|
+
readonly SIGNATURE_MALFORMED_ERROR: "SIGNATURE_MALFORMED_ERROR";
|
|
1715
|
+
readonly SIGNATURE_MISMATCH_ERROR: "SIGNATURE_MISMATCH_ERROR";
|
|
1716
|
+
readonly STACKABLE_UNIT_AMOUNT_ERROR: "STACKABLE_UNIT_AMOUNT_ERROR";
|
|
1717
|
+
readonly STACKABLE_UNIT_DECIMALS_ERROR: "STACKABLE_UNIT_DECIMALS_ERROR";
|
|
1718
|
+
readonly TRANSFER_BALANCE_ERROR: "TRANSFER_BALANCE_ERROR";
|
|
1719
|
+
readonly TRANSFER_MALFORMED_ERROR: "TRANSFER_MALFORMED_ERROR";
|
|
1720
|
+
readonly TRANSFER_MISMATCHED_ERROR: "TRANSFER_MISMATCHED_ERROR";
|
|
1721
|
+
readonly TRANSFER_REMAINDER_ERROR: "TRANSFER_REMAINDER_ERROR";
|
|
1722
|
+
readonly TRANSFER_TO_SELF_ERROR: "TRANSFER_TO_SELF_ERROR";
|
|
1723
|
+
readonly TRANSFER_UNBALANCED_ERROR: "TRANSFER_UNBALANCED_ERROR";
|
|
1724
|
+
readonly UNAUTHENTICATED_ERROR: "UNAUTHENTICATED_ERROR";
|
|
1725
|
+
readonly WALLET_CREDENTIAL_ERROR: "WALLET_CREDENTIAL_ERROR";
|
|
1726
|
+
readonly WALLET_SHADOW_ERROR: "WALLET_SHADOW_ERROR";
|
|
1727
|
+
readonly WRONG_TOKEN_TYPE_ERROR: "WRONG_TOKEN_TYPE_ERROR";
|
|
1728
|
+
};
|
|
1729
|
+
declare const EXCEPTION_CODES: {
|
|
1730
|
+
readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
|
|
1731
|
+
readonly VALIDATION_FAILED: "VALIDATION_FAILED";
|
|
1732
|
+
readonly OPERATION_FAILED: "OPERATION_FAILED";
|
|
1733
|
+
readonly INDEX_CONFLICT: "INDEX_CONFLICT";
|
|
1734
|
+
readonly INDEX_OUT_OF_RANGE: "INDEX_OUT_OF_RANGE";
|
|
1735
|
+
readonly INDEX_MISSING: "INDEX_MISSING";
|
|
1736
|
+
readonly EMPTY_MOLECULE: "EMPTY_MOLECULE";
|
|
1737
|
+
readonly MISSING_ISOTOPE: "MISSING_ISOTOPE";
|
|
1738
|
+
readonly MISSING_REMAINDER: "MISSING_REMAINDER";
|
|
1739
|
+
readonly MISSING_VALUE_ATOMS: "MISSING_VALUE_ATOMS";
|
|
1740
|
+
readonly HASH_MISMATCH: "HASH_MISMATCH";
|
|
1741
|
+
readonly INVALID_FORMAT: "INVALID_FORMAT";
|
|
1742
|
+
readonly CROSS_PLATFORM_MISMATCH: "CROSS_PLATFORM_MISMATCH";
|
|
1743
|
+
readonly ATOM_INTEGRITY_FAILURE: "ATOM_INTEGRITY_FAILURE";
|
|
1744
|
+
readonly VERIFICATION_FAILED: "VERIFICATION_FAILED";
|
|
1745
|
+
readonly OTS_VERIFICATION_FAILED: "OTS_VERIFICATION_FAILED";
|
|
1746
|
+
readonly INSUFFICIENT_BALANCE: "INSUFFICIENT_BALANCE";
|
|
1747
|
+
readonly NEGATIVE_BALANCE: "NEGATIVE_BALANCE";
|
|
1748
|
+
readonly CALCULATION_ERROR: "CALCULATION_ERROR";
|
|
1749
|
+
readonly INVALID_SECRET: "INVALID_SECRET";
|
|
1750
|
+
readonly MISSING_CREDENTIALS: "MISSING_CREDENTIALS";
|
|
1751
|
+
readonly CREDENTIALS_EXPIRED: "CREDENTIALS_EXPIRED";
|
|
1752
|
+
readonly BUNDLE_MISMATCH: "BUNDLE_MISMATCH";
|
|
1753
|
+
readonly MALFORMED_JSON: "MALFORMED_JSON";
|
|
1754
|
+
readonly GRAPHQL_ERROR: "GRAPHQL_ERROR";
|
|
1755
|
+
readonly MISSING_DATA: "MISSING_DATA";
|
|
1756
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
1757
|
+
};
|
|
1758
|
+
|
|
1759
|
+
declare const SDK_VERSION = "1.0.0";
|
|
1760
|
+
declare const SDK_NAME = "KnishIO-Client-TS";
|
|
1761
|
+
declare const COMPATIBLE_SERVER_VERSIONS: number[];
|
|
1762
|
+
declare const SDK_INFO: {
|
|
1763
|
+
readonly name: "KnishIO-Client-TS";
|
|
1764
|
+
readonly version: "1.0.0";
|
|
1765
|
+
readonly description: "TypeScript SDK for Knish.IO post-blockchain distributed ledger";
|
|
1766
|
+
readonly compatibleServerVersions: number[];
|
|
1767
|
+
readonly features: readonly ["Post-quantum cryptography (XMSS, ML-KEM768)", "Cross-platform compatibility", "Type-safe APIs", "DAG-based transaction processing", "GraphQL integration", "Real-time subscriptions", "Cellular architecture support"];
|
|
1768
|
+
readonly build: {
|
|
1769
|
+
readonly target: "ES2022";
|
|
1770
|
+
readonly formats: readonly ["esm", "cjs", "iife"];
|
|
1771
|
+
readonly typescript: true;
|
|
1772
|
+
readonly strictMode: true;
|
|
1773
|
+
};
|
|
1774
|
+
};
|
|
1775
|
+
interface SDKConfig {
|
|
1776
|
+
defaultUri?: string | string[];
|
|
1777
|
+
defaultCellSlug?: string | null;
|
|
1778
|
+
logging?: boolean;
|
|
1779
|
+
cryptoValidation?: boolean;
|
|
1780
|
+
compatibilityChecks?: boolean;
|
|
1781
|
+
}
|
|
1782
|
+
declare function configureSDK(config: Partial<SDKConfig>): void;
|
|
1783
|
+
declare function getSDKConfig(): SDKConfig;
|
|
1784
|
+
declare const DevUtils: {
|
|
1785
|
+
validateInstallation(): boolean;
|
|
1786
|
+
runFullCompatibilityTests: typeof runCompatibilityTests;
|
|
1787
|
+
getBuildInfo(): {
|
|
1788
|
+
buildTime: string;
|
|
1789
|
+
nodeVersion: string;
|
|
1790
|
+
environment: string;
|
|
1791
|
+
name: "KnishIO-Client-TS";
|
|
1792
|
+
version: "1.0.0";
|
|
1793
|
+
description: "TypeScript SDK for Knish.IO post-blockchain distributed ledger";
|
|
1794
|
+
compatibleServerVersions: number[];
|
|
1795
|
+
features: readonly ["Post-quantum cryptography (XMSS, ML-KEM768)", "Cross-platform compatibility", "Type-safe APIs", "DAG-based transaction processing", "GraphQL integration", "Real-time subscriptions", "Cellular architecture support"];
|
|
1796
|
+
build: {
|
|
1797
|
+
readonly target: "ES2022";
|
|
1798
|
+
readonly formats: readonly ["esm", "cjs", "iife"];
|
|
1799
|
+
readonly typescript: true;
|
|
1800
|
+
readonly strictMode: true;
|
|
1801
|
+
};
|
|
1802
|
+
};
|
|
1803
|
+
} | {
|
|
1804
|
+
validateInstallation?: never;
|
|
1805
|
+
runFullCompatibilityTests?: never;
|
|
1806
|
+
getBuildInfo?: never;
|
|
1807
|
+
};
|
|
1808
|
+
|
|
1809
|
+
declare const KnishIO: {
|
|
1810
|
+
shake256: typeof shake256;
|
|
1811
|
+
generateSecret: typeof generateSecret;
|
|
1812
|
+
generateBundleHash: typeof generateBundleHash;
|
|
1813
|
+
generateBatchId: typeof generateBatchId;
|
|
1814
|
+
chunkSubstr: typeof chunkSubstr;
|
|
1815
|
+
randomString: typeof randomString;
|
|
1816
|
+
isHex: typeof isHex;
|
|
1817
|
+
SDK_VERSION: string;
|
|
1818
|
+
SDK_INFO: {
|
|
1819
|
+
readonly name: "KnishIO-Client-TS";
|
|
1820
|
+
readonly version: "1.0.0";
|
|
1821
|
+
readonly description: "TypeScript SDK for Knish.IO post-blockchain distributed ledger";
|
|
1822
|
+
readonly compatibleServerVersions: number[];
|
|
1823
|
+
readonly features: readonly ["Post-quantum cryptography (XMSS, ML-KEM768)", "Cross-platform compatibility", "Type-safe APIs", "DAG-based transaction processing", "GraphQL integration", "Real-time subscriptions", "Cellular architecture support"];
|
|
1824
|
+
readonly build: {
|
|
1825
|
+
readonly target: "ES2022";
|
|
1826
|
+
readonly formats: readonly ["esm", "cjs", "iife"];
|
|
1827
|
+
readonly typescript: true;
|
|
1828
|
+
readonly strictMode: true;
|
|
1829
|
+
};
|
|
1830
|
+
};
|
|
1831
|
+
};
|
|
1832
|
+
|
|
1833
|
+
export { Atom, AtomIndexException, type AtomIsotope, AtomMeta, type AtomParams, AtomsMissingException, type AuthParams, AuthToken, type BalanceQueryParams, type Base17Hash, BaseException, type BaseResponse, type BundleHash, type BundleHashOptions, COMPATIBLE_SERVER_VERSIONS, CRYPTO_CONSTANTS, type CellSlug, CheckMolecule, type CreateTokenParams, DevUtils, Dot, EXCEPTION_CODES, EXCEPTION_TYPES, EXTENDED_COMPATIBILITY_TEST_VECTORS, ExceptionFactory, GraphQLClient, type GraphQLError, type GraphQLRequest, type GraphQLResponse, type HexString, InvalidResponseException, type KeyGenerationOptions, KnishIO, KnishIOClient, type KnishIOClientConfig, Meta, type MetaData, type MetaId, type MetaQueryParams, type MetaType, type MolecularHash, MolecularHashMismatchException, Molecule, type MoleculeParams, Mutation, MutationCreateMeta, MutationCreateToken, MutationCreateWallet, type MutationOperation, MutationProposeMolecule, MutationRequestAuthorization, MutationRequestTokens, MutationTransferTokens, PolicyMeta, type Position, type PositionGenerationOptions, Query, QueryAtom, QueryBalance, QueryBatch, QueryContinuId, QueryMetaType, QueryMetaTypeViaAtom, type QueryOperation, QueryWalletBundle, QueryWalletList, type RequestTokensParams, Response, ResponseAtom, ResponseBalance, ResponseContinuId, ResponseCreateMeta, ResponseCreateToken, ResponseCreateWallet, ResponseMetaType, ResponseMetaTypeViaAtom, ResponseProposeMolecule, ResponseRequestAuthorization, ResponseRequestTokens, ResponseTransferTokens, ResponseWalletBundle, ResponseWalletList, type SDKConfig, SDK_INFO, SDK_NAME, SDK_VERSION, type SHAKE256Options, type SecretGenerationOptions, SignatureMismatchException, type SignatureOptions, type TokenSlug, TokenUnit, TransferBalanceException, type TransferParams, type ValidationResult$1 as ValidationResult, type VerificationOptions, Wallet, type WalletAddress, WalletCredentialException, type WalletParams, type WalletQueryParams, base64ToHex, bufferToHexString, capitalize, charsetBaseConvert, chunkArray, chunkSubstr, configureSDK, convertToBase17, createBundleHash, createMolecularHash, createPosition, createTokenSlug, createWalletAddress, deepCloning, shake256 as default, diff, enumerateMolecularHash, generateBatchId, generateBundleHash, generateOTSSignature, generatePosition, generateSecret, generateWalletAddress, generateWalletKey, getSDKConfig, hexStringToBuffer, hexToBase64, intersect, isAtomIsotope, isBundleHash, isHex, isHexString, isMolecularHash, isNumeric, isPosition, isWalletAddress, normalizeMolecularHash, randomString, runCompatibilityTests, runExtendedCompatibilityTests, shake256, toCamelCase, toSnakeCase, truncate, validateBundleHash, validateMolecularHashForSignature, validateOTSSignature, validatePosition, validateSecret, validateWalletAddress, verifyOTSSignature };
|