alephium-web3
v0.9.3
Published
Alephium Web3.js
Downloads
22
Readme
Alephium TypeScript API
A JavaScript/TypeScript library for building decentralized applications on the Alephium platform.
You could run the following command to scaffold a skeleton project for smart contract development.
npx alephium-web3 <project-dir> [-t template-name]
Install
npm install alephium-web3
💥 Until our SDK is stable, breaking changes will be introduced in minor versions (instead of the traditional major versions of semver). We recommend allowing patch-level updates and to always read the release notes for breaking changes.
// package.json
{
"dependencies": {
"alephium-web3": "X.Y.Z"
}
}
Development
Update schemas
One first needs to update the version number of alephium
and explorer-backend
in package.json
. Kindly note that one needs to check the compatibility of both OpenAPI files manually.
Typings can automatically generated using the following command:
npm run update-schemas
Packaging
We need to include the .gitignore
file inside the npm package so that it can be used by the dist/cli/create-project.js
script. To do that we define the prepack
and postpack
npm scripts that will rename the .gitignore
file to gitignore
, pack it into the package, and rename it back to .gitignore
. Similar approach has been followed by create-react-app
1.
Release
To release a new version:
Create a commit that updates the package version in package.json and package-lock.json and a tag with:
npm version patch # if you want to bump the patch version, without breaking changes npm version minor # if you want to bump the minor version, with breaking changes npm version prerelease --preid=rc # if you want to create a release candidate
Push the tag to GitHub and trigger the publish workflow that will publish it on NPM with:
git push [remote] <tag>
Unless you are on
master
, create a new branch and push it to GitHub so that the tagged commit belongs to a branch of this repo with:git checkout -b <tag> git push
Otherwise, just push to
master
.
Compile
Compile the TypeScript files into JavaScript:
npm run build
Testing
npm run start-devnet # this will start a devnet for smart contract tests
npm test
or, to watch for changes:
npm run test:watch