# Transactions

## GET /transaction/pool/{pool\_id}

> Get a paginated list of all transactions in the specified pool that match the provided filter

```json
{"openapi":"3.1.0","info":{"title":"Saturn Indexer API","version":"0.1.0"},"tags":[{"name":"transaction","description":"Bitcoin transactions created on the Saturn platform"}],"servers":[{"url":"http://127.0.0.1:3000","description":"Local testing"}],"paths":{"/transaction/pool/{pool_id}":{"get":{"tags":["transaction"],"description":"Get a paginated list of all transactions in the specified pool that match the provided filter","operationId":"find_transactions_by_pool_id","parameters":[{"name":"pool_id","in":"path","description":"Pool ID in hex format","required":true,"schema":{"type":"string"}},{"name":"startDate","in":"query","required":false,"schema":{"type":["string","null"],"format":"date-time"}},{"name":"endDate","in":"query","required":false,"schema":{"type":["string","null"],"format":"date-time"}},{"name":"poolId","in":"query","description":"Optional pool filter; hex-encoded pool id","required":false,"schema":{"type":["string","null"]}},{"name":"token0","in":"query","description":"Optional asset pair filter; provide both tokens to filter by a specific pair","required":false,"schema":{"type":["string","null"]}},{"name":"token1","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"types","in":"query","required":false,"schema":{"type":["array","null"],"items":{"$ref":"#/components/schemas/TransactionType"}},"explode":false},{"name":"cursor","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int32"}},{"name":"sortCreatedAt","in":"query","required":false,"schema":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/SortOrder"}]}},{"name":"bitcoinTxStatus","in":"query","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"List of transactions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CursorResponse_Vec_Transaction"}}}},"400":{"description":"Invalid pubkey format"}}}}},"components":{"schemas":{"TransactionType":{"type":"string","enum":["open_position","close_position","increase_liquidity","decrease_liquidity","swap","initialize_pool","add_pool_shards","collect_protocol_fees","initialize_protocol","set_owner","toggle_paused","SetFeeTiers"]},"SortOrder":{"type":"string","enum":["ASC","DESC"]},"CursorResponse_Vec_Transaction":{"type":"object","required":["response"],"properties":{"response":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/SuccessfulTransaction"},{"$ref":"#/components/schemas/FailedTransaction"}]}},"nextCursor":{"type":["string","null"]}}},"SuccessfulTransaction":{"type":"object","required":["id","status","rollbackStatus","blockHeight","poolPubkey","userPubkey","transactionType","createdAt","details","writableAccounts"],"properties":{"id":{"type":"string"},"status":{"$ref":"#/components/schemas/StatusSchema"},"rollbackStatus":{"$ref":"#/components/schemas/RollbackStatusSchema"},"bitcoinTxId":{"type":["string","null"]},"bitcoinBlockHeight":{"type":["integer","null"],"format":"int64","minimum":0},"bitcoinTxStatus":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/BitcoinTxStatus"}]},"blockHeight":{"type":"string"},"poolPubkey":{"type":"string"},"userPubkey":{"type":"string"},"transactionType":{"$ref":"#/components/schemas/TransactionType"},"createdAt":{"type":"string","format":"date-time"},"details":{"$ref":"#/components/schemas/TransactionDetails"},"writableAccounts":{"type":"array","items":{"type":"string"}}}},"StatusSchema":{"oneOf":[{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["queued"]}}},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["processed"]}}},{"type":"object","required":["message","type"],"properties":{"message":{"type":"string"},"type":{"type":"string","enum":["failed"]}}}]},"RollbackStatusSchema":{"oneOf":[{"type":"object","required":["message","type"],"properties":{"message":{"type":"string"},"type":{"type":"string","enum":["rolledback"]}}},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["notRolledback"]}}}]},"BitcoinTxStatus":{"type":"string","enum":["pending","confirmed","failed","rolled_back"]},"TransactionDetails":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/InitializeProtocolData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["initialize_protocol"]}}}]},{"allOf":[{"$ref":"#/components/schemas/SetOwnerData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["set_owner"]}}}]},{"allOf":[{"$ref":"#/components/schemas/TogglePausedData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["toggle_paused"]}}}]},{"allOf":[{"$ref":"#/components/schemas/SetFeeTiersData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["set_fee_tiers"]}}}]},{"allOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["open_position"]}}}]},{"allOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["increase_liquidity"]}}}]},{"allOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["decrease_liquidity"]}}}]},{"allOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["close_position"]}}}]},{"allOf":[{"$ref":"#/components/schemas/AddPoolShardsData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["add_pool_shards"]}}}]},{"allOf":[{"$ref":"#/components/schemas/SwapData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["swap"]}}}]},{"allOf":[{"$ref":"#/components/schemas/CollectProtocolFeesData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["collect_protocol_fees"]}}}]},{"allOf":[{"$ref":"#/components/schemas/InitializePoolData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["initialize_pool"]}}}]}]},"InitializeProtocolData":{"type":"object"},"SetOwnerData":{"type":"object","required":["owner"],"properties":{"owner":{"type":"string"}}},"TogglePausedData":{"type":"object","required":["paused"],"properties":{"paused":{"type":"boolean"}}},"SetFeeTiersData":{"type":"object","required":["feeTiers"],"properties":{"feeTiers":{"type":"array","items":{"type":"integer","format":"int32","minimum":0}}}},"PositionData":{"type":"object","required":["positionId","token0Amount","token1Amount","btcFeePaid","totalBtcFeePaid","prevTransactions"],"properties":{"positionId":{"type":"string"},"token0Amount":{"type":"string"},"token1Amount":{"type":"string"},"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0},"prevTransactions":{"type":"array","items":{"type":"string"}}}},"AddPoolShardsData":{"type":"object","required":["shards","diffShards","btcFeePaid","totalBtcFeePaid"],"properties":{"shards":{"type":"integer","format":"int32","minimum":0},"diffShards":{"type":"integer","format":"int32","minimum":0},"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0},"prevTransaction":{"type":["string","null"]}}},"SwapData":{"type":"object","required":["amountIn","amountOut","zeroToOne","btcFeePaid","totalBtcFeePaid"],"properties":{"amountIn":{"type":"string"},"amountOut":{"type":"string"},"zeroToOne":{"type":"boolean"},"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0}}},"CollectProtocolFeesData":{"type":"object","required":["token0Amount","token1Amount","btcFeePaid","totalBtcFeePaid"],"properties":{"token0Amount":{"type":"string"},"token1Amount":{"type":"string"},"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0}}},"InitializePoolData":{"type":"object","required":["btcFeePaid","totalBtcFeePaid"],"properties":{"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0},"prevTransaction":{"type":["string","null"]}}},"FailedTransaction":{"type":"object","required":["id","status","rollbackStatus","blockHeight","poolPubkey","userPubkey","transactionType","createdAt","details","writableAccounts"],"properties":{"id":{"type":"string"},"status":{"$ref":"#/components/schemas/StatusSchema"},"rollbackStatus":{"$ref":"#/components/schemas/RollbackStatusSchema"},"blockHeight":{"type":"string"},"poolPubkey":{"type":"string"},"userPubkey":{"type":"string"},"transactionType":{"$ref":"#/components/schemas/TransactionType"},"createdAt":{"type":"string","format":"date-time"},"details":{"$ref":"#/components/schemas/TransactionDetails"},"writableAccounts":{"type":"array","items":{"type":"string"}}}}}}}
```

## GET /transaction/user/{pubkey}

> Fetches a paginated list of user's transactions that match the provided filter

```json
{"openapi":"3.1.0","info":{"title":"Saturn Indexer API","version":"0.1.0"},"tags":[{"name":"transaction","description":"Bitcoin transactions created on the Saturn platform"}],"servers":[{"url":"http://127.0.0.1:3000","description":"Local testing"}],"paths":{"/transaction/user/{pubkey}":{"get":{"tags":["transaction"],"description":"Fetches a paginated list of user's transactions that match the provided filter","operationId":"find_transactions_by_user","parameters":[{"name":"pubkey","in":"path","description":"User public key in hex format","required":true,"schema":{"type":"string"}},{"name":"startDate","in":"query","required":false,"schema":{"type":["string","null"],"format":"date-time"}},{"name":"endDate","in":"query","required":false,"schema":{"type":["string","null"],"format":"date-time"}},{"name":"poolId","in":"query","description":"Optional pool filter; hex-encoded pool id","required":false,"schema":{"type":["string","null"]}},{"name":"token0","in":"query","description":"Optional asset pair filter; provide both tokens to filter by a specific pair","required":false,"schema":{"type":["string","null"]}},{"name":"token1","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"types","in":"query","required":false,"schema":{"type":["array","null"],"items":{"$ref":"#/components/schemas/TransactionType"}},"explode":false},{"name":"cursor","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int32"}},{"name":"sortCreatedAt","in":"query","required":false,"schema":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/SortOrder"}]}},{"name":"bitcoinTxStatus","in":"query","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"Paginated list of transactions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CursorResponse_Vec_TransactionResponse"}}}},"400":{"description":"Invalid pubkey format"}}}}},"components":{"schemas":{"TransactionType":{"type":"string","enum":["open_position","close_position","increase_liquidity","decrease_liquidity","swap","initialize_pool","add_pool_shards","collect_protocol_fees","initialize_protocol","set_owner","toggle_paused","SetFeeTiers"]},"SortOrder":{"type":"string","enum":["ASC","DESC"]},"CursorResponse_Vec_TransactionResponse":{"type":"object","required":["response"],"properties":{"response":{"type":"array","items":{"type":"object","required":["transaction","token0","token1"],"properties":{"transaction":{"$ref":"#/components/schemas/Transaction"},"token0":{"$ref":"#/components/schemas/Collection"},"token1":{"$ref":"#/components/schemas/Collection"}}}},"nextCursor":{"type":["string","null"]}}},"Transaction":{"oneOf":[{"$ref":"#/components/schemas/SuccessfulTransaction"},{"$ref":"#/components/schemas/FailedTransaction"}]},"SuccessfulTransaction":{"type":"object","required":["id","status","rollbackStatus","blockHeight","poolPubkey","userPubkey","transactionType","createdAt","details","writableAccounts"],"properties":{"id":{"type":"string"},"status":{"$ref":"#/components/schemas/StatusSchema"},"rollbackStatus":{"$ref":"#/components/schemas/RollbackStatusSchema"},"bitcoinTxId":{"type":["string","null"]},"bitcoinBlockHeight":{"type":["integer","null"],"format":"int64","minimum":0},"bitcoinTxStatus":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/BitcoinTxStatus"}]},"blockHeight":{"type":"string"},"poolPubkey":{"type":"string"},"userPubkey":{"type":"string"},"transactionType":{"$ref":"#/components/schemas/TransactionType"},"createdAt":{"type":"string","format":"date-time"},"details":{"$ref":"#/components/schemas/TransactionDetails"},"writableAccounts":{"type":"array","items":{"type":"string"}}}},"StatusSchema":{"oneOf":[{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["queued"]}}},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["processed"]}}},{"type":"object","required":["message","type"],"properties":{"message":{"type":"string"},"type":{"type":"string","enum":["failed"]}}}]},"RollbackStatusSchema":{"oneOf":[{"type":"object","required":["message","type"],"properties":{"message":{"type":"string"},"type":{"type":"string","enum":["rolledback"]}}},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["notRolledback"]}}}]},"BitcoinTxStatus":{"type":"string","enum":["pending","confirmed","failed","rolled_back"]},"TransactionDetails":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/InitializeProtocolData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["initialize_protocol"]}}}]},{"allOf":[{"$ref":"#/components/schemas/SetOwnerData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["set_owner"]}}}]},{"allOf":[{"$ref":"#/components/schemas/TogglePausedData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["toggle_paused"]}}}]},{"allOf":[{"$ref":"#/components/schemas/SetFeeTiersData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["set_fee_tiers"]}}}]},{"allOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["open_position"]}}}]},{"allOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["increase_liquidity"]}}}]},{"allOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["decrease_liquidity"]}}}]},{"allOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["close_position"]}}}]},{"allOf":[{"$ref":"#/components/schemas/AddPoolShardsData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["add_pool_shards"]}}}]},{"allOf":[{"$ref":"#/components/schemas/SwapData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["swap"]}}}]},{"allOf":[{"$ref":"#/components/schemas/CollectProtocolFeesData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["collect_protocol_fees"]}}}]},{"allOf":[{"$ref":"#/components/schemas/InitializePoolData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["initialize_pool"]}}}]}]},"InitializeProtocolData":{"type":"object"},"SetOwnerData":{"type":"object","required":["owner"],"properties":{"owner":{"type":"string"}}},"TogglePausedData":{"type":"object","required":["paused"],"properties":{"paused":{"type":"boolean"}}},"SetFeeTiersData":{"type":"object","required":["feeTiers"],"properties":{"feeTiers":{"type":"array","items":{"type":"integer","format":"int32","minimum":0}}}},"PositionData":{"type":"object","required":["positionId","token0Amount","token1Amount","btcFeePaid","totalBtcFeePaid","prevTransactions"],"properties":{"positionId":{"type":"string"},"token0Amount":{"type":"string"},"token1Amount":{"type":"string"},"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0},"prevTransactions":{"type":"array","items":{"type":"string"}}}},"AddPoolShardsData":{"type":"object","required":["shards","diffShards","btcFeePaid","totalBtcFeePaid"],"properties":{"shards":{"type":"integer","format":"int32","minimum":0},"diffShards":{"type":"integer","format":"int32","minimum":0},"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0},"prevTransaction":{"type":["string","null"]}}},"SwapData":{"type":"object","required":["amountIn","amountOut","zeroToOne","btcFeePaid","totalBtcFeePaid"],"properties":{"amountIn":{"type":"string"},"amountOut":{"type":"string"},"zeroToOne":{"type":"boolean"},"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0}}},"CollectProtocolFeesData":{"type":"object","required":["token0Amount","token1Amount","btcFeePaid","totalBtcFeePaid"],"properties":{"token0Amount":{"type":"string"},"token1Amount":{"type":"string"},"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0}}},"InitializePoolData":{"type":"object","required":["btcFeePaid","totalBtcFeePaid"],"properties":{"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0},"prevTransaction":{"type":["string","null"]}}},"FailedTransaction":{"type":"object","required":["id","status","rollbackStatus","blockHeight","poolPubkey","userPubkey","transactionType","createdAt","details","writableAccounts"],"properties":{"id":{"type":"string"},"status":{"$ref":"#/components/schemas/StatusSchema"},"rollbackStatus":{"$ref":"#/components/schemas/RollbackStatusSchema"},"blockHeight":{"type":"string"},"poolPubkey":{"type":"string"},"userPubkey":{"type":"string"},"transactionType":{"$ref":"#/components/schemas/TransactionType"},"createdAt":{"type":"string","format":"date-time"},"details":{"$ref":"#/components/schemas/TransactionDetails"},"writableAccounts":{"type":"array","items":{"type":"string"}}}},"Collection":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/BTCCollection"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["btc"]}}}]},{"allOf":[{"$ref":"#/components/schemas/RuneCollection"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["rune"]}}}]}]},"BTCCollection":{"type":"object","required":["id","name","displayName","divisibility","supply","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"displayName":{"type":"string"},"symbol":{"type":["string","null"]},"divisibility":{"type":"integer","format":"int32","minimum":0},"supply":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"RuneCollection":{"type":"object","required":["id","name","displayName","divisibility","supply","verified","premined","burned","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"displayName":{"type":"string"},"symbol":{"type":["string","null"]},"divisibility":{"type":"integer","format":"int32","minimum":0},"supply":{"type":"string"},"verified":{"type":"boolean"},"icon":{"type":["string","null"]},"premined":{"type":"string"},"burned":{"type":"string"},"transactionId":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}}
```

