@wishknish/knishio-client-ts 0.7.2 → 0.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/index.cjs +2819 -1186
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +378 -142
  4. package/dist/index.d.ts +378 -142
  5. package/dist/index.iife.js +22799 -20747
  6. package/dist/index.iife.js.map +1 -1
  7. package/dist/index.js +2817 -1185
  8. package/dist/index.js.map +1 -1
  9. package/package.json +12 -6
  10. package/src/AuthToken.ts +8 -2
  11. package/src/KnishIOClient.ts +367 -118
  12. package/src/constants.ts +5 -3
  13. package/src/core/Atom.ts +167 -100
  14. package/src/core/AtomMeta.ts +11 -28
  15. package/src/core/Meta.ts +18 -15
  16. package/src/core/Molecule.ts +582 -140
  17. package/src/core/Wallet.ts +19 -24
  18. package/src/index.ts +9 -10
  19. package/src/instance/rules/Rule.ts +128 -19
  20. package/src/libraries/CheckMolecule.ts +88 -1
  21. package/src/libraries/GraphQLClient.ts +17 -22
  22. package/src/libraries/crypto.ts +14 -30
  23. package/src/libraries/strings.ts +26 -25
  24. package/src/mutation/MutationAppendRequest.ts +52 -0
  25. package/src/mutation/MutationCreateRule.ts +2 -2
  26. package/src/mutation/MutationPeering.ts +37 -0
  27. package/src/mutation/MutationRequestAuthorization.ts +3 -3
  28. package/src/query/Query.ts +6 -6
  29. package/src/query/QueryActiveSession.ts +0 -1
  30. package/src/query/QueryAtom.ts +27 -27
  31. package/src/query/QueryContinuId.ts +8 -0
  32. package/src/query/QueryMetaType.ts +1 -1
  33. package/src/query/QueryMetaTypeViaMolecule.ts +221 -0
  34. package/src/query/QueryWalletList.ts +2 -2
  35. package/src/response/Response.ts +17 -1
  36. package/src/response/ResponseAppendRequest.ts +17 -0
  37. package/src/response/ResponseBalance.ts +8 -3
  38. package/src/response/ResponseContinuId.ts +1 -1
  39. package/src/response/ResponseMetaType.ts +32 -19
  40. package/src/response/ResponseMetaTypeViaMolecule.ts +224 -0
  41. package/src/response/ResponsePeering.ts +17 -0
  42. package/src/response/ResponsePolicy.ts +2 -3
  43. package/src/response/ResponseProposeMolecule.ts +0 -1
  44. package/src/response/ResponseRequestAuthorization.ts +32 -2
  45. package/src/response/ResponseRequestAuthorizationGuest.ts +25 -1
  46. package/src/response/ResponseWalletList.ts +1 -1
  47. package/src/schemas/index.ts +12 -1
  48. package/src/types/client.ts +3 -2
  49. package/src/types/graphql.ts +3 -2
  50. package/src/types/guards.ts +18 -5
  51. package/src/types/index.ts +19 -4
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TypedDocumentNode } from '@urql/core';
2
2
 
3
- declare const ISOTOPES: readonly ["C", "V", "U", "T", "M", "I", "R", "B", "F"];
3
+ declare const ISOTOPES: readonly ["C", "V", "U", "T", "M", "I", "R", "B", "F", "P", "A"];
4
4
  type AtomIsotope = typeof ISOTOPES[number];
5
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
6
  type KnishIOErrorType = typeof ERROR_TYPES[number];
