Skip to content

Latest commit

 

History

History
227 lines (168 loc) · 10.3 KB

README.md

File metadata and controls

227 lines (168 loc) · 10.3 KB

Rarimo JS SDK

Rarimo JavaScript/Typescript SDK

Rarimo is a multichain protocol developed to solve the problems of liquidity, access, and interoperability across non-fungible and fungible use-cases. This suite of tools in this SDK makes it easy to build ground-breaking integrations on top of our technology.

Example

For a complete running example, see @rarimo/nft-checkout.

For example applications, see rarimo/js-sdk-examples on GitHub.

Changelog

For the change log, see CHANGELOG.md.

API documentation

The full API documentation is hosted at rarimo.github.io/js-sdk. This is Typedoc-generated documentation. It is helpful if you want to look up details for advanced use cases. This documentation is auto-generated based on the current main branch and can diverge from the latest release.

Packages

The Rarimo SDK is a library that consists of many smaller NPM packages within the @rarimo namespace.

Token swapping, bridging, and checkout packages

Package Description Latest
@rarimo/shared Utility functions, types, and constants shared across Rarimo packages. npm version
@rarimo/bridge Internal tools that other Rarimo packages use to bridge tokens. npm version
@rarimo/swap Internal tools that other Rarimo packages use to swap tokens. npm version
@rarimo/provider A common interface for access to wallets (EVM and non-EVM) in the Rarimo SDK, used by packages that provide access to wallets on specific chains. npm version
@rarimo/providers-evm Features of the Rarimo SDK that provide access to wallets and the ability to interact with them on EVM-compatible blockchains. npm version
@rarimo/providers-solana Features of the Rarimo SDK that provide access to wallets and the ability to interact with them on the Solana blockchain. npm version
@rarimo/providers-near Features of the Rarimo SDK that provide access to wallets and the ability to interact with them on the NEAR blockchain. npm version
@rarimo/nft-checkout Features of the Rarimo SDK that create cross-chain transactions based on the Rarimo protocol. npm version
@rarimo/react-provider Tools to connect to wallets in React applications through the Rarimo SDK. npm version
@rarimo/react-nft-checkout Features of the Rarimo SDK that provide React components to manage cross-train transactions with the Rarimo protocol. npm version

Other packages

Package Description Latest
@rarimo/client The Rarimo Core client npm version

Known issues

React

To use such packages as @rarimo/provider and @rarimo/nft-checkout in React project, created with create-react-app you need to add craco package and config to resolve the ESM version:

yarn add -D @craco/craco

Next, in the root of your project (where package.json is located) create a file named craco.config.js with the following content:

module.exports = {
  webpack: {
    configure: {
      module: {
        rules: [
          {
            test: /\.m?js$/,
            resolve: {
              fullySpecified: false,
            },
          },
        ],
      },
    },
  },
}

This config disables the breaking change that causes this error.

Then change the start/build/test commands in package.json replacing react-scripts to craco:

{
  "scripts": {
    "start": "craco start",
    "build": "craco build",
    "test": "craco test"
  }
}

Development

Editors

VSCode

To get ESLint and Prettier working in VSCode, install ESLint extension and add the following to your settings.json:

{
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
  "editor.formatOnSave": true,
  "eslint.validate": [
    "javascript",
    "typescript"
  ],
  "eslint.alwaysShowStatus": true,
  "eslint.packageManager": "yarn",
  "eslint.workingDirectories": [{ "mode": "auto" }]
}

WebStorm

To get ESLint and Prettier working in WebStorm, go to Preferences > Languages & Frameworks > JavaScript > Code Quality Tools > ESLint and check the following:

  • Run eslint --fix on save enabled
  • Automatic ESLint configuration enabled
  • {**/*,*}.{js,ts} in Run for files field

Dependencies

Local dependencies

To install all dependencies, run:

yarn install

If you are implementing a new package which needs to depend on the local package, you can use the following command to install it:

yarn workspace @rarimo/target-package add @distributedlab/package-to-add

To install a dependency to all packages, use the following command:

yarn workspaces foreach -pt run add @rarimo/package-to-add

Testing dependencies

To test the packages, you need:

  1. Build the packages:

    yarn build
  2. Switch yarn to version berry in the project where you want to test package, to yarn be able to resolve workspace dependencies:

    yarn set version berry
  3. Add this to the .yarnrc.yml file:

    nodeLinker: node-modules
  4. Link the packages to the project:

    yarn link -p -A /path/to/js-sdk/root/directory
  5. Add dependencies to the package.json file:

    {
      "dependencies": {
        "@rarimo/provider": "*"
      }
    }
  6. Install the dependencies:

    yarn install

Basics

Build

yarn build

Run tests

yarn test

Run linter

yarn lint

Check release version

yarn rsc 0.1.0

Bump version for all packages

yarn apply-version 0.1.0

Resources