-
Notifications
You must be signed in to change notification settings - Fork 478
Update to RecordProvider Interface #1074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
alexpitsikoulis
merged 14 commits into
mainnet
from
feat/upgraded-record-provider-interface
Sep 22, 2025
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4f083e5
wip: started upgrade to record provider interface and started record …
alexpitsikoulis 83fbe54
moved record provider types to models dir. moved nonces out of record…
alexpitsikoulis 9170df5
added jsdoc comments to record provider/scanner types
alexpitsikoulis 8a4df53
fixed failing record provider tests
alexpitsikoulis 49577dd
fixed casing of fields on OwnedRecord and EncryptedRecord types
alexpitsikoulis 8e14c99
corrected fields in RecordsFilter interface
alexpitsikoulis 2572192
updated encryptedRecords function to mirror changes made to the endpo…
alexpitsikoulis 691f71b
changed program to programs in RecordsFilter
alexpitsikoulis f541996
fixed outdated test case for invalid transaction id API response
alexpitsikoulis 39675bf
added optional apiKey field to RecordScanner
alexpitsikoulis 2549a9d
changed api key field on RecordScanner to be able to accept either a …
alexpitsikoulis 3b345ba
removed concrete record scanner impl
alexpitsikoulis 71654fb
Add missing fields to documentation and objects
iamalwaysuncomfortable 957f8c8
corrected boolean type name in ownedFilter.ts
alexpitsikoulis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* 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. | ||
* | ||
* @property {string} commitment - The commitment of the record. | ||
* @property {string | undefined} checksum - The checksum of the record. | ||
* @property {number | undefined} block_height - The block height of the record. | ||
* @property {number | undefined} block_timestamp - The block timestamp of the record. | ||
* @property {string | undefined} program_name - The name of the program that produced the record. | ||
* @property {string | undefined} function_name - The name of the function that produced the record. | ||
* @property {number | undefined} output_index - The output index of the record. | ||
* @property {string | undefined} owner - The owner of the record. | ||
* @property {string | undefined} record_ciphertext - The ciphertext of the record. | ||
* @property {string | undefined} record_name - The name of the record. | ||
* @property {string | undefined} record_nonce - The nonce of the record. | ||
iamalwaysuncomfortable marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* @property {string | undefined} sender_ciphertext - The ciphertext of the sender. | ||
* @property {string | undefined} transaction_id - The ID of the transaction that produced the record. | ||
* @property {string | undefined} transition_id - The ID of the transition that produced the record. | ||
* @property {number | undefined} transaction_index - The index of the transaction that produced the record. | ||
* @property {number | undefined} transition_index - The index of the transition that produced the record. | ||
* | ||
* @example | ||
* const encryptedRecord: EncryptedRecord = { | ||
* commitment: "1754131901135854615627743152473414463769543922079966020586765988138574911385field", | ||
* checksum: "731623304764338277682996290553427512270277231686866672455141481050283829616field", | ||
* block_height: 123456, | ||
iamalwaysuncomfortable marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* block_timestamp: 1725845998, | ||
* program_name: "credits.aleo", | ||
* function_name: "transfer_private", | ||
* output_index: 0, | ||
* owner: "ciphertext1qgqdetlfzk98jkm4e7sgqml66e3x2gpg5d6udkpw0g67z0tplkpmzrm6q5dyfd7xhgmhedvptxzwfhrtxaqn7n0hs0esge3lwg9s2zukqgzxd0cr", | ||
* record_ciphertext: "record1qyqsqt43u9kp97svljyyup3v4jmppd0vgght9edvvmtxx6mxycsej8cwqsrxzmt0w4h8ggcqqgqspf8zqut2ycnap7f0uzz5ktu0cxscca96urtkg2aweuzn70787dsrpp6x76m9de0kjezrqqpqyqp3mn3xeh53lukvcy406amjf5g0ksl3saauzjk0j4ljtjqq6kqlqhdz05sw92zye96qym7kp83ra0eesgtwhaw37c85r499456se8ts28m90p6x2unwv9k97ct4w35x7unf0fshg6t0de0hyet3w45hyetyyvqqyqgq4t2wr9tmcrfha5tfz5j585ptvvslqe0f6sf29vytshhdh7ym05rpqct4w35x7unf0fjkghm4de6xjmprqqpqzqru6p7fef29vuz6smyqwcn3z7jhxtdgjdw5xv23ppxhpgnvu72fp8hz6fjt6gsdn8yxhzq7gpsah0rscwqrzxwl5e8aemkj5gt09y7q5506yrf", | ||
* record_name: "credits", | ||
* record_nonce: "3077450429259593211617823051143573281856129402760267155982965992208217472983group", | ||
iamalwaysuncomfortable marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* sender_ciphertext: "1754131901135854615627743152473414463769543922079966020586765988138574911385field", | ||
* transaction_id: "at1f8ueqxu3x49sckpc6jlg676tmxumddzer3fwe2l0dxwj4dqxygyqua4u2q", | ||
* transition_id: "au17mm5v7sfwus6y40xsyc99d5rtsr4vsajdec6twdjzv0m458q85zspqdnka", | ||
* transaction_index: 0, | ||
* transition_index: 0, | ||
* } | ||
*/ | ||
export type EncryptedRecord = { | ||
alexpitsikoulis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
commitment: string; | ||
checksum?: string; | ||
block_height?: number; | ||
iamalwaysuncomfortable marked this conversation as resolved.
Show resolved
Hide resolved
|
||
block_timestamp?: number; | ||
program_name?: string; | ||
function_name?: string; | ||
output_index?: number; | ||
owner?: string; | ||
record_ciphertext?: string; | ||
record_name?: string; | ||
record_nonce?: string; | ||
iamalwaysuncomfortable marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sender_ciphertext?: string; | ||
transaction_id?: string; | ||
transition_id?: string; | ||
transaction_index?: number; | ||
transition_index?: number; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* 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. | ||
* | ||
* @property {number | undefined} block_height - Block height where the record was created. | ||
iamalwaysuncomfortable marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* @property {number | undefined} block_timestamp - The timestamp of the block that the record was created in. | ||
* @property {string | undefined} commitment - Commitment of the record. | ||
* @property {string | undefined} function_name - Name of the function that created the record. | ||
* @property {number | undefined} output_index - Index of the output in the function call that created the record. | ||
* @property {string | undefined} owner - Address of the record owner. | ||
* @property {string | undefined} program_name - Name of the program that created the record. | ||
* @property {string | undefined} record_ciphertext - Encrypted ciphertext of the record. | ||
* @property {string | undefined} record_name - Name of the record. | ||
iamalwaysuncomfortable marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* @property {string | undefined} sender - Address of the sender. | ||
* @property {boolean | undefined} spent - Whether the record has been spent. | ||
* @property {string | undefined} tag - Tag associated with the record. | ||
* @property {string | undefined} transaction_id - ID of the transaction that created the record. | ||
* @property {string | undefined} transition_id - ID of the transition that created the record. | ||
* @property {string | undefined} transaction_index - Index of the transaction in the block. | ||
* @property {string | undefined} transition_index - Index of the transition in the transaction. | ||
* | ||
* @example | ||
* const ownedRecord: OwnedRecord = { | ||
* block_height: 123456, | ||
iamalwaysuncomfortable marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* block_timestamp: 1725845998, | ||
* commitment: "1754131901135854615627743152473414463769543922079966020586765988138574911385field", | ||
* function_name: "transfer_public_to_private", | ||
* output_index: 0, | ||
* owner: "ciphertext1qgqdetlfzk98jkm4e7sgqml66e3x2gpg5d6udkpw0g67z0tplkpmzrm6q5dyfd7xhgmhedvptxzwfhrtxaqn7n0hs0esge3lwg9s2zukqgzxd0cr", | ||
* program_name: "credits.aleo", | ||
* record_ciphertext: "record1qyqsqt43u9kp97svljyyup3v4jmppd0vgght9edvvmtxx6mxycsej8cwqsrxzmt0w4h8ggcqqgqspf8zqut2ycnap7f0uzz5ktu0cxscca96urtkg2aweuzn70787dsrpp6x76m9de0kjezrqqpqyqp3mn3xeh53lukvcy406amjf5g0ksl3saauzjk0j4ljtjqq6kqlqhdz05sw92zye96qym7kp83ra0eesgtwhaw37c85r499456se8ts28m90p6x2unwv9k97ct4w35x7unf0fshg6t0de0hyet3w45hyetyyvqqyqgq4t2wr9tmcrfha5tfz5j585ptvvslqe0f6sf29vytshhdh7ym05rpqct4w35x7unf0fjkghm4de6xjmprqqpqzqru6p7fef29vuz6smyqwcn3z7jhxtdgjdw5xv23ppxhpgnvu72fp8hz6fjt6gsdn8yxhzq7gpsah0rscwqrzxwl5e8aemkj5gt09y7q5506yrf", | ||
* record_plaintext: "{ owner: aleo1j7qxyunfldj2lp8hsvy7mw5k8zaqgjfyr72x2gh3x4ewgae8v5gscf5jh3.private, microcredits: 1500000000000000u64.private, _nonce: 3077450429259593211617823051143573281856129402760267155982965992208217472983group.public , _version: 1u8 }", | ||
* record_name: "credits", | ||
* spent: true, | ||
iamalwaysuncomfortable marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* sender: "aleo1sf5kk4f8mcmgjasw9fannmm0h8z2nwqxu5e200cjneu28jxvtvpqulfxsa", | ||
* tag: "6511661650536816422260305447175136877451468301541296257226129781611237851030field", | ||
* transaction_id: "at1f8ueqxu3x49sckpc6jlg676tmxumddzer3fwe2l0dxwj4dqxygyqua4u2q", | ||
* transition_id: "au17mm5v7sfwus6y40xsyc99d5rtsr4vsajdec6twdjzv0m458q85zspqdnka", | ||
* transaction_index: 0, | ||
* transition_index: 0, | ||
* } | ||
*/ | ||
export type OwnedRecord = { | ||
block_height?: number; | ||
iamalwaysuncomfortable marked this conversation as resolved.
Show resolved
Hide resolved
|
||
block_timestamp?: number; | ||
commitment?: string; | ||
function_name?: string; | ||
output_index?: number; | ||
owner?: string; | ||
program_name?: string; | ||
record_ciphertext?: string; | ||
record_plaintext?: string; | ||
record_name?: string; | ||
sender?: string; | ||
spent?: boolean; | ||
iamalwaysuncomfortable marked this conversation as resolved.
Show resolved
Hide resolved
|
||
tag?: string; | ||
transaction_id?: string; | ||
transition_id?: string; | ||
transaction_index?: number; | ||
transition_index?: number; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Interface for record search parameters. This allows for arbitrary search parameters to be passed to record provider | ||
* implementations. | ||
* | ||
* @example | ||
* const recordSearchParams: RecordSearchParams = { | ||
* // Declared fields | ||
* unspent: true, | ||
* nonces: ["3077450429259593211617823051143573281856129402760267155982965992208217472983group"], | ||
* // Arbitrary fields | ||
* startHeight: 123456, | ||
* programName: "credits.aleo" | ||
* } | ||
*/ | ||
export interface RecordSearchParams { | ||
unspent?: boolean; | ||
nonces?: string[]; | ||
[key: string]: any; // This allows for arbitrary keys with any type values | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { RecordSearchParams } from "../record-provider/recordSearchParams"; | ||
import { RecordsFilter } from "./recordsFilter"; | ||
import { OwnedRecordsResponseFilter } from "./ownedRecordsResponseFilter"; | ||
|
||
/** | ||
* OwnedFilter is an extension of RecordSearchParams that represents a filter for scanning owned records. | ||
* | ||
* @example | ||
* const ownedFilter: OwnedFilter = { | ||
* unspent: true, | ||
* nonces: ["3077450429259593211617823051143573281856129402760267155982965992208217472983group"], | ||
* decrypt: true, | ||
* filter: { | ||
* program: "credits.aleo", | ||
* record: "credits", | ||
* }, | ||
* } | ||
*/ | ||
export interface OwnedFilter extends RecordSearchParams { | ||
decrypt?: boolean; | ||
filter?: RecordsFilter; | ||
responseFilter?: OwnedRecordsResponseFilter; | ||
unspent?: boolean; | ||
uuid?: string; | ||
iamalwaysuncomfortable marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
42 changes: 42 additions & 0 deletions
42
sdk/src/models/record-scanner/ownedRecordsResponseFilter.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* OwnedRecordsResponseFilter is a type that represents a filter for the response from a record provider. | ||
* A `true` value for a field in the filter will include that field in the response. | ||
* | ||
* @example | ||
* const ownedRecordsResponseFilter: OwnedRecordsResponseFilter = { | ||
* commitment: true, | ||
* owner: true, | ||
* tag: true, | ||
* sender: true, | ||
* spent: true, | ||
* record_ciphertext: true, | ||
* block_height: true, | ||
* block_timestamp: true, | ||
* output_index: true, | ||
* record_name: true, | ||
* function_name: true, | ||
* program_name: true, | ||
* transition_id: true, | ||
* transaction_id: true, | ||
* transaction_index: true, | ||
* transition_index: true, | ||
* } | ||
*/ | ||
export interface OwnedRecordsResponseFilter { | ||
commitment?: boolean; | ||
owner?: boolean; | ||
tag?: boolean; | ||
sender?: boolean; | ||
spent?: boolean; | ||
record_ciphertext?: boolean; | ||
block_height?: boolean; | ||
block_timestamp?: boolean; | ||
output_index?: boolean; | ||
record_name?: boolean; | ||
function_name?: boolean; | ||
program_name?: boolean; | ||
transition_id?: boolean; | ||
transaction_id?: boolean; | ||
transaction_index?: boolean; | ||
transition_index?: boolean; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { RecordSearchParams } from "../record-provider/recordSearchParams"; | ||
import { RecordsResponseFilter } from "./recordsResponseFilter"; | ||
|
||
/** | ||
* RecordsFilter is an extension of RecordSearchParams that represents a filter for scanning encrypted or owned records. | ||
* | ||
* @example | ||
* const recordsFilter: RecordsFilter = { | ||
* start: 0, | ||
* end: 100, | ||
* programs: ["credits.aleo"], | ||
* records: ["credits"], | ||
* functions: ["transfer_public_to_private"], | ||
* response: { | ||
* program: true, | ||
* record: true, | ||
* function: true, | ||
* transition: true, | ||
* block_height: true, | ||
* transaction_id: true, | ||
* } | ||
* results_per_page: 100, | ||
* page: 0, | ||
* } | ||
*/ | ||
export interface RecordsFilter extends RecordSearchParams { | ||
alexpitsikoulis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
commitments?: string[]; | ||
response?: RecordsResponseFilter; | ||
start?: number; | ||
end?: number; | ||
programs?: string[]; | ||
records?: string[]; | ||
functions?: string[]; | ||
results_per_page?: number; | ||
page?: number; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** | ||
* RecordsResponseFilter is a type that represents a filter for the response from a record provider. | ||
* A `true` value for a field in the filter will include that field in the response. | ||
* | ||
* @example | ||
* const recordsResponseFilter: RecordsResponseFilter = { | ||
* block_height: true, | ||
* checksum: true, | ||
* commitment: true, | ||
* record_ciphertext: true, | ||
* function_name: true, | ||
* nonce: true, | ||
* output_index: true, | ||
* owner: true, | ||
* program_name: true, | ||
* record_name: true, | ||
* transaction_id: true, | ||
* transition_id: true, | ||
* transaction_index: true, | ||
* transition_index: true, | ||
* } | ||
*/ | ||
export type RecordsResponseFilter = { | ||
blockHeight?: boolean; | ||
checksum?: boolean; | ||
commitment?: boolean; | ||
record_ciphertext?: boolean; | ||
function_name?: boolean; | ||
nonce?: boolean; | ||
output_index?: boolean; | ||
owner?: boolean; | ||
program_name?: boolean; | ||
record_name?: boolean; | ||
transaction_id?: boolean; | ||
transition_id?: boolean; | ||
transaction_index?: boolean; | ||
transition_index?: boolean; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* RegistrationRequest is a type that represents a request to register an account's view key with a record scanning service. | ||
* | ||
* @example | ||
* const registrationRequest: RegistrationRequest = { | ||
* view_key: "AViewKey1ccEt8A2Ryva5rxnKcAbn7wgTaTsb79tzkKHFpeKsm9NX", | ||
* start: 123456, | ||
* } | ||
*/ | ||
export type RegistrationRequest = { | ||
view_key: string; | ||
start: number; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* RegistrationResponse is a type that represents a response from a record scanning service. | ||
* | ||
* @example | ||
* const registrationResponse: RegistrationResponse = { | ||
* uuid: "5291249998620209321712738612705518874926462927543783711572375085855029172391field", | ||
* job_id: "3019177021147406178755252788128212930359855601860174268911518336835545087409field", | ||
* status: "pending", | ||
* } | ||
*/ | ||
interface RegistrationResponse { | ||
uuid: string, | ||
job_id?: string, | ||
status?: string | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.