Skip to content

Commit 988c042

Browse files
committed
Merge branch 'feat/sdk-v3'
2 parents 64206b4 + 27729f8 commit 988c042

File tree

251 files changed

+32551
-33169
lines changed

Some content is hidden

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

251 files changed

+32551
-33169
lines changed

.babelrc.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CELO_MAINNET_RPC_URL=
2+
TEST_SIGNER_PRIVATE_KEY=

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Dependabot configuration for automated dependency updates
2+
# See: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates
3+
version: 2
4+
updates:
5+
# npm dependencies
6+
- package-ecosystem: npm
7+
directory: /
8+
schedule:
9+
interval: weekly
10+
groups:
11+
dev-dependencies:
12+
patterns:
13+
- '*'
14+
exclude-patterns:
15+
- '@mento-protocol/*'
16+
- viem
17+
18+
# GitHub Actions
19+
- package-ecosystem: github-actions
20+
directory: /
21+
schedule:
22+
interval: weekly

.github/workflows/main.yml

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,54 @@
11
name: CI
2-
on: [push]
2+
3+
env:
4+
CELO_MAINNET_RPC_URL: ${{secrets.CELO_MAINNET_RPC_URL}}
5+
6+
on:
7+
push:
8+
branches: [main]
9+
pull_request:
10+
branches: [main]
11+
12+
# Restrict default permissions for security
13+
permissions: {}
14+
315
jobs:
416
build:
5-
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}
17+
name: Build, lint, and test on Node ${{ matrix.node }}
618

7-
runs-on: ${{ matrix.os }}
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
822
strategy:
923
matrix:
10-
node: [22.x]
11-
os: [ubuntu-latest]
24+
node: ['18.x', '20.x', '22.x']
1225

1326
steps:
1427
- name: Checkout repo
15-
uses: actions/checkout@v4
28+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
29+
30+
- name: Install pnpm
31+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
32+
with:
33+
version: 9
1634

1735
- name: Use Node ${{ matrix.node }}
18-
uses: actions/setup-node@v4
36+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
1937
with:
2038
node-version: ${{ matrix.node }}
39+
cache: pnpm
2140

22-
- name: Install deps
23-
run: yarn install
41+
- name: Install dependencies
42+
run: pnpm install --frozen-lockfile
2443

2544
- name: Build
26-
run: yarn build
45+
run: pnpm build
2746

2847
- name: Lint
29-
run: yarn lint
48+
run: pnpm lint
3049

3150
- name: Test
32-
run: yarn test --ci --coverage
51+
run: pnpm test:unit
52+
53+
- name: Check bundle size
54+
run: pnpm size

.github/workflows/publish_npm.yml

Lines changed: 75 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,87 @@
1-
name: publish npm package
1+
name: Publish to npm
22

3-
on: [workflow_dispatch]
3+
on: workflow_dispatch
4+
5+
# Restrict default permissions for security
6+
permissions: {}
47

58
jobs:
6-
release:
7-
name: publish
9+
build:
10+
name: Build and test
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
steps:
15+
- name: Checkout repo
16+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
17+
18+
- name: Install pnpm
19+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
20+
with:
21+
version: 9
22+
23+
- name: Install Node.js
24+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
25+
with:
26+
node-version: '20'
27+
cache: pnpm
28+
29+
- name: Install dependencies
30+
run: pnpm install --frozen-lockfile
31+
32+
- name: Build
33+
run: pnpm build
34+
35+
- name: Lint
36+
run: pnpm lint
37+
38+
- name: Test
39+
run: pnpm test:unit
40+
41+
- name: Upload build artifact
42+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
43+
with:
44+
name: dist
45+
path: dist/
46+
retention-days: 1
47+
48+
publish:
49+
name: Publish
50+
needs: build
851
runs-on: ubuntu-latest
52+
permissions:
53+
contents: read
54+
id-token: write # Required for npm OIDC trusted publishing
955
steps:
10-
- name: Check out the repo
11-
uses: actions/checkout@v4
56+
- name: Checkout repo
57+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
1258

1359
- name: Install Node.js
14-
uses: actions/setup-node@v4
60+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
1561
with:
16-
cache: yarn
17-
node-version: '22'
62+
node-version: '20'
1863
registry-url: https://registry.npmjs.org
1964

20-
- name: Install the Node.js dependencies
21-
run: yarn install --immutable
65+
- name: Download build artifact
66+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
67+
with:
68+
name: dist
69+
path: dist/
2270

23-
- name: Build the sdk
24-
run: yarn build
71+
- name: Determine npm tag
72+
id: tag
73+
run: |
74+
VERSION=$(node -p "require('./package.json').version")
75+
if echo "$VERSION" | grep -q "beta"; then
76+
echo "tag=beta" >> "$GITHUB_OUTPUT"
77+
elif echo "$VERSION" | grep -q "rc"; then
78+
echo "tag=rc" >> "$GITHUB_OUTPUT"
79+
elif echo "$VERSION" | grep -q "alpha"; then
80+
echo "tag=alpha" >> "$GITHUB_OUTPUT"
81+
else
82+
echo "tag=latest" >> "$GITHUB_OUTPUT"
83+
fi
84+
echo "Publishing $VERSION with tag: $(cat "$GITHUB_OUTPUT" | grep tag | cut -d= -f2)"
2585
26-
- name: publish
27-
run: npm publish --access public
28-
env:
29-
NODE_AUTH_TOKEN: ${{secrets.SDK_NPM_AUTH_TOKEN}}
86+
- name: Publish to npm
87+
run: npm publish --access public --tag ${{ steps.tag.outputs.tag }} --provenance

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,11 @@ yarn-error.log*
3232
# local env files
3333
.env
3434
.env.*
35-
.tool-versions
35+
!.env.example
36+
37+
# AI files
38+
.claude/
39+
.specify/*
40+
IMPLEMENTATION_PLAN.md
41+
42+
.vscode/

.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Security: Disable lifecycle scripts during install to mitigate supply-chain attacks
2+
# See: https://e18e.dev/docs/publishing.html
3+
ignore-scripts=true

.prettierrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"semi": false,
3-
"printWidth": 80,
3+
"printWidth": 120,
44
"singleQuote": true,
55
"tabWidth": 2,
66
"trailingComma": "es5"

0 commit comments

Comments
 (0)