This monorepo contains individual OpenZeppelin Defender TypeScript clients and publishes the collection of clients as @openzeppelin/defender-sdk
For detailed instructions on how to use the SDK, please refer to our SDK Documentation.
-
pnpm
for workspaces & dependency management. -
nx
for build & tests. -
changesets
for versioning, changelog management & publishing. -
Checkout the repo and run
pnpm i --ignore-scripts --prefer-offline && pnpm run build
.Install pnpm globally with
npm i -g pnpm
if you haven't already. -
To skip cache on the subsequent build steps you can use
pnpm nx-build-skip-cache
.
- Run
pnpm nx-test-skip-cache
to run unit tests across all packages.
- Run
pnpm lint:check
orpnpm prettier:check
at the project root. For fixingpnpm lint:fix
- Run
pnpm nx-build-test-skip-cache
.
The examples
repo has sample code - note that most examples rely on dotenv
for loading API keys and secrets.
You can set the following environment variables to control to which instance your client will connect to:
# all modules/clients besides relay signer
DEFENDER_API_URL=
DEFENDER_POOL_ID=
DEFENDER_POOL_CLIENT_ID=
# relay signer
DEFENDER_RELAY_SIGNER_API_URL=
DEFENDER_RELAY_SIGNER_POOL_ID=
DEFENDER_RELAY_SIGNER_POOL_CLIENT_ID=
- For time being the manual process is as follows until CI/CD is fixed.
- Run
npx changeset
to select specific packages to bump ( use up & down arrows to navigate, space to select specific packages). This will create a new changeset file in./changesets
folder. Update changelog in changeset file if needed usingfeat:
,fix:
,docs:
,chore:
orrefactor:
prefixes. - Create a PR with changeset file.
- After the PR is approved & merged. Changeset bot will automatically create a PR deleting the changeset file and bumping the package version & updates changelog. This PR will not automatically update the package version/dependencies in
package.json
file. You will have to manually push the change to this PR updating package version/version of@openzeppelin/defender-sdk-base-client
inpackage.json
file and runpnpm i --ignore-scripts --prefer-offline
to make sure pnpm lock file is updated. - After the PR is approved & merged make sure to run build & tests uisng
pnpm build-skip-nx-cache
&&pnpm test-skip-nx-cache
. - After the tests passes run
npx changeset publish
this publishes the packages to npm. - Finally push tags ( make sure you are signing tags before pushing ) to git
git push --follow-tags
.
- Run
- We use github actions for CI/CD. See workflows for more info.
ci.yml
- runs on every push to any branch --> runs tests.
- We use slsa framework pronounced "salsa" for reproducible builds & secure pushes. Verification is done using provenance