@provablehq/sdk 0.6.9
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/README.md +1172 -0
- package/dist/account.d.ts +137 -0
- package/dist/function-key-provider.d.ts +336 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +3049 -0
- package/dist/index.js.map +1 -0
- package/dist/managed-worker.d.ts +3 -0
- package/dist/models/block.d.ts +21 -0
- package/dist/models/confirmed_transaction.d.ts +6 -0
- package/dist/models/execution.d.ts +5 -0
- package/dist/models/input.d.ts +10 -0
- package/dist/models/output.d.ts +6 -0
- package/dist/models/transactionModel.d.ts +6 -0
- package/dist/models/transition.d.ts +13 -0
- package/dist/network-client.d.ts +267 -0
- package/dist/node-polyfill.d.ts +4 -0
- package/dist/node-polyfill.js +302 -0
- package/dist/node-polyfill.js.map +1 -0
- package/dist/node.d.ts +2 -0
- package/dist/node.js +11 -0
- package/dist/node.js.map +1 -0
- package/dist/offline-key-provider.d.ts +347 -0
- package/dist/polyfill/crypto.d.ts +1 -0
- package/dist/polyfill/fetch.d.ts +1 -0
- package/dist/polyfill/worker.d.ts +1 -0
- package/dist/polyfill/xmlhttprequest.d.ts +1 -0
- package/dist/program-manager.d.ts +639 -0
- package/dist/record-provider.d.ts +236 -0
- package/dist/utils.d.ts +2 -0
- package/dist/worker.d.ts +8 -0
- package/dist/worker.js +74 -0
- package/dist/worker.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +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/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;AAC1C;;ACAD,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;AAEzC,QAAA,IAAI,IAAI,EAAE;AACN,YAAA,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;AAClC,SAAA;AAED,QAAA,OAAO,IAAI,QAAQ,CAAC,UAAiB,EAAE;AACnC,YAAA,MAAM,EAAE,GAAG;AACX,YAAA,UAAU,EAAE,IAAI;YAChB,OAAO;AACV,SAAA,CAAC,CAAC;AAEN,KAAA;AAAM,SAAA;AACH,QAAA,OAAO,MAAM,QAAQ,CAAC,OAAO,CAAC,CAAC;AAClC,KAAA;AACL,CAAC;;AC7BD,UAAU,CAAC,cAAc,GAAG,cAAc,WAAW,CAAA;AAC1C,IAAA,OAAgB,MAAM,GAAG,CAAC,CAAC;AAC3B,IAAA,OAAgB,M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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;AAClC;;ACtLD,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;AACjB,IAAA,UAAkB,CAAC,IAAI,GAAG,UAAU,CAAC;AACzC"}
|
package/dist/node.d.ts
ADDED
package/dist/node.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
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 './index.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';
|
|
4
|
+
import 'node:crypto';
|
|
5
|
+
import 'node:fs';
|
|
6
|
+
import 'mime/lite.js';
|
|
7
|
+
import 'sync-request';
|
|
8
|
+
import 'node:worker_threads';
|
|
9
|
+
import 'node:os';
|
|
10
|
+
import 'comlink';
|
|
11
|
+
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
import { FunctionKeyProvider, KeySearchParams, FunctionKeyPair, CachedKeyPair, ProvingKey, VerifyingKey } from "./index";
|
|
2
|
+
/**
|
|
3
|
+
* Search parameters for the offline key provider. This class implements the KeySearchParams interface and includes
|
|
4
|
+
* a convenience method for creating a new instance of this class for each function of the credits.aleo program.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* // If storing a key for a custom program function
|
|
8
|
+
* offlineSearchParams = new OfflineSearchParams("myprogram.aleo/myfunction");
|
|
9
|
+
*
|
|
10
|
+
* // If storing a key for a credits.aleo program function
|
|
11
|
+
* bondPublicKeyParams = OfflineSearchParams.bondPublicKeyParams();
|
|
12
|
+
*/
|
|
13
|
+
declare class OfflineSearchParams implements KeySearchParams {
|
|
14
|
+
cacheKey: string | undefined;
|
|
15
|
+
verifyCreditsKeys: boolean | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Create a new OfflineSearchParams instance.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} cacheKey - Key used to store the local function proving & verifying keys. This should be stored
|
|
20
|
+
* under the naming convention "programName/functionName" (i.e. "myprogram.aleo/myfunction")
|
|
21
|
+
* @param {boolean} verifyCreditsKeys - Whether to verify the keys against the credits.aleo program,
|
|
22
|
+
* defaults to false, but should be set to true if using keys from the credits.aleo program
|
|
23
|
+
*/
|
|
24
|
+
constructor(cacheKey: string, verifyCreditsKeys?: boolean);
|
|
25
|
+
/**
|
|
26
|
+
* Create a new OfflineSearchParams instance for the bond_public function of the credits.aleo program.
|
|
27
|
+
*/
|
|
28
|
+
static bondPublicKeyParams(): OfflineSearchParams;
|
|
29
|
+
/**
|
|
30
|
+
* Create a new OfflineSearchParams instance for the bond_validator function of the credits.aleo program.
|
|
31
|
+
*/
|
|
32
|
+
static bondValidatorKeyParams(): OfflineSearchParams;
|
|
33
|
+
/**
|
|
34
|
+
* Create a new OfflineSearchParams instance for the claim_unbond_public function of the
|
|
35
|
+
*/
|
|
36
|
+
static claimUnbondPublicKeyParams(): OfflineSearchParams;
|
|
37
|
+
/**
|
|
38
|
+
* Create a new OfflineSearchParams instance for the fee_private function of the credits.aleo program.
|
|
39
|
+
*/
|
|
40
|
+
static feePrivateKeyParams(): OfflineSearchParams;
|
|
41
|
+
/**
|
|
42
|
+
* Create a new OfflineSearchParams instance for the fee_public function of the credits.aleo program.
|
|
43
|
+
*/
|
|
44
|
+
static feePublicKeyParams(): OfflineSearchParams;
|
|
45
|
+
/**
|
|
46
|
+
* Create a new OfflineSearchParams instance for the inclusion prover function.
|
|
47
|
+
*/
|
|
48
|
+
static inclusionKeyParams(): OfflineSearchParams;
|
|
49
|
+
/**
|
|
50
|
+
* Create a new OfflineSearchParams instance for the join function of the credits.aleo program.
|
|
51
|
+
*/
|
|
52
|
+
static joinKeyParams(): OfflineSearchParams;
|
|
53
|
+
/**
|
|
54
|
+
* Create a new OfflineSearchParams instance for the set_validator_state function of the credits.aleo program.
|
|
55
|
+
*/
|
|
56
|
+
static setValidatorStateKeyParams(): OfflineSearchParams;
|
|
57
|
+
/**
|
|
58
|
+
* Create a new OfflineSearchParams instance for the split function of the credits.aleo program.
|
|
59
|
+
*/
|
|
60
|
+
static splitKeyParams(): OfflineSearchParams;
|
|
61
|
+
/**
|
|
62
|
+
* Create a new OfflineSearchParams instance for the transfer_private function of the credits.aleo program.
|
|
63
|
+
*/
|
|
64
|
+
static transferPrivateKeyParams(): OfflineSearchParams;
|
|
65
|
+
/**
|
|
66
|
+
* Create a new OfflineSearchParams instance for the transfer_private_to_public function of the credits.aleo program.
|
|
67
|
+
*/
|
|
68
|
+
static transferPrivateToPublicKeyParams(): OfflineSearchParams;
|
|
69
|
+
/**
|
|
70
|
+
* Create a new OfflineSearchParams instance for the transfer_public function of the credits.aleo program.
|
|
71
|
+
*/
|
|
72
|
+
static transferPublicKeyParams(): OfflineSearchParams;
|
|
73
|
+
/**
|
|
74
|
+
* Create a new OfflineSearchParams instance for the transfer_public_as_signer function of the credits.aleo program.
|
|
75
|
+
*/
|
|
76
|
+
static transferPublicAsSignerKeyParams(): OfflineSearchParams;
|
|
77
|
+
/**
|
|
78
|
+
* Create a new OfflineSearchParams instance for the transfer_public_to_private function of the credits.aleo program.
|
|
79
|
+
*/
|
|
80
|
+
static transferPublicToPrivateKeyParams(): OfflineSearchParams;
|
|
81
|
+
/**
|
|
82
|
+
* Create a new OfflineSearchParams instance for the unbond_public function of the credits.aleo program.
|
|
83
|
+
*/
|
|
84
|
+
static unbondPublicKeyParams(): OfflineSearchParams;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A key provider meant for building transactions offline on devices such as hardware wallets. This key provider is not
|
|
88
|
+
* able to contact the internet for key material and instead relies on the user to insert Aleo function proving &
|
|
89
|
+
* verifying keys from local storage prior to usage.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* // Create an offline program manager
|
|
93
|
+
* const programManager = new ProgramManager();
|
|
94
|
+
*
|
|
95
|
+
* // Create a temporary account for the execution of the program
|
|
96
|
+
* const account = new Account();
|
|
97
|
+
* programManager.setAccount(account);
|
|
98
|
+
*
|
|
99
|
+
* // Create the proving keys from the key bytes on the offline machine
|
|
100
|
+
* console.log("Creating proving keys from local key files");
|
|
101
|
+
* const program = "program hello_hello.aleo; function hello: input r0 as u32.public; input r1 as u32.private; add r0 r1 into r2; output r2 as u32.private;";
|
|
102
|
+
* const myFunctionProver = await getLocalKey("/path/to/my/function/hello_hello.prover");
|
|
103
|
+
* const myFunctionVerifier = await getLocalKey("/path/to/my/function/hello_hello.verifier");
|
|
104
|
+
* const feePublicProvingKeyBytes = await getLocalKey("/path/to/credits.aleo/feePublic.prover");
|
|
105
|
+
*
|
|
106
|
+
* myFunctionProvingKey = ProvingKey.fromBytes(myFunctionProver);
|
|
107
|
+
* myFunctionVerifyingKey = VerifyingKey.fromBytes(myFunctionVerifier);
|
|
108
|
+
* const feePublicProvingKey = ProvingKey.fromBytes(feePublicKeyBytes);
|
|
109
|
+
*
|
|
110
|
+
* // Create an offline key provider
|
|
111
|
+
* console.log("Creating offline key provider");
|
|
112
|
+
* const offlineKeyProvider = new OfflineKeyProvider();
|
|
113
|
+
*
|
|
114
|
+
* // Cache the keys
|
|
115
|
+
* // Cache the proving and verifying keys for the custom hello function
|
|
116
|
+
* OfflineKeyProvider.cacheKeys("hello_hello.aleo/hello", myFunctionProvingKey, myFunctionVerifyingKey);
|
|
117
|
+
*
|
|
118
|
+
* // Cache the proving key for the fee_public function (the verifying key is automatically cached)
|
|
119
|
+
* OfflineKeyProvider.insertFeePublicKey(feePublicProvingKey);
|
|
120
|
+
*
|
|
121
|
+
* // Create an offline query using the latest state root in order to create the inclusion proof
|
|
122
|
+
* const offlineQuery = new OfflineQuery("latestStateRoot");
|
|
123
|
+
*
|
|
124
|
+
* // Insert the key provider into the program manager
|
|
125
|
+
* programManager.setKeyProvider(offlineKeyProvider);
|
|
126
|
+
*
|
|
127
|
+
* // Create the offline search params
|
|
128
|
+
* const offlineSearchParams = new OfflineSearchParams("hello_hello.aleo/hello");
|
|
129
|
+
*
|
|
130
|
+
* // Create the offline transaction
|
|
131
|
+
* const offlineExecuteTx = <Transaction>await this.buildExecutionTransaction("hello_hello.aleo", "hello", 1, false, ["5u32", "5u32"], undefined, offlineSearchParams, undefined, undefined, undefined, undefined, offlineQuery, program);
|
|
132
|
+
*
|
|
133
|
+
* // Broadcast the transaction later on a machine with internet access
|
|
134
|
+
* const networkClient = new AleoNetworkClient("https://api.explorer.aleo.org/v1");
|
|
135
|
+
* const txId = await networkClient.broadcastTransaction(offlineExecuteTx);
|
|
136
|
+
*/
|
|
137
|
+
declare class OfflineKeyProvider implements FunctionKeyProvider {
|
|
138
|
+
cache: Map<string, CachedKeyPair>;
|
|
139
|
+
constructor();
|
|
140
|
+
/**
|
|
141
|
+
* Get bond_public function keys from the credits.aleo program. The keys must be cached prior to calling this
|
|
142
|
+
* method for it to work.
|
|
143
|
+
*
|
|
144
|
+
* @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the bond_public function
|
|
145
|
+
*/
|
|
146
|
+
bondPublicKeys(): Promise<FunctionKeyPair | Error>;
|
|
147
|
+
/**
|
|
148
|
+
* Get bond_validator function keys from the credits.aleo program. The keys must be cached prior to calling this
|
|
149
|
+
* method for it to work.
|
|
150
|
+
*
|
|
151
|
+
* @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the bond_public function
|
|
152
|
+
*/
|
|
153
|
+
bondValidatorKeys(): Promise<FunctionKeyPair | Error>;
|
|
154
|
+
/**
|
|
155
|
+
* Cache a set of keys. This will overwrite any existing keys with the same keyId. The user can check if a keyId
|
|
156
|
+
* exists in the cache using the containsKeys method prior to calling this method if overwriting is not desired.
|
|
157
|
+
*
|
|
158
|
+
* @param {string} keyId access key for the cache
|
|
159
|
+
* @param {FunctionKeyPair} keys keys to cache
|
|
160
|
+
*/
|
|
161
|
+
cacheKeys(keyId: string, keys: FunctionKeyPair): void;
|
|
162
|
+
/**
|
|
163
|
+
* Get unbond_public function keys from the credits.aleo program. The keys must be cached prior to calling this
|
|
164
|
+
* method for it to work.
|
|
165
|
+
*
|
|
166
|
+
* @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the unbond_public function
|
|
167
|
+
*/
|
|
168
|
+
claimUnbondPublicKeys(): Promise<FunctionKeyPair | Error>;
|
|
169
|
+
/**
|
|
170
|
+
* Get arbitrary function key from the offline key provider cache.
|
|
171
|
+
*
|
|
172
|
+
* @param {KeySearchParams | undefined} params - Optional search parameters for the key provider
|
|
173
|
+
* @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the specified program
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* /// First cache the keys from local offline resources
|
|
177
|
+
* const offlineKeyProvider = new OfflineKeyProvider();
|
|
178
|
+
* const myFunctionVerifyingKey = VerifyingKey.fromString("verifier...");
|
|
179
|
+
* const myFunctionProvingKeyBytes = await readBinaryFile('./resources/myfunction.prover');
|
|
180
|
+
* const myFunctionProvingKey = ProvingKey.fromBytes(myFunctionProvingKeyBytes);
|
|
181
|
+
*
|
|
182
|
+
* /// Cache the keys for future use with a memorable locator
|
|
183
|
+
* offlineKeyProvider.cacheKeys("myprogram.aleo/myfunction", [myFunctionProvingKey, myFunctionVerifyingKey]);
|
|
184
|
+
*
|
|
185
|
+
* /// When they're needed, retrieve the keys from the cache
|
|
186
|
+
*
|
|
187
|
+
* /// First create a search parameter object with the same locator used to cache the keys
|
|
188
|
+
* const keyParams = new OfflineSearchParams("myprogram.aleo/myfunction");
|
|
189
|
+
*
|
|
190
|
+
* /// Then retrieve the keys
|
|
191
|
+
* const [myFunctionProver, myFunctionVerifier] = await offlineKeyProvider.functionKeys(keyParams);
|
|
192
|
+
*/
|
|
193
|
+
functionKeys(params?: KeySearchParams): Promise<FunctionKeyPair | Error>;
|
|
194
|
+
/**
|
|
195
|
+
* Determines if the keys for a given credits function match the expected keys.
|
|
196
|
+
*
|
|
197
|
+
* @returns {boolean} Whether the keys match the expected keys
|
|
198
|
+
*/
|
|
199
|
+
verifyCreditsKeys(locator: string, provingKey: ProvingKey, verifyingKey: VerifyingKey): boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Get fee_private function keys from the credits.aleo program. The keys must be cached prior to calling this
|
|
202
|
+
* method for it to work.
|
|
203
|
+
*
|
|
204
|
+
* @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the join function
|
|
205
|
+
*/
|
|
206
|
+
feePrivateKeys(): Promise<FunctionKeyPair | Error>;
|
|
207
|
+
/**
|
|
208
|
+
* Get fee_public function keys from the credits.aleo program. The keys must be cached prior to calling this
|
|
209
|
+
* method for it to work.
|
|
210
|
+
*
|
|
211
|
+
* @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the join function
|
|
212
|
+
*/
|
|
213
|
+
feePublicKeys(): Promise<FunctionKeyPair | Error>;
|
|
214
|
+
/**
|
|
215
|
+
* Get join function keys from the credits.aleo program. The keys must be cached prior to calling this
|
|
216
|
+
* method for it to work.
|
|
217
|
+
*
|
|
218
|
+
* @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the join function
|
|
219
|
+
*/
|
|
220
|
+
joinKeys(): Promise<FunctionKeyPair | Error>;
|
|
221
|
+
/**
|
|
222
|
+
* Get split function keys from the credits.aleo program. The keys must be cached prior to calling this
|
|
223
|
+
* method for it to work.
|
|
224
|
+
*
|
|
225
|
+
* @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the join function
|
|
226
|
+
*/
|
|
227
|
+
splitKeys(): Promise<FunctionKeyPair | Error>;
|
|
228
|
+
/**
|
|
229
|
+
* Get keys for a variant of the transfer function from the credits.aleo program.
|
|
230
|
+
*
|
|
231
|
+
*
|
|
232
|
+
* @param {string} visibility Visibility of the transfer function (private, public, privateToPublic, publicToPrivate)
|
|
233
|
+
* @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the specified transfer function
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* // Create a new OfflineKeyProvider
|
|
237
|
+
* const offlineKeyProvider = new OfflineKeyProvider();
|
|
238
|
+
*
|
|
239
|
+
* // Cache the keys for future use with the official locator
|
|
240
|
+
* const transferPublicProvingKeyBytes = await readBinaryFile('./resources/transfer_public.prover.a74565e');
|
|
241
|
+
* const transferPublicProvingKey = ProvingKey.fromBytes(transferPublicProvingKeyBytes);
|
|
242
|
+
*
|
|
243
|
+
* // Cache the transfer_public keys for future use with the OfflinKeyProvider's convenience method for
|
|
244
|
+
* // transfer_public (the verifying key will be cached automatically)
|
|
245
|
+
* offlineKeyProvider.insertTransferPublicKeys(transferPublicProvingKey);
|
|
246
|
+
*
|
|
247
|
+
* /// When they're needed, retrieve the keys from the cache
|
|
248
|
+
* const [transferPublicProvingKey, transferPublicVerifyingKey] = await keyProvider.transferKeys("public");
|
|
249
|
+
*/
|
|
250
|
+
transferKeys(visibility: string): Promise<FunctionKeyPair | Error>;
|
|
251
|
+
/**
|
|
252
|
+
* Get unbond_public function keys from the credits.aleo program
|
|
253
|
+
*
|
|
254
|
+
* @returns {Promise<FunctionKeyPair | Error>} Proving and verifying keys for the join function
|
|
255
|
+
*/
|
|
256
|
+
unBondPublicKeys(): Promise<FunctionKeyPair | Error>;
|
|
257
|
+
/**
|
|
258
|
+
* Insert the proving and verifying keys for the bond_public function into the cache. Only the proving key needs
|
|
259
|
+
* to be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check
|
|
260
|
+
* that the keys match the expected checksum for bond_public before inserting them into the cache.
|
|
261
|
+
*
|
|
262
|
+
* @param provingKey
|
|
263
|
+
*/
|
|
264
|
+
insertBondPublicKeys(provingKey: ProvingKey): void;
|
|
265
|
+
/**
|
|
266
|
+
* Insert the proving and verifying keys for the claim_unbond_public function into the cache. Only the proving key needs
|
|
267
|
+
* to be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check
|
|
268
|
+
* that the keys match the expected checksum for claim_unbond_public before inserting them into the cache.
|
|
269
|
+
*
|
|
270
|
+
* @param provingKey
|
|
271
|
+
*/
|
|
272
|
+
insertClaimUnbondPublicKeys(provingKey: ProvingKey): void;
|
|
273
|
+
/**
|
|
274
|
+
* Insert the proving and verifying keys for the fee_private function into the cache. Only the proving key needs
|
|
275
|
+
* to be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check
|
|
276
|
+
* that the keys match the expected checksum for fee_private before inserting them into the cache.
|
|
277
|
+
*
|
|
278
|
+
* @param provingKey
|
|
279
|
+
*/
|
|
280
|
+
insertFeePrivateKeys(provingKey: ProvingKey): void;
|
|
281
|
+
/**
|
|
282
|
+
* Insert the proving and verifying keys for the fee_public function into the cache. Only the proving key needs
|
|
283
|
+
* to be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check
|
|
284
|
+
* that the keys match the expected checksum for fee_public before inserting them into the cache.
|
|
285
|
+
*
|
|
286
|
+
* @param provingKey
|
|
287
|
+
*/
|
|
288
|
+
insertFeePublicKeys(provingKey: ProvingKey): void;
|
|
289
|
+
/**
|
|
290
|
+
* Insert the proving and verifying keys for the join function into the cache. Only the proving key needs
|
|
291
|
+
* to be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check
|
|
292
|
+
* that the keys match the expected checksum for join before inserting them into the cache.
|
|
293
|
+
*
|
|
294
|
+
* @param provingKey
|
|
295
|
+
*/
|
|
296
|
+
insertJoinKeys(provingKey: ProvingKey): void;
|
|
297
|
+
/**
|
|
298
|
+
* Insert the proving and verifying keys for the set_validator_state function into the cache. Only the proving key needs
|
|
299
|
+
* to be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check
|
|
300
|
+
* that the keys match the expected checksum for set_validator_state before inserting them into the cache.
|
|
301
|
+
*
|
|
302
|
+
* @param provingKey
|
|
303
|
+
*/
|
|
304
|
+
insertSetValidatorStateKeys(provingKey: ProvingKey): void;
|
|
305
|
+
/**
|
|
306
|
+
* Insert the proving and verifying keys for the split function into the cache. Only the proving key needs
|
|
307
|
+
* to be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check
|
|
308
|
+
* that the keys match the expected checksum for split before inserting them into the cache.
|
|
309
|
+
*
|
|
310
|
+
* @param provingKey
|
|
311
|
+
*/
|
|
312
|
+
insertSplitKeys(provingKey: ProvingKey): void;
|
|
313
|
+
/**
|
|
314
|
+
* Insert the proving and verifying keys for the transfer_private function into the cache. Only the proving key needs
|
|
315
|
+
* to be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check
|
|
316
|
+
* that the keys match the expected checksum for transfer_private before inserting them into the cache.
|
|
317
|
+
*
|
|
318
|
+
* @param provingKey
|
|
319
|
+
*/
|
|
320
|
+
insertTransferPrivateKeys(provingKey: ProvingKey): void;
|
|
321
|
+
/**
|
|
322
|
+
* Insert the proving and verifying keys for the transfer_private_to_public function into the cache. Only the proving key needs
|
|
323
|
+
* to be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check
|
|
324
|
+
* that the keys match the expected checksum for transfer_private_to_public before inserting them into the cache.
|
|
325
|
+
*
|
|
326
|
+
* @param provingKey
|
|
327
|
+
*/
|
|
328
|
+
insertTransferPrivateToPublicKeys(provingKey: ProvingKey): void;
|
|
329
|
+
/**
|
|
330
|
+
* Insert the proving and verifying keys for the transfer_public function into the cache. Only the proving key needs
|
|
331
|
+
* to be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check
|
|
332
|
+
* that the keys match the expected checksum for transfer_public before inserting them into the cache.
|
|
333
|
+
*
|
|
334
|
+
* @param provingKey
|
|
335
|
+
*/
|
|
336
|
+
insertTransferPublicKeys(provingKey: ProvingKey): void;
|
|
337
|
+
/**
|
|
338
|
+
* Insert the proving and verifying keys for the transfer_public_to_private function into the cache. Only the proving key needs
|
|
339
|
+
* to be inserted, the verifying key is automatically inserted by the SDK. This function will automatically check
|
|
340
|
+
* that the keys match the expected checksum for transfer_public_to_private before inserting them into the cache.
|
|
341
|
+
*
|
|
342
|
+
* @param provingKey
|
|
343
|
+
*/
|
|
344
|
+
insertTransferPublicToPrivateKeys(provingKey: ProvingKey): void;
|
|
345
|
+
insertUnbondPublicKeys(provingKey: ProvingKey): void;
|
|
346
|
+
}
|
|
347
|
+
export { OfflineKeyProvider, OfflineSearchParams };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|