@provablehq/sdk 0.7.1 → 0.7.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.
Files changed (74) hide show
  1. package/README.md +3 -3
  2. package/package.json +3 -3
  3. package/dist/mainnet/account.d.ts +0 -137
  4. package/dist/mainnet/browser.d.ts +0 -20
  5. package/dist/mainnet/browser.js +0 -934
  6. package/dist/mainnet/browser.js.map +0 -1
  7. package/dist/mainnet/constants.d.ts +0 -34
  8. package/dist/mainnet/function-key-provider.d.ts +0 -349
  9. package/dist/mainnet/managed-worker.d.ts +0 -3
  10. package/dist/mainnet/models/block.d.ts +0 -21
  11. package/dist/mainnet/models/confirmed_transaction.d.ts +0 -6
  12. package/dist/mainnet/models/execution.d.ts +0 -5
  13. package/dist/mainnet/models/input.d.ts +0 -10
  14. package/dist/mainnet/models/output.d.ts +0 -6
  15. package/dist/mainnet/models/transactionModel.d.ts +0 -6
  16. package/dist/mainnet/models/transition.d.ts +0 -13
  17. package/dist/mainnet/network-client.d.ts +0 -270
  18. package/dist/mainnet/node-polyfill.d.ts +0 -5
  19. package/dist/mainnet/node-polyfill.js +0 -303
  20. package/dist/mainnet/node-polyfill.js.map +0 -1
  21. package/dist/mainnet/node.d.ts +0 -2
  22. package/dist/mainnet/node.js +0 -13
  23. package/dist/mainnet/node.js.map +0 -1
  24. package/dist/mainnet/offline-key-provider.d.ts +0 -348
  25. package/dist/mainnet/polyfill/crypto.d.ts +0 -1
  26. package/dist/mainnet/polyfill/fetch.d.ts +0 -1
  27. package/dist/mainnet/polyfill/shared.d.ts +0 -1
  28. package/dist/mainnet/polyfill/worker.d.ts +0 -1
  29. package/dist/mainnet/polyfill/xmlhttprequest.d.ts +0 -1
  30. package/dist/mainnet/program-manager-6a377210.js +0 -2200
  31. package/dist/mainnet/program-manager-6a377210.js.map +0 -1
  32. package/dist/mainnet/program-manager.d.ts +0 -640
  33. package/dist/mainnet/record-provider.d.ts +0 -236
  34. package/dist/mainnet/utils.d.ts +0 -4
  35. package/dist/mainnet/wasm.d.ts +0 -1
  36. package/dist/mainnet/worker.d.ts +0 -9
  37. package/dist/mainnet/worker.js +0 -78
  38. package/dist/mainnet/worker.js.map +0 -1
  39. package/dist/testnet/account.d.ts +0 -137
  40. package/dist/testnet/browser.d.ts +0 -20
  41. package/dist/testnet/browser.js +0 -934
  42. package/dist/testnet/browser.js.map +0 -1
  43. package/dist/testnet/constants.d.ts +0 -34
  44. package/dist/testnet/function-key-provider.d.ts +0 -349
  45. package/dist/testnet/managed-worker.d.ts +0 -3
  46. package/dist/testnet/models/block.d.ts +0 -21
  47. package/dist/testnet/models/confirmed_transaction.d.ts +0 -6
  48. package/dist/testnet/models/execution.d.ts +0 -5
  49. package/dist/testnet/models/input.d.ts +0 -10
  50. package/dist/testnet/models/output.d.ts +0 -6
  51. package/dist/testnet/models/transactionModel.d.ts +0 -6
  52. package/dist/testnet/models/transition.d.ts +0 -13
  53. package/dist/testnet/network-client.d.ts +0 -270
  54. package/dist/testnet/node-polyfill.d.ts +0 -5
  55. package/dist/testnet/node-polyfill.js +0 -303
  56. package/dist/testnet/node-polyfill.js.map +0 -1
  57. package/dist/testnet/node.d.ts +0 -2
  58. package/dist/testnet/node.js +0 -13
  59. package/dist/testnet/node.js.map +0 -1
  60. package/dist/testnet/offline-key-provider.d.ts +0 -348
  61. package/dist/testnet/polyfill/crypto.d.ts +0 -1
  62. package/dist/testnet/polyfill/fetch.d.ts +0 -1
  63. package/dist/testnet/polyfill/shared.d.ts +0 -1
  64. package/dist/testnet/polyfill/worker.d.ts +0 -1
  65. package/dist/testnet/polyfill/xmlhttprequest.d.ts +0 -1
  66. package/dist/testnet/program-manager-97ade0e6.js +0 -2200
  67. package/dist/testnet/program-manager-97ade0e6.js.map +0 -1
  68. package/dist/testnet/program-manager.d.ts +0 -640
  69. package/dist/testnet/record-provider.d.ts +0 -236
  70. package/dist/testnet/utils.d.ts +0 -4
  71. package/dist/testnet/wasm.d.ts +0 -1
  72. package/dist/testnet/worker.d.ts +0 -9
  73. package/dist/testnet/worker.js +0 -78
  74. package/dist/testnet/worker.js.map +0 -1
