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

feat: add v2 addresses endpoints #1876

Merged
merged 9 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions docs/api/address/get-address-transaction-transfers.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"limit": 20,
"offset": 0,
"total": 4,
"results": [
{
"type": "stx_transfer",
"event_index": 0,
"data": {
"amount": "200",
"sender": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE",
"recipient": "SP24Q9PK9DNTA2V89APY8WNBJ1QYKKSW9SWB04RJP"
}
},
{
"type": "stx_transfer",
"event_index": 1,
"data": {
"amount": "150",
"sender": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE",
"recipient": "SP26066SDPP4NXKGCVYZQDR5GX2QPE8KADZ0YK2J7"
}
},
{
"type": "ft_transfer",
"event_index": 5,
"data": {
"amount": "103",
"asset_identifier": "SP466FNC0P7JWTNM2R9T199QRZN1MYEDTAR0KP27.miamicoin-token::miamicoin",
"sender": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE",
"recipient": "SP24Q9PK9DNTA2V89APY8WNBJ1QYKKSW9SWB04RJP"
}
},
{
"type": "nft_transfer",
"event_index": 6,
"data": {
"asset_identifier": "SP497E7RX3233ATBS2AB9G4WTHB63X5PBSP5VGAQ.boom-nfts::boom",
"value": { "hex": "0x00", "repr": "0" },
"sender": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE",
"recipient": "SP24Q9PK9DNTA2V89APY8WNBJ1QYKKSW9SWB04RJP"
}
}
]
}
25 changes: 25 additions & 0 deletions docs/api/address/get-address-transaction-transfers.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"description": "GET Address Transaction Transfers",
"title": "AddressTransactionTransfersListResponse",
"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-transfer.schema.json"
}
}
}
}
102 changes: 102 additions & 0 deletions docs/api/address/get-v2-address-transactions.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{
"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",
"stx_transfers": 2,
"ft_transfers": 1,
"nft_transfers": 1
},
{
"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",
"stx_transfers": 1,
"ft_transfers": 0,
"nft_transfers": 0
}
]
}
25 changes: 25 additions & 0 deletions docs/api/address/get-v2-address-transactions.schema.json
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"
}
}
}
}
130 changes: 130 additions & 0 deletions docs/entities/address/address-transaction-transfer.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"description": "Address Transaction Transfer",
"title": "AddressTransactionTransfer",
"type": "object",
"anyOf": [
{
"type": "object",
"additionalProperties": false,
"required": ["type", "event_index", "data"],
"properties": {
"type": {
"type": "string",
"enum": ["stx_transfer"]
},
"event_index": {
"type": "integer"
},
"data": {
"type": "object",
"additionalProperties": false,
"required": [
"amount"
],
"properties": {
"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_transfer"]
},
"event_index": {
"type": "integer"
},
"data": {
"type": "object",
"additionalProperties": false,
"required": [
"amount", "asset_identifier"
],
"properties": {
"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_transfer"]
},
"event_index": {
"type": "integer"
},
"data": {
"type": "object",
"additionalProperties": false,
"required": [
"asset_identifier", "value"
],
"properties": {
"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."
}
}
}
}
}
]
}
39 changes: 39 additions & 0 deletions docs/entities/address/address-transaction.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"title": "AddressTransaction",
"description": "Address transaction with STX, FT and NFT transfer summaries",
"type": "object",
"additionalProperties": false,
"required": [
"tx",
"stx_sent",
"stx_received",
"stx_transfers",
"ft_transfers",
"nft_transfers"
],
"properties": {
"tx": {
"$ref": "../transactions/transaction.schema.json"
},
"stx_sent": {
"type": "string",
"description": "Total sent from the given address, including the tx fee, in micro-STX as an integer string."
},
"stx_received": {
"type": "string",
"description": "Total received by the given address in micro-STX as an integer string."
},
"stx_transfers": {
"type": "integer",
"description": "Number of STX transfers for this account in this transaction"
},
"ft_transfers": {
"type": "integer",
"description": "Number of FT transfers for this account in this transaction"
},
"nft_transfers": {
"type": "integer",
"description": "Number of NFT transfers for this account in this transaction"
}
}
}
Loading
Loading