@provablehq/sdk 0.7.2 → 0.7.4
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 +3 -3
- package/package.json +1 -1
- package/dist/mainnet/account.d.ts +0 -137
- package/dist/mainnet/browser.d.ts +0 -26
- package/dist/mainnet/browser.js +0 -934
- package/dist/mainnet/browser.js.map +0 -1
- package/dist/mainnet/constants.d.ts +0 -34
- package/dist/mainnet/function-key-provider.d.ts +0 -349
- package/dist/mainnet/managed-worker.d.ts +0 -3
- package/dist/mainnet/models/blockJSON.d.ts +0 -21
- package/dist/mainnet/models/confirmed_transaction.d.ts +0 -6
- package/dist/mainnet/models/deploy.d.ts +0 -5
- package/dist/mainnet/models/executionJSON.d.ts +0 -5
- package/dist/mainnet/models/functionObject.d.ts +0 -7
- package/dist/mainnet/models/input/inputJSON.d.ts +0 -13
- package/dist/mainnet/models/input/inputObject.d.ts +0 -15
- package/dist/mainnet/models/output/outputJSON.d.ts +0 -6
- package/dist/mainnet/models/output/outputObject.d.ts +0 -17
- package/dist/mainnet/models/plaintext/array.d.ts +0 -3
- package/dist/mainnet/models/plaintext/literal.d.ts +0 -1
- package/dist/mainnet/models/plaintext/plaintext.d.ts +0 -4
- package/dist/mainnet/models/plaintext/struct.d.ts +0 -5
- package/dist/mainnet/models/transaction/transactionJSON.d.ts +0 -6
- package/dist/mainnet/models/transaction/transactionSummary.d.ts +0 -11
- package/dist/mainnet/models/transition/transitionJSON.d.ts +0 -13
- package/dist/mainnet/models/transition/transitionObject.d.ts +0 -15
- package/dist/mainnet/network-client.d.ts +0 -359
- package/dist/mainnet/node-polyfill.d.ts +0 -5
- package/dist/mainnet/node-polyfill.js +0 -304
- package/dist/mainnet/node-polyfill.js.map +0 -1
- package/dist/mainnet/node.d.ts +0 -2
- package/dist/mainnet/node.js +0 -13
- package/dist/mainnet/node.js.map +0 -1
- package/dist/mainnet/offline-key-provider.d.ts +0 -348
- package/dist/mainnet/polyfill/crypto.d.ts +0 -1
- package/dist/mainnet/polyfill/fetch.d.ts +0 -1
- package/dist/mainnet/polyfill/shared.d.ts +0 -1
- package/dist/mainnet/polyfill/worker.d.ts +0 -1
- package/dist/mainnet/polyfill/xmlhttprequest.d.ts +0 -1
- package/dist/mainnet/program-manager-DAqdrsXx.js +0 -2356
- package/dist/mainnet/program-manager-DAqdrsXx.js.map +0 -1
- package/dist/mainnet/program-manager.d.ts +0 -640
- package/dist/mainnet/record-provider.d.ts +0 -236
- package/dist/mainnet/utils.d.ts +0 -4
- package/dist/mainnet/wasm.d.ts +0 -1
- package/dist/mainnet/worker.d.ts +0 -9
- package/dist/mainnet/worker.js +0 -78
- package/dist/mainnet/worker.js.map +0 -1
- package/dist/testnet/account.d.ts +0 -137
- package/dist/testnet/browser.d.ts +0 -26
- package/dist/testnet/browser.js +0 -934
- package/dist/testnet/browser.js.map +0 -1
- package/dist/testnet/constants.d.ts +0 -34
- package/dist/testnet/function-key-provider.d.ts +0 -349
- package/dist/testnet/managed-worker.d.ts +0 -3
- package/dist/testnet/models/blockJSON.d.ts +0 -21
- package/dist/testnet/models/confirmed_transaction.d.ts +0 -6
- package/dist/testnet/models/deploy.d.ts +0 -5
- package/dist/testnet/models/executionJSON.d.ts +0 -5
- package/dist/testnet/models/functionObject.d.ts +0 -7
- package/dist/testnet/models/input/inputJSON.d.ts +0 -13
- package/dist/testnet/models/input/inputObject.d.ts +0 -15
- package/dist/testnet/models/output/outputJSON.d.ts +0 -6
- package/dist/testnet/models/output/outputObject.d.ts +0 -17
- package/dist/testnet/models/plaintext/array.d.ts +0 -3
- package/dist/testnet/models/plaintext/literal.d.ts +0 -1
- package/dist/testnet/models/plaintext/plaintext.d.ts +0 -4
- package/dist/testnet/models/plaintext/struct.d.ts +0 -5
- package/dist/testnet/models/transaction/transactionJSON.d.ts +0 -6
- package/dist/testnet/models/transaction/transactionSummary.d.ts +0 -11
- package/dist/testnet/models/transition/transitionJSON.d.ts +0 -13
- package/dist/testnet/models/transition/transitionObject.d.ts +0 -15
- package/dist/testnet/network-client.d.ts +0 -359
- package/dist/testnet/node-polyfill.d.ts +0 -5
- package/dist/testnet/node-polyfill.js +0 -304
- package/dist/testnet/node-polyfill.js.map +0 -1
- package/dist/testnet/node.d.ts +0 -2
- package/dist/testnet/node.js +0 -13
- package/dist/testnet/node.js.map +0 -1
- package/dist/testnet/offline-key-provider.d.ts +0 -348
- package/dist/testnet/polyfill/crypto.d.ts +0 -1
- package/dist/testnet/polyfill/fetch.d.ts +0 -1
- package/dist/testnet/polyfill/shared.d.ts +0 -1
- package/dist/testnet/polyfill/worker.d.ts +0 -1
- package/dist/testnet/polyfill/xmlhttprequest.d.ts +0 -1
- package/dist/testnet/program-manager-DWPt87ls.js +0 -2356
- package/dist/testnet/program-manager-DWPt87ls.js.map +0 -1
- package/dist/testnet/program-manager.d.ts +0 -640
- package/dist/testnet/record-provider.d.ts +0 -236
- package/dist/testnet/utils.d.ts +0 -4
- package/dist/testnet/wasm.d.ts +0 -1
- package/dist/testnet/worker.d.ts +0 -9
- package/dist/testnet/worker.js +0 -78
- package/dist/testnet/worker.js.map +0 -1
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ In your project's `package.json`, ensure that the following line is added above
|
|
|
90
90
|
|
|
91
91
|
### Create Leo App
|
|
92
92
|
A set of fully functional examples of zero-knowledge web apps can be found in
|
|
93
|
-
[create-leo-app](https://github.com/ProvableHQ/sdk/tree/
|
|
93
|
+
[create-leo-app](https://github.com/ProvableHQ/sdk/tree/mainnet/create-leo-app). Create Leo App provides several web app
|
|
94
94
|
templates in common web frameworks such as React that can be used as a starting point for building zero-knowledge web apps.
|
|
95
95
|
|
|
96
96
|
Developers can get started immediately with create-leo-app by running:
|
|
@@ -100,7 +100,7 @@ Developers can get started immediately with create-leo-app by running:
|
|
|
100
100
|
|
|
101
101
|
Additionally, the SDK powers [provable.tools](https://provable.tools) - a React app that provides a graphical interface for most
|
|
102
102
|
of the functionality provided by the SDK and can be used as a reference for usage of the SDK. Source code for provable.tools
|
|
103
|
-
can be found [in the SDK repo here](https://github.com/ProvableHQ/sdk/tree/
|
|
103
|
+
can be found [in the SDK repo here](https://github.com/ProvableHQ/sdk/tree/mainnet/website).
|
|
104
104
|
|
|
105
105
|
## Usage
|
|
106
106
|
|
|
@@ -421,7 +421,7 @@ Program execution is a computationally-expensive process. For this reason, it is
|
|
|
421
421
|
web workers. Create-Leo-App will automatically create a web worker for you that performs the execution called `worker.js`.
|
|
422
422
|
|
|
423
423
|
|
|
424
|
-
A full example of this implementation can be found [here](https://github.com/ProvableHQ/sdk/tree/
|
|
424
|
+
A full example of this implementation can be found [here](https://github.com/ProvableHQ/sdk/tree/mainnet/create-leo-app/template-vanilla)
|
|
425
425
|
|
|
426
426
|
## 3. Aleo Credit Transfers
|
|
427
427
|
|
package/package.json
CHANGED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { Address, PrivateKey, Signature, ViewKey, PrivateKeyCiphertext, RecordCiphertext } from "./wasm";
|
|
2
|
-
interface AccountParam {
|
|
3
|
-
privateKey?: string;
|
|
4
|
-
seed?: Uint8Array;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Key Management class. Enables the creation of a new Aleo Account, importation of an existing account from
|
|
8
|
-
* an existing private key or seed, and message signing and verification functionality.
|
|
9
|
-
*
|
|
10
|
-
* An Aleo Account is generated from a randomly generated seed (number) from which an account private key, view key,
|
|
11
|
-
* and a public account address are derived. The private key lies at the root of an Aleo account. It is a highly
|
|
12
|
-
* sensitive secret and should be protected as it allows for creation of Aleo Program executions and arbitrary value
|
|
13
|
-
* transfers. The View Key allows for decryption of a user's activity on the blockchain. The Address is the public
|
|
14
|
-
* address to which other users of Aleo can send Aleo credits and other records to. This class should only be used
|
|
15
|
-
* environments where the safety of the underlying key material can be assured.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* // Create a new account
|
|
19
|
-
* const myRandomAccount = new Account();
|
|
20
|
-
*
|
|
21
|
-
* // Create an account from a randomly generated seed
|
|
22
|
-
* const seed = new Uint8Array([94, 91, 52, 251, 240, 230, 226, 35, 117, 253, 224, 210, 175, 13, 205, 120, 155, 214, 7, 169, 66, 62, 206, 50, 188, 40, 29, 122, 40, 250, 54, 18]);
|
|
23
|
-
* const mySeededAccount = new Account({seed: seed});
|
|
24
|
-
*
|
|
25
|
-
* // Create an account from an existing private key
|
|
26
|
-
* const myExistingAccount = new Account({privateKey: 'myExistingPrivateKey'})
|
|
27
|
-
*
|
|
28
|
-
* // Sign a message
|
|
29
|
-
* const hello_world = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
|
|
30
|
-
* const signature = myRandomAccount.sign(hello_world)
|
|
31
|
-
*
|
|
32
|
-
* // Verify a signature
|
|
33
|
-
* myRandomAccount.verify(hello_world, signature)
|
|
34
|
-
*/
|
|
35
|
-
export declare class Account {
|
|
36
|
-
_privateKey: PrivateKey;
|
|
37
|
-
_viewKey: ViewKey;
|
|
38
|
-
_address: Address;
|
|
39
|
-
constructor(params?: AccountParam);
|
|
40
|
-
/**
|
|
41
|
-
* Attempts to create an account from a private key ciphertext
|
|
42
|
-
* @param {PrivateKeyCiphertext | string} ciphertext
|
|
43
|
-
* @param {string} password
|
|
44
|
-
* @returns {PrivateKey}
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* const ciphertext = PrivateKey.newEncrypted("password");
|
|
48
|
-
* const account = Account.fromCiphertext(ciphertext, "password");
|
|
49
|
-
*/
|
|
50
|
-
static fromCiphertext(ciphertext: PrivateKeyCiphertext | string, password: string): Account;
|
|
51
|
-
private privateKeyFromParams;
|
|
52
|
-
privateKey(): PrivateKey;
|
|
53
|
-
viewKey(): ViewKey;
|
|
54
|
-
address(): Address;
|
|
55
|
-
toString(): any;
|
|
56
|
-
/**
|
|
57
|
-
* Encrypt the account's private key with a password
|
|
58
|
-
* @param {string} ciphertext
|
|
59
|
-
* @returns {PrivateKeyCiphertext}
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* const account = new Account();
|
|
63
|
-
* const ciphertext = account.encryptAccount("password");
|
|
64
|
-
*/
|
|
65
|
-
encryptAccount(password: string): any;
|
|
66
|
-
/**
|
|
67
|
-
* Decrypts a Record in ciphertext form into plaintext
|
|
68
|
-
* @param {string} ciphertext
|
|
69
|
-
* @returns {Record}
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* const account = new Account();
|
|
73
|
-
* const record = account.decryptRecord("record1ciphertext");
|
|
74
|
-
*/
|
|
75
|
-
decryptRecord(ciphertext: string): any;
|
|
76
|
-
/**
|
|
77
|
-
* Decrypts an array of Records in ciphertext form into plaintext
|
|
78
|
-
* @param {string[]} ciphertexts
|
|
79
|
-
* @returns {Record[]}
|
|
80
|
-
*
|
|
81
|
-
* @example
|
|
82
|
-
* const account = new Account();
|
|
83
|
-
* const record = account.decryptRecords(["record1ciphertext", "record2ciphertext"]);
|
|
84
|
-
*/
|
|
85
|
-
decryptRecords(ciphertexts: string[]): any[];
|
|
86
|
-
/**
|
|
87
|
-
* Determines whether the account owns a ciphertext record
|
|
88
|
-
* @param {RecordCipherText | string} ciphertext
|
|
89
|
-
* @returns {boolean}
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* // Create a connection to the Aleo network and an account
|
|
93
|
-
* const connection = new AleoNetworkClient("https://api.explorer.provable.com/v1");
|
|
94
|
-
* const account = Account.fromCiphertext("ciphertext", "password");
|
|
95
|
-
*
|
|
96
|
-
* // Get a record from the network
|
|
97
|
-
* const record = connection.getBlock(1234);
|
|
98
|
-
* const recordCipherText = record.transactions[0].execution.transitions[0].id;
|
|
99
|
-
*
|
|
100
|
-
* // Check if the account owns the record
|
|
101
|
-
* if account.ownsRecord(recordCipherText) {
|
|
102
|
-
* // Then one can do something like:
|
|
103
|
-
* // Decrypt the record and check if it's spent
|
|
104
|
-
* // Store the record in a local database
|
|
105
|
-
* // Etc.
|
|
106
|
-
* }
|
|
107
|
-
*/
|
|
108
|
-
ownsRecordCiphertext(ciphertext: RecordCiphertext | string): any;
|
|
109
|
-
/**
|
|
110
|
-
* Signs a message with the account's private key.
|
|
111
|
-
* Returns a Signature.
|
|
112
|
-
*
|
|
113
|
-
* @param {Uint8Array} message
|
|
114
|
-
* @returns {Signature}
|
|
115
|
-
*
|
|
116
|
-
* @example
|
|
117
|
-
* const account = new Account();
|
|
118
|
-
* const message = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
|
|
119
|
-
* account.sign(message);
|
|
120
|
-
*/
|
|
121
|
-
sign(message: Uint8Array): any;
|
|
122
|
-
/**
|
|
123
|
-
* Verifies the Signature on a message.
|
|
124
|
-
*
|
|
125
|
-
* @param {Uint8Array} message
|
|
126
|
-
* @param {Signature} signature
|
|
127
|
-
* @returns {boolean}
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* const account = new Account();
|
|
131
|
-
* const message = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
|
|
132
|
-
* const signature = account.sign(message);
|
|
133
|
-
* account.verify(message, signature);
|
|
134
|
-
*/
|
|
135
|
-
verify(message: Uint8Array, signature: Signature): any;
|
|
136
|
-
}
|
|
137
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import "./polyfill/shared";
|
|
2
|
-
import { Account } from "./account";
|
|
3
|
-
import { AleoNetworkClient, ProgramImports } from "./network-client";
|
|
4
|
-
import { BlockJSON } from "./models/blockJSON";
|
|
5
|
-
import { ExecutionJSON } from "./models/executionJSON";
|
|
6
|
-
import { FunctionObject } from "./models/functionObject";
|
|
7
|
-
import { InputJSON } from "./models/input/inputJSON";
|
|
8
|
-
import { InputObject } from "./models/input/inputObject";
|
|
9
|
-
import { OutputJSON } from "./models/output/outputJSON";
|
|
10
|
-
import { OutputObject } from "./models/output/outputObject";
|
|
11
|
-
import { PlaintextArray } from "./models/plaintext/array";
|
|
12
|
-
import { PlaintextLiteral } from "./models/plaintext/literal";
|
|
13
|
-
import { PlaintextStruct } from "./models/plaintext/struct";
|
|
14
|
-
import { TransactionJSON } from "./models/transaction/transactionJSON";
|
|
15
|
-
import { TransactionSummary } from "./models/transaction/transactionSummary";
|
|
16
|
-
import { AleoKeyProvider, AleoKeyProviderParams, AleoKeyProviderInitParams, CachedKeyPair, FunctionKeyPair, FunctionKeyProvider, KeySearchParams } from "./function-key-provider";
|
|
17
|
-
import { OfflineKeyProvider, OfflineSearchParams } from "./offline-key-provider";
|
|
18
|
-
import { BlockHeightSearch, NetworkRecordProvider, RecordProvider, RecordSearchParams } from "./record-provider";
|
|
19
|
-
declare function initializeWasm(): Promise<void>;
|
|
20
|
-
export { createAleoWorker } from "./managed-worker";
|
|
21
|
-
export { ProgramManager } from "./program-manager";
|
|
22
|
-
export { logAndThrow } from "./utils";
|
|
23
|
-
export { Address, Ciphertext, Execution as FunctionExecution, ExecutionResponse, Field, Group, OfflineQuery, Plaintext, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, RecordCiphertext, RecordPlaintext, Signature, Scalar, Transaction, Transition, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution, } from "./wasm";
|
|
24
|
-
export { initializeWasm };
|
|
25
|
-
export { Key, CREDITS_PROGRAM_KEYS, KEY_STORE, PRIVATE_TRANSFER, PRIVATE_TO_PUBLIC_TRANSFER, PRIVATE_TRANSFER_TYPES, PUBLIC_TRANSFER, PUBLIC_TRANSFER_AS_SIGNER, PUBLIC_TO_PRIVATE_TRANSFER, VALID_TRANSFER_TYPES, } from "./constants";
|
|
26
|
-
export { Account, AleoKeyProvider, AleoKeyProviderParams, AleoKeyProviderInitParams, AleoNetworkClient, BlockJSON, BlockHeightSearch, CachedKeyPair, ExecutionJSON, FunctionObject, FunctionKeyPair, FunctionKeyProvider, InputJSON, InputObject, KeySearchParams, NetworkRecordProvider, ProgramImports, OfflineKeyProvider, OfflineSearchParams, PlaintextArray, PlaintextLiteral, PlaintextStruct, OutputJSON, OutputObject, RecordProvider, RecordSearchParams, TransactionJSON, TransactionSummary, };
|