Skip to content
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

feature: return tx subtype on tx summary #1358

Closed
Tracked by #228
selankon opened this issue Aug 6, 2024 · 4 comments · Fixed by #1329
Closed
Tracked by #228

feature: return tx subtype on tx summary #1358

selankon opened this issue Aug 6, 2024 · 4 comments · Fixed by #1329
Assignees
Labels
enhancement New feature or request

Comments

@selankon
Copy link
Contributor

selankon commented Aug 6, 2024

Describe the feature

Return tx subtype on a transaction summary on:

chain/transactions/page/0
chain/blocks/1374876/transactions/page/0

Motivation

When getting a list of txs on the explorer, a nice feature requested is to show the tx subtype instead of the tx type.

Constraints & Assumptions

Maybe can be also implemented on fees endpoints because they have tx info and the tx type.

/chain/fees/page/:page
/chain/fees/reference/:reference/page/:page
/chain/fees/type/:type/page/:page
/accounts/:accountID/fees/page/:page

@selankon selankon added the enhancement New feature or request label Aug 6, 2024
@altergui
Copy link
Contributor

for example this?

  "transactions": [
    {
      "transactionNumber": 15,
      "transactionHash": "33099c5f35e2e7e6473d7825448755a60eee5f47fa86134560f11233173ac5d7",
      "blockHeight": 292,
      "transactionIndex": 0,
      "transactionType": "setAccount",
      "transactionSubtype": "SET_ACCOUNT_INFO_URI"
    },
    {
      "transactionNumber": 14,
      "transactionHash": "d542ce00d608e2a9b52673fba5770e4d93118797f441ca6bd25d45cb688861d7",
      "blockHeight": 291,
      "transactionIndex": 0,
      "transactionType": "setAccount",
      "transactionSubtype": "CREATE_ACCOUNT"
    },

feedback welcome. i could make it lowerCamelCase but then it will differ from what is shown when fetching the full tx , on tx.setAccount.txtype is uppercase with underscores

@altergui
Copy link
Contributor

this is an example of the full tx

curl -s "http://localhost:9090/v2/chain/transactions/292/0" | jq
{
  "tx": {
    "setAccount": {
      "txtype": "SET_ACCOUNT_INFO_URI",
      "nonce": 0,
      "infoURI": "ipfs://bafybeicqgij33divxkjsfoe7vw7u2l66fmdbchmj5cwlthk34qh7wrcmlm",
      "account": "eaGryPh2PiZE+0F6v4jrwaBWzvQ=",
      "delegates": []
    }
  },
  "txInfo": {
    "transactionNumber": 15,
    "transactionHash": "33099c5f35e2e7e6473d7825448755a60eee5f47fa86134560f11233173ac5d7",
    "blockHeight": 292,
    "transactionIndex": 0,
    "transactionType": "setAccount",
    "transactionSubtype": "SET_ACCOUNT_INFO_URI"
  },
  "signature": "4de7fbf60d6a616b80dc92dbf6b330a907a9b348ef81e0e7918a9033047000b101485550cf777ecaf4bfd03fce58cb365ad633130728b4ddbc828534693528cb01",
  "account": "79a1abc8f8763e2644fb417abf88ebc1a056cef4"
}

(note that account field is present as well, from another feature i'm working on)

@altergui
Copy link
Contributor

interestingly enough, the current /chain/fees endpoint DOES report the "sub" txtype

 $ curl -s "http://localhost:9090/v2/chain/fees" | jq
{
  "fees": [
    {
      "cost": 1,
      "from": "5ba763c9f904290c262cfe2c798e962175429260",
      "height": 295,
      "reference": "0x79a1aBc8F8763e2644FB417Abf88eBc1a056CEF4",
      "timestamp": "2024-08-26T17:31:09Z",
      "txType": "send_tokens"
    },
...
    {
      "cost": 1,
      "from": "79a1abc8f8763e2644fb417abf88ebc1a056cef4",
      "height": 292,
      "reference": "ipfs://bafybeicqgij33divxkjsfoe7vw7u2l66fmdbchmj5cwlthk34qh7wrcmlm",
      "timestamp": "2024-08-26T17:30:50Z",
      "txType": "set_account_info_uri"
    },
    {

named txType, and value in lowercase, with underscores

@altergui
Copy link
Contributor

i wouldn't touch the current /chain/fees format,
so i'll just make the new field lowercase_with_underscores, for consistency

@altergui altergui self-assigned this Sep 3, 2024
@altergui altergui linked a pull request Sep 3, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants