@wishknish/knishio-client-ts 0.7.4 → 0.7.7
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 +2702 -1033
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +339 -106
- package/dist/index.d.ts +339 -106
- package/dist/index.iife.js +22052 -19964
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +2699 -1034
- package/dist/index.js.map +1 -1
- package/package.json +10 -4
- package/src/AuthToken.ts +8 -2
- package/src/KnishIOClient.ts +346 -51
- 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 +607 -141
- 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,15 +651,18 @@ 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
|
+
continuIdPosition: string | null;
|
|
656
|
+
parentHashes: string[];
|
|
537
657
|
local?: number;
|
|
538
|
-
constructor({ secret, bundle, sourceWallet, remainderWallet, cellSlug, version }?: {
|
|
658
|
+
constructor({ secret, bundle, sourceWallet, remainderWallet, cellSlug, version, continuIdPosition }?: {
|
|
539
659
|
secret?: string | null;
|
|
540
660
|
bundle?: string | null;
|
|
541
661
|
sourceWallet?: Wallet | null;
|
|
542
662
|
remainderWallet?: Wallet | null;
|
|
543
663
|
cellSlug?: string | null;
|
|
544
664
|
version?: string | number | null;
|
|
665
|
+
continuIdPosition?: string | null;
|
|
545
666
|
});
|
|
546
667
|
get cellSlugDelimiter(): string;
|
|
547
668
|
getIsotopes(isotopes: AtomIsotope | AtomIsotope[]): Atom[];
|
|
@@ -550,6 +671,12 @@ declare class Molecule {
|
|
|
550
671
|
generateIndex(): number;
|
|
551
672
|
addAtom(atom: Atom): Molecule;
|
|
552
673
|
addContinuIdAtom(): Molecule;
|
|
674
|
+
addPolicyAtom({ metaType, metaId, meta, policy }: {
|
|
675
|
+
metaType: string;
|
|
676
|
+
metaId: string;
|
|
677
|
+
meta?: any;
|
|
678
|
+
policy?: Record<string, any>;
|
|
679
|
+
}): Molecule;
|
|
553
680
|
initValue({ recipientWallet, amount }: {
|
|
554
681
|
recipientWallet: Wallet;
|
|
555
682
|
amount: number;
|
|
@@ -574,10 +701,13 @@ declare class Molecule {
|
|
|
574
701
|
amount: number;
|
|
575
702
|
meta: any;
|
|
576
703
|
}): Molecule;
|
|
577
|
-
burnToken({ amount, walletBundle }: {
|
|
704
|
+
burnToken({ amount, walletBundle: _walletBundle }: {
|
|
578
705
|
amount: number;
|
|
579
706
|
walletBundle?: string | null;
|
|
580
707
|
}): Molecule;
|
|
708
|
+
initAuthorization({ meta }: {
|
|
709
|
+
meta: Record<string, any>;
|
|
710
|
+
}): Molecule;
|
|
581
711
|
initMeta({ meta, metaType, metaId, policy }: {
|
|
582
712
|
meta: any;
|
|
583
713
|
metaType: string;
|
|
@@ -585,12 +715,49 @@ declare class Molecule {
|
|
|
585
715
|
policy?: any;
|
|
586
716
|
}): Molecule;
|
|
587
717
|
initWalletCreation(wallet: Wallet, atomMeta?: AtomMeta | null): Molecule;
|
|
718
|
+
createRule({ metaType, metaId, rule, policy }: {
|
|
719
|
+
metaType: string;
|
|
720
|
+
metaId: string;
|
|
721
|
+
rule: Rule[] | any[] | any;
|
|
722
|
+
policy?: Record<string, any>;
|
|
723
|
+
}): Molecule;
|
|
724
|
+
initTokenRequest({ token, amount, metaType, metaId, meta, batchId }: {
|
|
725
|
+
token: string;
|
|
726
|
+
amount: number;
|
|
727
|
+
metaType: string;
|
|
728
|
+
metaId: string;
|
|
729
|
+
meta?: Record<string, any>;
|
|
730
|
+
batchId?: string | null;
|
|
731
|
+
}): Molecule;
|
|
588
732
|
static fromJSON(json: string | any, options?: {
|
|
589
733
|
includeValidationContext?: boolean;
|
|
590
734
|
validateStructure?: boolean;
|
|
591
735
|
strictMode?: boolean;
|
|
592
736
|
}): Molecule;
|
|
593
737
|
static jsonToObject(json: string): Molecule;
|
|
738
|
+
initPeering({ host }: {
|
|
739
|
+
host: string;
|
|
740
|
+
}): Molecule;
|
|
741
|
+
initAppendRequest({ metaType, metaId, action, meta }: {
|
|
742
|
+
metaType: string;
|
|
743
|
+
metaId: string;
|
|
744
|
+
action: string;
|
|
745
|
+
meta?: Record<string, any>;
|
|
746
|
+
}): Molecule;
|
|
747
|
+
initDepositBuffer({ amount, tradeRates }: {
|
|
748
|
+
amount: number;
|
|
749
|
+
tradeRates?: Record<string, any>;
|
|
750
|
+
}): Molecule;
|
|
751
|
+
initWithdrawBuffer({ recipients, signingWallet }: {
|
|
752
|
+
recipients: Record<string, number>;
|
|
753
|
+
signingWallet?: any | null;
|
|
754
|
+
}): Molecule;
|
|
755
|
+
initShadowWalletClaim(wallet: Wallet): Molecule;
|
|
756
|
+
initIdentifierCreation({ type, contact, code }: {
|
|
757
|
+
type: string;
|
|
758
|
+
contact: string;
|
|
759
|
+
code: string;
|
|
760
|
+
}): Molecule;
|
|
594
761
|
}
|
|
595
762
|
|
|
596
763
|
interface MoleculeStructure {
|
|
@@ -619,6 +786,19 @@ declare class CheckMolecule {
|
|
|
619
786
|
isotopeV(senderWallet?: Wallet | null): boolean;
|
|
620
787
|
molecularHash(): boolean;
|
|
621
788
|
ots(): boolean;
|
|
789
|
+
static fromServerData({ molecularHash, bundleHash, cellSlug, status, createdAt, atoms }: {
|
|
790
|
+
molecularHash: string;
|
|
791
|
+
bundleHash: string;
|
|
792
|
+
cellSlug?: string | null;
|
|
793
|
+
status?: string | null;
|
|
794
|
+
createdAt?: string | null;
|
|
795
|
+
atoms?: any[];
|
|
796
|
+
}): Molecule;
|
|
797
|
+
static verifyFromServerData(moleculeData: any): {
|
|
798
|
+
molecularHash: string | null;
|
|
799
|
+
verified: boolean;
|
|
800
|
+
error: string | null;
|
|
801
|
+
};
|
|
622
802
|
}
|
|
623
803
|
|
|
624
804
|
declare class Dot {
|
|
@@ -723,6 +903,7 @@ declare class AuthToken {
|
|
|
723
903
|
getExpiresAt(): number;
|
|
724
904
|
getPubkey(): string;
|
|
725
905
|
isEncrypted(): boolean;
|
|
906
|
+
getExpireInterval(): number;
|
|
726
907
|
isExpired(): boolean;
|
|
727
908
|
getAuthData(): {
|
|
728
909
|
token: string;
|
|
@@ -877,6 +1058,30 @@ declare class Mutation extends Query {
|
|
|
877
1058
|
}): Promise<Response | null>;
|
|
878
1059
|
}
|
|
879
1060
|
|
|
1061
|
+
declare class ResponseProposeMolecule extends Response {
|
|
1062
|
+
private $__clientMolecule;
|
|
1063
|
+
constructor({ query, json }: {
|
|
1064
|
+
query: Query;
|
|
1065
|
+
json: Record<string, unknown>;
|
|
1066
|
+
});
|
|
1067
|
+
init(): void;
|
|
1068
|
+
clientMolecule(): any;
|
|
1069
|
+
molecule(): Molecule | null;
|
|
1070
|
+
success(): boolean;
|
|
1071
|
+
status(): string;
|
|
1072
|
+
reason(): string;
|
|
1073
|
+
payload(): any;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
declare class ResponseRequestAuthorization extends ResponseProposeMolecule {
|
|
1077
|
+
payloadKey(key: string): any;
|
|
1078
|
+
token(): string;
|
|
1079
|
+
time(): string;
|
|
1080
|
+
expiresAt(): number;
|
|
1081
|
+
encrypt(): string;
|
|
1082
|
+
pubKey(): string;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
880
1085
|
declare class KnishIOClient {
|
|
881
1086
|
private $__secret;
|
|
882
1087
|
private $__bundle;
|
|
@@ -888,6 +1093,7 @@ declare class KnishIOClient {
|
|
|
888
1093
|
private $__logging;
|
|
889
1094
|
private $__authTokenObjects;
|
|
890
1095
|
private $__authToken;
|
|
1096
|
+
private $__authInProcess;
|
|
891
1097
|
private $__remainderWallet;
|
|
892
1098
|
private lastMoleculeQuery;
|
|
893
1099
|
private abortControllers;
|
|
@@ -952,7 +1158,7 @@ declare class KnishIOClient {
|
|
|
952
1158
|
batchId?: string | null;
|
|
953
1159
|
sourceWallet?: Wallet | null;
|
|
954
1160
|
}): Promise<Response | null>;
|
|
955
|
-
requestAuthToken({ secret
|
|
1161
|
+
requestAuthToken({ secret, seed, cellSlug, encrypt }?: {
|
|
956
1162
|
secret?: string | null;
|
|
957
1163
|
seed?: string | null;
|
|
958
1164
|
cellSlug?: string | null;
|
|
@@ -988,7 +1194,7 @@ declare class KnishIOClient {
|
|
|
988
1194
|
queryContinuId({ bundle }: {
|
|
989
1195
|
bundle: BundleHash | string;
|
|
990
1196
|
}): Promise<Response>;
|
|
991
|
-
queryMeta({ metaType, metaId, key, value, latest, fields: _fields, filter, queryArgs, count, countBy, throughAtom, values, keys, atomValues }: {
|
|
1197
|
+
queryMeta({ metaType, metaId, key, value, latest, fields: _fields, filter, queryArgs, count, countBy, throughAtom, throughMolecule, values, keys, atomValues }: {
|
|
992
1198
|
metaType: MetaType | string;
|
|
993
1199
|
metaId?: MetaId | string | null;
|
|
994
1200
|
key?: string | null;
|
|
@@ -1000,6 +1206,22 @@ declare class KnishIOClient {
|
|
|
1000
1206
|
count?: number | null;
|
|
1001
1207
|
countBy?: string | null;
|
|
1002
1208
|
throughAtom?: boolean | null;
|
|
1209
|
+
throughMolecule?: boolean | null;
|
|
1210
|
+
values?: any[] | null;
|
|
1211
|
+
keys?: string[] | null;
|
|
1212
|
+
atomValues?: any[] | null;
|
|
1213
|
+
}): Promise<Response>;
|
|
1214
|
+
queryMetaVerified(params: {
|
|
1215
|
+
metaType: MetaType | string;
|
|
1216
|
+
metaId?: MetaId | string | null;
|
|
1217
|
+
key?: string | null;
|
|
1218
|
+
value?: string | null;
|
|
1219
|
+
latest?: boolean | null;
|
|
1220
|
+
fields?: string[] | null;
|
|
1221
|
+
filter?: MetaFilter[] | null;
|
|
1222
|
+
queryArgs?: Record<string, any> | null;
|
|
1223
|
+
count?: number | null;
|
|
1224
|
+
countBy?: string | null;
|
|
1003
1225
|
values?: any[] | null;
|
|
1004
1226
|
keys?: string[] | null;
|
|
1005
1227
|
atomValues?: any[] | null;
|
|
@@ -1184,6 +1406,15 @@ declare class KnishIOClient {
|
|
|
1184
1406
|
requestProfileAuthToken({ secret, encrypt }: {
|
|
1185
1407
|
secret: string;
|
|
1186
1408
|
encrypt?: boolean;
|
|
1409
|
+
}): Promise<ResponseRequestAuthorization>;
|
|
1410
|
+
registerPeer({ host }: {
|
|
1411
|
+
host: string;
|
|
1412
|
+
}): Promise<Response>;
|
|
1413
|
+
appendRequest({ metaType, metaId, action, meta }: {
|
|
1414
|
+
metaType: string;
|
|
1415
|
+
metaId: string;
|
|
1416
|
+
action: string;
|
|
1417
|
+
meta?: Record<string, any>;
|
|
1187
1418
|
}): Promise<Response>;
|
|
1188
1419
|
cellSlug(): string | null;
|
|
1189
1420
|
uri(): string[];
|
|
@@ -1285,6 +1516,7 @@ declare class ResponseMetaType extends Response {
|
|
|
1285
1516
|
query: Query;
|
|
1286
1517
|
json: any;
|
|
1287
1518
|
});
|
|
1519
|
+
private extractPayload;
|
|
1288
1520
|
payload(): any | null;
|
|
1289
1521
|
}
|
|
1290
1522
|
|
|
@@ -1342,6 +1574,7 @@ declare class ResponseContinuId extends Response {
|
|
|
1342
1574
|
|
|
1343
1575
|
declare class QueryContinuId extends Query {
|
|
1344
1576
|
constructor(graphQLClient: GraphQLClient$1, knishIOClient: KnishIOClient);
|
|
1577
|
+
createQueryContext(): Record<string, any>;
|
|
1345
1578
|
createResponse(json: any): ResponseContinuId;
|
|
1346
1579
|
}
|
|
1347
1580
|
|
|
@@ -1351,21 +1584,6 @@ declare class QueryBatch extends Query {
|
|
|
1351
1584
|
createResponse(json: any): Response;
|
|
1352
1585
|
}
|
|
1353
1586
|
|
|
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
1587
|
declare abstract class MutationProposeMolecule extends Mutation {
|
|
1370
1588
|
protected $__molecule: Molecule;
|
|
1371
1589
|
protected $__remainderWallet: any | null;
|
|
@@ -1403,14 +1621,6 @@ declare class MutationCreateWallet extends MutationProposeMolecule {
|
|
|
1403
1621
|
createResponse(json: any): ResponseCreateWallet;
|
|
1404
1622
|
}
|
|
1405
1623
|
|
|
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
1624
|
declare class MutationRequestAuthorization extends MutationProposeMolecule {
|
|
1415
1625
|
fillMolecule({ meta }: {
|
|
1416
1626
|
meta: any;
|
|
@@ -1458,6 +1668,29 @@ declare class MutationRequestTokens extends MutationProposeMolecule {
|
|
|
1458
1668
|
createResponse(json: any): ResponseRequestTokens;
|
|
1459
1669
|
}
|
|
1460
1670
|
|
|
1671
|
+
declare class ResponsePeering extends ResponseProposeMolecule {
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
declare class MutationPeering extends MutationProposeMolecule {
|
|
1675
|
+
fillMolecule({ host }: {
|
|
1676
|
+
host: string;
|
|
1677
|
+
}): void;
|
|
1678
|
+
createResponse(json: any): ResponsePeering;
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
declare class ResponseAppendRequest extends ResponseProposeMolecule {
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
declare class MutationAppendRequest extends MutationProposeMolecule {
|
|
1685
|
+
fillMolecule({ metaType, metaId, action, meta }: {
|
|
1686
|
+
metaType: string;
|
|
1687
|
+
metaId: string;
|
|
1688
|
+
action: string;
|
|
1689
|
+
meta?: Record<string, any>;
|
|
1690
|
+
}): void;
|
|
1691
|
+
createResponse(json: any): ResponseAppendRequest;
|
|
1692
|
+
}
|
|
1693
|
+
|
|
1461
1694
|
declare class TokenUnit {
|
|
1462
1695
|
id: string;
|
|
1463
1696
|
name: string;
|
|
@@ -1520,7 +1753,7 @@ declare const CRYPTO_CONSTANTS: {
|
|
|
1520
1753
|
};
|
|
1521
1754
|
declare function shake256(input: string, outputLength: number): string;
|
|
1522
1755
|
declare function generateSecret(seed?: string | null, length?: number): string;
|
|
1523
|
-
declare function generateBundleHash(secret: string,
|
|
1756
|
+
declare function generateBundleHash(secret: string, _source?: string | null): BundleHash;
|
|
1524
1757
|
declare function generatePosition(): Position;
|
|
1525
1758
|
declare function generateBatchId({ molecularHash, index }?: {
|
|
1526
1759
|
molecularHash?: string | null;
|
|
@@ -1835,4 +2068,4 @@ declare const KnishIO: {
|
|
|
1835
2068
|
};
|
|
1836
2069
|
};
|
|
1837
2070
|
|
|
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 };
|
|
2071
|
+
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 };
|