Skip to content

Commit d5399f8

Browse files
Add support for all chains to modular accounts (#1)
* 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 <[email protected]>
1 parent 26682d2 commit d5399f8

File tree

481 files changed

+61943
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

481 files changed

+61943
-1
lines changed

.circleci/announcePublish.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
applicationName=$1
5+
package=$2
6+
7+
payload=$(
8+
cat <<EOM
9+
{
10+
"attachments": [
11+
{
12+
"fallback": "A new version of $applicationName is available for use. :circleci-pass:",
13+
"color": "#33CC66",
14+
"pretext": "A new version of $applicationName is available for use. :circleci-pass:",
15+
"title": "$CIRCLE_PROJECT_REPONAME",
16+
"title_link": "https://github.com/etherspot/etherspot-prime-sdk/releases/tag/$package",
17+
"text": "Version: @etherspot/prime-sdk@$package",
18+
"ts": $(date '+%s')
19+
}
20+
]
21+
}
22+
EOM
23+
)
24+
25+
curl -X POST --data-urlencode payload="$payload" "$SLACK_WEBHOOK_URL"
26+
curl -X POST --data-urlencode payload="$payload" "$SLACK_WEBHOOK_FRONTEND"

.circleci/config.yml

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
version: 2.1
2+
parameters:
3+
run_e2e_tests:
4+
type: boolean
5+
default: true
6+
orbs:
7+
slack: circleci/[email protected]
8+
9+
jobs:
10+
install:
11+
working_directory: ~/etherspot-prime-sdk
12+
docker:
13+
- image: cimg/node:18.16.1
14+
auth:
15+
username: $DOCKERHUB_USER
16+
password: $DOCKERHUB_PASSWORD
17+
steps:
18+
- checkout
19+
- run:
20+
name: Authenticate with registry
21+
command: echo "//registry.npmjs.org/:_authToken=$ETHERSPOT_NPM_TOKEN" > ~/etherspot-prime-sdk/.npmrc
22+
- restore_cache:
23+
key: dependency-cache-{{ checksum "package.json" }}
24+
- run:
25+
name: Install dependencies
26+
command: npm install
27+
- save_cache:
28+
key: dependency-cache-{{ checksum "package.json" }}
29+
paths:
30+
- ./node_modules
31+
- run:
32+
name: Dry run build
33+
command: npm run build
34+
# - slack/status:
35+
# failure_message: "Triggered by: *${CIRCLE_USERNAME}* \n\n Ooops! The *$CIRCLE_JOB* job has failed! :circleci-fail:"
36+
# webhook: "${SLACK_WEBHOOK_URL}"
37+
38+
# e2e-tests:
39+
# working_directory: ~/etherspot-prime-sdk
40+
# docker:
41+
# - image: cimg/node:18.16.1
42+
# auth:
43+
# username: $DOCKERHUB_USER
44+
# password: $DOCKERHUB_PASSWORD
45+
# steps:
46+
# - checkout
47+
# - when:
48+
# condition: <<pipeline.parameters.run_e2e_tests>>
49+
# steps:
50+
51+
# - restore_cache:
52+
# key: dependency-cache-{{ checksum "package.json" }}
53+
# - run:
54+
# name: Authenticate with registry
55+
# command: echo "//registry.npmjs.org/:_authToken=$ETHERSPOT_NPM_TOKEN" > ~/etherspot-prime-sdk/.npmrc
56+
# - run:
57+
# name: Build Etherpot Prime SDK
58+
# command: npm run build
59+
# - run:
60+
# name: Checkout e2e repo and run tests
61+
# no_output_timeout: 60m
62+
# command: |
63+
# cd ~
64+
# git clone https://github.com/etherspot/e2e-sdk-prime.git
65+
# cd e2e-sdk-prime
66+
# sed -i.bak "s/_private_key_/$PRIVATE_KEY/g" .env
67+
# sed -i.bak "s/_project_key_/$PROJECT_KEY/g" .env
68+
# sed -i.bak "s/_project_key_testnet_/$PROJECT_KEY_TESTNET/g" .env
69+
# sed -i.bak "s/_api_key_/$API_KEY/g" .env
70+
# sed -i.bak "s/_incorrect_api_key_/$INCORRECT_API_KEY/g" .env
71+
# sed -i.bak "s/_invalid_api_key_/$INVALID_API_KEY/g" .env
72+
# sed -i.bak "s/_bundler_api_key_/$BUNDLER_API_KEY/g" .env
73+
# sed -i.bak "s/_data_api_key_/$DATA_API_KEY/g" .env
74+
# mv package.json temp.json
75+
# jq -r '.dependencies."@etherspot/prime-sdk" |= "file:../etherspot-prime-sdk"' temp.json > package.json
76+
# rm temp.json
77+
# npm i
78+
# npm run test-mainnet
79+
# - run:
80+
# name: Move test report
81+
# command: |
82+
# mv /home/circleci/e2e-sdk-prime/mochawesome-report /tmp/
83+
# chmod 777 -R /tmp/mochawesome-report
84+
# when: always
85+
# - store_artifacts:
86+
# path: /tmp/mochawesome-report
87+
# when: always
88+
# - slack/status:
89+
# 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"
90+
# 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"
91+
# # only_for_branches: master
92+
# webhook: "${SLACK_WEBHOOK_URL}"
93+
publish-npm-package:
94+
working_directory: ~/etherspot-prime-sdk
95+
docker:
96+
- image: cimg/node:18.16.1
97+
auth:
98+
username: $DOCKERHUB_USER
99+
password: $DOCKERHUB_PASSWORD
100+
steps:
101+
- checkout
102+
- restore_cache:
103+
key: dependency-cache-{{ checksum "package.json" }}
104+
- run:
105+
name: Authenticate with registry
106+
command: echo "//registry.npmjs.org/:_authToken=$ETHERSPOT_NPM_TOKEN" > ~/etherspot-prime-sdk/.npmrc
107+
- run:
108+
name: Build Etherpot Prime SDK
109+
command: npm run build
110+
- run:
111+
name: Publish package to npm
112+
command: |
113+
cd ~/etherspot-prime-sdk
114+
npm publish --tag v2-modular
115+
- run:
116+
name: Announce Publish
117+
command: |
118+
chmod +x .circleci/announcePublish.sh
119+
.circleci/announcePublish.sh "Etherspot Modular SDK" "$(node -e "console.log(require('./package.json').version)")"
120+
publish-github-release:
121+
docker:
122+
- image: ardd97/ghr
123+
steps:
124+
- checkout
125+
- run:
126+
name: "Publish Release on GitHub"
127+
command: |
128+
PACKAGE_VERSION="$(jq .version package.json -r)"
129+
echo $PACKAGE_VERSION
130+
ghr -t "${GITHUB_TOKEN}" -u "${CIRCLE_PROJECT_USERNAME}" -r "${CIRCLE_PROJECT_REPONAME}" -c "${CIRCLE_SHA1}" -n "$PACKAGE_VERSION"
131+
132+
workflows:
133+
version: 2.1
134+
install_and_publish:
135+
jobs:
136+
- install:
137+
context: general-vars
138+
- e2e-tests:
139+
context: general-vars
140+
requires:
141+
- install
142+
# filters:
143+
# branches:
144+
# only:
145+
# - master
146+
- publish-npm-package:
147+
context: general-vars
148+
# requires:
149+
# - e2e-tests
150+
filters:
151+
branches:
152+
only:
153+
- master
154+
- publish-github-release:
155+
context: general-vars
156+
requires:
157+
- publish-npm-package
158+
filters:
159+
branches:
160+
only:
161+
- master

.eslintignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
dist
3+
coverage
4+
__snapshots__
5+
src/sdk/contracts/**/*.ts
6+
src/sdk/base/HttpRpcClient.ts
7+
src/sdk/state/state.service.ts

.eslintrc.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module.exports = {
2+
root: true,
3+
parser: '@typescript-eslint/parser',
4+
parserOptions: {
5+
sourceType: 'module',
6+
},
7+
plugins: ['@typescript-eslint/eslint-plugin'],
8+
extends: [
9+
'plugin:@typescript-eslint/eslint-recommended',
10+
'plugin:@typescript-eslint/recommended',
11+
'prettier',
12+
],
13+
env: {
14+
node: true,
15+
jest: true,
16+
},
17+
rules: {
18+
'@typescript-eslint/interface-name-prefix': 'off',
19+
'@typescript-eslint/explicit-function-return-type': 'off',
20+
'@typescript-eslint/no-explicit-any': 'off',
21+
'@typescript-eslint/camelcase': 'off',
22+
'@typescript-eslint/ban-types': 'off',
23+
'@typescript-eslint/ban-ts-comment': 'off',
24+
},
25+
};

.github-pages/files/CNAME

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sdk.etherspot.io

0 commit comments

Comments
 (0)