Skip to content

Commit dba689e

Browse files
fixed casing of fields on OwnedRecord and EncryptedRecord types
1 parent a8fccc9 commit dba689e

File tree

13 files changed

+348
-85
lines changed

13 files changed

+348
-85
lines changed

sdk/src/browser.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { BlockJSON, Header, Metadata } from "./models/blockJSON.js";
66
import { ConfirmedTransactionJSON } from "./models/confirmed_transaction.js";
77
import { DeploymentJSON, VerifyingKeys } from "./models/deployment/deploymentJSON.js";
88
import { DeploymentObject } from "./models/deployment/deploymentObject.js";
9+
import { EncryptedRecord } from "./models/record-provider/encryptedRecord.js";
910
import { ExecutionJSON, FeeExecutionJSON } from "./models/execution/executionJSON.js";
1011
import { ExecutionObject, FeeExecutionObject } from "./models/execution/executionObject.js";
1112
import { FinalizeJSON } from "./models/finalizeJSON.js";
@@ -15,6 +16,8 @@ import { InputJSON } from "./models/input/inputJSON.js";
1516
import { InputObject } from "./models/input/inputObject.js";
1617
import { OutputJSON } from "./models/output/outputJSON.js";
1718
import { OutputObject } from "./models/output/outputObject.js";
19+
import { OwnedFilter } from "./models/record-scanner/ownedFilter.js";
20+
import { OwnedRecord } from "./models/record-provider/ownedRecord.js";
1821
import { OwnerJSON } from "./models/owner/ownerJSON.js";
1922
import { PlaintextArray} from "./models/plaintext/array.js";
2023
import { PlaintextLiteral} from "./models/plaintext/literal.js";
@@ -23,6 +26,9 @@ import { PlaintextStruct} from "./models/plaintext/struct.js";
2326
import { ProvingRequestJSON } from "./models/provingRequest.js";
2427
import { ProvingResponse } from "./models/provingResponse.js";
2528
import { RatificationJSON } from "./models/ratification.js";
29+
import { RecordsFilter } from "./models/record-scanner/recordsFilter.js";
30+
import { RecordsResponseFilter } from "./models/record-provider/recordsResponseFilter.js";
31+
import { RecordSearchParams } from "./models/record-provider/recordSearchParams.js";
2632
import { SolutionsJSON, SolutionJSON, PartialSolutionJSON } from "./models/solution.js";
2733
import { TransactionJSON } from "./models/transaction/transactionJSON.js";
2834
import { TransactionObject } from "./models/transaction/transactionObject.js";
@@ -46,9 +52,7 @@ import {
4652
NetworkRecordProvider,
4753
RecordProvider,
4854
} from "./record-provider.js";
49-
import {
50-
RecordSearchParams,
51-
} from "./models/record-provider/recordSearchParams.js";
55+
import { RecordScanner } from "./record-scanner.js";
5256

