-
Notifications
You must be signed in to change notification settings - Fork 9
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
(graphql) add new account_udts
api for grapqhl
#699
Comments
The PR has been merged, could we move this task into |
example: query {
account_ckbs(
input: { address_hashes: ["0x715AB282B873B79A7BE8B0E8C13C4E8966A52040"] }
) {
udt_script_hash
value
udt {
id
name
bridge_account_id
script_hash
decimal
value
}
account {
id
eth_address
script_hash
}
}
}
{
"data": {
"account_ckbs": [
{
"account": {
"eth_address": null,
"id": 1,
"script_hash": "0x595cc14e574a708dc70a320d2026f79374246ed4659261131cdda7dd5814b5ca"
},
"udt": {
"bridge_account_id": 375,
"decimal": 18,
"id": "1",
"name": "pCKB",
"script_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"value": null
},
"udt_script_hash": "0x595cc14e574a708dc70a320d2026f79374246ed4659261131cdda7dd5814b5ca",
"value": "1165507481400061309833"
}
]
}
} |
account udt example: query {
account_udts(
input: {
address_hashes: ["0x715AB282B873B79A7BE8B0E8C13C4E8966A52040"],
udt_script_hash: "0x595cc14e574a708dc70a320d2026f79374246ed4659261131cdda7dd5814b5ca"
}
) {
udt_script_hash
value
udt {
id
name
bridge_account_id
script_hash
decimal
value
}
account {
id
eth_address
script_hash
}
}
}
{
"data": {
"account_udts": [
{
"account": {
"eth_address": null,
"id": 1,
"script_hash": "0x595cc14e574a708dc70a320d2026f79374246ed4659261131cdda7dd5814b5ca"
},
"udt": {
"bridge_account_id": 375,
"decimal": 18,
"id": "1",
"name": "pCKB",
"script_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"value": null
},
"udt_script_hash": "0x595cc14e574a708dc70a320d2026f79374246ed4659261131cdda7dd5814b5ca",
"value": "1165507481400061309833"
}
]
}
} |
We will start testing APIs because it's an important service for the community, let's start from this query @FrederLu it's a graphql API request, and feel free to ask about details of each field and its updating mechanism. |
Ok, I look at the graphql API information for community services and then ask the API for details of each field and its update mechanism. |
query {
account_udts(
input: {
address_hashes: ["0xcc0af0af911dd40853b8c8dfee90b32f8d1ecad6"]
udt_script_hash: "0x595cc14e574a708dc70a320d2026f79374246ed4659261131cdda7dd5814b5ca"
}
) {
udt_script_hash
value
udt {
id
name
bridge_account_id
script_hash
decimal
value
}
account {
id
eth_address
script_hash
}
}
} Compared with the information on the metamask, the value of the interface account remains unchanged before the withdrawal operation. |
https://pudge.explorer.nervos.org/transaction/0xccc25d9e3a05df4701879978e4ed57d18c5c04dd9d697cf0bd1a4a516739fd65 After operating Withdrawal, the data on nerouns and metamask are displayed and changed, but the interface is not updated. |
seems data source table not updated by withdrawal {
"account_current_bridged_udt_balances": [
{
"id" : 43388,
"address_hash" : "1A9A8E69246896AC1720C1F407309C142C5C3CDC",
"account_id" : 46102,
"udt_script_hash" : "595CC14E574A708DC70A320D2026F79374246ED4659261131CDDA7DD5814B5CA",
"udt_id" : 1,
"value" : 2400000000000000000000,
"value_fetched_at" : null,
"layer1_block_number" : 5975984,
"block_number" : null,
"inserted_at" : "2022-07-06T20:01:22.000Z",
"updated_at" : "2022-07-10T02:13:52.000Z"
}
]}
{
"account_current_udt_balances": [
{
"id" : 1337148,
"address_hash" : "1A9A8E69246896AC1720C1F407309C142C5C3CDC",
"token_contract_address_hash" : "E05D380839F32BC12FB690AA6FE26B00BD982613",
"udt_id" : null,
"account_id" : null,
"value" : 401000000000000000000,
"value_fetched_at" : "2022-07-06T23:25:56.855Z",
"block_number" : 169242,
"inserted_at" : "2022-07-06T23:25:56.000Z",
"updated_at" : "2022-07-06T23:25:56.000Z"
}
]} |
Now the amount of the interface is updated normally after the Deposit/Withdrawal transaction operation, but the service access takes a long time and is unstable. |
@zmcNotafraid @Naupio |
new api |
cc @Keith-CY example: query {
account_udts(
input: { address_hashes: ["0x40dfb7df991c9aa6138a60f0cac6ed1d02b834b8"] }
) {
value
udt {
id
type
name
icon
decimal
symbol
}
}
account_current_udts(
input: { address_hashes: ["0x40dfb7df991c9aa6138a60f0cac6ed1d02b834b8"] }
) {
udt {
name
}
updated_at
value
}
account_current_bridged_udts(
input: { address_hashes: ["0x40dfb7df991c9aa6138a60f0cac6ed1d02b834b8"] }
) {
udt {
name
}
updated_at
value
}
account_ckbs(
input: { address_hashes: ["0x40dfb7df991c9aa6138a60f0cac6ed1d02b834b8"] }
) {
udt {
name
}
value
}
}
return: {
"data": {
"account_ckbs": [
{
"udt": {
"name": "pCKB"
},
"value": "2913433910000000000000"
}
],
"account_current_bridged_udts": [
{
"udt": {
"name": "pCKB"
},
"updated_at": "2022-07-13T16:35:26",
"value": "2913433910000000000000"
},
{
"udt": {
"name": "Godwoken Bridge Test Token (via GodwokenBridge from CKB)"
},
"updated_at": "2022-07-06T16:23:44",
"value": "100000000000000000000"
}
],
"account_current_udts": [
{
"udt": {
"name": "pCKB"
},
"updated_at": "2022-07-04T05:01:34",
"value": "1282198940000000000000"
}
],
"account_udts": [
{
"udt": {
"decimal": 18,
"icon": "https://cryptologos.cc/logos/nervos-network-ckb-logo.png",
"id": "1",
"name": "pCKB",
"symbol": "pCKB",
"type": "BRIDGE"
},
"value": "2913433910000000000000"
},
{
"udt": {
"decimal": null,
"icon": null,
"id": "80",
"name": "Godwoken Bridge Test Token (via GodwokenBridge from CKB)",
"symbol": "TTKN.gw|gb.ckb",
"type": "BRIDGE"
},
"value": "100000000000000000000"
}
]
}
} |
account_udts
api for grapqhl
account_udts
api for grapqhlaccount_udts
api for grapqhl
Please check this issue @Naupio |
query {
account_udts(input: {address_hashes: ["0xcc0af0af911dd40853b8c8dfee90b32f8d1ecad6"]}) {
value
udt {
id
name
bridge_account_id
}
}
}
{
"data": {
"account_udts": [
{
"udt": {
"bridge_account_id": null,
"id": "33",
"name": "pCKB (via Godwoken Bridge from CKB)"
},
"value": "895837040000000000000"
},
{
"udt": {
"bridge_account_id": 33,
"id": "1",
"name": "pCKB (via Godwoken Bridge from CKB)"
},
"value": "900000000000000000000"
},
{
"udt": {
"bridge_account_id": 133,
"id": "128",
"name": "YOK (via Godwoken Bridge from CKB)"
},
"value": "200000000000000000000"
}
]
}
} |
bridge token value will be sync when this pr merge https://github.com/Magickbase/godwoken_explorer/pull/805/files |
Verified. |
No description provided.
The text was updated successfully, but these errors were encountered: