Skip to content

feat(syscoin): add compact tx summary history#27

Merged
sidhujag merged 10 commits into
masterfrom
syscoin-txsummary-history
Jun 30, 2026
Merged

feat(syscoin): add compact tx summary history#27
sidhujag merged 10 commits into
masterfrom
syscoin-txsummary-history

Conversation

@sidhujag

Copy link
Copy Markdown
Member

Summary

  • Add details=txsummary for Syscoin account/xpub history responses.
  • Return compact account-context transaction rows with direction, native value in/out, and SPT account transfer summaries instead of full vin/vout payloads.
  • Keep existing txids, txslight, and txs behavior unchanged for compatibility.

Test plan

  • gofmt -w api/types.go api/worker.go api/xpub.go server/public.go server/ws_types.go
  • go test ./api ./server (blocked locally by grocksdb/RocksDB C symbol mismatch: missing rocksdb_cache_create_hyper_clock and related symbols)

Made with Cursor

Expose a Syscoin-specific account history mode for wallet transaction lists so clients can avoid storing full vin/vout payloads while still showing account-relative amounts and SPT deltas.

Co-authored-by: Cursor <cursoragent@cursor.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56006936f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/ws_types.go
Details string `json:"details,omitempty" ts_type:"'basic' | 'tokens' | 'tokenBalances' | 'txids' | 'txslight' | 'txs'" ts_doc:"Level of detail to retrieve about the account."`
Descriptor string `json:"descriptor" ts_doc:"Address or XPUB descriptor to query."`
// SYSCOIN: txsummary is a compact account-context history mode for wallet lists.
Details string `json:"details,omitempty" ts_type:"'basic' | 'tokens' | 'tokenBalances' | 'txids' | 'txsummary' | 'txslight' | 'txs'" ts_doc:"Level of detail to retrieve about the account."`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Handle txsummary in websocket parsing

This advertises details: "txsummary" for the getAccountInfo websocket request, but getAccountInfo in server/websocket.go has no matching case and falls through to AccountDetailsBasic. A WS client following this generated type/doc will get only basic account data instead of the compact transaction summaries, so the new history mode is unavailable on the surface where it is documented.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 2bae226: websocket getAccountInfo now maps details=txsummary to AccountDetailsTxHistorySummary.

Comment thread server/public.go Outdated
Comment on lines +1161 to +1162
case "txsummary":
accountDetails = api.AccountDetailsTxHistorySummary

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict txsummary to account endpoints

This shared query parser is also used by apiAsset, so /api/v2/asset/...?...details=txsummary now passes AccountDetailsTxHistorySummary into GetAsset. There, unconfirmed asset txs are counted for every option >= AccountDetailsTxidHistory, but mempoolTxs is populated only for options >= AccountDetailsTxHistoryLight; because summary sits between them, any asset with mempool transactions can slice an empty mempoolTxs slice and panic. Either reject this detail level for asset routes or handle it like the tx history modes there.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 2bae226: apiAsset now rejects details=txsummary before calling GetAsset, since txsummary is account-context only.

