Skip to content

Commit

Permalink
Rebase to 0.9.2 (#5)
Browse files Browse the repository at this point in the history
* export `signFake` helper (AcalaNetwork#379)

* export sign fake

* Update packages/chopsticks/src/utils/signFake.ts

Co-authored-by: Xiliang Chen <[email protected]>

* fix

* fix lint

---------

Co-authored-by: Xiliang Chen <[email protected]>

* Bump axios from 1.4.0 to 1.5.0 (AcalaNetwork#380)

Bumps [axios](https://github.com/axios/axios) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](axios/axios@v1.4.0...v1.5.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @types/node from 20.5.1 to 20.5.7 (AcalaNetwork#381)

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.5.1 to 20.5.7.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump unplugin-swc from 1.3.2 to 1.4.2 (AcalaNetwork#382)

Bumps [unplugin-swc](https://github.com/hannoeru/unplugin-swc) from 1.3.2 to 1.4.2.
- [Release notes](https://github.com/hannoeru/unplugin-swc/releases)
- [Commits](unplugin/unplugin-swc@v1.3.2...v1.4.2)

---
updated-dependencies:
- dependency-name: unplugin-swc
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @typescript-eslint/eslint-plugin from 6.4.0 to 6.5.0 (AcalaNetwork#383)

Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 6.4.0 to 6.5.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.5.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump eslint from 8.47.0 to 8.48.0 (AcalaNetwork#384)

Bumps [eslint](https://github.com/eslint/eslint) from 8.47.0 to 8.48.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](eslint/eslint@v8.47.0...v8.48.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* add unsafeBlockHeight (AcalaNetwork#387)

* add unsageBlockHeight

* add unsafeBlockHeight in test

* Update packages/core/src/blockchain/block-builder.ts

Co-authored-by: Xiliang Chen <[email protected]>

* fix unsafeBlockHeight test

---------

Co-authored-by: Xiliang Chen <[email protected]>

* bump

* add unsafeBlockHeight to dev.newBlock

* fix

* fix

* allow dev rpc set runtime log level (AcalaNetwork#390)

* fix runtime log level setting

* Revert "fix runtime log level setting"

This reverts commit 5fe97fc.

* dev rpc runtime log level

* fix log level validation and refactor log

* fix header.toJSON is not a function (AcalaNetwork#393)

* fix header.toJSON undefined

* fix BlockEntity Header type

* release 0.8.0 (AcalaNetwork#394)

* feat: load blocks from db (AcalaNetwork#392)

* feat: load blocks from db

* fix load blocks

* fix: make tests independent

* fix: override storage after load blocks

* fix: storage

* fix: load latest block only

* feat: resume using block number hash

* fix polkadot js got unknown error (AcalaNetwork#396)

* fix error.toJSON undefined

* fix: pass error to polkadot

* add a test for reject unsigned extrinsic

* Deploy web test to github pages (AcalaNetwork#397)

* deploy web-test to pages

* fix: workflow syntax

* fix: workflow syntax

* fix: rename

* fix: action

* fix

* fix

* fix for upstream

* child storage support (AcalaNetwork#391)

* child storage support

* merge child with key

* cleanup

* Update karura.yml (AcalaNetwork#400)

* bump 0.8.1 (AcalaNetwork#401)

* fix web test build (AcalaNetwork#402)

* fix typeorm vite bundle using a patch

* remove comments

* fix patch

* Set up docs (AcalaNetwork#403)

* deploy web-test to pages

* fix: workflow syntax

* fix: workflow syntax

* fix: rename

* fix: action

* fix

* fix

* fix for upstream

* setup doc generation

* test deploy in pr

* remove pr trigger

* fix lint

* fix deploy docs (AcalaNetwork#404)

* fix route

* trigger

* remove pr deploy trigger

* Add types and doc for `new-block` (AcalaNetwork#406)

* refactor api-extractor config

* fix docs home page

* fix

* test tsdoc for new-block

* use typedoc

* fix new-block comments

* test deploy

* remove pr deploy trigger

* add more rpc docs (AcalaNetwork#408)

* refactor api-extractor config

* fix docs home page

* fix

* test tsdoc for new-block

* use typedoc

* fix new-block comments

* test deploy

* remove pr deploy trigger

* add more rpc types

* add more docs

* export types

* add rpc types and docs (AcalaNetwork#409)

* add rpc types and docs

* refactor and add types

* Update Tinkernet RPC (AcalaNetwork#411)

* camelCase TX event names (AcalaNetwork#412)

* add core package docs (AcalaNetwork#410)

* add blockchain docs

* add docs for blockchain and block class

* add docs for storage

* add api class doc

* remove obvious comments

* remove obvious comments

* add test for resume with xcm options (AcalaNetwork#413)

* Bump get-func-name from 2.0.0 to 2.0.2 (AcalaNetwork#416)

Bumps [get-func-name](https://github.com/chaijs/get-func-name) from 2.0.0 to 2.0.2.
- [Release notes](https://github.com/chaijs/get-func-name/releases)
- [Commits](https://github.com/chaijs/get-func-name/commits/v2.0.2)

---
updated-dependencies:
- dependency-name: get-func-name
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* improve web test (AcalaNetwork#415)

* improve web test

* fix ci

* fix web-test tests

* fix lint

* update readme (AcalaNetwork#418)

* fix link in readme (AcalaNetwork#419)

* Bump axios from 1.5.0 to 1.5.1 (AcalaNetwork#423)

Bumps [axios](https://github.com/axios/axios) from 1.5.0 to 1.5.1.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](axios/axios@v1.5.0...v1.5.1)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ws and @types/ws (AcalaNetwork#420)

Bumps [ws](https://github.com/websockets/ws) and [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws). These dependencies needed to be updated together.

Updates `ws` from 8.13.0 to 8.14.2
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](websockets/ws@8.13.0...8.14.2)

Updates `@types/ws` from 8.5.5 to 8.5.6
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: "@types/ws"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump vitest from 0.34.2 to 0.34.6 (AcalaNetwork#421)

Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 0.34.2 to 0.34.6.
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Commits](https://github.com/vitest-dev/vitest/commits/v0.34.6/packages/vitest)

---
updated-dependencies:
- dependency-name: vitest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @types/lodash from 4.14.197 to 4.14.199 (AcalaNetwork#422)

Bumps [@types/lodash](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/lodash) from 4.14.197 to 4.14.199.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/lodash)

---
updated-dependencies:
- dependency-name: "@types/lodash"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @mui/material from 5.14.10 to 5.14.11 (AcalaNetwork#424)

Bumps [@mui/material](https://github.com/mui/material-ui/tree/HEAD/packages/mui-material) from 5.14.10 to 5.14.11.
- [Release notes](https://github.com/mui/material-ui/releases)
- [Changelog](https://github.com/mui/material-ui/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mui/material-ui/commits/v5.14.11/packages/mui-material)

---
updated-dependencies:
- dependency-name: "@mui/material"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump postcss from 8.4.28 to 8.4.31 (AcalaNetwork#425)

Bumps [postcss](https://github.com/postcss/postcss) from 8.4.28 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](postcss/postcss@8.4.28...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix yarn.lock

* Bump zod from 3.22.2 to 3.22.3 (AcalaNetwork#427)

Bumps [zod](https://github.com/colinhacks/zod) from 3.22.2 to 3.22.3.
- [Release notes](https://github.com/colinhacks/zod/releases)
- [Changelog](https://github.com/colinhacks/zod/blob/master/CHANGELOG.md)
- [Commits](colinhacks/zod@v3.22.2...v3.22.3)

---
updated-dependencies:
- dependency-name: zod
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* 0.8.2 (AcalaNetwork#428)

* refactor block builder (AcalaNetwork#429)

* fix browser undefined (AcalaNetwork#430)

* fix browser undefined

* fix test

* fix test

* fix

* update web-test (AcalaNetwork#433)

* update smoldot and fix empty next key (AcalaNetwork#438)

* update smoldot and fix empty next key

* fix trie empty next key

* lint

* update test

* bump 0.8.3 (AcalaNetwork#439)

* update sidecar (AcalaNetwork#440)

* fix getBlockHash & add chain_getHead alias (AcalaNetwork#441)

* add chain_getHead alias

* support multiple hash fetch

* handle null

* fix author rpc (AcalaNetwork#442)

* fix undefined params (AcalaNetwork#443)

* Chopsticks provider (AcalaNetwork#432)

* add chopsticks provider

* refactor substrate rpc handlers into core

* add e2e tests

* add e2e test

* put chain setup in worker

* manual testing

* remove snapshot

* fix tx subscribe

* add playwright tests

* fix vite build

* try fix playwright tests

* fix subscribe

* fix test

* remote coment

* fix log level

* fix indent

* fix logger

* fix lint

* improve resume (AcalaNetwork#448)

* disable chopsticks provider (AcalaNetwork#450)

* use worker for wasm-executor (AcalaNetwork#445)

* use worker for wasm-executor

* fix path

* fix buffer

* worker terminate

* run crowdloan.test only on CI

* fix unsafe block height error (AcalaNetwork#447)

* fix unsafe block height error

* add regression test

* fix child trie (AcalaNetwork#449)

* fix child trie

* update snapshot

* add test

* update sidecar script (AcalaNetwork#454)

* 0.8.4

* support batch request (AcalaNetwork#453)

* support batch request

* batch response

* add tests

* use promise.all

* Update packages/chopsticks/src/server.ts

Co-authored-by: Ermal Kaleci <[email protected]>

* fix ws client

---------

Co-authored-by: Ermal Kaleci <[email protected]>

* add chopsticks provider (AcalaNetwork#456)

* update release action (AcalaNetwork#458)

* make db its own package (AcalaNetwork#460)

* make db its own package

* bump (AcalaNetwork#461)

* update genesis provider (AcalaNetwork#462)

* fix docs (AcalaNetwork#463)

* update deps (AcalaNetwork#464)

* reduce default maxMemoryBlockCount (AcalaNetwork#465)

* fix types (AcalaNetwork#466)

* fix types and deps

* fix

* add retry (AcalaNetwork#467)

* improve references (AcalaNetwork#468)

* improve references

* fix lint

* retry on sqlite initialise (AcalaNetwork#469)

* fix cli option (AcalaNetwork#470)

* fix cli option

* fix resume option

* fix boolean

* apply after validation (AcalaNetwork#471)

* enable sqlite wal (AcalaNetwork#472)

* enable sqlite wal

* sqlite PRAGMA busy_timeout

* update sidecar

* Update .github/workflows/ci.yml

Co-authored-by: Xiliang Chen <[email protected]>

---------

Co-authored-by: Xiliang Chen <[email protected]>

* fix deleted key (AcalaNetwork#478)

* fix deleted key

* Increase timeout

* use Map for better performance

* enable threads

* Bump browserify-sign from 4.2.1 to 4.2.2 (AcalaNetwork#479)

Bumps [browserify-sign](https://github.com/crypto-browserify/browserify-sign) from 4.2.1 to 4.2.2.
- [Changelog](https://github.com/browserify/browserify-sign/blob/main/CHANGELOG.md)
- [Commits](browserify/browserify-sign@v4.2.1...v4.2.2)

---
updated-dependencies:
- dependency-name: browserify-sign
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix test (AcalaNetwork#482)

* support http endpoint (AcalaNetwork#480)

* run block rpc (AcalaNetwork#476)

* run block rpc

* include logs

* improve

* no need to set head

* to u8a

* fix

* fix

* 0.8.5-2

* export plugins (AcalaNetwork#483)

* 0.8.5-3

* use indexedDB instead of sqljs (AcalaNetwork#477)

* add idb for browser

* add test

* fix test

* remove extra package

* remove package

* remove localforage

* using cursor

* add more tests

* fix test

* fix tests

* fix lint

* fix keyValue key

* fix

* reduce key value storage size

* small fix

* undo comment

---------

Co-authored-by: Ermal Kaleci <[email protected]>

* fix deps (AcalaNetwork#484)

* bump (AcalaNetwork#485)

* improve worker (AcalaNetwork#488)

* 0.8.5-5

* enable api cache (AcalaNetwork#486)

* dual publish (AcalaNetwork#489)

* build esm cjs package

* update chopsticks.js

* update tsconfig and fix path

* fix docs

* fix yarn pack

* no need to remove .buildinfo now that they're created inside dist

---------

Co-authored-by: Ermal Kaleci <[email protected]>

* bump (AcalaNetwork#490)

* fix RPC getBlock number (AcalaNetwork#491)

* teardown chains (AcalaNetwork#492)

* update run block result format (AcalaNetwork#495)

* update the format so it is easier to use

* remove console.log

* 0.9.0 (AcalaNetwork#496)

* Bump pino from 8.15.0 to 8.16.1 (AcalaNetwork#499)

Bumps [pino](https://github.com/pinojs/pino) from 8.15.0 to 8.16.1.
- [Release notes](https://github.com/pinojs/pino/releases)
- [Commits](pinojs/pino@v8.15.0...v8.16.1)

---
updated-dependencies:
- dependency-name: pino
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @types/yargs from 17.0.24 to 17.0.29 (AcalaNetwork#500)

Bumps [@types/yargs](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/yargs) from 17.0.24 to 17.0.29.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/yargs)

---
updated-dependencies:
- dependency-name: "@types/yargs"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump axios from 1.5.1 to 1.6.0 (AcalaNetwork#501)

Bumps [axios](https://github.com/axios/axios) from 1.5.1 to 1.6.0.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](axios/axios@v1.5.1...v1.6.0)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @swc/core from 1.3.78 to 1.3.95 (AcalaNetwork#503)

Bumps [@swc/core](https://github.com/swc-project/swc) from 1.3.78 to 1.3.95.
- [Release notes](https://github.com/swc-project/swc/releases)
- [Changelog](https://github.com/swc-project/swc/blob/main/CHANGELOG.md)
- [Commits](swc-project/swc@v1.3.78...v1.3.95)

---
updated-dependencies:
- dependency-name: "@swc/core"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: order of wasm and storage overrides (AcalaNetwork#505)

* improve decoder (AcalaNetwork#504)

* improve decoder

* update

* support runtime log level (AcalaNetwork#508)

* support runtime log level

* fix path

* update submodule

* update Cargo.lock

* support well known keys (AcalaNetwork#507)

* support well known keys

* no need to toString

* fix decode

* code is handled

* fix

* fmt

* Update packages/chopsticks/src/plugins/run-block/index.ts

Co-authored-by: Qiwei Yang <[email protected]>

---------

Co-authored-by: Qiwei Yang <[email protected]>

* update submodule

* 0.9.1-1

* Fix path and update smoldot (AcalaNetwork#509)

* update smoldot

* fix template path

* follow mode (AcalaNetwork#498)

* basic follow mode

* wip: subscribeNewHeads

* update

* remove output and html

* reuse parent

* fix esm (AcalaNetwork#511)

* fix esm

* bump

* fix

* add bridge hub

* polkadot bridge hub

* use swc for build (AcalaNetwork#517)

* use swc for build

* fix sidecar

* bump

* exclude web-test from build (AcalaNetwork#518)

* ensure decode key and values are json (AcalaNetwork#519)

* ensure everything are JSON

* fmt

* fix

* chore: fix typos (AcalaNetwork#521)

* Node next (AcalaNetwork#522)

* switch moduleResolver nodenext

* fix type

* bump

* fix plugins (AcalaNetwork#523)

* action timeout (AcalaNetwork#524)

* action timeout

* exit on fail test

* update deps

* update wellknown key (AcalaNetwork#525)

* release 0.9.1 (AcalaNetwork#526)

* improve runtime logging (AcalaNetwork#529)

* improve runtime logging

* use log::info instead

* lint

* fix level

* Fix validation data mock (AcalaNetwork#531)

* fix mock validation data for new upgrade

* bump

* fix version (AcalaNetwork#532)

* update config

* no init warn (AcalaNetwork#535)

* improve load rpc plugin (AcalaNetwork#514)

* improve load plugin

* restore

* add load rpc plugin

* fix

* add cli plugin lazy load

* fix

* fix DISABLE_PLUGINS

* refactor

* update

* dev container

* keep extend plugin

* fix lint

* update read rpc methods

* revert executor build

* fix lint

* add rpc plugin schema check (AcalaNetwork#528)

* fix hrmp (AcalaNetwork#537)

* fix hrmp

* bump

* ignore api warnings (AcalaNetwork#538)

* ws reconnect (AcalaNetwork#539)

* max cache for decoder (AcalaNetwork#530)

* max cache for decoder

* change cache size

* add utils package (AcalaNetwork#536)

* add utils package

* fix export

* registry cache (AcalaNetwork#540)

* registry cache

* fix

* executor dual pkg (AcalaNetwork#541)

* bun missing URL.createObjectURL workaround for wasm init (AcalaNetwork#543)

* update wasm init (AcalaNetwork#544)

* update readme (AcalaNetwork#545)

* add missing deps (AcalaNetwork#546)

* feat: add centrifuge config (AcalaNetwork#549)

* release 0.9.2 (AcalaNetwork#548)

* fix

* lint

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Shunji Zhan <[email protected]>
Co-authored-by: Xiliang Chen <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Qiwei Yang <[email protected]>
Co-authored-by: Ermal Kaleci <[email protected]>
Co-authored-by: Gabriel Facco de Arruda <[email protected]>
Co-authored-by: James Wilson <[email protected]>
Co-authored-by: William Freudenberger <[email protected]>
Co-authored-by: vuittont60 <[email protected]>
  • Loading branch information
10 people authored Nov 20, 2023
1 parent 12036f8 commit 6af6bcf
Show file tree
Hide file tree
Showing 217 changed files with 27,967 additions and 3,726 deletions.
13 changes: 13 additions & 0 deletions .cjsswcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"exclude": [".*\\.test.ts$"],
"jsc": {
"parser": {
"syntax": "typescript"
},
"target": "es2021"
},
"module": {
"type": "commonjs"
}
}
3 changes: 3 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"postCreateCommand": "git submodule update --init"
}
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ lib/
dist/
packages/core/scripts/
chopsticks.js
packages/core/src/wasm-executor/browser-wasm-executor.js
packages/core/src/wasm-executor/node-wasm-executor.js
packages/web-test/playwright-report
33 changes: 33 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "import", "sort-imports-es6-autofix"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"plugin:import/recommended",
"plugin:import/typescript"
],
"rules": {
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"sort-imports-es6-autofix/sort-imports-es6": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
]
},
"settings": {
"import/resolver": {
"typescript": {
"project": "tsconfig.json"
}
}
}
}
33 changes: 0 additions & 33 deletions .eslintrc.js

This file was deleted.

13 changes: 13 additions & 0 deletions .esmswcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"exclude": [".*\\.test.ts$"],
"jsc": {
"parser": {
"syntax": "typescript"
},
"target": "esnext"
},
"module": {
"type": "es6"
}
}
65 changes: 65 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Deploy

on:
push:
branches: [ master ]

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
contents: read
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
executor/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install toolchain
uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly-2022-10-30
components: rustfmt
target: wasm32-unknown-unknown
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'yarn'
- name: Build packages
run: |
yarn --immutable
yarn check
yarn build:web-test
- name: Generate Docs
run: |
yarn docs:build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './dist'

deploy:
needs: setup
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,19 @@ dist
*.sqlite
*.sqlite-journal
*.wasm
*.db
*.sqlite-shm
*.sqlite-wal

.DS_store

preview/

lib
.parcel-cache

# docs src output folder
docs-src

# vitepress cache
.vitepress/cache
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ vendor/
.pnp.loader.mjs
lib/
preview/
tsconfig.json
34 changes: 34 additions & 0 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { defineConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: 'Chopsticks Docs',
description: 'Chopsticks Types Documentation',
base: '/chopsticks/docs/',
srcDir: 'docs-src',
outDir: 'dist/docs',
lastUpdated: true,
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: [{ text: 'Home', link: '/' }],
sidebar: [
{
text: 'Packages',
items: [
{ text: 'Chopsticks', link: '/chopsticks/README.html' },
{ text: 'Core', link: '/core/README.html' },
],
},
],
search: {
provider: 'local',
},
socialLinks: [{ icon: 'github', link: 'https://github.com/AcalaNetwork/chopsticks' }],
outline: 3,
},
markdown: {
anchor: {
slugify: (s) => encodeURIComponent(String(s).trim().replace(/\s+/g, '-')).toLocaleLowerCase(),
},
},
})
55 changes: 55 additions & 0 deletions .yarn/patches/@polkadot-rpc-provider-npm-10.10.1-c60ba50fe2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
diff --git a/http/index.js b/http/index.js
index 63d7d0439956851f8794e10defbbd944fdae2766..13a08f7451bcb5838b19a64d47182a1dd8a7a813 100644
--- a/http/index.js
+++ b/http/index.js
@@ -1,4 +1,4 @@
-import { logger, noop } from '@polkadot/util';
+import { logger, noop, stringify } from '@polkadot/util';
import { fetch } from '@polkadot/x-fetch';
import { RpcCoder } from '../coder/index.js';
import defaults from '../defaults.js';
@@ -99,13 +99,14 @@ export class HttpProvider {
async send(method, params, isCacheable) {
this.__internal__stats.total.requests++;
const [, body] = this.__internal__coder.encodeJson(method, params);
+ const cacheKey = isCacheable ? `${method}::${stringify(params)}` : '';
let resultPromise = isCacheable
- ? this.__internal__callCache.get(body)
+ ? this.__internal__callCache.get(cacheKey)
: null;
if (!resultPromise) {
resultPromise = this.__internal__send(body);
if (isCacheable) {
- this.__internal__callCache.set(body, resultPromise);
+ this.__internal__callCache.set(cacheKey, resultPromise);
}
}
else {
diff --git a/ws/index.js b/ws/index.js
index 879299b5d960a9bce6572a0e585ede29935db2a7..9ea7f184dd0c65dfe37585dd811120838ca580b9 100644
--- a/ws/index.js
+++ b/ws/index.js
@@ -1,5 +1,5 @@
import { EventEmitter } from 'eventemitter3';
-import { isChildClass, isNull, isUndefined, logger, noop, objectSpread } from '@polkadot/util';
+import { isChildClass, isNull, isUndefined, logger, noop, objectSpread, stringify } from '@polkadot/util';
import { xglobal } from '@polkadot/x-global';
import { WebSocket } from '@polkadot/x-ws';
import { RpcCoder } from '../coder/index.js';
@@ -395,13 +395,14 @@ export class WsProvider {
this.__internal__endpointStats.requests++;
this.__internal__stats.total.requests++;
const [id, body] = this.__internal__coder.encodeJson(method, params);
+ const cacheKey = isCacheable ? `${method}::${stringify(params)}` : '';
let resultPromise = isCacheable
- ? this.__internal__callCache.get(body)
+ ? this.__internal__callCache.get(cacheKey)
: null;
if (!resultPromise) {
resultPromise = this.__internal__send(id, body, method, params, subscription);
if (isCacheable) {
- this.__internal__callCache.set(body, resultPromise);
+ this.__internal__callCache.set(cacheKey, resultPromise);
}
}
else {
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ Run node using config file
npx @acala-network/chopsticks@latest -c acala
```

## Web testing

Run Chopsticks in browser? Now you can turn a mainnet into a devnet and play with it directly in your browser!

An example is available at [acalanetwork.github.io/chopsticks](https://acalanetwork.github.io/chopsticks/), and the corresponding code can be found in [web-test](packages/web-test).

## Environment Variables

- `PORT`: Set port for Chopsticks to listen on, default is `8000`
Expand Down Expand Up @@ -125,6 +131,14 @@ npx @acala-network/chopsticks@latest dry-run --config=configs/mandala.yml --prei
}
]
]
},
"Whitelist": {
"WhitelistedCall": [
[
["0x3146d2141cdb95de80488d6cecbb5d7577dd59069efc366cb1be7fe64f02e62c"],
"0x" // please use 0x for null values
],
]
}
}
```
Expand All @@ -150,4 +164,13 @@ To learn more, see https://www.npmjs.com/package/global-agent?activeTab=readme

External documentation on Chopsticks can be found at the following links:

- [Chopsticks types documentation](https://acalanetwork.github.io/chopsticks/docs)
- [Moonbeam documentation site](https://docs.moonbeam.network/builders/build/substrate-api/chopsticks/)

## Plugins

Chopsticks is designed to be extensible. You can write your own plugin to extend Chopsticks' functionality.

There are 2 types of plugins: `cli` and `rpc`. `cli` plugins are used to extend Chopsticks' CLI, while `rpc` plugins are used to extend Chopsticks' RPC.

To create a new plugin, you could check out the [run-block plugin](packages/chopsticks/src/plugins/run-block/) as an example.
50 changes: 50 additions & 0 deletions configs/centrifuge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
endpoint: wss://centrifuge-parachain.api.onfinality.io/public-ws/
mock-signature-host: true
block: ${env.CENTRIFUGE_BLOCK_NUMBER}
db: ./db.sqlite
# wasm-override: centrifuge-1023.wasm

import-storage:
# Sudo:
# Key: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY # Alice
System:
Account:
-
-
- "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
- providers: 1
data:
free: "1000000000000000000000000"
Council:
Members: [5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY]
Elections:
Members:
- who: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
stake: "10000000000000000000000"
deposit: "10000000000000000000000"
OrmlTokens:
Accounts:
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- ForeignAsset: 6
- free: 1000000000000
-
-
- 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- ForeignAsset: 4
- free: "1000000000000000000000"
Proxy:
Proxies:
-
-
- 4dTeMxuPJCK7zQGhFcgCivSJqBs9Wo2SuMSQeYCCuVJ9xrE2
-
-
- delegate: "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
- proxyType: "Any"
- delay: 0
- "350000000000000000"



2 changes: 1 addition & 1 deletion configs/dancebox.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
endpoint: wss://vira-stagenet-dancebox-rpc.a.moondev.network
endpoint: wss://fraa-dancebox-rpc.a.dancebox.tanssi.network
mock-signature-host: true

import-storage:
Expand Down
2 changes: 1 addition & 1 deletion configs/karura.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
endpoint: wss://karura-rpc.dwellir.com
endpoint: wss://karura-rpc.aca-api.network
mock-signature-host: true
block: ${env.KARURA_BLOCK_NUMBER}
db: ./db.sqlite
Expand Down
Loading

0 comments on commit 6af6bcf

Please sign in to comment.