📦 Install dKiT SDK
▶️ dKiT Demo
A minimal example of how to build a dex using the @doritokit/sdk
Scaffold
Skip if you have an existing project.
To scaffold the project, we are going to use vite with the react-ts template. Feel free to pick a different vite template or replace vite with the build tool of your choice. The bottom line is that you are able to process javascript modules.
As for the package manager, in this example, we are going to use bun
. Though you may as well opt for npm
, yarn
, pnpm
or deno
.
Make sure to replace my-app
with your project name.
Once the project is scaffolded, cd into the newly created directory.
Configure package resolutions
Pin the following dependency versions in package.json
using resolutions. In the case of npm
reference overrides. Either by manually updating the resolutions section in your package.json
Or by running the command (which requires jq to be in the path):
Install
In respect to the package manager you chose prior, install the @doritokit/sdk
which will also install the rest of the project's dependencies.
Configure polyfills and globals
Node.js globals Buffer
and global
need to be polyfilled. If you're using vite, it's as easy as installing and configuring vite-plugin-node-polyfills. Firstly, add the vite-plugin-node-polyfills
package as a development dependency:
For a concrete example reference the project's vite.config.ts
, specifically, the plugins section:
Configure tsconfig.json (if applicable)
The lowest supported tsconfig.json
target is ES2022 and also requires lib ES2022 to be specified, due to usage of Error.cause
.
Because of the usage of enum
s, the erasableSyntaxOnly compilerOption
in your tsconfig.json
has to be turned off.
Below is a minimal example. For a more realistic configuration look up the project's tsconfig.app.json
.
Start the dev server
In the context of a vite project, by convention the script to run the development server is called dev
.
With the dev server running, navigate to http://localhost:3000
where 3000
is to be replaced with the custom port number or the vite default 5173
.
Join our Community →
Any other questions? Book a Call →