Objects and Subscription API

Objects

get_objects(ids)

Get the objects corresponding to the provided IDs.
If any of the provided IDs does not map to an object, a null is returned in its position.

Parameters

Option
Description
vector<object_id_type> ids
an array of object IDs, e.g. ["1.2.1", "1.2.2", ...]

Example

1
{
2
"id": 4,
3
"method": "call",
4
"params": [
5
DATABASE_API_ID,
6
"get_objects",
7
[
8
[
9
"1.2.1",
10
"1.2.2"
11
]
12
]
13
]
14
}
Copied!

Returns

The objects retrieved, in the order they are mentioned in ids.
1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": [
5
{
6
"id": "1.2.1",
7
"registrar": "1.2.0",
8
"name": "committee-account",
9
"active": {
10
"weight_threshold": 14,
11
"account_auths": [
12
[
13
"1.2.6",
14
1
15
],
16
[
17
"1.2.7",
18
1
19
],
20
[
21
"1.2.8",
22
1
23
],
24
[
25
"1.2.9",
26
1
27
],
28
[
29
"1.2.10",
30
1
31
],
32
[
33
"1.2.11",
34
1
35
],
36
[
37
"1.2.12",
38
1
39
],
40
[
41
"1.2.13",
42
1
43
],
44
[
45
"1.2.14",
46
1
47
],
48
[
49
"1.2.15",
50
1
51
],
52
[
53
"1.2.16",
54
1
55
],
56
[
57
"1.2.17",
58
1
59
],
60
[
61
"1.2.18",
62
1
63
],
64
[
65
"1.2.19",
66
1
67
],
68
[
69
"1.2.20",
70
1
71
],
72
[
73
"1.2.21",
74
1
75
],
76
[
77
"1.2.22",
78
1
79
],
80
[
81
"1.2.23",
82
1
83
],
84
[
85
"1.2.24",
86
1
87
],
88
[
89
"1.2.25",
90
1
91
]
92
],
93
"key_auths": []
94
},
95
"echorand_key": "ECHODaQencDTLD5u6LGk9JNaMoJBh6sAkGchMnZPjtJXdvG3",
96
"options": {
97
"delegating_account": "1.2.5",
98
"delegate_share": 2000,
99
"extensions": []
100
},
101
"statistics": "2.5.1",
102
"whitelisting_accounts": [],
103
"blacklisting_accounts": [],
104
"whitelisted_accounts": [],
105
"blacklisted_accounts": [],
106
"active_special_authority": [
107
0,
108
{}
109
],
110
"top_n_control_flags": 0,
111
"accumulated_reward": 0,
112
"extensions": []
113
},
114
{
115
"id": "1.2.2",
116
"registrar": "1.2.0",
117
"name": "relaxed-committee-account",
118
"active": {
119
"weight_threshold": 1,
120
"account_auths": [],
121
"key_auths": []
122
},
123
"echorand_key": "ECHODaQencDTLD5u6LGk9JNaMoJBh6sAkGchMnZPjtJXdvG3",
124
"options": {
125
"delegating_account": "1.2.5",
126
"delegate_share": 2000,
127
"extensions": []
128
},
129
"statistics": "2.5.2",
130
"whitelisting_accounts": [],
131
"blacklisting_accounts": [],
132
"whitelisted_accounts": [],
133
"blacklisted_accounts": [],
134
"active_special_authority": [
135
0,
136
{}
137
],
138
"top_n_control_flags": 0,
139
"accumulated_reward": 0,
140
"extensions": []
141
}
142
]
143
}
Copied!

Subscriptions

set_subscribe_callback(callback, clear_filter)

Subscribe to updates.

Parameters

Option
Description
function<void(variant)> callback
global subscription callback can be registered
clear_filter
whether subscribe to universal object creation and removal events
If clear_filter is set to true, the API server will notify all newly created objects and ID of all newly removed objects to the client, no matter whether client subscribed to the objects

Example

1
{
2
"id": 4,
3
"method": "call",
4
"params": [
5
DATABASE_API_ID,
6
"set_subscribe_callback",
7
[
8
CALLBACK_ID,
9
true
10
]
11
]
12
}
Copied!

Returns

1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": null
5
}
Copied!

Notice example

1
{
2
"method": "notice",
3
"params": [
4
CALLBACK_ID,
5
[
6
[
7
{
8
"id": "2.1.0", ...
9
},
10
{
11
"id": ...
12
},
13
{
14
"id": ...
15
},
16
{
17
"id": ...
18
}
19
]
20
]
21
],
22
}
Copied!

set_pending_transaction_callback(callback)

Subscribe to pending transactions.

Parameters

Option
Description
function<void(variant)> callback
notifications for incoming unconfirmed transactions

Example

1
{
2
"id": 4,
3
"method": "call",
4
"params": [
5
DATABASE_API_ID,
6
"set_pending_transaction_callback",
7
[
8
CALLBACK_ID
9
]
10
]
11
}
Copied!

Returns

1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": null
5
}
Copied!

Notice example

1
{
2
"method": "notice",
3
"params": [
4
CALLBACK_ID,
5
[
6
{
7
"ref_block_num": 46,
8
"ref_block_prefix": 620557504,
9
"expiration": "2019-08-14T12:35:31",
10
"operations": [
11
[
12
21,
13
{
14
"fee": {
15
"amount": 0,
16
"asset_id": "1.3.0"
17
},
18
"deposit_to_account": "1.2.26",
19
"balance_to_claim": "1.8.0",
20
"balance_owner_key": "ECHO6XS3BMVnEHAzo1PhHWt9vndrZn2P27tCbU9WdqCM8sJu",
21
"total_claimed": {
22
"amount": "1000000000000000",
23
"asset_id": "1.3.0"
24
},
25
"extensions": []
26
}
27
]
28
],
29
"extensions": [],
30
"signatures": [
31
"1c8747b07f8131b4caaa52932c14a2472b52fdff339456ceb52befe5f2f14142e0020a4ba02258a68c43668bd36fc4c56ba19234a9a525e9c493fbc251103e0a"
32
],
33
"signed_with_echorand_key": false
34
}
35
]
36
]
37
}
Copied!

set_block_applied_callback(callback)

Subscribe to block applications.

Parameters

Option
Description
function<void(variant block_id)> callback
gives a notification whenever the block block_id is applied to the blockchain

Example

1
{
2
"id": 4,
3
"method": "call",
4
"params": [
5
DATABASE_API_ID,
6
"set_block_applied_callback",
7
[
8
CALLBACK_ID
9
]
10
]
11
}
Copied!

Returns

1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": null
5
}
Copied!

Notice example

1
{
2
"method": "notice",
3
"params": [
4
CALLBACK_ID,
5
[
6
"0013191865d4306288d52d2f648476508a159a0d"
7
]
8
]
9
}
Copied!

cancel_all_subscriptions()

Stop receiving any notifications. Unsubscribe from all subscribed objects.

Example

1
{
2
"id": 4,
3
"method": "call",
4
"params": [
5
DATABASE_API_ID,
6
"cancel_all_subscriptions",
7
[
8
CALLBACK_ID
9
]
10
]
11
}
Copied!

Returns

1
{
2
"id": 4,
3
"jsonrpc": "2.0",
4
"result": null
5
}
Copied!
Last modified 1yr ago