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

Add Viem v2 & Wagmi v2 packages, and remove Ethers dependency #303

Merged
merged 60 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
c9c4bd9
integrations/wagmi: initial re-work of wagmi support
CedarMist Mar 22, 2024
c470424
updated pnpm-lock.yaml
CedarMist Mar 22, 2024
8e21441
wagmi: added docs & minor cleanup
CedarMist Mar 23, 2024
d6cdfa0
Try global 'fetch' function if not defined in globalThis
CedarMist Mar 23, 2024
14322f5
clients/js: removed --no-experimental-fetch from CI tests
CedarMist Mar 23, 2024
1b95fa6
clients/js: updated docs & changelog
CedarMist Mar 23, 2024
76fbe1d
clients/js: formatting
CedarMist Mar 23, 2024
fc6025a
examples/wagmi: added visualizer to output
CedarMist Mar 23, 2024
f9cbbe6
Add sapphire testnet to wagmi example
CedarMist Mar 26, 2024
1ff9770
examples: formatting of wagmi example
CedarMist Mar 29, 2024
8af7153
wagmi: renamed Wagmi related packages `-v2` + addressed PR comments
CedarMist Apr 2, 2024
ed8bf3d
integrations/wagmi-v2: biome linting config
CedarMist Apr 2, 2024
0e3c5d7
wagmi: removed wagmi from docs, it has its own section in integration…
CedarMist Apr 2, 2024
438a06e
wagmi: formatting
CedarMist Apr 2, 2024
fe12094
wagmi: removed wagmi from docs
CedarMist Apr 2, 2024
3133936
wagmi/viem: added hardhat-viem example and fixed TX serializer
CedarMist Apr 4, 2024
8f3a40f
ci: added wagmi & viem to CI + fixed lint errors
CedarMist Apr 4, 2024
45161a1
ci: fixes
CedarMist Apr 4, 2024
5de1632
clients/js: fixed formatting
CedarMist Apr 4, 2024
35a18a8
viem: CI test to verify encryption
CedarMist Apr 4, 2024
d24655e
viem: moved viem tests further up CI
CedarMist Apr 4, 2024
fe907f8
wagmi: lint + CI step reorg
CedarMist Apr 5, 2024
211e3f1
viem: fixed proxy tests
CedarMist Apr 5, 2024
d679661
wagmi & viem: updated dependencies so peer types work correctly with …
CedarMist Apr 5, 2024
bd3fadb
wagmi: reorder tests + lint for CI
CedarMist Apr 5, 2024
947aabe
wagmi: build supports alpha release now
CedarMist Apr 6, 2024
9eefbf4
feedback from PR #292
CedarMist Apr 8, 2024
6761692
refactor
CedarMist Apr 24, 2024
0c808c9
formatting & CI fix
CedarMist Apr 24, 2024
7bfd263
formatting
CedarMist Apr 24, 2024
c17ea14
moved JS tests into contracts-test
CedarMist Apr 24, 2024
0b38f83
ubmp contracts-test
CedarMist Apr 24, 2024
4d45473
fixed contracts-test CI
CedarMist Apr 24, 2024
09a6c28
refactor: fix CI for proxy with JS client test
CedarMist Apr 24, 2024
74b3d58
refactor: fixed provider test
CedarMist Apr 24, 2024
945a06d
formatting
CedarMist Apr 24, 2024
1762fbe
fixed hardhat-ignition
CedarMist Apr 25, 2024
7781928
formatting
CedarMist Apr 25, 2024
bcbb362
no tests for examples/wagmi-v2 - so don't error out
CedarMist Apr 25, 2024
16cda1e
minor fix around BytesLike in cipher.ts for hardhat-ignition compat.
CedarMist Apr 25, 2024
a003b03
removed graph integration & updated makefiles for examples & integrat…
CedarMist Apr 25, 2024
a55bf5e
many minor fixes + Makefile improvements
CedarMist Apr 27, 2024
0baa41e
formatting
CedarMist Apr 27, 2024
78e4695
formatting
CedarMist Apr 27, 2024
c3ac253
fixed hardhat-boilerplate build
CedarMist Apr 27, 2024
5d694f4
hardhat-boilerplay: deploy to build frontend
CedarMist Apr 27, 2024
89c3921
remove tweetnacl dependency
CedarMist Apr 27, 2024
a1a9525
clients/js: add tweetnacl back in as a dev dependency for tests
CedarMist Apr 27, 2024
34b7a87
fixed munacl
CedarMist Apr 27, 2024
7d9ceac
added munacl tests
CedarMist Apr 28, 2024
5ab37fc
integrations/ethers-v6: updated README
CedarMist Apr 30, 2024
81a9f57
added wagmi-v1 example + viem test
CedarMist Jun 11, 2024
290b8ff
lint + readme fix
CedarMist Jun 17, 2024
6acdc75
fix lint
CedarMist Jun 17, 2024
38f4c68
minor comment nit in js cipher.ts
CedarMist Jun 18, 2024
1415bb4
feedback from xi
CedarMist Jun 27, 2024
c1c060c
fixed lint in client/js
CedarMist Jun 27, 2024
ec748e2
Fix type
aefhm Jul 29, 2024
2a77f25
Fix GitHub CI step
aefhm Jul 30, 2024
d956ad7
Add separate JS client unit test
aefhm Jul 30, 2024
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
39 changes: 0 additions & 39 deletions .github/workflows/ci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,42 +123,3 @@ jobs:
working-directory: ./clients/go
# Always run this step so that all linting errors can be seen at once.
if: always()

type-test-client-js:
name: type-test-client-js
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"

- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm --filter '@oasisprotocol/sapphire-paratime*' install

- name: Test type-only-test
run: pnpm test
working-directory: ./clients/js/type-only-test
165 changes: 2 additions & 163 deletions .github/workflows/ci-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,101 +81,11 @@ jobs:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm --filter @oasisprotocol/sapphire-paratime install

- name: Build JS client
run: pnpm build

- name: Build typedoc
run: pnpm typedoc

- name: Upload client-js build
uses: actions/upload-artifact@v4
with:
name: client-js
retention-days: 1
if-no-files-found: error
path: |
clients/js/lib
run: pnpm install

- name: Test JS client
env:
NODE_OPTIONS: "--no-experimental-fetch" # https://github.com/nock/nock/issues/2397
run: pnpm test

test-integration-hardhat:
name: test-integration-hardhat
runs-on: ubuntu-latest
needs: [test-client-js]
defaults:
run:
working-directory: ./integrations/hardhat
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Download client-js build
uses: actions/download-artifact@v4
with:
name: client-js
path: clients/js/lib

- name: Install dependencies
run: |
pnpm install

- name: Build Integration Hardhat
run: pnpm build

- name: Upload integration-hardhat build
uses: actions/upload-artifact@v4
with:
name: integration-hardhat
retention-days: 1
if-no-files-found: error
path: |
integrations/hardhat/dist
run: pnpm test:unit

test-client-go:
name: test-client-go
Expand All @@ -193,74 +103,3 @@ jobs:

- name: Test
run: go test -v ./...

