A simple API to interact with Stacks and CityCoins data.

Overview

CityCoins API

Probably Nothing

CF Workers + IttyRouter + micro-stacks + TypeScript

...and it feels good!

Things to Note

  • uses simple typed responses and provides detailed error messages
  • all :cityname routes accept three letter city names, e.g. mia, nyc
  • all :blockheight routes always follow :cityname routes when required
  • all additional parameters follow :cityname and :blockheight routes
  • routes are structured the same as the contract functions and documentation

Implementation

If you want to use this for your project, build a copy for yourself, or have any questions, please join the CityCoins Discord or file a GitHub Issue and reach out!

Development

Static assets in the /static folder are pushed to Cloudflare Workers KV store automatically, but require a custom match to the URL path in order to serve files from index.ts.

All other paths are passed to the IttyRouter in handler.ts.

The API is divided into three main sections:

  • handlers: individual endpoints that get/caculate a value and return the result
  • lib: libraries to get or calculate data for handlers
  • types: type definitions for utilities and responses

How to Add a City

  • add new city config as constant in /src/types/cities.ts
  • update getCityConfig in cities.ts with case for new city
  • update enum in /static/openapi.yml for reusable parameters

How to Add an Endpoint

  • create a new handler file in /src/handlers
    • all inputs must be checked or 400
    • city config must resolve or 404
    • any integers verified with isStringAllDigits or 400
    • response from getter or calcualation checked or 404
    • returns successful response
  • (optional) add new getters in /lib
  • (optional) add new types in /types
  • add new handler file and route to /src/handler.ts
    • Order of Operations: :cityname > :blockheight > :cycleid > :userid > :address
  • add new endpoint to /static/openapi.yml
    • routes get added to the corresponding section
      • routes get tagged by their category (matches directory)
      • routes always use ref for parameters and responses
    • reusable parameters and responses are at the bottom of the file

Special case: if the response is a custom type, e.g. MiningStatsAtBlock, an example for the responses must be added manually to /static/openapi.yml

Deployment

Local development is possible with wrangler:

  • install with NPM: npm i @cloudflare/wrangler -g (or cargo)
  • run wrangler dev to start up the development server
  • navigate to http://127.0.0.1:8787 to see the API

Any pull requests should point to the develop branch.

Any pushes to the develop branch are automatically built and available here for testing.

Any pushes to the main branch are automatically built and available on the main site.

This project uses SemVer for versioning.

Version numbers should be updated in /package.json and /static/openapi.yml.

Endpoint Examples

A full list of routes and responses can be found in the OpenAPI documentation.

Some quick examples:

“Continuous effort, not strength or intelligence is the key to unlocking our potential.”

Winston Churchill

