Skip to content

Commit cc8ccb4

Browse files
committed
feat(sdk): migrate indexer GraphQL to maci-graphql and add multi-endpoint defaults
- Migrate default apiEndpoint to maci-graphql.dorafactory.org (mainnet) and maci-testnet-graphql.dorafactory.org (testnet) - Replace NetworkConfig.rpcEndpoint/restEndpoint with rpcEndpoints[]/restEndpoints[] arrays; mainnet defaults to primary + archive endpoints - Update RoundType: operator(string) → operatorAddress, identity → operator{identity} - Update OperatorDelayType: remove nodeId, roundAddress → contractAddress - Update DeactivateMessage: maciContractAddress → contractAddress, maciOperator → operatorAddress - Update all GraphQL queries in round.ts / operator.ts / event.ts to match new schema - Add test framework: unit tests (http/retry), integration tests (all 22 query methods, fully automated) - Add sdk-tests job to CI workflow
1 parent 075106e commit cc8ccb4

26 files changed

Lines changed: 2767 additions & 79 deletions

.github/workflows/test.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,48 @@ jobs:
5757
- name: Run contract tests
5858
run: RUSTFLAGS="-A dead_code -A unused_variables" cargo test --lib -- --nocapture
5959

60+
sdk-tests:
61+
name: SDK Tests
62+
runs-on: ubuntu-latest
63+
timeout-minutes: 15
64+
steps:
65+
- name: Checkout code
66+
uses: actions/checkout@v4
67+
68+
- name: Setup Node.js
69+
uses: actions/setup-node@v4
70+
with:
71+
node-version: '22'
72+
73+
- name: Setup pnpm
74+
uses: pnpm/action-setup@v4
75+
with:
76+
version: 9.12.3
77+
78+
- name: Get pnpm store directory
79+
shell: bash
80+
run: |
81+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
82+
83+
- name: Setup pnpm cache
84+
uses: actions/cache@v4
85+
with:
86+
path: ${{ env.STORE_PATH }}
87+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
88+
restore-keys: |
89+
${{ runner.os }}-pnpm-store-
90+
91+
- name: Install root dependencies
92+
run: pnpm install --frozen-lockfile
93+
94+
- name: Run SDK unit tests
95+
working-directory: ./packages/sdk
96+
run: pnpm test:unit
97+
98+
- name: Run SDK integration tests
99+
working-directory: ./packages/sdk
100+
run: pnpm test:integration
101+
60102
build-wasm:
61103
name: Build WASM Contracts
62104
runs-on: ubuntu-latest

packages/sdk/package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@
3535
"watch:tsup": "tsup ./src/index.ts --format esm,cjs --clean --splitting --watch",
3636
"watch:types": "tsc --watch",
3737
"watch": "pnpm run clean & pnpm run watch:types & pnpm run watch:tsup",
38-
"test": "pnpm test:typecheck && pnpm test:unit",
39-
"test:typecheck": "tsc -p ./test",
40-
"test:unit": "vitest run --test-timeout=60000",
41-
"test:watch": "vitest",
38+
"test": "pnpm test:unit",
39+
"test:unit": "vitest run --config vitest.config.ts",
40+
"test:integration": "vitest run --config vitest.config.integration.ts",
41+
"test:migration": "vitest run --config vitest.config.migration.ts",
42+
"test:watch": "vitest --config vitest.config.ts",
43+
"test:compare": "tsx scripts/compare_graphql_migration.ts",
4244
"format:fix": "prettier --ignore-path 'dist/* docs/*' --write '**/*.{ts,json,md}'",
4345
"lint:fix": "eslint . --ignore-pattern dist --ext .ts --fix",
4446
"commit": "commit",
@@ -96,6 +98,7 @@
9698
"tsconfig-paths": "^4.2.0",
9799
"tsup": "^8.0.0",
98100
"typedoc": "^0.25.2",
99-
"typescript": "^5.2.2"
101+
"typescript": "^5.2.2",
102+
"vitest": "^4.1.5"
100103
}
101104
}

0 commit comments

Comments
 (0)