test-examples:
name: test-examples
runs-on: ubuntu-latest
needs: [test-client-js, test-integration-hardhat]
strategy:
matrix:
example: [hardhat, hardhat-boilerplate, onchain-signer]
defaults:
run:
working-directory: examples/${{ matrix.example }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Download client-js build
uses: actions/download-artifact@v4
with:
name: client-js
path: clients/js/lib

- name: Download integration-hardhat build
uses: actions/download-artifact@v4
with:
name: integration-hardhat
path: integrations/hardhat/dist

- name: Install dependencies
run: |
pnpm install

- name: Build
run: |
! grep -q '"build":' package.json || pnpm run build

- name: Test
run: |
! grep -q '"test":' package.json || pnpm test

- name: Test Frontend
if: matrix.example == 'hardhat-boilerplate'
run: |
npx hardhat run scripts/deploy.js
cd frontend
pnpm build
50 changes: 25 additions & 25 deletions .github/workflows/contracts-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
--rm
--health-cmd="/oasis-node debug control wait-ready -a unix:/serverdir/node/net-runner/network/client-0/internal.sock"
--health-start-period=90s
env:
SAPPHIRE_LOCALNET_HTTP_PROXY_PORT: 3001
CedarMist marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -54,35 +56,33 @@ jobs:
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Build
run: make -C clients/js build
- uses: JarvusInnovations/background-action@v1
name: RPC proxy will error if non-encrypted calls are made
with:
run: pnpm run proxy &
wait-on: http://127.0.0.1:${{ env.SAPPHIRE_LOCALNET_HTTP_PROXY_PORT }}
tail: true
log-output-resume: true
wait-for: 31sec
log-output: true
log-output-if: true
working-directory: clients/js
- name: Test JS client
run: make -C clients/js test lint
- name: Build & Test integrations
run: make -C integrations
- name: Build & Test Examples
run: make -C examples
- name: Build & Test sapphire-contracts package
run: make -C contracts
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Install forge doc deps
run: cargo install mdbook-pagetoc
- name: Install dependencies
run: pnpm install
- name: Build JS client
working-directory: clients/js
run: pnpm build
- name: Build hardhat integration
working-directory: integrations/hardhat
run: pnpm build
- name: Test contracts with Hardhat
working-directory: contracts
run: pnpm hardhat test --network sapphire-localnet-ci
- name: Build docs
working-directory: contracts
run: pnpm doc
- name: hardhat test examples/hardhat
working-directory: examples/hardhat
run: pnpm hardhat run --network sapphire-localnet scripts/run-vigil.ts
env:
PRIVATE_KEY: '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'
- name: hardhat test examples/onchain-signer
working-directory: examples/onchain-signer
run: pnpm run test --network sapphire-localnet
- name: ethersv5-ts-esm
working-directory: examples/ethersv5-ts-esm
run: pnpm run test
- name: ethersv6-ts-esm
working-directory: examples/ethersv6-ts-esm
run: pnpm run test
26 changes: 22 additions & 4 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ name: publish
on:
push:
tags:
- clients/js/v[0-9].[0-9]+.[0-9]+
- contracts/v[0-9].[0-9]+.[0-9]+
- integrations/hardhat/v[0-9].[0-9]+.[0-9]+
- clients/js/v[0-9]\.[0-9]+\.[0-9]+(-(alpha|beta|rc)(\.[0-9]+)?)?
- contracts/v[0-9]\.[0-9]+\.[0-9]+(-(alpha|beta|rc)(\.[0-9]+)?)?
- integrations/ethers-v6/v[0-9]\.[0-9]+\.[0-9]+(-(alpha|beta|rc)(\.[0-9]+)?)?
- integrations/hardhat/v[0-9]\.[0-9]+\.[0-9]+(-(alpha|beta|rc)(\.[0-9]+)?)?
- integrations/viem-v2/v[0-9]\.[0-9]+\.[0-9]+(-(alpha|beta|rc)(\.[0-9]+)?)?
- integrations/wagmi-v2/v[0-9]\.[0-9]+\.[0-9]+(-(alpha|beta|rc)(\.[0-9]+)?)?

jobs:
publish:
Expand All @@ -21,10 +24,25 @@ jobs:
with:
version: 8
run_install: true
- name: Build JS client
working-directory: clients/js
run: pnpm build
- name: Build ethers-v6 integration
working-directory: integrations/ethers-v6
run: pnpm build
- name: Build hardhat integration
working-directory: integrations/hardhat
run: pnpm build
- name: Build Viem integration
working-directory: integrations/viem-v2
run: pnpm build
- name: Build Wagmi integration
working-directory: integrations/wagmi-v2
run: pnpm build
- name: Extract package from tag
id: extract-tag
run: |
echo "NPM_PACKAGE=$(echo ${{ github.ref_name }} | grep -oE '(clients/js|contracts|integrations/hardhat)')" >> $GITHUB_OUTPUT
echo "NPM_PACKAGE=$(echo ${{ github.ref_name }} | grep -oE '(clients/js|contracts|integrations/(hardhat|wagmi-v2|viem-v2))')" >> $GITHUB_OUTPUT
- name: Publish ${{ github.ref_name }} to NPM
uses: JS-DevTools/npm-publish@v3
with:
Expand Down
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
NPM ?= pnpm

subdirs = runtime clients integrations contracts

all:
@echo ...

clean distclean build lint::
for sd in $(subdirs); do $(MAKE) -C $$sd $@; done

$(subdirs)::
$(MAKE) -C $@

full: clean build

.PHONY: full all
Loading
Loading