Comments
  • Bug: Get User ID API returns not intended status code

    Bug: Get User ID API returns not intended status code

    It looks like the API which is used to get user's id with principal - /activation/get-user-id/{cityname}/{address} - returns wrong status code when invalid principal is provided.

    I tested with:

    https://api.citycoins.co/activation/get-user-id/MIA/SPZV5BASGBCDFD6W1C9R567GEKR4R1KFN086A9Z
    

    It returns an HTML:

    <!DOCTYPE html>
    <!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
    <!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
    <!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
    <!--[if gt IE 8]><!-->
    <html class="no-js" lang="en-US">
    <!--<![endif]-->
    
    <head>
    	<title>Worker threw exception | api.citycoins.co | Cloudflare</title>
    	</title>
    	<meta charset="UTF-8" />
    	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
    	<meta name="robots" content="noindex, nofollow" />
    	<meta name="viewport" content="width=device-width,initial-scale=1" />
    	<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/cf.errors.css" type="text/css"
    		media="screen,projection" />
    	<!--[if lt IE 9]><link rel="stylesheet" id='cf_styles-ie-css' href="/cdn-cgi/styles/cf.errors.ie.css" type="text/css" media="screen,projection" /><![endif]-->
    	<style type="text/css">
    		body {
    			margin: 0;
    			padding: 0
    		}
    	</style>
    
    
    	<!--[if gte IE 10]><!-->
    	<script>
    		if (!navigator.cookieEnabled) {
        window.addEventListener('DOMContentLoaded', function () {
          var cookieEl = document.getElementById('cookie-alert');
          cookieEl.style.display = 'block';
        })
      }
    	</script>
    	<!--<![endif]-->
    
    
    </head>
    
    <body>
    	<div id="cf-wrapper">
    		<div class="cf-alert cf-alert-error cf-cookie-error" id="cookie-alert" data-translate="enable_cookies">Please
    			enable cookies.</div>
    		<div id="cf-error-details" class="cf-error-details-wrapper">
    			<div class="cf-wrapper cf-header cf-error-overview">
    				<h1>
    					<span class="cf-error-type" data-translate="error">Error</span>
    					<span class="cf-error-code">1101</span>
    					<small class="heading-ray-id">Ray ID: 6f94a82c08b48346 &bull; 2022-04-09 16:35:36 UTC</small>
    				</h1>
    				<h2 class="cf-subheadline" data-translate="error_desc">Worker threw exception</h2>
    			</div><!-- /.header -->
    
    			<section></section><!-- spacer -->
    
    			<div class="cf-section cf-wrapper">
    				<div class="cf-columns two">
    					<div class="cf-column">
    						<h2 data-translate="what_happened">What happened?</h2>
    						<p>You've requested a page on a website (api.citycoins.co) that is on the <a
    								data-orig-proto="https" data-orig-ref="www.cloudflare.com/5xx-error-landing/"
    								target="_blank">Cloudflare</a> network. An unknown error occurred while rendering the
    							page.</p>
    					</div>
    
    
    					<div class="cf-column">
    						<h2 data-translate="what_can_i_do">What can I do?</h2>
    						<p><strong>If you are the owner of this website:</strong><br />you should <a
    								data-orig-proto="https" data-orig-ref="www.cloudflare.com/login?utm_source=error_100x"
    								target="_blank">login to Cloudflare</a> and check the error logs for api.citycoins.co.
    						</p>
    					</div>
    
    				</div>
    			</div><!-- /.section -->
    
    			<div
    				class="cf-error-footer cf-wrapper w-240 lg:w-full py-10 sm:py-4 sm:px-8 mx-auto text-center sm:text-left border-solid border-0 border-t border-gray-300">
    				<p class="text-13">
    					<span class="cf-footer-item sm:block sm:mb-1">Cloudflare Ray ID: <strong class="font-semibold">6f94a82c08b48346</strong></span>
    					<span class="cf-footer-separator sm:hidden">&bull;</span>
    					<span class="cf-footer-item sm:block sm:mb-1"><span>Your IP</span>: 218.153.229.68</span>
    					<span class="cf-footer-separator sm:hidden">&bull;</span>
    					<span class="cf-footer-item sm:block sm:mb-1"><span>Performance &amp; security by</span> <a
    						rel="noopener noreferrer" href="https://www.cloudflare.com/5xx-error-landing" id="brand_link"
    						target="_blank">Cloudflare</a></span>
    
    				</p>
    			</div><!-- /.error-footer -->
    
    
    		</div><!-- /#cf-error-details -->
    	</div><!-- /#cf-wrapper -->
    
    	<script type="text/javascript">
    		window._cf_translation = {};
      
      
    	</script>
    
    </body>
    
    </html>
    

    This is the result when an invalid principal has been provided, and when I used valid but not activated one, server responds with status code 404.

    opened by jolacaleb 2
  • Add query parameter for output format

    Add query parameter for output format

    Right now all responses are returned as JSON, with single values being:

    {
      "value": "data goes here"
    }
    

    And more complex return values having associated types, e.g.

    export interface MiningStatsAtBlock {
      minersCount: number,
      amount: number,
      amountToCity: number,
      amountToStackers: number,
      rewardClaimed: boolean,
    }
    

    In some instances a plaintext value is required (cough CoinMarketCap cough) .

    We could add a query parameter ?format=plaintext or similar, and that pattern could be used to modify future outputs should a new need arise.

    opened by whoabuddy 1
  • Endpoint Request: /tools/get-full-city-configuration

    Endpoint Request: /tools/get-full-city-configuration

    Right now the current format is:

    /{cityname}/tools/get-full-city-configuration

    In some cases, it may make sense to query all versions in one request, rather than splitting requests based on v1/v2/etc.

    The {version} route should accept the word all, similar to how {blockheight} accepts current.

    This would need to be updated in the handler and defined in the OpenAPI spec, but should be a pretty straight-forward change.

    opened by whoabuddy 1
  • Check contract function error handling

    Check contract function error handling

    After updating the v1 contracts to v2, the v1 core contracts activation status is false.

    This results in an error (err u1005) from the contract when querying the activation block, which translates to ERR_CONTRACT_NOT_ACTIVATED.

    When querying the activation block for the MIA v1 core contract, it returns {"value":"1005"}, which is passing the error value into the returned value.

    This should create a clear error message instead, and the same pattern should be checked against all other endpoints.

    opened by whoabuddy 1
  • BREAKING CHANGE: Add contract versioning

    BREAKING CHANGE: Add contract versioning

    ⚠️Breaking Change⚠️

    This PR contains a breaking change to set up the data structure for multiple versions of CityCoins contracts.

    The structure allows enough flexibility that this should be the preferred format moving forward.

    What is changing?

    Routes and Paths

    Any routes that involve querying a city now start with :version/:cityname instead of the route category.

    | Before | After | | --- | --- | | /activation/get-activation-block/mia | /v1/mia/activation/get-activation-block | | /mining/get-mining-stats-at-block/mia/57934 | /v1/mia/mining/get-mining-stats-at-block/57934 | | /stacking/get-stacker-at-cycle/mia/15/1848 | /v1/mia/stacking/get-stacker-at-cycle/15/1848 |

    CityConfig Definition

    In the previous version the CityConfig object represented a single set of contracts. This refactors the code to allow for:

    • a version number, used as a key in the CityVersions object
    • a CityConfig per version, returned by getCityConfig()
    • updates to getCityConfig() to pass the version parameter
    • updates to getCityConfig() error handling to pass response if not found
    • individual interfaces per contract type (auth, core, token)

    What is left to do?

    • [x] update routes
    • [x] update getCityConfig()
    • [x] update handlers
    • [x] update README
    • [x] update landing page
    • [x] verify docs are correct
    • [x] update OpenAPI spec
    • [x] update versioning
    opened by whoabuddy 1
  • Migrate to V2 contracts

    Migrate to V2 contracts

    Now that the community upgrade is complete it's time to point the API to the new data sources.

    One approach to this could be:

    • update current endpoints to serve v2 data by default
    • add get-city-config from #44 (for minecitycoins.com and other sites)
    • add a /legacy path and child router, such that:
      • routes would be stored separate from the main router
      • /legacy/v1 would access the v1 data
      • endpoints could be added to either (or both) as needed
    opened by whoabuddy 1
  • Typo: wrong return type for `get-last-high-value-at-block`

    Typo: wrong return type for `get-last-high-value-at-block`

    In the OpenAPI spec it's showing this as a boolean instead of a number (or a string? see #45):

    https://api.citycoins.co/docs#tag/Mining/paths/~1mining~1get-last-high-value-at-block~1{cityname}~1{blockheight}/get

    opened by whoabuddy 1
  • Bug: response types inconsistent

    Bug: response types inconsistent

    This is one I'm surprised we didn't catch earlier.

    All SingleValue entries are passed to the response as either string | boolean. These can be numbers, too, and the docs are not consistent with the endpoints.

    Shows it returns a number: https://api.citycoins.co/docs#tag/Mining/paths/~1mining~1get-block-winner-id~1{cityname}~1{blockheight}/get

    Actually returns a string: {"value":"407"} https://api.citycoins.co/mining/get-block-winner-id/mia/49000

    I think it's something with how we're using micro-stacks as the Stacks block height endpoint returns a number: https://api.citycoins.co/stacks/get-block-height

    This will be interesting to look at alongside #40

    opened by whoabuddy 1
  • Endpoint Request: /tools/get-city-config

    Endpoint Request: /tools/get-city-config

    What endpoint would you like to request?

    /tools/get-city-config/:city

    Is this something directly available, or does it have to be calculated?

    It is directly available and would correlate to the CityConfig type and constant definitions in /types/cities.ts. e.g.

    const miaConfig: CityConfig = {
      deployer: "SP466FNC0P7JWTNM2R9T199QRZN1MYEDTAR0KP27",
      authContract: "miamicoin-auth",
      coreContract: "miamicoin-core-v1",
      tokenContract: "miamicoin-token",
      tokenDisplayName: "MiamiCoin",
      tokenName: "miamicoin",
      tokenSymbol: "MIA",
    };
    

    The motivation for this is to standardize the city configuration data, which can be useful for building contract calls, finding more information (e.g. find contract in explorer, or identify deployer address), and possibly more.

    The CityCoins UI defines similar constants (although those may be unused now iirc) and passes down configurations per cities using defined files per city.

    If the API could serve this data, it could allow for the CityCoins UI to fetch the information and store it in a consistent structure, as well as only require the updates to be made in one place. This could be used to automatically add new cities' data.

    opened by whoabuddy 1
  • Testing new endpoints for v1.1.0 release

    Testing new endpoints for v1.1.0 release

    The develop branch has quite a few more endpoints than the main branch, and it's time to merge them to create a new release.

    This is a call for testing - please try to break the endpoints below!

    Any comments, issues, feedback or insights are welcome as issue comments here.

    Any typos or inconsistencies are an extra bonus.

    When the PR is merged for the next version, it will automatically close this issue.


    List of new endpoints found on the dev deployment (all the details are in the docs):

    • https://citycoins-api.citycoins.workers.dev/mining/get-block-winner-id/{cityname}/{blockheight}
    • https://citycoins-api.citycoins.workers.dev/mining/get-last-high-value-at-block/{cityname}/{blockheight}
    • https://citycoins-api.citycoins.workers.dev/mining/has-mined-at-block/{cityname}/{blockheight}/{userid}
    • https://citycoins-api.citycoins.workers.dev/mining-claims/can-claim-mining-reward/{cityname}/{blockheight}/{address}
    • https://citycoins-api.citycoins.workers.dev/mining-claims/is-block-winner/{cityname}/{blockheight}/{address}
    • https://citycoins-api.citycoins.workers.dev/stacking/stacking-active-at-cycle/{cityname}/{cycleid}
    • https://citycoins-api.citycoins.workers.dev/stacking-claims/get-stacking-reward/{cityname}/{cycleid}/{userid}
    • https://citycoins-api.citycoins.workers.dev/tools/prices/{cityname}/{currency}
    • https://citycoins-api.citycoins.workers.dev/tools/proof-of-hodl/{cityname}/{address}

    Outstanding tasks before merge:

    • [x] update package.json version number
    • [x] update OpenAPI version number

    Also noting a few things that need to be updated in the docs as well before this gets merged:

    • [x] add links to new OpenAPI tags for Mining and Stacking claims pages
    • [x] move get-stacking-reward to Stacking Claims page
    opened by whoabuddy 1
  • Endpoint Request: /tools/stacked-supply

    Endpoint Request: /tools/stacked-supply

    What endpoint would you like to request?

    /tools/stacked-supply/:city

    Is this something directly available, or does it have to be calculated?

    It has to be calculated, and would require:

    • Get total supply
    • Get current block height
    • Get current reward cycle
    • Get total stacked in current cycle
    • Return total supply - total stacked

    Returns: SingleValue (value: string)

    opened by whoabuddy 1
  • chore(deps): bump json5 from 2.2.0 to 2.2.3

    chore(deps): bump json5 from 2.2.0 to 2.2.3

    Bumps json5 from 2.2.0 to 2.2.3.

    Release notes

    Sourced from json5's releases.

    v2.2.3

    v2.2.2

    • Fix: Properties with the name __proto__ are added to objects and arrays. (#199) This also fixes a prototype pollution vulnerability reported by Jonathan Gregson! (#295).

    v2.2.1

    • Fix: Removed dependence on minimist to patch CVE-2021-44906. (#266)
    Changelog

    Sourced from json5's changelog.

    v2.2.3 [code, diff]

    v2.2.2 [code, diff]

    • Fix: Properties with the name __proto__ are added to objects and arrays. (#199) This also fixes a prototype pollution vulnerability reported by Jonathan Gregson! (#295).

    v2.2.1 [code, diff]

    • Fix: Removed dependence on minimist to patch CVE-2021-44906. (#266)
    Commits
    • c3a7524 2.2.3
    • 94fd06d docs: update CHANGELOG for v2.2.3
    • 3b8cebf docs(security): use GitHub security advisories
    • f0fd9e1 docs: publish a security policy
    • 6a91a05 docs(template): bug -> bug report
    • 14f8cb1 2.2.2
    • 10cc7ca docs: update CHANGELOG for v2.2.2
    • 7774c10 fix: add proto to objects and arrays
    • edde30a Readme: slight tweak to intro
    • 97286f8 Improve example in readme
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Add unit tests

    Add unit tests

    The framework for testing with Jest is in place on the worker, but nothing has been setup yet.

    It'd be nice to start with:

    • make sure each endpoint returns the correct values based on:
      • all checks/errors possible depending on data submitted
      • successful response and correct type
    • make sure CityConfig options match contract data
      • could be a one-time pass in CI that verifies against read-only functions
      • helps to discover small inconsistencies in hard-coded data without offloading to client
    • make sure handler definitions match OpenAPI spec (might be a stretch)

    Any other ideas are welcome!

    opened by whoabuddy 0
  • Open Question: How to Generalize

    Open Question: How to Generalize

    This may not be something specifically in scope for the CityCoins API, but thinking about the amount of routing we do to satisfy all the contract paths and parameters, there is a common pattern that could be generalized.

    The original thought behind the CityCoins API was to make an endpoint for every contract function, and I still think specific APIs that follow this pattern could be very useful to both user interfaces and external integrations.

    However, this may be useful for other projects that want to the use an API structure like this one, and I felt like the idea was worth documenting as "something to think about" when the V2 upgrades come downstream.


    What if there were a simple route that accepted the following path and query parameters?

    https://api.citycoins.co/query/deployer/contract_name/function_name?param1=value1&param2=value2

    Which breaks down as:

    • prefix: https://api.citycoins.co/query/
    • path: deployer - deployer address of contract
    • path: contract_name - contract name
    • path: function_name - function name in contract
    • query: param1 - function parameters, if any
    • query: param2 - function parameters, if any

    An example using is-block-winner:

    https://api.citycoins.co/v2/SP466FNC0P7JWTNM2R9T199QRZN1MYEDTAR0KP27/miamicoin-core-v1/?blockheight=25000&address=SP466FNC0P7JWTNM2R9T199QRZN1MYEDTAR0KP27

    This would essentially be a "query builder" in which you could put any contract, function, and related parameters then receive a result.

    Pros:

    • this would open up a way to query any contract without dependencies
    • there is no additional code to add if contract functions change
    • there is no effort required to query new contracts on chain
    • could serve as a fallback method for getting data
      • e.g. using this method until something more official like an endpoint is implemented
      • e.g. using this method to query data only needed for some time (like the vote info)

    Cons:

    • knowing the correct type for the query parameters and converting them may be a challenge
    • knowing how to process the types of returned data may be a challenge
    • could both of those be worked around using the contract ABI?

    Curious what others think!

    Spit-balling a few more reasons I think this could be useful:

    • this can be achieved with Cloudflare Workers free tier, and their pricing is very fair when scaling
    • this separates the data layer from the application layer, which allows for others to build UIs, tools, and implement integrations in a consistent fashion
    • this allows for caching, where a strategy could be set based on the type of data and stored in Cloudflare Workers KV
      • if data never changes, can return results directly from KV first then store if not found
      • custom TTL values can be set depending on how often data should be refreshed
      • patterns like checking if the block height changed can be applied to limit queries
    • this allows low-level access to HTTP headers and responses, which can:
      • help increase security
      • solve cross-origin request problems
      • and much much more
    • this allows for cron-type scripts to run using the same defined functions, which can:
      • update a user's info on a regular basis (or a list of users)
      • monitor chain state and key metrics
      • collect contract data for processing / re-use
    opened by whoabuddy 4
  • Endpoint Request: /tools/get-market-cap

    Endpoint Request: /tools/get-market-cap

    What endpoint would you like to request?

    /tools/get-market-cap/:city

    Is this something directly available, or does it have to be calculated?

    It would need to be calculated in two steps:

    1. Get the price for the city
    2. Get the total supply for the city
    3. Multiply and return the value
    opened by whoabuddy 1
  • Integration: DataGovs

    Integration: DataGovs

    What endpoint would you like to request?

    • Activation
    • Pricing
    • Use GOVS API for City of Miami / Venture Miami

    Is this something directly available, or does it have to be calculated?

    Govs API calculates this and serves it to city users at the government level.

    Other Considerations/Notes?

    • We need this to be incorporated to drive operationalize and utility use
    • We want to be able to prioritize this as a standard for other cities in our network to adopt responsibly.
    opened by HiGregory 4
  • Feature: aggregate mining and stacking data

    Feature: aggregate mining and stacking data

    This will likely turn into an endpoint request at the end, but will start as an exploration of how to best compile and serve data similar to the mining dashboards available now. https://miamining.com https://mining.nyc

    Some of the raw data is available through API endpoints, but the file sizes are growing pretty large: https://miamining.com/blocks https://miamining.com/winners https://miamining.com/stacking

    Since the data is organized per block, I think this is a situation similar to #42 where we can take advantage of KV, although the logic is a bit more complex.


    The KV key name could be mia-miningdata-{blocknumber}, with information stored for each block height since the contract activated.

    The /blocks and /winners data above could be combined into one json record with a little more specificity:

    {
      "minersVerified": "boolean",
      "miners": {
        "address": "ustx",
        "address": "ustx",
        "address": "ustx",
        "address": "ustx"
      },
      "winnerVerified": "boolean",
      "winnerClaimed": "boolean",
      "winner": {
        "miner": "address",
        "commitment": "ustx",
        "reward": "citycoins",
      }
    }
    

    miners keeps track of the list of miners who participated in that block, which can be found by querying and filtering the transactions, then extracting the addresses.

    minersVerified is set to true sequentially after the last 200 blocks are accounted for and verified, due to mine-many transactions spanning up to 200 blocks. This should be monitored/updated by a cron script.

    winner keeps track of the winning miner, commitment, reward, and whether they claimed it.

    winnerVerified is set to true once the winner data is populated via is-block-winner, and indicates the winner properties are available.

    winnerClaimed is based on querying the winning miner address against can-claim-mining-reward once the winning address is known. This should be separate as the miner doesn't have to claim right away.

    Both data points should be monitored/updated by a cron script.

    The resulting endpoint could take query parameters for start and end then aggregate the KV responses with promise.All(). It will be interesting to see how the performance scales here with how many blocks are returned at a time.


    Stacking data could follow a similar format:

    mia-stackingdata-{cycleid}

    {
      "amountToken": "citycoins",
      "amountUstx": "ustx",
      "firstBlock": "blockheight",
      "lastBlock": "blockheight",
      "complete": "boolean"
    }
    

    Side note - is it possible to know the number of Stacked addresses in a cycle? That's one interesting data point that doesn't exist here.

    @jamil would love to know if you have any additional input here!

    opened by whoabuddy 2
Releases(v2.0.2)
  • v2.0.2(Aug 4, 2022)

    What's Changed

    v2.0.1 changes that pulled into this one (?)

    • chore(deps): bump terser from 5.7.0 to 5.14.2 by @dependabot in https://github.com/citycoins/api/pull/73
    • Add circulating supply by @whoabuddy in https://github.com/citycoins/api/pull/74
    • Release v2.0.1 by @whoabuddy in https://github.com/citycoins/api/pull/75

    v2.0.2 changes

    • Fix API responses by @whoabuddy in https://github.com/citycoins/api/pull/76
    • Release v2.0.2 by @whoabuddy in https://github.com/citycoins/api/pull/77

    Full Changelog: https://github.com/citycoins/api/compare/v2.0.0...v2.0.2

    Source code(tar.gz)
    Source code(zip)
  • v2.0.1(Aug 4, 2022)

    What's Changed

    • chore(deps): bump terser from 5.7.0 to 5.14.2 by @dependabot in https://github.com/citycoins/api/pull/73
    • Add circulating supply by @whoabuddy in https://github.com/citycoins/api/pull/74

    Full Changelog: https://github.com/citycoins/api/compare/v2.0.0...v2.0.1

    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(May 31, 2022)

    What's Changed

    • BREAKING CHANGE: Add contract versioning by @whoabuddy in https://github.com/citycoins/api/pull/55
    • Add new endpoints by @whoabuddy in https://github.com/citycoins/api/pull/60
    • Update error handling in handlers and functions by @whoabuddy in https://github.com/citycoins/api/pull/62
    • Add endpoints for UI by @whoabuddy in https://github.com/citycoins/api/pull/66
    • Fix headers on all responses by @whoabuddy in https://github.com/citycoins/api/pull/67
    • Add or-default optional parameter to supported functions by @whoabuddy in https://github.com/citycoins/api/pull/68
    • Add endpoints and prep release by @whoabuddy in https://github.com/citycoins/api/pull/71
    • V2 Release: multiple version support by @whoabuddy in https://github.com/citycoins/api/pull/72

    Full Changelog: https://github.com/citycoins/api/compare/v1.1.0...v2.0.0

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Feb 28, 2022)

    What's Changed

    • Add more endpoints by @whoabuddy in https://github.com/citycoins/api/pull/28
    • Add price endpoint by @whoabuddy in https://github.com/citycoins/api/pull/29
    • Add endpoint proof-of-hodl by @whoabuddy in https://github.com/citycoins/api/pull/30
    • Add HTML metadata by @whoabuddy in https://github.com/citycoins/api/pull/32
    • Fix proof of hodl exception by @whoabuddy in https://github.com/citycoins/api/pull/33
    • Prep release v1.1.0 by @whoabuddy in https://github.com/citycoins/api/pull/34
    • Release v1.1.0 by @whoabuddy in https://github.com/citycoins/api/pull/35

    Full Changelog: https://github.com/citycoins/api/compare/v1.0.0...v1.1.0

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Feb 28, 2022)

    What's Changed

    • chore(deps): bump urijs from 1.19.6 to 1.19.8 by @dependabot in https://github.com/citycoins/api/pull/1
    • chore(deps): bump tmpl from 1.0.4 to 1.0.5 by @dependabot in https://github.com/citycoins/api/pull/2
    • chore(deps): bump ansi-regex from 5.0.0 to 5.0.1 by @dependabot in https://github.com/citycoins/api/pull/3
    • Testing pull request flow for issue templates by @whoabuddy in https://github.com/citycoins/api/pull/4
    • Add bug report template by @whoabuddy in https://github.com/citycoins/api/pull/5
    • Add stacking endpoints by @whoabuddy in https://github.com/citycoins/api/pull/6
    • Add note to find all routes in handler.ts by @whoabuddy in https://github.com/citycoins/api/pull/7
    • Add more endpoints and code cleanup by @whoabuddy in https://github.com/citycoins/api/pull/8
    • Add token endpoints by @whoabuddy in https://github.com/citycoins/api/pull/9
    • Add stacks endpoints and refactor for consistency by @whoabuddy in https://github.com/citycoins/api/pull/10
    • Add token and stacks endpoints by @whoabuddy in https://github.com/citycoins/api/pull/11
    • Add OpenAPI by @whoabuddy in https://github.com/citycoins/api/pull/12
    • Refactor responses by @whoabuddy in https://github.com/citycoins/api/pull/13
    • Merge latest develop branch for testing by @whoabuddy in https://github.com/citycoins/api/pull/14
    • Prep V1 release by @whoabuddy in https://github.com/citycoins/api/pull/15
    • Release v1 by @whoabuddy in https://github.com/citycoins/api/pull/16

    New Contributors

    • @dependabot made their first contribution in https://github.com/citycoins/api/pull/1

    Full Changelog: https://github.com/citycoins/api/commits/v1.0.0

    Source code(tar.gz)
    Source code(zip)
Owner
CityCoins
Build cities.
CityCoins
A simple project of task list! - Stacks HTML, CSS and JS(pure)

Stacks used This project The purpose of this was to recreate a To do list project using the concepts of JavaScript, HTML and CSS and also storing the

Alisson Peixer 3 Sep 20, 2022
MultiSafe is a shared crypto wallet for managing Stacks (STX) and Bitcoin (BTC).

MultiSafe MultiSafe is a shared crypto wallet for managing Stacks (STX) and Bitcoin (BTC). Deploy a MultiSafe https://app.multisafe.xyz/ Features Curr

Trust Machines 22 Dec 26, 2022
The one DAO to rule them all. A modular DAO written in Clarity for the Stacks blockchain.

ExecutorDAO The one DAO to rule them all. ExecutorDAO is designed to be completely modular and flexible, leveraging Clarity to the fullest extent. The

Marvin 31 Oct 5, 2022
A Stacks DeFi app that automates covered call writing to generate sustainable, risk-adjusted yield.

?? Options Vault ?? A Stacks DeFi app that automates covered call writing to generate sustainable, risk-adjusted yield. Options vaults allow you to al

null 15 Nov 16, 2022
The Gitcoin Passport SDK is comprised of a set of libraries distributed on npm to help developers interact with Passport data living on Ceramic.

The Gitcoin Passport SDK is comprised of a set of libraries distributed on npm to help developers interact with Passport data living on [Ceramic]

Gitcoin Core 47 Dec 6, 2022
This is a project based on a game Leaderboard. You can interact with an API inserting your user name and score. Built with HTML, CSS, JavaScript and WEBPACK

Leaderboard: Leaderboard project - Microverse Acces link Check the live version here Built With HTML CSS JavaScript VScode Webpack GitFlow Quick view

Vitor Guedes Madeira 11 Oct 8, 2022
Get, change, and otherwise interact with your notes in Obsidian via a REST API.

Local REST API for Obsidian See our interactive docs: https://coddingtonbear.github.io/obsidian-local-rest-api/ Have you ever needed to automate inter

Adam Coddington 157 Dec 22, 2022
This project is built with JavaScript, Webpack, HTML & CSS, Leaderboard api. When user clicks on Refresh button it hits the api and responds with the data, The user can also post data to the api

leaderboad Description the project. this project is about the leaderboad i did during Microverse to build a website for adding Data to the API and fet

Emmanuel Moombe 4 May 30, 2022
Complete module to interact with the Brawl Stars API.

BrawlStars-API.js Brawlstars-api.js is a library made to interact with the Official Brawl Stars api, listing all of their endpoints in one place. ✨ Ho

Nícolas Gabriel 4 Nov 3, 2022
JavaScript library to interact with the Cfx.re API (FiveM/RedM)

Cfx.re JavaScript API A package that helps you interacting with the Cfx.re, FiveM & RedM API. How to install npm i cfx-api Example usage: const cfx =

Pablo Zapata 21 Jan 1, 2023
JavaScript library to interact with the Cfx.re API (FiveM/RedM)

Cfx.re JavaScript API A package that helps you interacting with the Cfx.re, FiveM & RedM API. How to install npm i cfx-api Example usage: const cfx =

Pablo Zapata 14 Aug 14, 2022
On this page, you can save and load all the awesome books you have and save the name and the author into the local storage. this project uses Javascript to interact with the pages

Awesome Books: refactor to use JavaScript classes In this project, We add the links to the applications into the final project Getting Started if you

Cesar Valencia 8 Nov 29, 2022
A package that allows your bot of discord.js v13 & v14 to create the new awesome Discord Modals and interact with them

A package that allows your bot of discord.js v13 & v14 to create the new awesome Discord Modals and interact with them

MateoDeveloper 85 Dec 23, 2022
A standard library to interact with KaiOS 2.x and 3.x APIs.

kaios-lib A standard library to interact with KaiOS 2.x and 3.x* APIs. * 3.x support coming when there is a good dev device available for testing purp

Garrett Downs 4 Jun 3, 2022
A comprehensive collection of useful tools developed with the help of Ethers.js to interact with the Ethereum Blockchain to develop great DeFi apps as quickly and easily as possible.

hudi-packages-ethersfactory How to install Installing with npm For more information on using npm check out the docs here. npm i @humandataincome/ether

HUDI 6 Mar 30, 2022
A CLI to upload files to IPFS and interact with them using wbeb3.storage

Storli A CLI to upload files to IPFS and interact with them using web3.storage Storli Usage Commands Usage $ npm install -g storli $ storli COMMAND ru

Anish De 9 Aug 7, 2022
Nami Wallet is a browser based wallet extension to interact with the Cardano blockchain.

Nami Wallet Nami Wallet is a browser based wallet extension to interact with the Cardano blockchain. It's an open-source project and built by Berry Po

Berry 335 Dec 29, 2022
Web3.js provider to interact with the VeChain Thor protocol

web3-providers-connex Web3.js provider implemented using Connex.js. It makes it possible to use web3.js and ethers.js to interact with VeChain Thor pr

null 13 Dec 26, 2022
Web3 NPM library to interact with Soonaverse.

Soonaverse - Soonaverse JavaScript/Typescript API - APLHA Please note this is APLHA and we might introduce breaking changes. Library to interact with

SoonLabs 15 Oct 28, 2022