@consensys/on-ramp-sdk
TypeScript icon, indicating that this package has built-in type declarations

2.1.8 • Public • Published

On-Ramp SDK

Getting started

  • Please make sure that there is either a deployed OnRamp API service or you are running it localy.
  • Install the SDK package from the archive.
  • Import the on ramp sdk with this line of code: import {OnRampSdk} from '@codefi/on-ramp-sdk'

On-Ramp SDK

To facilitate back-end interaction, a SDK can be used.

You can use it like this:

const sdk: IOnRampSdk = await OnRampSdk.getSDK(
  Environment.Staging,
  Context.Mobile,
  {
    verbose: true,
    maxInstanceCount: 1,
  },
)

Local Development with MetaMask Portfolio

To connect a local instance of the SDK to a local MetaMask Portfolio client, follow these steps:

1. Update SDK Configuration

  1. Open the tsconfig.json file in the SDK project.
  2. Modify the module and moduleResolution properties as follows:
    {
      "compilerOptions": {
        "module": "esnext",
        "moduleResolution": "node"
        // other configurations
      }
    }

2. Link SDK to Portfolio

  1. In the SDK project directory, run the following command to create a symbolic link:

    yarn link
  2. In the Portfolio project directory, link the SDK by running:

    yarn link @consensys/on-ramp-sdk
  3. Remove the cache to ensure the changes take effect:

    rm -rf node_modules/.cache

3. Install Dependencies

  1. In the Portfolio project directory, install the necessary packages:
    yarn install

4. Update Vite Configuration

  1. Open the vite.config.js file in the Portfolio project.
  2. Add the following configuration to exclude the SDK from dependency optimization:
    export default {
      // other configurations
      optimizeDeps: {
        exclude: ['@consensys/on-ramp-sdk'],
      },
    }

5. Rebuild After SDK Changes

Whenever you make changes to the SDK, remember to rebuild the project to reflect those changes in the Portfolio client:

yarn build

Readme

Keywords

none

Package Sidebar

Install

npm i @consensys/on-ramp-sdk

Weekly Downloads

5,811

Version

2.1.8

License

ISC

Unpacked Size

440 kB

Total Files

71

Last publish

Collaborators

  • gustavorssilva
  • stanleyyuen
  • jones.ho
  • rizedr
  • pmkowalski
  • klejeune-consensys
  • victorien-gauch
  • wantedsystem
  • leo.wang
  • becali12
  • andreolf
  • marioac
  • jluque-npm
  • consensys-npm
  • consensys_jb
  • cxalem1
  • leifdejong