@provablehq/sdk 0.7.0 → 0.7.2

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.
Files changed (80) hide show
  1. package/README.md +4 -4
  2. package/dist/mainnet/account.d.ts +8 -8
  3. package/dist/mainnet/browser.d.ts +16 -43
  4. package/dist/mainnet/browser.js +497 -2690
  5. package/dist/mainnet/browser.js.map +1 -1
  6. package/dist/mainnet/constants.d.ts +34 -0
  7. package/dist/mainnet/function-key-provider.d.ts +2 -1
  8. package/dist/mainnet/models/{block.d.ts → blockJSON.d.ts} +1 -1
  9. package/dist/mainnet/models/confirmed_transaction.d.ts +2 -2
  10. package/dist/mainnet/models/deploy.d.ts +5 -0
  11. package/dist/mainnet/models/executionJSON.d.ts +5 -0
  12. package/dist/mainnet/models/functionObject.d.ts +7 -0
  13. package/dist/{testnet/models/input.d.ts → mainnet/models/input/inputJSON.d.ts} +4 -1
  14. package/dist/mainnet/models/input/inputObject.d.ts +15 -0
  15. package/dist/{testnet/models/output.d.ts → mainnet/models/output/outputJSON.d.ts} +1 -1
  16. package/dist/mainnet/models/output/outputObject.d.ts +17 -0
  17. package/dist/mainnet/models/plaintext/array.d.ts +3 -0
  18. package/dist/mainnet/models/plaintext/literal.d.ts +1 -0
  19. package/dist/mainnet/models/plaintext/plaintext.d.ts +4 -0
  20. package/dist/mainnet/models/plaintext/struct.d.ts +5 -0
  21. package/dist/mainnet/models/transaction/transactionJSON.d.ts +6 -0
  22. package/dist/mainnet/models/transaction/transactionSummary.d.ts +11 -0
  23. package/dist/mainnet/models/transition/transitionJSON.d.ts +13 -0
  24. package/dist/mainnet/models/transition/transitionObject.d.ts +15 -0
  25. package/dist/mainnet/network-client.d.ts +121 -29
  26. package/dist/mainnet/node-polyfill.js +5 -4
  27. package/dist/mainnet/node-polyfill.js.map +1 -1
  28. package/dist/mainnet/node.js +3 -2
  29. package/dist/mainnet/node.js.map +1 -1
  30. package/dist/mainnet/offline-key-provider.d.ts +2 -1
  31. package/dist/mainnet/program-manager-DAqdrsXx.js +2356 -0
  32. package/dist/mainnet/program-manager-DAqdrsXx.js.map +1 -0
  33. package/dist/mainnet/program-manager.d.ts +5 -1
  34. package/dist/mainnet/record-provider.d.ts +1 -1
  35. package/dist/mainnet/utils.d.ts +1 -0
  36. package/dist/mainnet/wasm.d.ts +1 -0
  37. package/dist/mainnet/worker.js +2 -2
  38. package/dist/testnet/account.d.ts +8 -8
  39. package/dist/testnet/browser.d.ts +16 -43
  40. package/dist/testnet/browser.js +497 -2690
  41. package/dist/testnet/browser.js.map +1 -1
  42. package/dist/testnet/constants.d.ts +34 -0
  43. package/dist/testnet/function-key-provider.d.ts +2 -1
  44. package/dist/testnet/models/{block.d.ts → blockJSON.d.ts} +1 -1
  45. package/dist/testnet/models/confirmed_transaction.d.ts +2 -2
  46. package/dist/testnet/models/deploy.d.ts +5 -0
  47. package/dist/testnet/models/executionJSON.d.ts +5 -0
  48. package/dist/testnet/models/functionObject.d.ts +7 -0
  49. package/dist/{mainnet/models/input.d.ts → testnet/models/input/inputJSON.d.ts} +4 -1
  50. package/dist/testnet/models/input/inputObject.d.ts +15 -0
  51. package/dist/{mainnet/models/output.d.ts → testnet/models/output/outputJSON.d.ts} +1 -1
  52. package/dist/testnet/models/output/outputObject.d.ts +17 -0
  53. package/dist/testnet/models/plaintext/array.d.ts +3 -0
  54. package/dist/testnet/models/plaintext/literal.d.ts +1 -0
  55. package/dist/testnet/models/plaintext/plaintext.d.ts +4 -0
  56. package/dist/testnet/models/plaintext/struct.d.ts +5 -0
  57. package/dist/testnet/models/transaction/transactionJSON.d.ts +6 -0
  58. package/dist/testnet/models/transaction/transactionSummary.d.ts +11 -0
  59. package/dist/testnet/models/transition/transitionJSON.d.ts +13 -0
  60. package/dist/testnet/models/transition/transitionObject.d.ts +15 -0
  61. package/dist/testnet/network-client.d.ts +121 -29
  62. package/dist/testnet/node-polyfill.js +5 -4
  63. package/dist/testnet/node-polyfill.js.map +1 -1
  64. package/dist/testnet/node.js +3 -2
  65. package/dist/testnet/node.js.map +1 -1
  66. package/dist/testnet/offline-key-provider.d.ts +2 -1
  67. package/dist/testnet/program-manager-DWPt87ls.js +2356 -0
  68. package/dist/testnet/program-manager-DWPt87ls.js.map +1 -0
  69. package/dist/testnet/program-manager.d.ts +5 -1
  70. package/dist/testnet/record-provider.d.ts +1 -1
  71. package/dist/testnet/utils.d.ts +1 -0
  72. package/dist/testnet/wasm.d.ts +1 -0
  73. package/dist/testnet/worker.js +2 -2
  74. package/package.json +4 -4
  75. package/dist/mainnet/models/execution.d.ts +0 -5
  76. package/dist/mainnet/models/transactionModel.d.ts +0 -6
  77. package/dist/mainnet/models/transition.d.ts +0 -13
  78. package/dist/testnet/models/execution.d.ts +0 -5
  79. package/dist/testnet/models/transactionModel.d.ts +0 -6
  80. package/dist/testnet/models/transition.d.ts +0 -13
@@ -0,0 +1,34 @@
1
+ import { VerifyingKey } from "./wasm";
2
+ export declare const KEY_STORE: string;
3
+ export interface Key {
4
+ name: string;
5
+ locator: string;
6
+ prover: string;
7
+ verifier: string;
8
+ verifyingKey: () => VerifyingKey;
9
+ }
10
+ export declare const CREDITS_PROGRAM_KEYS: {
11
+ bond_public: Key;
12
+ bond_validator: Key;
13
+ claim_unbond_public: Key;
14
+ fee_private: Key;
15
+ fee_public: Key;
16
+ inclusion: Key;
17
+ join: Key;
18
+ set_validator_state: Key;
19
+ split: Key;
20
+ transfer_private: Key;
21
+ transfer_private_to_public: Key;
22
+ transfer_public: Key;
23
+ transfer_public_as_signer: Key;
24
+ transfer_public_to_private: Key;
25
+ unbond_public: Key;
26
+ getKey: (key: string) => Key;
27
+ };
28
+ export declare const PRIVATE_TRANSFER_TYPES: Set<string>;
29
+ export declare const VALID_TRANSFER_TYPES: Set<string>;
30
+ export declare const PRIVATE_TRANSFER: Set<string>;
31
+ export declare const PRIVATE_TO_PUBLIC_TRANSFER: Set<string>;
32
+ export declare const PUBLIC_TRANSFER: Set<string>;
33
+ export declare const PUBLIC_TRANSFER_AS_SIGNER: Set<string>;
34
+ export declare const PUBLIC_TO_PRIVATE_TRANSFER: Set<string>;
@@ -1,4 +1,5 @@
1
- import { ProvingKey, VerifyingKey, Key } from "./browser";
1
+ import { Key } from "./constants";
2
+ import { ProvingKey, VerifyingKey } from "./wasm";
2
3
  type FunctionKeyPair = [ProvingKey, VerifyingKey];
3
4
  type CachedKeyPair = [Uint8Array, Uint8Array];
4
5
  type AleoKeyProviderInitParams = {
@@ -1,5 +1,5 @@
1
1
  import { ConfirmedTransaction } from "./confirmed_transaction";
2
- export type Block = {
2
+ export type BlockJSON = {
3
3
  block_hash: string;
4
4
  previous_hash: string;
5
5
  header: Header;
@@ -1,6 +1,6 @@
1
- import { TransactionModel } from "./transactionModel";
1
+ import { TransactionJSON } from "./transaction/transactionJSON";
2
2
  export type ConfirmedTransaction = {
3
3
  type: string;
4
4
  id: string;
5
- transaction: TransactionModel;
5
+ transaction: TransactionJSON;
6
6
  };
@@ -0,0 +1,5 @@
1
+ import { FunctionObject } from "./functionObject";
2
+ export type DeploymentMetadata = {
3
+ "programId": string;
4
+ "functions": FunctionObject[];
5
+ };
@@ -0,0 +1,5 @@
1
+ import { TransitionJSON } from "./transition/transitionJSON";
2
+ export type ExecutionJSON = {
3
+ edition: number;
4
+ transitions?: (TransitionJSON)[];
5
+ };
@@ -0,0 +1,7 @@
1
+ import { VerifyingKey } from "@provablehq/wasm";
2
+ export type FunctionObject = {
3
+ "name": string;
4
+ "constraints": number;
5
+ "variables": number;
6
+ "verifyingKey": string | VerifyingKey;
7
+ };
@@ -1,4 +1,7 @@
1
- export type Input = {
1
+ /**
2
+ * Object representation of an Input as raw JSON returned from a SnarkOS node.
3
+ */
4
+ export type InputJSON = {
2
5
  type: string;
3
6
  id: string;
4
7
  tag?: string;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Aleo function Input represented as a typed typescript object.
3
+ */
4
+ import { Ciphertext, Field } from "@provablehq/wasm";
5
+ import { Plaintext } from "@provablehq/wasm/mainnet.js";
6
+ import { PlaintextObject } from "../plaintext/plaintext";
7
+ /**
8
+ * Object representation of an Input as raw JSON returned from a SnarkOS node.
9
+ */
10
+ export type InputObject = {
11
+ type: "string";
12
+ id: "string" | Field;
13
+ tag?: string | Field;
14
+ value?: Ciphertext | Plaintext | PlaintextObject;
15
+ };
@@ -1,4 +1,4 @@
1
- export type Output = {
1
+ export type OutputJSON = {
2
2
  type: string;
3
3
  id: string;
4
4
  checksum: string;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Aleo function Input represented as a typed typescript object.
3
+ */
4
+ import { Field, Ciphertext, Plaintext } from "@provablehq/wasm";
5
+ import { PlaintextObject } from "../plaintext/plaintext";
6
+ /**
7
+ * Object representation of an Input as raw JSON returned from a SnarkOS node.
8
+ */
9
+ export type OutputObject = {
10
+ type: string;
11
+ id: string | Field;
12
+ value?: Ciphertext | Plaintext | PlaintextObject;
13
+ checksum?: string | Field;
14
+ programId?: string;
15
+ functionName?: string;
16
+ arguments?: Array<Plaintext> | Array<OutputObject>;
17
+ };
@@ -0,0 +1,3 @@
1
+ import { PlaintextLiteral } from "./literal";
2
+ import { PlaintextStruct } from "./struct";
3
+ export type PlaintextArray = PlaintextLiteral[] | PlaintextStruct[] | PlaintextArray[];
@@ -0,0 +1 @@
1
+ export type PlaintextLiteral = boolean | bigint | number | string;
@@ -0,0 +1,4 @@
1
+ import { PlaintextArray } from "./array";
2
+ import { PlaintextLiteral } from "./literal";
3
+ import { PlaintextStruct } from "./struct";
4
+ export type PlaintextObject = PlaintextArray | PlaintextLiteral | PlaintextStruct;
@@ -0,0 +1,5 @@
1
+ import { PlaintextArray } from "./array";
2
+ import { PlaintextLiteral } from "./literal";
3
+ export type PlaintextStruct = {
4
+ [key: string]: PlaintextArray | PlaintextLiteral | PlaintextStruct;
5
+ };
@@ -0,0 +1,6 @@
1
+ import { ExecutionJSON } from "../executionJSON";
2
+ export type TransactionJSON = {
3
+ type: string;
4
+ id: string;
5
+ execution: ExecutionJSON;
6
+ };
@@ -0,0 +1,11 @@
1
+ import { TransitionObject } from "../transition/transitionObject";
2
+ import { DeploymentMetadata } from "../deploy";
3
+ export type TransactionSummary = {
4
+ id: string;
5
+ type: string;
6
+ fee: bigint;
7
+ baseFee: bigint;
8
+ priorityFee: bigint;
9
+ transitions: TransitionObject[];
10
+ deployment?: DeploymentMetadata;
11
+ };
@@ -0,0 +1,13 @@
1
+ import { InputJSON } from "../input/inputJSON";
2
+ import { OutputJSON } from "../output/outputJSON";
3
+ export type TransitionJSON = {
4
+ id: string;
5
+ program: string;
6
+ function: string;
7
+ inputs?: (InputJSON)[];
8
+ outputs?: (OutputJSON)[];
9
+ proof: string;
10
+ tpk: string;
11
+ tcm: string;
12
+ fee: bigint;
13
+ };
@@ -0,0 +1,15 @@
1
+ import { InputObject } from "../input/inputObject";
2
+ import { OutputObject } from "../output/outputObject";
3
+ import { Field, Group } from "@provablehq/wasm";
4
+ export type TransitionObject = {
5
+ id: string;
6
+ program: string;
7
+ functionName: string;
8
+ inputs?: (InputObject)[];
9
+ outputs?: (OutputObject)[];
10
+ proof: string;
11
+ tpk: string | Group;
12
+ tcm: string | Field;
13
+ scm: string | Field;
14
+ fee: bigint;
15
+ };
@@ -1,4 +1,7 @@
1
- import { Account, Block, Program, RecordPlaintext, PrivateKey, Transaction, TransactionModel } from "./browser";
1
+ import { Account } from "./account";
2
+ import { BlockJSON } from "./models/blockJSON";
3
+ import { TransactionJSON } from "./models/transaction/transactionJSON";
4
+ import { Plaintext, Program, RecordPlaintext, PrivateKey, Transaction } from "./wasm";
2
5
  type ProgramImports = {
3
6
  [key: string]: string | Program;
4
7
  };
@@ -51,7 +54,7 @@ declare class AleoNetworkClient {
51
54
  setHost(host: string): void;
52
55
  fetchData<Type>(url?: string): Promise<Type>;
53
56
  /**
54
- * Attempts to find unspent records in the Aleo blockchain for a specified private key
57
+ * Attempts to find unspent records in the Aleo blockchain for a specified private key.
55
58
  * @param {number} startHeight - The height at which to start searching for unspent records
56
59
  * @param {number} endHeight - The height at which to stop searching for unspent records
57
60
  * @param {string | PrivateKey} privateKey - The private key to use to find unspent records
@@ -75,58 +78,65 @@ declare class AleoNetworkClient {
75
78
  */
76
79
  findUnspentRecords(startHeight: number, endHeight: number | undefined, privateKey: string | PrivateKey | undefined, amounts: number[] | undefined, maxMicrocredits?: number | undefined, nonces?: string[] | undefined): Promise<Array<RecordPlaintext>>;
77
80
  /**
78
- * Returns the contents of the block at the specified block height
81
+ * Returns the contents of the block at the specified block height.
79
82
  *
80
83
  * @param {number} height
81
84
  * @example
82
85
  * const block = networkClient.getBlock(1234);
83
86
  */
84
- getBlock(height: number): Promise<Block>;
87
+ getBlock(height: number): Promise<BlockJSON>;
85
88
  /**
86
- * Returns a range of blocks between the specified block heights
89
+ * Returns a range of blocks between the specified block heights.
87
90
  *
88
91
  * @param {number} start
89
92
  * @param {number} end
90
93
  * @example
91
94
  * const blockRange = networkClient.getBlockRange(2050, 2100);
92
95
  */
93
- getBlockRange(start: number, end: number): Promise<Array<Block>>;
96
+ getBlockRange(start: number, end: number): Promise<Array<BlockJSON>>;
94
97
  /**
95
- * Returns the deployment transaction id associated with the specified program
98
+ * Returns the deployment transaction id associated with the specified program.
96
99
  *
97
100
  * @param {Program | string} program
98
- * @returns {TransactionModel}
101
+ * @returns {TransactionJSON}
99
102
  */
100
103
  getDeploymentTransactionIDForProgram(program: Program | string): Promise<string>;
101
104
  /**
102
- * Returns the deployment transaction associated with a specified program
105
+ * Returns the deployment transaction associated with a specified program.
103
106
  *
104
107
  * @param {Program | string} program
105
- * @returns {TransactionModel}
108
+ * @returns {TransactionJSON}
106
109
  */
107
- getDeploymentTransactionForProgram(program: Program | string): Promise<TransactionModel>;
110
+ getDeploymentTransactionForProgram(program: Program | string): Promise<TransactionJSON>;
108
111
  /**
109
- * Returns the contents of the latest block
112
+ * Returns the deployment transaction associated with a specified program as a wasm object.
113
+ *
114
+ * @param {Program | string} program
115
+ * @returns {TransactionJSON}
116
+ */
117
+ getDeploymentTransactioObjectnForProgram(program: Program | string): Promise<Transaction>;
118
+ /**
119
+ * Returns the contents of the latest block.
110
120
  *
111
121
  * @example
112
122
  * const latestHeight = networkClient.getLatestBlock();
113
123
  */
114
- getLatestBlock(): Promise<Block>;
124
+ getLatestBlock(): Promise<BlockJSON>;
115
125
  /**
116
- * Returns the latest committee
126
+ * Returns the latest committee.
117
127
  *
118
128
  * @returns {Promise<object>} A javascript object containing the latest committee
119
129
  */
120
130
  getLatestCommittee(): Promise<object>;
121
131
  /**
122
- * Returns the latest block height
132
+ * Returns the latest block height.
123
133
  *
124
134
  * @example
125
135
  * const latestHeight = networkClient.getLatestHeight();
126
136
  */
127
137
  getLatestHeight(): Promise<number>;
128
138
  /**
129
- * Returns the source code of a program given a program ID
139
+ * Returns the source code of a program given a program ID.
130
140
  *
131
141
  * @param {string} programId The program ID of a program deployed to the Aleo Network
132
142
  * @return {Promise<string>} Source code of the program
@@ -138,7 +148,7 @@ declare class AleoNetworkClient {
138
148
  */
139
149
  getProgram(programId: string): Promise<string>;
140
150
  /**
141
- * Returns a program object from a program ID or program source code
151
+ * Returns a program object from a program ID or program source code.
142
152
  *
143
153
  * @param {string} inputProgram The program ID or program source code of a program deployed to the Aleo Network
144
154
  * @return {Promise<Program>} Source code of the program
@@ -182,7 +192,7 @@ declare class AleoNetworkClient {
182
192
  */
183
193
  getProgramImports(inputProgram: Program | string): Promise<ProgramImports>;
184
194
  /**
185
- * Get a list of the program names that a program imports
195
+ * Get a list of the program names that a program imports.
186
196
  *
187
197
  * @param {Program | string} inputProgram - The program id or program source code to get the imports of
188
198
  * @returns {string[]} - The list of program names that the program imports
@@ -194,7 +204,7 @@ declare class AleoNetworkClient {
194
204
  */
195
205
  getProgramImportNames(inputProgram: Program | string): Promise<string[]>;
196
206
  /**
197
- * Returns the names of the mappings of a program
207
+ * Returns the names of the mappings of a program.
198
208
  *
199
209
  * @param {string} programId - The program ID to get the mappings of (e.g. "credits.aleo")
200
210
  * @example
@@ -204,11 +214,11 @@ declare class AleoNetworkClient {
204
214
  */
205
215
  getProgramMappingNames(programId: string): Promise<Array<string>>;
206
216
  /**
207
- * Returns the value of a program's mapping for a specific key
217
+ * Returns the value of a program's mapping for a specific key.
208
218
  *
209
219
  * @param {string} programId - The program ID to get the mapping value of (e.g. "credits.aleo")
210
220
  * @param {string} mappingName - The name of the mapping to get the value of (e.g. "account")
211
- * @param {string} key - The key of the mapping to get the value of (e.g. "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px")
221
+ * @param {string | Plaintext} key - The key of the mapping to get the value of (e.g. "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px")
212
222
  * @return {Promise<string>} String representation of the value of the mapping
213
223
  *
214
224
  * @example
@@ -217,37 +227,113 @@ declare class AleoNetworkClient {
217
227
  * const expectedValue = "0u64";
218
228
  * assert.equal(mappingValue, expectedValue);
219
229
  */
220
- getProgramMappingValue(programId: string, mappingName: string, key: string): Promise<string>;
230
+ getProgramMappingValue(programId: string, mappingName: string, key: string | Plaintext): Promise<string>;
221
231
  /**
222
- * Returns the latest state/merkle root of the Aleo blockchain
232
+ * Returns the value of a mapping as a wasm Plaintext object. Returning an
233
+ * object in this format allows it to be converted to a Js type and for its
234
+ * internal members to be inspected if it's a struct or array.
235
+ *
236
+ * @example
237
+ * // Get the bond state as an account.
238
+ * const unbondedState = networkClient.getMappingPlaintext("credits.aleo", "bonded", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px");
239
+ *
240
+ * // Get the two members of the object individually.
241
+ * const validator = unbondedState.getMember("validator");
242
+ * const microcredits = unbondedState.getMember("microcredits");
243
+ *
244
+ * // Ensure the expected values are correct.
245
+ * assert.equal(validator, "aleo1u6940v5m0fzud859xx2c9tj2gjg6m5qrd28n636e6fdd2akvfcgqs34mfd");
246
+ * assert.equal(microcredits, BigInt("9007199254740991"));
247
+ *
248
+ * // Get a JS object representation of the unbonded state.
249
+ * const unbondedStateObject = unbondedState.toObject();
250
+ *
251
+ * const expectedState = {
252
+ * validator: "aleo1u6940v5m0fzud859xx2c9tj2gjg6m5qrd28n636e6fdd2akvfcgqs34mfd",
253
+ * microcredits: BigInt("9007199254740991")
254
+ * };
255
+ * assert.equal(unbondedState, expectedState);
256
+ *
257
+ * @param {string} programId - The program ID to get the mapping value of (e.g. "credits.aleo")
258
+ * @param {string} mappingName - The name of the mapping to get the value of (e.g. "account")
259
+ * @param {string | Plaintext} key - The key of the mapping to get the value of (e.g. "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px")
260
+ *
261
+ * @return {Promise<string>} String representation of the value of the mapping
262
+ */
263
+ getProgramMappingPlaintext(programId: string, mappingName: string, key: string | Plaintext): Promise<Plaintext>;
264
+ /**
265
+ * Returns the latest state/merkle root of the Aleo blockchain.
223
266
  *
224
267
  * @example
225
268
  * const stateRoot = networkClient.getStateRoot();
226
269
  */
227
270
  getStateRoot(): Promise<string>;
228
271
  /**
229
- * Returns a transaction by its unique identifier
272
+ * Returns a transaction by its unique identifier.
230
273
  *
231
274
  * @param {string} id
232
275
  * @example
233
276
  * const transaction = networkClient.getTransaction("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj");
234
277
  */
235
- getTransaction(id: string): Promise<TransactionModel>;
278
+ getTransaction(transactionId: string): Promise<TransactionJSON>;
236
279
  /**
237
- * Returns the transactions present at the specified block height
280
+ * Returns a transaction as a wasm object. Getting a transaction of this type will allow the ability for the inputs,
281
+ * outputs, and records to be searched for and displayed.
282
+ *
283
+ * @example
284
+ * const transactionObject = networkClient.getTransaction("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj");
285
+ * // Get the transaction inputs as a JS array.
286
+ * const transactionOutputs = transactionObject.inputs(true);
287
+ *
288
+ * // Get the transaction outputs as a JS object.
289
+ * const transactionInputs = transactionObject.outputs(true);
290
+ *
291
+ * // Get any records generated in transitions in the transaction as a JS object.
292
+ * const records = transactionObject.records();
293
+ *
294
+ * // Get the transaction type.
295
+ * const transactionType = transactionObject.transactionType();
296
+ * assert.equal(transactionType, "Execute");
297
+ *
298
+ * // Get a JS representation of all inputs, outputs, and transaction metadata.
299
+ * const transactionSummary = transactionObject.summary();
300
+ *
301
+ * @param {string} transactionId
302
+ * @example
303
+ */
304
+ getTransactionObject(transactionId: string): Promise<Transaction>;
305
+ /**
306
+ * Returns the transactions present at the specified block height.
238
307
  *
239
308
  * @param {number} height
240
309
  * @example
241
310
  * const transactions = networkClient.getTransactions(654);
242
311
  */
243
- getTransactions(height: number): Promise<Array<TransactionModel>>;
312
+ getTransactions(height: number): Promise<Array<TransactionJSON>>;
313
+ /**
314
+ * Returns an array of transactions as wasm objects present at the specified block height.
315
+ *
316
+ * @param {number} height
317
+ * @example
318
+ * const transactions = networkClient.getTransactionObjects(654);
319
+ *
320
+ * let transaction_summaries = transactions.map(transaction => transaction.summary());
321
+ */
322
+ getTransactionObjects(height: number): Promise<Array<Transaction>>;
244
323
  /**
245
324
  * Returns the transactions in the memory pool.
246
325
  *
247
326
  * @example
248
327
  * const transactions = networkClient.getTransactionsInMempool();
249
328
  */
250
- getTransactionsInMempool(): Promise<Array<TransactionModel>>;
329
+ getTransactionsInMempool(): Promise<Array<TransactionJSON>>;
330
+ /**
331
+ * Returns the transactions in the memory pool as wasm objects.
332
+ *
333
+ * @example
334
+ * const transactions = networkClient.getTransactionsInMempool();
335
+ */
336
+ getTransactionObjectsInMempool(): Promise<Array<Transaction>>;
251
337
  /**
252
338
  * Returns the transition ID of the transition corresponding to the ID of the input or output.
253
339
  * @param {string} inputOrOutputID - ID of the input or output.
@@ -257,11 +343,17 @@ declare class AleoNetworkClient {
257
343
  */
258
344
  getTransitionId(inputOrOutputID: string): Promise<string>;
259
345
  /**
260
- * Submit an execute or deployment transaction to the Aleo network
346
+ * Submit an execute or deployment transaction to the Aleo network.
261
347
  *
262
348
  * @param {Transaction | string} transaction - The transaction to submit to the network
263
349
  * @returns {string} - The transaction id of the submitted transaction or the resulting error
264
350
  */
265
351
  submitTransaction(transaction: Transaction | string): Promise<string>;
352
+ /**
353
+ * Submit a solution to the Aleo network.
354
+ *
355
+ * @param {string} solution The string representation of the solution desired to be submitted to the network.
356
+ */
357
+ submitSolution(solution: string): Promise<string>;
266
358
  }
267
359
  export { AleoNetworkClient, AleoNetworkClientOptions, ProgramImports };
@@ -175,10 +175,11 @@ globalThis.Worker = class Worker extends EventTarget {
175
175
  throw new Error("Workers must use \`type: \"module\"\`");
176
176
  }
177
177
  const code = `
178
- const { workerData } = require("node:worker_threads");
179
-
180
- import(workerData.polyfill)
181
- .then(() => import(workerData.url))
178
+ import("node:worker_threads")
179
+ .then(({ workerData }) => {
180
+ return import(workerData.polyfill)
181
+ .then(() => import(workerData.url))
182
+ })
182
183
  .catch((e) => {
183
184
  // TODO maybe it should send a message to the parent?
184
185
  console.error(e.stack);
@@ -1 +1 @@
1
- {"version":3,"file":"node-polyfill.js","sources":["../../src/polyfill/crypto.ts","../../src/polyfill/fetch.ts","../../src/polyfill/xmlhttprequest.ts","../../src/polyfill/worker.ts","../../src/node-polyfill.ts"],"sourcesContent":["import { webcrypto } from \"node:crypto\";\n\nif ((globalThis as any).crypto == null) {\n (globalThis as any).crypto = webcrypto;\n}\n","import * as $fs from \"node:fs\";\nimport $mime from \"mime/lite.js\";\n\n\nconst oldFetch = globalThis.fetch;\n\n// We always polyfill fetch because Node's fetch doesn't support file URLs.\n(globalThis.fetch as any) = async function (resource: URL | RequestInfo, options: RequestInit | undefined): Promise<Response> {\n const request = new Request(resource, options);\n\n const url = new URL(request.url);\n\n if (url.protocol === \"file:\") {\n const readStream = $fs.createReadStream(url);\n\n const headers: HeadersInit = {};\n\n const type = $mime.getType(url.pathname);\n\n if (type) {\n headers[\"Content-Type\"] = type;\n }\n\n return new Response(readStream as any, {\n status: 200,\n statusText: \"OK\",\n headers,\n });\n\n } else {\n return await oldFetch(request);\n }\n};\n","import $request from \"sync-request\";\n\n\nglobalThis.XMLHttpRequest = class extends EventTarget implements XMLHttpRequest {\n public static readonly UNSENT = 0;\n public static readonly OPENED = 1;\n public static readonly HEADERS_RECEIVED = 2;\n public static readonly LOADING = 3;\n public static readonly DONE = 4;\n\n public readonly UNSENT = XMLHttpRequest.UNSENT;\n public readonly OPENED = XMLHttpRequest.OPENED;\n public readonly HEADERS_RECEIVED = XMLHttpRequest.HEADERS_RECEIVED;\n public readonly LOADING = XMLHttpRequest.LOADING;\n public readonly DONE = XMLHttpRequest.DONE;\n\n public responseType!: XMLHttpRequestResponseType;\n public withCredentials!: boolean;\n public timeout!: number;\n\n public readonly readyState!: number;\n public readonly response!: ArrayBuffer | Blob | Document | string | null;\n public readonly responseText!: string;\n public readonly responseURL!: string;\n public readonly responseXML!: Document | null;\n public readonly status!: number;\n public readonly statusText!: string;\n public readonly upload!: XMLHttpRequestUpload;\n\n private _url!: string | URL | null;\n private _mime!: string;\n\n constructor() {\n super();\n\n this._reset();\n\n this._mime = \"text/xml\";\n }\n\n private _reset() {\n (this as any).readyState = XMLHttpRequest.UNSENT;\n (this as any).response = null;\n (this as any).responseText = \"\";\n (this as any).responseType = \"\";\n (this as any).responseURL = \"\";\n (this as any).responseXML = null;\n (this as any).status = 0;\n (this as any).statusText = \"\";\n (this as any).timeout = 0;\n (this as any).upload = null;\n (this as any).withCredentials = false;\n\n this._url = null;\n }\n\n private _success() {\n (this as any).readyState = XMLHttpRequest.DONE;\n (this as any).status = 200;\n (this as any).statusText = \"OK\";\n }\n\n public set onabort(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onerror(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onreadystatechange(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onloadstart(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onload(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onloadend(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onprogress(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set ontimeout(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public abort() {\n throw new Error(\"Not implemented\");\n }\n\n public overrideMimeType(mime: string) {\n this._mime = mime;\n }\n\n public getResponseHeader(): string | null {\n throw new Error(\"Not implemented\");\n }\n\n public getAllResponseHeaders(): string {\n throw new Error(\"Not implemented\");\n }\n\n public setRequestHeader() {\n throw new Error(\"Not implemented\");\n }\n\n public open(method: string, url: string | URL, async: boolean = true, username?: string | null | undefined, password?: string | null | undefined): void {\n if (async) {\n throw new Error(\"Async XMLHttpRequest is not implemented yet\");\n }\n\n if (method !== \"GET\") {\n throw new Error(\"Non-GET requests are not implemented yet\");\n }\n\n this._reset();\n\n this._url = url;\n }\n\n public send(body: null = null) {\n if (body !== null) {\n throw new Error(\"XMLHttpRequest send body is not implemented yet\");\n }\n\n if (!this._url) {\n throw new Error(\"You must call open before you call send\");\n }\n\n const response = $request(\"GET\", this._url, {\n headers: {\n \"Content-Type\": this._mime,\n }\n });\n\n const buffer = (response.body as Buffer).buffer;\n\n const responseText = new TextDecoder(\"iso-8859-5\", { fatal: true }).decode(buffer);\n\n (this as any).response = (this as any).responseText = responseText;\n\n this._url = null;\n\n this._success();\n }\n};","import * as $worker from \"node:worker_threads\";\nimport * as $os from \"node:os\";\n\n// This is technically not a part of the Worker polyfill,\n// but Workers are used for multi-threading, so this is often\n// needed when writing Worker code.\nif (globalThis.navigator == null) {\n globalThis.navigator = {\n hardwareConcurrency: $os.cpus().length,\n } as Navigator;\n}\n\nglobalThis.Worker = class Worker extends EventTarget {\n private _worker: import(\"node:worker_threads\").Worker;\n\n constructor(url: string | URL, options?: WorkerOptions | undefined) {\n super();\n\n if (url instanceof URL) {\n if (url.protocol !== \"file:\") {\n throw new Error(\"Worker only supports file: URLs\");\n }\n\n url = url.href;\n\n } else {\n throw new Error(\"Filepaths are unreliable, use `new URL(\\\"...\\\", import.meta.url)` instead.\");\n }\n\n if (!options || options.type !== \"module\") {\n throw new Error(\"Workers must use \\`type: \\\"module\\\"\\`\");\n }\n\n const code = `\n const { workerData } = require(\"node:worker_threads\");\n\n import(workerData.polyfill)\n .then(() => import(workerData.url))\n .catch((e) => {\n // TODO maybe it should send a message to the parent?\n console.error(e.stack);\n });\n `;\n\n this._worker = new $worker.Worker(code, {\n eval: true,\n workerData: {\n url,\n polyfill: new URL(\"node-polyfill.js\", import.meta.url).href,\n },\n });\n\n this._worker.on(\"message\", (data) => {\n this.dispatchEvent(new MessageEvent(\"message\", { data }));\n });\n\n this._worker.on(\"messageerror\", (error) => {\n throw new Error(\"UNIMPLEMENTED\");\n });\n\n this._worker.on(\"error\", (error) => {\n // TODO attach the error to the event somehow\n const event = new Event(\"error\");\n this.dispatchEvent(event);\n });\n }\n\n set onmessage(f: () => void) {\n throw new Error(\"UNIMPLEMENTED\");\n }\n\n set onmessageerror(f: () => void) {\n throw new Error(\"UNIMPLEMENTED\");\n }\n\n set onerror(f: () => void) {\n throw new Error(\"UNIMPLEMENTED\");\n }\n\n postMessage(message: any, transfer: Array<Transferable>): void;\n postMessage(message: any, options?: StructuredSerializeOptions | undefined): void;\n postMessage(value: any, transfer: any) {\n this._worker.postMessage(value, transfer);\n }\n\n terminate() {\n this._worker.terminate();\n }\n\n // This is Node-specific, it allows the process to exit\n // even if the Worker is still running.\n unref() {\n this._worker.unref();\n }\n};\n\n\nif (!$worker.isMainThread) {\n const globals = globalThis as unknown as DedicatedWorkerGlobalScope;\n\n // This is used to create the onmessage, onmessageerror, and onerror setters\n const makeSetter = (prop: string, event: string) => {\n let oldvalue: () => void;\n\n Object.defineProperty(globals, prop, {\n get() {\n return oldvalue;\n },\n set(value) {\n if (oldvalue) {\n globals.removeEventListener(event, oldvalue);\n }\n\n oldvalue = value;\n\n if (oldvalue) {\n globals.addEventListener(event, oldvalue);\n }\n },\n });\n };\n\n // This makes sure that `f` is only run once\n const memoize = (f: () => void) => {\n let run = false;\n\n return () => {\n if (!run) {\n run = true;\n f();\n }\n };\n };\n\n\n // We only start listening for messages / errors when the worker calls addEventListener\n const startOnMessage = memoize(() => {\n $worker.parentPort!.on(\"message\", (data) => {\n workerEvents.dispatchEvent(new MessageEvent(\"message\", { data }));\n });\n });\n\n const startOnMessageError = memoize(() => {\n throw new Error(\"UNIMPLEMENTED\");\n });\n\n const startOnError = memoize(() => {\n $worker.parentPort!.on(\"error\", (data) => {\n workerEvents.dispatchEvent(new Event(\"error\"));\n });\n });\n\n\n // Node workers don't have top-level events, so we have to make our own\n const workerEvents = new EventTarget();\n\n globals.close = () => {\n process.exit();\n };\n\n globals.addEventListener = (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => {\n workerEvents.addEventListener(type, callback, options);\n\n if (type === \"message\") {\n startOnMessage();\n } else if (type === \"messageerror\") {\n startOnMessageError();\n } else if (type === \"error\") {\n startOnError();\n }\n };\n\n globals.removeEventListener = (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => {\n workerEvents.removeEventListener(type, callback, options);\n };\n\n function postMessage(message: any, transfer: Transferable[]): void;\n function postMessage(message: any, options?: StructuredSerializeOptions | undefined): void;\n function postMessage(value: any, transfer: any) {\n $worker.parentPort!.postMessage(value, transfer);\n }\n\n globals.postMessage = postMessage;\n\n makeSetter(\"onmessage\", \"message\");\n makeSetter(\"onmessageerror\", \"messageerror\");\n makeSetter(\"onerror\", \"error\");\n}\n","import \"./polyfill/shared\";\nimport \"./polyfill/crypto\";\nimport \"./polyfill/fetch\";\nimport \"./polyfill/xmlhttprequest\";\nimport \"./polyfill/worker\";\n\nif (!globalThis.self) {\n (globalThis as any).self = globalThis;\n}\n"],"names":[],"mappings":";;;;;;;;AAEA,IAAK,UAAkB,CAAC,MAAM,IAAI,IAAI,EAAE;AACnC,IAAA,UAAk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ACnC;;ACrLA,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;AACjB,IAAA,UAAkB,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1C"}
1
+ {"version":3,"file":"node-polyfill.js","sources":["../../src/polyfill/crypto.ts","../../src/polyfill/fetch.ts","../../src/polyfill/xmlhttprequest.ts","../../src/polyfill/worker.ts","../../src/node-polyfill.ts"],"sourcesContent":["import { webcrypto } from \"node:crypto\";\n\nif ((globalThis as any).crypto == null) {\n (globalThis as any).crypto = webcrypto;\n}\n","import * as $fs from \"node:fs\";\nimport $mime from \"mime/lite.js\";\n\n\nconst oldFetch = globalThis.fetch;\n\n// We always polyfill fetch because Node's fetch doesn't support file URLs.\n(globalThis.fetch as any) = async function (resource: URL | RequestInfo, options: RequestInit | undefined): Promise<Response> {\n const request = new Request(resource, options);\n\n const url = new URL(request.url);\n\n if (url.protocol === \"file:\") {\n const readStream = $fs.createReadStream(url);\n\n const headers: HeadersInit = {};\n\n const type = $mime.getType(url.pathname);\n\n if (type) {\n headers[\"Content-Type\"] = type;\n }\n\n return new Response(readStream as any, {\n status: 200,\n statusText: \"OK\",\n headers,\n });\n\n } else {\n return await oldFetch(request);\n }\n};\n","import $request from \"sync-request\";\n\n\nglobalThis.XMLHttpRequest = class extends EventTarget implements XMLHttpRequest {\n public static readonly UNSENT = 0;\n public static readonly OPENED = 1;\n public static readonly HEADERS_RECEIVED = 2;\n public static readonly LOADING = 3;\n public static readonly DONE = 4;\n\n public readonly UNSENT = XMLHttpRequest.UNSENT;\n public readonly OPENED = XMLHttpRequest.OPENED;\n public readonly HEADERS_RECEIVED = XMLHttpRequest.HEADERS_RECEIVED;\n public readonly LOADING = XMLHttpRequest.LOADING;\n public readonly DONE = XMLHttpRequest.DONE;\n\n public responseType!: XMLHttpRequestResponseType;\n public withCredentials!: boolean;\n public timeout!: number;\n\n public readonly readyState!: number;\n public readonly response!: ArrayBuffer | Blob | Document | string | null;\n public readonly responseText!: string;\n public readonly responseURL!: string;\n public readonly responseXML!: Document | null;\n public readonly status!: number;\n public readonly statusText!: string;\n public readonly upload!: XMLHttpRequestUpload;\n\n private _url!: string | URL | null;\n private _mime!: string;\n\n constructor() {\n super();\n\n this._reset();\n\n this._mime = \"text/xml\";\n }\n\n private _reset() {\n (this as any).readyState = XMLHttpRequest.UNSENT;\n (this as any).response = null;\n (this as any).responseText = \"\";\n (this as any).responseType = \"\";\n (this as any).responseURL = \"\";\n (this as any).responseXML = null;\n (this as any).status = 0;\n (this as any).statusText = \"\";\n (this as any).timeout = 0;\n (this as any).upload = null;\n (this as any).withCredentials = false;\n\n this._url = null;\n }\n\n private _success() {\n (this as any).readyState = XMLHttpRequest.DONE;\n (this as any).status = 200;\n (this as any).statusText = \"OK\";\n }\n\n public set onabort(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onerror(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onreadystatechange(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onloadstart(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onload(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onloadend(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set onprogress(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public set ontimeout(value: () => void) {\n throw new Error(\"Not implemented\");\n }\n\n public abort() {\n throw new Error(\"Not implemented\");\n }\n\n public overrideMimeType(mime: string) {\n this._mime = mime;\n }\n\n public getResponseHeader(): string | null {\n throw new Error(\"Not implemented\");\n }\n\n public getAllResponseHeaders(): string {\n throw new Error(\"Not implemented\");\n }\n\n public setRequestHeader() {\n throw new Error(\"Not implemented\");\n }\n\n public open(method: string, url: string | URL, async: boolean = true, username?: string | null | undefined, password?: string | null | undefined): void {\n if (async) {\n throw new Error(\"Async XMLHttpRequest is not implemented yet\");\n }\n\n if (method !== \"GET\") {\n throw new Error(\"Non-GET requests are not implemented yet\");\n }\n\n this._reset();\n\n this._url = url;\n }\n\n public send(body: null = null) {\n if (body !== null) {\n throw new Error(\"XMLHttpRequest send body is not implemented yet\");\n }\n\n if (!this._url) {\n throw new Error(\"You must call open before you call send\");\n }\n\n const response = $request(\"GET\", this._url, {\n headers: {\n \"Content-Type\": this._mime,\n }\n });\n\n const buffer = (response.body as Buffer).buffer;\n\n const responseText = new TextDecoder(\"iso-8859-5\", { fatal: true }).decode(buffer);\n\n (this as any).response = (this as any).responseText = responseText;\n\n this._url = null;\n\n this._success();\n }\n};","import * as $worker from \"node:worker_threads\";\nimport * as $os from \"node:os\";\n\n// This is technically not a part of the Worker polyfill,\n// but Workers are used for multi-threading, so this is often\n// needed when writing Worker code.\nif (globalThis.navigator == null) {\n globalThis.navigator = {\n hardwareConcurrency: $os.cpus().length,\n } as Navigator;\n}\n\nglobalThis.Worker = class Worker extends EventTarget {\n private _worker: import(\"node:worker_threads\").Worker;\n\n constructor(url: string | URL, options?: WorkerOptions | undefined) {\n super();\n\n if (url instanceof URL) {\n if (url.protocol !== \"file:\") {\n throw new Error(\"Worker only supports file: URLs\");\n }\n\n url = url.href;\n\n } else {\n throw new Error(\"Filepaths are unreliable, use `new URL(\\\"...\\\", import.meta.url)` instead.\");\n }\n\n if (!options || options.type !== \"module\") {\n throw new Error(\"Workers must use \\`type: \\\"module\\\"\\`\");\n }\n\n const code = `\n import(\"node:worker_threads\")\n .then(({ workerData }) => {\n return import(workerData.polyfill)\n .then(() => import(workerData.url))\n })\n .catch((e) => {\n // TODO maybe it should send a message to the parent?\n console.error(e.stack);\n });\n `;\n\n this._worker = new $worker.Worker(code, {\n eval: true,\n workerData: {\n url,\n polyfill: new URL(\"node-polyfill.js\", import.meta.url).href,\n },\n });\n\n this._worker.on(\"message\", (data) => {\n this.dispatchEvent(new MessageEvent(\"message\", { data }));\n });\n\n this._worker.on(\"messageerror\", (error) => {\n throw new Error(\"UNIMPLEMENTED\");\n });\n\n this._worker.on(\"error\", (error) => {\n // TODO attach the error to the event somehow\n const event = new Event(\"error\");\n this.dispatchEvent(event);\n });\n }\n\n set onmessage(f: () => void) {\n throw new Error(\"UNIMPLEMENTED\");\n }\n\n set onmessageerror(f: () => void) {\n throw new Error(\"UNIMPLEMENTED\");\n }\n\n set onerror(f: () => void) {\n throw new Error(\"UNIMPLEMENTED\");\n }\n\n postMessage(message: any, transfer: Array<Transferable>): void;\n postMessage(message: any, options?: StructuredSerializeOptions | undefined): void;\n postMessage(value: any, transfer: any) {\n this._worker.postMessage(value, transfer);\n }\n\n terminate() {\n this._worker.terminate();\n }\n\n // This is Node-specific, it allows the process to exit\n // even if the Worker is still running.\n unref() {\n this._worker.unref();\n }\n};\n\n\nif (!$worker.isMainThread) {\n const globals = globalThis as unknown as DedicatedWorkerGlobalScope;\n\n // This is used to create the onmessage, onmessageerror, and onerror setters\n const makeSetter = (prop: string, event: string) => {\n let oldvalue: () => void;\n\n Object.defineProperty(globals, prop, {\n get() {\n return oldvalue;\n },\n set(value) {\n if (oldvalue) {\n globals.removeEventListener(event, oldvalue);\n }\n\n oldvalue = value;\n\n if (oldvalue) {\n globals.addEventListener(event, oldvalue);\n }\n },\n });\n };\n\n // This makes sure that `f` is only run once\n const memoize = (f: () => void) => {\n let run = false;\n\n return () => {\n if (!run) {\n run = true;\n f();\n }\n };\n };\n\n\n // We only start listening for messages / errors when the worker calls addEventListener\n const startOnMessage = memoize(() => {\n $worker.parentPort!.on(\"message\", (data) => {\n workerEvents.dispatchEvent(new MessageEvent(\"message\", { data }));\n });\n });\n\n const startOnMessageError = memoize(() => {\n throw new Error(\"UNIMPLEMENTED\");\n });\n\n const startOnError = memoize(() => {\n $worker.parentPort!.on(\"error\", (data) => {\n workerEvents.dispatchEvent(new Event(\"error\"));\n });\n });\n\n\n // Node workers don't have top-level events, so we have to make our own\n const workerEvents = new EventTarget();\n\n globals.close = () => {\n process.exit();\n };\n\n globals.addEventListener = (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => {\n workerEvents.addEventListener(type, callback, options);\n\n if (type === \"message\") {\n startOnMessage();\n } else if (type === \"messageerror\") {\n startOnMessageError();\n } else if (type === \"error\") {\n startOnError();\n }\n };\n\n globals.removeEventListener = (type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined) => {\n workerEvents.removeEventListener(type, callback, options);\n };\n\n function postMessage(message: any, transfer: Transferable[]): void;\n function postMessage(message: any, options?: StructuredSerializeOptions | undefined): void;\n function postMessage(value: any, transfer: any) {\n $worker.parentPort!.postMessage(value, transfer);\n }\n\n globals.postMessage = postMessage;\n\n makeSetter(\"onmessage\", \"message\");\n makeSetter(\"onmessageerror\", \"messageerror\");\n makeSetter(\"onerror\", \"error\");\n}\n","import \"./polyfill/shared\";\nimport \"./polyfill/crypto\";\nimport \"./polyfill/fetch\";\nimport \"./polyfill/xmlhttprequest\";\nimport \"./polyfill/worker\";\n\nif (!globalThis.self) {\n (globalThis as any).self = globalThis;\n}\n"],"names":[],"mappings":";;;;;;;;AAEA,IAAK,UAAkB,CAAC,MAAM,IAAI,IAAI,EAAE;AACnC,IAAA,UAAkB,CAAC,MAAM,GAAG,SAAS,CAAC;AAC3C;;ACAA,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;AAElC;AACC,UAAU,CAAC,KAAa,GAAG,gBAAgB,QAA2B,EAAE,OAAgC,EAAA;IACrG,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAE/C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAEjC,IAAA,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO,EAAE;QAC1B,MAAM,UAAU,GAAG,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;QAE7C,MAAM,OAAO,GAAgB,EAAE,CAAC;QAEhC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAEzC,IAAI,IA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AAc,EAAE;AAChC,YAAA,mBAAmB,EAAE,CAAC;SACzB;AAAM,aAAA,IAAI,IAAI,KAAK,OAAO,EAAE;AACzB,YAAA,YAAY,EAAE,CAAC;SAClB;AACL,KAAC,CAAC;IAEF,OAAO,CAAC,mBAAmB,GAAG,CAAC,IAAY,EAAE,QAAmD,EAAE,OAAoD,KAAI;QACtJ,YAAY,CAAC,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC9D,KAAC,CAAC;AAIF,IAAA,SAAS,WAAW,CAAC,KAAU,EAAE,QAAa,EAAA;QAC1C,OAAO,CAAC,UAAW,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;KACpD;AAED,IAAA,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC;AAElC,IAAA,UAAU,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AACnC,IAAA,UAAU,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;AAC7C,IAAA,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACnC;;ACtLA,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;AACjB,IAAA,UAAkB,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1C"}
@@ -1,6 +1,7 @@
1
1
  import './node-polyfill.js';
2
- export { Account, AleoKeyProvider, AleoKeyProviderParams, AleoNetworkClient, BlockHeightSearch, CREDITS_PROGRAM_KEYS, KEY_STORE, NetworkRecordProvider, OfflineKeyProvider, OfflineSearchParams, PRIVATE_TO_PUBLIC_TRANSFER, PRIVATE_TRANSFER, PRIVATE_TRANSFER_TYPES, PUBLIC_TO_PRIVATE_TRANSFER, PUBLIC_TRANSFER, PUBLIC_TRANSFER_AS_SIGNER, ProgramManager, VALID_TRANSFER_TYPES, createAleoWorker, initializeWasm, logAndThrow } from './browser.js';
3
- export { Address, ExecutionResponse, Field, Execution as FunctionExecution, OfflineQuery, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, RecordCiphertext, RecordPlaintext, Signature, Transaction, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution } from '@provablehq/wasm/mainnet.js';
2
+ export { Account, BlockHeightSearch, NetworkRecordProvider, OfflineKeyProvider, OfflineSearchParams, createAleoWorker, initializeWasm } from './browser.js';
3
+ export { A as AleoKeyProvider, a as AleoKeyProviderParams, b as AleoNetworkClient, C as CREDITS_PROGRAM_KEYS, K as KEY_STORE, d as PRIVATE_TO_PUBLIC_TRANSFER, c as PRIVATE_TRANSFER, e as PRIVATE_TRANSFER_TYPES, h as PUBLIC_TO_PRIVATE_TRANSFER, f as PUBLIC_TRANSFER, g as PUBLIC_TRANSFER_AS_SIGNER, P as ProgramManager, V as VALID_TRANSFER_TYPES, l as logAndThrow } from './program-manager-DAqdrsXx.js';
4
+ export { Address, Ciphertext, ExecutionResponse, Field, Execution as FunctionExecution, Group, OfflineQuery, Plaintext, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution } from '@provablehq/wasm/mainnet.js';
4
5
  import 'core-js/proposals/json-parse-with-source.js';
5
6
  import 'node:crypto';
6
7
  import 'node:fs';
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
1
+ {"version":3,"file":"node.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -1,4 +1,5 @@
1
- import { FunctionKeyProvider, KeySearchParams, FunctionKeyPair, CachedKeyPair, ProvingKey, VerifyingKey } from "./browser";
1
+ import { CachedKeyPair, FunctionKeyPair, FunctionKeyProvider, KeySearchParams } from "./function-key-provider";
2
+ import { ProvingKey, VerifyingKey } from "./wasm";
2
3
  /**
3
4
  * Search parameters for the offline key provider. This class implements the KeySearchParams interface and includes
4
5
  * a convenience method for creating a new instance of this class for each function of the credits.aleo program.