Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@futureverse/evm

Package Overview
Dependencies
Maintainers
17
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@futureverse/evm

A utility package that simplifies EVM development on The Root Network.

latest
npmnpm
Version
1.1.0
Version published
Maintainers
17
Created
Source

@futureverse/evm

A utility package that simplifies EVM development on The Root Network.

Install

npm i @futureverse/evm

Usage

import {
  collectionIdToERC721Address,
  ERC721_PRECOMPILE_ABI,
} from '@futureverse/evm';

import { createPublicClient, http } from 'viem';
import { root } from 'viem/chains';

// Create a viem client
const client = createPublicClient({
  chain: root,
  transport: http(),
});

// `owner` is automatically typed as `Address`
const owner = await client.readContract({
  address: collectionIdToERC721Address(17508)
  abi: ERC721_PRECOMPILE_ABI,
  functionName: 'ownerOf', // Strongly typed ABI gives you autocomplete for function names
  args: [3248n] // Gives type errors for args which don't match the ABI function inputs
})

API

ABIs

ABIDescription
ERC20_ABIABI for the ERC-20 standard
ERC721_ABIABI for the ERC-721 standard
ERC1155_ABIABI for the ERC-1155 standard
NFT_PRECOMPILE_ABIABI for the nft pallet
SFT_PRECOMPILE_ABIABI for the sft pallet
FEE_PROXY_PRECOMPILE_ABIABI for feeProxy pallet
FUTUREPASS_PRECOMPILE_ABIABI for a futurepass account
FUTUREPASS_REGISTRAR_PRECOMPILE_ABIABI for futurepass pallet
DEX_PRECOMPILE_ABIABI for the dex pallet
OWNABLE_ABIABI for the ownable interface
MARKETPLACE_PRECOMBILE_ABIABI for the marketplace pallet
MULTICALL3_ABIABI for the multicall3 contract

Addresses

AddressDescription
NFT_PRECOMPILE_ADDRESS: stringPrecompile address for nft pallet
SFT_PRECOMPILE_ADDRESS: stringPrecompile address for sft pallet
FUTUREPASS_REGISTRAR_PRECOMPILE_ADDRESS: stringPrecompile address for futurepass pallet
PEG_PRECOMPILE_ADDRESS: stringPrecompile address for erc20Peg and nftPeg pallets
DEX_PRECOMPILE_ADDRESS: stringPrecompile address for dex pallet
FEE_PROXY_PRECOMPILE_ADDRESSPrecompile address for feeProxy pallet
MARKETPLACE_PRECOMPILE_ADDRESSPrecompile address for marketplace pallet
MULTICALL3_ADDRESSAddress for multicall3 contract
RNS_REGISTRAR_ADDRESS_ROOTAddress for rnsRegistrar contract on Root
RNS_REGISTRAR_ADDRESS_PORCINIAddress for rnsRegistrar contract on Porcini

Helpers

/**
 * Converts an asset's assetId to a contract address
 * @param assetId - The assetId we are converting
 * @returns The contract address
 */
function assetIdToERC20Address(assetId: string | number): `0x${string}`;

/**
 * Converts an NFT collectionId to a contractAddress
 * @param collectionId - The collectionId we are converting
 * @returns The contract address
 */
function collectionIdToERC721Address(
  collectionId: string | number
): `0x${string}`;

/**
 * Converts an SFT collectionId to a contractAddress
 * @param collectionId - The collectionId we are converting
 * @returns The contract address
 */
function collectionIdToERC1155Address(
  collectionId: string | number
): `0x${string}`;

/**
 * Converts a contract address back to it's native ID (collection ID or asset
 * ID) if possible
 * @param contractAddress - The address we are checking
 * @returns NativeId or `null` when conversion failed
 */
function contractAddressToNativeId(contractAddress: Address): number | null;

/**
 * Retrieves whether address is a Futurepass
 * @param address - The address we are checking
 * @returns Whether it's a futurepass or not
 */
function isFuturepass(address: Address): boolean;

FAQs

Package last updated on 17 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts