-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
40 add support to interact with 010 rankify interfaces (#52)
* added 0.10 rankify contracts basic support * updated index file * moved rank token methods to separate class * refactored sdk to use viem (#48) * build suceeds * added prebuild step to copy and use abi's within srcs * fix wrong imports * update prebuild script * update multipass class to use chain ID as a number --------- Co-authored-by: theKosmoss <[email protected]> * Peersky/40 add support 010 rankify/with viem (#49) * build suceeds * added prebuild step to copy and use abi's within srcs * fix wrong imports * generate chain id mapping to supported chains path during sdk build * Refactored sdk to accept chainId instead of chain * made linter to highlight more issues and fixed those * added jest for TDD * multipass unit test * updated ci cd * upd ci * added tests to player, fixed bug * validate address in distributor constructor * multipass constructor tweaks * added abi files to index & generator * export abis as object * reexport abis * fix dist import require paths * Revert "fix dist import require paths" This reverts commit cf816da. * modified build scipt instead * up ci * upd MAO distributor class getter namings * updated generation scripts and decoupled multipass in base and registrar classes * added block range for getEvents * tests mock deployments, removed console logs * remove console logs * happy linter - happy life * added types node * lockfile * add readme and setup local dev script * env sertup process * fix bug * docstrings & readme upd * changeset * upodate docs generation * wip * wip * TDD game master * updates for monitor --------- Co-authored-by: theKosmoss <[email protected]>
- Loading branch information
1 parent
96c4b5c
commit 25ba1db
Showing
47 changed files
with
6,973 additions
and
3,006 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"rankify-js": minor | ||
--- | ||
|
||
added script to locally bring up development enviroment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"rankify-js": major | ||
--- | ||
|
||
adapted client library for rankify v0.10.0 release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Environment | ||
NODE_ENV="TEST" | ||
|
||
# RPC URLs | ||
FORK_RPC_URL="https://arb1.arbitrum.io/rpc" | ||
|
||
# Repository paths - update these to your local paths | ||
RANKIFY_CONTRACTS_PATH="/path/to/rankify/contracts" | ||
EDS_PATH="/path/to/eds" | ||
MULTIPASS_PATH="/path/to/multipass" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
branches: [main,staging] | ||
types: [opened, reopened, labeled, synchronize] | ||
env: | ||
NODE_ENV: 'TEST' | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: './.github/setup' | ||
- name: Building | ||
run: pnpm build | ||
- name: Linting | ||
run: pnpm lint:ci | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: './.github/setup' | ||
|
||
- name: Running tests | ||
run: pnpm test:ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ node_modules | |
.secrets | ||
/.idea/* | ||
.DS_Store | ||
src/abis | ||
.env | ||
docs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
dist | ||
coverage | ||
.changeset | ||
pnpm-lock.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"printWidth": 120, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": false, | ||
"trailingComma": "es5", | ||
"bracketSpacing": true, | ||
"arrowParens": "always" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,92 @@ | ||
# SDK | ||
|
||
This is SDK for use with Rankify game. You can use this to ease interaction with smart contracts | ||
This is SDK for use with Rankify game. You can ease interaction with smart contracts. | ||
|
||
## Prerequisites | ||
|
||
Before setting up the local development environment, ensure you have the following installed: | ||
|
||
1. **Node.js and pnpm** | ||
```bash | ||
# Using homebrew | ||
brew install node | ||
npm install -g pnpm | ||
``` | ||
|
||
2. **Foundry (for Anvil)** | ||
```bash | ||
curl -L https://foundry.paradigm.xyz | bash | ||
foundryup | ||
``` | ||
|
||
3. **tmux** | ||
```bash | ||
# Using homebrew | ||
brew install tmux | ||
``` | ||
|
||
## Local Development Setup | ||
|
||
To set up your local development environment: | ||
|
||
1. Create your environment file: | ||
```bash | ||
cp .env.example .env | ||
``` | ||
Then edit `.env` to set your local repository paths. | ||
|
||
2. Set the required environment variables: | ||
```bash | ||
export RANKIFY_CONTRACTS_PATH="/path/to/rankify/contracts" | ||
export EDS_PATH="/path/to/eds" | ||
export MULTIPASS_PATH="/path/to/multipass" | ||
``` | ||
|
||
3. Make the setup script executable: | ||
```bash | ||
chmod +x scripts/setup-local-dev.sh | ||
``` | ||
|
||
4. Run the setup script: | ||
```bash | ||
source .env && ./scripts/setup-local-dev.sh | ||
``` | ||
|
||
This will: | ||
- Start a local Anvil development network in a tmux session (or use existing one if running) | ||
- Install dependencies for all repositories | ||
- Run local deployment scripts (`playbook/utils/deploy-to-local-anvil.sh`) in each repository | ||
- Set up local pnpm links between packages | ||
|
||
The script uses a fixed mnemonic for consistent addresses across runs. | ||
|
||
### Managing Anvil | ||
|
||
- View Anvil logs: `tmux attach -t anvil` | ||
- Detach from logs: Press `Ctrl+B` then `D` | ||
- Stop Anvil: `tmux kill-session -t anvil` | ||
|
||
## Documentation | ||
|
||
The SDK comes with comprehensive API documentation generated using TypeDoc. The documentation is automatically generated during the package build process and is included in the npm package. | ||
|
||
### Generating Documentation | ||
|
||
To generate the documentation locally: | ||
|
||
```bash | ||
pnpm run docs | ||
``` | ||
|
||
This will create a `docs` directory with the generated documentation. | ||
|
||
For development, you can use the watch mode: | ||
|
||
```bash | ||
pnpm run docs:watch | ||
``` | ||
|
||
### Accessing Documentation | ||
|
||
- **Local Development**: Open `docs/index.html` in your browser after generating the documentation | ||
- **Published Package**: Documentation is available through the npm package page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,46 @@ | ||
import promise from "eslint-plugin-promise"; | ||
import globals from "globals"; | ||
import tsParser from "@typescript-eslint/parser"; | ||
import path from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
import js from "@eslint/js"; | ||
import { FlatCompat } from "@eslint/eslintrc"; | ||
import prettier from "eslint-plugin-prettier"; | ||
import tseslint from "typescript-eslint"; | ||
import prettierConfig from "eslint-config-prettier"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
allConfig: js.configs.all, | ||
}); | ||
|
||
export default [ | ||
export default tseslint.config( | ||
js.configs.recommended, | ||
...tseslint.configs.recommended, | ||
prettierConfig, | ||
{ | ||
ignores: ["deployments/", "coverage/**", "docs/templates/", "**/node_modules/"], | ||
// Base configuration for all files | ||
ignores: ["**/node_modules/**", "**/dist/**", "src/abis/*.ts", "scripts", "copyPackageFile.js"], | ||
}, | ||
...compat.extends("eslint:recommended", "plugin:promise/recommended", "prettier"), | ||
{ | ||
plugins: { | ||
promise, | ||
prettier, // Add Prettier plugin | ||
"@typescript-eslint": tseslint.plugin, | ||
}, | ||
// TypeScript files configuration | ||
files: ["**/*.ts"], | ||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
...globals.node, | ||
...globals.mocha, | ||
artifacts: "readonly", | ||
contract: "readonly", | ||
assert: "readonly", | ||
web3: "readonly", | ||
parserOptions: { | ||
project: ["./tsconfig.json", "./tsconfig.test.json"], | ||
tsconfigRootDir: ".", | ||
}, | ||
parser: tsParser, | ||
}, | ||
rules: { | ||
"no-unused-vars": "warn", | ||
"prettier/prettier": "error", // Add Prettier as an ESLint rule | ||
"@typescript-eslint/no-unused-vars": "warn", | ||
"@typescript-eslint/no-unsafe-member-access": "warn", | ||
"@typescript-eslint/no-unsafe-call": "warn", | ||
"@typescript-eslint/await-thenable": "warn", | ||
"@typescript-eslint/no-unsafe-assignment": "warn", | ||
"@typescript-eslint/no-require-imports": "off", | ||
}, | ||
files: ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"], | ||
}, | ||
]; | ||
{ | ||
// JavaScript files configuration | ||
files: ["**/*.js", "**/*.mjs", "**/*.cjs"], | ||
ignores: ["src/**/*.ts", "**/node_modules/**", "**/dist/**"], | ||
extends: [tseslint.configs.disableTypeChecked], | ||
languageOptions: { | ||
sourceType: "module", | ||
}, | ||
rules: { | ||
// Add JavaScript-specific rules here if needed | ||
}, | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** @type {import('jest').Config} */ | ||
export default { | ||
preset: "ts-jest/presets/default-esm", | ||
testEnvironment: "node", | ||
extensionsToTreatAsEsm: [".ts"], | ||
moduleNameMapper: { | ||
"^(\\.{1,2}/.*)\\.js$": "$1", | ||
}, | ||
transform: { | ||
"^.+\\.tsx?$": [ | ||
"ts-jest", | ||
{ | ||
useESM: true, | ||
}, | ||
], | ||
}, | ||
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.