// make sure to configure your build environment as described below
npm i --save @zkfs/contract-api@latest
🚨 You will have to configure your build environment to resolve some of the relative imports temporarily used within ZKFS libraries, you can find out how and why in this issue.
⚠️ ZKFS is currently being shipped as a development preview, containing a limited subset of features. As of now, you can use ZKFS in your test suite using @zkfs/contract-api@latest. Next step is to ship a UI development kit, with a fully fledged ZKFS node/peer.
import { method, UInt64 } from 'snarkyjs';
import {
offchainState,
OffchainStateContract,
OffchainState,
} from '@zkfs/contract-api';
class Counter extends OffchainStateContract {
@offchainState() public count = OffchainState.fromRoot<UInt64>(UInt64);
public init() {
super.init();
this.count.set(UInt64.from(0));
}
@method
public update() {
const currentCount = this.count.get();
const newCount = currentCount.add(1);
this.count.set(newCount);
}
}
When contributing, please keep the following in mind:
- Use the
git flow
convention for branch names:feature/*
- Feature branches shall be created only for corresponding issues and named accordingly, such as
feature/#1-development-release-workflow
- Feature branches shall be created only for corresponding issues and named accordingly, such as
develop
release/<package-name>@<version>
.e.g.:release/@zkfs/[email protected]
- Alternatively, in case of a multi package release, feel free to use an arbitrary release name (release/*)
- Follow
commitizen's conventional-changelog
commit message format- Use
npm run commit
and you'll be presented with a commitizen prompt walking you through writing the commit message properly.
- Use
- Each pull request for the develop branch must pass the underlying workflows for lint/test/build.
- There are a few git hooks configured to help you validate commit contents before pushing:
pre-commit
: validates staged filespre-push
: validates branch names
- Releases and changelog generation shall happen after merging from
release/*
todevelop
- Changelog and semver increments are generated automatically from conventional commits. All commits are included together with a merge commit, so that the changelog and semver can be deducted automatically.
- Releases happen automatically on merge to develop (@alpha releases)
You can keep track of the work being done across all ZKFS repositories in the ZKFS Github project.
In order to run github workflows locally, you need to install act
. This is especially useful when developing changes to the CI/CD pipeline. Afterwards you should be able to run the following:
# run all workflows tied to pull_request(s)
act pull_request