## GET /transaction/all

> Paginated list of all transactions that match the provided filter

```json
{"openapi":"3.1.0","info":{"title":"Saturn Indexer API","version":"0.1.0"},"tags":[{"name":"transaction","description":"Bitcoin transactions created on the Saturn platform"}],"servers":[{"url":"http://127.0.0.1:3000","description":"Local testing"}],"paths":{"/transaction/all":{"get":{"tags":["transaction"],"description":"Paginated list of all transactions that match the provided filter","operationId":"find_all_transactions","parameters":[{"name":"startDate","in":"query","required":false,"schema":{"type":["string","null"],"format":"date-time"}},{"name":"endDate","in":"query","required":false,"schema":{"type":["string","null"],"format":"date-time"}},{"name":"poolId","in":"query","description":"Optional pool filter; hex-encoded pool id","required":false,"schema":{"type":["string","null"]}},{"name":"token0","in":"query","description":"Optional asset pair filter; provide both tokens to filter by a specific pair","required":false,"schema":{"type":["string","null"]}},{"name":"token1","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"types","in":"query","required":false,"schema":{"type":["array","null"],"items":{"$ref":"#/components/schemas/TransactionType"}},"explode":false},{"name":"cursor","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int32"}},{"name":"sortCreatedAt","in":"query","required":false,"schema":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/SortOrder"}]}},{"name":"bitcoinTxStatus","in":"query","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"Paginated list of transactions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CursorResponse_Vec_Transaction"}}}}}}}},"components":{"schemas":{"TransactionType":{"type":"string","enum":["open_position","close_position","increase_liquidity","decrease_liquidity","swap","initialize_pool","add_pool_shards","collect_protocol_fees","initialize_protocol","set_owner","toggle_paused","SetFeeTiers"]},"SortOrder":{"type":"string","enum":["ASC","DESC"]},"CursorResponse_Vec_Transaction":{"type":"object","required":["response"],"properties":{"response":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/SuccessfulTransaction"},{"$ref":"#/components/schemas/FailedTransaction"}]}},"nextCursor":{"type":["string","null"]}}},"SuccessfulTransaction":{"type":"object","required":["id","status","rollbackStatus","blockHeight","poolPubkey","userPubkey","transactionType","createdAt","details","writableAccounts"],"properties":{"id":{"type":"string"},"status":{"$ref":"#/components/schemas/StatusSchema"},"rollbackStatus":{"$ref":"#/components/schemas/RollbackStatusSchema"},"bitcoinTxId":{"type":["string","null"]},"bitcoinBlockHeight":{"type":["integer","null"],"format":"int64","minimum":0},"bitcoinTxStatus":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/BitcoinTxStatus"}]},"blockHeight":{"type":"string"},"poolPubkey":{"type":"string"},"userPubkey":{"type":"string"},"transactionType":{"$ref":"#/components/schemas/TransactionType"},"createdAt":{"type":"string","format":"date-time"},"details":{"$ref":"#/components/schemas/TransactionDetails"},"writableAccounts":{"type":"array","items":{"type":"string"}}}},"StatusSchema":{"oneOf":[{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["queued"]}}},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["processed"]}}},{"type":"object","required":["message","type"],"properties":{"message":{"type":"string"},"type":{"type":"string","enum":["failed"]}}}]},"RollbackStatusSchema":{"oneOf":[{"type":"object","required":["message","type"],"properties":{"message":{"type":"string"},"type":{"type":"string","enum":["rolledback"]}}},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["notRolledback"]}}}]},"BitcoinTxStatus":{"type":"string","enum":["pending","confirmed","failed","rolled_back"]},"TransactionDetails":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/InitializeProtocolData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["initialize_protocol"]}}}]},{"allOf":[{"$ref":"#/components/schemas/SetOwnerData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["set_owner"]}}}]},{"allOf":[{"$ref":"#/components/schemas/TogglePausedData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["toggle_paused"]}}}]},{"allOf":[{"$ref":"#/components/schemas/SetFeeTiersData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["set_fee_tiers"]}}}]},{"allOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["open_position"]}}}]},{"allOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["increase_liquidity"]}}}]},{"allOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["decrease_liquidity"]}}}]},{"allOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["close_position"]}}}]},{"allOf":[{"$ref":"#/components/schemas/AddPoolShardsData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["add_pool_shards"]}}}]},{"allOf":[{"$ref":"#/components/schemas/SwapData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["swap"]}}}]},{"allOf":[{"$ref":"#/components/schemas/CollectProtocolFeesData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["collect_protocol_fees"]}}}]},{"allOf":[{"$ref":"#/components/schemas/InitializePoolData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["initialize_pool"]}}}]}]},"InitializeProtocolData":{"type":"object"},"SetOwnerData":{"type":"object","required":["owner"],"properties":{"owner":{"type":"string"}}},"TogglePausedData":{"type":"object","required":["paused"],"properties":{"paused":{"type":"boolean"}}},"SetFeeTiersData":{"type":"object","required":["feeTiers"],"properties":{"feeTiers":{"type":"array","items":{"type":"integer","format":"int32","minimum":0}}}},"PositionData":{"type":"object","required":["positionId","token0Amount","token1Amount","btcFeePaid","totalBtcFeePaid","prevTransactions"],"properties":{"positionId":{"type":"string"},"token0Amount":{"type":"string"},"token1Amount":{"type":"string"},"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0},"prevTransactions":{"type":"array","items":{"type":"string"}}}},"AddPoolShardsData":{"type":"object","required":["shards","diffShards","btcFeePaid","totalBtcFeePaid"],"properties":{"shards":{"type":"integer","format":"int32","minimum":0},"diffShards":{"type":"integer","format":"int32","minimum":0},"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0},"prevTransaction":{"type":["string","null"]}}},"SwapData":{"type":"object","required":["amountIn","amountOut","zeroToOne","btcFeePaid","totalBtcFeePaid"],"properties":{"amountIn":{"type":"string"},"amountOut":{"type":"string"},"zeroToOne":{"type":"boolean"},"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0}}},"CollectProtocolFeesData":{"type":"object","required":["token0Amount","token1Amount","btcFeePaid","totalBtcFeePaid"],"properties":{"token0Amount":{"type":"string"},"token1Amount":{"type":"string"},"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0}}},"InitializePoolData":{"type":"object","required":["btcFeePaid","totalBtcFeePaid"],"properties":{"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0},"prevTransaction":{"type":["string","null"]}}},"FailedTransaction":{"type":"object","required":["id","status","rollbackStatus","blockHeight","poolPubkey","userPubkey","transactionType","createdAt","details","writableAccounts"],"properties":{"id":{"type":"string"},"status":{"$ref":"#/components/schemas/StatusSchema"},"rollbackStatus":{"$ref":"#/components/schemas/RollbackStatusSchema"},"blockHeight":{"type":"string"},"poolPubkey":{"type":"string"},"userPubkey":{"type":"string"},"transactionType":{"$ref":"#/components/schemas/TransactionType"},"createdAt":{"type":"string","format":"date-time"},"details":{"$ref":"#/components/schemas/TransactionDetails"},"writableAccounts":{"type":"array","items":{"type":"string"}}}}}}}
```

## GET /transaction/swaps

> List of swap transactions for specific collections

```json
{"openapi":"3.1.0","info":{"title":"Saturn Indexer API","version":"0.1.0"},"tags":[{"name":"transaction","description":"Bitcoin transactions created on the Saturn platform"}],"servers":[{"url":"http://127.0.0.1:3000","description":"Local testing"}],"paths":{"/transaction/swaps":{"get":{"tags":["transaction"],"description":"List of swap transactions for specific collections","operationId":"find_swaps_by_collections","parameters":[{"name":"token0","in":"query","required":true,"schema":{"type":"string"}},{"name":"token1","in":"query","required":true,"schema":{"type":"string"}},{"name":"status","in":"query","description":"Optional status filter; defaults to processed when not provided","required":false,"schema":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/TransactionStatusFilter"}]}},{"name":"rollbackStatus","in":"query","description":"Optional rollback status filter","required":false,"schema":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/RollbackStatusFilter"}]}},{"name":"cursor","in":"query","required":false,"schema":{"type":["string","null"]}},{"name":"limit","in":"query","required":false,"schema":{"type":["integer","null"],"format":"int32"}}],"responses":{"200":{"description":"Paginated list of transactions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CursorResponse_Vec_TransactionResponse"}}}}}}}},"components":{"schemas":{"TransactionStatusFilter":{"type":"string","description":"Filter for high-level transaction processing status","enum":["processed","failed"]},"RollbackStatusFilter":{"type":"string","description":"Filter for rollback state","enum":["not_rolledback","rolledback"]},"CursorResponse_Vec_TransactionResponse":{"type":"object","required":["response"],"properties":{"response":{"type":"array","items":{"type":"object","required":["transaction","token0","token1"],"properties":{"transaction":{"$ref":"#/components/schemas/Transaction"},"token0":{"$ref":"#/components/schemas/Collection"},"token1":{"$ref":"#/components/schemas/Collection"}}}},"nextCursor":{"type":["string","null"]}}},"Transaction":{"oneOf":[{"$ref":"#/components/schemas/SuccessfulTransaction"},{"$ref":"#/components/schemas/FailedTransaction"}]},"SuccessfulTransaction":{"type":"object","required":["id","status","rollbackStatus","blockHeight","poolPubkey","userPubkey","transactionType","createdAt","details","writableAccounts"],"properties":{"id":{"type":"string"},"status":{"$ref":"#/components/schemas/StatusSchema"},"rollbackStatus":{"$ref":"#/components/schemas/RollbackStatusSchema"},"bitcoinTxId":{"type":["string","null"]},"bitcoinBlockHeight":{"type":["integer","null"],"format":"int64","minimum":0},"bitcoinTxStatus":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/BitcoinTxStatus"}]},"blockHeight":{"type":"string"},"poolPubkey":{"type":"string"},"userPubkey":{"type":"string"},"transactionType":{"$ref":"#/components/schemas/TransactionType"},"createdAt":{"type":"string","format":"date-time"},"details":{"$ref":"#/components/schemas/TransactionDetails"},"writableAccounts":{"type":"array","items":{"type":"string"}}}},"StatusSchema":{"oneOf":[{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["queued"]}}},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["processed"]}}},{"type":"object","required":["message","type"],"properties":{"message":{"type":"string"},"type":{"type":"string","enum":["failed"]}}}]},"RollbackStatusSchema":{"oneOf":[{"type":"object","required":["message","type"],"properties":{"message":{"type":"string"},"type":{"type":"string","enum":["rolledback"]}}},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["notRolledback"]}}}]},"BitcoinTxStatus":{"type":"string","enum":["pending","confirmed","failed","rolled_back"]},"TransactionType":{"type":"string","enum":["open_position","close_position","increase_liquidity","decrease_liquidity","swap","initialize_pool","add_pool_shards","collect_protocol_fees","initialize_protocol","set_owner","toggle_paused","SetFeeTiers"]},"TransactionDetails":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/InitializeProtocolData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["initialize_protocol"]}}}]},{"allOf":[{"$ref":"#/components/schemas/SetOwnerData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["set_owner"]}}}]},{"allOf":[{"$ref":"#/components/schemas/TogglePausedData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["toggle_paused"]}}}]},{"allOf":[{"$ref":"#/components/schemas/SetFeeTiersData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["set_fee_tiers"]}}}]},{"allOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["open_position"]}}}]},{"allOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["increase_liquidity"]}}}]},{"allOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["decrease_liquidity"]}}}]},{"allOf":[{"$ref":"#/components/schemas/PositionData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["close_position"]}}}]},{"allOf":[{"$ref":"#/components/schemas/AddPoolShardsData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["add_pool_shards"]}}}]},{"allOf":[{"$ref":"#/components/schemas/SwapData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["swap"]}}}]},{"allOf":[{"$ref":"#/components/schemas/CollectProtocolFeesData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["collect_protocol_fees"]}}}]},{"allOf":[{"$ref":"#/components/schemas/InitializePoolData"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["initialize_pool"]}}}]}]},"InitializeProtocolData":{"type":"object"},"SetOwnerData":{"type":"object","required":["owner"],"properties":{"owner":{"type":"string"}}},"TogglePausedData":{"type":"object","required":["paused"],"properties":{"paused":{"type":"boolean"}}},"SetFeeTiersData":{"type":"object","required":["feeTiers"],"properties":{"feeTiers":{"type":"array","items":{"type":"integer","format":"int32","minimum":0}}}},"PositionData":{"type":"object","required":["positionId","token0Amount","token1Amount","btcFeePaid","totalBtcFeePaid","prevTransactions"],"properties":{"positionId":{"type":"string"},"token0Amount":{"type":"string"},"token1Amount":{"type":"string"},"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0},"prevTransactions":{"type":"array","items":{"type":"string"}}}},"AddPoolShardsData":{"type":"object","required":["shards","diffShards","btcFeePaid","totalBtcFeePaid"],"properties":{"shards":{"type":"integer","format":"int32","minimum":0},"diffShards":{"type":"integer","format":"int32","minimum":0},"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0},"prevTransaction":{"type":["string","null"]}}},"SwapData":{"type":"object","required":["amountIn","amountOut","zeroToOne","btcFeePaid","totalBtcFeePaid"],"properties":{"amountIn":{"type":"string"},"amountOut":{"type":"string"},"zeroToOne":{"type":"boolean"},"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0}}},"CollectProtocolFeesData":{"type":"object","required":["token0Amount","token1Amount","btcFeePaid","totalBtcFeePaid"],"properties":{"token0Amount":{"type":"string"},"token1Amount":{"type":"string"},"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0}}},"InitializePoolData":{"type":"object","required":["btcFeePaid","totalBtcFeePaid"],"properties":{"btcFeePaid":{"type":"integer","format":"int64","minimum":0},"totalBtcFeePaid":{"type":"integer","format":"int64","minimum":0},"prevTransaction":{"type":["string","null"]}}},"FailedTransaction":{"type":"object","required":["id","status","rollbackStatus","blockHeight","poolPubkey","userPubkey","transactionType","createdAt","details","writableAccounts"],"properties":{"id":{"type":"string"},"status":{"$ref":"#/components/schemas/StatusSchema"},"rollbackStatus":{"$ref":"#/components/schemas/RollbackStatusSchema"},"blockHeight":{"type":"string"},"poolPubkey":{"type":"string"},"userPubkey":{"type":"string"},"transactionType":{"$ref":"#/components/schemas/TransactionType"},"createdAt":{"type":"string","format":"date-time"},"details":{"$ref":"#/components/schemas/TransactionDetails"},"writableAccounts":{"type":"array","items":{"type":"string"}}}},"Collection":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/BTCCollection"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["btc"]}}}]},{"allOf":[{"$ref":"#/components/schemas/RuneCollection"},{"type":"object","required":["type"],"properties":{"type":{"type":"string","enum":["rune"]}}}]}]},"BTCCollection":{"type":"object","required":["id","name","displayName","divisibility","supply","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"displayName":{"type":"string"},"symbol":{"type":["string","null"]},"divisibility":{"type":"integer","format":"int32","minimum":0},"supply":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}},"RuneCollection":{"type":"object","required":["id","name","displayName","divisibility","supply","verified","premined","burned","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"displayName":{"type":"string"},"symbol":{"type":["string","null"]},"divisibility":{"type":"integer","format":"int32","minimum":0},"supply":{"type":"string"},"verified":{"type":"boolean"},"icon":{"type":["string","null"]},"premined":{"type":"string"},"burned":{"type":"string"},"transactionId":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}}}}}}
```
