Skip to content

Commit

Permalink
Merge branch 'feat/add-stark-scan-client' into chore/state-mgr-suppor…
Browse files Browse the repository at this point in the history
…t-multiple-tx-calls
  • Loading branch information
stanleyyconsensys committed Dec 4, 2024
2 parents 33e758f + 804a2bd commit 2d60760
Show file tree
Hide file tree
Showing 201 changed files with 9,591 additions and 4,445 deletions.
168 changes: 168 additions & 0 deletions .github/workflows/deploy-wallet-get-starknet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
name: Deploy Wallet-UI and Get-starknet

on:
workflow_dispatch:

jobs:
prepare-deployment:
environment: production
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Prepare Parameters
id: prepare_parameters
run: |
BASE=$(node -p "require('./packages/starknet-snap/package.json').version")
{
echo "VERSION=${BASE}"
echo "ENV=prod"
echo "AWS_CLOUDFRONT_DISTRIBUTIONS_ID=${{ vars.AWS_CLOUDFRONT_DISTRIBUTIONS_ID }}"
echo "AWS_S3_GET_STARKNET_URL=${{ vars.AWS_S3_GET_STARKNET_URL }}"
echo "AWS_S3_URL=${{ vars.AWS_S3_URL }}"
echo "GET_STARKNET_PUBLIC_PATH=${{ vars.GET_STARKNET_PUBLIC_PATH }}"
} >> "$GITHUB_OUTPUT"
outputs:
VERSION: ${{ steps.prepare_parameters.outputs.VERSION }}
AWS_S3_GET_STARKNET_URL: ${{ steps.prepare_parameters.outputs.AWS_S3_GET_STARKNET_URL }}
AWS_CLOUDFRONT_DISTRIBUTIONS_ID: ${{ steps.prepare_parameters.outputs.AWS_CLOUDFRONT_DISTRIBUTIONS_ID }}
AWS_S3_URL: ${{ steps.prepare_parameters.outputs.AWS_S3_URL }}
GET_STARKNET_PUBLIC_PATH: ${{ steps.prepare_parameters.outputs.GET_STARKNET_PUBLIC_PATH }}
CACHE_KEY: ${{ github.sha }}-${{ steps.prepare_parameters.outputs.ENV }}-UI_N_GET_STARKNET

install-build:
needs:
- prepare-deployment
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Install
run: |
yarn --no-immutable
yarn allow-scripts
- name: Build Snap
run: |
echo "Building UI with version $VERSION"
REACT_APP_SNAP_VERSION="${VERSION}" yarn workspace wallet-ui build
echo "Building Get Starknet with GET_STARKNET_PUBLIC_PATH=$GET_STARKNET_PUBLIC_PATH"
SNAP_VERSION="${VERSION}" GET_STARKNET_PUBLIC_PATH=$GET_STARKNET_PUBLIC_PATH yarn workspace @consensys/get-starknet build
env:
VERSION: ${{ needs.prepare-deployment.outputs.VERSION }}
GET_STARKNET_PUBLIC_PATH: ${{ needs.prepare-deployment.outputs.GET_STARKNET_PUBLIC_PATH }}
- name: Cache Build
uses: actions/cache@v3
id: cache
with:
path: |
./packages/get-starknet/dist/webpack
./packages/wallet-ui/build
./node_modules/.yarn-state.yml
key: ${{ needs.prepare-deployment.outputs.CACHE_KEY }}

deploy-wallet-ui:
runs-on: ubuntu-latest
needs:
- prepare-deployment
- install-build
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
- name: Restore Cached Build
uses: actions/cache@v3
id: restore-build
with:
path: |
./packages/get-starknet/dist/webpack
./packages/wallet-ui/build
./node_modules/.yarn-state.yml
key: ${{ needs.prepare-deployment.outputs.CACHE_KEY }}
- name: Deploy to AWS
run: |
echo "Deployed Dapp to : $AWS_S3_URL"
aws s3 sync ./packages/wallet-ui/build "$AWS_S3_URL"
env:
AWS_S3_URL: ${{ needs.prepare-deployment.outputs.AWS_S3_URL }}

