@consensys/on-ramp-sdk

中文文档
2.1.14发布于 2026/07/02ISCTypeScriptCommonJS近 30 天下载 12.9万

Getting started

此软件包已被标记为弃用

This package is deprecated. Use @metamask/money-mvmt-sdk instead.

原始使用文档
文档目录8 节
  1. Getting started
  2. On-Ramp SDK
  3. Local Development with MetaMask Portfolio
  4. 1. Update SDK Configuration
  5. 2. Link SDK to Portfolio
  6. 3. Install Dependencies
  7. 4. Update Vite Configuration
  8. 5. Rebuild After SDK Changes

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
      }
    }
    
  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

版本与发布记录

@consensys/on-ramp-sdk 共发布 247 个版本,首次发布于 2022/04/06;过去 12 个月发布了 2 个版本。

版本发布日期距今
2.1.14latest2026/07/024 个月前
2.1.132026/06/045 个月前
2.1.122025/10/301 年前
2.1.112025/09/131.2 年前
2.1.102025/05/291.5 年前
2.1.92025/05/291.5 年前

其他发布通道:beta → 1.28.7-beta.2。

关于 @consensys/on-ramp-sdk 的常见问题

@consensys/on-ramp-sdk 是什么?

Getting started注意:该包已被作者标记为弃用——This package is deprecated. Use @metamask/money-mvmt-sdk instead.

如何安装 @consensys/on-ramp-sdk?

在项目目录运行 npm install @consensys/on-ramp-sdk,或使用 pnpm add / yarn add / bun add。

@consensys/on-ramp-sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@consensys/on-ramp-sdk 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@consensys/on-ramp-sdk 可以商用吗?

@consensys/on-ramp-sdk 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@consensys/on-ramp-sdk 的下载量有多少?

根据 npm 官方下载统计,@consensys/on-ramp-sdk 在 2026/10/11 – 2026/11/09 这 30 天内被下载 129,043 次,日均约 4,301 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@consensys/on-ramp-sdk 还在维护吗?

最新版本 2.1.14 发布于 2026/07/02(4 个月前);至今共发布 247 个版本,其中过去 12 个月发布了 2 个;首次发布于 2022/04/06。作者已将其标记为弃用,新项目建议寻找替代方案。