The branch feat/improve-sdk is including a solid draft of the upcoming ordinals-api re-architecture.
Instead of starting ordhook and registering ordinals-api as an http observer receiving payloads including ordinals inscriptions / transfers, the incoming version of ordinals-api will pull a NPM @hirosystems/ordhoook-sdk-js library and implement the following skeleton (present in components/ordhook-sdk-js/lib/test.ts:
import { OrdinalsIndexer } from "./index";
const indexer = new OrdinalsIndexer({
bitcoinRpcUrl: 'http://0.0.0.0:8332',
bitcoinRpcUsername: 'devnet',
bitcoinRpcPassword: 'devnet',
workingDirectory: '/Users/ludovic/ordhook-sdk-js',
logs: false
});
indexer.applyBlock(block => {
console.log(`Hello from JS ${JSON.stringify(block)}`);
});
indexer.undoBlock(block => {
console.log(`Hello from JS ${JSON.stringify(block)}`);
});
indexer.streamBlocks();
The OrdinalsIndexer struct can be fully piloted in Typescript. In case of migrations, the following actions can also be performed:
// Delete blocks and inscriptions
indexer.dropBlocks([32103, 32104]);
// Re-download + index blocks
indexer.rewriteBlocks([32103, 32104]);
// Sync blocks until chain tip
indexer.syncBlocks();
// Replay a list of blocks
indexer.replayBlocks([32103, 32104]);
The ordhook-sdk-js is producing a state (rocksdb+sqlite) identical to the one being produced by ordhook-cli. So a state produced by ordhook-cli can be reused by an app being built with ordhook-sdk-js and vice-versa.
Remaining work:
[ ] Wire dropBlocks method
[ ] Wire rewriteBlocks method
[ ] Wire syncBlocks method
[ ] Wire replayBlocks method
[ ] Manually publish ordhook-sdk-js on NPM for end to end testing
The branch
feat/improve-sdk
is including a solid draft of the upcomingordinals-api
re-architecture. Instead of startingordhook
and registeringordinals-api
as an http observer receiving payloads including ordinals inscriptions / transfers, the incoming version ofordinals-api
will pull a NPM@hirosystems/ordhoook-sdk-js
library and implement the following skeleton (present incomponents/ordhook-sdk-js/lib/test.ts
:The
OrdinalsIndexer
struct can be fully piloted in Typescript. In case of migrations, the following actions can also be performed:The
ordhook-sdk-js
is producing a state (rocksdb+sqlite) identical to the one being produced byordhook-cli
. So a state produced byordhook-cli
can be reused by an app being built withordhook-sdk-js
and vice-versa.Remaining work:
dropBlocks
methodrewriteBlocks
methodsyncBlocks
methodreplayBlocks
methodordhook-sdk-js
on NPM for end to end testingordhook-sdk-js
via CI