-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add v2 addresses endpoints (#1876)
* feat: account txs * fix: add tests and deprecate old endpoints * feat: transaction transfers endpoint * docs: event_index * fix: names * fix: event detail * fix: rename to /events endpoint * docs: update examples * docs: typos [skip ci]
- Loading branch information
Showing
18 changed files
with
1,324 additions
and
21 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
docs/api/address/get-address-transaction-events.example.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"limit": 20, | ||
"offset": 0, | ||
"total": 4, | ||
"results": [ | ||
{ | ||
"type": "stx", | ||
"event_index": 0, | ||
"data": { | ||
"type": "transfer", | ||
"amount": "200", | ||
"sender": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE", | ||
"recipient": "SP24Q9PK9DNTA2V89APY8WNBJ1QYKKSW9SWB04RJP" | ||
} | ||
}, | ||
{ | ||
"type": "stx", | ||
"event_index": 1, | ||
"data": { | ||
"type": "transfer", | ||
"amount": "150", | ||
"sender": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE", | ||
"recipient": "SP26066SDPP4NXKGCVYZQDR5GX2QPE8KADZ0YK2J7" | ||
} | ||
}, | ||
{ | ||
"type": "ft", | ||
"event_index": 5, | ||
"data": { | ||
"type": "transfer", | ||
"amount": "103", | ||
"asset_identifier": "SP466FNC0P7JWTNM2R9T199QRZN1MYEDTAR0KP27.miamicoin-token::miamicoin", | ||
"sender": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE", | ||
"recipient": "SP24Q9PK9DNTA2V89APY8WNBJ1QYKKSW9SWB04RJP" | ||
} | ||
}, | ||
{ | ||
"type": "nft", | ||
"event_index": 6, | ||
"data": { | ||
"type": "transfer", | ||
"asset_identifier": "SP497E7RX3233ATBS2AB9G4WTHB63X5PBSP5VGAQ.boom-nfts::boom", | ||
"value": { "hex": "0x00", "repr": "0" }, | ||
"sender": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE", | ||
"recipient": "SP24Q9PK9DNTA2V89APY8WNBJ1QYKKSW9SWB04RJP" | ||
} | ||
} | ||
] | ||
} |
25 changes: 25 additions & 0 deletions
25
docs/api/address/get-address-transaction-events.schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"description": "GET Address Transaction Events", | ||
"title": "AddressTransactionEventListResponse", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"required": ["results", "limit", "offset", "total"], | ||
"properties": { | ||
"limit": { | ||
"type": "integer", | ||
"maximum": 30 | ||
}, | ||
"offset": { | ||
"type": "integer" | ||
}, | ||
"total": { | ||
"type": "integer" | ||
}, | ||
"results": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "../../entities/address/address-transaction-event.schema.json" | ||
} | ||
} | ||
} | ||
} |
130 changes: 130 additions & 0 deletions
130
docs/api/address/get-v2-address-transactions.example.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
{ | ||
"limit": 20, | ||
"offset": 0, | ||
"total": 2, | ||
"results": [ | ||
{ | ||
"tx": { | ||
"tx_id": "0x34d79c7cfc2fe525438736733e501a4bf0308a5556e3e080d1e2c0858aad7448", | ||
"tx_type": "contract_call", | ||
"nonce": 11, | ||
"fee_rate": "346", | ||
"sender_address": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE", | ||
"sponsored": false, | ||
"post_condition_mode": "deny", | ||
"tx_status": "success", | ||
"block_hash": "0x13d1b4ad35c95bca209397420fb8af104d2929d91993ba056d7a1ca5470095f9", | ||
"block_height": 3246, | ||
"burn_block_time": 1613009951, | ||
"burn_block_time_iso": "2021-02-11T02:19:11.000Z", | ||
"canonical": true, | ||
"is_unanchored": false, | ||
"microblock_hash": "0x590a1bb1d7bcbeafce0a9fc8f8a69e369486192d14687fe95fbe4dc1c71d49df", | ||
"microblock_sequence": 5, | ||
"microblock_canonical": true, | ||
"tx_index": 1, | ||
"tx_result": { | ||
"hex": "0x0703", | ||
"repr": "(ok true)" | ||
}, | ||
"post_conditions": [ | ||
{ | ||
"type": "stx", | ||
"condition_code": "sent_equal_to", | ||
"amount": "350", | ||
"principal": { | ||
"type_id": "principal_standard", | ||
"address": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE" | ||
} | ||
} | ||
], | ||
"contract_call": { | ||
"contract_id": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.send-many-memo", | ||
"function_name": "send-many", | ||
"function_signature": "(define-public (send-many (recipients (list 200 (tuple (memo (buff 34)) (to principal) (ustx uint))))))", | ||
"function_args": [ | ||
{ | ||
"hex": "0x0b000000020c00000003046d656d6f020000000966697273746d656d6f02746f05168c031b2db5895ece0cdfbf76e0b0e8af67226a6f047573747801000000000000000000000000000000960c00000003046d656d6f020000000a7365636f6e646d656d6f02746f05168974da696d74a16d0955bc8e55720dfd39e789cf047573747801000000000000000000000000000000c8", | ||
"repr": "(list (tuple (memo 0x66697273746d656d6f) (to SP26066SDPP4NXKGCVYZQDR5GX2QPE8KADZ0YK2J7) (ustx u150)) (tuple (memo 0x7365636f6e646d656d6f) (to SP24Q9PK9DNTA2V89APY8WNBJ1QYKKSW9SWB04RJP) (ustx u200)))", | ||
"name": "recipients", | ||
"type": "(list 200 (tuple (memo (buff 34)) (to principal) (ustx uint)))" | ||
} | ||
] | ||
}, | ||
"events": [], | ||
"event_count": 4 | ||
}, | ||
"stx_sent": "696", | ||
"stx_received": "0", | ||
"events": { | ||
"stx": { | ||
"transfer": 2, | ||
"mint": 0, | ||
"burn": 0 | ||
}, | ||
"ft": { | ||
"transfer": 1, | ||
"mint": 0, | ||
"burn": 0 | ||
}, | ||
"nft": { | ||
"transfer": 1, | ||
"mint": 0, | ||
"burn": 0 | ||
} | ||
} | ||
}, | ||
{ | ||
"tx": { | ||
"tx_id": "0x628045bff13658396277d618e9a3e4d468a4b3876eff4941d2f13ed88cd7abb7", | ||
"tx_type": "token_transfer", | ||
"nonce": 8, | ||
"fee_rate": "180", | ||
"sender_address": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE", | ||
"sponsored": false, | ||
"post_condition_mode": "deny", | ||
"tx_status": "success", | ||
"block_hash": "0x2b8599696f64e2456c67b1ab5e63078f99d87bd1d903c37fdcfd73b1890a7551", | ||
"block_height": 1761, | ||
"burn_block_time": 1611968237, | ||
"burn_block_time_iso": "2021-01-30T00:57:17.000Z", | ||
"canonical": true, | ||
"is_unanchored": false, | ||
"microblock_hash": "", | ||
"microblock_sequence": 2147483647, | ||
"microblock_canonical": true, | ||
"tx_index": 2, | ||
"tx_result": { | ||
"hex": "0x0703", | ||
"repr": "(ok true)" | ||
}, | ||
"token_transfer": { | ||
"recipient_address": "SPRSM0R2JZWBCZ39NQBARWTMX9TE99K3JK8D5KMX", | ||
"amount": "100000", | ||
"memo": "0x57656c636f6d6520746f20426f6f6d2e000000000000000000000000000000000000" | ||
}, | ||
"events": [], | ||
"event_count": 1 | ||
}, | ||
"stx_sent": "100180", | ||
"stx_received": "0", | ||
"events": { | ||
"stx": { | ||
"transfer": 1, | ||
"mint": 0, | ||
"burn": 0 | ||
}, | ||
"ft": { | ||
"transfer": 0, | ||
"mint": 0, | ||
"burn": 0 | ||
}, | ||
"nft": { | ||
"transfer": 0, | ||
"mint": 0, | ||
"burn": 0 | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"description": "GET Address Transactions", | ||
"title": "AddressTransactionsV2ListResponse", | ||
"type": "object", | ||
"additionalProperties": false, | ||
"required": ["results", "limit", "offset", "total"], | ||
"properties": { | ||
"limit": { | ||
"type": "integer", | ||
"maximum": 30 | ||
}, | ||
"offset": { | ||
"type": "integer" | ||
}, | ||
"total": { | ||
"type": "integer" | ||
}, | ||
"results": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "../../entities/address/address-transaction.schema.json" | ||
} | ||
} | ||
} | ||
} |
142 changes: 142 additions & 0 deletions
142
docs/entities/address/address-transaction-event.schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
{ | ||
"description": "Address Transaction Event", | ||
"title": "AddressTransactionEvent", | ||
"type": "object", | ||
"anyOf": [ | ||
{ | ||
"type": "object", | ||
"additionalProperties": false, | ||
"required": ["type", "event_index", "data"], | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"enum": ["stx"] | ||
}, | ||
"event_index": { | ||
"type": "integer" | ||
}, | ||
"data": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"required": [ | ||
"amount", "type" | ||
], | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"enum": ["transfer", "mint", "burn"] | ||
}, | ||
"amount": { | ||
"type": "string", | ||
"description": "Amount transferred in micro-STX as an integer string." | ||
}, | ||
"sender": { | ||
"type": "string", | ||
"description": "Principal that sent STX. This is unspecified if the STX were minted." | ||
}, | ||
"recipient": { | ||
"type": "string", | ||
"description": "Principal that received STX. This is unspecified if the STX were burned." | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "object", | ||
"additionalProperties": false, | ||
"required": ["type", "event_index", "data"], | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"enum": ["ft"] | ||
}, | ||
"event_index": { | ||
"type": "integer" | ||
}, | ||
"data": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"required": [ | ||
"amount", "asset_identifier", "type" | ||
], | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"enum": ["transfer", "mint", "burn"] | ||
}, | ||
"asset_identifier": { | ||
"type": "string", | ||
"description": "Fungible Token asset identifier." | ||
}, | ||
"amount": { | ||
"type": "string", | ||
"description": "Amount transferred as an integer string. This balance does not factor in possible SIP-010 decimals." | ||
}, | ||
"sender": { | ||
"type": "string", | ||
"description": "Principal that sent the asset." | ||
}, | ||
"recipient": { | ||
"type": "string", | ||
"description": "Principal that received the asset." | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"type": "object", | ||
"additionalProperties": false, | ||
"required": ["type", "event_index", "data"], | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"enum": ["nft"] | ||
}, | ||
"event_index": { | ||
"type": "integer" | ||
}, | ||
"data": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"required": [ | ||
"asset_identifier", "value", "type" | ||
], | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"enum": ["transfer", "mint", "burn"] | ||
}, | ||
"asset_identifier": { | ||
"type": "string", | ||
"description": "Non Fungible Token asset identifier." | ||
}, | ||
"value": { | ||
"type": "object", | ||
"description": "Non Fungible Token asset value.", | ||
"additionalProperties": false, | ||
"required": ["hex", "repr"], | ||
"properties": { | ||
"hex": { | ||
"type": "string" | ||
}, | ||
"repr": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"sender": { | ||
"type": "string", | ||
"description": "Principal that sent the asset." | ||
}, | ||
"recipient": { | ||
"type": "string", | ||
"description": "Principal that received the asset." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} |
Oops, something went wrong.