Skip to content

Commit

Permalink
feat: BRC-20 token support (#78)
Browse files Browse the repository at this point in the history
* chore: add brc20 migrations

* feat: start storing token deploys

* feat: mints with balance changes

* chore: events table draft

* feat: first balance endpoint

* fix: balances and rollbacks

* feat: token info endpoint

* feat: tokens endpoint as paginated index

* test: paginated index

* test: brc20 format

* chore: more standard validation

* fix: tick must be 4 bytes or less

* fix: invalid decimal count

* feat: mint within supply

* test: mint limit

* chore: first transfers

* test: dont exceed avail balance for transfer

* test: multiple transfers in block

* feat: first balance transfers

* fix: transfers only usable once

* refactor: extract to separate functions

* fix: remove old json content tables

* fix: balances/:address

* feat: token details

* feat: holders endpoint

* fix: introduce materialized view to count address inscriptions (#147)

* fix: introduce materialized view to count address inscriptions

* fix: make index unique

* chore(release): 0.4.15 [skip ci]

## [0.4.15](hirosystems/ordinals-api@v0.4.14...v0.4.15) (2023-07-13)

### Bug Fixes

* introduce materialized view to count address inscriptions ([#147](hirosystems/ordinals-api#147)) ([2e79311](hirosystems/ordinals-api@2e79311))

* refactor: move brc20 pg to separate file

* fix: add indexes for fks

* fix: remove old json schemas

* refactor: move brc-20 files to its own folder

* chore(release): 1.0.0-beta.6 [skip ci]

## [1.0.0-beta.6](hirosystems/ordinals-api@v1.0.0-beta.5...v1.0.0-beta.6) (2023-07-21)

### Bug Fixes

* make etag calculation sensitive to inscription location gap fills and upserts ([#156](hirosystems/ordinals-api#156)) ([5648c9e](hirosystems/ordinals-api@5648c9e))
* refresh views in parallel ([#154](hirosystems/ordinals-api#154)) ([a7674a9](hirosystems/ordinals-api@a7674a9))

* chore(release): 0.4.15 [skip ci]

* introduce materialized view to count address inscriptions ([#147](hirosystems/ordinals-api#147)) ([2e79311](hirosystems/ordinals-api@2e79311))

* fix: build beta image

* fix: remove unused json functions (#165)

* chore(release): 1.0.0-beta.7 [skip ci]

## [1.0.0-beta.7](hirosystems/ordinals-api@v1.0.0-beta.6...v1.0.0-beta.7) (2023-07-21)

### Bug Fixes

* build beta image ([13f2c13](hirosystems/ordinals-api@13f2c13))
* introduce materialized view to count address inscriptions ([#147](hirosystems/ordinals-api#147)) ([2e79311](hirosystems/ordinals-api@2e79311))
* remove unused json functions ([#165](hirosystems/ordinals-api#165)) ([3eb0e24](hirosystems/ordinals-api@3eb0e24))

* fix: skip db migrations during readonly mode

* chore(release): 1.0.0-beta.8 [skip ci]

## [1.0.0-beta.8](hirosystems/ordinals-api@v1.0.0-beta.7...v1.0.0-beta.8) (2023-07-21)

### Bug Fixes

* skip db migrations during readonly mode ([d5157f0](hirosystems/ordinals-api@d5157f0))

* fix: allow gap fills for transfers

* feat: add inscription number sort option (#168)

* chore(release): 1.0.0-beta.9 [skip ci]

## [1.0.0-beta.9](hirosystems/ordinals-api@v1.0.0-beta.8...v1.0.0-beta.9) (2023-07-25)

### Features

* add inscription number sort option ([#168](hirosystems/ordinals-api#168)) ([9f4cdbc](hirosystems/ordinals-api@9f4cdbc))

* feat: detect and tag recursive inscriptions (#167)

* feat: initial impl

* fix: tests

* feat: filter by recursive

* fix: tests

* fix: make migration progressive

* chore(release): 1.0.0-beta.10 [skip ci]

## [1.0.0-beta.10](hirosystems/ordinals-api@v1.0.0-beta.9...v1.0.0-beta.10) (2023-07-25)

### Features

* detect and tag recursive inscriptions ([#167](hirosystems/ordinals-api#167)) ([fb36285](hirosystems/ordinals-api@fb36285))

* fix: warn correctly on missing prev locations

* chore(release): 1.0.0-beta.11 [skip ci]

## [1.0.0-beta.11](hirosystems/ordinals-api@v1.0.0-beta.10...v1.0.0-beta.11) (2023-07-25)

### Bug Fixes

* warn correctly on missing prev locations ([879bf55](hirosystems/ordinals-api@879bf55))

* fix: rollback location pointers (#174)

* chore(release): 1.0.0-beta.12 [skip ci]

## [1.0.0-beta.12](hirosystems/ordinals-api@v1.0.0-beta.11...v1.0.0-beta.12) (2023-07-31)

### Bug Fixes

* rollback location pointers ([#174](hirosystems/ordinals-api#174)) ([3c9d7f0](hirosystems/ordinals-api@3c9d7f0))

* fix: optimize COUNT calculations via the use of count tables (#175)

* feat: first iteration

* fix: rollbacks

* fix: block height ranges

* fix: block hash count

* fix: add custom count support

* feat: add cursed filter

* feat: genesis address filter

* chore(release): 1.0.0-beta.13 [skip ci]

## [1.0.0-beta.13](hirosystems/ordinals-api@v1.0.0-beta.12...v1.0.0-beta.13) (2023-08-01)

### Bug Fixes

* optimize COUNT calculations via the use of count tables ([#175](hirosystems/ordinals-api#175)) ([31498bd](hirosystems/ordinals-api@31498bd))

* fix: add secondary sorting by inscription number (#177)

* chore(release): 1.0.0-beta.14 [skip ci]

## [1.0.0-beta.14](hirosystems/ordinals-api@v1.0.0-beta.13...v1.0.0-beta.14) (2023-08-02)

### Bug Fixes

* add secondary sorting by inscription number ([#177](hirosystems/ordinals-api#177)) ([99959df](hirosystems/ordinals-api@99959df))

* fix: consider `tx_index` in transfers by block endpoint (#178)

* fix: upsert warning

* fix: transfers same block

* chore(release): 1.0.0-beta.15 [skip ci]

## [1.0.0-beta.15](hirosystems/ordinals-api@v1.0.0-beta.14...v1.0.0-beta.15) (2023-08-04)

### Bug Fixes

* consider `tx_index` in transfers by block endpoint ([#178](hirosystems/ordinals-api#178)) ([ed517d6](hirosystems/ordinals-api@ed517d6))

* fix: only consider blessed inscriptions

* feat: brc-20 balance at block (#186)

* build: release for brc-20 branch

* chore(release): 1.0.0-brc-20.1 [skip ci]

## [1.0.0-brc-20.1](hirosystems/ordinals-api@v0.4.15...v1.0.0-brc-20.1) (2023-08-17)

### ⚠ BREAKING CHANGES

* optimize transfer replay capability (#129)

### Features

* add inscription number sort option ([#168](hirosystems/ordinals-api#168)) ([9f4cdbc](hirosystems/ordinals-api@9f4cdbc))
* add stats endpoint for inscription counts ([#70](hirosystems/ordinals-api#70)) ([ac18e62](hirosystems/ordinals-api@ac18e62))
* brc-20 balance at block ([#186](hirosystems/ordinals-api#186)) ([ced5cb3](hirosystems/ordinals-api@ced5cb3))
* detect and tag recursive inscriptions ([#167](hirosystems/ordinals-api#167)) ([fb36285](hirosystems/ordinals-api@fb36285))
* first balance endpoint ([f9c6654](hirosystems/ordinals-api@f9c6654))
* first balance transfers ([dd8ec07](hirosystems/ordinals-api@dd8ec07))
* holders endpoint ([a01f77e](hirosystems/ordinals-api@a01f77e))
* mint within supply ([c8e5820](hirosystems/ordinals-api@c8e5820))
* mints with balance changes ([32e90f7](hirosystems/ordinals-api@32e90f7))
* optimize transfer replay capability ([#129](hirosystems/ordinals-api#129)) ([97874cc](hirosystems/ordinals-api@97874cc))
* start storing token deploys ([bf4c7f6](hirosystems/ordinals-api@bf4c7f6))
* token details ([5d35d5b](hirosystems/ordinals-api@5d35d5b))
* token info endpoint ([8fad6b9](hirosystems/ordinals-api@8fad6b9))
* tokens endpoint as paginated index ([ae2049b](hirosystems/ordinals-api@ae2049b))

### Bug Fixes

* add address column to genesis and current ([d71e1d4](hirosystems/ordinals-api@d71e1d4))
* add indexes for fks ([354ddd0](hirosystems/ordinals-api@354ddd0))
* add secondary sorting by inscription number ([#177](hirosystems/ordinals-api#177)) ([99959df](hirosystems/ordinals-api@99959df))
* allow gap fills for transfers ([026c275](hirosystems/ordinals-api@026c275))
* allow multiple transfers of an inscription in one block ([#132](hirosystems/ordinals-api#132)) ([bc545f0](hirosystems/ordinals-api@bc545f0))
* auto predicate registration option ([e1ed7c7](hirosystems/ordinals-api@e1ed7c7))
* balances and rollbacks ([61b4139](hirosystems/ordinals-api@61b4139))
* balances/:address ([687c2e4](hirosystems/ordinals-api@687c2e4))
* build beta image ([13f2c13](hirosystems/ordinals-api@13f2c13))
* build event server using chainhook client library ([#105](hirosystems/ordinals-api#105)) ([ab4c795](hirosystems/ordinals-api@ab4c795))
* chainhook client upgrades ([9a96492](hirosystems/ordinals-api@9a96492))
* consider `tx_index` in transfers by block endpoint ([#178](hirosystems/ordinals-api#178)) ([ed517d6](hirosystems/ordinals-api@ed517d6))
* introduce materialized view to count address inscriptions ([#147](hirosystems/ordinals-api#147)) ([09a95d5](hirosystems/ordinals-api@09a95d5))
* invalid decimal count ([aa15b0e](hirosystems/ordinals-api@aa15b0e))
* make etag calculation sensitive to inscription location gap fills and upserts ([#156](hirosystems/ordinals-api#156)) ([5648c9e](hirosystems/ordinals-api@5648c9e))
* only consider blessed inscriptions ([2a4700c](hirosystems/ordinals-api@2a4700c))
* optimize COUNT calculations via the use of count tables ([#175](hirosystems/ordinals-api#175)) ([31498bd](hirosystems/ordinals-api@31498bd))
* refresh views in parallel ([#154](hirosystems/ordinals-api#154)) ([a7674a9](hirosystems/ordinals-api@a7674a9))
* remove old json content tables ([0732048](hirosystems/ordinals-api@0732048))
* remove old json schemas ([8cc7f8a](hirosystems/ordinals-api@8cc7f8a))
* remove unused json functions ([#165](hirosystems/ordinals-api#165)) ([3eb0e24](hirosystems/ordinals-api@3eb0e24))
* rename location pointer tables ([b84d27e](hirosystems/ordinals-api@b84d27e))
* rollback location pointers ([#174](hirosystems/ordinals-api#174)) ([3c9d7f0](hirosystems/ordinals-api@3c9d7f0))
* save tx_index on locations to support transfers on same block ([#145](hirosystems/ordinals-api#145)) ([30a9635](hirosystems/ordinals-api@30a9635))
* skip db migrations during readonly mode ([d5157f0](hirosystems/ordinals-api@d5157f0))
* tick must be 4 bytes or less ([f6fd0a6](hirosystems/ordinals-api@f6fd0a6))
* transfers only usable once ([542ec34](hirosystems/ordinals-api@542ec34))
* upgrade chainhook client ([cbbb951](hirosystems/ordinals-api@cbbb951))
* upgrade chainhook client to 1.3.3 ([ee66f93](hirosystems/ordinals-api@ee66f93))
* warn correctly on missing prev locations ([879bf55](hirosystems/ordinals-api@879bf55))

* feat: add more brc20 features (#183)

* refactor: update nullish access

* feat: add deploy_timestamp to brc-20 token endpoints

* feat: add minted_supply to brc-20 token endpoints

* refactor: improve scan performance with generated lower ticker

* feat: add prefix filtering to brc20 deploy tickers

* test: add token endpoint test

---------

Co-authored-by: janniks <[email protected]>

* fix: optimize inscription and brc-20 inserts (#189)

* chore: draft optims

* chore: more optimizations

* fix: reveals and transfers in same batch

* fix: inscriptions tests pass

* fix: optimize pointer logic

* fix: cache updated_at writes

* feat: scan block concept

* fix: individual items, start transfers

* fix: all tests pass

* fix: env var brc20 processing

* feat: add admin rpc server to control brc20 scans

* style: comments

* chore(release): 1.0.0-brc-20.2 [skip ci]

## [1.0.0-brc-20.2](hirosystems/ordinals-api@v1.0.0-brc-20.1...v1.0.0-brc-20.2) (2023-08-24)

### Features

* add more brc20 features ([#183](hirosystems/ordinals-api#183)) ([c1939ce](hirosystems/ordinals-api@c1939ce))

### Bug Fixes

* optimize inscription and brc-20 inserts ([#189](hirosystems/ordinals-api#189)) ([3807334](hirosystems/ordinals-api@3807334))

* fix: sending transfer as fee returns amt to sender

* fix: add unique indexes for mints and transfers

* chore(release): 1.0.0-brc-20.3 [skip ci]

## [1.0.0-brc-20.3](hirosystems/ordinals-api@v1.0.0-brc-20.2...v1.0.0-brc-20.3) (2023-08-24)

### Bug Fixes

* add unique indexes for mints and transfers ([b428bb4](hirosystems/ordinals-api@b428bb4))
* sending transfer as fee returns amt to sender ([e23012a](hirosystems/ordinals-api@e23012a))

* fix: upgrade api-toolkit (#190)

* fix: upgrade api-toolkit

* fix: isProdEnv helper

* fix: refresh supplies view only if BRC-20 is enabled

* chore(release): 1.0.0-brc-20.4 [skip ci]

## [1.0.0-brc-20.4](hirosystems/ordinals-api@v1.0.0-brc-20.3...v1.0.0-brc-20.4) (2023-08-25)

### Bug Fixes

* refresh supplies view only if BRC-20 is enabled ([7d6705a](hirosystems/ordinals-api@7d6705a))
* upgrade api-toolkit ([#190](hirosystems/ordinals-api#190)) ([0e673a7](hirosystems/ordinals-api@0e673a7))

* fix: change uniqueness constraint in locations table

* chore(release): 1.0.0-brc-20.5 [skip ci]

## [1.0.0-brc-20.5](hirosystems/ordinals-api@v1.0.0-brc-20.4...v1.0.0-brc-20.5) (2023-08-25)

### Bug Fixes

* change uniqueness constraint in locations table ([9a9c5de](hirosystems/ordinals-api@9a9c5de))

* fix: place a cap on max insertion size

* chore(release): 1.0.0-brc-20.6 [skip ci]

## [1.0.0-brc-20.6](hirosystems/ordinals-api@v1.0.0-brc-20.5...v1.0.0-brc-20.6) (2023-08-26)

### Bug Fixes

* place a cap on max insertion size ([bef5f23](hirosystems/ordinals-api@bef5f23))

* fix: guard against empty recursion refs

* fix: optimize inscription backfill indexes (#197)

* fix: add recursion backfill and temporary skip (#198)

* fix: dont update cache timestamp during ingestion (#200)

* fix: do not insert repeated recursions (#199)

* fix: do not insert repeated recursions

* chore: remove custom launch

* chore: lock commit-analyzer to 9.0.2; rm dup plugins in releaserc file

* chore: revert releaserc file

* fix: split recursion insertion into chunks (#201)

* chore(release): 1.0.0 [skip ci]

* optimize transfer replay capability (#129)

* add inscription number sort option ([#168](hirosystems/ordinals-api#168)) ([9f4cdbc](hirosystems/ordinals-api@9f4cdbc))
* add stats endpoint for inscription counts ([#70](hirosystems/ordinals-api#70)) ([ac18e62](hirosystems/ordinals-api@ac18e62))
* detect and tag recursive inscriptions ([#167](hirosystems/ordinals-api#167)) ([fb36285](hirosystems/ordinals-api@fb36285))
* optimize transfer replay capability ([#129](hirosystems/ordinals-api#129)) ([97874cc](hirosystems/ordinals-api@97874cc))

* add address column to genesis and current ([d71e1d4](hirosystems/ordinals-api@d71e1d4))
* add secondary sorting by inscription number ([#177](hirosystems/ordinals-api#177)) ([99959df](hirosystems/ordinals-api@99959df))
* allow multiple transfers of an inscription in one block ([#132](hirosystems/ordinals-api#132)) ([bc545f0](hirosystems/ordinals-api@bc545f0))
* auto predicate registration option ([e1ed7c7](hirosystems/ordinals-api@e1ed7c7))
* build beta image ([13f2c13](hirosystems/ordinals-api@13f2c13))
* build event server using chainhook client library ([#105](hirosystems/ordinals-api#105)) ([ab4c795](hirosystems/ordinals-api@ab4c795))
* chainhook client upgrades ([9a96492](hirosystems/ordinals-api@9a96492))
* consider `tx_index` in transfers by block endpoint ([#178](hirosystems/ordinals-api#178)) ([ed517d6](hirosystems/ordinals-api@ed517d6))
* introduce materialized view to count address inscriptions ([#147](hirosystems/ordinals-api#147)) ([09a95d5](hirosystems/ordinals-api@09a95d5))
* make etag calculation sensitive to inscription location gap fills and upserts ([#156](hirosystems/ordinals-api#156)) ([5648c9e](hirosystems/ordinals-api@5648c9e))
* optimize COUNT calculations via the use of count tables ([#175](hirosystems/ordinals-api#175)) ([31498bd](hirosystems/ordinals-api@31498bd))
* refresh views in parallel ([#154](hirosystems/ordinals-api#154)) ([a7674a9](hirosystems/ordinals-api@a7674a9))
* remove unused json functions ([#165](hirosystems/ordinals-api#165)) ([3eb0e24](hirosystems/ordinals-api@3eb0e24))
* rename location pointer tables ([b84d27e](hirosystems/ordinals-api@b84d27e))
* rollback location pointers ([#174](hirosystems/ordinals-api#174)) ([3c9d7f0](hirosystems/ordinals-api@3c9d7f0))
* save tx_index on locations to support transfers on same block ([#145](hirosystems/ordinals-api#145)) ([30a9635](hirosystems/ordinals-api@30a9635))
* semantic release process ([#202](hirosystems/ordinals-api#202)) ([1bd3f74](hirosystems/ordinals-api@1bd3f74))
* skip db migrations during readonly mode ([d5157f0](hirosystems/ordinals-api@d5157f0))
* upgrade api-toolkit ([#190](hirosystems/ordinals-api#190)) ([a691b67](hirosystems/ordinals-api@a691b67))
* upgrade chainhook client ([cbbb951](hirosystems/ordinals-api@cbbb951))
* upgrade chainhook client to 1.3.3 ([ee66f93](hirosystems/ordinals-api@ee66f93))
* warn correctly on missing prev locations ([879bf55](hirosystems/ordinals-api@879bf55))

* ci: remove debug logs on semantic release [skip ci]

* fix: attempt to optimize brc-20 scan (#204)

* fix: use cursor query for brc-20 scan

* fix: optimize content retrieval

* fix: ignore transfers that are not brc-20

* fix: semantic release

* chore(release): 1.0.0-brc-20.7 [skip ci]

## [1.0.0-brc-20.7](hirosystems/ordinals-api@v1.0.0-brc-20.6...v1.0.0-brc-20.7) (2023-08-30)

### Bug Fixes

* add recursion backfill and temporary skip ([#198](hirosystems/ordinals-api#198)) ([63571ee](hirosystems/ordinals-api@63571ee))
* attempt to optimize brc-20 scan ([#204](hirosystems/ordinals-api#204)) ([f6545cd](hirosystems/ordinals-api@f6545cd))
* do not insert repeated recursions ([#199](hirosystems/ordinals-api#199)) ([9c8508b](hirosystems/ordinals-api@9c8508b))
* dont update cache timestamp during ingestion ([#200](hirosystems/ordinals-api#200)) ([8f973a3](hirosystems/ordinals-api@8f973a3))
* guard against empty recursion refs ([71ce1a5](hirosystems/ordinals-api@71ce1a5))
* optimize inscription backfill indexes ([#197](hirosystems/ordinals-api#197)) ([ab2f7bf](hirosystems/ordinals-api@ab2f7bf))
* semantic release ([26cd2c6](hirosystems/ordinals-api@26cd2c6))
* split recursion insertion into chunks ([#201](hirosystems/ordinals-api#201)) ([4ebc106](hirosystems/ordinals-api@4ebc106))

* fix: optimize brc-20 scan by minimizing string conversions (#206)

* fix: filter brc-20 content from postgres

* fix: optimize transfer insert a bit

* chore: move to pg submodule

* chore(release): 1.0.0-brc-20.8 [skip ci]

## [1.0.0-brc-20.8](hirosystems/ordinals-api@v1.0.0-brc-20.7...v1.0.0-brc-20.8) (2023-08-30)

### Bug Fixes

* optimize brc-20 scan by minimizing string conversions ([#206](hirosystems/ordinals-api#206)) ([98c12c8](hirosystems/ordinals-api@98c12c8))

* fix: insert ops in single queries, reduce BigNumber usage (#207)

* fix: validate mint data in pg

* fix: mint in single query

* fix: insert transfer in single query

* fix: transfer send in single query

* fix: optimize BigNumber usage

* chore(release): 1.0.0-brc-20.9 [skip ci]

## [1.0.0-brc-20.9](hirosystems/ordinals-api@v1.0.0-brc-20.8...v1.0.0-brc-20.9) (2023-08-30)

### Bug Fixes

* insert ops in single queries, reduce BigNumber usage ([#207](hirosystems/ordinals-api#207)) ([ef11e34](hirosystems/ordinals-api@ef11e34))

* fix: cast numbers to postgres numeric

* chore(release): 1.0.0-brc-20.10 [skip ci]

## [1.0.0-brc-20.10](hirosystems/ordinals-api@v1.0.0-brc-20.9...v1.0.0-brc-20.10) (2023-08-30)

### Bug Fixes

* cast numbers to postgres numeric ([f8ae276](hirosystems/ordinals-api@f8ae276))

* fix: remove supply view, calculate supply as we mint

* chore(release): 1.0.0-brc-20.11 [skip ci]

## [1.0.0-brc-20.11](hirosystems/ordinals-api@v1.0.0-brc-20.10...v1.0.0-brc-20.11) (2023-08-30)

### Bug Fixes

* remove supply view, calculate supply as we mint ([36addce](hirosystems/ordinals-api@36addce))

* fix: guard against null bytes

* fix: null char escaping

* chore(release): 1.0.0-brc-20.12 [skip ci]

## [1.0.0-brc-20.12](hirosystems/ordinals-api@v1.0.0-brc-20.11...v1.0.0-brc-20.12) (2023-08-30)

### Bug Fixes

* guard against null bytes ([9eddbfc](hirosystems/ordinals-api@9eddbfc))
* null char escaping ([8bb4954](hirosystems/ordinals-api@8bb4954))

* fix: go back to individual content fetch from utf8 pg errors

* chore(release): 1.0.0-brc-20.13 [skip ci]

## [1.0.0-brc-20.13](hirosystems/ordinals-api@v1.0.0-brc-20.12...v1.0.0-brc-20.13) (2023-08-31)

### Bug Fixes

* go back to individual content fetch from utf8 pg errors ([4fd530d](hirosystems/ordinals-api@4fd530d))

* feat: add BRC-20 event history endpoint (#191)

* feat: add BRC-20 event history/activity ingestion and endpoint

* refactor: switch to concat for a single activity subplan for transfers

* refactor: rename prepare_transfer to transfer

* test: fix faulty test due to duplicate inscription numbers

* refactor: switch to postgres enum type

* refactor: merge multiple queries using CTEs

* test: add test with multiple participants

* refactor: add updates from pr

* test: add block height test

* refactor: merge event inserts using CTEs

* fix: use correct ids for events

* fix: migrate into events with queries

---------

Co-authored-by: janniks <[email protected]>
Co-authored-by: Rafael Cardenas <[email protected]>

* chore(release): 1.0.0-brc-20.14 [skip ci]

## [1.0.0-brc-20.14](hirosystems/ordinals-api@v1.0.0-brc-20.13...v1.0.0-brc-20.14) (2023-08-31)

### Features

* add BRC-20 event history endpoint ([#191](hirosystems/ordinals-api#191)) ([d9967b1](hirosystems/ordinals-api@d9967b1))

* fix: remove migration queries

* chore(release): 1.0.0-brc-20.15 [skip ci]

## [1.0.0-brc-20.15](hirosystems/ordinals-api@v1.0.0-brc-20.14...v1.0.0-brc-20.15) (2023-08-31)

### Bug Fixes

* remove migration queries ([f53f889](hirosystems/ordinals-api@f53f889))

* fix: optimize read queries, display amounts with correct decimals (#208)

* fix: single token

* fix: token list

* fix: holders, add tests

* fix: activity sorting

* fix: display amounts with correct number of decimals

* chore(release): 1.0.0-brc-20.16 [skip ci]

## [1.0.0-brc-20.16](hirosystems/ordinals-api@v1.0.0-brc-20.15...v1.0.0-brc-20.16) (2023-09-01)

### Bug Fixes

* optimize read queries, display amounts with correct decimals ([#208](hirosystems/ordinals-api#208)) ([5d6453e](hirosystems/ordinals-api@5d6453e))

* fix: holders count query (#209)

* chore(release): 1.0.0-brc-20.17 [skip ci]

## [1.0.0-brc-20.17](hirosystems/ordinals-api@v1.0.0-brc-20.16...v1.0.0-brc-20.17) (2023-09-01)

### Bug Fixes

* holders count query ([#209](hirosystems/ordinals-api#209)) ([254ed75](hirosystems/ordinals-api@254ed75))

* fix: temporarily disable count calculation to speed up requests (#210)

* chore(release): 1.0.0-brc-20.18 [skip ci]

## [1.0.0-brc-20.18](hirosystems/ordinals-api@v1.0.0-brc-20.17...v1.0.0-brc-20.18) (2023-09-01)

### Bug Fixes

* temporarily disable count calculation to speed up requests ([#210](hirosystems/ordinals-api#210)) ([640e406](hirosystems/ordinals-api@640e406))

* feat: add fast ingestion mode for faster replays (#211)

* chore(release): 1.0.0-brc-20.19 [skip ci]

## [1.0.0-brc-20.19](hirosystems/ordinals-api@v1.0.0-brc-20.18...v1.0.0-brc-20.19) (2023-09-04)

### Features

* add fast ingestion mode for faster replays ([#211](hirosystems/ordinals-api#211)) ([7996587](hirosystems/ordinals-api@7996587))

* fix: optimize sent as fee detection

* chore(release): 1.0.0-brc-20.20 [skip ci]

## [1.0.0-brc-20.20](hirosystems/ordinals-api@v1.0.0-brc-20.19...v1.0.0-brc-20.20) (2023-09-06)

### Bug Fixes

* optimize sent as fee detection ([1c9b0f4](hirosystems/ordinals-api@1c9b0f4))

* fix: calculate etag correctly on status endpoint (#213)

* fix: calculate etag correctly on status endpoint

* fix: vercel build

* chore(release): 1.0.0-brc-20.21 [skip ci]

## [1.0.0-brc-20.21](hirosystems/ordinals-api@v1.0.0-brc-20.20...v1.0.0-brc-20.21) (2023-09-07)

### Bug Fixes

* calculate etag correctly on status endpoint ([#213](hirosystems/ordinals-api#213)) ([f0c42e2](hirosystems/ordinals-api@f0c42e2))

* fix: optimize read queries by keeping count tables, implement rollbacks (#214)

* feat: total balances table

* fix: add total balance column

* fix: return balance to sender

* fix: more than once transfer

* fix: rollbacks

* fix: use new table for token holders

* fix: ticker length check

* feat: add tx_count to tokens (#215)

* fix: use correct inscription_id for transfer_send event

* feat: add tx_count to tokens

* refactor: rename activities events

---------

Co-authored-by: janniks <[email protected]>

* feat: count for activity types

* feat: token count

* test: rollbacks

* test: ignore tickers less than 4 bytes wide

---------

Co-authored-by: janniks <[email protected]>
Co-authored-by: janniks <[email protected]>

* chore(release): 1.0.0-brc-20.22 [skip ci]

## [1.0.0-brc-20.22](hirosystems/ordinals-api@v1.0.0-brc-20.21...v1.0.0-brc-20.22) (2023-09-10)

### Bug Fixes

* optimize read queries by keeping count tables, implement rollbacks ([#214](hirosystems/ordinals-api#214)) ([574d349](hirosystems/ordinals-api@574d349)), closes [#215](hirosystems/ordinals-api#215)

* fix: only increase counts on valid operations

* chore(release): 1.0.0-brc-20.23 [skip ci]

## [1.0.0-brc-20.23](hirosystems/ordinals-api@v1.0.0-brc-20.22...v1.0.0-brc-20.23) (2023-09-10)

### Bug Fixes

* only increase counts on valid operations ([01f0865](hirosystems/ordinals-api@01f0865))

* feat: add location to activity response

* chore(release): 1.0.0-brc-20.24 [skip ci]

## [1.0.0-brc-20.24](hirosystems/ordinals-api@v1.0.0-brc-20.23...v1.0.0-brc-20.24) (2023-09-10)

### Features

* add location to activity response ([580861e](hirosystems/ordinals-api@580861e))

* fix: change tx_count to json number (#216)

Co-authored-by: janniks <[email protected]>

* chore(release): 1.0.0-brc-20.25 [skip ci]

## [1.0.0-brc-20.25](hirosystems/ordinals-api@v1.0.0-brc-20.24...v1.0.0-brc-20.25) (2023-09-11)

### Bug Fixes

* change tx_count to json number ([#216](hirosystems/ordinals-api#216)) ([20f9415](hirosystems/ordinals-api@20f9415))

* fix: ticker filter for balances (#217)

* chore(release): 1.0.0-brc-20.26 [skip ci]

## [1.0.0-brc-20.26](hirosystems/ordinals-api@v1.0.0-brc-20.25...v1.0.0-brc-20.26) (2023-09-11)

### Bug Fixes

* ticker filter for balances ([#217](hirosystems/ordinals-api#217)) ([1ca3bcd](hirosystems/ordinals-api@1ca3bcd))

* fix: return to sender balance calculation (#218)

* chore(release): 1.0.0-brc-20.27 [skip ci]

## [1.0.0-brc-20.27](hirosystems/ordinals-api@v1.0.0-brc-20.26...v1.0.0-brc-20.27) (2023-09-12)

### Bug Fixes

* return to sender balance calculation ([#218](hirosystems/ordinals-api#218)) ([226dfe6](hirosystems/ordinals-api@226dfe6))

---------

Co-authored-by: semantic-release-bot <[email protected]>
Co-authored-by: janniks <[email protected]>
Co-authored-by: janniks <[email protected]>
Co-authored-by: Dean Chi <[email protected]>
  • Loading branch information
5 people committed Sep 12, 2023
1 parent e04f8c3 commit 274b9f3
Show file tree
Hide file tree
Showing 50 changed files with 30,387 additions and 12,693 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- master
- develop
- beta
- brc-20
tags-ignore:
- '**'
paths-ignore:
Expand Down Expand Up @@ -118,7 +119,7 @@ jobs:
persist-credentials: false

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3.2.0
uses: cycjimmy/semantic-release-action@v3
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
Expand All @@ -128,9 +129,9 @@ jobs:
with:
semantic_version: 19
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
conventional-changelog-conventionalcommits
@semantic-release/changelog@6.0.3
@semantic-release/git@10.0.1
conventional-changelog-conventionalcommits@6.1.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
Expand Down
52 changes: 35 additions & 17 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -1,19 +1,37 @@
{
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits"
}
],
"@semantic-release/github",
"@semantic-release/changelog",
"@semantic-release/git"
]
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"master",
"next",
"next-major",
{
"name": "beta",
"prerelease": true
},
{
"name": "alpha",
"prerelease": true
},
{
"name": "brc-20",
"prerelease": true
}
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits"
}
],
"@semantic-release/github",
"@semantic-release/changelog",
"@semantic-release/git"
]
}
386 changes: 384 additions & 2 deletions CHANGELOG.md

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions migrations/1684174644336_brc20-deploys.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { MigrationBuilder, ColumnDefinitions } from 'node-pg-migrate';

export const shorthands: ColumnDefinitions | undefined = undefined;

export function up(pgm: MigrationBuilder): void {
pgm.createTable('brc20_deploys', {
id: {
type: 'bigserial',
primaryKey: true,
},
inscription_id: {
type: 'bigint',
notNull: true,
},
block_height: {
type: 'bigint',
notNull: true,
},
tx_id: {
type: 'text',
notNull: true,
},
address: {
type: 'text',
notNull: true,
},
ticker: {
type: 'text',
notNull: true,
},
max: {
type: 'numeric',
notNull: true,
},
limit: {
type: 'numeric',
},
decimals: {
type: 'int',
notNull: true,
},
});
pgm.createConstraint(
'brc20_deploys',
'brc20_deploys_inscription_id_fk',
'FOREIGN KEY(inscription_id) REFERENCES inscriptions(id) ON DELETE CASCADE'
);
pgm.createIndex('brc20_deploys', ['inscription_id']);
pgm.createIndex('brc20_deploys', 'LOWER(ticker)', { unique: true });
pgm.createIndex('brc20_deploys', ['block_height']);
pgm.createIndex('brc20_deploys', ['address']);
}
51 changes: 51 additions & 0 deletions migrations/1684175792528_brc20-mints.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { MigrationBuilder, ColumnDefinitions } from 'node-pg-migrate';

export const shorthands: ColumnDefinitions | undefined = undefined;

export function up(pgm: MigrationBuilder): void {
pgm.createTable('brc20_mints', {
id: {
type: 'bigserial',
primaryKey: true,
},
inscription_id: {
type: 'bigint',
notNull: true,
},
brc20_deploy_id: {
type: 'bigint',
notNull: true,
},
block_height: {
type: 'bigint',
notNull: true,
},
tx_id: {
type: 'text',
notNull: true,
},
address: {
type: 'text',
notNull: true,
},
amount: {
type: 'numeric',
notNull: true,
},
});
pgm.createConstraint(
'brc20_mints',
'brc20_mints_inscription_id_fk',
'FOREIGN KEY(inscription_id) REFERENCES inscriptions(id) ON DELETE CASCADE'
);
pgm.createConstraint(
'brc20_mints',
'brc20_mints_brc20_deploy_id_fk',
'FOREIGN KEY(brc20_deploy_id) REFERENCES brc20_deploys(id) ON DELETE CASCADE'
);
pgm.createIndex('brc20_mints', ['inscription_id']);
pgm.createIndex('brc20_mints', ['brc20_deploy_id']);
pgm.createIndex('brc20_mints', ['block_height']);
pgm.createIndex('brc20_mints', ['address']);
}
55 changes: 55 additions & 0 deletions migrations/1684175795592_brc20-transfers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { MigrationBuilder, ColumnDefinitions } from 'node-pg-migrate';

export const shorthands: ColumnDefinitions | undefined = undefined;

export function up(pgm: MigrationBuilder): void {
pgm.createTable('brc20_transfers', {
id: {
type: 'bigserial',
primaryKey: true,
},
inscription_id: {
type: 'bigint',
notNull: true,
},
brc20_deploy_id: {
type: 'bigint',
notNull: true,
},
block_height: {
type: 'bigint',
notNull: true,
},
tx_id: {
type: 'text',
notNull: true,
},
from_address: {
type: 'text',
notNull: true,
},
to_address: {
type: 'text',
},
amount: {
type: 'numeric',
notNull: true,
},
});
pgm.createConstraint(
'brc20_transfers',
'brc20_transfers_inscription_id_fk',
'FOREIGN KEY(inscription_id) REFERENCES inscriptions(id) ON DELETE CASCADE'
);
pgm.createConstraint(
'brc20_transfers',
'brc20_transfers_brc20_deploy_id_fk',
'FOREIGN KEY(brc20_deploy_id) REFERENCES brc20_deploys(id) ON DELETE CASCADE'
);
pgm.createIndex('brc20_transfers', ['inscription_id']);
pgm.createIndex('brc20_transfers', ['brc20_deploy_id']);
pgm.createIndex('brc20_transfers', ['block_height']);
pgm.createIndex('brc20_transfers', ['from_address']);
pgm.createIndex('brc20_transfers', ['to_address']);
}
63 changes: 63 additions & 0 deletions migrations/1684175810998_brc20-balances.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { MigrationBuilder, ColumnDefinitions } from 'node-pg-migrate';

export const shorthands: ColumnDefinitions | undefined = undefined;

export function up(pgm: MigrationBuilder): void {
pgm.createTable('brc20_balances', {
id: {
type: 'bigserial',
primaryKey: true,
},
inscription_id: {
type: 'bigint',
notNull: true,
},
location_id: {
type: 'bigint',
notNull: true,
},
brc20_deploy_id: {
type: 'bigint',
notNull: true,
},
address: {
type: 'text',
},
avail_balance: {
type: 'numeric',
notNull: true,
},
trans_balance: {
type: 'numeric',
notNull: true,
},
type: {
type: 'smallint',
notNull: true,
},
});
pgm.createConstraint(
'brc20_balances',
'brc20_balances_inscription_id_fk',
'FOREIGN KEY(inscription_id) REFERENCES inscriptions(id) ON DELETE CASCADE'
);
pgm.createConstraint(
'brc20_balances',
'brc20_balances_location_id_fk',
'FOREIGN KEY(location_id) REFERENCES locations(id) ON DELETE CASCADE'
);
pgm.createConstraint(
'brc20_balances',
'brc20_balances_brc20_deploy_id_fk',
'FOREIGN KEY(brc20_deploy_id) REFERENCES brc20_deploys(id) ON DELETE CASCADE'
);
pgm.createConstraint(
'brc20_balances',
'brc20_balances_inscription_id_type_unique',
'UNIQUE(inscription_id, type)'
);
pgm.createIndex('brc20_balances', ['location_id']);
pgm.createIndex('brc20_balances', ['brc20_deploy_id']);
pgm.createIndex('brc20_balances', ['address']);
}
60 changes: 60 additions & 0 deletions migrations/1684344022290_brc20-events.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { MigrationBuilder, ColumnDefinitions } from 'node-pg-migrate';

export const shorthands: ColumnDefinitions | undefined = undefined;

export function up(pgm: MigrationBuilder): void {
pgm.createTable('brc20_events', {
id: {
type: 'bigserial',
primaryKey: true,
},
inscription_id: {
type: 'bigint',
notNull: true,
},
brc20_deploy_id: {
type: 'bigint',
notNull: true,
},
deploy_id: {
type: 'bigint',
},
mint_id: {
type: 'bigint',
},
transfer_id: {
type: 'bigint',
},
});
pgm.createConstraint(
'brc20_events',
'brc20_events_inscription_id_fk',
'FOREIGN KEY(inscription_id) REFERENCES inscriptions(id) ON DELETE CASCADE'
);
pgm.createConstraint(
'brc20_events',
'brc20_events_brc20_deploy_id_fk',
'FOREIGN KEY(brc20_deploy_id) REFERENCES brc20_deploys(id) ON DELETE CASCADE'
);
pgm.createConstraint(
'brc20_events',
'brc20_events_deploy_id_fk',
'FOREIGN KEY(deploy_id) REFERENCES brc20_deploys(id) ON DELETE CASCADE'
);
pgm.createConstraint(
'brc20_events',
'brc20_events_mint_id_fk',
'FOREIGN KEY(mint_id) REFERENCES brc20_mints(id) ON DELETE CASCADE'
);
pgm.createConstraint(
'brc20_events',
'brc20_events_transfer_id_fk',
'FOREIGN KEY(transfer_id) REFERENCES brc20_transfers(id) ON DELETE CASCADE'
);
pgm.createConstraint(
'brc20_events',
'brc20_valid_event',
'CHECK(NUM_NONNULLS(deploy_id, mint_id, transfer_id) = 1)'
);
}
Loading

0 comments on commit 274b9f3

Please sign in to comment.