Skip to content
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

create first beta release #62

Merged
merged 118 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
195088f
chore: initial commit
rafaelcr Jul 8, 2022
f1480c3
feat: start adding types
rafaelcr Jul 8, 2022
362f739
feat: more types and validation
rafaelcr Jul 9, 2022
0b4f623
refactor: move to plugins
rafaelcr Jul 9, 2022
0e3bd96
chore: formatting
rafaelcr Jul 9, 2022
afcde9e
feat: migrations
rafaelcr Jul 9, 2022
b3b407f
chore: expand types
rafaelcr Jul 9, 2022
63d9e60
feat: new table schema
rafaelcr Jul 12, 2022
74fab02
chore: smart_contracts tweaks
rafaelcr Jul 12, 2022
43d0fe0
feat: contract queue table
rafaelcr Jul 13, 2022
e1ea1f8
draft: queues
rafaelcr Jul 13, 2022
7d9057b
feat: better queue shape
rafaelcr Jul 14, 2022
34291ce
feat: better shape in the queues
rafaelcr Jul 14, 2022
5619791
chore: insert contract and queue in same query
rafaelcr Jul 15, 2022
75d1707
feat: start testing queues
rafaelcr Jul 19, 2022
8a12beb
chore: single queue
rafaelcr Jul 19, 2022
aa45c54
feat: one queue works
rafaelcr Jul 20, 2022
5e6a450
feat: working metadata parser
rafaelcr Jul 20, 2022
ac9207d
feat: route responses working correctly
rafaelcr Jul 22, 2022
ec738f8
feat: add table indexes
rafaelcr Jul 22, 2022
cfd30eb
test: first jest draft
rafaelcr Jul 23, 2022
6397ab7
test: smart contract job
rafaelcr Jul 24, 2022
263e804
test: first token job test
rafaelcr Jul 25, 2022
23f9294
test: metadata arbitrary values
rafaelcr Jul 25, 2022
a165678
feat: support localizations
rafaelcr Jul 25, 2022
82fe554
feat: import sip-019 notifications
rafaelcr Aug 1, 2022
7bef29b
docs: add readme
rafaelcr Aug 2, 2022
2a0c208
feat: add swagger and cors
rafaelcr Aug 2, 2022
f6a69c1
feat: timestamps on tokens and contracts, add tests
rafaelcr Aug 2, 2022
649f296
feat: add etag caching
rafaelcr Aug 2, 2022
4899c56
chore(deps): bump undici from 5.6.1 to 5.8.0
dependabot[bot] Aug 3, 2022
7dd9f5a
Merge pull request #1 from hirosystems/dependabot/npm_and_yarn/undici…
rafaelcr Aug 3, 2022
89ad9be
feat: timeout and max size for metadata fetch
rafaelcr Aug 3, 2022
d8731c6
fix: set token updated_at on metadata refresh
rafaelcr Aug 3, 2022
a19cbd8
test: fastify test structure
rafaelcr Aug 4, 2022
ed43206
docs: expand readme
rafaelcr Aug 4, 2022
4708020
feat: add locale query param
rafaelcr Aug 4, 2022
704ce67
docs: update architecture to include fetches
rafaelcr Aug 4, 2022
83cfea3
docs: add supported URI schemes to README
rafaelcr Aug 4, 2022
f90fab8
fix: ignore metadata that is not SIP-016 compliant
rafaelcr Aug 4, 2022
ee47a45
chore: move to bigserial for id columns
rafaelcr Aug 4, 2022
f5df667
docs: expand comments on job queue
rafaelcr Aug 4, 2022
136d4a0
feat: add prometheus metrics
rafaelcr Aug 4, 2022
ead36e2
docs: mention prometheus in readme
rafaelcr Aug 5, 2022
18eab3f
build: update dependencies
rafaelcr Nov 9, 2022
dc7837f
Merge branch 'develop' of github.com:rafaelcr/token-metadata-service …
rafaelcr Nov 9, 2022
5e72ed0
feat: launch postgres on docker for test suite (#9)
rafaelcr Nov 9, 2022
c04aecc
feat: github ci (#10)
rafaelcr Nov 10, 2022
0055d64
test: blockchain importer
rafaelcr Nov 15, 2022
b304eab
feat: add eslint (#14)
rafaelcr Nov 16, 2022
205ec15
feat: check raw metadata JSON types with typebox (#15)
rafaelcr Nov 16, 2022
dba3473
feat: expand status endpoint to include token, contract, job counts (…
rafaelcr Nov 16, 2022
6c2326b
feat: add first version of pg tools (#18)
rafaelcr Nov 18, 2022
b8ebaf3
fix: retry long cursor queries (#20)
rafaelcr Nov 19, 2022
c76c00a
test: job and core node rpc (#23)
rafaelcr Nov 19, 2022
e0242d9
test: queue size limits (#24)
rafaelcr Nov 22, 2022
eff46d1
fix: handle pg errors on queue (#25)
rafaelcr Nov 22, 2022
ca8e3da
feat: add image cdn script (#26)
rafaelcr Nov 26, 2022
828ca43
feat: add graceful shutdown (#27)
rafaelcr Nov 28, 2022
470be94
fix: add pg env vars to handle connection options (#30)
rafaelcr Nov 28, 2022
2790597
feat: return token error responses for different scenarios (#33)
rafaelcr Nov 28, 2022
1bd395b
feat: support arweave URIs (#35)
rafaelcr Nov 29, 2022
a9e194e
feat: allow other keys for token ids and image uris (#36)
rafaelcr Nov 29, 2022
b79742a
feat: support SIP-019 notifications (#43)
rafaelcr Dec 1, 2022
676ffef
fix: change total supply column type to `numeric` (#46)
rafaelcr Dec 2, 2022
c68d85c
feat: add configurable storage gateways (#48)
rafaelcr Dec 2, 2022
20427b0
fix: queue graceful shutdown (#49)
rafaelcr Dec 2, 2022
4128e8e
feat: add winston logger (#50)
rafaelcr Dec 2, 2022
f965612
feat: restrict max nft count per contract (#52)
rafaelcr Dec 3, 2022
5f1697d
feat: build openapi spec and generate redoc (#53)
rafaelcr Dec 5, 2022
c2d1765
docs: expand endpoint openapi documentation (#54)
rafaelcr Dec 5, 2022
c5228e4
feat: add docker build step (#55)
rafaelcr Dec 5, 2022
8588048
feat: metadata update modes (#57)
rafaelcr Dec 6, 2022
94b95e2
fix: stop using cursors to insert and enqueue tokens (#58)
rafaelcr Dec 6, 2022
c42aa5c
fix: parse stringable values in raw metadata (#59)
rafaelcr Dec 11, 2022
4e09fc7
docs: expand README (#60)
rafaelcr Dec 11, 2022
50d0666
fix: flowchart colors (#61)
rafaelcr Dec 11, 2022
7255d62
refactor: move job classes (#63)
rafaelcr Dec 12, 2022
2627474
Update src/api/init.ts
rafaelcr Dec 20, 2022
a1021b8
build: add dockerignore and remove extra deps from Dockerfile (#67)
rafaelcr Jan 5, 2023
f1f2818
chore: switch from winston to pino for logging (#68)
rafaelcr Jan 5, 2023
19ffb62
fix: switch to jsonb type for json columns (#69)
rafaelcr Jan 5, 2023
fea3e55
fix: remove SELECT * statements (#71)
rafaelcr Jan 5, 2023
214ea3b
fix: use regex to replace URI placeholders
rafaelcr Jan 5, 2023
2563e24
style: fix lint errors for regexes
rafaelcr Jan 5, 2023
c269b3e
fix: specify metadata value types (#72)
rafaelcr Jan 6, 2023
19ec483
docs: explain the image cache service script
rafaelcr Jan 12, 2023
aa2b88f
ci: fix semantic release config
rafaelcr Jan 12, 2023
6160ebd
fix: add more detail on http errors (#73)
rafaelcr Jan 13, 2023
e1865fa
docs: expand on CDN advantages in README [skip ci]
rafaelcr Jan 17, 2023
4e7b9c1
feat: add SIP-013 SFT support (#74)
rafaelcr Jan 18, 2023
96452c8
chore: move to stacks-encoding-native-js (#75)
rafaelcr Jan 18, 2023
ba2f7de
feat: add server version to status endpoint and rendered docs (#76)
rafaelcr Jan 19, 2023
be262f6
chore: add husky to enforce conventional commits (#77)
rafaelcr Jan 20, 2023
9dba66c
test: clean up api db mocks and server status (#79)
rafaelcr Jan 20, 2023
e1c0882
feat: refresh dynamic metadata tokens periodically (#64)
rafaelcr Jan 20, 2023
0b144e1
chore: update env comment [skip ci]
rafaelcr Jan 20, 2023
6c28037
feat: import sip-019 notifications during boot (#81)
rafaelcr Jan 23, 2023
4bd2812
fix: contract log queries
rafaelcr Jan 23, 2023
780b160
fix: uintcv creation
rafaelcr Jan 23, 2023
8dff8a6
fix: jsonb value insertions
rafaelcr Jan 23, 2023
293498c
chore: add more detail to metadata fetch errors
rafaelcr Jan 23, 2023
5985c80
fix: jsonb type interpretation on endpoints
rafaelcr Jan 24, 2023
08cdce6
fix: retry 429 and gateway timeouts
rafaelcr Jan 24, 2023
10b1e50
test: image cache script
rafaelcr Jan 24, 2023
be5f6c5
test: jsonb tests fixed
rafaelcr Jan 24, 2023
84ba448
test: image cache on nft metadata
rafaelcr Jan 24, 2023
bf8f1b8
Merge pull request #83 from hirosystems/fix/impl
rafaelcr Jan 24, 2023
6ce6454
docs: add shutdown details to readme [skip ci]
rafaelcr Jan 24, 2023
9b26439
fix: move from fetch to request to fix ENOBUFS
rafaelcr Jan 25, 2023
e16fcd5
fix: improve SIGINT handling for queued jobs
rafaelcr Jan 25, 2023
3c89967
chore: upgrade undici to v5.16.0
rafaelcr Jan 25, 2023
e658e1d
fix: manage additional timeout errors on metadata fetch
rafaelcr Jan 25, 2023
c16025f
fix: update_at jobs on status or retry change
rafaelcr Jan 26, 2023
67433de
style: update types for request text
rafaelcr Jan 26, 2023
a30641a
fix: persist http agent for metadata fetches
rafaelcr Jan 26, 2023
e268c79
fix: shut down queue at the end of sequence
rafaelcr Jan 26, 2023
53673b2
fix: sft_mint detection
rafaelcr Jan 26, 2023
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
3 changes: 3 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["@commitlint/config-conventional"]
}
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/node_modules
**/tmp
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# top-most EditorConfig file
root = true

[{*.ts,*.json}]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# See src/env.ts for environment variable documentation.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
.eslintrc.js
29 changes: 29 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module.exports = {
root: true,
extends: ['@stacks/eslint-config', 'prettier'],
overrides: [],
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.json',
ecmaVersion: 2020,
sourceType: 'module',
},
ignorePatterns: ['*.config.js', 'config/*', '*.mjs', 'tests/*.js'],
plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc', 'prettier'],
rules: {
'prettier/prettier': 'error',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-use-before-define': ['error', 'nofunc'],
'@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
'no-warning-comments': 'warn',
'tsdoc/syntax': 'error',
// TODO: Remove this when `any` abi type is fixed.
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
},
};
169 changes: 169 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
name: CI

on:
push:
branches:
- master
- develop
- beta
tags-ignore:
- '**'
paths-ignore:
- '**/CHANGELOG.md'
- '**/package.json'
pull_request:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: |
~/.npm
**/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- name: Install deps
run: npm ci --audit=false

- name: Lint ESLint
run: npm run lint:eslint

- name: Lint Prettier
run: npm run lint:prettier

test:
runs-on: ubuntu-latest
env:
API_HOST: 127.0.0.1
API_PORT: 3000
PGHOST: 127.0.0.1
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: postgres
BLOCKCHAIN_API_PGHOST: 127.0.0.1
BLOCKCHAIN_API_PGPORT: 5432
BLOCKCHAIN_API_PGUSER: postgres
BLOCKCHAIN_API_PGPASSWORD: postgres
BLOCKCHAIN_API_PGDATABASE: postgres
STACKS_NODE_RPC_HOST: 127.0.0.1
STACKS_NODE_RPC_PORT: 24440
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: |
~/.npm
**/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- name: Install deps
run: npm ci --audit=false

- name: Setup integration environment
run: |
sudo ufw disable
npm run testenv:run -- -d
npm run testenv:logs -- --no-color &> docker-compose-logs.txt &

- name: Run tests
run: npm run test

- name: Print integration environment logs
run: cat docker-compose-logs.txt
if: failure()

- name: Teardown integration environment
run: npm run testenv:stop
if: always()

build-publish:
runs-on: ubuntu-latest
needs:
- lint
- test
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
fetch-depth: 0
persist-credentials: false

- name: Semantic Release
uses: cycjimmy/[email protected]
id: semantic
# Only run on non-PR events or only PRs that aren't from forks
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
SEMANTIC_RELEASE_PACKAGE: ${{ github.event.repository.name }}
with:
semantic_version: 19
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
@semantic-release/exec
conventional-changelog-conventionalcommits

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Docker Meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
hirosystems/${{ github.event.repository.name }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}},value=${{ steps.semantic.outputs.new_release_version }},enable=${{ steps.semantic.outputs.new_release_version != '' }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.semantic.outputs.new_release_version }},enable=${{ steps.semantic.outputs.new_release_version != '' }}

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build/Tag/Push Image
uses: docker/build-push-action@v2
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Only push if (there's a new release on main branch, or if building a non-main branch) and (Only run on non-PR events or only PRs that aren't from forks)
push: ${{ (github.ref != 'refs/heads/master' || steps.semantic.outputs.new_release_version != '') && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
53 changes: 53 additions & 0 deletions .github/workflows/vercel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Vercel

env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

on:
push:
branches-ignore:
- master

jobs:
vercel:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: |
~/.npm
**/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- name: Install deps
run: npm ci --audit=false

- name: Install Vercel CLI
run: npm install --global vercel@latest

- name: Pull Vercel environment information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}

- name: Build project artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}

- name: Deploy project artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
*.swp

pids
logs
results
tmp

# Build
public/css/main.css

# Coverage reports
coverage

# API keys and secrets
.env

# Dependency directory
node_modules
bower_components

# Editors
.idea
*.iml

# OS metadata
.DS_Store
Thumbs.db

# Ignore built ts files
dist/**/*

# ignore yarn.lock
yarn.lock

.git-info
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx commitlint --edit
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
39 changes: 39 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Run",
"runtimeArgs": [
"-r",
"ts-node/register"
],
"args": [
"${workspaceFolder}/src/index.ts"
],
"outputCapture": "std",
"internalConsoleOptions": "openOnSessionStart",
"env": {
"NODE_ENV": "development",
"TS_NODE_SKIP_IGNORE": "true"
},
"killBehavior": "polite",
},
{
"type": "node",
"request": "launch",
"name": "Jest",
"program": "${workspaceFolder}/node_modules/jest/bin/jest",
"args": [
"--testTimeout=3600000",
"--runInBand",
"--no-cache",
],
"outputCapture": "std",
"console": "integratedTerminal",
"preLaunchTask": "npm: testenv:run",
"postDebugTask": "npm: testenv:stop",
},
]
}
Loading