@@ -163,8 +163,8 @@ interface AtomMetaData$1 extends MetaData {
163
163
  interface AtomParams {
164
164
  position?: string | null;
165
165
  walletAddress?: WalletAddress | null;
166
- isotope?: AtomIsotope;
167
- token?: TokenSlug | string;
166
+ isotope?: AtomIsotope | null;
167
+ token?: TokenSlug | string | null;
168
168
  value?: string | number | null;
169
169
  batchId?: BatchId | string | null;
170
170
  metaType?: MetaType | string | null;
@@ -173,7 +173,7 @@ interface AtomParams {
173
173
  otsFragment?: string | null;
174
174
  index?: number | null;
175
175
  createdAt?: string | null;
176
- version?: number | null;
176
+ version?: string | number | null | undefined;
177
177
  }
178
178
  interface WalletParams {
179
179
  secret?: string | null;
@@ -233,6 +233,12 @@ interface RequestTokensParams {
233
233
  metaId?: MetaId | string | null;
234
234
  meta?: MetaData | null;
235
235
  }
236
+ interface MetaFilter {
237
+ key: string;
238
+ value: string;
239
+ comparison?: string;
240
+ criterion?: string;
241
+ }
236
242
  interface BalanceQueryParams {
237
243
  address?: WalletAddress | string | null;
238
244
  bundleHash?: BundleHash | string | null;
@@ -245,7 +251,7 @@ interface MetaQueryParams {
245
251
  key?: string | null;
246
252
  value?: string | null;
247
253
  latest?: boolean | null;
248
- filter?: string | null;
254
+ filter?: MetaFilter[] | null;
249
255
  queryArgs?: Record<string, unknown> | null;
250
256
  count?: number | null;
251
257
  countBy?: string | null;
@@ -323,78 +329,10 @@ declare function createPosition(value: string): Position;
323
329
  declare function createTokenSlug(value: string): TokenSlug;
324
330
  declare function createMolecularHash(value: string): MolecularHash;
325
331
 
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
332
  interface NormalizedMeta {
395
333
  key: string;
396
- value: string | number | boolean | null;
397
- [additionalProps: string]: unknown;
334
+ value: string | null;
335
+ [props: string]: unknown;
398
336
  }
399
337
  interface MetaItem {
400
338
  key: string;
@@ -404,7 +342,7 @@ interface MetaItem {
404
342
  interface AggregatedMetaResult {
405
343
  [key: string]: unknown;
406
344
  }
407
- declare class Meta {
345
+ declare class Meta$1 {
408
346
  static normalizeMeta(meta: MetaData | MetaItem[] | null): NormalizedMeta[];
409
347
  static aggregateMeta(metaItems: NormalizedMeta[] | MetaItem[] | null): AggregatedMetaResult;
410
348
  static mergeMeta(...metaArrays: (NormalizedMeta[] | MetaItem[] | null)[]): NormalizedMeta[];
@@ -449,9 +387,85 @@ declare class AtomMeta {
449
387
  clone(): AtomMeta;
450
388
  }
451
389
 
390
+ interface AtomMetaData {
391
+ readonly key: string;
392
+ readonly value: string | null;
393
+ readonly [props: string]: unknown;
394
+ }
395
+ interface AtomCreationParams extends AtomParams {
396
+ version?: string | number | null | undefined;
397
+ }
398
+ interface AtomHashableData {
399
+ position: string;
400
+ walletAddress: string;
401
+ isotope: AtomIsotope;
402
+ token: string;
403
+ value: string | null;
404
+ batchId: string | null;
405
+ metaType: string | null;
406
+ metaId: string | null;
407
+ meta: AtomMetaData[] | null;
408
+ createdAt: string;
409
+ index: number;
410
+ version?: string | number | null;
411
+ }
412
+ declare class Atom {
413
+ position: string | null;
414
+ walletAddress: WalletAddress | string | null;
415
+ isotope: AtomIsotope | null;
416
+ token: TokenSlug | string | null;
417
+ value: string | null;
418
+ batchId: BatchId | string | null;
419
+ metaType: MetaType | string | null;
420
+ metaId: MetaId | string | null;
421
+ meta: AtomMetaData[];
422
+ otsFragment: string | null;
423
+ index: number | null;
424
+ createdAt: string;
425
+ version: string | undefined;
426
+ constructor({ position, walletAddress, isotope, token, value, batchId, metaType, metaId, meta, otsFragment, index, createdAt, version }?: AtomCreationParams);
427
+ aggregatedMeta(): Record<string, unknown>;
428
+ getHashableValues(): string[];
429
+ getStructuredData(): AtomHashableData;
430
+ toJSON(options?: {
431
+ includeOtsFragments?: boolean;
432
+ includeValidationContext?: boolean;
433
+ validateFields?: boolean;
434
+ }): Record<string, unknown>;
435
+ clone(): Atom;
436
+ isValid(): boolean;
437
+ static getHashableProps(): string[];
438
+ static getUnclaimedProps(): string[];
439
+ static create({ isotope, wallet, value, metaType, metaId, meta, batchId }: {
440
+ isotope: AtomIsotope | string;
441
+ wallet?: any | null;
442
+ value?: string | number | null;
443
+ metaType?: string | null;
444
+ metaId?: string | null;
445
+ meta?: AtomMeta | any[] | Record<string, any> | null;
446
+ batchId?: string | null;
447
+ }): Atom;
448
+ static fromJSON(json: string | Record<string, unknown>, options?: {
449
+ validateStructure?: boolean;
450
+ strictMode?: boolean;
451
+ }): Atom;
452
+ static jsonToObject(jsonData: Record<string, unknown>): Atom;
453
+ static hashAtoms({ atoms }: {
454
+ atoms: Atom[];
455
+ }): string;
456
+ static sortAtoms(atoms: Atom[]): Atom[];
457
+ static generateNextAtomIndex(atoms: Atom[]): number;
458
+ static isotopeFilter(isotopes: AtomIsotope | AtomIsotope[], atoms: Atom[]): Atom[];
459
+ static validateAtom(atom: unknown): atom is Atom;
460
+ static isIsotope(atom: Atom, isotope: AtomIsotope | null): boolean;
461
+ static getUniqueIsotopes(atoms: Atom[]): AtomIsotope[];
462
+ static calculateTotalValue(atoms: Atom[]): number;
463
+ static groupByIsotope(atoms: Atom[]): Record<AtomIsotope, Atom[]>;
464
+ }
465
+
452
466
  declare class Wallet {
453
467
  token: string;
454
- balance: number;
468
+ balance: string;
455
469
  address: string | null;
456
470
  position: string | null;
457
471
  bundle: string | null;
@@ -516,6 +530,116 @@ declare class Wallet {
516
530
  deserializeKey(serializedKey: string): Uint8Array;
517
531
  }
518
532
 
533
+ declare class Meta<T extends MetaData = MetaData> {
534
+ private readonly __data;
535
+ constructor(args?: T);
536
+ static toObject<U extends MetaData>(object: U): Meta<U>;
537
+ get<K extends keyof T>(key: K): T[K] | undefined;
538
+ set<K extends keyof T>(key: K, value: T[K]): void;
539
+ has<K extends keyof T>(key: K): boolean;
540
+ keys(): string[];
541
+ toJSON(): T;
542
+ clone(): Meta<T>;
543
+ merge<U extends MetaData>(other: Meta<U>): Meta<T & U>;
544
+ forEach<K extends keyof T>(callback: (value: T[K], key: K) => void): void;
545
+ get size(): number;
546
+ clear(): void;
547
+ }
548
+
549
+ type CallbackAction = 'reject' | 'meta' | 'collect' | 'buffer' | 'remit' | 'burn';
550
+ interface CallbackParams {
551
+ action: CallbackAction | string;
552
+ metaType?: MetaType | string | null;
553
+ metaId?: MetaId | string | null;
554
+ meta?: Meta<MetaData> | MetaData | null;
555
+ address?: WalletAddress | string | null;
556
+ token?: TokenSlug | string | null;
557
+ amount?: string | null;
558
+ comparison?: string | null;
559
+ }
560
+ interface CallbackJSON {
561
+ action: string;
562
+ metaType?: string;
563
+ metaId?: string;
564
+ meta?: MetaData;
565
+ address?: string;
566
+ token?: string;
567
+ amount?: string;
568
+ comparison?: string;
569
+ }
570
+ declare class Callback {
571
+ private __action;
572
+ private __metaType?;
573
+ private __metaId?;
574
+ private __meta?;
575
+ private __address?;
576
+ private __token?;
577
+ private __amount?;
578
+ private __comparison?;
579
+ constructor(params: CallbackParams);
580
+ set comparison(comparison: string);
581
+ set amount(amount: string);
582
+ set token(token: string);
583
+ set address(address: string);
584
+ set meta(meta: Meta<MetaData> | MetaData);
585
+ set metaType(metaType: string);
586
+ set metaId(metaId: string);
587
+ static toObject(object: CallbackParams): Callback;
588
+ toJSON(): CallbackJSON;
589
+ isReject(): this is Callback & {
590
+ __action: 'reject';
591
+ };
592
+ isMeta(): this is Callback & {
593
+ __action: 'meta';
594
+ };
595
+ isCollect(): this is Callback & {
596
+ __action: 'collect';
597
+ };
598
+ isBuffer(): this is Callback & {
599
+ __action: 'buffer';
600
+ };
601
+ isRemit(): this is Callback & {
602
+ __action: 'remit';
603
+ };
604
+ isBurn(): this is Callback & {
605
+ __action: 'burn';
606
+ };
607
+ private _is;
608
+ get action(): string;
609
+ }
610
+
611
+ interface ConditionParams {
612
+ key: string;
613
+ value: any;
614
+ comparison: string;
615
+ }
616
+ declare class Condition {
617
+ private __key;
618
+ private __value;
619
+ private __comparison;
620
+ constructor({ key, value, comparison }: ConditionParams);
621
+ static toObject(object: ConditionParams): Condition;
622
+ toJSON(): ConditionParams;
623
+ }
624
+
625
+ interface RuleParams {
626
+ condition?: Condition[];
627
+ callback?: Callback[];
628
+ }
629
+ interface RuleJSON {
630
+ condition: Condition[];
631
+ callback: Callback[];
632
+ }
633
+ declare class Rule {
634
+ private __condition;
635
+ private __callback;
636
+ constructor({ condition, callback }: RuleParams);
637
+ set comparison(condition: Condition | Record<string, any>);
638
+ set callback(callback: Callback | Record<string, any>);
639
+ static toObject(object: any): Rule;
640
+ toJSON(): RuleJSON;
641
+ }
642
+
519
643
  declare class Molecule {
520
644
  status: string | null;
521
645
  molecularHash: string | null;
@@ -527,7 +651,8 @@ declare class Molecule {
527
651
  sourceWallet: Wallet | null;
528
652
  remainderWallet: Wallet | null;
529
653
  atoms: Atom[];
530
- version: string | null;
654
+ version: string | null | undefined;
655
+ parentHashes: string[];
531
656
  local?: number;
532
657
  constructor({ secret, bundle, sourceWallet, remainderWallet, cellSlug, version }?: {
533
658
  secret?: string | null;
@@ -544,6 +669,12 @@ declare class Molecule {
544
669
  generateIndex(): number;
545
670
  addAtom(atom: Atom): Molecule;
546
671
  addContinuIdAtom(): Molecule;
672
+ addPolicyAtom({ metaType, metaId, meta, policy }: {
673
+ metaType: string;
674
+ metaId: string;
675
+ meta?: any;
676
+ policy?: Record<string, any>;
677
+ }): Molecule;
547
678
  initValue({ recipientWallet, amount }: {
548
679
  recipientWallet: Wallet;
549
680
  amount: number;
@@ -568,10 +699,13 @@ declare class Molecule {
568
699
  amount: number;
569
700
  meta: any;
570
701
  }): Molecule;
571
- burnToken({ amount, walletBundle }: {
702
+ burnToken({ amount, walletBundle: _walletBundle }: {
572
703
  amount: number;
573
704
  walletBundle?: string | null;
574
705
  }): Molecule;
706
+ initAuthorization({ meta }: {
707
+ meta: Record<string, any>;
708
+ }): Molecule;
575
709
  initMeta({ meta, metaType, metaId, policy }: {
576
710
  meta: any;
577
711
  metaType: string;
@@ -579,12 +713,49 @@ declare class Molecule {
579
713
  policy?: any;
580
714
  }): Molecule;
581
715
  initWalletCreation(wallet: Wallet, atomMeta?: AtomMeta | null): Molecule;
716
+ createRule({ metaType, metaId, rule, policy }: {
717
+ metaType: string;
718
+ metaId: string;
719
+ rule: Rule[] | any[] | any;
720
+ policy?: Record<string, any>;
721
+ }): Molecule;
722
+ initTokenRequest({ token, amount, metaType, metaId, meta, batchId }: {
723
+ token: string;
724
+ amount: number;
725
+ metaType: string;
726
+ metaId: string;
727
+ meta?: Record<string, any>;
728
+ batchId?: string | null;
729
+ }): Molecule;
582
730
  static fromJSON(json: string | any, options?: {
583
731
  includeValidationContext?: boolean;
584
732
  validateStructure?: boolean;
585
733
  strictMode?: boolean;
586
734
  }): Molecule;
587
735
  static jsonToObject(json: string): Molecule;
736
+ initPeering({ host }: {
737
+ host: string;
738
+ }): Molecule;
739
+ initAppendRequest({ metaType, metaId, action, meta }: {
740
+ metaType: string;
741
+ metaId: string;
742
+ action: string;
743
+ meta?: Record<string, any>;
744
+ }): Molecule;
745
+ initDepositBuffer({ amount, tradeRates }: {
746
+ amount: number;
747
+ tradeRates?: Record<string, any>;
748
+ }): Molecule;
749
+ initWithdrawBuffer({ recipients, signingWallet }: {
750
+ recipients: Record<string, number>;
751
+ signingWallet?: any | null;
752
+ }): Molecule;
753
+ initShadowWalletClaim(wallet: Wallet): Molecule;
754
+ initIdentifierCreation({ type, contact, code }: {
755
+ type: string;
756
+ contact: string;
757
+ code: string;
758
+ }): Molecule;
588
759
  }
589
760
 
590
761
  interface MoleculeStructure {
@@ -613,6 +784,19 @@ declare class CheckMolecule {
613
784
  isotopeV(senderWallet?: Wallet | null): boolean;
614
785
  molecularHash(): boolean;
615
786
  ots(): boolean;
787
+ static fromServerData({ molecularHash, bundleHash, cellSlug, status, createdAt, atoms }: {
788
+ molecularHash: string;
789
+ bundleHash: string;
790
+ cellSlug?: string | null;
791
+ status?: string | null;
792
+ createdAt?: string | null;
793
+ atoms?: any[];
794
+ }): Molecule;
795
+ static verifyFromServerData(moleculeData: any): {
796
+ molecularHash: string | null;
797
+ verified: boolean;
798
+ error: string | null;
799
+ };
616
800
  }
617
801
 
618
802
  declare class Dot {
@@ -658,10 +842,10 @@ declare class GraphQLClient implements GraphQLClient$1 {
658
842
  pubkey: string;
659
843
  wallet?: Wallet;
660
844
  }): 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>>;
845
+ query<TResult = unknown>(request: GraphQLRequest): Promise<GraphQLResponse<TResult>>;
846
+ mutation<TResult = unknown>(request: GraphQLRequest): Promise<GraphQLResponse<TResult>>;
847
+ mutate<TResult = unknown>(request: GraphQLRequest): Promise<GraphQLResponse<TResult>>;
848
+ subscription<TResult = unknown>(request: GraphQLRequest): AsyncIterableIterator<GraphQLResponse<TResult>>;
665
849
  subscribe(request: {
666
850
  query: string;
667
851
  variables?: Record<string, any>;
@@ -717,6 +901,7 @@ declare class AuthToken {
717
901
  getExpiresAt(): number;
718
902
  getPubkey(): string;
719
903
  isEncrypted(): boolean;
904
+ getExpireInterval(): number;
720
905
  isExpired(): boolean;
721
906
  getAuthData(): {
722
907
  token: string;
@@ -856,7 +1041,7 @@ declare class Query {
856
1041
  }): any;
857
1042
  createQueryContext(): Record<string, any>;
858
1043
  execute({ variables, context }?: {
859
- variables?: Record<string, any>;
1044
+ variables?: Record<string, any> | null;
860
1045
  context?: Record<string, any>;
861
1046
  }): Promise<Response | null>;
862
1047
  }
@@ -871,6 +1056,30 @@ declare class Mutation extends Query {
871
1056
  }): Promise<Response | null>;
872
1057
  }
873
1058
 
1059
+ declare class ResponseProposeMolecule extends Response {
1060
+ private $__clientMolecule;
1061
+ constructor({ query, json }: {
1062
+ query: Query;
1063
+ json: Record<string, unknown>;
1064
+ });
1065
+ init(): void;
1066
+ clientMolecule(): any;
1067
+ molecule(): Molecule | null;
1068
+ success(): boolean;
1069
+ status(): string;
1070
+ reason(): string;
1071
+ payload(): any;
1072
+ }
1073
+
1074
+ declare class ResponseRequestAuthorization extends ResponseProposeMolecule {
1075
+ payloadKey(key: string): any;
1076
+ token(): string;
1077
+ time(): string;
1078
+ expiresAt(): number;
1079
+ encrypt(): string;
1080
+ pubKey(): string;
1081
+ }
1082
+
874
1083
  declare class KnishIOClient {
875
1084
  private $__secret;
876
1085
  private $__bundle;
@@ -882,6 +1091,7 @@ declare class KnishIOClient {
882
1091
  private $__logging;
883
1092
  private $__authTokenObjects;
884
1093
  private $__authToken;
1094
+ private $__authInProcess;
885
1095
  private $__remainderWallet;
886
1096
  private lastMoleculeQuery;
887
1097
  private abortControllers;
@@ -946,7 +1156,7 @@ declare class KnishIOClient {
946
1156
  batchId?: string | null;
947
1157
  sourceWallet?: Wallet | null;
948
1158
  }): Promise<Response | null>;
949
- requestAuthToken({ secret: _secret, seed: _seed, cellSlug: _cellSlug, encrypt: _encrypt }?: {
1159
+ requestAuthToken({ secret, seed, cellSlug, encrypt }?: {
950
1160
  secret?: string | null;
951
1161
  seed?: string | null;
952
1162
  cellSlug?: string | null;
@@ -982,18 +1192,34 @@ declare class KnishIOClient {
982
1192
  queryContinuId({ bundle }: {
983
1193
  bundle: BundleHash | string;
984
1194
  }): Promise<Response>;
985
- queryMeta({ metaType, metaId, key, value, latest, fields: _fields, filter, queryArgs, count, countBy, throughAtom, values, keys, atomValues }: {
1195
+ queryMeta({ metaType, metaId, key, value, latest, fields: _fields, filter, queryArgs, count, countBy, throughAtom, throughMolecule, values, keys, atomValues }: {
986
1196
  metaType: MetaType | string;
987
1197
  metaId?: MetaId | string | null;
988
1198
  key?: string | null;
989
1199
  value?: string | null;
990
1200
  latest?: boolean | null;
991
1201
  fields?: string[] | null;
992
- filter?: string | null;
1202
+ filter?: MetaFilter[] | null;
993
1203
  queryArgs?: Record<string, any> | null;
994
1204
  count?: number | null;
995
1205
  countBy?: string | null;
996
1206
  throughAtom?: boolean | null;
1207
+ throughMolecule?: boolean | null;
1208
+ values?: any[] | null;
1209
+ keys?: string[] | null;
1210
+ atomValues?: any[] | null;
1211
+ }): Promise<Response>;
1212
+ queryMetaVerified(params: {
1213
+ metaType: MetaType | string;
1214
+ metaId?: MetaId | string | null;
1215
+ key?: string | null;
1216
+ value?: string | null;
1217
+ latest?: boolean | null;
1218
+ fields?: string[] | null;
1219
+ filter?: MetaFilter[] | null;
1220
+ queryArgs?: Record<string, any> | null;
1221
+ count?: number | null;
1222
+ countBy?: string | null;
997
1223
  values?: any[] | null;
998
1224
  keys?: string[] | null;
999
1225
  atomValues?: any[] | null;
@@ -1029,7 +1255,7 @@ declare class KnishIOClient {
1029
1255
  metaId?: string | null;
1030
1256
  indexes?: number[] | null;
1031
1257
  index?: number | null;
1032
- filter?: string | null;
1258
+ filter?: MetaFilter[] | null;
1033
1259
  latest?: boolean | null;
1034
1260
  queryArgs?: Record<string, any> | null;
1035
1261
  }): Promise<Response>;
@@ -1178,6 +1404,15 @@ declare class KnishIOClient {
1178
1404
  requestProfileAuthToken({ secret, encrypt }: {
1179
1405
  secret: string;
1180
1406
  encrypt?: boolean;
1407
+ }): Promise<ResponseRequestAuthorization>;
1408
+ registerPeer({ host }: {
1409
+ host: string;
1410
+ }): Promise<Response>;
1411
+ appendRequest({ metaType, metaId, action, meta }: {
1412
+ metaType: string;
1413
+ metaId: string;
1414
+ action: string;
1415
+ meta?: Record<string, any>;
1181
1416
  }): Promise<Response>;
1182
1417
  cellSlug(): string | null;
1183
1418
  uri(): string[];
@@ -1243,33 +1478,33 @@ declare class ResponseAtom extends Response {
1243
1478
  declare class QueryAtom extends Query {
1244
1479
  constructor(graphQLClient: GraphQLClient$1, knishIOClient: KnishIOClient);
1245
1480
  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;
1481
+ molecularHashes?: string[] | null;
1482
+ molecularHash?: string | null;
1483
+ bundleHashes?: string[] | null;
1484
+ bundleHash?: string | null;
1485
+ positions?: string[] | null;
1486
+ position?: string | null;
1487
+ walletAddresses?: string[] | null;
1488
+ walletAddress?: string | null;
1489
+ isotopes?: string[] | null;
1490
+ isotope?: string | null;
1491
+ tokenSlugs?: string[] | null;
1492
+ tokenSlug?: string | null;
1493
+ cellSlugs?: string[] | null;
1494
+ cellSlug?: string | null;
1495
+ batchIds?: string[] | null;
1496
+ batchId?: string | null;
1497
+ values?: string[] | null;
1498
+ value?: string | number | null;
1499
+ metaTypes?: string[] | null;
1500
+ metaType?: string | null;
1501
+ metaIds?: string[] | null;
1502
+ metaId?: string | null;
1503
+ indexes?: number[] | null;
1504
+ index?: number | null;
1505
+ filter?: object[] | null;
1506
+ latest?: boolean | null;
1507
+ queryArgs?: object | null;
1273
1508
  }): Record<string, any>;
1274
1509
  createResponse(json: any): ResponseAtom;
1275
1510
  }
@@ -1279,6 +1514,7 @@ declare class ResponseMetaType extends Response {
1279
1514
  query: Query;
1280
1515
  json: any;
1281
1516
  });
1517
+ private extractPayload;
1282
1518
  payload(): any | null;
1283
1519
  }
1284
1520
 
@@ -1292,7 +1528,7 @@ declare class QueryMetaType extends Query {
1292
1528
  latest?: boolean | null;
1293
1529
  filter?: any | null;
1294
1530
  queryArgs?: any | null;
1295
- count?: string | null;
1531
+ count?: string | number | null;
1296
1532
  countBy?: string | null;
1297
1533
  cellSlug?: string | null;
1298
1534
  }): Record<string, any>;
@@ -1336,6 +1572,7 @@ declare class ResponseContinuId extends Response {
1336
1572
 
1337
1573
  declare class QueryContinuId extends Query {
1338
1574
  constructor(graphQLClient: GraphQLClient$1, knishIOClient: KnishIOClient);
1575
+ createQueryContext(): Record<string, any>;
1339
1576
  createResponse(json: any): ResponseContinuId;
1340
1577
  }
1341
1578
 
@@ -1345,21 +1582,6 @@ declare class QueryBatch extends Query {
1345
1582
  createResponse(json: any): Response;
1346
1583
  }
1347
1584
 
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
1585
  declare abstract class MutationProposeMolecule extends Mutation {
1364
1586
  protected $__molecule: Molecule;
1365
1587
  protected $__remainderWallet: any | null;
@@ -1397,14 +1619,6 @@ declare class MutationCreateWallet extends MutationProposeMolecule {
1397
1619
  createResponse(json: any): ResponseCreateWallet;
1398
1620
  }
1399
1621
 
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
1622
  declare class MutationRequestAuthorization extends MutationProposeMolecule {
1409
1623
  fillMolecule({ meta }: {
1410
1624
  meta: any;
@@ -1452,6 +1666,29 @@ declare class MutationRequestTokens extends MutationProposeMolecule {
1452
1666
  createResponse(json: any): ResponseRequestTokens;
1453
1667
  }
1454
1668
 
1669
+ declare class ResponsePeering extends ResponseProposeMolecule {
1670
+ }
1671
+
1672
+ declare class MutationPeering extends MutationProposeMolecule {
1673
+ fillMolecule({ host }: {
1674
+ host: string;
1675
+ }): void;
1676
+ createResponse(json: any): ResponsePeering;
1677
+ }
1678
+
1679
+ declare class ResponseAppendRequest extends ResponseProposeMolecule {
1680
+ }
1681
+
1682
+ declare class MutationAppendRequest extends MutationProposeMolecule {
1683
+ fillMolecule({ metaType, metaId, action, meta }: {
1684
+ metaType: string;
1685
+ metaId: string;
1686
+ action: string;
1687
+ meta?: Record<string, any>;
1688
+ }): void;
1689
+ createResponse(json: any): ResponseAppendRequest;
1690
+ }
1691
+
1455
1692
  declare class TokenUnit {
1456
1693
  id: string;
1457
1694
  name: string;
@@ -1514,7 +1751,7 @@ declare const CRYPTO_CONSTANTS: {
1514
1751
  };
1515
1752
  declare function shake256(input: string, outputLength: number): string;
1516
1753
  declare function generateSecret(seed?: string | null, length?: number): string;
1517
- declare function generateBundleHash(secret: string, source?: string | null): BundleHash;
1754
+ declare function generateBundleHash(secret: string, _source?: string | null): BundleHash;
1518
1755
  declare function generatePosition(): Position;
1519
1756
  declare function generateBatchId({ molecularHash, index }?: {
1520
1757
  molecularHash?: string | null;
@@ -1805,7 +2042,6 @@ declare const DevUtils: {
1805
2042
  runFullCompatibilityTests?: never;
1806
2043
  getBuildInfo?: never;
1807
2044
  };
1808
-
1809
2045
  declare const KnishIO: {
1810
2046
  shake256: typeof shake256;
1811
2047
  generateSecret: typeof generateSecret;
@@ -1830,4 +2066,4 @@ declare const KnishIO: {
1830
2066
  };
1831
2067
  };
1832
2068
 
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 };
2069
+ 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$1 as Meta, type MetaData, type MetaId, type MetaQueryParams, type MetaType, type MolecularHash, MolecularHashMismatchException, Molecule, type MoleculeParams, Mutation, MutationAppendRequest, MutationCreateMeta, MutationCreateToken, MutationCreateWallet, type MutationOperation, MutationPeering, MutationProposeMolecule, MutationRequestAuthorization, MutationRequestTokens, MutationTransferTokens, PolicyMeta, type Position, type PositionGenerationOptions, Query, QueryAtom, QueryBalance, QueryBatch, QueryContinuId, QueryMetaType, QueryMetaTypeViaAtom, type QueryOperation, QueryWalletBundle, QueryWalletList, type RequestTokensParams, Response, ResponseAppendRequest, ResponseAtom, ResponseBalance, ResponseContinuId, ResponseCreateMeta, ResponseCreateToken, ResponseCreateWallet, ResponseMetaType, ResponseMetaTypeViaAtom, ResponsePeering, 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, 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 };