Wire txsummary through websocket account info requests and reject it on asset history endpoints where account-context summaries do not apply.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sidhujag

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2bae2269a7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread api/worker.go
// only ChainBitcoinType supports TxHistoryLight
if option == AccountDetailsTxHistoryLight && w.chainType == bchain.ChainBitcoinType {
// SYSCOIN: summary history shares the indexed Bitcoin-type light path.
if option >= AccountDetailsTxHistorySummary && option <= AccountDetailsTxHistoryLight && w.chainType == bchain.ChainBitcoinType {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Populate descriptors before summarizing indexed transactions

When details=txsummary is used on confirmed Bitcoin/Syscoin history, this branch now reuses the light txFromTxAddress path, but that converter only fills Addresses and never copies AddrDesc into each Vin/Vout. summarizeTxForAccount matches exclusively on vin.AddrDesc/vout.AddrDesc, so confirmed summaries from this path report zero account input/output, no asset transfers, and default to received; mempool summaries still work because they come from getTransaction. Please either populate descriptors in the light conversion or summarize against the indexed TxAddresses descriptors.

Useful? React with 👍 / 👎.

jagdeep sidhu and others added 2 commits June 29, 2026 23:22
Keep indexed input/output descriptors when building light transaction rows so compact account summaries can compute confirmed account-relative values.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@sidhujag

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f63cc7c563

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/public.go Outdated
Comment on lines +1161 to +1162
case "txsummary":
accountDetails = api.AccountDetailsTxHistorySummary

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Gate txsummary to supported chains

Because this generic parser accepts details=txsummary for every coin, Ethereum-like address endpoints can now reach summarizeTxForAccount; for a sender, Ethereum Vin entries have the address descriptor but no ValueSat, so the summary reports zero in/out and direction: "received" instead of the sent value. The WebSocket mapping has the same exposure, so this mode should be rejected outside the Syscoin/UTXO path or implemented for EVM transactions before advertising it.

Useful? React with 👍 / 👎.

Comment thread api/worker.go
Comment on lines +1529 to +1533
transfers = append(transfers, TokenTransfer{
AssetGuid: guid,
Symbol: summary.symbol,
Decimals: summary.decimals,
Value: (*Amount)(value),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Populate SPT transfer identity fields

These summary transfers are returned both as accountAssetTransfers and as TokenTransfers, but the literal leaves the non-omitempty type, standard, and contract fields at empty strings. Existing Syscoin transfer rows from getSyscoinAssetTransfers identify SPT transfers with SPT and the asset GUID as the contract; without the same fields here, clients consuming the normal token-transfer shape cannot reliably classify or key summary SPT movements.

Useful? React with 👍 / 👎.

Reject txsummary on non-UTXO account endpoints and populate SPT identity fields in compact account transfer summaries.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sidhujag

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 05085d7a5c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/ws_types.go
Details string `json:"details,omitempty" ts_type:"'basic' | 'tokens' | 'tokenBalances' | 'txids' | 'txslight' | 'txs'" ts_doc:"Level of detail to retrieve about the account."`
Descriptor string `json:"descriptor" ts_doc:"Address or XPUB descriptor to query."`
// SYSCOIN: txsummary is a compact account-context history mode for wallet lists.
Details string `json:"details,omitempty" ts_type:"'basic' | 'tokens' | 'tokenBalances' | 'txids' | 'txsummary' | 'txslight' | 'txs'" ts_doc:"Level of detail to retrieve about the account."`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Regenerate public API schemas for txsummary

This exposes details='txsummary' in the WebSocket request type, but the checked-in API schemas were not updated: blockbook-api.ts still types details as only 'basic' | 'tokens' | 'tokenBalances' | 'txids' | 'txslight' | 'txs', and openapi.yaml has the same enum without txsummary; the new summary Tx fields are also absent there. Clients generated from those canonical files cannot discover or type-check this new mode even though the server accepts it.

Useful? React with 👍 / 👎.

Expose compact Syscoin transaction summary fields and the txsummary detail option in checked-in API schema artifacts.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sidhujag

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ce952d2777

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/public.go Outdated

// SYSCOIN
func (s *PublicServer) validateTxSummarySupported(r *http.Request) error {
if r.URL.Query().Get("details") == "txsummary" && !s.supportsAccountTxSummary() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject txsummary before converting to v1

When details=txsummary is sent to /api/v1/address or /api/v1/xpub (and to unversioned /api/... on Bitcoin-type chains, where the default is v1), this helper allows the new mode because it only checks chain support. The handlers then call AddressToV1, whose TxV1 has no direction, addressValueIn/Out, or accountAssetTransfers fields and serializes empty vin/vout for compact rows, so clients receive incomplete history instead of the summary they requested. Gate txsummary on apiVersion == apiV2 or return a public error for v1.

Useful? React with 👍 / 👎.

Keep compact transaction summaries on API v2 only so v1 address conversion cannot return incomplete history rows.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sidhujag

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9bd76b8683

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread api/worker.go
Comment on lines +2425 to +2426
if option == AccountDetailsTxHistorySummary {
txs = append(txs, w.summarizeTxForAccount(tx, accountAddrDescs)) // SYSCOIN

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Offset confirmed txsummary rows after mempool entries

When an address has unconfirmed transactions, page 1 prepends their summaries above and then this branch adds confirmed rows using from/to computed as if no mempool rows existed; the later page-size trim drops the extra confirmed rows, while page 2 starts at the next full confirmed page. For details=txsummary&pageSize=10 with two mempool transactions, confirmed rows 9-10 are skipped, so the confirmed window needs to be reduced/offset by the mempool count before appending summaries.

Useful? React with 👍 / 👎.

Comment thread api/xpub.go
Comment on lines +679 to +680
} else if option == AccountDetailsTxHistorySummary {
txs = append(txs, w.summarizeTxForAccount(txmMap[entry.Txid], accountAddrDescs)) // SYSCOIN

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Bound xpub txsummary pages when mempool is present

For xpubs on the first page with unconfirmed transactions, this appends every mempool summary and the confirmed loop below still appends a full page of confirmed transactions, with no later trim in this path. As a result details=txsummary&pageSize=10 can return more than 10 rows and paging metadata that only reflects confirmed history, so clients relying on fixed page sizes get inconsistent pages when mempool entries exist.

Useful? React with 👍 / 👎.

Offset confirmed txsummary windows by first-page mempool rows so compact account history stays bounded and does not skip confirmed transactions.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sidhujag

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4a9a3c133c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread api/worker.go
direction = "sent"
}
accountAssetTransfers := accountAssetTransfersFromSummary(assetTransfers)
return &Tx{

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Populate vin/vout arrays in txsummary rows

When an account or xpub request uses details=txsummary, this constructor returns a Tx with nil Vin and Vout; those fields do not have omitempty, so the JSON contains "vin": null and "vout": null even though the public Tx schema and generated TypeScript type require arrays. Clients that iterate these fields for every transaction row can break only on the new summary mode, so initialize them to empty slices or expose a summary-specific response shape.

Useful? React with 👍 / 👎.

Initialize compact summary rows with empty vin and vout arrays so API responses continue to satisfy the public Tx schema.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sidhujag

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 075f957df3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread api/worker.go
AddressValueInSat: (*Amount)(&valueIn),
AddressValueOutSat: (*Amount)(&valueOut),
AccountAssetTransfers: accountAssetTransfers,
TokenType: tx.TokenType,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve memos in txsummary rows

For Syscoin SPT transactions that carry a decoded OP_RETURN memo, details=txsummary now returns a compact Tx built here, but it only copies TokenType and drops tx.Memo. The regular light/full transaction paths still populate Memo, and this commit also documents Tx.memo, so wallets using the new summary history cannot display memos for exactly those SPT rows; copy Memo into the summarized transaction alongside TokenType.

Useful? React with 👍 / 👎.

Copy decoded Syscoin transaction memos into compact account summary rows so SPT history keeps memo metadata.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sidhujag

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: a2029051a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sidhujag sidhujag merged commit ce1fdc4 into master Jun 30, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant