Skip to content

Commit 2209875

Browse files
[Feature] RecordScanner client (#1100)
* added RecordScanner class as an implementation of the RecordProvider interface * added unit tests for RecordScanner * added RecordScanner tests for findRecords and findRecord * added checkStatus method and its unit test to the RecordScanner object * corrected url for RecordScanner status request * [Feature] Domain separators (#1105) * Create domain separator in function in wasm * Give domain separator camelCase name * Add Record Scanner domain separator to SDK constants * added UUID computation to RecordScanner so theres no need to register each time a client spins up * removed account field from RecordScanner * added RecordScanner integration tests * corrected outdated client ip for CI * added .spec to record scanner integration test filename --------- Co-authored-by: Mike Turner <[email protected]>
1 parent 7d451a7 commit 2209875

File tree

13 files changed

+915
-10
lines changed

13 files changed

+915
-10
lines changed

create-leo-app/template-node/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ async function remoteProgramExecution(programName, functionName, inputs) {
6363
const keyProvider = new AleoKeyProvider();
6464
keyProvider.useCache(true);
6565

66-
const programManager = new ProgramManager("http://34.168.156.3:3030", keyProvider);
66+
const programManager = new ProgramManager("http://34.169.215.4:3030", keyProvider);
6767

6868
const tx = await programManager.buildExecutionTransaction(
6969
{

sdk/src/browser.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import {
5252
NetworkRecordProvider,
5353
RecordProvider,
5454
} from "./record-provider.js";
55+
import { RecordScanner } from "./record-scanner.js";
5556

5657
// @TODO: This function is no longer needed, remove it.
5758
async function initializeWasm() {
@@ -126,6 +127,7 @@ export {
126127
PUBLIC_TRANSFER,
127128
PUBLIC_TRANSFER_AS_SIGNER,
128129
PUBLIC_TO_PRIVATE_TRANSFER,
130+
RECORD_DOMAIN,
129131
VALID_TRANSFER_TYPES,
130132
} from "./constants.js";
131133

@@ -177,6 +179,7 @@ export {
177179
RecordsFilter,
178180
RecordsResponseFilter,
179181
RecordProvider,
182+
RecordScanner,
180183
RecordSearchParams,
181184
SolutionJSON,
182185
SolutionsJSON,

sdk/src/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,5 @@ export const PUBLIC_TO_PRIVATE_TRANSFER = new Set([
111111
"transfer_public_to_private",
112112
"transferPublicToPrivate",
113113
]);
114+
115+
export const RECORD_DOMAIN = "RecordScannerV0";

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* @example
66
* const recordsResponseFilter: RecordsResponseFilter = {
77
* block_height: true,
8+
* block_timestamp: true,
89
* checksum: true,
910
* commitment: true,
1011
* record_ciphertext: true,
@@ -14,17 +15,20 @@
1415
* owner: true,
1516
* program_name: true,
1617
* record_name: true,
18+
* sender_ciphertext: true,
1719
* transaction_id: true,
1820
* transition_id: true,
1921
* transaction_index: true,
2022
* transition_index: true,
2123
* }
2224
*/
2325
export type RecordsResponseFilter = {
24-
blockHeight?: boolean;
26+
block_height?: boolean;
27+
block_timestamp?: boolean;
2528
checksum?: boolean;
2629
commitment?: boolean;
2730
record_ciphertext?: boolean;
31+
sender_ciphertext?: boolean;
2832
function_name?: boolean;
2933
nonce?: boolean;
3034
output_index?: boolean;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* RegistrationResponse is a type that represents a response from a record scanning service.
2+
* RegistrationResponse is a type that represents a response from a record scanning service's registration endpoint.
33
*
44
* @example
55
* const registrationResponse: RegistrationResponse = {
@@ -8,7 +8,7 @@
88
* status: "pending",
99
* }
1010
*/
11-
interface RegistrationResponse {
11+
export interface RegistrationResponse {
1212
uuid: string,
1313
job_id?: string,
1414
status?: string
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* StatusResponse is a type that represents a response from a record scanning service's status endpoint.
3+
*
4+
* @example
5+
* const statusResponse: StatusResponse = {
6+
* synced: true,
7+
* percentage: 100,
8+
* }
9+
*/
10+
export interface StatusResponse {
11+
synced: boolean;
12+
percentage: number;
13+
}

0 commit comments

Comments
 (0)