Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ name: CI
on:
push:
branches:
- master
- develop
- beta
- main
- next
tags-ignore:
- '**'
Expand Down Expand Up @@ -131,7 +129,7 @@ jobs:
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
LATEST_VERSION=${LATEST_TAG#v}

if [ "$BRANCH" = "master" ]; then
if [ "$BRANCH" = "main" ]; then
BUMP=$(npx conventional-recommended-bump -p conventionalcommits)
NEXT_VERSION=$(npx semver "$LATEST_VERSION" -i "$BUMP")
elif [ "$BRANCH" = "alpha" ] || [ "$BRANCH" = "beta" ]; then
Expand Down
2 changes: 1 addition & 1 deletion client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Check if the API is ready and which chain tip it has indexed.
const { data, error } = await client.GET('/metadata/v1/');

if (data) {
console.log(data.server_version); // e.g. "token-metadata-api v0.0.1 (master:a1b2c3)"
console.log(data.server_version); // e.g. "token-metadata-api v0.0.1 (main:a1b2c3)"
console.log(data.status); // e.g. "ready"
console.log(data.chain_tip); // { block_height: 150000, index_block_hash: "0x..." } | null
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/generated/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ export interface operations {
};
content: {
"application/json": {
/** @example token-metadata-api v0.0.1 (master:a1b2c3) */
/** @example token-metadata-api v0.0.1 (main:a1b2c3) */
server_version: string;
/** @example ready */
status: string;
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This section helps you to initiate the service by following the steps below.

`git clone https://github.com/hirosystems/token-metadata-api.git`

1. Create a `.env` file and specify the appropriate values to configure access to the Stacks API database, the Token metadata API local database, and the Stacks node RPC interface. See [`env.ts`](https://github.com/hirosystems/token-metadata-api/tree/master/src/env.ts) for all available configuration options.
1. Create a `.env` file and specify the appropriate values to configure access to the Stacks API database, the Token metadata API local database, and the Stacks node RPC interface. See [`env.ts`](https://github.com/hirosystems/token-metadata-api/tree/main/src/env.ts) for all available configuration options.

2. Build the app (NodeJS v18+ is required)

Expand Down
2 changes: 1 addition & 1 deletion docs/how-to/how-to-use-image-cache-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ The Token metadata API allows you to specify the path to a custom script that ca
* Protects original image hosts from [DDoS attacks](https://wikipedia.org/wiki/Denial-of-service_attack)
* Increases user privacy

An example IMGIX processor script is included in [`config/image-cache.js`](https://github.com/hirosystems/token-metadata-api/blob/master/config/image-cache.js).
An example IMGIX processor script is included in [`config/image-cache.js`](https://github.com/hirosystems/token-metadata-api/blob/main/config/image-cache.js).
You can customize the script path by altering the `METADATA_IMAGE_CACHE_PROCESSOR` environment variable.
8 changes: 4 additions & 4 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ The following is the internal architectural diagram of the Token metadata API.

#### Blockchain importer

The [`BlockchainImporter`](https://github.com/hirosystems/token-metadata-api/tree/master/src/token-processor/blockchain-api/blockchain-importer.ts) is a component in the Token metadata API that takes token contracts from the API database. This component is only used on service boot.
The [`BlockchainImporter`](https://github.com/hirosystems/token-metadata-api/tree/main/src/token-processor/blockchain-api/blockchain-importer.ts) is a component in the Token metadata API that takes token contracts from the API database. This component is only used on service boot.

It connects to the Stacks Blockchain API database and scans the entire `smart_contracts` table looking for any contract that conforms to [SIP-009](https://github.com/stacksgov/sips/blob/main/sips/sip-009/sip-009-nft-standard.md), SIP-010 or SIP-013. When it finds a token contract, it creates a [`ProcessSmartContractJob`](https://github.com/hirosystems/token-metadata-api/tree/master/src/token-processor/queue/job/process-smart-contract-job.ts) and adds it to the [Job queue](#job-queue), ßso its tokens can be read and processed thereafter.
It connects to the Stacks Blockchain API database and scans the entire `smart_contracts` table looking for any contract that conforms to [SIP-009](https://github.com/stacksgov/sips/blob/main/sips/sip-009/sip-009-nft-standard.md), SIP-010 or SIP-013. When it finds a token contract, it creates a [`ProcessSmartContractJob`](https://github.com/hirosystems/token-metadata-api/tree/main/src/token-processor/queue/job/process-smart-contract-job.ts) and adds it to the [Job queue](#job-queue), ßso its tokens can be read and processed thereafter.

This process runs only once. If the Token metadata API is ever restarted, though, this component re-scans the API `smart_contracts` table from the last processed block height. It can pick up any newer contracts it might have missed while the service was unavailable.

#### Smart contract monitor

The [`BlockchainSmartContractMonitor`](https://github.com/hirosystems/token-metadata-api/tree/master/src/token-processor/blockchain-api/blockchain-smart-contract-monitor.ts) component constantly listens to the following Stacks Blockchain API events:
The [`BlockchainSmartContractMonitor`](https://github.com/hirosystems/token-metadata-api/tree/main/src/token-processor/blockchain-api/blockchain-smart-contract-monitor.ts) component constantly listens to the following Stacks Blockchain API events:

* **Smart contract log events**

Expand All @@ -60,7 +60,7 @@ This process is kept alive throughout the entire service lifetime.

#### Job queue

The role of the [`JobQueue`](https://github.com/hirosystems/token-metadata-api/tree/master/src/token-processor/queue/job-queue.ts) is to perform all the smart contract and token processing in the service.
The role of the [`JobQueue`](https://github.com/hirosystems/token-metadata-api/tree/main/src/token-processor/queue/job-queue.ts) is to perform all the smart contract and token processing in the service.

It is a priority queue that organizes all necessary work for contract ingestion and token metadata processing. Every job this queue processes corresponds to one row in the `jobs` DB table, which marks its processing status and related objects to be worked on (smart contract or token).

Expand Down
2 changes: 1 addition & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ paths:
properties:
server_version:
type: string
example: token-metadata-api v0.0.1 (master:a1b2c3)
example: token-metadata-api v0.0.1 (main:a1b2c3)
status:
type: string
example: ready
Expand Down
2 changes: 1 addition & 1 deletion src/api/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ export const SearchResponse = Type.Array(SearchResultItem, {

export const ApiStatusResponse = Type.Object(
{
server_version: Type.String({ examples: ['token-metadata-api v0.0.1 (master:a1b2c3)'] }),
server_version: Type.String({ examples: ['token-metadata-api v0.0.1 (main:a1b2c3)'] }),
status: Type.String({ examples: ['ready'] }),
chain_tip: Nullable(
Type.Object({
Expand Down
Loading