feat(sdk): add indexer discovery provider - #485
Conversation
c39f895 to
a4f635d
Compare
c3b7a9e to
6a30266
Compare
3450fc6 to
1f8f07a
Compare
6a30266 to
6389d72
Compare
2cea1ef to
72c5023
Compare
6389d72 to
3db203d
Compare
8e1a256 to
2590756
Compare
Yoni-Starkware
left a comment
There was a problem hiding this comment.
@Yoni-Starkware reviewed 4 files and all commit messages, and made 1 comment.
Reviewable status: 4 of 7 files reviewed, 1 unresolved discussion (waiting on ittaysw and m-kus).
sdk/src/internal/indexer-discovery.ts line 136 at r1 (raw file):
} else if (lastKnownBlock) { body.last_known_block = lastKnownBlock; }
Note that you're not enforcing this on the Rust side
Code quote:
if (blockRef) {
body.block_ref = blockRef;
} else if (lastKnownBlock) {
body.last_known_block = lastKnownBlock;
}2590756 to
f6f51d2
Compare
94836e6 to
97c6d65
Compare
f6f51d2 to
88b351e
Compare
88b351e to
b9915cf
Compare
97c6d65 to
9022d3a
Compare
b9915cf to
48f2d7e
Compare
m-kus
left a comment
There was a problem hiding this comment.
@m-kus resolved 1 discussion.
Reviewable status: 3 of 8 files reviewed, all discussions resolved (waiting on ittaysw and Yoni-Starkware).
Yoni-Starkware
left a comment
There was a problem hiding this comment.
@Yoni-Starkware partially reviewed 1 file and made 1 comment.
Reviewable status: 4 of 8 files reviewed, 1 unresolved discussion (waiting on ittaysw and m-kus).
sdk/src/internal/indexer-discovery.ts line 538 at r2 (raw file):
const sender = BigInt(n.sender_addr); const channelKey = channelKeyMap.get(n.sender_addr) ?? existingChannels.get(sender)?.channelKey ?? 0n;
Is this reachable? should we throw an error instead?
Code quote:
0n;48f2d7e to
f6b4bbc
Compare
m-kus
left a comment
There was a problem hiding this comment.
@m-kus made 1 comment.
Reviewable status: 3 of 8 files reviewed, 1 unresolved discussion (waiting on ittaysw and Yoni-Starkware).
sdk/src/internal/indexer-discovery.ts line 538 at r2 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
Is this reachable? should we throw an error instead?
Done.
f6b4bbc to
08cc49a
Compare
Yoni-Starkware
left a comment
There was a problem hiding this comment.
@Yoni-Starkware made 2 comments and resolved 1 discussion.
Reviewable status: 3 of 8 files reviewed, 2 unresolved discussions (waiting on ittaysw and m-kus).
sdk/src/internal/indexer-discovery.ts line 238 at r2 (raw file):
subchannel_discovery_complete: false, subchannels, };
Please share this code
Code quote:
for (const [token, nonces] of existing.tokens) {
subchannels[toHex(token)] = {
last_note_index: nonces.noteNonce > 0 ? nonces.noteNonce - 1 : undefined,
};
}
}
apiCursor.channels![toHex(rb)] = {
channel_key: toHex(info.key),
subchannel_discovery_complete: false,
subchannels,
};sdk/src/internal/indexer-discovery.ts line 375 at r4 (raw file):
apiCursor.channels![toHex(sender)] = { channel_key: toHex(icc.channelKey), subchannel_discovery_complete: !!tokenFilter,
What if you have a token in your filter, but no notes from this token in noteIndexes? don't you need to discover subchannels in this case?
Code quote:
subchannel_discovery_complete: !!tokenFilter,08cc49a to
6f0b5d9
Compare
m-kus
left a comment
There was a problem hiding this comment.
@m-kus made 1 comment and resolved 1 discussion.
Reviewable status: 3 of 8 files reviewed, 1 unresolved discussion (waiting on ittaysw and Yoni-Starkware).
sdk/src/internal/indexer-discovery.ts line 375 at r4 (raw file):
Previously, Yoni-Starkware (Yoni) wrote…
What if you have a token in your filter, but no notes from this token in
noteIndexes? don't you need to discover subchannels in this case?
Done.
Yoni-Starkware
left a comment
There was a problem hiding this comment.
@Yoni-Starkware reviewed 5 files and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on ittaysw).
6f0b5d9 to
fb5dc93
Compare

TL;DR
Add IndexerDiscoveryProvider to support discovery via the indexer API, with reorg handling and cursor-based pagination.
What changed?
IndexerDiscoveryProviderimplementation that communicates with the discovery service APIActionCompilerThis change is