@0xmonaco/contracts

中文文档
1.1.9发布于 2026/11/07TypeScriptES Module近 30 天下载 8394

Smart contract ABIs and sweeper deposit-address helpers for the Monaco protocol. Resolve deployed addresses, such as the vault, through the Monaco SDK.

原始使用文档
文档目录10 节
  1. Installation
  2. Usage
  3. Contract ABIs
  4. Contract Overview
  5. Core Protocol Contracts
  6. Network Support
  7. ABI Reference
  8. Development
  9. Adding New Contracts
  10. Best Practices

@0xmonaco/contracts

Smart contract ABIs and sweeper deposit-address helpers for the Monaco protocol. Resolve deployed addresses, such as the vault, through the Monaco SDK.

Installation

npm install @0xmonaco/contracts

Note: This package is typically installed as a dependency of @0xmonaco/core or @0xmonaco/types, but you can install it directly if you only need contract ABIs.

Usage

Contract ABIs

Use CONTRACT_ABIS with the vault address the Monaco SDK resolves for the network:

import { CONTRACT_ABIS } from "@0xmonaco/contracts";
import { createPublicClient, http } from "viem";
import { sei } from "viem/chains";

// Resolve the vault address from the Monaco SDK (Sei mainnet, chain ID 1329)
const vaultAddress = await sdk.vault.getVaultAddress();

const client = createPublicClient({
  chain: sei,
  transport: http("https://evm-rpc.sei-apis.com"),
});

const vaultContract = {
  address: vaultAddress,
  abi: CONTRACT_ABIS.vault,
  client,
};

Contract Overview

Core Protocol Contracts

Vault

  • Manages user balances and deposits
  • Handles token transfers for trades
  • Ensures secure fund management

Sweeper

  • Per-(application, user) deposit addresses created through a CREATE2 factory
  • predictSweeperAddress and the related helpers derive an address before it is deployed

Network Support

  • Sei mainnet (pacific-1)
    • Chain ID: 1329

ABI Reference

The package exports a consolidated CONTRACT_ABIS object:

import { CONTRACT_ABIS } from "@0xmonaco/contracts";

const vaultAbi = CONTRACT_ABIS.vault;

Available ABIs in CONTRACT_ABIS:

  • vault: Vault contract interface
  • sweeper: Per-(application, user) sweeper deposit address interface
  • sweeperFactory: CREATE2 sweeper factory interface

Development

Adding New Contracts

  1. Create a new file in src/abis/ for the contract ABI
  2. Export the ABI as a named constant
  3. Add the export to src/abis/index.ts
  4. Add the ABI to CONTRACT_ABIS in src/index.ts

Best Practices

  • Keep ABIs up to date with deployed contracts
  • Document any breaking changes
  • Maintain backward compatibility when possible

版本与发布记录

@0xmonaco/contracts 共发布 183 个版本,首次发布于 2025/08/28;过去 12 个月发布了 174 个版本。

版本发布日期距今
1.1.9latest2026/11/071 天前
1.1.82026/11/061 天前
1.1.72026/11/052 天前
1.1.62026/11/053 天前
1.1.5-prerelease.de852e2prerelease-1.1.62026/11/044 天前
1.1.5-develop.129b2c6develop2026/11/044 天前

其他发布通道:prerelease-1.0.40 → 1.0.39-prerelease.19d492d,develop → 1.1.5-develop.129b2c6,prerelease-1.1.6 → 1.1.5-prerelease.de852e2。

关于 @0xmonaco/contracts 的常见问题

@0xmonaco/contracts 是什么?

Smart contract ABIs and sweeper deposit-address helpers for the Monaco protocol. Resolve deployed addresses, such as the vault, through the Monaco SDK.

如何安装 @0xmonaco/contracts?

在项目目录运行 npm install @0xmonaco/contracts,或使用 pnpm add / yarn add / bun add。

@0xmonaco/contracts 支持 TypeScript 吗?

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

@0xmonaco/contracts 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@0xmonaco/contracts 可以商用吗?

@0xmonaco/contracts 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@0xmonaco/contracts 的下载量有多少?

根据 npm 官方下载统计,@0xmonaco/contracts 在 2026/10/04 – 2026/11/02 这 30 天内被下载 8,394 次,日均约 280 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@0xmonaco/contracts 还在维护吗?

最新版本 1.1.9 发布于 2026/11/07(1 天前);至今共发布 183 个版本,其中过去 12 个月发布了 174 个;首次发布于 2025/08/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。