deploy-get-starknet:
runs-on: ubuntu-latest
needs:
- prepare-deployment
- install-build
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
- name: Restore Cached Build
uses: actions/cache@v3
id: restore-build
with:
path: |
./packages/get-starknet/dist/webpack
./packages/wallet-ui/build
./node_modules/.yarn-state.yml
key: ${{ needs.prepare-deployment.outputs.CACHE_KEY }}
- name: Deploy to AWS
run: |
echo "Deployed get Starknet to : $AWS_S3_GET_STARKNET_URL"
aws s3 sync ./packages/get-starknet/dist/webpack "$AWS_S3_GET_STARKNET_URL"
env:
AWS_S3_GET_STARKNET_URL: ${{ needs.prepare-deployment.outputs.AWS_S3_GET_STARKNET_URL }}

invalid-aws-cdn-cache:
runs-on: ubuntu-latest
needs:
- deploy-wallet-ui
- deploy-get-starknet
- prepare-deployment
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- name: Invalid AWS CDN Cache
run: |
echo "Distribution ID : $AWS_CLOUDFRONT_DISTRIBUTIONS_ID"
echo "$AWS_CLOUDFRONT_DISTRIBUTIONS_ID" | tr ',' '\n' | while read -r DISTRIBUTIONS_ID
do
echo "Processing Distribution ID : $DISTRIBUTIONS_ID"
INVALIDED_ID="$(aws cloudfront create-invalidation --distribution-id "$DISTRIBUTIONS_ID" --paths "/starknet/*" | grep Id | awk -F'"' '{ print $4}')"
echo "Waiting for invalidation $INVALIDED_ID"
aws cloudfront wait invalidation-completed --id "$INVALIDED_ID" --distribution-id "$DISTRIBUTIONS_ID"
echo "Invalidation $INVALIDED_ID completed"
done
env:
AWS_CLOUDFRONT_DISTRIBUTIONS_ID: ${{ needs.prepare-deployment.outputs.AWS_CLOUDFRONT_DISTRIBUTIONS_ID }}
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
echo "Building Get Starknet with GET_STARKNET_PUBLIC_PATH=$GET_STARKNET_PUBLIC_PATH"
GET_STARKNET_PUBLIC_PATH=$GET_STARKNET_PUBLIC_PATH yarn workspace @consensys/get-starknet build
SNAP_VERSION="${VERSION}" GET_STARKNET_PUBLIC_PATH=$GET_STARKNET_PUBLIC_PATH yarn workspace @consensys/get-starknet build
env:
SNAP_ENV: ${{ needs.prepare-deployment.outputs.ENV }}
VERSION: ${{ needs.prepare-deployment.outputs.VERSION }}
Expand Down
147 changes: 147 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Publish NPM

on:
workflow_dispatch:

jobs:
prepare-deployment:
environment: production
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Prepare Parameters
id: prepare_parameters
run: |
BASE=$(node -p "require('./packages/starknet-snap/package.json').version")
{
echo "VERSION=${BASE}"
echo "TAG=latest"
echo "ENV=prod"
echo "LOG_LEVEL=0"
} >> "$GITHUB_OUTPUT"
outputs:
VERSION: ${{ steps.prepare_parameters.outputs.VERSION }}
TAG: ${{ steps.prepare_parameters.outputs.TAG }}
ENV: ${{ steps.prepare_parameters.outputs.ENV }}
CACHE_KEY: ${{ github.sha }}-${{ steps.prepare_parameters.outputs.ENV }}-SANP
LOG_LEVEL: ${{ steps.prepare_parameters.outputs.LOG_LEVEL }}

install-build:
needs:
- prepare-deployment
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Install
run: |
yarn --no-immutable
yarn allow-scripts
- name: Build Snap
run: |
echo "Building Snap with version $VERSION"
npm --prefix ./packages/starknet-snap version --new-version "$VERSION" --no-git-tag-version --allow-same-version
yarn workspace @consensys/starknet-snap build
BUILD_VERSION=$(node -p "require('./packages/starknet-snap/package.json').version")
if [[ "$VERSION" != "$BUILD_VERSION" ]]; then
echo "Version mismatch"
exit 1
fi
env:
SNAP_ENV: ${{ needs.prepare-deployment.outputs.ENV }}
VERSION: ${{ needs.prepare-deployment.outputs.VERSION }}
LOG_LEVEL: ${{ needs.prepare-deployment.outputs.LOG_LEVEL }}
VOYAGER_API_KEY: ${{ secrets.VOYAGER_API_KEY }}
ALCHEMY_API_KEY: ${{ secrets.ALCHEMY_API_KEY }}
- name: Cache Build
uses: actions/cache@v3
id: cache
with:
path: |
./packages/starknet-snap/package.json
./packages/starknet-snap/dist
./packages/starknet-snap/snap.manifest.json
./node_modules/.yarn-state.yml
key: ${{ needs.prepare-deployment.outputs.CACHE_KEY }}

publish-npm-dry-run:
runs-on: ubuntu-latest
needs:
- prepare-deployment
- install-build
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Restore Cached Build
uses: actions/cache@v3
id: restore-build
with:
# add /packages/snap/snap.manifest.json to include an updated shasum from build due to version update in auto PR
path: |
./packages/starknet-snap/package.json
./packages/starknet-snap/dist
./packages/starknet-snap/snap.manifest.json
./node_modules/.yarn-state.yml
key: ${{ needs.prepare-deployment.outputs.CACHE_KEY }}
- name: Dry Run Publish
run: |
npm pack ./packages/starknet-snap --tag "$TAG" --access public
env:
TAG: ${{ needs.prepare-deployment.outputs.TAG }}

publish-npm:
runs-on: ubuntu-latest
needs:
- publish-npm-dry-run
- prepare-deployment
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.sha }}
- uses: actions/setup-node@v3
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Restore Cached Build
uses: actions/cache@v3
id: restore-build
with:
# add /packages/snap/snap.manifest.json to include an updated shasum from build due to version update in auto PR
path: |
./packages/starknet-snap/package.json
./packages/starknet-snap/dist
./packages/starknet-snap/snap.manifest.json
./node_modules/.yarn-state.yml
key: ${{ needs.prepare-deployment.outputs.CACHE_KEY }}
- name: Run Publish
run: |
npm publish ./packages/starknet-snap --tag "$TAG" --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
TAG: ${{ needs.prepare-deployment.outputs.TAG }}
6 changes: 3 additions & 3 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"packages/starknet-snap": "2.9.0",
"packages/wallet-ui": "1.23.0",
"packages/get-starknet": "1.1.0"
"packages/starknet-snap": "3.0.0",
"packages/wallet-ui": "1.25.0",
"packages/get-starknet": "1.3.0"
}
2 changes: 1 addition & 1 deletion packages/get-starknet/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ module.exports = {
},
],

ignorePatterns: ['!.eslintrc.js', 'dist/', '**/test', '.nyc_output/', 'coverage/'],
ignorePatterns: ['!.eslintrc.js', 'dist/', '**/test', '.nyc_output/', 'coverage/', 'webpack.*.js'],
};
21 changes: 21 additions & 0 deletions packages/get-starknet/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## [1.3.0](https://github.com/Consensys/starknet-snap/compare/get-starknet-v1.2.0...get-starknet-v1.3.0) (2024-10-28)


