@wishknish/knishio-client-ts 0.8.3 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +399 -258
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -16
- package/dist/index.d.ts +37 -16
- package/dist/index.iife.js +3700 -602
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +421 -280
- package/dist/index.js.map +1 -1
- package/package.json +18 -20
- package/src/KnishIOClient.ts +135 -53
- package/src/constants.ts +1 -2
- package/src/core/Molecule.ts +53 -0
- package/src/core/Wallet.ts +96 -3
- package/src/libraries/Decimal.ts +1 -1
- package/src/libraries/GraphQLClient.ts +83 -0
- package/src/libraries/Hex.ts +4 -3
- package/src/libraries/UrqlClientWrapper.ts +13 -13
- package/src/libraries/crypto.ts +4 -4
- package/src/mutation/MutationClaimShadowWallet.ts +3 -1
- package/src/mutation/MutationTransferTokens.ts +18 -0
- package/src/query/QueryActiveSession.ts +0 -1
- package/src/query/QueryPolicy.ts +0 -1
- package/src/response/ResponseAuthorizationGuest.ts +2 -2
- package/src/response/ResponseBalance.ts +9 -6
- package/src/response/ResponseLinkIdentifier.ts +1 -1
- package/src/response/ResponseRequestAuthorizationGuest.ts +2 -2
- package/src/subscribe/Subscribe.ts +3 -2
- package/src/types/assertions.ts +1 -6
- package/src/types/client.ts +12 -19
- package/src/types/guards.ts +2 -3
- package/src/validation/UNIVERSAL_CONFIGURATION_INTERFACES.ts +3 -5
- package/src/validation/ValidationService.ts +6 -15
- package/src/versions/HashAtom.ts +11 -9
- package/src/query/QueryUserActivity.ts +0 -153
- package/src/response/ResponseQueryUserActivity.ts +0 -89
package/dist/index.d.cts
CHANGED
|
@@ -21,6 +21,13 @@ type PositionPattern = `${HexChar}${HexChar}${string}` & {
|
|
|
21
21
|
};
|
|
22
22
|
type TokenSlugPattern = `${Uppercase<string>}`;
|
|
23
23
|
|
|
24
|
+
interface TransferRecipientInput {
|
|
25
|
+
bundleHash: BundleHash | string;
|
|
26
|
+
units?: string[];
|
|
27
|
+
amount?: number | null;
|
|
28
|
+
batchId?: string | null;
|
|
29
|
+
}
|
|
30
|
+
|
|
24
31
|
type HashAlgorithm = 'SHAKE256' | 'SHA3-256' | 'BLAKE2B';
|
|
25
32
|
type SignatureAlgorithm = 'XMSS' | 'ML-KEM768' | 'SPHINCS+';
|
|
26
33
|
interface SHAKE256Options {
|
|
@@ -515,6 +522,7 @@ declare class Wallet {
|
|
|
515
522
|
isRemainder?: boolean;
|
|
516
523
|
}): void;
|
|
517
524
|
splitUnits(units: string[], remainderWallet: Wallet, recipientWallet?: Wallet | null): void;
|
|
525
|
+
splitUnitsMulti(recipientUnitLists: string[][], recipientWallets: Wallet[], remainderWallet: Wallet): void;
|
|
518
526
|
getTokenUnitsData(): any[];
|
|
519
527
|
isShadow(): boolean;
|
|
520
528
|
initializeMLKEM(): void;
|
|
@@ -526,6 +534,16 @@ declare class Wallet {
|
|
|
526
534
|
cipherText: string;
|
|
527
535
|
encryptedMessage: string;
|
|
528
536
|
}): Promise<any>;
|
|
537
|
+
_mlkemDecryptToString(encryptedData: {
|
|
538
|
+
cipherText: string;
|
|
539
|
+
encryptedMessage: string;
|
|
540
|
+
}): Promise<string | null>;
|
|
541
|
+
hashShare(pubkey: string): string;
|
|
542
|
+
encryptStringML768(message: any, recipientPubkey: string): Promise<string>;
|
|
543
|
+
decryptMyMessageML768(map: Record<string, {
|
|
544
|
+
cipherText: string;
|
|
545
|
+
encryptedMessage: string;
|
|
546
|
+
}>): Promise<string | null>;
|
|
529
547
|
private encryptWithSharedSecret;
|
|
530
548
|
private decryptWithSharedSecret;
|
|
531
549
|
serializeKey(key: Uint8Array): string;
|
|
@@ -683,6 +701,10 @@ declare class Molecule {
|
|
|
683
701
|
recipientWallet: Wallet;
|
|
684
702
|
amount: number;
|
|
685
703
|
}): Molecule;
|
|
704
|
+
initValues({ recipientWallets, amounts }: {
|
|
705
|
+
recipientWallets: Wallet[];
|
|
706
|
+
amounts: number[];
|
|
707
|
+
}): Molecule;
|
|
686
708
|
sign({ bundle, anonymous, compressed }?: {
|
|
687
709
|
bundle?: string | null;
|
|
688
710
|
anonymous?: boolean;
|
|
@@ -841,6 +863,8 @@ declare class GraphQLClient implements GraphQLClient$1 {
|
|
|
841
863
|
encrypt?: boolean;
|
|
842
864
|
});
|
|
843
865
|
private createUrqlClient;
|
|
866
|
+
private shouldEncrypt;
|
|
867
|
+
private cipherFetch;
|
|
844
868
|
setAuthData({ token, pubkey, wallet }: {
|
|
845
869
|
token: string;
|
|
846
870
|
pubkey: string;
|
|
@@ -1197,6 +1221,11 @@ declare class KnishIOClient {
|
|
|
1197
1221
|
batchId?: string | null;
|
|
1198
1222
|
sourceWallet?: Wallet | null;
|
|
1199
1223
|
}): Promise<Response | null>;
|
|
1224
|
+
transferTokens({ token, recipients, sourceWallet }: {
|
|
1225
|
+
token: string;
|
|
1226
|
+
recipients: TransferRecipientInput[];
|
|
1227
|
+
sourceWallet?: Wallet | null;
|
|
1228
|
+
}): Promise<Response | null>;
|
|
1200
1229
|
requestAuthToken({ secret, seed, cellSlug, encrypt }?: {
|
|
1201
1230
|
secret?: string | null;
|
|
1202
1231
|
seed?: string | null;
|
|
@@ -1319,18 +1348,6 @@ declare class KnishIOClient {
|
|
|
1319
1348
|
metaType: MetaType | string;
|
|
1320
1349
|
metaId: MetaId | string;
|
|
1321
1350
|
}): Promise<Response>;
|
|
1322
|
-
queryUserActivity({ bundleHash, metaType, metaId, ipAddress, browser, osCpu, resolution, timeZone, countBy, interval }: {
|
|
1323
|
-
bundleHash: BundleHash | string;
|
|
1324
|
-
metaType: MetaType | string;
|
|
1325
|
-
metaId: MetaId | string;
|
|
1326
|
-
ipAddress?: string | null;
|
|
1327
|
-
browser?: string | null;
|
|
1328
|
-
osCpu?: string | null;
|
|
1329
|
-
resolution?: string | null;
|
|
1330
|
-
timeZone?: string | null;
|
|
1331
|
-
countBy?: string | null;
|
|
1332
|
-
interval?: string | null;
|
|
1333
|
-
}): Promise<Response>;
|
|
1334
1351
|
queryToken({ token }: {
|
|
1335
1352
|
token: TokenSlug | string;
|
|
1336
1353
|
}): Promise<Response>;
|
|
@@ -1354,7 +1371,7 @@ declare class KnishIOClient {
|
|
|
1354
1371
|
}): Promise<string>;
|
|
1355
1372
|
unsubscribe(operationName: string): void;
|
|
1356
1373
|
unsubscribeAll(): void;
|
|
1357
|
-
createToken({ token, amount, meta, batchId, units
|
|
1374
|
+
createToken({ token, amount, meta, batchId, units }: {
|
|
1358
1375
|
token: TokenSlug | string;
|
|
1359
1376
|
amount?: number | string | null;
|
|
1360
1377
|
meta?: Record<string, any> | null;
|
|
@@ -1689,6 +1706,10 @@ declare class MutationTransferTokens extends MutationProposeMolecule {
|
|
|
1689
1706
|
recipientWallet: Wallet;
|
|
1690
1707
|
amount: number | string;
|
|
1691
1708
|
}): void;
|
|
1709
|
+
fillMoleculeMulti({ recipientWallets, amounts }: {
|
|
1710
|
+
recipientWallets: Wallet[];
|
|
1711
|
+
amounts: number[];
|
|
1712
|
+
}): void;
|
|
1692
1713
|
createResponse(json: Record<string, unknown>): ResponseTransferTokens;
|
|
1693
1714
|
}
|
|
1694
1715
|
|
|
@@ -2094,9 +2115,9 @@ declare const DevUtils: {
|
|
|
2094
2115
|
};
|
|
2095
2116
|
};
|
|
2096
2117
|
} | {
|
|
2097
|
-
validateInstallation?:
|
|
2098
|
-
runFullCompatibilityTests?:
|
|
2099
|
-
getBuildInfo?:
|
|
2118
|
+
validateInstallation?: undefined;
|
|
2119
|
+
runFullCompatibilityTests?: undefined;
|
|
2120
|
+
getBuildInfo?: undefined;
|
|
2100
2121
|
};
|
|
2101
2122
|
declare const KnishIO: {
|
|
2102
2123
|
shake256: typeof shake256;
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,13 @@ type PositionPattern = `${HexChar}${HexChar}${string}` & {
|
|
|
21
21
|
};
|
|
22
22
|
type TokenSlugPattern = `${Uppercase<string>}`;
|
|
23
23
|
|
|
24
|
+
interface TransferRecipientInput {
|
|
25
|
+
bundleHash: BundleHash | string;
|
|
26
|
+
units?: string[];
|
|
27
|
+
amount?: number | null;
|
|
28
|
+
batchId?: string | null;
|
|
29
|
+
}
|
|
30
|
+
|
|
24
31
|
type HashAlgorithm = 'SHAKE256' | 'SHA3-256' | 'BLAKE2B';
|
|
25
32
|
type SignatureAlgorithm = 'XMSS' | 'ML-KEM768' | 'SPHINCS+';
|
|
26
33
|
interface SHAKE256Options {
|
|
@@ -515,6 +522,7 @@ declare class Wallet {
|
|
|
515
522
|
isRemainder?: boolean;
|
|
516
523
|
}): void;
|
|
517
524
|
splitUnits(units: string[], remainderWallet: Wallet, recipientWallet?: Wallet | null): void;
|
|
525
|
+
splitUnitsMulti(recipientUnitLists: string[][], recipientWallets: Wallet[], remainderWallet: Wallet): void;
|
|
518
526
|
getTokenUnitsData(): any[];
|
|
519
527
|
isShadow(): boolean;
|
|
520
528
|
initializeMLKEM(): void;
|
|
@@ -526,6 +534,16 @@ declare class Wallet {
|
|
|
526
534
|
cipherText: string;
|
|
527
535
|
encryptedMessage: string;
|
|
528
536
|
}): Promise<any>;
|
|
537
|
+
_mlkemDecryptToString(encryptedData: {
|
|
538
|
+
cipherText: string;
|
|
539
|
+
encryptedMessage: string;
|
|
540
|
+
}): Promise<string | null>;
|
|
541
|
+
hashShare(pubkey: string): string;
|
|
542
|
+
encryptStringML768(message: any, recipientPubkey: string): Promise<string>;
|
|
543
|
+
decryptMyMessageML768(map: Record<string, {
|
|
544
|
+
cipherText: string;
|
|
545
|
+
encryptedMessage: string;
|
|
546
|
+
}>): Promise<string | null>;
|
|
529
547
|
private encryptWithSharedSecret;
|
|
530
548
|
private decryptWithSharedSecret;
|
|
531
549
|
serializeKey(key: Uint8Array): string;
|
|
@@ -683,6 +701,10 @@ declare class Molecule {
|
|
|
683
701
|
recipientWallet: Wallet;
|
|
684
702
|
amount: number;
|
|
685
703
|
}): Molecule;
|
|
704
|
+
initValues({ recipientWallets, amounts }: {
|
|
705
|
+
recipientWallets: Wallet[];
|
|
706
|
+
amounts: number[];
|
|
707
|
+
}): Molecule;
|
|
686
708
|
sign({ bundle, anonymous, compressed }?: {
|
|
687
709
|
bundle?: string | null;
|
|
688
710
|
anonymous?: boolean;
|
|
@@ -841,6 +863,8 @@ declare class GraphQLClient implements GraphQLClient$1 {
|
|
|
841
863
|
encrypt?: boolean;
|
|
842
864
|
});
|
|
843
865
|
private createUrqlClient;
|
|
866
|
+
private shouldEncrypt;
|
|
867
|
+
private cipherFetch;
|
|
844
868
|
setAuthData({ token, pubkey, wallet }: {
|
|
845
869
|
token: string;
|
|
846
870
|
pubkey: string;
|
|
@@ -1197,6 +1221,11 @@ declare class KnishIOClient {
|
|
|
1197
1221
|
batchId?: string | null;
|
|
1198
1222
|
sourceWallet?: Wallet | null;
|
|
1199
1223
|
}): Promise<Response | null>;
|
|
1224
|
+
transferTokens({ token, recipients, sourceWallet }: {
|
|
1225
|
+
token: string;
|
|
1226
|
+
recipients: TransferRecipientInput[];
|
|
1227
|
+
sourceWallet?: Wallet | null;
|
|
1228
|
+
}): Promise<Response | null>;
|
|
1200
1229
|
requestAuthToken({ secret, seed, cellSlug, encrypt }?: {
|
|
1201
1230
|
secret?: string | null;
|
|
1202
1231
|
seed?: string | null;
|
|
@@ -1319,18 +1348,6 @@ declare class KnishIOClient {
|
|
|
1319
1348
|
metaType: MetaType | string;
|
|
1320
1349
|
metaId: MetaId | string;
|
|
1321
1350
|
}): Promise<Response>;
|
|
1322
|
-
queryUserActivity({ bundleHash, metaType, metaId, ipAddress, browser, osCpu, resolution, timeZone, countBy, interval }: {
|
|
1323
|
-
bundleHash: BundleHash | string;
|
|
1324
|
-
metaType: MetaType | string;
|
|
1325
|
-
metaId: MetaId | string;
|
|
1326
|
-
ipAddress?: string | null;
|
|
1327
|
-
browser?: string | null;
|
|
1328
|
-
osCpu?: string | null;
|
|
1329
|
-
resolution?: string | null;
|
|
1330
|
-
timeZone?: string | null;
|
|
1331
|
-
countBy?: string | null;
|
|
1332
|
-
interval?: string | null;
|
|
1333
|
-
}): Promise<Response>;
|
|
1334
1351
|
queryToken({ token }: {
|
|
1335
1352
|
token: TokenSlug | string;
|
|
1336
1353
|
}): Promise<Response>;
|
|
@@ -1354,7 +1371,7 @@ declare class KnishIOClient {
|
|
|
1354
1371
|
}): Promise<string>;
|
|
1355
1372
|
unsubscribe(operationName: string): void;
|
|
1356
1373
|
unsubscribeAll(): void;
|
|
1357
|
-
createToken({ token, amount, meta, batchId, units
|
|
1374
|
+
createToken({ token, amount, meta, batchId, units }: {
|
|
1358
1375
|
token: TokenSlug | string;
|
|
1359
1376
|
amount?: number | string | null;
|
|
1360
1377
|
meta?: Record<string, any> | null;
|
|
@@ -1689,6 +1706,10 @@ declare class MutationTransferTokens extends MutationProposeMolecule {
|
|
|
1689
1706
|
recipientWallet: Wallet;
|
|
1690
1707
|
amount: number | string;
|
|
1691
1708
|
}): void;
|
|
1709
|
+
fillMoleculeMulti({ recipientWallets, amounts }: {
|
|
1710
|
+
recipientWallets: Wallet[];
|
|
1711
|
+
amounts: number[];
|
|
1712
|
+
}): void;
|
|
1692
1713
|
createResponse(json: Record<string, unknown>): ResponseTransferTokens;
|
|
1693
1714
|
}
|
|
1694
1715
|
|
|
@@ -2094,9 +2115,9 @@ declare const DevUtils: {
|
|
|
2094
2115
|
};
|
|
2095
2116
|
};
|
|
2096
2117
|
} | {
|
|
2097
|
-
validateInstallation?:
|
|
2098
|
-
runFullCompatibilityTests?:
|
|
2099
|
-
getBuildInfo?:
|
|
2118
|
+
validateInstallation?: undefined;
|
|
2119
|
+
runFullCompatibilityTests?: undefined;
|
|
2120
|
+
getBuildInfo?: undefined;
|
|
2100
2121
|
};
|
|
2101
2122
|
declare const KnishIO: {
|
|
2102
2123
|
shake256: typeof shake256;
|