Skip to content

Commit c9440dd

Browse files
authored
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]
1 parent a0856f9 commit c9440dd

18 files changed

+1324
-21
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"limit": 20,
3+
"offset": 0,
4+
"total": 4,
5+
"results": [
6+
{
7+
"type": "stx",
8+
"event_index": 0,
9+
"data": {
10+
"type": "transfer",
11+
"amount": "200",
12+
"sender": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE",
13+
"recipient": "SP24Q9PK9DNTA2V89APY8WNBJ1QYKKSW9SWB04RJP"
14+
}
15+
},
16+
{
17+
"type": "stx",
18+
"event_index": 1,
19+
"data": {
20+
"type": "transfer",
21+
"amount": "150",
22+
"sender": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE",
23+
"recipient": "SP26066SDPP4NXKGCVYZQDR5GX2QPE8KADZ0YK2J7"
24+
}
25+
},
26+
{
27+
"type": "ft",
28+
"event_index": 5,
29+
"data": {
30+
"type": "transfer",
31+
"amount": "103",
32+
"asset_identifier": "SP466FNC0P7JWTNM2R9T199QRZN1MYEDTAR0KP27.miamicoin-token::miamicoin",
33+
"sender": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE",
34+
"recipient": "SP24Q9PK9DNTA2V89APY8WNBJ1QYKKSW9SWB04RJP"
35+
}
36+
},
37+
{
38+
"type": "nft",
39+
"event_index": 6,
40+
"data": {
41+
"type": "transfer",
42+
"asset_identifier": "SP497E7RX3233ATBS2AB9G4WTHB63X5PBSP5VGAQ.boom-nfts::boom",
43+
"value": { "hex": "0x00", "repr": "0" },
44+
"sender": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE",
45+
"recipient": "SP24Q9PK9DNTA2V89APY8WNBJ1QYKKSW9SWB04RJP"
46+
}
47+
}
48+
]
49+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"description": "GET Address Transaction Events",
3+
"title": "AddressTransactionEventListResponse",
4+
"type": "object",
5+
"additionalProperties": false,
6+
"required": ["results", "limit", "offset", "total"],
7+
"properties": {
8+
"limit": {
9+
"type": "integer",
10+
"maximum": 30
11+
},
12+
"offset": {
13+
"type": "integer"
14+
},
15+
"total": {
16+
"type": "integer"
17+
},
18+
"results": {
19+
"type": "array",
20+
"items": {
21+
"$ref": "../../entities/address/address-transaction-event.schema.json"
22+
}
23+
}
24+
}
25+
}
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
{
2+
"limit": 20,
3+
"offset": 0,
4+
"total": 2,
5+
"results": [
6+
{
7+
"tx": {
8+
"tx_id": "0x34d79c7cfc2fe525438736733e501a4bf0308a5556e3e080d1e2c0858aad7448",
9+
"tx_type": "contract_call",
10+
"nonce": 11,
11+
"fee_rate": "346",
12+
"sender_address": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE",
13+
"sponsored": false,
14+
"post_condition_mode": "deny",
15+
"tx_status": "success",
16+
"block_hash": "0x13d1b4ad35c95bca209397420fb8af104d2929d91993ba056d7a1ca5470095f9",
17+
"block_height": 3246,
18+
"burn_block_time": 1613009951,
19+
"burn_block_time_iso": "2021-02-11T02:19:11.000Z",
20+
"canonical": true,
21+
"is_unanchored": false,
22+
"microblock_hash": "0x590a1bb1d7bcbeafce0a9fc8f8a69e369486192d14687fe95fbe4dc1c71d49df",
23+
"microblock_sequence": 5,
24+
"microblock_canonical": true,
25+
"tx_index": 1,
26+
"tx_result": {
27+
"hex": "0x0703",
28+
"repr": "(ok true)"
29+
},
30+
"post_conditions": [
31+
{
32+
"type": "stx",
33+
"condition_code": "sent_equal_to",
34+
"amount": "350",
35+
"principal": {
36+
"type_id": "principal_standard",
37+
"address": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE"
38+
}
39+
}
40+
],
41+
"contract_call": {
42+
"contract_id": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.send-many-memo",
43+
"function_name": "send-many",
44+
"function_signature": "(define-public (send-many (recipients (list 200 (tuple (memo (buff 34)) (to principal) (ustx uint))))))",
45+
"function_args": [
46+
{
47+
"hex": "0x0b000000020c00000003046d656d6f020000000966697273746d656d6f02746f05168c031b2db5895ece0cdfbf76e0b0e8af67226a6f047573747801000000000000000000000000000000960c00000003046d656d6f020000000a7365636f6e646d656d6f02746f05168974da696d74a16d0955bc8e55720dfd39e789cf047573747801000000000000000000000000000000c8",
48+
"repr": "(list (tuple (memo 0x66697273746d656d6f) (to SP26066SDPP4NXKGCVYZQDR5GX2QPE8KADZ0YK2J7) (ustx u150)) (tuple (memo 0x7365636f6e646d656d6f) (to SP24Q9PK9DNTA2V89APY8WNBJ1QYKKSW9SWB04RJP) (ustx u200)))",
49+
"name": "recipients",
50+
"type": "(list 200 (tuple (memo (buff 34)) (to principal) (ustx uint)))"
51+
}
52+
]
53+
},
54+
"events": [],
55+
"event_count": 4
56+
},
57+
"stx_sent": "696",
58+
"stx_received": "0",
59+
"events": {
60+
"stx": {
61+
"transfer": 2,
62+
"mint": 0,
63+
"burn": 0
64+
},
65+
"ft": {
66+
"transfer": 1,
67+
"mint": 0,
68+
"burn": 0
69+
},
70+
"nft": {
71+
"transfer": 1,
72+
"mint": 0,
73+
"burn": 0
74+
}
75+
}
76+
},
77+
{
78+
"tx": {
79+
"tx_id": "0x628045bff13658396277d618e9a3e4d468a4b3876eff4941d2f13ed88cd7abb7",
80+
"tx_type": "token_transfer",
81+
"nonce": 8,
82+
"fee_rate": "180",
83+
"sender_address": "SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE",
84+
"sponsored": false,
85+
"post_condition_mode": "deny",
86+
"tx_status": "success",
87+
"block_hash": "0x2b8599696f64e2456c67b1ab5e63078f99d87bd1d903c37fdcfd73b1890a7551",
88+
"block_height": 1761,
89+
"burn_block_time": 1611968237,
90+
"burn_block_time_iso": "2021-01-30T00:57:17.000Z",
91+
"canonical": true,
92+
"is_unanchored": false,
93+
"microblock_hash": "",
94+
"microblock_sequence": 2147483647,
95+
"microblock_canonical": true,
96+
"tx_index": 2,
97+
"tx_result": {
98+
"hex": "0x0703",
99+
"repr": "(ok true)"
100+
},
101+
"token_transfer": {
102+
"recipient_address": "SPRSM0R2JZWBCZ39NQBARWTMX9TE99K3JK8D5KMX",
103+
"amount": "100000",
104+
"memo": "0x57656c636f6d6520746f20426f6f6d2e000000000000000000000000000000000000"
105+
},
106+
"events": [],
107+
"event_count": 1
108+
},
109+
"stx_sent": "100180",
110+
"stx_received": "0",
111+
"events": {
112+
"stx": {
113+
"transfer": 1,
114+
"mint": 0,
115+
"burn": 0
116+
},
117+
"ft": {
118+
"transfer": 0,
119+
"mint": 0,
120+
"burn": 0
121+
},
122+
"nft": {
123+
"transfer": 0,
124+
"mint": 0,
125+
"burn": 0
126+
}
127+
}
128+
}
129+
]
130+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"description": "GET Address Transactions",
3+
"title": "AddressTransactionsV2ListResponse",
4+
"type": "object",
5+
"additionalProperties": false,
6+
"required": ["results", "limit", "offset", "total"],
7+
"properties": {
8+
"limit": {
9+
"type": "integer",
10+
"maximum": 30
11+
},
12+
"offset": {
13+
"type": "integer"
14+
},
15+
"total": {
16+
"type": "integer"
17+
},
18+
"results": {
19+
"type": "array",
20+
"items": {
21+
"$ref": "../../entities/address/address-transaction.schema.json"
22+
}
23+
}
24+
}
25+
}
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
{
2+
"description": "Address Transaction Event",
3+
"title": "AddressTransactionEvent",
4+
"type": "object",
5+
"anyOf": [
6+
{
7+
"type": "object",
8+
"additionalProperties": false,
9+
"required": ["type", "event_index", "data"],
10+
"properties": {
11+
"type": {
12+
"type": "string",
13+
"enum": ["stx"]
14+
},
15+
"event_index": {
16+
"type": "integer"
17+
},
18+
"data": {
19+
"type": "object",
20+
"additionalProperties": false,
21+
"required": [
22+
"amount", "type"
23+
],
24+
"properties": {
25+
"type": {
26+
"type": "string",
27+
"enum": ["transfer", "mint", "burn"]
28+
},
29+
"amount": {
30+
"type": "string",
31+
"description": "Amount transferred in micro-STX as an integer string."
32+
},
33+
"sender": {
34+
"type": "string",
35+
"description": "Principal that sent STX. This is unspecified if the STX were minted."
36+
},
37+
"recipient": {
38+
"type": "string",
39+
"description": "Principal that received STX. This is unspecified if the STX were burned."
40+
}
41+
}
42+
}
43+
}
44+
},
45+
{
46+
"type": "object",
47+
"additionalProperties": false,
48+
"required": ["type", "event_index", "data"],
49+
"properties": {
50+
"type": {
51+
"type": "string",
52+
"enum": ["ft"]
53+
},
54+
"event_index": {
55+
"type": "integer"
56+
},
57+
"data": {
58+
"type": "object",
59+
"additionalProperties": false,
60+
"required": [
61+
"amount", "asset_identifier", "type"
62+
],
63+
"properties": {
64+
"type": {
65+
"type": "string",
66+
"enum": ["transfer", "mint", "burn"]
67+
},
68+
"asset_identifier": {
69+
"type": "string",
70+
"description": "Fungible Token asset identifier."
71+
},
72+
"amount": {
73+
"type": "string",
74+
"description": "Amount transferred as an integer string. This balance does not factor in possible SIP-010 decimals."
75+
},
76+
"sender": {
77+
"type": "string",
78+
"description": "Principal that sent the asset."
79+
},
80+
"recipient": {
81+
"type": "string",
82+
"description": "Principal that received the asset."
83+
}
84+
}
85+
}
86+
}
87+
},
88+
{
89+
"type": "object",
90+
"additionalProperties": false,
91+
"required": ["type", "event_index", "data"],
92+
"properties": {
93+
"type": {
94+
"type": "string",
95+
"enum": ["nft"]
96+
},
97+
"event_index": {
98+
"type": "integer"
99+
},
100+
"data": {
101+
"type": "object",
102+
"additionalProperties": false,
103+
"required": [
104+
"asset_identifier", "value", "type"
105+
],
106+
"properties": {
107+
"type": {
108+
"type": "string",
109+
"enum": ["transfer", "mint", "burn"]
110+
},
111+
"asset_identifier": {
112+
"type": "string",
113+
"description": "Non Fungible Token asset identifier."
114+
},
115+
"value": {
116+
"type": "object",
117+
"description": "Non Fungible Token asset value.",
118+
"additionalProperties": false,
119+
"required": ["hex", "repr"],
120+
"properties": {
121+
"hex": {
122+
"type": "string"
123+
},
124+
"repr": {
125+
"type": "string"
126+
}
127+
}
128+
},
129+
"sender": {
130+
"type": "string",
131+
"description": "Principal that sent the asset."
132+
},
133+
"recipient": {
134+
"type": "string",
135+
"description": "Principal that received the asset."
136+
}
137+
}
138+
}
139+
}
140+
}
141+
]
142+
}

0 commit comments

Comments
 (0)