### Features

* Add backward compatible with get-starknet v3 ([#400](https://github.com/Consensys/starknet-snap/issues/400)) ([8bf8463](https://github.com/Consensys/starknet-snap/commit/8bf8463e0aefd3eb9e59f3cbcb44493e5de2fb5f))
* Add get-starknet v4 support ([#400](https://github.com/Consensys/starknet-snap/issues/400)) ([8bf8463](https://github.com/Consensys/starknet-snap/commit/8bf8463e0aefd3eb9e59f3cbcb44493e5de2fb5f))


### Bug Fixes

* Fix address not update when network change ([#366](https://github.com/Consensys/starknet-snap/issues/366)) ([c96f75e](https://github.com/Consensys/starknet-snap/commit/c96f75eb6c95b76513e3a0488d7ccdb3d59e5a71))
* Remove 'Method not supported' exception in 'on' and 'off' event handlers for get-starknet v4 compatibility ([#402](https://github.com/Consensys/starknet-snap/issues/402)) ([bd6b66d](https://github.com/Consensys/starknet-snap/commit/bd6b66d2cba8382711adbe6a6312f295e22c64b6))

## [1.2.0](https://github.com/Consensys/starknet-snap/compare/get-starknet-v1.1.0...get-starknet-v1.2.0) (2024-09-20)


### Features

* bump starknet.js to v6.11.0 ([#296](https://github.com/Consensys/starknet-snap/issues/296)) ([e298244](https://github.com/Consensys/starknet-snap/commit/e298244a5e68e2809ab6367330e104c53ca5c861))

## [1.1.0](https://github.com/Consensys/starknet-snap/compare/get-starknet-v1.0.0...get-starknet-v1.1.0) (2024-07-16)


Expand Down
Loading

0 comments on commit 2d60760

Please sign in to comment.