Skip to content

Commit d8f3421

Browse files
removed concrete record scanner impl
1 parent bae6188 commit d8f3421

File tree

10 files changed

+74
-333
lines changed

10 files changed

+74
-333
lines changed

sdk/src/browser.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { ProvingRequestJSON } from "./models/provingRequest.js";
2727
import { ProvingResponse } from "./models/provingResponse.js";
2828
import { RatificationJSON } from "./models/ratification.js";
2929
import { RecordsFilter } from "./models/record-scanner/recordsFilter.js";
30-
import { RecordsResponseFilter } from "./models/record-provider/recordsResponseFilter.js";
30+
import { RecordsResponseFilter } from "./models/record-scanner/recordsResponseFilter.js";
3131
import { RecordSearchParams } from "./models/record-provider/recordSearchParams.js";
3232
import { SolutionsJSON, SolutionJSON, PartialSolutionJSON } from "./models/solution.js";
3333
import { TransactionJSON } from "./models/transaction/transactionJSON.js";
@@ -52,7 +52,6 @@ import {
5252
NetworkRecordProvider,
5353
RecordProvider,
5454
} from "./record-provider.js";
55-
import { RecordScanner } from "./record-scanner.js";
5655

5756
// @TODO: This function is no longer needed, remove it.
5857
async function initializeWasm() {
@@ -178,7 +177,6 @@ export {
178177
RecordsFilter,
179178
RecordsResponseFilter,
180179
RecordProvider,
181-
RecordScanner,
182180
RecordSearchParams,
183181
SolutionJSON,
184182
SolutionsJSON,

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
/**
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.
2+
* Encrypted Record found on chain. This type provides the record ciphertext and metadata from the ledger such as the record's name, the program/function that produced it, etc.
33
*
44
* @property {string} commitment - The commitment of the record.
55
* @property {string | undefined} checksum - The checksum of the record.
66
* @property {number | undefined} block_height - The block height of the record.
7+
* @property {number | undefined} block_timestamp - The block timestamp of the record.
78
* @property {string | undefined} program_name - The name of the program that produced the record.
89
* @property {string | undefined} function_name - The name of the function that produced the record.
910
* @property {number | undefined} output_index - The output index of the record.
1011
* @property {string | undefined} owner - The owner of the record.
1112
* @property {string | undefined} record_ciphertext - The ciphertext of the record.
1213
* @property {string | undefined} record_name - The name of the record.
1314
* @property {string | undefined} record_nonce - The nonce of the record.
15+
* @property {string | undefined} sender_ciphertext - The ciphertext of the sender.
1416
* @property {string | undefined} transaction_id - The ID of the transaction that produced the record.
1517
* @property {string | undefined} transition_id - The ID of the transition that produced the record.
1618
* @property {number | undefined} transaction_index - The index of the transaction that produced the record.
@@ -25,9 +27,10 @@
2527
* function_name: "transfer_private",
2628
* output_index: 0,
2729
* owner: "ciphertext1qgqdetlfzk98jkm4e7sgqml66e3x2gpg5d6udkpw0g67z0tplkpmzrm6q5dyfd7xhgmhedvptxzwfhrtxaqn7n0hs0esge3lwg9s2zukqgzxd0cr",
28-
* recordCiphertext: "record1qyqsqt43u9kp97svljyyup3v4jmppd0vgght9edvvmtxx6mxycsej8cwqsrxzmt0w4h8ggcqqgqspf8zqut2ycnap7f0uzz5ktu0cxscca96urtkg2aweuzn70787dsrpp6x76m9de0kjezrqqpqyqp3mn3xeh53lukvcy406amjf5g0ksl3saauzjk0j4ljtjqq6kqlqhdz05sw92zye96qym7kp83ra0eesgtwhaw37c85r499456se8ts28m90p6x2unwv9k97ct4w35x7unf0fshg6t0de0hyet3w45hyetyyvqqyqgq4t2wr9tmcrfha5tfz5j585ptvvslqe0f6sf29vytshhdh7ym05rpqct4w35x7unf0fjkghm4de6xjmprqqpqzqru6p7fef29vuz6smyqwcn3z7jhxtdgjdw5xv23ppxhpgnvu72fp8hz6fjt6gsdn8yxhzq7gpsah0rscwqrzxwl5e8aemkj5gt09y7q5506yrf",
30+
* record_ciphertext: "record1qyqsqt43u9kp97svljyyup3v4jmppd0vgght9edvvmtxx6mxycsej8cwqsrxzmt0w4h8ggcqqgqspf8zqut2ycnap7f0uzz5ktu0cxscca96urtkg2aweuzn70787dsrpp6x76m9de0kjezrqqpqyqp3mn3xeh53lukvcy406amjf5g0ksl3saauzjk0j4ljtjqq6kqlqhdz05sw92zye96qym7kp83ra0eesgtwhaw37c85r499456se8ts28m90p6x2unwv9k97ct4w35x7unf0fshg6t0de0hyet3w45hyetyyvqqyqgq4t2wr9tmcrfha5tfz5j585ptvvslqe0f6sf29vytshhdh7ym05rpqct4w35x7unf0fjkghm4de6xjmprqqpqzqru6p7fef29vuz6smyqwcn3z7jhxtdgjdw5xv23ppxhpgnvu72fp8hz6fjt6gsdn8yxhzq7gpsah0rscwqrzxwl5e8aemkj5gt09y7q5506yrf",
2931
* record_name: "credits",
3032
* record_nonce: "3077450429259593211617823051143573281856129402760267155982965992208217472983group",
33+
* sender_ciphertext: "1754131901135854615627743152473414463769543922079966020586765988138574911385field",
3134
* transaction_id: "at1f8ueqxu3x49sckpc6jlg676tmxumddzer3fwe2l0dxwj4dqxygyqua4u2q",
3235
* transition_id: "au17mm5v7sfwus6y40xsyc99d5rtsr4vsajdec6twdjzv0m458q85zspqdnka",
3336
* transaction_index: 0,
@@ -38,6 +41,7 @@ export type EncryptedRecord = {
3841
commitment: string;
3942
checksum?: string;
4043
block_height?: number;
44+
block_timestamp?: number;
4145
program_name?: string;
4246
function_name?: string;
4347
output_index?: number;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
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.
2+
* Record owned by a registered view key. This type provides the record ciphertext, record plaintext and metadata from the ledger such as the record's name, the program/function that produced it, etc.
33
*
44
* @property {number | undefined} block_height - Block height where the record was created.
55
* @property {string | undefined} commitment - Commitment of the record.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { RecordSearchParams } from "../record-provider/recordSearchParams";
22
import { RecordsFilter } from "./recordsFilter";
3-
import { RecordsResponseFilter } from "../record-provider/recordsResponseFilter";
3+
import { OwnedRecordsResponseFilter } from "./ownedRecordsResponseFilter";
44

55
/**
66
* OwnedFilter is an extension of RecordSearchParams that represents a filter for scanning owned records.
@@ -19,6 +19,6 @@ import { RecordsResponseFilter } from "../record-provider/recordsResponseFilter"
1919
export interface OwnedFilter extends RecordSearchParams {
2020
decrypt?: boolean;
2121
filter?: RecordsFilter;
22-
responseFilter?: RecordsResponseFilter;
22+
responseFilter?: OwnedRecordsResponseFilter;
2323
uuid?: string;
2424
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* OwnedRecordsResponseFilter is a type that represents a filter for the response from a record provider.
3+
* A `true` value for a field in the filter will include that field in the response.
4+
*
5+
* @example
6+
* const ownedRecordsResponseFilter: OwnedRecordsResponseFilter = {
7+
* commitment: true,
8+
* owner: true,
9+
* tag: true,
10+
* sender: true,
11+
* spent: true,
12+
* record_ciphertext: true,
13+
* block_height: true,
14+
* block_timestamp: true,
15+
* output_index: true,
16+
* record_name: true,
17+
* function_name: true,
18+
* program_name: true,
19+
* transition_id: true,
20+
* transaction_id: true,
21+
* transaction_index: true,
22+
* transition_index: true,
23+
* }
24+
*/
25+
export interface OwnedRecordsResponseFilter {
26+
commitment?: boolean;
27+
owner?: boolean;
28+
tag?: boolean;
29+
sender?: boolean;
30+
spent?: boolean;
31+
record_ciphertext?: boolean;
32+
block_height?: boolean;
33+
block_timestamp?: boolean;
34+
output_index?: boolean;
35+
record_name?: boolean;
36+
function_name?: boolean;
37+
program_name?: boolean;
38+
transition_id?: boolean;
39+
transaction_id?: boolean;
40+
transaction_index?: boolean;
41+
transition_index?: boolean;
42+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { RecordSearchParams } from "../record-provider/recordSearchParams";
2-
import { RecordsResponseFilter } from "../record-provider/recordsResponseFilter";
2+
import { RecordsResponseFilter } from "./recordsResponseFilter";
33

44
/**
55
* RecordsFilter is an extension of RecordSearchParams that represents a filter for scanning encrypted or owned records.
File renamed without changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* RegistrationResponse is a type that represents a response from a record scanning service.
3+
*
4+
* @example
5+
* const registrationResponse: RegistrationResponse = {
6+
* uuid: "5291249998620209321712738612705518874926462927543783711572375085855029172391field",
7+
* job_id: "3019177021147406178755252788128212930359855601860174268911518336835545087409field",
8+
* status: "pending",
9+
* }
10+
*/
11+
interface RegistrationResponse {
12+
uuid: string,
13+
job_id?: string,
14+
status?: string
15+
}

sdk/src/record-provider.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { EncryptedRecord } from "./models/record-provider/encryptedRecord.js";
44
import { logAndThrow } from "./utils.js";
55
import { OwnedRecord } from "./models/record-provider/ownedRecord.js";
66
import { RecordSearchParams } from "./models/record-provider/recordSearchParams.js";
7-
import { RecordsResponseFilter } from "./models/record-provider/recordsResponseFilter.js";
7+
import { RecordsResponseFilter } from "./models/record-scanner/recordsResponseFilter.js";
88

99
/**
1010
* Interface for a record provider. A record provider is used to find records for use in deployment and execution
@@ -25,26 +25,26 @@ interface RecordProvider {
2525
* @param {RecordsResponseFilter} responseFilter The filter used to filter the response.
2626
* @returns {Promise<EncryptedRecord[]>} The encrypted records.
2727
*/
28-
encryptedRecords(recordsFilter: RecordSearchParams, responseFilter: RecordsResponseFilter): Promise<EncryptedRecord[]>;
28+
encryptedRecords(recordsFilter: RecordSearchParams, responseFilter?: RecordsResponseFilter): Promise<EncryptedRecord[]>;
2929

3030
/**
31-
* Check if a list of serial numbers exist in the chosen provider
31+
* Check if a list of serial numbers exist in the chosen provider.
3232
*
3333
* @param {string[]} serialNumbers The serial numbers to check.
3434
* @returns {Promise<Record<string, boolean>>} Map of Aleo Record serial numbers and whether they appeared in any inputs on chain. If boolean corresponding to the Serial Number has a true value, that Record is considered spent by the Aleo Network.
3535
*/
3636
checkSerialNumbers(serialNumbers: string[]): Promise<Record<string, boolean>>;
3737

3838
/**
39-
* Check if a list of tags exist in the chosen provider
39+
* Check if a list of tags exist in the chosen provider.
4040
*
4141
* @param {string[]} tags The tags to check.
4242
* @returns {Promise<Record<string, boolean>>} Map of Aleo Record tags and whether they appeared in any inputs on chain. If boolean corresponding to the tag has a true value, that Record is considered spent by the Aleo Network.
4343
*/
4444
checkTags(tags: string[]): Promise<Record<string, boolean>>;
4545

4646
/**
47-
* Find a credits.aleo record with a given number of microcredits from the chosen provider
47+
* Find a credits.aleo record with a given number of microcredits from the chosen provider.
4848
*
4949
* @param {number} microcredits The number of microcredits to search for.
5050
* @param {RecordSearchParams} searchParameters Additional parameters to search for.
@@ -383,7 +383,7 @@ class NetworkRecordProvider implements RecordProvider {
383383
}));
384384
}
385385

386-
async encryptedRecords(recordsFilter: RecordSearchParams, responseFilter: RecordsResponseFilter): Promise<EncryptedRecord[]> {
386+
async encryptedRecords(recordsFilter: RecordSearchParams, responseFilter?: RecordsResponseFilter): Promise<EncryptedRecord[]> {
387387
throw new Error("Not implemented");
388388
}
389389

0 commit comments

Comments
 (0)