UNPKG

3.15 kBMarkdownView Raw
1# ๐Ÿ”ฅ @effectai/effect-js
2
3<p align="center"><img src="https://effect.network/img/logo/logo.png" width="400px"></p>
4
5Effect Network SDK for integration with [https://effect.network](https://effect.network)
6
7## โœ’๏ธ Installation
8
9The official distribution for the package is available at [npm](https://www.npmjs.com/package/@effectai/effect-js).
10Note that the module available under the `@effectai/effect-js` namespace is for ECMAScript modules, if you want to use the module in a CommonJS environment (require), you can use the `@effectai/effect-js@cjs` module.
11Note, that if you are using NodeJS, the minimum version required is `v18`.
12
13### ESM
14
15```bash
16npm i @effectai/effect-js
17```
18
19```js
20import { EffectSdk } from "@effectai/effect-js";
21```
22
23### CommonJS
24
25```bash
26npm i @effectai/effect-js@cjs
27```
28
29```js
30const { EffectSdk } = require("@effectai/effect-js");
31```
32
33## Quickstart
34
35Take a look at the quick start [guide](https://developer.effect.network/quickstart/) to understand how to install and use the library.
36
37## SDK-Reference
38
39The SDK reference is available here: [SDK-Reference](https://effectai.github.io/effect-js/)
40
41## ๐Ÿฆ‹ Development
42
43The best way to get to know how this module works is by adding features while you can run it. So there are some examples provided to provide an idea of how to create a transaction with the Effect Network.
44
45Clone the project
46
47```bash
48git clone https://github.com/effectai/effect-js.git
49```
50
51Install dependencies and dev-dependencies
52
53```bash
54npm ci
55```
56
57It is now possible to start compiling the typescript files to the module spec of your choice, for now, the following module specs are supported: [ESM, CommonJS]
58
59```bash
60npm run build # esmodules
61npm run build:cjs # commonjs
62```
63
64Link it. Now it is possible to use `npm link` to link the compiled typescript code to your project, from the directory of your project, run the following command.
65
66```bash
67npm link /path/to/effect-js/
68```
69
70From your project folder, you should be able to import the compiled code from `effect-js`. Depending on your environment, use `import` or `require` as [described above](## โœ’๏ธ Installation).
71
72## ๐Ÿงช Testing
73
74The testing framework used for this project is [ViTest](https://vitest.dev) and is configured to run the tests in the `test` directory.
75Remember to copy the `test/.env.test.example` file to `test/.env.test` and fill in the values for your environment.
76Currently, these variables are required:
77
78- `VITE_EOSACC=yourEosAccountName`
79- `VITE_EOSPERM=yourEosAccountPermission`
80- `VITE_EOSPK=yourEosAccountPrivateKey`
81
82```bash
83cp test/.env.test.example test/.env.test
84
85npm run test
86# OR
87npm run test:watch
88```
89
90## ๐Ÿ—ž Publishing
91
92Run the following command to build the source, increment the version, and publish the `dist` transpile code and types to the npm repository, assuming you have the correct credentials.
93
94Make sure the git is clean, and everything has been committed, and run the following.
95
96```bash
97npm run publish:public
98```
99
100Running `publish:next` will publish a pre-release of the SDK to the npm repository. Users will need to explicitly opt-in to use it.
101
102```bash
103npm run publish:next
104```