5357
// @TODO: This function is no longer needed, remove it.
5458
async function initializeWasm() {
@@ -74,6 +78,7 @@ export {
7478
ExecutionResponse,
7579
EncryptionToolkit,
7680
Field,
81+
GraphKey,
7782
Group,
7883
I8,
7984
I16,
@@ -137,6 +142,7 @@ export {
137142
ConfirmedTransactionJSON,
138143
DeploymentJSON,
139144
DeploymentObject,
145+
EncryptedRecord,
140146
ExecutionJSON,
141147
ExecutionObject,
142148
FeeExecutionJSON,
@@ -157,6 +163,8 @@ export {
157163
OfflineSearchParams,
158164
OutputJSON,
159165
OutputObject,
166+
OwnedFilter,
167+
OwnedRecord,
160168
OwnerJSON,
161169
PartialSolutionJSON,
162170
PlaintextArray,
@@ -167,7 +175,10 @@ export {
167175
ProvingRequestJSON,
168176
ProvingResponse,
169177
RatificationJSON,
178+
RecordsFilter,
179+
RecordsResponseFilter,
170180
RecordProvider,
181+
RecordScanner,
171182
RecordSearchParams,
172183
SolutionJSON,
173184
SolutionsJSON,
Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,52 @@
11
/**
2-
* EncryptedRecord is a type that represents information about an encrypted record.
2+
* Encrypted Record found on chain. This type provides the record ciphertext and metadata from the ledger that such as the record's name, the program/function that produced it, etc.
3+
*
4+
* @property {string} commitment - The commitment of the record.
5+
* @property {string | undefined} checksum - The checksum of the record.
6+
* @property {number | undefined} block_height - The block height of the record.
7+
* @property {string | undefined} program_name - The name of the program that produced the record.
8+
* @property {string | undefined} function_name - The name of the function that produced the record.
9+
* @property {number | undefined} output_index - The output index of the record.
10+
* @property {string | undefined} owner - The owner of the record.
11+
* @property {string | undefined} record_ciphertext - The ciphertext of the record.
12+
* @property {string | undefined} record_name - The name of the record.
13+
* @property {string | undefined} record_nonce - The nonce of the record.
14+
* @property {string | undefined} transaction_id - The ID of the transaction that produced the record.
15+
* @property {string | undefined} transition_id - The ID of the transition that produced the record.
16+
* @property {number | undefined} transaction_index - The index of the transaction that produced the record.
17+
* @property {number | undefined} transition_index - The index of the transition that produced the record.
318
*
419
* @example
520
* const encryptedRecord: EncryptedRecord = {
6-
* commitment: "...",
7-
* checksum: "...",
8-
* blockHeight: 123456,
9-
* programName: "...",
10-
* functionName: "...",
11-
* outputIndex: 0,
12-
* owner: "...",
13-
* recordCiphertext: "...",
14-
* recordName: "...",
15-
* recordNonce: "...",
16-
* transactionId: "...",
17-
* transitionId: "...",
18-
* transactionIndex: 0,
19-
* transitionIndex: 0,
21+
* commitment: "1754131901135854615627743152473414463769543922079966020586765988138574911385field",
22+
* checksum: "731623304764338277682996290553427512270277231686866672455141481050283829616field",
23+
* block_height: 123456,
24+
* program_name: "credits.aleo",
25+
* function_name: "transfer_private",
26+
* output_index: 0,
27+
* owner: "ciphertext1qgqdetlfzk98jkm4e7sgqml66e3x2gpg5d6udkpw0g67z0tplkpmzrm6q5dyfd7xhgmhedvptxzwfhrtxaqn7n0hs0esge3lwg9s2zukqgzxd0cr",
28+
* recordCiphertext: "record1qyqsqt43u9kp97svljyyup3v4jmppd0vgght9edvvmtxx6mxycsej8cwqsrxzmt0w4h8ggcqqgqspf8zqut2ycnap7f0uzz5ktu0cxscca96urtkg2aweuzn70787dsrpp6x76m9de0kjezrqqpqyqp3mn3xeh53lukvcy406amjf5g0ksl3saauzjk0j4ljtjqq6kqlqhdz05sw92zye96qym7kp83ra0eesgtwhaw37c85r499456se8ts28m90p6x2unwv9k97ct4w35x7unf0fshg6t0de0hyet3w45hyetyyvqqyqgq4t2wr9tmcrfha5tfz5j585ptvvslqe0f6sf29vytshhdh7ym05rpqct4w35x7unf0fjkghm4de6xjmprqqpqzqru6p7fef29vuz6smyqwcn3z7jhxtdgjdw5xv23ppxhpgnvu72fp8hz6fjt6gsdn8yxhzq7gpsah0rscwqrzxwl5e8aemkj5gt09y7q5506yrf",
29+
* record_name: "credits",
30+
* record_nonce: "3077450429259593211617823051143573281856129402760267155982965992208217472983group",
31+
* transaction_id: "at1f8ueqxu3x49sckpc6jlg676tmxumddzer3fwe2l0dxwj4dqxygyqua4u2q",
32+
* transition_id: "au17mm5v7sfwus6y40xsyc99d5rtsr4vsajdec6twdjzv0m458q85zspqdnka",
33+
* transaction_index: 0,
34+
* transition_index: 0,
2035
* }
2136
*/
2237
export type EncryptedRecord = {
2338
commitment: string;
2439
checksum?: string;
25-
blockHeight?: number;
26-
programName?: string;
27-
functionName?: string;
28-
outputIndex?: number;
40+
block_height?: number;
41+
program_name?: string;
42+
function_name?: string;
43+
output_index?: number;
2944
owner?: string;
30-
recordCiphertext?: string;
31-
recordName?: string;
32-
recordNonce?: string;
33-
transactionId?: string;
34-
transitionId?: string;
35-
transactionIndex?: number;
36-
transitionIndex?: number;
45+
record_ciphertext?: string;
46+
record_name?: string;
47+
record_nonce?: string;
48+
transaction_id?: string;
49+
transition_id?: string;
50+
transaction_index?: number;
51+
transition_index?: number;
3752
}
Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,54 @@
11
/**
2-
* OwnedRecord is a type that represents information about an owned record that is found on chain.
3-
*
2+
* Record owned by a registered view key. This type provides the record ciphertext, record plaintext and metadata from the ledger that such as the record's name, the program/function that produced it, etc.
3+
*
4+
* @property {number | undefined} block_height - Block height where the record was created.
5+
* @property {string | undefined} commitment - Commitment of the record.
6+
* @property {string | undefined} function_name - Name of the function that created the record.
7+
* @property {number | undefined} output_index - Index of the output in the function call that created the record.
8+
* @property {string | undefined} owner - Address of the record owner.
9+
* @property {string | undefined} program_name - Name of the program that created the record.
10+
* @property {string | undefined} record_ciphertext - Encrypted ciphertext of the record.
11+
* @property {string | undefined} record_name - Name of the record.
12+
* @property {boolean | undefined} spent - Whether the record has been spent.
13+
* @property {string | undefined} tag - Tag associated with the record.
14+
* @property {string | undefined} transaction_id - ID of the transaction that created the record.
15+
* @property {string | undefined} transition_id - ID of the transition that created the record.
16+
* @property {string | undefined} transaction_index - Index of the transaction in the block.
17+
* @property {string | undefined} transition_index - Index of the transition in the transaction.
18+
*
419
* @example
520
* const ownedRecord: OwnedRecord = {
6-
* blockHeight: 123456,
7-
* commitment: "...",
8-
* functionName: "...",
9-
* outputIndex: 0,
10-
* owner: "...",
11-
* programName: "...",
12-
* recordCiphertext: "...",
13-
* recordPlaintext: "...",
14-
* recordName: "...",
21+
* block_height: 123456,
22+
* commitment: "1754131901135854615627743152473414463769543922079966020586765988138574911385field",
23+
* function_name: "transfer_public_to_private",
24+
* output_index: 0,
25+
* owner: "ciphertext1qgqdetlfzk98jkm4e7sgqml66e3x2gpg5d6udkpw0g67z0tplkpmzrm6q5dyfd7xhgmhedvptxzwfhrtxaqn7n0hs0esge3lwg9s2zukqgzxd0cr",
26+
* program_name: "credits.aleo",
27+
* record_ciphertext: "record1qyqsqt43u9kp97svljyyup3v4jmppd0vgght9edvvmtxx6mxycsej8cwqsrxzmt0w4h8ggcqqgqspf8zqut2ycnap7f0uzz5ktu0cxscca96urtkg2aweuzn70787dsrpp6x76m9de0kjezrqqpqyqp3mn3xeh53lukvcy406amjf5g0ksl3saauzjk0j4ljtjqq6kqlqhdz05sw92zye96qym7kp83ra0eesgtwhaw37c85r499456se8ts28m90p6x2unwv9k97ct4w35x7unf0fshg6t0de0hyet3w45hyetyyvqqyqgq4t2wr9tmcrfha5tfz5j585ptvvslqe0f6sf29vytshhdh7ym05rpqct4w35x7unf0fjkghm4de6xjmprqqpqzqru6p7fef29vuz6smyqwcn3z7jhxtdgjdw5xv23ppxhpgnvu72fp8hz6fjt6gsdn8yxhzq7gpsah0rscwqrzxwl5e8aemkj5gt09y7q5506yrf",
28+
* record_plaintext: "{ owner: aleo1j7qxyunfldj2lp8hsvy7mw5k8zaqgjfyr72x2gh3x4ewgae8v5gscf5jh3.private, microcredits: 1500000000000000u64.private, _nonce: 3077450429259593211617823051143573281856129402760267155982965992208217472983group.public , _version: 1u8 }",
29+
* record_name: "credits",
1530
* spent: true,
16-
* tag: "...",
17-
* transactionId: "...",
18-
* transitionId: "...",
19-
* transactionIndex: 0,
20-
* transitionIndex: 0,
31+
* tag: "6511661650536816422260305447175136877451468301541296257226129781611237851030field",
32+
* transaction_id: "at1f8ueqxu3x49sckpc6jlg676tmxumddzer3fwe2l0dxwj4dqxygyqua4u2q",
33+
* transition_id: "au17mm5v7sfwus6y40xsyc99d5rtsr4vsajdec6twdjzv0m458q85zspqdnka",
34+
* transaction_index: 0,
35+
* transition_index: 0,
2136
* }
2237
*/
2338
export type OwnedRecord = {
24-
blockHeight?: number;
39+
block_height?: number;
2540
commitment?: string;
26-
functionName?: string;
27-
outputIndex?: number;
41+
function_name?: string;
42+
output_index?: number;
2843
owner?: string;
29-
programName?: string;
44+
program_name?: string;
3045
recordCiphertext?: string;
31-
recordPlaintext?: string;
32-
recordName?: string;
46+
record_plaintext?: string;
47+
record_name?: string;
3348
spent?: boolean;
3449
tag?: string;
35-
transactionId?: string;
36-
transitionId?: string;
37-
transactionIndex?: number;
38-
transitionIndex?: number;
50+
transaction_id?: string;
51+
transition_id?: string;
52+
transaction_index?: number;
53+
transition_index?: number;
3954
}

sdk/src/models/record-provider/recordSearchParams.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
* const recordSearchParams: RecordSearchParams = {
77
* // Declared fields
88
* unspent: true,
9-
* nonces: ["..."],
9+
* nonces: ["3077450429259593211617823051143573281856129402760267155982965992208217472983group"],
1010
* // Arbitrary fields
1111
* startHeight: 123456,
12-
* programName: "..."
12+
* programName: "credits.aleo"
1313
* }
1414
*/
1515
export interface RecordSearchParams {
16-
unspent: boolean;
16+
unspent?: boolean;
1717
nonces?: string[];
1818
[key: string]: any; // This allows for arbitrary keys with any type values
1919
}

sdk/src/models/record-scanner/ownedFilter.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import { RecordsResponseFilter } from "../record-provider/recordsResponseFilter"
88
* @example
99
* const ownedFilter: OwnedFilter = {
1010
* unspent: true,
11-
* nonces: ["..."],
11+
* nonces: ["3077450429259593211617823051143573281856129402760267155982965992208217472983group"],
1212
* decrypt: true,
1313
* filter: {
14-
* program: "...",
15-
* record: "...",
14+
* program: "credits.aleo",
15+
* record: "credits",
1616
* },
1717
* }
1818
*/

sdk/src/models/record-scanner/recordsFilter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { RecordSearchParams } from "../record-provider/recordSearchParams";
77
* const recordsFilter: RecordsFilter = {
88
* start: 0,
99
* end: 100,
10-
* program: "...",
11-
* record: "...",
10+
* program: "credits.aleo",
11+
* record: "credits",
1212
* }
1313
*/
1414
export interface RecordsFilter extends RecordSearchParams {

sdk/src/models/record-scanner/registrationRequest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
*
44
* @example
55
* const registrationRequest: RegistrationRequest = {
6-
* viewKey: "...",
6+
* view_key: "AViewKey1ccEt8A2Ryva5rxnKcAbn7wgTaTsb79tzkKHFpeKsm9NX",
77
* start: 123456,
88
* }
99
*/
1010
export type RegistrationRequest = {
11-
viewKey: string;
11+
view_key: string;
1212
start: number;
1313
}

sdk/src/program-manager.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ class ProgramManager {
357357
[],
358358
feeRecord,
359359
recordSearchParams,
360-
)).recordPlaintext?? '')
360+
)).record_plaintext?? '')
361361
: undefined;
362362
} catch (e: any) {
363363
logAndThrow(
@@ -569,7 +569,7 @@ class ProgramManager {
569569
[],
570570
feeRecord,
571571
recordSearchParams,
572-
)).recordPlaintext?? '')
572+
)).record_plaintext?? '')
573573
: undefined;
574574
} catch (e: any) {
575575
logAndThrow(
@@ -912,7 +912,7 @@ class ProgramManager {
912912
[],
913913
feeRecord,
914914
recordSearchParams,
915-
)).recordPlaintext?? '')
915+
)).record_plaintext?? '')
916916
: undefined;
917917
} catch (e: any) {
918918
logAndThrow(
@@ -1245,7 +1245,7 @@ class ProgramManager {
12451245
[],
12461246
feeRecord,
12471247
recordSearchParams,
1248-
)).recordPlaintext?? '')
1248+
)).record_plaintext?? '')
12491249
: undefined;
12501250
} catch (e: any) {
12511251
logAndThrow(
@@ -1516,7 +1516,7 @@ class ProgramManager {
15161516
[],
15171517
amountRecord,
15181518
recordSearchParams,
1519-
)).recordPlaintext?? '');
1519+
)).record_plaintext?? '');
15201520
nonces.push(amountRecord.nonce());
15211521
} else {
15221522
amountRecord = undefined;
@@ -1527,7 +1527,7 @@ class ProgramManager {
15271527
nonces,
15281528
feeRecord,
15291529
recordSearchParams,
1530-
)).recordPlaintext?? '')
1530+
)).record_plaintext?? '')
15311531
: undefined;
15321532
} catch (e: any) {
15331533
logAndThrow(

sdk/src/record-provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ class NetworkRecordProvider implements RecordProvider {
379379

380380
const recordPts = await this.networkClient.findRecords(startHeight, endHeight, searchParameters.unspent, programs, amounts, maxAmount, searchParameters.nonces, this.account.privateKey());
381381
return recordPts.map((record) => ({
382-
recordPlaintext: record.toString(),
382+
record_plaintext: record.toString(),
383383
}));
384384
}
385385

0 commit comments

Comments
 (0)