Skip to content

Commit

Permalink
Add support for all chains to modular accounts (#1)
Browse files Browse the repository at this point in the history
* Initial commit
* Add support for all chains and change initData optional in installModule
* Remove unsupported bundler URLs
* change contract addresses for all the chains and SDK name to ModularSdk
* Fix default contract addresses and bundlerApiKey
* chore: pipeline changes
* chore: version and description changes
---------
Co-authored-by: AArdian <34317628+arddluma@users.noreply.github.com>
  • Loading branch information
kaushalrajbacancy authored Jun 7, 2024
1 parent 26682d2 commit d5399f8
Show file tree
Hide file tree
Showing 481 changed files with 61,943 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .circleci/announcePublish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -euo pipefail

applicationName=$1
package=$2

payload=$(
cat <<EOM
{
"attachments": [
{
"fallback": "A new version of $applicationName is available for use. :circleci-pass:",
"color": "#33CC66",
"pretext": "A new version of $applicationName is available for use. :circleci-pass:",
"title": "$CIRCLE_PROJECT_REPONAME",
"title_link": "https://github.com/etherspot/etherspot-prime-sdk/releases/tag/$package",
"text": "Version: @etherspot/prime-sdk@$package",
"ts": $(date '+%s')
}
]
}
EOM
)

curl -X POST --data-urlencode payload="$payload" "$SLACK_WEBHOOK_URL"
curl -X POST --data-urlencode payload="$payload" "$SLACK_WEBHOOK_FRONTEND"
161 changes: 161 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
version: 2.1
parameters:
run_e2e_tests:
type: boolean
default: true
orbs:
slack: circleci/slack@3.4.2

jobs:
install:
working_directory: ~/etherspot-prime-sdk
docker:
- image: cimg/node:18.16.1
auth:
username: $DOCKERHUB_USER
password: $DOCKERHUB_PASSWORD
steps:
- checkout
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$ETHERSPOT_NPM_TOKEN" > ~/etherspot-prime-sdk/.npmrc
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Install dependencies
command: npm install
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
name: Dry run build
command: npm run build
# - slack/status:
# failure_message: "Triggered by: *${CIRCLE_USERNAME}* \n\n Ooops! The *$CIRCLE_JOB* job has failed! :circleci-fail:"
# webhook: "${SLACK_WEBHOOK_URL}"

# e2e-tests:
# working_directory: ~/etherspot-prime-sdk
# docker:
# - image: cimg/node:18.16.1
# auth:
# username: $DOCKERHUB_USER
# password: $DOCKERHUB_PASSWORD
# steps:
# - checkout
# - when:
# condition: <<pipeline.parameters.run_e2e_tests>>
# steps:

# - restore_cache:
# key: dependency-cache-{{ checksum "package.json" }}
# - run:
# name: Authenticate with registry
# command: echo "//registry.npmjs.org/:_authToken=$ETHERSPOT_NPM_TOKEN" > ~/etherspot-prime-sdk/.npmrc
# - run:
# name: Build Etherpot Prime SDK
# command: npm run build
# - run:
# name: Checkout e2e repo and run tests
# no_output_timeout: 60m
# command: |
# cd ~
# git clone https://github.com/etherspot/e2e-sdk-prime.git
# cd e2e-sdk-prime
# sed -i.bak "s/_private_key_/$PRIVATE_KEY/g" .env
# sed -i.bak "s/_project_key_/$PROJECT_KEY/g" .env
# sed -i.bak "s/_project_key_testnet_/$PROJECT_KEY_TESTNET/g" .env
# sed -i.bak "s/_api_key_/$API_KEY/g" .env
# sed -i.bak "s/_incorrect_api_key_/$INCORRECT_API_KEY/g" .env
# sed -i.bak "s/_invalid_api_key_/$INVALID_API_KEY/g" .env
# sed -i.bak "s/_bundler_api_key_/$BUNDLER_API_KEY/g" .env
# sed -i.bak "s/_data_api_key_/$DATA_API_KEY/g" .env
# mv package.json temp.json
# jq -r '.dependencies."@etherspot/prime-sdk" |= "file:../etherspot-prime-sdk"' temp.json > package.json
# rm temp.json
# npm i
# npm run test-mainnet
# - run:
# name: Move test report
# command: |
# mv /home/circleci/e2e-sdk-prime/mochawesome-report /tmp/
# chmod 777 -R /tmp/mochawesome-report
# when: always
# - store_artifacts:
# path: /tmp/mochawesome-report
# when: always
# - slack/status:
# failure_message: "Triggered by: *${CIRCLE_USERNAME}* \n\n Ooops! The *$CIRCLE_JOB* job e2e tests failed! :circleci-fail: \n\n Report URL: https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/${CIRCLE_NODE_INDEX}/tmp/mochawesome-report/mochawesome.html"
# success_message: "Triggered by: *${CIRCLE_USERNAME}* \n\n Woohoh! The *$CIRCLE_JOB* job e2e tests completed successfully! :circleci-pass: \n\n Report URL: https://output.circle-artifacts.com/output/job/${CIRCLE_WORKFLOW_JOB_ID}/artifacts/${CIRCLE_NODE_INDEX}/tmp/mochawesome-report/mochawesome.html"
# # only_for_branches: master
# webhook: "${SLACK_WEBHOOK_URL}"
publish-npm-package:
working_directory: ~/etherspot-prime-sdk
docker:
- image: cimg/node:18.16.1
auth:
username: $DOCKERHUB_USER
password: $DOCKERHUB_PASSWORD
steps:
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$ETHERSPOT_NPM_TOKEN" > ~/etherspot-prime-sdk/.npmrc
- run:
name: Build Etherpot Prime SDK
command: npm run build
- run:
name: Publish package to npm
command: |
cd ~/etherspot-prime-sdk
npm publish --tag v2-modular
- run:
name: Announce Publish
command: |
chmod +x .circleci/announcePublish.sh
.circleci/announcePublish.sh "Etherspot Modular SDK" "$(node -e "console.log(require('./package.json').version)")"
publish-github-release:
docker:
- image: ardd97/ghr
steps:
- checkout
- run:
name: "Publish Release on GitHub"
command: |
PACKAGE_VERSION="$(jq .version package.json -r)"
echo $PACKAGE_VERSION
ghr -t "${GITHUB_TOKEN}" -u "${CIRCLE_PROJECT_USERNAME}" -r "${CIRCLE_PROJECT_REPONAME}" -c "${CIRCLE_SHA1}" -n "$PACKAGE_VERSION"
workflows:
version: 2.1
install_and_publish:
jobs:
- install:
context: general-vars
- e2e-tests:
context: general-vars
requires:
- install
# filters:
# branches:
# only:
# - master
- publish-npm-package:
context: general-vars
# requires:
# - e2e-tests
filters:
branches:
only:
- master
- publish-github-release:
context: general-vars
requires:
- publish-npm-package
filters:
branches:
only:
- master
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
dist
coverage
__snapshots__
src/sdk/contracts/**/*.ts
src/sdk/base/HttpRpcClient.ts
src/sdk/state/state.service.ts
25 changes: 25 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
env: {
node: true,
jest: true,
},
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
},
};
1 change: 1 addition & 0 deletions .github-pages/files/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sdk.etherspot.io
Loading

0 comments on commit d5399f8

Please sign in to comment.