@wishknish/knishio-client-ts 0.7.4 → 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.
- package/dist/index.cjs +2670 -1039
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +336 -105
- package/dist/index.d.ts +336 -105
- package/dist/index.iife.js +22097 -20047
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +2667 -1040
- package/dist/index.js.map +1 -1
- package/package.json +10 -4
- package/src/AuthToken.ts +8 -2
- package/src/KnishIOClient.ts +306 -50
- package/src/constants.ts +5 -3
- package/src/core/Atom.ts +167 -100
- package/src/core/AtomMeta.ts +11 -28
- package/src/core/Meta.ts +18 -15
- package/src/core/Molecule.ts +582 -140
- package/src/core/Wallet.ts +19 -24
- package/src/index.ts +8 -0
- package/src/instance/rules/Rule.ts +128 -19
- package/src/libraries/CheckMolecule.ts +88 -1
- package/src/libraries/crypto.ts +14 -30
- package/src/libraries/strings.ts +26 -25
- package/src/mutation/MutationAppendRequest.ts +52 -0
- package/src/mutation/MutationCreateRule.ts +2 -2
- package/src/mutation/MutationPeering.ts +37 -0
- package/src/mutation/MutationRequestAuthorization.ts +3 -3
- package/src/query/QueryActiveSession.ts +0 -1
- package/src/query/QueryContinuId.ts +8 -0
- package/src/query/QueryMetaTypeViaMolecule.ts +221 -0
- package/src/query/QueryWalletList.ts +2 -2
- package/src/response/ResponseAppendRequest.ts +17 -0
- package/src/response/ResponseBalance.ts +8 -3
- package/src/response/ResponseContinuId.ts +1 -1
- package/src/response/ResponseMetaType.ts +32 -19
- package/src/response/ResponseMetaTypeViaMolecule.ts +224 -0
- package/src/response/ResponsePeering.ts +17 -0
- package/src/response/ResponsePolicy.ts +2 -3
- package/src/response/ResponseProposeMolecule.ts +0 -1
- package/src/response/ResponseRequestAuthorization.ts +32 -2
- package/src/response/ResponseRequestAuthorizationGuest.ts +25 -1
- package/src/response/ResponseWalletList.ts +1 -1
- package/src/types/guards.ts +18 -5
- package/src/types/index.ts +3 -3
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;
|
|
@@ -329,78 +329,10 @@ declare function createPosition(value: string): Position;
|
|
|
329
329
|
declare function createTokenSlug(value: string): TokenSlug;
|
|
330
330
|
declare function createMolecularHash(value: string): MolecularHash;
|
|
331
331
|
|
|
332
|
-
interface AtomMetaData {
|
|
333
|
-
readonly key: string;
|
|
334
|
-
readonly value: string | number | boolean | null;
|
|
335
|
-
readonly [additionalProps: string]: unknown;
|
|
336
|
-
}
|
|
337
|
-
interface AtomCreationParams extends AtomParams {
|
|
338
|
-
version?: number;
|
|
339
|
-
}
|
|
340
|
-
interface AtomHashableData {
|
|
341
|
-
position: string;
|
|
342
|
-
walletAddress: string;
|
|
343
|
-
isotope: AtomIsotope;
|
|
344
|
-
token: string;
|
|
345
|
-
value: string | null;
|
|
346
|
-
batchId: string | null;
|
|
347
|
-
metaType: string | null;
|
|
348
|
-
metaId: string | null;
|
|
349
|
-
meta: AtomMetaData[] | null;
|
|
350
|
-
createdAt: string;
|
|
351
|
-
index: number;
|
|
352
|
-
}
|
|
353
|
-
declare class Atom {
|
|
354
|
-
position: string;
|
|
355
|
-
walletAddress: WalletAddress | string;
|
|
356
|
-
isotope: AtomIsotope;
|
|
357
|
-
token: TokenSlug | string;
|
|
358
|
-
value: string | number | null;
|
|
359
|
-
batchId: BatchId | string | null;
|
|
360
|
-
metaType: MetaType | string | null;
|
|
361
|
-
metaId: MetaId | string | null;
|
|
362
|
-
meta: AtomMetaData[];
|
|
363
|
-
otsFragment: string | null;
|
|
364
|
-
index: number | null;
|
|
365
|
-
createdAt: string;
|
|
366
|
-
version: number;
|
|
367
|
-
constructor({ position, walletAddress, isotope, token, value, batchId, metaType, metaId, meta, otsFragment, index, createdAt, version }?: AtomCreationParams);
|
|
368
|
-
aggregatedMeta(): Record<string, unknown>;
|
|
369
|
-
getHashableValues(): string[];
|
|
370
|
-
getStructuredData(): AtomHashableData;
|
|
371
|
-
toJSON(options?: {
|
|
372
|
-
includeOtsFragments?: boolean;
|
|
373
|
-
validateFields?: boolean;
|
|
374
|
-
}): AtomHashableData & {
|
|
375
|
-
otsFragment?: string | null;
|
|
376
|
-
};
|
|
377
|
-
clone(): Atom;
|
|
378
|
-
isValid(): boolean;
|
|
379
|
-
static getHashableProps(): string[];
|
|
380
|
-
static getUnclaimedProps(): string[];
|
|
381
|
-
static create(params: AtomCreationParams): Atom;
|
|
382
|
-
static fromJSON(json: string | Record<string, unknown>, options?: {
|
|
383
|
-
validateStructure?: boolean;
|
|
384
|
-
strictMode?: boolean;
|
|
385
|
-
}): Atom;
|
|
386
|
-
static jsonToObject(jsonData: Record<string, unknown>): Atom;
|
|
387
|
-
static hashAtoms({ atoms }: {
|
|
388
|
-
atoms: Atom[];
|
|
389
|
-
}): string;
|
|
390
|
-
static sortAtoms(atoms: Atom[]): Atom[];
|
|
391
|
-
static generateNextAtomIndex(atoms: Atom[]): number;
|
|
392
|
-
static isotopeFilter(isotopes: AtomIsotope | AtomIsotope[], atoms: Atom[]): Atom[];
|
|
393
|
-
static validateAtom(atom: unknown): atom is Atom;
|
|
394
|
-
static isIsotope(atom: Atom, isotope: AtomIsotope): boolean;
|
|
395
|
-
static getUniqueIsotopes(atoms: Atom[]): AtomIsotope[];
|
|
396
|
-
static calculateTotalValue(atoms: Atom[]): number;
|
|
397
|
-
static groupByIsotope(atoms: Atom[]): Record<AtomIsotope, Atom[]>;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
332
|
interface NormalizedMeta {
|
|
401
333
|
key: string;
|
|
402
|
-
value: string |
|
|
403
|
-
[
|
|
334
|
+
value: string | null;
|
|
335
|
+
[props: string]: unknown;
|
|
404
336
|
}
|
|
405
337
|
interface MetaItem {
|
|
406
338
|
key: string;
|
|
@@ -410,7 +342,7 @@ interface MetaItem {
|
|
|
410
342
|
interface AggregatedMetaResult {
|
|
411
343
|
[key: string]: unknown;
|
|
412
344
|
}
|
|
413
|
-
declare class Meta {
|
|
345
|
+
declare class Meta$1 {
|
|
414
346
|
static normalizeMeta(meta: MetaData | MetaItem[] | null): NormalizedMeta[];
|
|
415
347
|
static aggregateMeta(metaItems: NormalizedMeta[] | MetaItem[] | null): AggregatedMetaResult;
|
|
416
348
|
static mergeMeta(...metaArrays: (NormalizedMeta[] | MetaItem[] | null)[]): NormalizedMeta[];
|
|
@@ -455,9 +387,85 @@ declare class AtomMeta {
|
|
|
455
387
|
clone(): AtomMeta;
|
|
456
388
|
}
|
|
457
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
|
+
|
|
458
466
|
declare class Wallet {
|
|
459
467
|
token: string;
|
|
460
|
-
balance:
|
|
468
|
+
balance: string;
|
|
461
469
|
address: string | null;
|
|
462
470
|
position: string | null;
|
|
463
471
|
bundle: string | null;
|
|
@@ -522,6 +530,116 @@ declare class Wallet {
|
|
|
522
530
|
deserializeKey(serializedKey: string): Uint8Array;
|
|
523
531
|
}
|
|
524
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
|
+
|
|
525
643
|
declare class Molecule {
|
|
526
644
|
status: string | null;
|
|
527
645
|
molecularHash: string | null;
|
|
@@ -533,7 +651,8 @@ declare class Molecule {
|
|
|
533
651
|
sourceWallet: Wallet | null;
|
|
534
652
|
remainderWallet: Wallet | null;
|
|
535
653
|
atoms: Atom[];
|
|
536
|
-
version: string | null;
|
|
654
|
+
version: string | null | undefined;
|
|
655
|
+
parentHashes: string[];
|
|
537
656
|
local?: number;
|
|
538
657
|
constructor({ secret, bundle, sourceWallet, remainderWallet, cellSlug, version }?: {
|
|
539
658
|
secret?: string | null;
|
|
@@ -550,6 +669,12 @@ declare class Molecule {
|
|
|
550
669
|
generateIndex(): number;
|
|
551
670
|
addAtom(atom: Atom): Molecule;
|
|
552
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;
|
|
553
678
|
initValue({ recipientWallet, amount }: {
|
|
554
679
|
recipientWallet: Wallet;
|
|
555
680
|
amount: number;
|
|
@@ -574,10 +699,13 @@ declare class Molecule {
|
|
|
574
699
|
amount: number;
|
|
575
700
|
meta: any;
|
|
576
701
|
}): Molecule;
|
|
577
|
-
burnToken({ amount, walletBundle }: {
|
|
702
|
+
burnToken({ amount, walletBundle: _walletBundle }: {
|
|
578
703
|
amount: number;
|
|
579
704
|
walletBundle?: string | null;
|
|
580
705
|
}): Molecule;
|
|
706
|
+
initAuthorization({ meta }: {
|
|
707
|
+
meta: Record<string, any>;
|
|
708
|
+
}): Molecule;
|
|
581
709
|
initMeta({ meta, metaType, metaId, policy }: {
|
|
582
710
|
meta: any;
|
|
583
711
|
metaType: string;
|
|
@@ -585,12 +713,49 @@ declare class Molecule {
|
|
|
585
713
|
policy?: any;
|
|
586
714
|
}): Molecule;
|
|
587
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;
|
|
588
730
|
static fromJSON(json: string | any, options?: {
|
|
589
731
|
includeValidationContext?: boolean;
|
|
590
732
|
validateStructure?: boolean;
|
|
591
733
|
strictMode?: boolean;
|
|
592
734
|
}): Molecule;
|
|
593
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;
|
|
594
759
|
}
|
|
595
760
|
|
|
596
761
|
interface MoleculeStructure {
|
|
@@ -619,6 +784,19 @@ declare class CheckMolecule {
|
|
|
619
784
|
isotopeV(senderWallet?: Wallet | null): boolean;
|
|
620
785
|
molecularHash(): boolean;
|
|
621
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
|
+
};
|
|
622
800
|
}
|
|
623
801
|
|
|
624
802
|
declare class Dot {
|
|
@@ -723,6 +901,7 @@ declare class AuthToken {
|
|
|
723
901
|
getExpiresAt(): number;
|
|
724
902
|
getPubkey(): string;
|
|
725
903
|
isEncrypted(): boolean;
|
|
904
|
+
getExpireInterval(): number;
|
|
726
905
|
isExpired(): boolean;
|
|
727
906
|
getAuthData(): {
|
|
728
907
|
token: string;
|
|
@@ -877,6 +1056,30 @@ declare class Mutation extends Query {
|
|
|
877
1056
|
}): Promise<Response | null>;
|
|
878
1057
|
}
|
|
879
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
|
+
|
|
880
1083
|
declare class KnishIOClient {
|
|
881
1084
|
private $__secret;
|
|
882
1085
|
private $__bundle;
|
|
@@ -888,6 +1091,7 @@ declare class KnishIOClient {
|
|
|
888
1091
|
private $__logging;
|
|
889
1092
|
private $__authTokenObjects;
|
|
890
1093
|
private $__authToken;
|
|
1094
|
+
private $__authInProcess;
|
|
891
1095
|
private $__remainderWallet;
|
|
892
1096
|
private lastMoleculeQuery;
|
|
893
1097
|
private abortControllers;
|
|
@@ -952,7 +1156,7 @@ declare class KnishIOClient {
|
|
|
952
1156
|
batchId?: string | null;
|
|
953
1157
|
sourceWallet?: Wallet | null;
|
|
954
1158
|
}): Promise<Response | null>;
|
|
955
|
-
requestAuthToken({ secret
|
|
1159
|
+
requestAuthToken({ secret, seed, cellSlug, encrypt }?: {
|
|
956
1160
|
secret?: string | null;
|
|
957
1161
|
seed?: string | null;
|
|
958
1162
|
cellSlug?: string | null;
|
|
@@ -988,7 +1192,7 @@ declare class KnishIOClient {
|
|
|
988
1192
|
queryContinuId({ bundle }: {
|
|
989
1193
|
bundle: BundleHash | string;
|
|
990
1194
|
}): Promise<Response>;
|
|
991
|
-
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 }: {
|
|
992
1196
|
metaType: MetaType | string;
|
|
993
1197
|
metaId?: MetaId | string | null;
|
|
994
1198
|
key?: string | null;
|
|
@@ -1000,6 +1204,22 @@ declare class KnishIOClient {
|
|
|
1000
1204
|
count?: number | null;
|
|
1001
1205
|
countBy?: string | null;
|
|
1002
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;
|
|
1003
1223
|
values?: any[] | null;
|
|
1004
1224
|
keys?: string[] | null;
|
|
1005
1225
|
atomValues?: any[] | null;
|
|
@@ -1184,6 +1404,15 @@ declare class KnishIOClient {
|
|
|
1184
1404
|
requestProfileAuthToken({ secret, encrypt }: {
|
|
1185
1405
|
secret: string;
|
|
1186
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>;
|
|
1187
1416
|
}): Promise<Response>;
|
|
1188
1417
|
cellSlug(): string | null;
|
|
1189
1418
|
uri(): string[];
|
|
@@ -1285,6 +1514,7 @@ declare class ResponseMetaType extends Response {
|
|
|
1285
1514
|
query: Query;
|
|
1286
1515
|
json: any;
|
|
1287
1516
|
});
|
|
1517
|
+
private extractPayload;
|
|
1288
1518
|
payload(): any | null;
|
|
1289
1519
|
}
|
|
1290
1520
|
|
|
@@ -1342,6 +1572,7 @@ declare class ResponseContinuId extends Response {
|
|
|
1342
1572
|
|
|
1343
1573
|
declare class QueryContinuId extends Query {
|
|
1344
1574
|
constructor(graphQLClient: GraphQLClient$1, knishIOClient: KnishIOClient);
|
|
1575
|
+
createQueryContext(): Record<string, any>;
|
|
1345
1576
|
createResponse(json: any): ResponseContinuId;
|
|
1346
1577
|
}
|
|
1347
1578
|
|
|
@@ -1351,21 +1582,6 @@ declare class QueryBatch extends Query {
|
|
|
1351
1582
|
createResponse(json: any): Response;
|
|
1352
1583
|
}
|
|
1353
1584
|
|
|
1354
|
-
declare class ResponseProposeMolecule extends Response {
|
|
1355
|
-
private $__clientMolecule;
|
|
1356
|
-
constructor({ query, json }: {
|
|
1357
|
-
query: Query;
|
|
1358
|
-
json: Record<string, unknown>;
|
|
1359
|
-
});
|
|
1360
|
-
init(): void;
|
|
1361
|
-
clientMolecule(): any;
|
|
1362
|
-
molecule(): Molecule | null;
|
|
1363
|
-
success(): boolean;
|
|
1364
|
-
status(): string;
|
|
1365
|
-
reason(): string;
|
|
1366
|
-
payload(): any;
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
1585
|
declare abstract class MutationProposeMolecule extends Mutation {
|
|
1370
1586
|
protected $__molecule: Molecule;
|
|
1371
1587
|
protected $__remainderWallet: any | null;
|
|
@@ -1403,14 +1619,6 @@ declare class MutationCreateWallet extends MutationProposeMolecule {
|
|
|
1403
1619
|
createResponse(json: any): ResponseCreateWallet;
|
|
1404
1620
|
}
|
|
1405
1621
|
|
|
1406
|
-
declare class ResponseRequestAuthorization extends ResponseProposeMolecule {
|
|
1407
|
-
payloadKey(key: string): any;
|
|
1408
|
-
token(): string;
|
|
1409
|
-
time(): string;
|
|
1410
|
-
encrypt(): string;
|
|
1411
|
-
pubKey(): string;
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
1622
|
declare class MutationRequestAuthorization extends MutationProposeMolecule {
|
|
1415
1623
|
fillMolecule({ meta }: {
|
|
1416
1624
|
meta: any;
|
|
@@ -1458,6 +1666,29 @@ declare class MutationRequestTokens extends MutationProposeMolecule {
|
|
|
1458
1666
|
createResponse(json: any): ResponseRequestTokens;
|
|
1459
1667
|
}
|
|
1460
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
|
+
|
|
1461
1692
|
declare class TokenUnit {
|
|
1462
1693
|
id: string;
|
|
1463
1694
|
name: string;
|
|
@@ -1520,7 +1751,7 @@ declare const CRYPTO_CONSTANTS: {
|
|
|
1520
1751
|
};
|
|
1521
1752
|
declare function shake256(input: string, outputLength: number): string;
|
|
1522
1753
|
declare function generateSecret(seed?: string | null, length?: number): string;
|
|
1523
|
-
declare function generateBundleHash(secret: string,
|
|
1754
|
+
declare function generateBundleHash(secret: string, _source?: string | null): BundleHash;
|
|
1524
1755
|
declare function generatePosition(): Position;
|
|
1525
1756
|
declare function generateBatchId({ molecularHash, index }?: {
|
|
1526
1757
|
molecularHash?: string | null;
|
|
@@ -1835,4 +2066,4 @@ declare const KnishIO: {
|
|
|
1835
2066
|
};
|
|
1836
2067
|
};
|
|
1837
2068
|
|
|
1838
|
-
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, 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 };
|