Skip to content

Commit 0fc9a26

Browse files
Caleb PetersonCaleb Peterson
authored andcommitted
feat: merge upstream/main and resolve conflicts
Integrate upstream changes (MockToken, token::Client transfer, updated test snapshots) while preserving subscription pausing with duration limits, auto-resume, and the refund mechanism.
2 parents 70277d2 + 5cce3b3 commit 0fc9a26

61 files changed

Lines changed: 25146 additions & 15729 deletions

Some content is hidden

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

.eslintrc.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
{
2-
"extends": [
3-
"expo",
4-
"plugin:@typescript-eslint/recommended"
5-
],
2+
"extends": ["expo", "plugin:@typescript-eslint/recommended"],
63
"plugins": ["@typescript-eslint", "prettier"],
74
"parser": "@typescript-eslint/parser",
85
"parserOptions": {

.github/BRANCH_PROTECTION.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
To enforce the CI/CD pipeline quality gates, configure branch protection rules in your GitHub repository:
44

55
## Settings Location
6+
67
Go to: Repository Settings → Branches → Add rule
78

89
## Required Settings for `main` branch:
910

1011
### Branch name pattern
12+
1113
```
1214
main
1315
```
1416

1517
### ✅ Required checks (enable ALL):
18+
1619
- [ ] **typescript-lint** - ESLint and Prettier checks
1720
- [ ] **typescript-typecheck** - TypeScript type validation
1821
- [ ] **typescript-tests** - Jest test suite
@@ -23,6 +26,7 @@ main
2326
- [ ] **rust-build** - Rust contract compilation
2427

2528
### Additional protections:
29+
2630
- [x] Require pull request before merging
2731
- [x] Require at least 1 approval (recommended)
2832
- [x] Dismiss stale reviews
@@ -31,13 +35,15 @@ main
3135
- [x] Do not allow bypassing the above settings
3236

3337
## Settings Location for `dev` branch (optional):
38+
3439
Similar settings, but you may allow force pushes for rapid development.
3540

3641
---
3742

3843
## Verification
3944

4045
After setting up, verify by:
46+
4147
1. Creating a test PR
4248
2. Intentionally break a lint rule
4349
3. Verify the PR cannot be merged until fixed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Pull Request Checklist
22

33
### Quality Gates (All must pass before merge)
4+
45
- [ ] **Lint**: Code passes ESLint and Prettier checks
56
- [ ] **Type Check**: TypeScript compilation succeeds
67
- [ ] **Tests**: All tests pass
@@ -11,12 +12,14 @@
1112
- [ ] **Rust Build**: Smart contracts compile successfully
1213

1314
### Additional Requirements
15+
1416
- [ ] New code has appropriate TypeScript types
1517
- [ ] No hardcoded secrets or credentials
1618
- [ ] New features have corresponding tests
1719
- [ ] Documentation updated if needed
1820

1921
### Reviewers
22+
2023
- At least 1 approval required for merge
2124
- All CI checks must be green
2225

.github/workflows/ci.yml

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,28 @@ env:
1111
RUST_VERSION: '1.77'
1212

1313
jobs:
14+
commitlint:
15+
name: Conventional Commit Check
16+
runs-on: ubuntu-latest
17+
if: github.event_name == 'pull_request'
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ env.NODE_VERSION }}
28+
cache: 'npm'
29+
30+
- name: Install dependencies
31+
run: npm ci --legacy-peer-deps
32+
33+
- name: Validate PR commits
34+
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.sha }} --verbose
35+
1436
# ─────────────────────────────────────────────────────────
1537
# TypeScript / React Native Checks
1638
# ─────────────────────────────────────────────────────────
@@ -111,7 +133,7 @@ jobs:
111133
- name: Install Rust toolchain
112134
uses: dtolnay/rust-toolchain@master
113135
with:
114-
version: ${{ env.RUST_VERSION }}
136+
toolchain: ${{ env.RUST_VERSION }}
115137
components: rustfmt
116138

117139
- name: Check Rust formatting
@@ -127,7 +149,7 @@ jobs:
127149
- name: Install Rust toolchain
128150
uses: dtolnay/rust-toolchain@master
129151
with:
130-
version: ${{ env.RUST_VERSION }}
152+
toolchain: ${{ env.RUST_VERSION }}
131153
components: clippy
132154

133155
- name: Cache Rust dependencies
@@ -149,7 +171,7 @@ jobs:
149171
- name: Install Rust toolchain
150172
uses: dtolnay/rust-toolchain@master
151173
with:
152-
version: ${{ env.RUST_VERSION }}
174+
toolchain: ${{ env.RUST_VERSION }}
153175

154176
- name: Cache Rust dependencies
155177
uses: Swatinem/rust-cache@v2
@@ -170,7 +192,7 @@ jobs:
170192
- name: Install Rust toolchain
171193
uses: dtolnay/rust-toolchain@master
172194
with:
173-
version: ${{ env.RUST_VERSION }}
195+
toolchain: ${{ env.RUST_VERSION }}
174196

175197
- name: Cache Rust dependencies
176198
uses: Swatinem/rust-cache@v2
@@ -188,7 +210,18 @@ jobs:
188210
name: Merge Protection Check
189211
runs-on: ubuntu-latest
190212
if: github.event_name == 'pull_request'
191-
needs: [typescript-lint, typescript-typecheck, typescript-tests, typescript-build, rust-format, rust-clippy, rust-tests, rust-build]
213+
needs:
214+
[
215+
commitlint,
216+
typescript-lint,
217+
typescript-typecheck,
218+
typescript-tests,
219+
typescript-build,
220+
rust-format,
221+
rust-clippy,
222+
rust-tests,
223+
rust-build,
224+
]
192225
steps:
193226
- name: All checks passed
194227
run: echo "All quality gates passed!"
@@ -200,10 +233,25 @@ jobs:
200233
name: CI Complete
201234
runs-on: ubuntu-latest
202235
if: always()
203-
needs: [typescript-lint, typescript-typecheck, typescript-tests, typescript-build, rust-format, rust-clippy, rust-tests, rust-build]
236+
needs:
237+
[
238+
commitlint,
239+
typescript-lint,
240+
typescript-typecheck,
241+
typescript-tests,
242+
typescript-build,
243+
rust-format,
244+
rust-clippy,
245+
rust-tests,
246+
rust-build,
247+
]
204248
steps:
205249
- name: Check for failures
206250
run: |
251+
if [ "${{ github.event_name }}" = "pull_request" ] && [ "${{ needs.commitlint.result }}" != "success" ]; then
252+
echo "Conventional commit check failed"
253+
exit 1
254+
fi
207255
if [ "${{ needs.typescript-lint.result }}" != "success" ] || \
208256
[ "${{ needs.typescript-typecheck.result }}" != "success" ] || \
209257
[ "${{ needs.typescript-tests.result }}" != "success" ] || \

.github/workflows/release.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Release
2+
3+
on:
4+
workflow_run:
5+
workflows: ['CI/CD Pipeline']
6+
types: [completed]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
issues: write
12+
pull-requests: write
13+
14+
jobs:
15+
release:
16+
name: semantic-release
17+
if: |
18+
(github.event_name == 'workflow_run' &&
19+
github.event.workflow_run.conclusion == 'success' &&
20+
github.event.workflow_run.head_branch == 'main') ||
21+
github.event_name == 'workflow_dispatch'
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: 20
33+
registry-url: https://registry.npmjs.org
34+
cache: npm
35+
36+
- name: Install dependencies
37+
run: npm ci --legacy-peer-deps
38+
39+
- name: Run semantic-release
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
43+
run: npx semantic-release

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ builds/
1818
coverage/
1919
# TypeChain output (generated; do not reformat to avoid churn)
2020
src/contracts/types/
21+
# Rust build artifacts (local/generated)
22+
contracts/target/
23+
# Backup/fixed package snapshots
24+
package-fixed.json
25+
package.json.backup

.releaserc

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"branches": [
3+
"main"
4+
],
5+
"tagFormat": "v${version}",
6+
"plugins": [
7+
[
8+
"@semantic-release/commit-analyzer",
9+
{
10+
"preset": "conventionalcommits"
11+
}
12+
],
13+
[
14+
"@semantic-release/release-notes-generator",
15+
{
16+
"preset": "conventionalcommits"
17+
}
18+
],
19+
[
20+
"@semantic-release/changelog",
21+
{
22+
"changelogFile": "CHANGELOG.md"
23+
}
24+
],
25+
[
26+
"@semantic-release/npm",
27+
{
28+
"npmPublish": true
29+
}
30+
],
31+
[
32+
"@semantic-release/github",
33+
{
34+
"successComment": false,
35+
"failComment": false
36+
}
37+
],
38+
[
39+
"@semantic-release/git",
40+
{
41+
"assets": [
42+
"CHANGELOG.md",
43+
"package.json",
44+
"package-lock.json"
45+
],
46+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
47+
}
48+
]
49+
]
50+
}

0 commit comments

Comments
 (0)