Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
3ffd3b5
add single-connection GetSubscription flow and UpdateSubscriptionScri…
bitcoin-coder-bob Mar 3, 2026
f5d0807
lint fix
bitcoin-coder-bob Mar 4, 2026
fb8b4e7
add single-connection subscription support to indexer gRPC client and…
bitcoin-coder-bob Mar 4, 2026
f725895
proto comment for scripts field
bitcoin-coder-bob Mar 5, 2026
c415a5f
fix subscription HTTP binding, permissions, error handling, client cl…
bitcoin-coder-bob Mar 6, 2026
ceaecd7
remove script len check
bitcoin-coder-bob Mar 9, 2026
937f4a9
remove script validation, test against it
bitcoin-coder-bob Mar 9, 2026
c548079
make modify subscription scripts atomic by validating all inputs befo…
bitcoin-coder-bob Mar 9, 2026
5d28cb7
Merge branch 'master' into bob/stream-single-connection
bitcoin-coder-bob Mar 18, 2026
d2c6527
Merge remote-tracking branch 'origin/master' into bob/stream-single-c…
bitcoin-coder-bob Mar 19, 2026
b2d81b7
Removed scripts cache per commented request
bitcoin-coder-bob Mar 20, 2026
6232c5b
Merge remote-tracking branch 'origin/master' into bob/stream-single-c…
bitcoin-coder-bob Apr 2, 2026
b9d7896
Merge master into bob/stream-single-connection
bitcoin-coder-bob Apr 14, 2026
7e30bba
merge master into bob/stream-single-connection
bitcoin-coder-bob Apr 15, 2026
8376755
Merge master into bob/stream-single-connection
bitcoin-coder-bob Apr 24, 2026
d8d6250
Merge master into bob/stream-single-connection
bitcoin-coder-bob May 11, 2026
442e92a
generalize UpdateSubscription RPC with pluggable filters
bitcoin-coder-bob May 19, 2026
c39614d
revert pkg/client-lib changes; moved to bob/client-lib-stream-changes
bitcoin-coder-bob May 20, 2026
23e30c4
use SubscriptionFilter for initial GetSubscription input
bitcoin-coder-bob May 20, 2026
36b9509
Update rest paths
altafan May 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 199 additions & 1 deletion api-spec/openapi/swagger/ark/v1/indexer.openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,60 @@
}
}
},
"/v1/indexer/script/subscription": {
"get": {
"tags": [
"IndexerService"
],
"description": "GetSubscription is a server-side streaming RPC which allows clients to receive real-time\nnotifications on transactions related to the subscribed vtxo scripts.\nThe subscription can be created or updated by using the SubscribeForScripts and\nUnsubscribeForScripts RPCs.",
"operationId": "IndexerService_GetSubscription2",
"parameters": [
{
"name": "subscriptionId",
"in": "query",
"description": "If empty, server creates a new subscription automatically.",
"schema": {
"type": "string"
}
},
{
"name": "scripts",
"in": "query",
"description": "Optional: scripts to subscribe to on stream creation.\nOnly used when subscription_id is empty; ignored otherwise.",
"style": "simple",
"schema": {
"minItems": 1,
"type": "array",
"items": {
"type": "string"
}
}
}
],
"responses": {
"200": {
"description": "a successful response. (streaming responses)",
"content": {
"text/event-stream": {
"schema": {
"$ref": "#/components/schemas/GetSubscriptionResponse"
}
}
}
},
"default": {
"description": "An unexpected error response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Status"
}
}
}
}
}
}
},
"/v1/indexer/script/subscription/{subscription_id}": {
"get": {
"tags": [
Expand All @@ -435,10 +489,24 @@
{
"name": "subscriptionId",
"in": "path",
"description": "If empty, server creates a new subscription automatically.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "scripts",
"in": "query",
"description": "Optional: scripts to subscribe to on stream creation.\nOnly used when subscription_id is empty; ignored otherwise.",
"style": "simple",
"schema": {
"minItems": 1,
"type": "array",
"items": {
"type": "string"
}
}
}
],
"responses": {
Expand Down Expand Up @@ -506,6 +574,47 @@
}
}
},
"/v1/indexer/script/updateScripts": {
"post": {
"tags": [
"IndexerService"
],
"description": "UpdateSubscriptionScripts allows to modify the scripts of an existing subscription\ncreated via GetSubscription.",
"operationId": "IndexerService_UpdateSubscriptionScripts",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateSubscriptionScriptsRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "a successful response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateSubscriptionScriptsResponse"
}
}
}
},
"default": {
"description": "An unexpected error response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Status"
}
}
}
}
}
}
},
"/v1/indexer/virtualTx/{txids}": {
"get": {
"tags": [
Expand Down Expand Up @@ -935,8 +1044,16 @@
"title": "GetSubscriptionRequest",
"type": "object",
"properties": {
"scripts": {
"type": "array",
"description": "Optional: scripts to subscribe to on stream creation.\nOnly used when subscription_id is empty; ignored otherwise.",
"items": {
"type": "string"
}
},
"subscriptionId": {
"type": "string"
"type": "string",
"description": "If empty, server creates a new subscription automatically."
}
}
},
Expand All @@ -949,6 +1066,9 @@
},
"heartbeat": {
"$ref": "#/components/schemas/IndexerHeartbeat"
},
"subscriptionStarted": {
"$ref": "#/components/schemas/SubscriptionStartedEvent"
}
}
},
Expand Down Expand Up @@ -1411,6 +1531,36 @@
}
}
},
"ModifyScripts": {
"title": "ModifyScripts",
"type": "object",
"properties": {
"addScripts": {
"type": "array",
"items": {
"type": "string"
}
},
"removeScripts": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"OverwriteScripts": {
"title": "OverwriteScripts",
"type": "object",
"properties": {
"scripts": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"Status": {
"title": "Status",
"type": "object",
Expand Down Expand Up @@ -1455,6 +1605,15 @@
}
}
},
"SubscriptionStartedEvent": {
"title": "SubscriptionStartedEvent",
"type": "object",
"properties": {
"subscriptionId": {
"type": "string"
}
}
},
"UnsubscribeForScriptsRequest": {
"title": "UnsubscribeForScriptsRequest",
"type": "object",
Expand All @@ -1474,6 +1633,45 @@
"UnsubscribeForScriptsResponse": {
"title": "UnsubscribeForScriptsResponse",
"type": "object"
},
"UpdateSubscriptionScriptsRequest": {
"title": "UpdateSubscriptionScriptsRequest",
"type": "object",
"properties": {
"modify": {
"$ref": "#/components/schemas/ModifyScripts"
},
"overwrite": {
"$ref": "#/components/schemas/OverwriteScripts"
},
"subscriptionId": {
"type": "string"
}
}
},
"UpdateSubscriptionScriptsResponse": {
"title": "UpdateSubscriptionScriptsResponse",
"type": "object",
"properties": {
"allScripts": {
"type": "array",
"items": {
"type": "string"
}
},
"scriptsAdded": {
"type": "array",
"items": {
"type": "string"
}
},
"scriptsRemoved": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
},
Expand Down
51 changes: 51 additions & 0 deletions api-spec/protobuf/ark/v1/indexer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,25 @@ service IndexerService {
disable_chunked_transfer: true
disable_websockets: true
}
additional_bindings: [
{
get: "/v1/indexer/script/subscription"
stream: {
disable_chunked_transfer: true
disable_websockets: true
}
}
]
};
};

// UpdateSubscriptionScripts allows to modify the scripts of an existing subscription
// created via GetSubscription.
rpc UpdateSubscriptionScripts(UpdateSubscriptionScriptsRequest)
returns (UpdateSubscriptionScriptsResponse) {
option (meshapi.gateway.http) = {
post: "/v1/indexer/script/updateScripts"
body: "*"
};
};
}
Expand Down Expand Up @@ -354,16 +373,48 @@ message UnsubscribeForScriptsResponse {}


message GetSubscriptionRequest {
// If empty, server creates a new subscription automatically.
string subscription_id = 1;
// Optional: scripts to subscribe to on stream creation.
// Only used when subscription_id is empty; ignored otherwise.
repeated string scripts = 2;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
Copy link
Copy Markdown
Collaborator

@altafan altafan May 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
repeated string scripts = 2;
SubscriptionFilter filter = 2;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 23e30c4

}

message GetSubscriptionResponse {
oneof data {
IndexerHeartbeat heartbeat = 1;
IndexerSubscriptionEvent event = 2;
SubscriptionStartedEvent subscription_started = 3;
}
}

message SubscriptionStartedEvent {
string subscription_id = 1;
}

message ModifyScripts {
repeated string add_scripts = 1;
repeated string remove_scripts = 2;
}

message OverwriteScripts {
repeated string scripts = 1;
}

message UpdateSubscriptionScriptsRequest {
string subscription_id = 1;
oneof scripts_change {
ModifyScripts modify = 2;
OverwriteScripts overwrite = 3;
}
}

message UpdateSubscriptionScriptsResponse {
repeated string scripts_added = 1;
repeated string scripts_removed = 2;
repeated string all_scripts = 3;
}

message IndexerTxData {
string txid = 1;
string tx = 2;
Expand Down
Loading
Loading