old-balance-ios
old-balance-ios copied to clipboard
⛓ Consider Changing MKR.tools API over to Maker’s GraphQL API
Read the data from the source
Or consider Graph Protocol
Assuming they make all of the data available that we need for your updated design, then GraphQL is the way to go if they don't include it in the regular API. GraphQL is easy to use too because you get to pick the data formatting when you make the API call, so it makes parsing easy.
No rush here. Just want to leave it open to curious devs.
Seeing lots of issues with maker data which are likely my fault. Makes me nervous to ship just yet.
Discrepancy between CDP web app and mobile app must never happen.
"Might this be subtracting my stability fee instead of adding what I would owe to close it?"
Going to spend time on this today.
If the numbers are ever out of sync then people will lose faith in Balance's ability to accurately show them their balance.
Notes from @obsidion on Maker’s Rocket Chat:
love your work on Balance btw 🙂 so we use a GraphQL endpoint for pulling in certain data in the CDP Portal that we can't easily get via Web3 (mostly CDP event history and CDPs by owner)
the kovan endpoint is: https://sai-kovan.makerfoundation.com/v1 (currently a little out of sync) the mainnet endpoint is: https://sai-mainnet.makerfoundation.com/v1 you can find the documentation here and can play around with mainnet queries here here's a sample POST request:
curl 'https://sai-kovan.makerfoundation.com/v1' -H 'Origin: https://cdp.makerdao.com' -H 'Content-type: application/graphql' --data-binary 'query { getCup(id: 1821) { actions { nodes { act arg guy tx time ink art per pip } } } }'
For a listing of cup ids for a particular address, try: curl 'https://sai-kovan.makerfoundation.com/v1' -H 'Content-type: application/graphql' --data-binary 'query { allCups( condition: { lad: "0xDB2A2D8ac9f10F4d6041462758241844AdD6b9D1" } ) { nodes { id, block } } }'
Also if they're owned by a DSProxy
(in the example above) you'll need to use the DSProxy
address (which is what the new CDP Portal uses when creating CDPs)
and the DSProxy
contract address above is owned by the regular address 0x7227bD52777cB85A89cB5F9eAf8E18f95aD91071
(In the old Dai Dashboard CDPs are just owned directly by an address)
CDP 420 Example

curl 'https://sai-kovan.makerfoundation.com/v1' -H 'Origin: https://cdp.makerdao.com' -H 'Content-type: application/graphql' --data-binary 'query { getCup(id: 420) { actions { nodes { act arg guy tx time ink art per pip } } } }'
{"data":{"getCup":{"actions":{"nodes":
[{"act":"LOCK",
"arg":"1.9996872024730865",
"guy":"0x82127cE31C0aA6203eB55c0AcfD7232efBF6Cd91",
"tx":"0xe9a966c1261fcce88789cac91c34d8eff1fccbaa6bff32e0c48f127eb3d4e85d",
"time":"2018-04-26T19:50:04+00:00",
"ink":"3.999374404946173",
"art":"10",
"per":"1.0001564232278561",
"pip":"629.4315"},
{"act":"DRAW",
"arg":"10",
"guy":"0x82127cE31C0aA6203eB55c0AcfD7232efBF6Cd91",
"tx":"0x3083dd93a8403b56defd5b1eec6aaff64f60871d67dfc68d88ad2ea943241d7c",
"time":"2018-03-19T21:31:40+00:00",
"ink":"1.9996872024730865",
"art":"10",
"per":"1.0001564232278561",
"pip":"545.915"},
{"act":"LOCK","arg":"1.9996872024730865",
"guy":"0x82127cE31C0aA6203eB55c0AcfD7232efBF6Cd91",
"tx":"0x3083dd93a8403b56defd5b1eec6aaff64f60871d67dfc68d88ad2ea943241d7c",
"time":"2018-03-19T21:31:40+00:00",
"ink":"1.9996872024730865",
"art":"10",
"per":"1.0001564232278561","pip":"545.915"},
{"act":"OPEN",
"arg":"-",
"guy":"0x82127cE31C0aA6203eB55c0AcfD7232efBF6Cd91",
"tx":"0x3083dd93a8403b56defd5b1eec6aaff64f60871d67dfc68d88ad2ea943241d7c",
"time":"2018-03-19T21:31:40+00:00",
"ink":"0",
"art":"0",
"per":"1.0001564232278561",
"pip":"545.915"}]}}}}
https://mkr.tools/api/v1/cdp/420
{"act":"wipe"}
{"art":20}
{"block":7407116}
{"deleted":false}
{"id":420}
{"ink":1.2304795810944558}
{"ire":19.772854082237014}
{"lad":"0x1674BAe53815a84E4610E68d3CE7E1F5aF2E6aaf"}
{"pip":152.6375}
{"pep":755.3990625}
{"per":"1.0408774024211158"}
{"ratio":977.4740575958326}
{"liq_price":23.423255913628466}
{"tab":195.49481151916652}
{"time":"2019-03-20T17:42:16.000Z"}
{"timestamp":1553103736000}
{"arg":null}