@provablehq/wasm 0.9.18 → 0.10.0
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/mainnet/aleo_wasm.d.ts +356 -1
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.js +1075 -32
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +1079 -31
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +4658 -4299
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.js +10664 -9284
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +10669 -9283
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -680,32 +680,126 @@ export class ExecutionRequest {
|
|
|
680
680
|
private constructor();
|
|
681
681
|
free(): void;
|
|
682
682
|
[Symbol.dispose](): void;
|
|
683
|
+
/**
|
|
684
|
+
* Computes the function ID and serialized input data for a program function call.
|
|
685
|
+
* This is a helper for external signing wallets and other applications that need to compute
|
|
686
|
+
* publicly computable inputs for the `Request::sign` function.
|
|
687
|
+
*
|
|
688
|
+
* @param {string} program_id The id of the program.
|
|
689
|
+
* @param {string} function_name The function name.
|
|
690
|
+
* @param {string[]} input_types The input types of the function as strings.
|
|
691
|
+
* @param {string[]} inputs The inputs to the function as strings.
|
|
692
|
+
* @param {boolean} is_root Flag to indicate if this is the top level function in the call graph.
|
|
693
|
+
* @param {Field | undefined} program_checksum The program checksum (required if the program has a constructor).
|
|
694
|
+
* @param {ViewKey | undefined} view_key The view key of the signer to compute a record's tag and h values.
|
|
695
|
+
*
|
|
696
|
+
* @returns {ExternalSigningInput}
|
|
697
|
+
*/
|
|
698
|
+
static computeExternalSigningInputs(program_id: string, function_name: string, inputs: Array<any>, input_types: Array<any>, is_root: boolean, program_checksum?: Field | null, view_key?: ViewKey | null): object;
|
|
683
699
|
/**
|
|
684
700
|
* Creates an request object from a bytes representation of an request.
|
|
685
701
|
*/
|
|
686
702
|
static fromBytesLe(bytes: Uint8Array): ExecutionRequest;
|
|
703
|
+
/**
|
|
704
|
+
* Builds a request from externally-signed data using externally-supplied record view keys.
|
|
705
|
+
*
|
|
706
|
+
* For record inputs, the caller provides `record_view_keys` and `gammas` directly.
|
|
707
|
+
* The method uses these to compute commitment, serial number, tag, and InputID for each record.
|
|
708
|
+
*
|
|
709
|
+
* @param {string} program_id The id of the program.
|
|
710
|
+
* @param {string} function_name The function name.
|
|
711
|
+
* @param {string[]} inputs The inputs to the function.
|
|
712
|
+
* @param {string[]} input_types The input types of the function.
|
|
713
|
+
* @param {Signature} signature The externally-computed signature.
|
|
714
|
+
* @param {Field} tvk The transition view key.
|
|
715
|
+
* @param {Address} signer The signer address.
|
|
716
|
+
* @param {Field} sk_tag The tag secret key.
|
|
717
|
+
* @param {Field[] | undefined} record_view_keys Pre-computed record view keys (required when there are record inputs).
|
|
718
|
+
* @param {Group[] | undefined} gammas An array of gammas (required when there are record inputs).
|
|
719
|
+
*/
|
|
720
|
+
static fromExternallySignedData(program_id: string, function_name: string, inputs: Array<any>, input_types: Array<any>, signature: Signature, tvk: Field, signer: Address, sk_tag: Field, record_view_keys?: Array<any> | null, gammas?: Array<any> | null): ExecutionRequest;
|
|
721
|
+
/**
|
|
722
|
+
* Builds a request from externally-signed data with pre-computed input IDs.
|
|
723
|
+
*
|
|
724
|
+
* Each element of `input_ids` is either:
|
|
725
|
+
* - A `Field` for constant, public, or private inputs (the input hash).
|
|
726
|
+
* - A JS Array `[Field, Group, Field, Field, Field]` for record inputs
|
|
727
|
+
* (commitment, gamma, record_view_key, serial_number, tag).
|
|
728
|
+
*
|
|
729
|
+
* The `input_types` array is used to determine the InputID variant for scalar fields.
|
|
730
|
+
*
|
|
731
|
+
* @param {string} program_id The id of the program.
|
|
732
|
+
* @param {string} function_name The function name.
|
|
733
|
+
* @param {string[]} inputs The inputs to the function.
|
|
734
|
+
* @param {string[]} input_types The input types of the function.
|
|
735
|
+
* @param {Signature} signature The externally-computed signature.
|
|
736
|
+
* @param {Field} tvk The transition view key.
|
|
737
|
+
* @param {Address} signer The signer address.
|
|
738
|
+
* @param {Field} sk_tag The tag secret key.
|
|
739
|
+
* @param {(Field | [Field, Group, Field, Field, Field])[]} input_ids Pre-computed input IDs.
|
|
740
|
+
*/
|
|
741
|
+
static fromExternallySignedDataWithInputIds(program_id: string, function_name: string, inputs: Array<any>, input_types: Array<any>, signature: Signature, tvk: Field, signer: Address, sk_tag: Field, input_ids: Array<any>): ExecutionRequest;
|
|
742
|
+
/**
|
|
743
|
+
* Builds a request from externally-signed data using a view key to derive record view keys.
|
|
744
|
+
*
|
|
745
|
+
* For record inputs, the method computes `record_view_key = (nonce * view_key).to_x_coordinate()`
|
|
746
|
+
* for each record, then uses it with the supplied `gammas` to compute commitment, serial number,
|
|
747
|
+
* tag, and InputID.
|
|
748
|
+
*
|
|
749
|
+
* @param {string} program_id The id of the program.
|
|
750
|
+
* @param {string} function_name The function name.
|
|
751
|
+
* @param {string[]} inputs The inputs to the function.
|
|
752
|
+
* @param {string[]} input_types The input types of the function.
|
|
753
|
+
* @param {Signature} signature The externally-computed signature.
|
|
754
|
+
* @param {Field} tvk The transition view key.
|
|
755
|
+
* @param {Address} signer The signer address.
|
|
756
|
+
* @param {Field} sk_tag The tag secret key.
|
|
757
|
+
* @param {ViewKey} view_key The view key of the signer.
|
|
758
|
+
* @param {Group[] | undefined} gammas An array of gammas (required when there are record inputs).
|
|
759
|
+
*/
|
|
760
|
+
static fromExternallySignedDataWithViewKey(program_id: string, function_name: string, inputs: Array<any>, input_types: Array<any>, signature: Signature, tvk: Field, signer: Address, sk_tag: Field, view_key: ViewKey, gammas?: Array<any> | null): ExecutionRequest;
|
|
687
761
|
/**
|
|
688
762
|
* Builds a request object from a string representation of a request.
|
|
689
763
|
*
|
|
690
764
|
* @param {string} request String representation of the request.
|
|
691
765
|
*/
|
|
692
766
|
static fromString(request: string): ExecutionRequest;
|
|
767
|
+
/**
|
|
768
|
+
* Alias for `function_name` (camelCase).
|
|
769
|
+
*/
|
|
770
|
+
functionName(): string;
|
|
693
771
|
/**
|
|
694
772
|
* Returns the function name.
|
|
695
773
|
*/
|
|
696
774
|
function_name(): string;
|
|
775
|
+
/**
|
|
776
|
+
* Alias for `input_ids` (camelCase).
|
|
777
|
+
*/
|
|
778
|
+
inputIds(): Array<any>;
|
|
697
779
|
/**
|
|
698
780
|
* Returns the input IDs for the transition.
|
|
781
|
+
*
|
|
782
|
+
* Each element is either a WASM `Field` (for constant/public/private/external_record inputs)
|
|
783
|
+
* or a JS Array `[Field, Group, Field, Field, Field]` (for record inputs: commitment, gamma,
|
|
784
|
+
* record_view_key, serial_number, tag).
|
|
699
785
|
*/
|
|
700
786
|
input_ids(): Array<any>;
|
|
701
787
|
/**
|
|
702
788
|
* Returns the function inputs as an array of strings.
|
|
703
789
|
*/
|
|
704
790
|
inputs(): Array<any>;
|
|
791
|
+
/**
|
|
792
|
+
* Alias for `network_id` (camelCase).
|
|
793
|
+
*/
|
|
794
|
+
networkId(): number;
|
|
705
795
|
/**
|
|
706
796
|
* Returns the network ID.
|
|
707
797
|
*/
|
|
708
798
|
network_id(): number;
|
|
799
|
+
/**
|
|
800
|
+
* Alias for `program_id` (camelCase).
|
|
801
|
+
*/
|
|
802
|
+
programId(): string;
|
|
709
803
|
/**
|
|
710
804
|
* Returns the program ID.
|
|
711
805
|
*/
|
|
@@ -734,6 +828,10 @@ export class ExecutionRequest {
|
|
|
734
828
|
* Returns the request signer.
|
|
735
829
|
*/
|
|
736
830
|
signer(): Address;
|
|
831
|
+
/**
|
|
832
|
+
* Alias for `sk_tag` (camelCase).
|
|
833
|
+
*/
|
|
834
|
+
skTag(): Field;
|
|
737
835
|
/**
|
|
738
836
|
* Returns the tag secret key `sk_tag`.
|
|
739
837
|
*/
|
|
@@ -752,6 +850,10 @@ export class ExecutionRequest {
|
|
|
752
850
|
* @returns {string} String representation of the request.
|
|
753
851
|
*/
|
|
754
852
|
toString(): string;
|
|
853
|
+
/**
|
|
854
|
+
* Alias for `to_tpk` (camelCase).
|
|
855
|
+
*/
|
|
856
|
+
toTpk(): Group;
|
|
755
857
|
/**
|
|
756
858
|
* Returns the transition public key `tpk`.
|
|
757
859
|
*/
|
|
@@ -975,6 +1077,14 @@ export class Group {
|
|
|
975
1077
|
* Create a group element from a Uint8Array of left endian bytes.
|
|
976
1078
|
*/
|
|
977
1079
|
static fromBytesLe(bytes: Uint8Array): Group;
|
|
1080
|
+
/**
|
|
1081
|
+
* Generate the group element from the x coordinate of the group.
|
|
1082
|
+
*/
|
|
1083
|
+
static fromField(field: Field): Group;
|
|
1084
|
+
/**
|
|
1085
|
+
* Generate the group element from a string representation of the x coordinate of the group.
|
|
1086
|
+
*/
|
|
1087
|
+
static fromFieldString(field: string): Group;
|
|
978
1088
|
/**
|
|
979
1089
|
* Creates a group object from a string representation of a group element.
|
|
980
1090
|
*/
|
|
@@ -2336,6 +2446,17 @@ export class ProgramManager {
|
|
|
2336
2446
|
* @returns {Authorization}
|
|
2337
2447
|
*/
|
|
2338
2448
|
static authorizeFee(private_key: PrivateKey, deployment_or_execution_id: string, base_fee_credits: number, priority_fee_credits: number, fee_record?: RecordPlaintext | null): Promise<Authorization>;
|
|
2449
|
+
/**
|
|
2450
|
+
* Build an authorization from a `Request` object.
|
|
2451
|
+
*
|
|
2452
|
+
* @param {ExecutionRequest} request The execution request to build the authorization from.
|
|
2453
|
+
* @param {string} program The program source code containing the function to authorize.
|
|
2454
|
+
* @param {boolean} unchecked Whether or not to generate an unchecked authorization.
|
|
2455
|
+
* @param {number | undefined} edition The edition of the program.
|
|
2456
|
+
* @param {object | undefined} imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
2457
|
+
* @param {PrivateKey | undefined} [private_key] Optional private key of the signer. If not provided, functions which call other programs may not succeed.
|
|
2458
|
+
*/
|
|
2459
|
+
static buildAuthorizationFromExecutionRequest(request: ExecutionRequest, program: string, unchecked: boolean, edition?: number | null, imports?: object | null, private_key?: PrivateKey | null): Promise<Authorization>;
|
|
2339
2460
|
/**
|
|
2340
2461
|
* Create an execution `Authorization` without generating a circuit. Use this function when
|
|
2341
2462
|
* fast delegated proving is needed.
|
|
@@ -2497,6 +2618,18 @@ export class ProgramManager {
|
|
|
2497
2618
|
* @returns {Authorization}
|
|
2498
2619
|
*/
|
|
2499
2620
|
static buildProvingRequest(private_key: PrivateKey, program: string, function_name: string, inputs: Array<any>, base_fee_credits: number, priority_fee_credits: number, fee_record: RecordPlaintext | null | undefined, imports: object | null | undefined, broadcast: boolean, unchecked: boolean, edition: number | null | undefined, use_fee_master: boolean): Promise<ProvingRequest>;
|
|
2621
|
+
/**
|
|
2622
|
+
* Build a proving request from a `Request` object. By default this method currently uses the feemaster.
|
|
2623
|
+
*
|
|
2624
|
+
* @param {ExecutionRequest} request The execution request to build the authorization from.
|
|
2625
|
+
* @param {string} program The program source code containing the function to authorize.
|
|
2626
|
+
* @param {boolean} unchecked Whether or not to generate an unchecked authorization.
|
|
2627
|
+
* @param {boolean} broadcast Whether or not to broadcast the transaction.
|
|
2628
|
+
* @param {number | undefined} edition The edition of the program.
|
|
2629
|
+
* @param {object | undefined} imports The imports to the program in the format {"programname.aleo":"aleo instructions source code"}.
|
|
2630
|
+
* @param {PrivateKey | undefined} [private_key] Optional private key of the signer. If not provided, functions which call other programs may not succeed.
|
|
2631
|
+
*/
|
|
2632
|
+
static buildProvingRequestFromExecutionRequest(request: ExecutionRequest, program: string, unchecked: boolean, broadcast: boolean, edition?: number | null, imports?: object | null, private_key?: PrivateKey | null): Promise<ProvingRequest>;
|
|
2500
2633
|
/**
|
|
2501
2634
|
* Split an Aleo credits record into two separate records. This function does not require a fee.
|
|
2502
2635
|
*
|
|
@@ -2653,6 +2786,41 @@ export class ProgramManager {
|
|
|
2653
2786
|
static synthesizeKeyPair(private_key: PrivateKey, program: string, function_id: string, inputs: Array<any>, imports?: object | null, edition?: number | null): Promise<KeyPair>;
|
|
2654
2787
|
}
|
|
2655
2788
|
|
|
2789
|
+
/**
|
|
2790
|
+
* SNARK proof for verification of program execution
|
|
2791
|
+
*/
|
|
2792
|
+
export class Proof {
|
|
2793
|
+
private constructor();
|
|
2794
|
+
free(): void;
|
|
2795
|
+
[Symbol.dispose](): void;
|
|
2796
|
+
/**
|
|
2797
|
+
* Construct a new proof from a byte array
|
|
2798
|
+
*
|
|
2799
|
+
* @param {Uint8Array} bytes Byte array representation of a proof
|
|
2800
|
+
* @returns {Proof}
|
|
2801
|
+
*/
|
|
2802
|
+
static fromBytes(bytes: Uint8Array): Proof;
|
|
2803
|
+
/**
|
|
2804
|
+
* Create a proof from string
|
|
2805
|
+
*
|
|
2806
|
+
* @param {string} string String representation of the proof
|
|
2807
|
+
* @returns {Proof}
|
|
2808
|
+
*/
|
|
2809
|
+
static fromString(string: string): Proof;
|
|
2810
|
+
/**
|
|
2811
|
+
* Return the byte representation of a proof
|
|
2812
|
+
*
|
|
2813
|
+
* @returns {Uint8Array} Byte array representation of a proof
|
|
2814
|
+
*/
|
|
2815
|
+
toBytes(): Uint8Array;
|
|
2816
|
+
/**
|
|
2817
|
+
* Get a string representation of the proof
|
|
2818
|
+
*
|
|
2819
|
+
* @returns {string} String representation of the proof
|
|
2820
|
+
*/
|
|
2821
|
+
toString(): string;
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2656
2824
|
/**
|
|
2657
2825
|
* Proving key for a function within an Aleo program
|
|
2658
2826
|
*/
|
|
@@ -3042,6 +3210,15 @@ export class RecordPlaintext {
|
|
|
3042
3210
|
* @returns {RecordPlaintext} Record plaintext
|
|
3043
3211
|
*/
|
|
3044
3212
|
static fromString(record: string): RecordPlaintext;
|
|
3213
|
+
/**
|
|
3214
|
+
* Compute the record's gamma value.
|
|
3215
|
+
*
|
|
3216
|
+
* @param {string} program_id The program id that produced the record.
|
|
3217
|
+
* @param {string} record_name The name of the record within the program.
|
|
3218
|
+
* @param {PrivateKey} private_key The private key that created the record.
|
|
3219
|
+
* @returns {Group} The computed value of gamma.
|
|
3220
|
+
*/
|
|
3221
|
+
gamma(program_id: string, record_name: string, private_key: PrivateKey): Group;
|
|
3045
3222
|
/**
|
|
3046
3223
|
* Get the record entry matching a key.
|
|
3047
3224
|
*
|
|
@@ -4161,6 +4338,139 @@ export class U8 {
|
|
|
4161
4338
|
toString(): string;
|
|
4162
4339
|
}
|
|
4163
4340
|
|
|
4341
|
+
/**
|
|
4342
|
+
* Aleo Value type. Value is the fundamental type representing program function inputs and outputs
|
|
4343
|
+
* in Aleo. It wraps three variants: Plaintext, Record, and Future.
|
|
4344
|
+
*
|
|
4345
|
+
* @example
|
|
4346
|
+
* // Parse a plaintext value from a string.
|
|
4347
|
+
* const value = Value.fromString("100u64");
|
|
4348
|
+
* console.log(value.valueType()); // "plaintext"
|
|
4349
|
+
* console.log(value.isPlaintext()); // true
|
|
4350
|
+
*
|
|
4351
|
+
* // Extract the inner Plaintext.
|
|
4352
|
+
* const plaintext = value.toPlaintext();
|
|
4353
|
+
* console.log(plaintext.toString()); // "100u64"
|
|
4354
|
+
*/
|
|
4355
|
+
export class Value {
|
|
4356
|
+
private constructor();
|
|
4357
|
+
free(): void;
|
|
4358
|
+
[Symbol.dispose](): void;
|
|
4359
|
+
/**
|
|
4360
|
+
* Creates a Value from a little-endian byte array.
|
|
4361
|
+
*
|
|
4362
|
+
* @param {Uint8Array} bytes A little-endian byte array.
|
|
4363
|
+
* @returns {Value} The Value object.
|
|
4364
|
+
*/
|
|
4365
|
+
static fromBytesLe(bytes: Uint8Array): Value;
|
|
4366
|
+
/**
|
|
4367
|
+
* Creates a Value from a Plaintext object.
|
|
4368
|
+
*
|
|
4369
|
+
* @param {Plaintext} plaintext The Plaintext to wrap.
|
|
4370
|
+
* @returns {Value} A Value wrapping the Plaintext.
|
|
4371
|
+
*/
|
|
4372
|
+
static fromPlaintext(plaintext: Plaintext): Value;
|
|
4373
|
+
/**
|
|
4374
|
+
* Creates a Value from a RecordPlaintext object.
|
|
4375
|
+
*
|
|
4376
|
+
* @param {RecordPlaintext} record The RecordPlaintext to wrap.
|
|
4377
|
+
* @returns {Value} A Value wrapping the Record.
|
|
4378
|
+
*/
|
|
4379
|
+
static fromRecordPlaintext(record: RecordPlaintext): Value;
|
|
4380
|
+
/**
|
|
4381
|
+
* Creates a Value from its string representation.
|
|
4382
|
+
*
|
|
4383
|
+
* @param {string} value The string representation of the value.
|
|
4384
|
+
* @returns {Value} The Value object.
|
|
4385
|
+
*/
|
|
4386
|
+
static fromString(value: string): Value;
|
|
4387
|
+
/**
|
|
4388
|
+
* Returns true if the value is a Future variant.
|
|
4389
|
+
*
|
|
4390
|
+
* Note: There is no `toFuture()` method because the Future type does not have a WASM wrapper.
|
|
4391
|
+
* Use `toString()` or `toBytesLe()` to serialize a Future value.
|
|
4392
|
+
*
|
|
4393
|
+
* @returns {boolean}
|
|
4394
|
+
*/
|
|
4395
|
+
isFuture(): boolean;
|
|
4396
|
+
/**
|
|
4397
|
+
* Returns true if the value is a Plaintext variant.
|
|
4398
|
+
*
|
|
4399
|
+
* @returns {boolean}
|
|
4400
|
+
*/
|
|
4401
|
+
isPlaintext(): boolean;
|
|
4402
|
+
/**
|
|
4403
|
+
* Returns true if the value is a Record variant.
|
|
4404
|
+
*
|
|
4405
|
+
* @returns {boolean}
|
|
4406
|
+
*/
|
|
4407
|
+
isRecord(): boolean;
|
|
4408
|
+
/**
|
|
4409
|
+
* Returns the little-endian boolean array representation of the bits.
|
|
4410
|
+
*
|
|
4411
|
+
* @returns {Array} Boolean array of bits in little-endian order.
|
|
4412
|
+
*/
|
|
4413
|
+
toBitsLe(): Array<any>;
|
|
4414
|
+
/**
|
|
4415
|
+
* Returns the raw big-endian boolean array representation of the bits.
|
|
4416
|
+
*
|
|
4417
|
+
* @returns {Array} Raw boolean array of bits in big-endian order.
|
|
4418
|
+
*/
|
|
4419
|
+
toBitsRawBe(): Array<any>;
|
|
4420
|
+
/**
|
|
4421
|
+
* Returns the raw little-endian boolean array representation of the bits.
|
|
4422
|
+
*
|
|
4423
|
+
* @returns {Array} Raw boolean array of bits in little-endian order.
|
|
4424
|
+
*/
|
|
4425
|
+
toBitsRawLe(): Array<any>;
|
|
4426
|
+
/**
|
|
4427
|
+
* Returns the little-endian byte array representation of the value.
|
|
4428
|
+
*
|
|
4429
|
+
* @returns {Uint8Array} The little-endian byte array.
|
|
4430
|
+
*/
|
|
4431
|
+
toBytesLe(): Uint8Array;
|
|
4432
|
+
/**
|
|
4433
|
+
* Returns the field array representation of the value.
|
|
4434
|
+
*
|
|
4435
|
+
* @returns {Array} Array of Field elements.
|
|
4436
|
+
*/
|
|
4437
|
+
toFields(): Array<any>;
|
|
4438
|
+
/**
|
|
4439
|
+
* Returns the raw field array representation of the value.
|
|
4440
|
+
*
|
|
4441
|
+
* @returns {Array} Array of raw Field elements.
|
|
4442
|
+
*/
|
|
4443
|
+
toFieldsRaw(): Array<any>;
|
|
4444
|
+
/**
|
|
4445
|
+
* Extracts the inner Plaintext from a Plaintext variant.
|
|
4446
|
+
*
|
|
4447
|
+
* @returns {Plaintext} The inner Plaintext value.
|
|
4448
|
+
* @throws If the value is not a Plaintext variant.
|
|
4449
|
+
*/
|
|
4450
|
+
toPlaintext(): Plaintext;
|
|
4451
|
+
/**
|
|
4452
|
+
* Extracts the inner Record from a Record variant as a RecordPlaintext.
|
|
4453
|
+
*
|
|
4454
|
+
* @returns {RecordPlaintext} The inner record.
|
|
4455
|
+
* @throws If the value is not a Record variant.
|
|
4456
|
+
*/
|
|
4457
|
+
toRecordPlaintext(): RecordPlaintext;
|
|
4458
|
+
/**
|
|
4459
|
+
* Returns the string representation of the value.
|
|
4460
|
+
*
|
|
4461
|
+
* @returns {string} The string representation of the value.
|
|
4462
|
+
*/
|
|
4463
|
+
toString(): string;
|
|
4464
|
+
/**
|
|
4465
|
+
* Returns the type of the value variant as a string.
|
|
4466
|
+
*
|
|
4467
|
+
* Possible values: "plaintext", "record", "future".
|
|
4468
|
+
*
|
|
4469
|
+
* @returns {string} The variant type name.
|
|
4470
|
+
*/
|
|
4471
|
+
valueType(): string;
|
|
4472
|
+
}
|
|
4473
|
+
|
|
4164
4474
|
/**
|
|
4165
4475
|
* Verifying key for a function within an Aleo program
|
|
4166
4476
|
*/
|
|
@@ -4392,6 +4702,23 @@ export class VerifyingKey {
|
|
|
4392
4702
|
* @returns {VerifyingKey} Verifying key for the unbond_public function
|
|
4393
4703
|
*/
|
|
4394
4704
|
static unbondPublicVerifier(): VerifyingKey;
|
|
4705
|
+
/**
|
|
4706
|
+
* Verify a SNARK proof against this verifying key and public inputs.
|
|
4707
|
+
*
|
|
4708
|
+
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
4709
|
+
* @param {Proof} proof The proof to verify
|
|
4710
|
+
* @returns {boolean} True if the proof is valid, false otherwise
|
|
4711
|
+
*/
|
|
4712
|
+
verify(inputs: Array<any>, proof: Proof): boolean;
|
|
4713
|
+
/**
|
|
4714
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
4715
|
+
*
|
|
4716
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
4717
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
4718
|
+
* @param {Proof} proof The batch proof to verify
|
|
4719
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
4720
|
+
*/
|
|
4721
|
+
static verifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
|
|
4395
4722
|
}
|
|
4396
4723
|
|
|
4397
4724
|
export class ViewKey {
|
|
@@ -4467,7 +4794,7 @@ export class ViewKey {
|
|
|
4467
4794
|
* @param {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
|
|
4468
4795
|
*
|
|
4469
4796
|
* @example
|
|
4470
|
-
* import {
|
|
4797
|
+
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
4471
4798
|
*
|
|
4472
4799
|
* Set the consensus version heights.
|
|
4473
4800
|
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12");
|
|
@@ -4478,6 +4805,34 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
|
4478
4805
|
|
|
4479
4806
|
export function runRayonThread(receiver: number): void;
|
|
4480
4807
|
|
|
4808
|
+
/**
|
|
4809
|
+
* Verify a SNARK proof against a verifying key and public inputs.
|
|
4810
|
+
*
|
|
4811
|
+
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
4812
|
+
* It directly invokes the Varuna proof verification from snarkVM.
|
|
4813
|
+
*
|
|
4814
|
+
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
4815
|
+
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
4816
|
+
* @param {Proof} proof The proof to verify
|
|
4817
|
+
* @returns {boolean} True if the proof is valid, false otherwise
|
|
4818
|
+
*/
|
|
4819
|
+
export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
|
|
4820
|
+
|
|
4821
|
+
/**
|
|
4822
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
4823
|
+
*
|
|
4824
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
4825
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
4826
|
+
*
|
|
4827
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
4828
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
4829
|
+
* @param {Proof} proof The batch proof to verify
|
|
4830
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
4831
|
+
*/
|
|
4832
|
+
export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
|
|
4833
|
+
|
|
4834
|
+
export function stringToField(string: string): Field;
|
|
4835
|
+
|
|
4481
4836
|
/**
|
|
4482
4837
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
4483
4838
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
Binary file
|