-
Notifications
You must be signed in to change notification settings - Fork 17
/
gxb_contract_api.json
511 lines (511 loc) · 15.6 KB
/
gxb_contract_api.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
{
"types": [
{
"name": "uint64_t"
},
{
"name": "int64_t"
},
{
"name": "uint32_t"
},
{
"name": "int32_t"
},
{
"name": "uint16_t"
},
{
"name": "int16_t"
},
{
"name": "signature"
},
{
"name": "checksum256"
},
{
"name": "checksum512"
},
{
"name": "block_id_type"
},
{
"name": "contract"
},
{
"name": "contract_asset"
}
],
"keywords": [
{
"name": "@abi"
},
{
"name": "ACTION"
},
{
"name": "PAYABLE"
},
{
"name": "TABLE"
},
{
"name": "GRAPHENE_ABI"
},
{
"name": "GRAPHENE_SERIALIZE"
}
],
"abi_keywords": [
{
"name": "action"
},
{
"name": "table"
},
{
"name": "payable"
}
],
"apis": [
{
"name": "current_receiver",
"returnType": "uint64_t",
"belong": "<graphenelib/action.h>",
"description": {
"zh-CN": "返回当前合约账号的id",
"en-US": "return current contract account ID"
}
},
{
"name": "get_action_asset_id",
"returnType": "uint64_t",
"belong": "<graphenelib/action.h>",
"description": {
"zh-CN": "返回本次调用向合约发送的资产id",
"en-US": "get aseet ID of this call"
}
},
{
"name": "get_action_asset_amount",
"returnType": "uint64_t",
"belong": "<graphenelib/action.h>",
"description": {
"zh-CN": "返回本次调用向合约发送的资产数量",
"en-US": "get asset amount of this call"
}
},
{
"name": "withdraw_asset",
"returnType": "void",
"belong": "<graphenelib/asset.h>",
"fields": [
{
"name": "from",
"type": "uint64_t",
"description": {
"zh-CN": "从哪个账号转账,一般是_self",
"en-US": "transfer from which account, normally _self"
}
},
{
"name": "to",
"type": "uint64_t",
"description": {
"zh-CN": "转账到哪个外部账户,必须只传账号的instance_id,比如外部账户是1.2.33,那么传33即可",
"en-US": ""
}
},
{
"name": "asset_id",
"type": "uint64_t",
"description": {
"zh-CN": "指定转账的资产id,必须只传资产id的instance_id, 比如资产id是1.3.0, 那么传0即可",
"en-US": ""
}
},
{
"name": "amount",
"type": "int64_t",
"description": {
"zh-CN": "转账金额,这个数字包含了资产的精度,比如想转1个GXC,那么应该写100000",
"en-US": ""
}
}
],
"description": {
"zh-CN": "将当前合约的资产转移到外部账户",
"en-US": "withdraw current account asset to another account"
}
},
{
"name": "get_balance",
"returnType": "int64_t",
"belong": "<graphenelib/asset.h>",
"fields": [
{
"name": "account",
"type": "int64_t",
"description": {
"zh-CN": "外部账户的instace_id",
"en-US": ""
}
},
{
"name": "asset_id",
"type": "int64_t",
"description": {
"zh-CN": "指定资产的instance_id",
"en-US": ""
}
}
],
"description": {
"zh-CN": "获取外部账户的某资产余额",
"en-US": "get balance of some account"
}
},
{
"name": "sha256",
"returnType": "void",
"belong": "<graphenelib/crypto.h>",
"fields": [
{
"name": "data",
"type": "char",
"description": {
"zh-CN": "用于计算sha256的字符串首地址",
"en-US": ""
}
},
{
"name": "length",
"type": "uint32_t",
"description": {
"zh-CN": "data字符串的长度",
"en-US": ""
}
},
{
"name": "hash",
"type": "const checksum256 *",
"description": {
"zh-CN": "出参 用于存储计算的sha256",
"en-US": ""
}
}
],
"description": {
"zh-CN": "计算数据的sha256",
"en-US": "get data's sha256"
}
},
{
"name": "sha512",
"returnType": "void",
"belong": "<graphenelib/crypto.h>",
"fields": [
{
"name": "data",
"type": "char",
"description": {
"zh-CN": "用于计算sha512的字符串首地址",
"en-US": ""
}
},
{
"name": "length",
"type": "uint32_t",
"description": {
"zh-CN": "data字符串的长度",
"en-US": ""
}
},
{
"name": "hash",
"type": "const checksum512 *",
"description": {
"zh-CN": "出参 用于存储计算的sha512",
"en-US": ""
}
}
],
"description": {
"zh-CN": "计算数据的sha512",
"en-US": "get data's sha512"
}
},
{
"name": "ripemd160",
"returnType": "void",
"belong": "<graphenelib/crypto.h>",
"fields": [
{
"name": "data",
"type": "char",
"description": {
"zh-CN": "用于计算ripemd160的字符串首地址",
"en-US": ""
}
},
{
"name": "length",
"type": "uint32_t",
"description": {
"zh-CN": "data字符串的长度",
"en-US": ""
}
},
{
"name": "hash",
"type": "const checksum160 *",
"description": {
"zh-CN": "出参 用于存储计算的ripemd160",
"en-US": ""
}
}
],
"description": {
"zh-CN": "计算数据的ripemd160",
"en-US": "get data's ripemd160"
}
},
{
"name": "verify_signature",
"returnType": "bool",
"belong": "<graphenelib/crypto.h>",
"fields": [
{
"name": "data",
"type": "const char",
"description": {
"zh-CN": "签名的原始字符串",
"en-US": ""
}
},
{
"name": "datalen",
"type": "uint32_t",
"description": {
"zh-CN": "data字符串的长度",
"en-US": ""
}
},
{
"name": "sig",
"type": "signature",
"description": {
"zh-CN": "签名数据",
"en-US": ""
}
},
{
"name": "pub_key",
"type": "const char *",
"description": {
"zh-CN": "签名私钥对应的公钥",
"en-US": ""
}
},
{
"name": "pub_keylen",
"type": "uint32_t",
"description": {
"zh-CN": "公钥的长度",
"en-US": ""
}
}
],
"description": {
"zh-CN": "验证签名",
"en-US": "verify signature"
}
},
{
"name": "get_head_block_num",
"returnType": "int64_t",
"belong": "<graphenelib/global.h>",
"fields": [],
"description": {
"zh-CN": "获取最新区块号",
"en-US": "get latest block number"
}
},
{
"name": "get_head_block_id",
"returnType": "int64_t",
"belong": "<graphenelib/global.h>",
"fields": [],
"description": {
"zh-CN": "获取最新区块hash",
"en-US": "get latest block hash"
}
},
{
"name": "get_head_block_time",
"returnType": "int64_t",
"belong": "<graphenelib/global.h>",
"fields": [],
"description": {
"zh-CN": "获取最新区块的时间,返回值单位秒",
"en-US": "get latest block time, unit is seconds"
}
},
{
"name": "get_trx_sender",
"returnType": "int64_t",
"belong": "<graphenelib/global.h>",
"fields": [],
"description": {
"zh-CN": "获取调用合约的账号的instance_id",
"en-US": "get caller account's instance_id"
}
},
{
"name": "get_trx_origin",
"returnType": "int64_t",
"belong": "<graphenelib/global.h>",
"fields": [],
"description": {
"zh-CN": "获取原始调用合约的账号的instance_id",
"en-US": "get original caller account's instance_id"
}
},
{
"name": "get_account_id",
"returnType": "int64_t",
"belong": "<graphenelib/global.h>",
"fields": [
{
"name": "data",
"type": "const char *",
"description": {
"zh-CN": "账号名,例如nathan",
"en-US": ""
}
},
{
"name": "length",
"type": "uint32_t",
"description": {
"zh-CN": "账号名的长度,例如nathan的长度是6",
"en-US": ""
}
}
],
"description": {
"zh-CN": "根据账号名获取账号的instance_id",
"en-US": "get account instance_id by account name"
}
},
{
"name": "get_asset_id",
"returnType": "int64_t",
"belong": "<graphenelib/global.h>",
"fields": [
{
"name": "data",
"type": "const char *",
"description": {
"zh-CN": "资产名",
"en-US": ""
}
},
{
"name": "length",
"type": "uint32_t",
"description": {
"zh-CN": "账号名的长度,例如nathan的长度是6",
"en-US": ""
}
}
],
"description": {
"zh-CN": "根据资产名获取资产的instance_id",
"en-US": "get asset instance_id by asset name"
}
},
{
"name": "graphene_assert",
"returnType": "void",
"belong": "<graphenelib/system.h>",
"fields": [
{
"name": "test",
"type": "uint32_t",
"description": {
"zh-CN": "",
"en-US": ""
}
},
{
"name": "msg",
"type": "const char*",
"description": {
"zh-CN": "",
"en-US": ""
}
}
],
"description": {
"zh-CN": "如果条件不满足,中断本次合约的执行并会滚所有状态",
"en-US": ""
}
},
{
"name": "graphene_assert_message",
"returnType": "void",
"belong": "<graphenelib/system.h>",
"fields": [
{
"name": "test",
"type": "uint32_t",
"description": {
"zh-CN": "",
"en-US": ""
}
},
{
"name": "msg",
"type": "const char*",
"description": {
"zh-CN": "",
"en-US": ""
}
},
{
"name": "msg_len",
"type": "uint32_t",
"description": {
"zh-CN": "",
"en-US": ""
}
}
],
"description": {
"zh-CN": "如果条件不满足,输出必要的信息,但是本次合约的执行会继续",
"en-US": ""
}
},
{
"name": "print",
"returnType": "void",
"belong": "<graphenelib/system.h>",
"fields": [
{
"name": "ptr",
"type": "const char*",
"description": {
"zh-CN": "",
"en-US": "print content"
}
}
],
"description": {
"zh-CN": "用于调试时日志的打印",
"en-US": ""
}
}
]
}