@provablehq/wasm 0.9.9 → 0.9.10
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 +92 -20
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.js +287 -56
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +287 -55
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +92 -20
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.js +287 -56
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +287 -55
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -16,6 +16,18 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
|
16
16
|
* @returns {boolean} True if the execution is valid, false otherwise
|
|
17
17
|
*/
|
|
18
18
|
export function verifyFunctionExecution(execution: Execution, verifying_key: VerifyingKey, program: Program, function_id: string, imports: object | null | undefined, imported_verifying_keys: object | null | undefined, block_height: number): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Set test consensus version heights for testing.
|
|
21
|
+
*
|
|
22
|
+
* @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.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* import { getOrInitConsensusVersionHeights } from @provablehq/sdk;
|
|
26
|
+
*
|
|
27
|
+
* Set the consensus version heights.
|
|
28
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9");
|
|
29
|
+
*/
|
|
30
|
+
export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
|
|
19
31
|
/**
|
|
20
32
|
* Public address of an Aleo account
|
|
21
33
|
*/
|
|
@@ -144,6 +156,12 @@ export class Authorization {
|
|
|
144
156
|
* @param {Uint8Array} bytes Left-endian bytes representing the Authorization.
|
|
145
157
|
*/
|
|
146
158
|
static fromBytesLe(bytes: Uint8Array): Authorization;
|
|
159
|
+
/**
|
|
160
|
+
* Get the function name.
|
|
161
|
+
*
|
|
162
|
+
* @returns {string} The function name.
|
|
163
|
+
*/
|
|
164
|
+
functionName(): string;
|
|
147
165
|
/**
|
|
148
166
|
* Returns `true` if the Authorization is for `credits.aleo/fee_public`.
|
|
149
167
|
*/
|
|
@@ -809,6 +827,10 @@ export class Field {
|
|
|
809
827
|
* Create a field element from a Uint8Array of left endian bytes.
|
|
810
828
|
*/
|
|
811
829
|
static fromBytesLe(bytes: Uint8Array): Field;
|
|
830
|
+
/**
|
|
831
|
+
* Initializes a new field as a domain separator.
|
|
832
|
+
*/
|
|
833
|
+
static newDomainSeparator(domain: string): Field;
|
|
812
834
|
/**
|
|
813
835
|
* Add two field elements.
|
|
814
836
|
*/
|
|
@@ -1636,9 +1658,9 @@ export class Plaintext {
|
|
|
1636
1658
|
private constructor();
|
|
1637
1659
|
free(): void;
|
|
1638
1660
|
/**
|
|
1639
|
-
* Get the
|
|
1661
|
+
* Get the little endian boolean array representation of the bits of the plaintext.
|
|
1640
1662
|
*
|
|
1641
|
-
* @returns {Array} The
|
|
1663
|
+
* @returns {Array} The little endian boolean array representation of the bits of the plaintext.
|
|
1642
1664
|
*/
|
|
1643
1665
|
toBitsLe(): Array<any>;
|
|
1644
1666
|
/**
|
|
@@ -1658,15 +1680,15 @@ export class Plaintext {
|
|
|
1658
1680
|
*/
|
|
1659
1681
|
static fromString(plaintext: string): Plaintext;
|
|
1660
1682
|
/**
|
|
1661
|
-
* Get the
|
|
1683
|
+
* Get the little endian byte array representation of the plaintext.
|
|
1662
1684
|
*
|
|
1663
|
-
* @returns {Uint8Array} The
|
|
1685
|
+
* @returns {Uint8Array} The little endian byte array representation of the plaintext.
|
|
1664
1686
|
*/
|
|
1665
1687
|
toBytesLe(): Uint8Array;
|
|
1666
1688
|
/**
|
|
1667
1689
|
* Get a plaintext object from a series of bits represented as a boolean array.
|
|
1668
1690
|
*
|
|
1669
|
-
* @param {Array} bits A
|
|
1691
|
+
* @param {Array} bits A little endian boolean array representing the bits plaintext.
|
|
1670
1692
|
*
|
|
1671
1693
|
* @returns {Plaintext} The plaintext object.
|
|
1672
1694
|
*/
|
|
@@ -1674,17 +1696,47 @@ export class Plaintext {
|
|
|
1674
1696
|
/**
|
|
1675
1697
|
* Get a plaintext object from a series of bytes.
|
|
1676
1698
|
*
|
|
1677
|
-
* @param {Uint8Array} bytes A
|
|
1699
|
+
* @param {Uint8Array} bytes A little endian byte array representing the plaintext.
|
|
1678
1700
|
*
|
|
1679
1701
|
* @returns {Plaintext} The plaintext object.
|
|
1680
1702
|
*/
|
|
1681
1703
|
static fromBytesLe(bytes: Uint8Array): Plaintext;
|
|
1704
|
+
/**
|
|
1705
|
+
* Get the raw field array representation of the plaintext.
|
|
1706
|
+
*
|
|
1707
|
+
* @returns {Array} The raw field array representation of the plaintext.
|
|
1708
|
+
*/
|
|
1709
|
+
toFieldsRaw(): Array<any>;
|
|
1682
1710
|
/**
|
|
1683
1711
|
* Gives the type of the plaintext.
|
|
1684
1712
|
*
|
|
1685
1713
|
* @returns {string} The type of the plaintext.
|
|
1686
1714
|
*/
|
|
1687
1715
|
plaintextType(): string;
|
|
1716
|
+
/**
|
|
1717
|
+
* Get the raw big endian boolean array representation of the bits of the plaintext.
|
|
1718
|
+
*
|
|
1719
|
+
* @returns {Array} The raw big endian boolean array representation of the bits of the plaintext.
|
|
1720
|
+
*/
|
|
1721
|
+
toBitsRawBe(): Array<any>;
|
|
1722
|
+
/**
|
|
1723
|
+
* Get the raw little endian boolean array representation of the bits of the plaintext.
|
|
1724
|
+
*
|
|
1725
|
+
* @returns {Array} The raw little endian boolean array representation of the bits of the plaintext.
|
|
1726
|
+
*/
|
|
1727
|
+
toBitsRawLe(): Array<any>;
|
|
1728
|
+
/**
|
|
1729
|
+
* Get the raw big endian byte array representation of the plaintext.
|
|
1730
|
+
*
|
|
1731
|
+
* @returns {Uint8Array} The raw big endian byte array representation of the plaintext.
|
|
1732
|
+
*/
|
|
1733
|
+
toBytesRawBe(): Uint8Array;
|
|
1734
|
+
/**
|
|
1735
|
+
* Get the raw little endian byte array representation of the plaintext.
|
|
1736
|
+
*
|
|
1737
|
+
* @returns {Uint8Array} The raw little endian byte array representation of the plaintext.
|
|
1738
|
+
*/
|
|
1739
|
+
toBytesRawLe(): Uint8Array;
|
|
1688
1740
|
/**
|
|
1689
1741
|
* Encrypt a plaintext with a transition view key.
|
|
1690
1742
|
*
|
|
@@ -2175,12 +2227,13 @@ export class ProgramManager {
|
|
|
2175
2227
|
/**
|
|
2176
2228
|
* Synthesize proving and verifying keys for a program
|
|
2177
2229
|
*
|
|
2178
|
-
* @param
|
|
2179
|
-
* @param
|
|
2180
|
-
* @param
|
|
2181
|
-
* @param
|
|
2230
|
+
* @param {string} program The program source code of the program to synthesize keys for
|
|
2231
|
+
* @param {string} function_id The function to synthesize keys for
|
|
2232
|
+
* @param {Array} inputs The inputs to the function
|
|
2233
|
+
* @param {Object | undefined} imports The imports for the program
|
|
2182
2234
|
*/
|
|
2183
2235
|
static synthesizeKeyPair(private_key: PrivateKey, program: string, function_id: string, inputs: Array<any>, imports?: object | null, edition?: number | null): Promise<KeyPair>;
|
|
2236
|
+
static loadInclusionProver(proving_key: ProvingKey): void;
|
|
2184
2237
|
/**
|
|
2185
2238
|
* Create a `ProvingRequest` object. This object creates authorizations for the top level
|
|
2186
2239
|
* function and associated fee function. This object can be sent directly to a remote prover
|
|
@@ -2284,26 +2337,31 @@ export class ProgramManager {
|
|
|
2284
2337
|
* @returns {u64} Fee in microcredits
|
|
2285
2338
|
*/
|
|
2286
2339
|
static estimateFinalizeFee(program: string, _function: string): bigint;
|
|
2340
|
+
/**
|
|
2341
|
+
* Execute an authorization.
|
|
2342
|
+
*
|
|
2343
|
+
* @param authorization The authorization to execute.
|
|
2344
|
+
* @param fee_authorization The fee authorization to execute.
|
|
2345
|
+
* @param program The program authorized to be executed.
|
|
2346
|
+
* @param imports The imports of the program being executed.
|
|
2347
|
+
* @param url The url to get the inclusion proving information from.
|
|
2348
|
+
* @param offline_query Optional offline query object if building a Transaction offline.
|
|
2349
|
+
*/
|
|
2350
|
+
static executeAuthorization(authorization: Authorization, fee_authorization: Authorization | null | undefined, program: string, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, fee_proving_key?: ProvingKey | null, fee_verifying_key?: VerifyingKey | null, imports?: object | null, url?: string | null, offline_query?: OfflineQuery | null): Promise<Transaction>;
|
|
2287
2351
|
/**
|
|
2288
2352
|
* Estimate Fee for Aleo function execution. Note if "cache" is set to true, the proving and
|
|
2289
2353
|
* verifying keys will be stored in the ProgramManager's memory and used for subsequent
|
|
2290
2354
|
* program executions.
|
|
2291
2355
|
*
|
|
2292
|
-
*
|
|
2293
|
-
*
|
|
2294
|
-
* @param private_key The private key of the sender
|
|
2295
|
-
* @param program The source code of the program to estimate the execution fee for
|
|
2296
|
-
* @param function The name of the function to execute
|
|
2297
|
-
* @param inputs A javascript array of inputs to the function
|
|
2298
|
-
* @param url The url of the Aleo network node to send the transaction to
|
|
2356
|
+
* @param program The source code of the program to estimate the execution fee for.
|
|
2357
|
+
* @param function The name of the function to estimate the execution fee for.
|
|
2299
2358
|
* @param imports (optional) Provide a list of imports to use for the fee estimation in the
|
|
2300
2359
|
* form of a javascript object where the keys are a string of the program name and the values
|
|
2301
2360
|
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
2302
|
-
* @param
|
|
2303
|
-
* @param verifying_key (optional) Provide a verifying key to use for the fee estimation
|
|
2361
|
+
* @param edition {
|
|
2304
2362
|
* @returns {u64} Fee in microcredits
|
|
2305
2363
|
*/
|
|
2306
|
-
static estimateExecutionFee(
|
|
2364
|
+
static estimateExecutionFee(program: string, _function: string, imports?: object | null, edition?: number | null): Promise<bigint>;
|
|
2307
2365
|
/**
|
|
2308
2366
|
* Execute an arbitrary function locally
|
|
2309
2367
|
*
|
|
@@ -2325,6 +2383,20 @@ export class ProgramManager {
|
|
|
2325
2383
|
* @param {VerifyingKey | undefined} verifying_key (optional) Provide a verifying key to use for the function execution
|
|
2326
2384
|
*/
|
|
2327
2385
|
static executeFunctionOffline(private_key: PrivateKey, program: string, _function: string, inputs: Array<any>, prove_execution: boolean, cache: boolean, imports?: object | null, proving_key?: ProvingKey | null, verifying_key?: VerifyingKey | null, url?: string | null, offline_query?: OfflineQuery | null, edition?: number | null): Promise<ExecutionResponse>;
|
|
2386
|
+
/**
|
|
2387
|
+
* Estimate Fee for an Authorization.
|
|
2388
|
+
*
|
|
2389
|
+
* @param authorization Authorization to estimate the fee for.
|
|
2390
|
+
* @param program The program the Authorization is for.
|
|
2391
|
+
* @param imports Provide a list of imports to use for the fee estimation in the
|
|
2392
|
+
* form of a javascript object where the keys are a string of the program name and the values
|
|
2393
|
+
* are a string representing the program source code \{ "hello.aleo": "hello.aleo source code" \}
|
|
2394
|
+
* @param offline_query The offline query object used to insert the global state root and state paths needed to create
|
|
2395
|
+
* a valid inclusion proof offline.
|
|
2396
|
+
* @param edition: Optional edition to estimate the fee for.
|
|
2397
|
+
* @returns {u64} Fee in microcredits
|
|
2398
|
+
*/
|
|
2399
|
+
static estimateFeeForAuthorization(authorization: Authorization, program: string, imports?: object | null, edition?: number | null): Promise<bigint>;
|
|
2328
2400
|
/**
|
|
2329
2401
|
* Execute Aleo function and create an Aleo execution transaction
|
|
2330
2402
|
*
|
|
Binary file
|