@@ -1,270 +0,0 @@
1
- import { Account } from "./account";
2
- import { Block } from "./models/block";
3
- import { TransactionModel } from "./models/transactionModel";
4
- import { Program, RecordPlaintext, PrivateKey, Transaction } from "./wasm";
5
- type ProgramImports = {
6
- [key: string]: string | Program;
7
- };
8
- interface AleoNetworkClientOptions {
9
- headers?: {
10
- [key: string]: string;
11
- };
12
- }
13
- /**
14
- * Client library that encapsulates REST calls to publicly exposed endpoints of Aleo nodes. The methods provided in this
15
- * allow users to query public information from the Aleo blockchain and submit transactions to the network.
16
- *
17
- * @param {string} host
18
- * @example
19
- * // Connection to a local node
20
- * const localNetworkClient = new AleoNetworkClient("http://localhost:3030");
21
- *
22
- * // Connection to a public beacon node
23
- * const publicnetworkClient = new AleoNetworkClient("https://api.explorer.provable.com/v1");
24
- */
25
- declare class AleoNetworkClient {
26
- host: string;
27
- headers: {
28
- [key: string]: string;
29
- };
30
- account: Account | undefined;
31
- constructor(host: string, options?: AleoNetworkClientOptions);
32
- /**
33
- * Set an account to use in networkClient calls
34
- *
35
- * @param {Account} account
36
- * @example
37
- * const account = new Account();
38
- * networkClient.setAccount(account);
39
- */
40
- setAccount(account: Account): void;
41
- /**
42
- * Return the Aleo account used in the networkClient
43
- *
44
- * @example
45
- * const account = networkClient.getAccount();
46
- */
47
- getAccount(): Account | undefined;
48
- /**
49
- * Set a new host for the networkClient
50
- *
51
- * @param {string} host The address of a node hosting the Aleo API
52
- * @param host
53
- */
54
- setHost(host: string): void;
55
- fetchData<Type>(url?: string): Promise<Type>;
56
- /**
57
- * Attempts to find unspent records in the Aleo blockchain for a specified private key
58
- * @param {number} startHeight - The height at which to start searching for unspent records
59
- * @param {number} endHeight - The height at which to stop searching for unspent records
60
- * @param {string | PrivateKey} privateKey - The private key to use to find unspent records
61
- * @param {number[]} amounts - The amounts (in microcredits) to search for (eg. [100, 200, 3000])
62
- * @param {number} maxMicrocredits - The maximum number of microcredits to search for
63
- * @param {string[]} nonces - The nonces of already found records to exclude from the search
64
- *
65
- * @example
66
- * // Find all unspent records
67
- * const privateKey = "[PRIVATE_KEY]";
68
- * const records = networkClient.findUnspentRecords(0, undefined, privateKey);
69
- *
70
- * // Find specific amounts
71
- * const startHeight = 500000;
72
- * const amounts = [600000, 1000000];
73
- * const records = networkClient.findUnspentRecords(startHeight, undefined, privateKey, amounts);
74
- *
75
- * // Find specific amounts with a maximum number of cumulative microcredits
76
- * const maxMicrocredits = 100000;
77
- * const records = networkClient.findUnspentRecords(startHeight, undefined, privateKey, undefined, maxMicrocredits);
78
- */
79
- findUnspentRecords(startHeight: number, endHeight: number | undefined, privateKey: string | PrivateKey | undefined, amounts: number[] | undefined, maxMicrocredits?: number | undefined, nonces?: string[] | undefined): Promise<Array<RecordPlaintext>>;
80
- /**
81
- * Returns the contents of the block at the specified block height
82
- *
83
- * @param {number} height
84
- * @example
85
- * const block = networkClient.getBlock(1234);
86
- */
87
- getBlock(height: number): Promise<Block>;
88
- /**
89
- * Returns a range of blocks between the specified block heights
90
- *
91
- * @param {number} start
92
- * @param {number} end
93
- * @example
94
- * const blockRange = networkClient.getBlockRange(2050, 2100);
95
- */
96
- getBlockRange(start: number, end: number): Promise<Array<Block>>;
97
- /**
98
- * Returns the deployment transaction id associated with the specified program
99
- *
100
- * @param {Program | string} program
101
- * @returns {TransactionModel}
102
- */
103
- getDeploymentTransactionIDForProgram(program: Program | string): Promise<string>;
104
- /**
105
- * Returns the deployment transaction associated with a specified program
106
- *
107
- * @param {Program | string} program
108
- * @returns {TransactionModel}
109
- */
110
- getDeploymentTransactionForProgram(program: Program | string): Promise<TransactionModel>;
111
- /**
112
- * Returns the contents of the latest block
113
- *
114
- * @example
115
- * const latestHeight = networkClient.getLatestBlock();
116
- */
117
- getLatestBlock(): Promise<Block>;
118
- /**
119
- * Returns the latest committee
120
- *
121
- * @returns {Promise<object>} A javascript object containing the latest committee
122
- */
123
- getLatestCommittee(): Promise<object>;
124
- /**
125
- * Returns the latest block height
126
- *
127
- * @example
128
- * const latestHeight = networkClient.getLatestHeight();
129
- */
130
- getLatestHeight(): Promise<number>;
131
- /**
132
- * Returns the source code of a program given a program ID
133
- *
134
- * @param {string} programId The program ID of a program deployed to the Aleo Network
135
- * @return {Promise<string>} Source code of the program
136
- *
137
- * @example
138
- * const program = networkClient.getProgram("hello_hello.aleo");
139
- * const expectedSource = "program hello_hello.aleo;\n\nfunction hello:\n input r0 as u32.public;\n input r1 as u32.private;\n add r0 r1 into r2;\n output r2 as u32.private;\n"
140
- * assert.equal(program, expectedSource);
141
- */
142
- getProgram(programId: string): Promise<string>;
143
- /**
144
- * Returns a program object from a program ID or program source code
145
- *
146
- * @param {string} inputProgram The program ID or program source code of a program deployed to the Aleo Network
147
- * @return {Promise<Program>} Source code of the program
148
- *
149
- * @example
150
- * const programID = "hello_hello.aleo";
151
- * const programSource = "program hello_hello.aleo;\n\nfunction hello:\n input r0 as u32.public;\n input r1 as u32.private;\n add r0 r1 into r2;\n output r2 as u32.private;\n"
152
- *
153
- * // Get program object from program ID or program source code
154
- * const programObjectFromID = await networkClient.getProgramObject(programID);
155
- * const programObjectFromSource = await networkClient.getProgramObject(programSource);
156
- *
157
- * // Both program objects should be equal
158
- * assert.equal(programObjectFromID.to_string(), programObjectFromSource.to_string());
159
- */
160
- getProgramObject(inputProgram: string): Promise<Program>;
161
- /**
162
- * Returns an object containing the source code of a program and the source code of all programs it imports
163
- *
164
- * @param {Program | string} inputProgram The program ID or program source code of a program deployed to the Aleo Network
165
- * @returns {Promise<ProgramImports>} Object of the form { "program_id": "program_source", .. } containing program id & source code for all program imports
166
- *
167
- * @example
168
- * const double_test_source = "import multiply_test.aleo;\n\nprogram double_test.aleo;\n\nfunction double_it:\n input r0 as u32.private;\n call multiply_test.aleo/multiply 2u32 r0 into r1;\n output r1 as u32.private;\n"
169
- * const double_test = Program.fromString(double_test_source);
170
- * const expectedImports = {
171
- * "multiply_test.aleo": "program multiply_test.aleo;\n\nfunction multiply:\n input r0 as u32.public;\n input r1 as u32.private;\n mul r0 r1 into r2;\n output r2 as u32.private;\n"
172
- * }
173
- *
174
- * // Imports can be fetched using the program ID, source code, or program object
175
- * let programImports = await networkClient.getProgramImports("double_test.aleo");
176
- * assert.deepStrictEqual(programImports, expectedImports);
177
- *
178
- * // Using the program source code
179
- * programImports = await networkClient.getProgramImports(double_test_source);
180
- * assert.deepStrictEqual(programImports, expectedImports);
181
- *
182
- * // Using the program object
183
- * programImports = await networkClient.getProgramImports(double_test);
184
- * assert.deepStrictEqual(programImports, expectedImports);
185
- */
186
- getProgramImports(inputProgram: Program | string): Promise<ProgramImports>;
187
- /**
188
- * Get a list of the program names that a program imports
189
- *
190
- * @param {Program | string} inputProgram - The program id or program source code to get the imports of
191
- * @returns {string[]} - The list of program names that the program imports
192
- *
193
- * @example
194
- * const programImportsNames = networkClient.getProgramImports("double_test.aleo");
195
- * const expectedImportsNames = ["multiply_test.aleo"];
196
- * assert.deepStrictEqual(programImportsNames, expectedImportsNames);
197
- */
198
- getProgramImportNames(inputProgram: Program | string): Promise<string[]>;
199
- /**
200
- * Returns the names of the mappings of a program
201
- *
202
- * @param {string} programId - The program ID to get the mappings of (e.g. "credits.aleo")
203
- * @example
204
- * const mappings = networkClient.getProgramMappingNames("credits.aleo");
205
- * const expectedMappings = ["account"];
206
- * assert.deepStrictEqual(mappings, expectedMappings);
207
- */
208
- getProgramMappingNames(programId: string): Promise<Array<string>>;
209
- /**
210
- * Returns the value of a program's mapping for a specific key
211
- *
212
- * @param {string} programId - The program ID to get the mapping value of (e.g. "credits.aleo")
213
- * @param {string} mappingName - The name of the mapping to get the value of (e.g. "account")
214
- * @param {string} key - The key of the mapping to get the value of (e.g. "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px")
215
- * @return {Promise<string>} String representation of the value of the mapping
216
- *
217
- * @example
218
- * // Get public balance of an account
219
- * const mappingValue = networkClient.getMappingValue("credits.aleo", "account", "aleo1rhgdu77hgyqd3xjj8ucu3jj9r2krwz6mnzyd80gncr5fxcwlh5rsvzp9px");
220
- * const expectedValue = "0u64";
221
- * assert.equal(mappingValue, expectedValue);
222
- */
223
- getProgramMappingValue(programId: string, mappingName: string, key: string): Promise<string>;
224
- /**
225
- * Returns the latest state/merkle root of the Aleo blockchain
226
- *
227
- * @example
228
- * const stateRoot = networkClient.getStateRoot();
229
- */
230
- getStateRoot(): Promise<string>;
231
- /**
232
- * Returns a transaction by its unique identifier
233
- *
234
- * @param {string} id
235
- * @example
236
- * const transaction = networkClient.getTransaction("at1handz9xjrqeynjrr0xay4pcsgtnczdksz3e584vfsgaz0dh0lyxq43a4wj");
237
- */
238
- getTransaction(id: string): Promise<TransactionModel>;
239
- /**
240
- * Returns the transactions present at the specified block height
241
- *
242
- * @param {number} height
243
- * @example
244
- * const transactions = networkClient.getTransactions(654);
245
- */
246
- getTransactions(height: number): Promise<Array<TransactionModel>>;
247
- /**
248
- * Returns the transactions in the memory pool.
249
- *
250
- * @example
251
- * const transactions = networkClient.getTransactionsInMempool();
252
- */
253
- getTransactionsInMempool(): Promise<Array<TransactionModel>>;
254
- /**
255
- * Returns the transition ID of the transition corresponding to the ID of the input or output.
256
- * @param {string} inputOrOutputID - ID of the input or output.
257
- *
258
- * @example
259
- * const transitionId = networkClient.getTransitionId("2429232855236830926144356377868449890830704336664550203176918782554219952323field");
260
- */
261
- getTransitionId(inputOrOutputID: string): Promise<string>;
262
- /**
263
- * Submit an execute or deployment transaction to the Aleo network
264
- *
265
- * @param {Transaction | string} transaction - The transaction to submit to the network
266
- * @returns {string} - The transaction id of the submitted transaction or the resulting error
267
- */
268
- submitTransaction(transaction: Transaction | string): Promise<string>;
269
- }
270
- export { AleoNetworkClient, AleoNetworkClientOptions, ProgramImports };
@@ -1,5 +0,0 @@
1
- import "./polyfill/shared";
2
- import "./polyfill/crypto";
3
- import "./polyfill/fetch";
4
- import "./polyfill/xmlhttprequest";
5
- import "./polyfill/worker";
@@ -1,303 +0,0 @@
1
- import 'core-js/proposals/json-parse-with-source.js';
2
- import { webcrypto } from 'node:crypto';
3
- import * as $fs from 'node:fs';
4
- import $mime from 'mime/lite.js';
5
- import $request from 'sync-request';
6
- import * as $worker from 'node:worker_threads';
7
- import * as $os from 'node:os';
8
-
9
- if (globalThis.crypto == null) {
10
- globalThis.crypto = webcrypto;
11
- }
12
-
13
- const oldFetch = globalThis.fetch;
14
- // We always polyfill fetch because Node's fetch doesn't support file URLs.
15
- globalThis.fetch = async function (resource, options) {
16
- const request = new Request(resource, options);
17
- const url = new URL(request.url);
18
- if (url.protocol === "file:") {
19
- const readStream = $fs.createReadStream(url);
20
- const headers = {};
21
- const type = $mime.getType(url.pathname);
22
- if (type) {
23
- headers["Content-Type"] = type;
24
- }
25
- return new Response(readStream, {
26
- status: 200,
27
- statusText: "OK",
28
- headers,
29
- });
30
- }
31
- else {
32
- return await oldFetch(request);
33
- }
34
- };
35
-
36
- globalThis.XMLHttpRequest = class extends EventTarget {
37
- static UNSENT = 0;
38
- static OPENED = 1;
39
- static HEADERS_RECEIVED = 2;
40
- static LOADING = 3;
41
- static DONE = 4;
42
- UNSENT = XMLHttpRequest.UNSENT;
43
- OPENED = XMLHttpRequest.OPENED;
44
- HEADERS_RECEIVED = XMLHttpRequest.HEADERS_RECEIVED;
45
- LOADING = XMLHttpRequest.LOADING;
46
- DONE = XMLHttpRequest.DONE;
47
- responseType;
48
- withCredentials;
49
- timeout;
50
- readyState;
51
- response;
52
- responseText;
53
- responseURL;
54
- responseXML;
55
- status;
56
- statusText;
57
- upload;
58
- _url;
59
- _mime;
60
- constructor() {
61
- super();
62
- this._reset();
63
- this._mime = "text/xml";
64
- }
65
- _reset() {
66
- this.readyState = XMLHttpRequest.UNSENT;
67
- this.response = null;
68
- this.responseText = "";
69
- this.responseType = "";
70
- this.responseURL = "";
71
- this.responseXML = null;
72
- this.status = 0;
73
- this.statusText = "";
74
- this.timeout = 0;
75
- this.upload = null;
76
- this.withCredentials = false;
77
- this._url = null;
78
- }
79
- _success() {
80
- this.readyState = XMLHttpRequest.DONE;
81
- this.status = 200;
82
- this.statusText = "OK";
83
- }
84
- set onabort(value) {
85
- throw new Error("Not implemented");
86
- }
87
- set onerror(value) {
88
- throw new Error("Not implemented");
89
- }
90
- set onreadystatechange(value) {
91
- throw new Error("Not implemented");
92
- }
93
- set onloadstart(value) {
94
- throw new Error("Not implemented");
95
- }
96
- set onload(value) {
97
- throw new Error("Not implemented");
98
- }
99
- set onloadend(value) {
100
- throw new Error("Not implemented");
101
- }
102
- set onprogress(value) {
103
- throw new Error("Not implemented");
104
- }
105
- set ontimeout(value) {
106
- throw new Error("Not implemented");
107
- }
108
- abort() {
109
- throw new Error("Not implemented");
110
- }
111
- overrideMimeType(mime) {
112
- this._mime = mime;
113
- }
114
- getResponseHeader() {
115
- throw new Error("Not implemented");
116
- }
117
- getAllResponseHeaders() {
118
- throw new Error("Not implemented");
119
- }
120
- setRequestHeader() {
121
- throw new Error("Not implemented");
122
- }
123
- open(method, url, async = true, username, password) {
124
- if (async) {
125
- throw new Error("Async XMLHttpRequest is not implemented yet");
126
- }
127
- if (method !== "GET") {
128
- throw new Error("Non-GET requests are not implemented yet");
129
- }
130
- this._reset();
131
- this._url = url;
132
- }
133
- send(body = null) {
134
- if (body !== null) {
135
- throw new Error("XMLHttpRequest send body is not implemented yet");
136
- }
137
- if (!this._url) {
138
- throw new Error("You must call open before you call send");
139
- }
140
- const response = $request("GET", this._url, {
141
- headers: {
142
- "Content-Type": this._mime,
143
- }
144
- });
145
- const buffer = response.body.buffer;
146
- const responseText = new TextDecoder("iso-8859-5", { fatal: true }).decode(buffer);
147
- this.response = this.responseText = responseText;
148
- this._url = null;
149
- this._success();
150
- }
151
- };
152
-
153
- // This is technically not a part of the Worker polyfill,
154
- // but Workers are used for multi-threading, so this is often
155
- // needed when writing Worker code.
156
- if (globalThis.navigator == null) {
157
- globalThis.navigator = {
158
- hardwareConcurrency: $os.cpus().length,
159
- };
160
- }
161
- globalThis.Worker = class Worker extends EventTarget {
162
- _worker;
163
- constructor(url, options) {
164
- super();
165
- if (url instanceof URL) {
166
- if (url.protocol !== "file:") {
167
- throw new Error("Worker only supports file: URLs");
168
- }
169
- url = url.href;
170
- }
171
- else {
172
- throw new Error("Filepaths are unreliable, use `new URL(\"...\", import.meta.url)` instead.");
173
- }
174
- if (!options || options.type !== "module") {
175
- throw new Error("Workers must use \`type: \"module\"\`");
176
- }
177
- const code = `
178
- const { workerData } = require("node:worker_threads");
179
-
180
- import(workerData.polyfill)
181
- .then(() => import(workerData.url))
182
- .catch((e) => {
183
- // TODO maybe it should send a message to the parent?
184
- console.error(e.stack);
185
- });
186
- `;
187
- this._worker = new $worker.Worker(code, {
188
- eval: true,
189
- workerData: {
190
- url,
191
- polyfill: new URL("node-polyfill.js", import.meta.url).href,
192
- },
193
- });
194
- this._worker.on("message", (data) => {
195
- this.dispatchEvent(new MessageEvent("message", { data }));
196
- });
197
- this._worker.on("messageerror", (error) => {
198
- throw new Error("UNIMPLEMENTED");
199
- });
200
- this._worker.on("error", (error) => {
201
- // TODO attach the error to the event somehow
202
- const event = new Event("error");
203
- this.dispatchEvent(event);
204
- });
205
- }
206
- set onmessage(f) {
207
- throw new Error("UNIMPLEMENTED");
208
- }
209
- set onmessageerror(f) {
210
- throw new Error("UNIMPLEMENTED");
211
- }
212
- set onerror(f) {
213
- throw new Error("UNIMPLEMENTED");
214
- }
215
- postMessage(value, transfer) {
216
- this._worker.postMessage(value, transfer);
217
- }
218
- terminate() {
219
- this._worker.terminate();
220
- }
221
- // This is Node-specific, it allows the process to exit
222
- // even if the Worker is still running.
223
- unref() {
224
- this._worker.unref();
225
- }
226
- };
227
- if (!$worker.isMainThread) {
228
- const globals = globalThis;
229
- // This is used to create the onmessage, onmessageerror, and onerror setters
230
- const makeSetter = (prop, event) => {
231
- let oldvalue;
232
- Object.defineProperty(globals, prop, {
233
- get() {
234
- return oldvalue;
235
- },
236
- set(value) {
237
- if (oldvalue) {
238
- globals.removeEventListener(event, oldvalue);
239
- }
240
- oldvalue = value;
241
- if (oldvalue) {
242
- globals.addEventListener(event, oldvalue);
243
- }
244
- },
245
- });
246
- };
247
- // This makes sure that `f` is only run once
248
- const memoize = (f) => {
249
- let run = false;
250
- return () => {
251
- if (!run) {
252
- run = true;
253
- f();
254
- }
255
- };
256
- };
257
- // We only start listening for messages / errors when the worker calls addEventListener
258
- const startOnMessage = memoize(() => {
259
- $worker.parentPort.on("message", (data) => {
260
- workerEvents.dispatchEvent(new MessageEvent("message", { data }));
261
- });
262
- });
263
- const startOnMessageError = memoize(() => {
264
- throw new Error("UNIMPLEMENTED");
265
- });
266
- const startOnError = memoize(() => {
267
- $worker.parentPort.on("error", (data) => {
268
- workerEvents.dispatchEvent(new Event("error"));
269
- });
270
- });
271
- // Node workers don't have top-level events, so we have to make our own
272
- const workerEvents = new EventTarget();
273
- globals.close = () => {
274
- process.exit();
275
- };
276
- globals.addEventListener = (type, callback, options) => {
277
- workerEvents.addEventListener(type, callback, options);
278
- if (type === "message") {
279
- startOnMessage();
280
- }
281
- else if (type === "messageerror") {
282
- startOnMessageError();
283
- }
284
- else if (type === "error") {
285
- startOnError();
286
- }
287
- };
288
- globals.removeEventListener = (type, callback, options) => {
289
- workerEvents.removeEventListener(type, callback, options);
290
- };
291
- function postMessage(value, transfer) {
292
- $worker.parentPort.postMessage(value, transfer);
293
- }
294
- globals.postMessage = postMessage;
295
- makeSetter("onmessage", "message");
296
- makeSetter("onmessageerror", "messageerror");
297
- makeSetter("onerror", "error");
298
- }
299
-
300
- if (!globalThis.self) {
301
- globalThis.self = globalThis;
302
- }
303
- //# sourceMappingURL=node-polyfill.js.map
@@ -1 +0,0 @@
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,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,IAAI,EAAE;AACN,YAAA,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;SAClC;AAED,QAAA,OAAO,IAAI,QAAQ,CAAC,UAAiB,EAAE;AACnC,YAAA,MAAM,EAAE,GAAG;AACX,YAAA,UAAU,EAAE,IAAI;YAChB,OAAO;AACV,SAAA,CAAC,CAAC;KAEN;SAAM;AACH,QAAA,OAAO,MAAM,Q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AAC,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;;ACrLA,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;AACjB,IAAA,UAAkB,CAAC,IAAI,GAAG,UAAU,CAAC;AAC1C"}
@@ -1,2 +0,0 @@
1
- import "./node-polyfill";
2
- export * from "./browser";
@@ -1,13 +0,0 @@
1
- import './node-polyfill.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-97ade0e6.js';
4
- 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/testnet.js';
5
- import 'core-js/proposals/json-parse-with-source.js';
6
- import 'node:crypto';
7
- import 'node:fs';
8
- import 'mime/lite.js';
9
- import 'sync-request';
10
- import 'node:worker_threads';
11
- import 'node:os';
12
- import 'comlink';
13
- //# sourceMappingURL=node.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"node.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}