-
Notifications
You must be signed in to change notification settings - Fork 31
[WIP]Indexer #524
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
base: master
Are you sure you want to change the base?
[WIP]Indexer #524
Changes from all commits
01b15ae
f067afe
5b8f528
216cd39
988f96e
2540395
6fc9c80
e80f819
1311785
3c8b802
d00b843
5a47ad3
4b44911
ee11775
b512da3
57e2978
97f6f3b
91d7e3f
cd50656
d8b6809
c28bb48
eaa302a
fe47190
4576949
3010197
845fd8f
36effad
ccbaaa1
f7974f4
ef64ae4
d119966
aea61bc
b1978dc
ae9e3d3
85b3098
0e8640c
6024b68
144a46b
cb3a337
d893ee7
20aa611
49b51d5
1463fbe
f6ff2dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"title": "ark/v1/new_types.proto", | ||
"version": "version not set" | ||
}, | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"paths": {}, | ||
"definitions": { | ||
"protobufAny": { | ||
"type": "object", | ||
"properties": { | ||
"@type": { | ||
"type": "string" | ||
} | ||
}, | ||
"additionalProperties": {} | ||
}, | ||
"rpcStatus": { | ||
"type": "object", | ||
"properties": { | ||
"code": { | ||
"type": "integer", | ||
"format": "int32" | ||
}, | ||
"message": { | ||
"type": "string" | ||
}, | ||
"details": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"$ref": "#/definitions/protobufAny" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
syntax = "proto3"; | ||
|
||
package ark.v1; | ||
|
||
import "google/api/annotations.proto"; | ||
|
||
service IndexerService { | ||
rpc GetCommitmentTx(GetCommitmentTxRequest) returns (GetCommitmentTxResponse) { | ||
option (google.api.http) = { | ||
get: "/v1/commitmentTx/{txid}" | ||
}; | ||
}; | ||
rpc GetVtxoTree(GetVtxoTreeRequest) returns (GetVtxoTreeResponse) { | ||
option (google.api.http) = { | ||
get: "/v1/batch/{batch_outpoint.txid}/{batch_outpoint.vout}/tree" | ||
}; | ||
}; | ||
rpc GetForfeitTxs(GetForfeitTxsRequest) returns (GetForfeitTxsResponse) { | ||
option (google.api.http) = { | ||
get: "/v1/batch/{batch_outpoint.txid}/{batch_outpoint.vout}/forfeitTxs" | ||
}; | ||
}; | ||
rpc GetConnectors(GetConnectorsRequest) returns (GetConnectorsResponse) { | ||
option (google.api.http) = { | ||
get: "/v1/batch/{batch_outpoint.txid}/{batch_outpoint.vout}/connectors" | ||
}; | ||
}; | ||
rpc GetSpendableVtxos(GetSpendableVtxosRequest) returns (GetSpendableVtxosResponse) { | ||
option (google.api.http) = { | ||
get: "/v1/spendableVtxos/{address}" | ||
}; | ||
}; | ||
rpc GetTransactionHistory(GetTransactionHistoryRequest) returns (GetTransactionHistoryResponse) { | ||
option (google.api.http) = { | ||
get: "/v1/history/{address}" | ||
}; | ||
}; | ||
rpc GetVtxoChain(GetVtxoChainRequest) returns (GetVtxoChainResponse) { | ||
option (google.api.http) = { | ||
get: "/v1/vtxo/{outpoint.txid}/{outpoint.vout}/chain" | ||
}; | ||
} | ||
rpc GetVirtualTxs(GetVirtualTxsRequest) returns (GetVirtualTxsResponse) { | ||
option (google.api.http) = { | ||
get: "/v1/virtualTx/{txids}" | ||
}; | ||
} | ||
rpc GetSweptCommitmentTx(GetSweptCommitmentTxRequest) returns (GetSweptCommitmentTxResponse) { | ||
option (google.api.http) = { | ||
get: "/v1/commitmentTx/{txid}/swept" | ||
}; | ||
} | ||
} | ||
|
||
message GetCommitmentTxRequest { | ||
string txid = 1; | ||
} | ||
message GetCommitmentTxResponse { | ||
int64 started_at = 1; | ||
int64 ended_at = 2; | ||
map<uint32, IndexerBatch> batches = 3; | ||
} | ||
|
||
message GetVtxoTreeRequest { | ||
IndexerOutpoint batch_outpoint = 1; | ||
IndexerPageRequest page = 2; | ||
} | ||
message GetVtxoTreeResponse { | ||
repeated IndexerNode vtxo_tree = 1; | ||
IndexerPageResponse page = 2; | ||
} | ||
|
||
message GetForfeitTxsRequest { | ||
IndexerOutpoint batch_outpoint = 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would do on a commitment tx level |
||
IndexerPageRequest page = 2; | ||
} | ||
message GetForfeitTxsResponse { | ||
repeated string txs = 1; | ||
IndexerPageResponse page = 2; | ||
} | ||
|
||
message GetConnectorsRequest { | ||
IndexerOutpoint batch_outpoint = 1; | ||
IndexerPageRequest page = 2; | ||
} | ||
message GetConnectorsResponse { | ||
repeated IndexerNode connectors = 1; | ||
IndexerPageResponse page = 2; | ||
} | ||
|
||
message GetSpendableVtxosRequest { | ||
string address = 1; | ||
IndexerPageRequest page = 2; | ||
} | ||
message GetSpendableVtxosResponse { | ||
repeated IndexerVtxo vtxos = 1; | ||
IndexerPageResponse page = 2; | ||
} | ||
|
||
message GetTransactionHistoryRequest { | ||
string address = 1; | ||
int64 start_time = 2; | ||
int64 end_time = 3; | ||
IndexerPageRequest page = 4; | ||
} | ||
message GetTransactionHistoryResponse { | ||
repeated IndexerTxHistoryRecord history = 1; | ||
IndexerPageResponse page = 2; | ||
} | ||
|
||
message GetVtxoChainRequest { | ||
IndexerOutpoint outpoint = 1; | ||
IndexerPageRequest page = 2; | ||
} | ||
message GetVtxoChainResponse { | ||
map<string, IndexerTransactions> graph = 1; | ||
IndexerPageResponse page = 2; | ||
} | ||
|
||
message GetVirtualTxsRequest { | ||
repeated string txids = 1; | ||
IndexerPageRequest page = 2; | ||
} | ||
message GetVirtualTxsResponse { | ||
repeated string txs = 1; | ||
IndexerPageResponse page = 2; | ||
} | ||
|
||
message GetSweptCommitmentTxRequest { | ||
string txid = 1; | ||
} | ||
message GetSweptCommitmentTxResponse { | ||
repeated string swept_by = 1; | ||
} | ||
|
||
message SubscribeForAddressesRequest { | ||
repeated string addresses = 1; | ||
} | ||
message SubscribeForAddressesResponse { | ||
string address = 1; | ||
repeated IndexerVtxo new_vtxos = 2; | ||
altafan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
repeated IndexerVtxo spent_vtxos = 3; | ||
} | ||
|
||
message IndexerTransactions { | ||
repeated IndexerChain txs = 1; | ||
int64 expires_at = 2; | ||
} | ||
|
||
message IndexerBatch { | ||
uint64 total_batch_amount = 1; | ||
uint64 total_forfeit_amount = 2; | ||
int32 total_input_vtxos = 3; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought we were removing this type (inputs) of data from the indexer? I would also move them from being batch specific to CommitmentTx level There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i prefer redundancy here and have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's say a multi batch tx happens and: These 0.5 VTXOs potentially end up in 2 different batches. There is only one forfeit. Only a total_input_vtxos on GetCommitmentTx would make sense. When a round is being done, intents should be on the round, batches only dictate vtxo and tree signing, but the forfeiture is on a commitment tx scope? |
||
int32 total_output_vtxos = 4; | ||
int64 expires_at = 5; | ||
bool swept = 6; | ||
} | ||
|
||
message IndexerOutpoint { | ||
string txid = 1; | ||
uint32 vout = 2; | ||
} | ||
|
||
message IndexerNode { | ||
string txid = 1; | ||
string parent_txid = 3; | ||
int32 level = 4; | ||
int32 level_index = 5; | ||
} | ||
|
||
message IndexerVtxo { | ||
IndexerOutpoint outpoint = 1; | ||
int64 created_at = 2; | ||
int64 expires_at = 3; | ||
uint64 amount = 4; | ||
string script = 5; | ||
bool is_leaf = 6; | ||
bool is_swept = 7; | ||
bool is_spent = 8; | ||
string spent_by = 9; | ||
} | ||
|
||
message IndexerChain { | ||
string txid = 1; | ||
IndexerChainedTxType type = 2; | ||
} | ||
|
||
message IndexerTxHistoryRecord { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This message confuses me quite a bit:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would introduce a way to fetch all effected vtxos with each record, something similar to the |
||
oneof key { | ||
string commitment_txid = 1; | ||
string virtual_txid = 2; | ||
} | ||
IndexerTxType type = 3; | ||
uint64 amount = 4; | ||
int64 created_at = 5; | ||
int64 confirmed_at = 6; | ||
bool is_settled = 7; | ||
} | ||
|
||
enum IndexerTxType { | ||
INDEXER_TX_TYPE_UNSPECIFIED = 0; | ||
INDEXER_TX_TYPE_RECEIVED = 1; | ||
INDEXER_TX_TYPE_SENT = 2; | ||
INDEXER_TX_TYPE_SWEEP = 3; | ||
} | ||
|
||
enum IndexerChainedTxType { | ||
INDEXER_CHAINED_TX_TYPE_UNSPECIFIED = 0; | ||
INDEXER_CHAINED_TX_TYPE_VIRTUAL = 1; | ||
INDEXER_CHAINED_TX_TYPE_COMMITMENT = 2; | ||
} | ||
|
||
message IndexerPageRequest { | ||
int32 size = 1; | ||
int32 index = 2; | ||
} | ||
|
||
message IndexerPageResponse { | ||
int32 current = 1; | ||
int32 next = 2; | ||
int32 total = 3; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally find this call a bit limiting. Why not be
GetVtxos
andGetVtxosRequest
would have extra filters ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we would have 2 lists in the response that would make the pagination tricky/impossible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why 2 lists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the IndexerVtxo holds enough data that you can return a flat list