@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
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  </p>
5
5
 
6
6
  <p align="center">
7
- <a href="https://developer.aleo.org"> <img alt="Website" src="https://img.shields.io/badge/Developer_Docs-online-blue"></a>
7
+ <a href="https://docs.leo-lang.org"> <img alt="Website" src="https://img.shields.io/badge/Developer_Docs-online-blue"></a>
8
8
  <a href="https://circleci.com/gh/ProvableHQ/sdk"><img src="https://circleci.com/gh/ProvableHQ/sdk.svg?style=svg"></a>
9
9
  <a href="https://discord.com/invite/aleo"><img src="https://img.shields.io/discord/700454073459015690?logo=discord"/></a>
10
10
  <a href="https://github.com/ProvableHQ/sdk#%EF%B8%8F-contributors"><img src="https://img.shields.io/badge/contributors-23-ee8449"/></a>
@@ -182,7 +182,7 @@ function hello:
182
182
  The SDK provides the ability to execute Aleo programs 100% client-side within the browser.
183
183
 
184
184
  The `ProgramManager` object encapsulates the functionality for executing programs and making zero-knowledge proofs about
185
- them. Under the hood it uses cryptographic code compiled from [SnarkVM](https://developer.aleo.org/aleo) into WebAssembly
185
+ them. Under the hood it uses cryptographic code compiled from [SnarkVM](https://docs.leo-lang.org/aleo) into WebAssembly
186
186
  with JavaScript bindings that allow for the execution of Aleo programs fully within the browser. Users interested in lower-level
187
187
  details on how this is achieved can visit the [aleo-wasm](https://www.npmjs.com/package/@provablehq/wasm) crate.
188
188
 
@@ -395,7 +395,7 @@ const transaction = await programManager.networkClient.getTransaction(tx_id);
395
395
 
396
396
  The `NetworkRecordProvider` will attempt to scan the network for a fee record for the account provided. Doing a recent
397
397
  public transfer to the deploying account will ensure a record is found quickly, or you can provide a fee record manually
398
- by [scanning](https://developer.aleo.org/testnet/getting_started/deploy_execute/#scan) for a record and passing it as a
398
+ by [scanning](https://docs.leo-lang.org/testnet/getting_started/deploy_execute/#scan) for a record and passing it as a
399
399
  string.
400
400
 
401
401
  ```typescript
@@ -930,7 +930,7 @@ Communication with the Aleo network is done through the `AleoNetworkClient` clas
930
930
  data from Aleo network nodes and submit transactions to the Aleo network.
931
931
 
932
932
  A full list of methods provided by the `AleoNetworkClient` class and usage examples can be found in the
933
- [Network Client API documentation](https://developer.aleo.org/sdk/typescript/aleo_network_client).
933
+ [Network Client API documentation](https://docs.leo-lang.org/sdk/typescript/aleo_network_client).
934
934
 
935
935
  ## Further Documentation
936
936
 
@@ -1,4 +1,4 @@
1
- import { Address, PrivateKey, Signature, ViewKey, PrivateKeyCiphertext, RecordCiphertext } from "./browser";
1
+ import { Address, PrivateKey, Signature, ViewKey, PrivateKeyCiphertext, RecordCiphertext } from "./wasm";
2
2
  interface AccountParam {
3
3
  privateKey?: string;
4
4
  seed?: Uint8Array;
@@ -52,7 +52,7 @@ export declare class Account {
52
52
  privateKey(): PrivateKey;
53
53
  viewKey(): ViewKey;
54
54
  address(): Address;
55
- toString(): string;
55
+ toString(): any;
56
56
  /**
57
57
  * Encrypt the account's private key with a password
58
58
  * @param {string} ciphertext
@@ -62,7 +62,7 @@ export declare class Account {
62
62
  * const account = new Account();
63
63
  * const ciphertext = account.encryptAccount("password");
64
64
  */
65
- encryptAccount(password: string): PrivateKeyCiphertext;
65
+ encryptAccount(password: string): any;
66
66
  /**
67
67
  * Decrypts a Record in ciphertext form into plaintext
68
68
  * @param {string} ciphertext
@@ -72,7 +72,7 @@ export declare class Account {
72
72
  * const account = new Account();
73
73
  * const record = account.decryptRecord("record1ciphertext");
74
74
  */
75
- decryptRecord(ciphertext: string): string;
75
+ decryptRecord(ciphertext: string): any;
76
76
  /**
77
77
  * Decrypts an array of Records in ciphertext form into plaintext
78
78
  * @param {string[]} ciphertexts
@@ -82,7 +82,7 @@ export declare class Account {
82
82
  * const account = new Account();
83
83
  * const record = account.decryptRecords(["record1ciphertext", "record2ciphertext"]);
84
84
  */
85
- decryptRecords(ciphertexts: string[]): string[];
85
+ decryptRecords(ciphertexts: string[]): any[];
86
86
  /**
87
87
  * Determines whether the account owns a ciphertext record
88
88
  * @param {RecordCipherText | string} ciphertext
@@ -105,7 +105,7 @@ export declare class Account {
105
105
  * // Etc.
106
106
  * }
107
107
  */
108
- ownsRecordCiphertext(ciphertext: RecordCiphertext | string): boolean;
108
+ ownsRecordCiphertext(ciphertext: RecordCiphertext | string): any;
109
109
  /**
110
110
  * Signs a message with the account's private key.
111
111
  * Returns a Signature.
@@ -118,7 +118,7 @@ export declare class Account {
118
118
  * const message = Uint8Array.from([104, 101, 108, 108, 111 119, 111, 114, 108, 100])
119
119
  * account.sign(message);
120
120
  */
121
- sign(message: Uint8Array): Signature;
121
+ sign(message: Uint8Array): any;
122
122
  /**
123
123
  * Verifies the Signature on a message.
124
124
  *
@@ -132,6 +132,6 @@ export declare class Account {
132
132
  * const signature = account.sign(message);
133
133
  * account.verify(message, signature);
134
134
  */
135
- verify(message: Uint8Array, signature: Signature): boolean;
135
+ verify(message: Uint8Array, signature: Signature): any;
136
136
  }
137
137
  export {};
@@ -1,53 +1,26 @@
1
1
  import "./polyfill/shared";
2
- import { VerifyingKey } from "@provablehq/wasm/mainnet.js";
3
- declare const KEY_STORE: string;
4
- interface Key {
5
- name: string;
6
- locator: string;
7
- prover: string;
8
- verifier: string;
9
- verifyingKey: () => VerifyingKey;
10
- }
11
- declare const CREDITS_PROGRAM_KEYS: {
12
- bond_public: Key;
13
- bond_validator: Key;
14
- claim_unbond_public: Key;
15
- fee_private: Key;
16
- fee_public: Key;
17
- inclusion: Key;
18
- join: Key;
19
- set_validator_state: Key;
20
- split: Key;
21
- transfer_private: Key;
22
- transfer_private_to_public: Key;
23
- transfer_public: Key;
24
- transfer_public_as_signer: Key;
25
- transfer_public_to_private: Key;
26
- unbond_public: Key;
27
- getKey: (key: string) => Key;
28
- };
29
- declare const PRIVATE_TRANSFER_TYPES: Set<string>;
30
- declare const VALID_TRANSFER_TYPES: Set<string>;
31
- declare const PRIVATE_TRANSFER: Set<string>;
32
- declare const PRIVATE_TO_PUBLIC_TRANSFER: Set<string>;
33
- declare const PUBLIC_TRANSFER: Set<string>;
34
- declare const PUBLIC_TRANSFER_AS_SIGNER: Set<string>;
35
- declare const PUBLIC_TO_PRIVATE_TRANSFER: Set<string>;
36
- declare function logAndThrow(message: string): never;
37
2
  import { Account } from "./account";
38
3
  import { AleoNetworkClient, ProgramImports } from "./network-client";
39
- import { Block } from "./models/block";
40
- import { Execution } from "./models/execution";
41
- import { Input } from "./models/input";
42
- import { Output } from "./models/output";
43
- import { TransactionModel } from "./models/transactionModel";
44
- import { Transition } from "./models/transition";
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";
45
16
  import { AleoKeyProvider, AleoKeyProviderParams, AleoKeyProviderInitParams, CachedKeyPair, FunctionKeyPair, FunctionKeyProvider, KeySearchParams } from "./function-key-provider";
46
17
  import { OfflineKeyProvider, OfflineSearchParams } from "./offline-key-provider";
47
18
  import { BlockHeightSearch, NetworkRecordProvider, RecordProvider, RecordSearchParams } from "./record-provider";
48
19
  declare function initializeWasm(): Promise<void>;
49
20
  export { createAleoWorker } from "./managed-worker";
50
21
  export { ProgramManager } from "./program-manager";
51
- export { Address, Execution as FunctionExecution, ExecutionResponse, Field, OfflineQuery, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, RecordCiphertext, RecordPlaintext, Signature, Transaction, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution, } from "@provablehq/wasm/mainnet.js";
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";
52
24
  export { initializeWasm };
53
- export { Account, AleoKeyProvider, AleoKeyProviderParams, AleoKeyProviderInitParams, AleoNetworkClient, Block, BlockHeightSearch, CachedKeyPair, Execution, FunctionKeyPair, FunctionKeyProvider, Input, Key, KeySearchParams, NetworkRecordProvider, ProgramImports, OfflineKeyProvider, OfflineSearchParams, Output, RecordProvider, RecordSearchParams, TransactionModel, Transition, 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, logAndThrow, };
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, };