1.33.0-development107 • Published 10 days ago

@opeslabs/sdk v1.33.0-development107

Weekly downloads
-
License
MIT
Repository
github
Last release
10 days ago

OPES SDK

Commitizen friendly

https://www.npmjs.com/package/@opeslabs/sdk

Getting started

  1. As this is intended to be an open-source project, we will want to first fork the original project that can be found here. Make sure you are added to the Github organization.
  2. Fork the project and clone it on your machine
  3. Set the remote upstream of the fork to point to the opeslabs repository
  4. Install the dependencies by running yarn install

Building

  1. In order to build the project, we have to run yarn build in order to generate all the transpiled files

Branching & Pull Requests

Current workflow is as follows:

  1. Make sure your main branch is up to date with the upstream
  2. Create a new feature-branch. This is where you will do most of the work regarding a feature. A common naming convention would be feat-#23/framer, where #23 is the issue in the organization's project.
  3. Commits will be linted and checked with commitizen, so it's easier when you want to commit some changes to run npx cz
  4. When you consider the branch to be done, create a pull request into the upstream/main branch from opeslabs and ask for reviewers
  5. After the PR is approved by 1 or more peers, you can merge it into the main
  6. After, you will want to sync your local main with the upstream main branch from the original opeslabs repository

Local development

Since this is an SDK, it does not do much on its own unless it's imported in another project.

If you want to take the latest version that's available on npm, you can simply run yarn add @opeslabs/sdk and then import whatever methods you need

If you want to test locally functionality that you've written inside the local SDK, we first need to:

  1. create a feature-branch
  2. implement your changes
  3. run yarn build in order to compile all files that will be used (a /lib folder will be generated)
  4. run npm i . -g in order to install this local version globally on your machine
  5. Then, in the project you want to test out the functionality, run npm link @opeslabs/sdk in order to link it to the globally installed package
  6. After you're done testing the integration, run npm unlink @opeslabs/sdk in order to remove the reference and then go back to using the NPM version by installing it with: yarn add @opeslabs/sdk

Using the SDK

Fetching the monsters list

  1. Login to you Metamask
  2. Filter for the NFTs in the Monster collection and map over the tokenId attribute (use Alchemy SDK or something similar)
  3. The above array of numbers will be passed as payload along with the env in the following API call from the SDK
import { getWaitingListGatekeepersByIds } from '@opeslabs/sdk/lib/services/waitinglist';

...

const response = await getWaitingListGatekeepersByIds({
  ids: nftIds,
  env: 'dev',
});

Fetching the monster's details

  1. nftId is equivalent to tokenId from the metamask account collection
import { getGatekeeperDetails } from '@opeslabs/sdk/lib/services/waitinglist';

...

const apiMonsterNFT = await getGatekeeperDetails({
  gatekeeperId: nftId,
  env: 'dev',
});

Deployment

When the feature is ready and you've tested locally that it's working (check above), we want to deploy it to npm

  1. First we make sure we're on the feature branch
  2. Bump the package version
  3. Stage & commit the files & push it to the branch
  4. Open a PR into the upstream main
  5. Ask for reviews and once they're approved merge the PR
  6. Publish the package by running npm --access public publish
  7. Sync your forked main with the upstream main
  8. Create a release tag in Github with the version from the package.json

Deploying

  1. Log in to npm
  2. Perform necessary changes
  3. Run yarn build
  4. Increase version in package.json
  5. Stage & commit & push into your fork's main and then merge it
  6. Open PR into upstream and ask for reviews
  7. Merge PR
  8. Run npm --access public publish
  9. Create a release tag in Github with the version from the package.json

Perfomance

We're using k6.io to run performance testing, stress testing, load testing etc...

Installation

Make sure you have installed k6 on your machine with brew install k6.

We won't use the Graphana/Cloud runtime from their end right now, we will currently run the tests locally on our machines.

Tests are writter in the /test/performance folder.

Note:

Unfortunately you cannot import the query/mutation from the **/mutations folders directly, so you will just have to paste the string and pass it to the buildRequest wrapper. K6 is written in go so it doesn't understand TS or node modules (like graphql-request or gql)

Terminology:

  • vus: virtual users
  • duration: how long the stress test should run (you can swap this with stages if you need ramping up/down etc)
  • thresholds - threhsholds of interest like avg response time, rate of failure in percentage etc..

Running a performance test

In the terminal run:

k6 run test/performance/waitlist/getTopics.ts

1.29.0

9 months ago

1.29.1

8 months ago

1.29.2

8 months ago

1.27.14-next.3

7 months ago

1.27.14-next.4

7 months ago

1.27.14-next.1

7 months ago

1.27.14-next.2

7 months ago

1.32.0

7 months ago

1.32.1

7 months ago

1.27.16

10 months ago

1.27.15

10 months ago

1.27.18

10 months ago

1.27.17

10 months ago

1.27.12

10 months ago

1.27.11

10 months ago

1.27.14

10 months ago

1.27.13

10 months ago

1.27.10

10 months ago

1.31.10

7 months ago

1.31.11

7 months ago

1.31.12

7 months ago

1.30.6

8 months ago

1.30.4

8 months ago

1.30.5

8 months ago

1.26.0

10 months ago

1.31.5

8 months ago

1.31.6

8 months ago

1.31.3

8 months ago

1.31.4

8 months ago

1.31.9

8 months ago

1.31.7

8 months ago

1.31.8

8 months ago

1.32.0-alpha.2

8 months ago

1.32.0-alpha.1

8 months ago

1.33.0-development

7 months ago

1.27.2

10 months ago

1.27.3

10 months ago

1.32.0-alpha.4

8 months ago

1.27.0

10 months ago

1.32.0-alpha.3

8 months ago

1.27.1

10 months ago

1.27.6

10 months ago

1.27.7

10 months ago

1.27.4

10 months ago

1.27.5

10 months ago

1.27.8

10 months ago

1.27.9

10 months ago

1.30.2

8 months ago

1.30.3

8 months ago

1.30.0

8 months ago

1.30.1

8 months ago

1.28.1

9 months ago

1.28.2

9 months ago

1.31.1

8 months ago

1.31.2

8 months ago

1.31.0

8 months ago

1.25.1

11 months ago

1.25.2

11 months ago

1.25.0

11 months ago

1.21.3

1 year ago

1.22.0

1 year ago

1.22.1

1 year ago

1.22.2

1 year ago

1.23.2

12 months ago

1.23.3

12 months ago

1.23.0

12 months ago

1.23.1

12 months ago

1.24.16

11 months ago

1.24.14

11 months ago

1.24.15

11 months ago

1.24.12

11 months ago

1.24.13

11 months ago

1.24.10

11 months ago

1.24.11

11 months ago

1.24.1

12 months ago

1.24.2

12 months ago

1.24.0

12 months ago

1.24.5

12 months ago

1.24.6

11 months ago

1.24.3

12 months ago

1.24.4

12 months ago

1.24.9

11 months ago

1.24.7

11 months ago

1.24.8

11 months ago

1.8.2

1 year ago

1.21.0

1 year ago

1.21.1

1 year ago

1.21.2

1 year ago

1.9.0

1 year ago

1.7.2

1 year ago

1.20.10

1 year ago

1.20.11

1 year ago

1.20.1

1 year ago

1.20.2

1 year ago

1.20.0

1 year ago

1.20.5

1 year ago

1.20.6

1 year ago

1.20.3

1 year ago

1.20.4

1 year ago

1.20.9

1 year ago

1.20.7

1 year ago

1.20.8

1 year ago

1.2.0

1 year ago

1.6.4

1 year ago

1.6.3

1 year ago

1.6.2

1 year ago

1.6.1

1 year ago

1.6.0

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.10

1 year ago

1.3.13

1 year ago

1.3.14

1 year ago

1.3.11

1 year ago

1.3.12

1 year ago

1.3.17

1 year ago

1.3.18

1 year ago

1.3.15

1 year ago

1.3.16

1 year ago

1.3.19

1 year ago

1.6.11

1 year ago

1.3.20

1 year ago

1.6.10

1 year ago

1.3.21

1 year ago

1.3.9

1 year ago

1.6.12

1 year ago

1.3.8

1 year ago

1.3.24

1 year ago

1.3.22

1 year ago

1.3.23

1 year ago

1.3.7

1 year ago

1.3.6

1 year ago

1.7.1

1 year ago

1.5.3

1 year ago

1.3.5

1 year ago

1.7.0

1 year ago

1.5.2

1 year ago

1.3.4

1 year ago

1.5.1

1 year ago

1.3.3

1 year ago

1.5.0

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.6.0-alpha

1 year ago

1.6.9

1 year ago

1.6.8

1 year ago

1.6.7

1 year ago

1.6.6

1 year ago

1.6.5

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago