citycoins / protocol-api Goto Github PK
View Code? Open in Web Editor NEWAn API to interact with Stacks and CityCoin on-chain data.
Home Page: https://protocol.citycoins.co/api
License: MIT License
An API to interact with Stacks and CityCoin on-chain data.
Home Page: https://protocol.citycoins.co/api
License: MIT License
The related Clarity code returns (some uint) or (none), but this is getting checked against a boolean value.
The current endpoint for get-balance-stx
returns the unlocked balance, e.g.
Returns:
155844000
Which matches the unlocked balance and doesn't indicate anything about the 10.2M STX locked.
This comes from stx-get-balance
in the treasury contract, so we may need to switch to calling the Hiro API.
Returns:
{
"balance": "10216532085394",
"total_sent": "0",
"total_received": "10216532085394",
"total_fees_sent": "0",
"total_miner_rewards_received": "0",
"lock_tx_id": "0x117c1a1ccb8242cdaf52012623a52fadb0f0e78cb34e0ad4f7046717dc92f8be",
"locked": "10216376241394",
"lock_height": 107391,
"burnchain_lock_height": 791949,
"burnchain_unlock_height": 794150
}
Also add block heights from transition and maybe link getVersionByBlock code.
Should be the same as the original just with a different target contract principal.
Once we know the block height that ccip013-activation executes, it can be used here to prevent returning data that should be queried in the legacy contracts.
This came from a point @Tim-Butterfield pointed out in Discord:
For example, this call returns data that isn't valid .
https://protocol.citycoins.co/api/ccd006-citycoin-mining/get-mining-stats?cityId=1&height=96250
According to MIAmining explorer, that block was won and already claimed, but the API says there were no miners.
There seems to be some disparity in how much data is returned and of what type. Here are a few examples:
https://protocol.citycoins.co/api/stacks/get-block-height - returns full JSON including redundant path and params
https://protocol.citycoins.co/api/ccd004-city-registry/get-city-id?cityName=mia - returns just the number in quotes "1"
https://protocol.citycoins.co/api/ccd005-city-data/is-city-activated?cityId=1 - returns the boolean false
I'm not asking about the specific values, but of the types of data returned and the differences between simple data and full JSON. I would have expected the get-block-height function to be called regularly and have simple data also, but it didn't.
Is this an issue or expected behavior?
The Stacks Blockchain API supports a tip
parameter for read-only contract calls, which can bring up the data at a certain point in time based on the index_block_hash
of the Stacks block height.
Ideally we could support specifying the tip as a hash, a block height, or a cycle number.
index_tip_hash
index_tip_hash
The value would be passed as part of the ReadOnlyFunctionOptions, and is accepted by micro-stacks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.