npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

decentraland-transactions

v3.0.2

Published

<img src="https://ui.decentraland.org/decentraland_256x256.png" height="128" width="128" />

Downloads

5,011

Readme

Decentraland Transactions

NPM version Install Size

Send meta transactions

Table of contents

API

The API consists of one function at the moment, which is all you need to send meta transactions. You might also choose to import pre-loaded contract configurations or some types.

sendMetaTransaction

Sends a meta transaction using a relay server. It's provider agnostic, so it'll take the providers it needs as parameters. The Provider only has to conform to the required interface found on types. See the Configuration type for information on what values you can override.

The provider argument refers to which network you are connected to and therefore where the meta transaction will be signed. The metaTransactionProvider argument is where the meta transaction will be executed. E.g: If you want to send a meta transaction to a second layer like Matic by staying connected on Ethereum Mainnet, provider could be Metamask connected to the Ethereum Mainnet and metaTransactionProvider could be a provider instantiated with a Matic Mainnet RPC URL.

Definition

async function sendMetaTransaction(
  provider: Provider,
  metaTransactionProvider: Provider,
  functionSignature: string,
  contractData: ContractData,
  partialConfiguration: Partial<Configuration> = {}
): Promise<string>

Usage

Using ethers for the providers

import {
  sendMetaTransaction,
  getContract,
  ContractName,
  ChainId
} from 'decentraland-transactions'
import { ethers } from 'ethers'

const manaConfig = getContract(ContractName.MANAToken, ChainId.MATIC_MUMBAI)
const manaContract = new ethers.Contract(
  manaConfig.address,
  manaConfig.abi,
  provider
)

const txHash = await sendMetaTransaction(
  new ethers.providers.Web3Provider(window.ethereum),
  new ethers.providers.JsonRpcProvider('https://rpc-mumbai.matic.today'),
  manaContract.pupulateTransaction.transfer(to, value),
  manaConfig
  // ,{ serverURL: 'override.url' }
)

getContract

Returns data for a collection of useful Decentraland contracts enum. for the different Ethereum chains. It contains all the information necessary to call sendMetaTransaction.

Definition

function getContract(contractName: ContractName, chainId: ChainId): ContractData

Usage

getContract(ContractName.MANAToken, ChainId.ROPSTEN)

Types

Configuration

type Configuration = {
  serverURL: string
}

Check configuration.ts to get an up to date snapshot of the current configuration values.

Provider

Defines the minimun required interface for a Provider. It tries to accomodate for different lib implementations

export interface EIPProvider {
  request: (reqArgs: { method: string; params?: any[] }) => Promise<any>
  send?: (method: string, params?: any[]) => Promise<any>
}
export interface LegacyProvider {
  send: (method: string, params: any[]) => Promise<any>
}
export type Provider = EIPProvider | LegacyProvider

ContractName

Supported contract names

enum ContractName {
  MANAToken = 'MANAToken'
}

ContractData

Represents all the information necessary to interact with a contract. If the contract is a proxy and doesn't need the address, you can leave it empty.

type ContractData = {
  abi: object[]
  address: string
  name: string
  version: string
  chainId: ChainId
}

DataToSign

type DataToSign = {
  types: {
    EIP712Domain: DomainType[]
    MetaTransaction: MetaTransactionType[]
  }
  domain: DomainData
  primaryType: 'MetaTransaction'
  message: {
    nonce: number
    from: string
    functionSignature: FunctionSignature
  }
}

DomainData

type DomainData = {
  name: string
  version: string
  verifyingContract: string
  salt: string
}

Example

Example use

Example using decentraland-connect and ethers to get the providers

import { connection, ProviderType } from 'decentraland-connect'
import {
  sendMetaTransaction,
  getContract,
  ContractName,
  ChainId
} from 'decentraland-transactions'

async function transferMana() {
  try {
    const { provider } = await connection.connect(ProviderType.INJECTED)

    const txHash = await sendMetaTransaction(
      // Connected wallet provider
      provider,
      // L2 matic provider
      new ethers.providers.JsonRpcProvider('https://rpc-mumbai.matic.today'),
      // Function signature
      '0xa9059cbb000000000000000000000000a8d82b0bf686eee78eb5ec882cac98fdd1335ef50000000000000000000000000000000000000000000000000000000000000001',
      // Mana contract for MATIC_MUMBAI
      getContract(ContractName.MANAToken, ChainId.MATIC_MUMBAI)
    )

    console.log('Result tx hash', txHash)
  } catch (error) {
    console.error('An error occurred sending the meta tx', error)
  }
}

Development

To run the project you need to

npm i
npm run test
npm run build

Scripts

This package includes several utility scripts to help with development and debugging:

convert-abi

Converts TypeScript ABI files to JSON format for easier use with other tools.

Usage:

npm run convert-abi <input-file> [output-file]
npm run convert-abi --all <input-directory> [output-directory]

Examples:

# Convert a single ABI file
npm run convert-abi src/abis/ERC20.ts

# Convert a single ABI file with custom output
npm run convert-abi src/abis/ERC20.ts src/abis/ERC20.json

# Convert all ABI files in a directory
npm run convert-abi --all src/abis/

# Convert all ABI files to a different output directory
npm run convert-abi --all src/abis/ output/abis/

extract-function-data

Extracts and decodes function data from meta-transaction data. This is useful for debugging and understanding what function calls are being made.

Usage:

npm run extract-function-data <transaction_data> [abi_file_path]

Arguments:

  • transaction_data: The hex transaction data from getOffchainExecuteMetaTransactionData
  • abi_file_path (optional): Path to a JSON file containing the contract ABI for decoding

Examples:

# Extract function data without decoding
npm run extract-function-data 0xd8ed1acc0000000000000000000000001234567890abcdef...

# Extract and decode function data with ABI
npm run extract-function-data 0xd8ed1acc0000000000000000000000001234567890abcdef... ./contract-abi.json

extract-tenderly-data

Extracts function data from meta-transaction data and formats it for Tenderly transaction simulation.

Usage:

npm run extract-tenderly-data <transaction_data>

Arguments:

  • transaction_data: The hex transaction data from getOffchainExecuteMetaTransactionData

Examples:

# Extract data for Tenderly simulation
npm run extract-tenderly-data 0xd8ed1acc0000000000000000000000001234567890abcdef...

The script outputs JSON data with data and from fields that can be used in Tenderly's transaction simulation interface.

Copyright

This repository is protected with a standard Apache 2 license. See the terms and conditions in the LICENSE file.