Skip to content

Commit 42d267d

Browse files
committed
revert chainedTxType, rename and add checkpoint type
1 parent 8c506d4 commit 42d267d

File tree

8 files changed

+551
-294
lines changed

8 files changed

+551
-294
lines changed

api-spec/openapi/swagger/ark/v1/indexer.swagger.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -932,9 +932,22 @@
932932
"expiresAt": {
933933
"type": "string",
934934
"format": "int64"
935+
},
936+
"type": {
937+
"$ref": "#/definitions/v1IndexerChainedTxType"
935938
}
936939
}
937940
},
941+
"v1IndexerChainedTxType": {
942+
"type": "string",
943+
"enum": [
944+
"INDEXER_CHAINED_TX_TYPE_UNSPECIFIED",
945+
"INDEXER_CHAINED_TX_TYPE_ARK",
946+
"INDEXER_CHAINED_TX_TYPE_TREE",
947+
"INDEXER_CHAINED_TX_TYPE_CHECKPOINT"
948+
],
949+
"default": "INDEXER_CHAINED_TX_TYPE_UNSPECIFIED"
950+
},
938951
"v1IndexerNode": {
939952
"type": "object",
940953
"properties": {

api-spec/protobuf/ark/v1/indexer.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ message IndexerVtxo {
286286
message IndexerChain {
287287
string txid = 1;
288288
int64 expires_at = 2;
289+
IndexerChainedTxType type = 3;
289290
}
290291

291292
message IndexerTxHistoryRecord {
@@ -306,6 +307,13 @@ enum IndexerTxType {
306307
INDEXER_TX_TYPE_SENT = 2;
307308
}
308309

310+
enum IndexerChainedTxType {
311+
INDEXER_CHAINED_TX_TYPE_UNSPECIFIED = 0;
312+
INDEXER_CHAINED_TX_TYPE_ARK = 1;
313+
INDEXER_CHAINED_TX_TYPE_TREE = 2;
314+
INDEXER_CHAINED_TX_TYPE_CHECKPOINT = 3;
315+
}
316+
309317
message IndexerPageRequest {
310318
int32 size = 1;
311319
int32 index = 2;

api-spec/protobuf/gen/ark/v1/indexer.pb.go

Lines changed: 369 additions & 293 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client-sdk/indexer/rest/service/models/v1_indexer_chain.go

Lines changed: 63 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/client-sdk/indexer/rest/service/models/v1_indexer_chained_tx_type.go

Lines changed: 84 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/internal/core/application/indexer.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ func (i *indexerService) GetVtxoChain(ctx context.Context, vtxoKey Outpoint, pag
289289
chain = append(chain, ChainWithExpiry{
290290
Txid: vtxo.Txid,
291291
ExpiresAt: vtxo.ExpireAt,
292+
Type: IndexerChainedTxTypeArk,
292293
})
293294

294295
// add the checkpoints txs
@@ -301,6 +302,7 @@ func (i *indexerService) GetVtxoChain(ctx context.Context, vtxoKey Outpoint, pag
301302
chain = append(chain, ChainWithExpiry{
302303
Txid: ptx.UnsignedTx.TxID(),
303304
ExpiresAt: vtxo.ExpireAt,
305+
Type: IndexerChainedTxTypeCheckpoint,
304306
})
305307

306308
// populate newNextVtxos with checkpoints inputs
@@ -345,6 +347,7 @@ func (i *indexerService) GetVtxoChain(ctx context.Context, vtxoKey Outpoint, pag
345347
fromVtxoToRoot = append(fromVtxoToRoot, ChainWithExpiry{
346348
Txid: fromRootToVtxo[i],
347349
ExpiresAt: vtxo.ExpireAt,
350+
Type: IndexerChainedTxTypeTree,
348351
})
349352
}
350353

server/internal/core/application/types.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,17 @@ type PageResp struct {
225225
Total int32
226226
}
227227

228+
type IndexerChainedTxType int
229+
230+
const (
231+
IndexerChainedTxTypeUnspecified IndexerChainedTxType = iota
232+
IndexerChainedTxTypeArk
233+
IndexerChainedTxTypeTree
234+
IndexerChainedTxTypeCheckpoint
235+
)
236+
228237
type ChainWithExpiry struct {
229238
Txid string
230239
ExpiresAt int64
240+
Type IndexerChainedTxType
231241
}

server/internal/interface/grpc/handlers/indexer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ func (e *indexerService) GetVtxoChain(ctx context.Context, request *arkv1.GetVtx
338338
chain = append(chain, &arkv1.IndexerChain{
339339
Txid: c.Txid,
340340
ExpiresAt: c.ExpiresAt,
341+
Type: arkv1.IndexerChainedTxType(c.Type),
341342
})
342343
}
343344

0 commit comments

Comments
 (0)