@audius/eth

中文文档
1.0.0发布于 2026/03/18Apache-2.0TypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 4209

The core Typescript mappings to the Audius Ethereum Contracts

原始使用文档
文档目录7 节
  1. Installation
  2. Usage
  3. Check pending rewards claim
  4. Read a governance proposal
  5. Look up service provider endpoints
  6. EIP-2612 permit (gasless approval)
  7. Contracts

@audius/eth

Typed ABIs and production addresses for the Audius Ethereum contracts. Designed for use with viem and fully tree-shakable — import only the contracts you need.

Installation

npm install @audius/eth viem

Usage

Each contract export is a plain object with abi and address:

import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'
import { Staking } from '@audius/eth'

const client = createPublicClient({
  chain: mainnet,
  transport: http()
})

const totalStaked = await client.readContract({
  ...Staking,
  functionName: 'totalStaked'
})

Check pending rewards claim

import { ClaimsManager } from '@audius/eth'

const isPending = await client.readContract({
  ...ClaimsManager,
  functionName: 'claimPending',
  args: ['0xYourServiceProviderAddress']
})

Read a governance proposal

import { Governance } from '@audius/eth'

const proposal = await client.readContract({
  ...Governance,
  functionName: 'getProposalById',
  args: [1n]
})

Look up service provider endpoints

import { ServiceProviderFactory, VALIDATOR_SERVICE_TYPE } from '@audius/eth'

// Get the total number of validators
const total = await client.readContract({
  ...ServiceProviderFactory,
  functionName: 'getTotalServiceTypeProviders',
  args: [VALIDATOR_SERVICE_TYPE]
})

// Get the endpoint info for the first one
const info = await client.readContract({
  ...ServiceProviderFactory,
  functionName: 'getServiceEndpointInfo',
  args: [VALIDATOR_SERVICE_TYPE, 1n]
})

EIP-2612 permit (gasless approval)

AudiusToken and AudiusWormhole include domain and types for EIP-712 signing:

import { AudiusToken } from '@audius/eth'

const signature = await walletClient.signTypedData({
  domain: {
    ...AudiusToken.domain,
    chainId: 1,
    verifyingContract: AudiusToken.address
  },
  types: AudiusToken.types,
  primaryType: 'Permit',
  message: {
    owner: '0x...',
    spender: '0x...',
    value: 1000000000000000000n,
    nonce: 0n,
    deadline: 99999999999n
  }
})

Contracts

ExportDescription
AudiusTokenThe AUDIO ERC-20 token. Mintable, pausable, burnable. Supports EIP-2612 permit().
AudiusWormholeSends AUDIO cross-chain via Wormhole with meta-transaction support.
ClaimsManagerPeriodic minting and distribution of AUDIO staking rewards.
DelegateManagerDelegation of AUDIO tokens to service providers with lockup periods.
EthRewardsManagerTransfers AUDIO rewards from Ethereum to Solana via Wormhole.
GovernanceOn-chain governance: proposals, stake-weighted voting, execution.
RegistryCentral directory mapping contract names to addresses.
ServiceProviderFactoryRegistration and staking for discovery nodes and content nodes.
ServiceTypeManagerRegistry of valid service types and their versions.
StakingCore staking contract holding all staked AUDIO with checkpointing.
TrustedNotifierManagerRegistry of trusted notifier entities.

版本与发布记录

@audius/eth 共发布 3 个版本,首次发布于 2024/11/06;过去 12 个月发布了 1 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.0.0latest2026/03/187 个月前
0.1.02025/01/181.8 年前
0.0.12024/11/062 年前

关于 @audius/eth 的常见问题

@audius/eth 是什么?

The core Typescript mappings to the Audius Ethereum Contracts

如何安装 @audius/eth?

在项目目录运行 npm install @audius/eth,或使用 pnpm add / yarn add / bun add。

@audius/eth 支持 TypeScript 吗?

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

@audius/eth 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@audius/eth 可以商用吗?

@audius/eth 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@audius/eth 的下载量有多少?

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

@audius/eth 还在维护吗?

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