-
Notifications
You must be signed in to change notification settings - Fork 10
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
all transactions for account endpoint #725
Comments
(cc @CedrikNikita ) |
name proposal from @sborrazas activity with different payload fields for different activity types. Paginated, never nested. |
An example response format/filter that other APIs use for this sort of "activity" information |
GoalExpose all "activity" of one account, the consumer of the api wants to know everything that happened to the account, so Basic Design
[
{
"transaction": {
...
},
"type": "native_transaction",
"additional_data": null
},
{
"transaction": {
...
},
"type": "aex9_transfer",
"additional_data": {
"amount": 10,
"contract_id": "ct_UAKGhMFJThpxgyFQi4fXztvT2fZRcMgZxjqrT9ehwsZT1yUe1",
"recipient": "ak_y87WkN4C4QevzjTuEYHg6XLqiWx3rjfYDFLBmZiqiro5mkRag",
"sender": "ak_45tM79u5EgCmsorADwuhf4PXkzEEBSHzXRZwjfBe5ww48XX63",
...
}
}
] ExamplesSpendTx (any native){
"transaction": {
"block_hash": "mh_EgvpfzAWAxes5xoFut3ADQBk9G9FpwdSFGnfXiV3anErouSC5",
"block_height": 621066,
"hash": "th_zDTyHWyVxMvmZmPhQZgnpdtHsbRMR6aLj7aADBKJqekkstmzG",
"micro_index": 0,
"micro_time": 1656616116824,
"signatures": [
"sg_P6EM1qzVx7HdP2dHR1bYU3LRrXjiAt6gvSKkg8bc4gLJRWf8Pme6akqFadytNLgpxFUKgDqxvpoCYHiDdSdeQDUieLAGs"
],
"tx": {
"amount": 455158420000000000000,
"fee": 20000000000000,
"nonce": 283,
"payload": "ba_Xfbg4g==",
"recipient_id": "ak_jgiBUko9fTwg5HQ8nHFoPbjR22TBcg9LK85qsv1mTkcjdszFa",
"sender_id": "ak_NcCfoP4M99vDfDSj6AKE4d3t7DBYE7UfB5rUJYggdPa23eWUp",
"type": "SpendTx",
"version": 1
},
"tx_index": 32696747
},
"type": "native_transaction",
"additional_data": null
} AEX-9 Transfer{
"transaction": {
"block_hash": "mh_2YhPW2gJSxJSRhiuLNR3MaHrAXew87FezsPh935KWW4Cmxi7dT",
"block_height": 423470,
"hash": "th_pGTAgCsBAQ8wzPRoi5mBL7koJypNpjgeYnFgWbwLcvouBgS3P",
"micro_index": 29,
"micro_time": 1619772609406,
"signatures": [
"sg_CicUTeiDLBCch8ANHg6K6pn7GVgNnnKWxkX7KpGZo3sMV8yS7zsNnRtypnM4VTpQnrNASStQqnX2KtXc8fd1cXKbRMmXS"
],
"tx": {
"abi_version": 3,
"amount": 0,
"arguments": [
{
"type": "int",
"value": 2858
},
{
"type": "contract",
"value": "ct_2bCbmU7vtsysL4JiUdUZjJJ98LLbJWG1fRtVApBvqSFEM59D6W"
},
{
"type": "int",
"value": 200000000000000000
}
],
"call_data": "cb_KxHLCaNVO2+CCuqfAqDRWfKB3b5gQ3QKTfjbMKv96kYvxVf2F3UwAuh4cm8OzG+IAsaK8LsT/8CKC6KO",
"caller_id": "ak_y87WkN4C4QevzjTuEYHg6XLqiWx3rjfYDFLBmZiqiro5mkRag",
"contract_id": "ct_2ZEoCKcqXkbz2uahRrsWeaPooZs9SdCv6pmC4kc55rD4MhqYSu",
"fee": 183040000000000,
"function": "retip_token",
"gas": 1579000,
"gas_price": 1000000000,
"gas_used": 14397,
"log": [
{
"address": "ct_2ZEoCKcqXkbz2uahRrsWeaPooZs9SdCv6pmC4kc55rD4MhqYSu",
"data": "cb_aHR0cHM6Ly9naXRodWIuY29tL3RoZXBpd28/dGFiPXByb2plY3Rz5wjuPw==",
"topics": [
"69233040432260092823535072650704575529616496835825451258994902650498116489956",
"57639713195292369493552360805284271936076756489947923784567159882221348109905",
"200000000000000000",
"94692308466469327368914015067879324067711091014055784310570568810048676368076"
]
},
{
"address": "ct_2bCbmU7vtsysL4JiUdUZjJJ98LLbJWG1fRtVApBvqSFEM59D6W",
"data": "cb_Xfbg4g==",
"topics": [
"15485047184846566156736396069994907050875216973023180189891727495730853981167",
"57639713195292369493552360805284271936076756489947923784567159882221348109905",
"92677149171721727644907713804262804720581801637012226274906210727390161108525",
"200000000000000000"
]
},
{
"address": "ct_2bCbmU7vtsysL4JiUdUZjJJ98LLbJWG1fRtVApBvqSFEM59D6W",
"data": "cb_Xfbg4g==",
"topics": [
"6675387653529534352993899574763440621350730065146058041830673378811230846814",
"57639713195292369493552360805284271936076756489947923784567159882221348109905",
"92677149171721727644907713804262804720581801637012226274906210727390161108525",
"0"
]
}
],
"nonce": 1766,
"result": "ok",
"return": {
"type": "int",
"value": 216
},
"return_type": "ok",
"type": "ContractCallTx",
"version": 1
},
"tx_index": 20904005
},
"type": "aex_9_transfer",
"additional_data": {
"amount": 2000000000000000000,
"block_height": 570863,
"call_txi": 27125236,
"contract_id": "ct_2eyXvDw3V3WSbcCpSiWcsCYHShBmEJEkU8PpUg7ymDLfZ4cSy4",
"log_idx": 5,
"micro_index": 0,
"micro_time": 1646658412647,
"recipient": "ak_Dh8X2kkZGiDVnG3LhgvRbWnfj9hxo9RUFFcdA6wFvHsNfTGpV",
"sender": "ak_y87WkN4C4QevzjTuEYHg6XLqiWx3rjfYDFLBmZiqiro5mkRag",
"tx_hash": "th_29pmGLe7Qp5vGaXUvASkSdrQ4LuQjg8e11QTzQqGxu7y81iydN"
}
}
Dev Reward Internal Transfer{
"transaction": null,
"type": "dev_reward_internal_transfer",
"additional_data": {
"account_id": "ak_2KAcA2Pp1nrR8Wkt3FtCkReGzAi8vJ9Snxa4PcmrthVx8AhPe8",
"amount": 9374108171600000000,
"height": 621083,
"kind": "reward_dev",
"ref_txi": null
}
} Fee Spend Name Internal Transfer{
"transaction": {
"block_hash": "mh_B9uuhUDYtMgUtkgN1a9TVagTytE4ZAtKBm6JW4XW9N4LndV3d",
"block_height": 620836,
"hash": "th_PGDRcCRHjbssJAHqjh4ADRhzgELAF3jFcZeCMWZdkDLeGmfUu",
"micro_index": 4,
"micro_time": 1656572103392,
"signatures": [
"sg_LcDTJSn3CdrAGuqUzsZVqxzx9baNbES456ExGH2ZQxVGeY5wGMyGwoH3oTS4y44GUZB29rnzPViXjfTF1D1iLxybYihAn"
],
"tx": {
"account_id": "ak_nWpUc3yymNLY5f2qD2dU1K1dx1ZcsrSP3ifNNsA4b363CqKDx",
"fee": 16480000000000,
"name": "zx.chain",
"name_fee": 352457800000000000000,
"name_id": "nm_HTS4fu1A29yMMweSG7yifBByBBZiXj82UQjHbWBPKuXkUFcyH",
"name_salt": 1745513846490943,
"nonce": 2,
"type": "NameClaimTx",
"version": 2
},
"tx_index": 32694596
},
"type": "fee_spend_name_internal_transfer",
"additional_data": {
"account_id": "ak_nWpUc3yymNLY5f2qD2dU1K1dx1ZcsrSP3ifNNsA4b363CqKDx",
"amount": 352457800000000000000,
"height": 620836,
"kind": "fee_spend_name",
"ref_txi": 32694596
}
} Chain.spend Function Call{
"transaction": {
"block_hash": "mh_2PNjxt4DszdKGMmYLPbV63cbGrZLkm1odoge4z1gQid1d9zWQC",
"block_height": 618669,
"hash": "th_28a8fwiYnSonAJxBP2KAm94SNDAkag3h1XvJj8yuDBZHvaKN8J",
"micro_index": 5,
"micro_time": 1656172299548,
"signatures": [
"sg_GosVdwVhZ4Av2h4PTpLkQJun49ZSAZHvu9KzioG8zwcYaBNiqnwe2f3geZRXdcDjB5Q2CWwi8v8EQjM4b9MnCpzw6BpJ3"
],
"tx": {
"abi_version": 3,
"amount": 371660000000000000000,
"arguments": [
{
"type": "contract",
"value": "ct_KeTvHnhU85vuuQMMZocaiYkPL9tkoavDRT3Jsy47LK2YqLHYb"
},
{
"type": "address",
"value": "ak_DPS1pLckyQ8CqhRymcKh9q9XE52LjTU5Rwj2mH48Eb4Bx67vK"
}
],
"call_data": "cb_KxEV1igBK58CoCpWfsefy3sCXPsFoNwnsjiGX+2lbjncVIK2cClM26tcnwCgHCAoyxtaCJbLJyXYtXkCw+eQsfSWRuxrLO2k5clPpw0TjobM",
"caller_id": "ak_QKEU2UZagBLMjGzTXG6fSHRW5BYL6ygoU6PXde8oFZEazxuRd",
"contract_id": "ct_2meHkLcAoZPrQj7P5WjFyJJRLJqRtv43z1QEbpcS1gHs9W8Q3g",
"fee": 183600000000000,
"function": "buy",
"gas": 1579000,
"gas_price": 1000000000,
"gas_used": 248068,
"log": [
{
"address": "ct_KeTvHnhU85vuuQMMZocaiYkPL9tkoavDRT3Jsy47LK2YqLHYb",
"data": "cb_Xfbg4g==",
"topics": [
"15485047184846566156736396069994907050875216973023180189891727495730853981167",
"105417517163555785945723224801218696668870882222503184278035313886450621180253",
"78358310802666329243274638441415362276768191830085298940556170962395967841219",
"557490000000000000000"
]
},
{
"address": "ct_KeTvHnhU85vuuQMMZocaiYkPL9tkoavDRT3Jsy47LK2YqLHYb",
"data": "cb_Xfbg4g==",
"topics": [
"15485047184846566156736396069994907050875216973023180189891727495730853981167",
"105417517163555785945723224801218696668870882222503184278035313886450621180253",
"23944573204997539868635097841906515400749890475032264081717075850491652064526",
"36608510000000000000000"
]
}
],
"nonce": 122,
"result": "ok",
"return": {
"type": "tuple",
"value": [
{
"type": "address",
"value": "ak_DPS1pLckyQ8CqhRymcKh9q9XE52LjTU5Rwj2mH48Eb4Bx67vK"
},
{
"type": "string",
"value": "WTT"
},
{
"type": "contract",
"value": "ct_KeTvHnhU85vuuQMMZocaiYkPL9tkoavDRT3Jsy47LK2YqLHYb"
},
{
"type": "int",
"value": 1653821085955
},
{
"type": "int",
"value": 605929
},
{
"type": "int",
"value": 3.7166e+22
},
{
"type": "int",
"value": 371660000000000000000
}
]
},
"return_type": "ok",
"type": "ContractCallTx",
"version": 1
},
"tx_index": 32660685
},
"type": "chain_spend_function_call",
"additional_data": {
"block_hash": "mh_2PNjxt4DszdKGMmYLPbV63cbGrZLkm1odoge4z1gQid1d9zWQC",
"call_tx_hash": "th_28a8fwiYnSonAJxBP2KAm94SNDAkag3h1XvJj8yuDBZHvaKN8J",
"call_txi": 32660685,
"contract_id": "ct_2meHkLcAoZPrQj7P5WjFyJJRLJqRtv43z1QEbpcS1gHs9W8Q3g",
"contract_txi": 21130617,
"function": "Chain.spend",
"height": 618669,
"internal_tx": {
"amount": 366085100000000000000,
"fee": 0,
"nonce": 0,
"payload": "ba_Q2hhaW4uc3BlbmRFa4Tl",
"recipient_id": "ak_DPS1pLckyQ8CqhRymcKh9q9XE52LjTU5Rwj2mH48Eb4Bx67vK",
"sender_id": "ak_2meHkLcAoZPrQj7P5WjFyJJRLJqRtv43z1QEbpcS1gHs9W8Q3g",
"type": "SpendTx",
"version": 1
},
"local_idx": 1,
"micro_index": 5
}
} Discussion
One idea would be to list the inner transaction that's relevant for the account as
I feel like we have |
{
"tx": {
"type": "PayingForTx",
"inner_tx": {
"type": "SpendTx",
...
}
} In this case both Additionally, we should add the
It would be nice to be able to list all activity types (type and payload) that we want, including transactions obtained via "transaction events" which occur when executing a contract call, mining events and all the events that aexn function calls trigger |
should also include contract call log event account occurrence |
As per our meeting discussion, we should probably deal with activities that are related to a transaction include the transaction inside the {
"activity_type": "key_block_mined",
"height": 1,
"mbi": -1,
"activity_index": 0,
"activity_payload": {
"kb_hash": "...",
"mining_fee": "...",
# notice no "tx" key in this object
}
}
{
"activity_type": "payment_sent",
"height": 1,
"mbi": 10,
"activity_index": 20,
"activity_payload": {
"amount": 1,
"sender_id": "...",
"recipient_id": "...",
"tx": { "type": "SpendTx", "hash": "...", "sender_id": "...", "recipient_id": "..." }
}
} |
For the wallet it is also important within such endpoint to have a aex9 related transactions, where the account (address) is also a receiver, not only sender. For example:
|
as previously discussed in #314 this should probably also be able to filter for contracts and all their information |
@sborrazas could you maybe summarise with a checklist on what is left to do here? do we want to make another issue for activities per contract + per block or track this in here as well? |
@thepiwo I can't think of any other activity type that we're missing. You can already scope the activities by generations and activities per contract would only be If you can think of any other activity type that we're missing we should add it, otherwise, we can probably close this issue |
is there a complete readable list I can quickly check? I just thought about AENS name perspective. there are also historical activities of a name which we currently discussed in a explorer meeting. we'd want to show the complete history of an AENS name, including implicit expiration / deactivation |
ok sorry, this is about accounts 🤦♂️ mhh, can we actually already get what I was talking about for an AENS name? but from account perspective this is also sth. to consider. somebody might transfer a name to me. I'd want to see that in the activity history |
@marc0olo yes I would expect this to be possible with activities, @sborrazas is it? |
Expiration of a name/oracle is not an activity on it's own, but we can definitely create one. Deactivation is not an activity directly, but since deactivation is caused by a name revoke transaction it is part of the activities indirectly |
Sorry, I agree expiration is not an account activity. But I was talking about name transfer receiver. |
For any transfer transaction, there will be an activity for both the name and the recipient of the transfer:
|
cool, thanks! 😍 |
@thepiwo as you've asked, aexn events would be possible to be indexed on activities as well. Other non-standard event wouldn't because an integer event param comes also as a 256-bit binary from the Node to the Mdw on the call logs. |
@sborrazas maybe this can be marked as done or is there anything obv. remaining? |
Done |
make an endpoiint that returns all tranactions for one account
with both plain tx that has that information, as well as
The text was updated successfully, but these errors were encountered: