@palliora.org/chainsdk 0.3.2 → 0.3.3
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 +149 -104
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +119 -53
- package/dist/index.d.ts +119 -53
- package/dist/index.js +127 -82
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -121,7 +121,7 @@ declare const API_TYPES: {
|
|
|
121
121
|
};
|
|
122
122
|
GuardianNwParams: {
|
|
123
123
|
kzg: string;
|
|
124
|
-
|
|
124
|
+
aggKey: string;
|
|
125
125
|
};
|
|
126
126
|
AppId: string;
|
|
127
127
|
DataLookupItem: {
|
|
@@ -172,9 +172,9 @@ declare const API_TYPES: {
|
|
|
172
172
|
verifier: string;
|
|
173
173
|
};
|
|
174
174
|
SilentThresholdParams: {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
tdParams: string;
|
|
176
|
+
pkBytes: string;
|
|
177
|
+
tauParams: string;
|
|
178
178
|
};
|
|
179
179
|
ThresholdParams: {
|
|
180
180
|
_enum: {
|
|
@@ -200,16 +200,16 @@ declare const API_TYPES: {
|
|
|
200
200
|
};
|
|
201
201
|
};
|
|
202
202
|
Secp256k1Params: {
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
recipientPublicKey: string;
|
|
204
|
+
ephemeralPublicKey: string;
|
|
205
205
|
compressed: string;
|
|
206
206
|
kdf: string;
|
|
207
207
|
salt: string;
|
|
208
208
|
info: string;
|
|
209
209
|
};
|
|
210
210
|
Ed25519Params: {
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
recipientPublicKey: string;
|
|
212
|
+
ephemeralPublicKey: string;
|
|
213
213
|
kdf: string;
|
|
214
214
|
salt: string;
|
|
215
215
|
info: string;
|
|
@@ -221,12 +221,12 @@ declare const API_TYPES: {
|
|
|
221
221
|
};
|
|
222
222
|
};
|
|
223
223
|
ThresholdHybridParams: {
|
|
224
|
-
|
|
225
|
-
|
|
224
|
+
thresholdParams: string;
|
|
225
|
+
symmetricParams: string;
|
|
226
226
|
};
|
|
227
227
|
AsymmetricHybridParams: {
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
asymmetricParams: string;
|
|
229
|
+
symmetricParams: string;
|
|
230
230
|
};
|
|
231
231
|
CipherSuite: {
|
|
232
232
|
_enum: {
|
|
@@ -253,8 +253,11 @@ declare const API_TYPES: {
|
|
|
253
253
|
data: string;
|
|
254
254
|
};
|
|
255
255
|
DAInputChainTransaction: {
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
blockNumber: string;
|
|
257
|
+
extrinsicIndex: string;
|
|
258
|
+
};
|
|
259
|
+
DAInputContractId: {
|
|
260
|
+
id: string;
|
|
258
261
|
};
|
|
259
262
|
DAInputIpfs: {
|
|
260
263
|
cid: string;
|
|
@@ -270,6 +273,7 @@ declare const API_TYPES: {
|
|
|
270
273
|
Null: string;
|
|
271
274
|
Inline: string;
|
|
272
275
|
ChainTransaction: string;
|
|
276
|
+
ContractId: string;
|
|
273
277
|
Ipfs: string;
|
|
274
278
|
Url: string;
|
|
275
279
|
NativeExecute: string;
|
|
@@ -280,6 +284,7 @@ declare const API_TYPES: {
|
|
|
280
284
|
_enum: {
|
|
281
285
|
Dormant: string;
|
|
282
286
|
Active: string;
|
|
287
|
+
Subscription: string;
|
|
283
288
|
};
|
|
284
289
|
};
|
|
285
290
|
StoreType: {
|
|
@@ -293,28 +298,29 @@ declare const API_TYPES: {
|
|
|
293
298
|
ComputeMetadata: {
|
|
294
299
|
name: string;
|
|
295
300
|
description: string;
|
|
296
|
-
|
|
297
|
-
|
|
301
|
+
storeType: string;
|
|
302
|
+
groupId: string;
|
|
298
303
|
};
|
|
299
304
|
ComputeInfo: {
|
|
300
305
|
cipher: string;
|
|
301
|
-
|
|
306
|
+
computerIndices: string;
|
|
302
307
|
fees: string;
|
|
308
|
+
computeRate: string;
|
|
303
309
|
deadline: string;
|
|
304
310
|
confidentiality: string;
|
|
305
|
-
|
|
306
|
-
|
|
311
|
+
feeFunction: string;
|
|
312
|
+
programEnv: string;
|
|
307
313
|
input: string;
|
|
308
314
|
program: string;
|
|
309
315
|
metadata: string;
|
|
310
316
|
};
|
|
311
317
|
Contract: {
|
|
312
|
-
|
|
318
|
+
contractType: string;
|
|
313
319
|
guardians: string;
|
|
314
|
-
|
|
320
|
+
preCheck: string;
|
|
315
321
|
compute: string;
|
|
316
|
-
|
|
317
|
-
|
|
322
|
+
postCheck: string;
|
|
323
|
+
resultCipher: string;
|
|
318
324
|
};
|
|
319
325
|
AgreementInfo: {
|
|
320
326
|
status: string;
|
|
@@ -322,7 +328,7 @@ declare const API_TYPES: {
|
|
|
322
328
|
index: string;
|
|
323
329
|
};
|
|
324
330
|
ComputePayload: {
|
|
325
|
-
|
|
331
|
+
daType: string;
|
|
326
332
|
agreement: string;
|
|
327
333
|
verification: string;
|
|
328
334
|
compute: string;
|
|
@@ -399,17 +405,53 @@ declare const API_TYPES: {
|
|
|
399
405
|
GProof: string;
|
|
400
406
|
GRow: string;
|
|
401
407
|
GDataProof: string;
|
|
408
|
+
AgreementStatus: {
|
|
409
|
+
_enum: string[];
|
|
410
|
+
};
|
|
411
|
+
AcceptedSubStatus: {
|
|
412
|
+
_enum: string[];
|
|
413
|
+
};
|
|
414
|
+
RejectedSubStatus: {
|
|
415
|
+
_enum: string[];
|
|
416
|
+
};
|
|
417
|
+
SettlementReason: {
|
|
418
|
+
_enum: string[];
|
|
419
|
+
};
|
|
420
|
+
ExecutionOutcome: {
|
|
421
|
+
_enum: string[];
|
|
422
|
+
};
|
|
423
|
+
ContractInfo: {
|
|
424
|
+
status: string;
|
|
425
|
+
owner: string;
|
|
426
|
+
originBlock: string;
|
|
427
|
+
invocationBlock: string;
|
|
428
|
+
index: string;
|
|
429
|
+
usagePrice: string;
|
|
430
|
+
contractType: string;
|
|
431
|
+
};
|
|
432
|
+
SettlementInfo: {
|
|
433
|
+
computeRate: string;
|
|
434
|
+
inputContractId: string;
|
|
435
|
+
guardians: string;
|
|
436
|
+
};
|
|
437
|
+
AppKeyInfo: {
|
|
438
|
+
owner: string;
|
|
439
|
+
id: string;
|
|
440
|
+
};
|
|
441
|
+
DataType: {
|
|
442
|
+
_enum: string[];
|
|
443
|
+
};
|
|
402
444
|
};
|
|
403
445
|
declare const DEFAULT_COMPUTE_PAYLOAD: {
|
|
404
446
|
compute: {
|
|
405
|
-
|
|
447
|
+
daType: number;
|
|
406
448
|
verification: number;
|
|
407
449
|
compute: number;
|
|
408
450
|
};
|
|
409
451
|
};
|
|
410
452
|
declare const DEFAULT_EMPTY_PAYLOAD: {
|
|
411
453
|
compute: {
|
|
412
|
-
|
|
454
|
+
daType: number;
|
|
413
455
|
verification: number;
|
|
414
456
|
compute: number;
|
|
415
457
|
agreement: never[];
|
|
@@ -473,7 +515,7 @@ type Hex = `0x${string}`;
|
|
|
473
515
|
*/
|
|
474
516
|
interface ComputePayload {
|
|
475
517
|
/** DA type: 0 = none, 1 = DA. */
|
|
476
|
-
|
|
518
|
+
daType: number;
|
|
477
519
|
/** Guardian agreement keys. Each element is a 32-byte Uint8Array or number[]. */
|
|
478
520
|
agreement?: Uint8Array[] | number[][];
|
|
479
521
|
/** Verification mode. */
|
|
@@ -488,11 +530,11 @@ interface OnChainRef {
|
|
|
488
530
|
}
|
|
489
531
|
interface SilentThresholdParams {
|
|
490
532
|
/** Encoded threshold ciphertext bytes (from encodeCiphertext). */
|
|
491
|
-
|
|
533
|
+
tdParams: number[];
|
|
492
534
|
/** Guardian group aggregate public key bytes. */
|
|
493
|
-
|
|
535
|
+
pkBytes: number[];
|
|
494
536
|
/** KZG powers-of-tau bytes. */
|
|
495
|
-
|
|
537
|
+
tauParams: number[];
|
|
496
538
|
}
|
|
497
539
|
type ThresholdParams = {
|
|
498
540
|
SilentThreshold: SilentThresholdParams;
|
|
@@ -508,16 +550,16 @@ type SymmetricParams = {
|
|
|
508
550
|
};
|
|
509
551
|
type KdfParams = "HkdfSha256" | "HkdfSha512";
|
|
510
552
|
interface Secp256k1Params {
|
|
511
|
-
|
|
512
|
-
|
|
553
|
+
recipientPublicKey: number[];
|
|
554
|
+
ephemeralPublicKey?: number[] | null;
|
|
513
555
|
compressed: boolean;
|
|
514
556
|
kdf: KdfParams;
|
|
515
557
|
salt?: number[] | null;
|
|
516
558
|
info?: number[] | null;
|
|
517
559
|
}
|
|
518
560
|
interface Ed25519Params {
|
|
519
|
-
|
|
520
|
-
|
|
561
|
+
recipientPublicKey: number[];
|
|
562
|
+
ephemeralPublicKey?: number[] | null;
|
|
521
563
|
kdf: KdfParams;
|
|
522
564
|
salt?: number[] | null;
|
|
523
565
|
info?: number[] | null;
|
|
@@ -528,12 +570,12 @@ type AsymmetricParams = {
|
|
|
528
570
|
Ed25519: Ed25519Params;
|
|
529
571
|
};
|
|
530
572
|
interface ThresholdHybridParams {
|
|
531
|
-
|
|
532
|
-
|
|
573
|
+
thresholdParams: ThresholdParams;
|
|
574
|
+
symmetricParams: SymmetricParams;
|
|
533
575
|
}
|
|
534
576
|
interface AsymmetricHybridParams {
|
|
535
|
-
|
|
536
|
-
|
|
577
|
+
asymmetricParams: AsymmetricParams;
|
|
578
|
+
symmetricParams: SymmetricParams;
|
|
537
579
|
}
|
|
538
580
|
/** Mirrors the on-chain CipherSuite enum from spec.ts. */
|
|
539
581
|
type CipherSuite = "Plaintext" | {
|
|
@@ -561,7 +603,7 @@ interface UploadOptions {
|
|
|
561
603
|
guardianGroupInfo: GuardianGroupInfo;
|
|
562
604
|
ref?: string;
|
|
563
605
|
filePath?: string;
|
|
564
|
-
/** Options forwarded to signAndSend. Defaults to dormant DA payload (
|
|
606
|
+
/** Options forwarded to signAndSend. Defaults to dormant DA payload (daType=1, compute=0). */
|
|
565
607
|
opts?: {
|
|
566
608
|
compute: ComputePayload;
|
|
567
609
|
};
|
|
@@ -726,6 +768,13 @@ declare function getKeyring(): Promise<Keyring>;
|
|
|
726
768
|
*/
|
|
727
769
|
declare function getEncKeyring(): Promise<Keyring>;
|
|
728
770
|
|
|
771
|
+
/** Fee terms for a compute step: an absolute amount plus an optional dynamic compute rate. */
|
|
772
|
+
interface Fee {
|
|
773
|
+
/** Absolute fee offered for the compute step, in PALI. Defaults to 0. */
|
|
774
|
+
amount?: PaliAmountInput;
|
|
775
|
+
/** Compute rate used for dynamic fee calculation, in PALI. Defaults to 0. */
|
|
776
|
+
computeRate?: PaliAmountInput;
|
|
777
|
+
}
|
|
729
778
|
/** On-chain proof that a result extrinsic was included in a block. */
|
|
730
779
|
interface SubmissionReceipt {
|
|
731
780
|
/** Hash of the result extrinsic (hex-encoded, "0x..."). */
|
|
@@ -818,15 +867,25 @@ declare function watchForSubmissionReceipt(requestId: string, timeoutMs?: number
|
|
|
818
867
|
*/
|
|
819
868
|
declare function getAgreementCreatedRequestId(blockHeight: number, extrinsicIndex: number): Promise<string | null>;
|
|
820
869
|
|
|
870
|
+
/**
|
|
871
|
+
* Converts a {@link Fee} into the on-chain `fees` / `computeRate` pair.
|
|
872
|
+
* `computeRate` only has meaning for `Active` contracts (it drives dynamic
|
|
873
|
+
* fee calculation during `compute.result`); omit `computeRate` for `Dormant`
|
|
874
|
+
* contracts.
|
|
875
|
+
*/
|
|
876
|
+
declare function buildFee(fee?: Fee): {
|
|
877
|
+
fees: bigint;
|
|
878
|
+
computeRate: bigint;
|
|
879
|
+
};
|
|
821
880
|
interface ComputeContract {
|
|
822
|
-
|
|
881
|
+
contractType: "Active" | "Dormant";
|
|
823
882
|
guardians: GuardianAddress[];
|
|
824
|
-
|
|
883
|
+
preCheck?: unknown;
|
|
825
884
|
compute: Record<string, unknown>;
|
|
826
|
-
|
|
827
|
-
|
|
885
|
+
postCheck?: unknown;
|
|
886
|
+
resultCipher: unknown;
|
|
828
887
|
}
|
|
829
|
-
declare function createAgreement(contract: ComputeContract, account: KeyringPair): Promise<{
|
|
888
|
+
declare function createAgreement(contract: ComputeContract, account: KeyringPair, oracle_quore_id?: string | undefined): Promise<{
|
|
830
889
|
blockNumber: number;
|
|
831
890
|
index: number;
|
|
832
891
|
hash: string;
|
|
@@ -844,8 +903,12 @@ interface DataContractParams {
|
|
|
844
903
|
url: string;
|
|
845
904
|
/** Guardian account IDs that participate in this contract. */
|
|
846
905
|
guardians: string[];
|
|
847
|
-
/**
|
|
848
|
-
|
|
906
|
+
/**
|
|
907
|
+
* Absolute fee offered for the contract. Defaults to 0.
|
|
908
|
+
* `computeRate` is omitted: this is a `Dormant` contract and the
|
|
909
|
+
* compute rate only applies to `Active` contracts.
|
|
910
|
+
*/
|
|
911
|
+
fee: Fee;
|
|
849
912
|
/** Block number deadline. Defaults to 0 (no deadline). */
|
|
850
913
|
deadline?: number;
|
|
851
914
|
/** Trusted guardian index in the guardians list. Defaults to 0. */
|
|
@@ -872,8 +935,8 @@ interface InferenceComputeParams {
|
|
|
872
935
|
input: Uint8Array | string;
|
|
873
936
|
/** Guardian account IDs that participate in this compute. */
|
|
874
937
|
guardians: string[];
|
|
875
|
-
/** Fee offered for the compute step
|
|
876
|
-
|
|
938
|
+
/** Fee offered for the compute step. Defaults to 0 amount and 0 compute rate. */
|
|
939
|
+
fee: Fee;
|
|
877
940
|
/** Block number deadline for the compute step. Defaults to 0 (no deadline). */
|
|
878
941
|
deadline?: number;
|
|
879
942
|
}
|
|
@@ -918,8 +981,8 @@ interface SimpleComputeParams {
|
|
|
918
981
|
inputExtrinsicIndex?: number;
|
|
919
982
|
/** Program location as URL. */
|
|
920
983
|
programUrl: string;
|
|
921
|
-
/** Fee offered for the compute step
|
|
922
|
-
|
|
984
|
+
/** Fee offered for the compute step. Defaults to 0 amount and 0 compute rate. */
|
|
985
|
+
fee?: Fee;
|
|
923
986
|
/** Block number deadline for the compute step. Defaults to 0 (no deadline). */
|
|
924
987
|
deadline?: number;
|
|
925
988
|
/** Trusted guardian index in the guardians list. Defaults to 0. */
|
|
@@ -1091,8 +1154,11 @@ interface DataAgreementParams {
|
|
|
1091
1154
|
ref: OnChainRef;
|
|
1092
1155
|
/** Guardian account IDs that participate in this agreement. */
|
|
1093
1156
|
guardians: string[];
|
|
1094
|
-
/**
|
|
1095
|
-
|
|
1157
|
+
/**
|
|
1158
|
+
* Absolute fee for the agreement. `computeRate` is omitted: this is a
|
|
1159
|
+
* `Dormant` contract and the compute rate only applies to `Active` contracts.
|
|
1160
|
+
*/
|
|
1161
|
+
fee: Pick<Fee, "amount">;
|
|
1096
1162
|
/** If provided, populates ComputeInfo.metadata in the contract. */
|
|
1097
1163
|
metadata?: DataAgreementMetadata;
|
|
1098
1164
|
/** Block number deadline. Defaults to 0 (no deadline). */
|
|
@@ -1274,4 +1340,4 @@ declare function setIdentity(account: KeyringPair, { display }: IdentityFields):
|
|
|
1274
1340
|
declare function rotateAndSetKeys(account: KeyringPair): Promise<void>;
|
|
1275
1341
|
declare function setWorker(account: KeyringPair): Promise<void>;
|
|
1276
1342
|
|
|
1277
|
-
export { API_EXTENSIONS, API_RPC, API_TYPES, AccountSourceType, type AsymmetricHybridParams, type AsymmetricParams, type AtomicPaliAmount, type BlockScanFilter, type BlockScanResult, type CipherSuite, type ComputeContract, CryptoType, DEBUG, DEFAULT_COMPUTE_PAYLOAD, DEFAULT_EMPTY_PAYLOAD, type DataAgreementMetadata, type DataAgreementParams, type DataContractParams, type Ed25519Params, FileFromMetadataRef, type GuardianAddress, type GuardianGroupInfo, type GuardianJoinPrefs, type GuardianParticipants, type IdentityFields, type InferenceComputeParams, type KdfParams, MCryptFs, MCryptFsReader, MCryptFsWriter, type OnChainRef, PALI_DECIMALS, PALI_SYMBOL, PALLIORA_RPC_URL, PALLIORA_WS, type PaliAmountInput, type Secp256k1Params, type SilentThresholdParams, type SimpleComputeParams, type SubmissionReceipt, type SubmitTEDataResult, type SymmetricParams, TX_WAIT_FINALIZATION, type ThresholdHybridParams, type ThresholdParams, type UploadOptions, addStake, base64ToUint8Array, clearTokenCache, configure, createAccount, createAgreement, createGuardianGroup, createGuardianGroupAndWatch, createSimpleAgreement, dataContract, debugLog, decodeAggregateKey, decodeField, decodePowersOfTau, decrypt, encrypt as ecncryptTest, encodeCiphertext, encrypt$1 as encrypt, fetchAndDecodeExtrinsic, fetchTokenProperties, formatBalanceWithTokenProperties, formatPaliAmount, fromAtomicPaliAmount, fundAccount, gen_shared_key, gen_stretched_key, generateRandomBytes, getAgreementCreatedRequestId, getApi, getCachedTokenProperties, getEncKeyring, getFileMetadataCall, getGuardianAddress, getGuardianList, getGuardianNwParams, getGuardianParticipants, getKeyring, hexToUint8Array, inferenceCompute, joinGuardian, joinIdleStaker, joinValidator, newStake, pairFromPrivateKeyHex, payoutStake, provider, reduceStake, registerDataAgreement, removeStake, rotateAndSetKeys, runAgent, scanForBlockEvent, setIdentity, setWorker, signAndSend, simpleCompute, submitData, submitTEData, submitTEDataWithCipher, testCrypt, toAtomicPaliAmount, tokenToBigint, transfer, uint8ArrayToBase64, uploadData, uploadDataLegacy, watchForSubmissionReceipt, withdrawStake, writeMetadata };
|
|
1343
|
+
export { API_EXTENSIONS, API_RPC, API_TYPES, AccountSourceType, type AsymmetricHybridParams, type AsymmetricParams, type AtomicPaliAmount, type BlockScanFilter, type BlockScanResult, type CipherSuite, type ComputeContract, CryptoType, DEBUG, DEFAULT_COMPUTE_PAYLOAD, DEFAULT_EMPTY_PAYLOAD, type DataAgreementMetadata, type DataAgreementParams, type DataContractParams, type Ed25519Params, type Fee, FileFromMetadataRef, type GuardianAddress, type GuardianGroupInfo, type GuardianJoinPrefs, type GuardianParticipants, type IdentityFields, type InferenceComputeParams, type KdfParams, MCryptFs, MCryptFsReader, MCryptFsWriter, type OnChainRef, PALI_DECIMALS, PALI_SYMBOL, PALLIORA_RPC_URL, PALLIORA_WS, type PaliAmountInput, type Secp256k1Params, type SilentThresholdParams, type SimpleComputeParams, type SubmissionReceipt, type SubmitTEDataResult, type SymmetricParams, TX_WAIT_FINALIZATION, type ThresholdHybridParams, type ThresholdParams, type UploadOptions, addStake, base64ToUint8Array, buildFee, clearTokenCache, configure, createAccount, createAgreement, createGuardianGroup, createGuardianGroupAndWatch, createSimpleAgreement, dataContract, debugLog, decodeAggregateKey, decodeField, decodePowersOfTau, decrypt, encrypt as ecncryptTest, encodeCiphertext, encrypt$1 as encrypt, fetchAndDecodeExtrinsic, fetchTokenProperties, formatBalanceWithTokenProperties, formatPaliAmount, fromAtomicPaliAmount, fundAccount, gen_shared_key, gen_stretched_key, generateRandomBytes, getAgreementCreatedRequestId, getApi, getCachedTokenProperties, getEncKeyring, getFileMetadataCall, getGuardianAddress, getGuardianList, getGuardianNwParams, getGuardianParticipants, getKeyring, hexToUint8Array, inferenceCompute, joinGuardian, joinIdleStaker, joinValidator, newStake, pairFromPrivateKeyHex, payoutStake, provider, reduceStake, registerDataAgreement, removeStake, rotateAndSetKeys, runAgent, scanForBlockEvent, setIdentity, setWorker, signAndSend, simpleCompute, submitData, submitTEData, submitTEDataWithCipher, testCrypt, toAtomicPaliAmount, tokenToBigint, transfer, uint8ArrayToBase64, uploadData, uploadDataLegacy, watchForSubmissionReceipt, withdrawStake, writeMetadata };
|