![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@imtbl/contracts
Advanced tools
Immutable Contracts is a library of smart contracts targeted at developers who wish to quickly build and deploy their smart contracts on the Immutable X and Immutable zkEVM, a general-purpose permissionless L2 zero-knowledge rollup. The library allows developers to build on contracts curated by Immutable, including (but not limited to):
Token presets, e.g. ERC721
Bridging contracts
Marketplace and AMM contracts
Smart Contract Wallets
Random Number Generation
These contracts are feature-rich and are the recommended standard on Immutable zkEVM intended for all users and partners within the ecosystem.
$ yarn add @imtbl/contracts
Once the contracts
package is installed, use the contracts from the library by importing them:
pragma solidity 0.8.19;
import "@imtbl/contracts/contracts/token/erc721/preset/ImmutableERC721.sol";
contract MyERC721 is ImmutableERC721 {
constructor(
address owner,
string memory name,
string memory symbol,
string memory baseURI,
string memory contractURI,
address operatorAllowlist,
address royaltyReceiver,
uint96 feeNumerator
) ImmutableERC721(
owner,
name,
symbol,
baseURI,
contractURI,
operatorAllowlist,
royaltyReceiver,
feeNumerator
)
{}
}
contracts
comes with importable Typescript ABIs that can be used to generate a contract client in conjunction with libraries such as viem
or wagmi
, so that you can
interact with deployed preset contracts.
The following Typescript ABIs are available:
ImmutableERC721Abi
ImmutableERC721MintByIdAbi
ImmutableERC1155Abi
An example of how to create and use a contract client in order to interact with a deployed ImmutableERC721
:
import { getContract, http, createWalletClient, defineChain } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { ImmutableERC721MintByIdAbi } from "@imtbl/contracts";
const PRIVATE_KEY = "YOUR_PRIVATE_KEY"; // should be read from environment variable
const CONTRACT_ADDRESS = "YOUR_CONTRACT_ADDRESS"; // should be of type `0x${string}`
const RECIPIENT = "ACCOUNT_ADDRESS"; // should be of type `0x${string}`
const TOKEN_ID = BigInt(1);
const immutableTestnet = defineChain({
id: 13473,
name: "imtbl-zkevm-testnet",
nativeCurrency: { name: "IMX", symbol: "IMX", decimals: 18 },
rpcUrls: {
default: {
http: ["https://rpc.testnet.immutable.com"],
},
},
});
const walletClient = createWalletClient({
chain: immutableTestnet,
transport: http(),
account: privateKeyToAccount(`0x${PRIVATE_KEY}`),
});
// Bound contract instance
const contract = getContract({
address: CONTRACT_ADDRESS,
abi: ImmutableERC721MintByIdAbi,
client: walletClient,
});
const txHash = await contract.write.mint([recipient, tokenId]);
console.log(`txHash: ${txHash}`);
Information about how to build and test the contracts can be found in our build information.
We aim to build robust and feature-rich standards to help all developers onboard and build their projects on Immuable zkEVM, and we welcome any and all feedback and contributions to this repository! See our contribution guideline for more details on opening Github issues, pull requests requesting features, minor security vulnerabilities and providing general feedback.
These contracts are in an experimental stage and are subject to change without notice. The code must still be formally audited or reviewed and may have security vulnerabilities. Do not use it in production. We take no responsibility for your implementation decisions and any security problems you might experience.
We will audit these contracts before our mainnet launch.
Please responsibly disclose any major security issues you find by reaching out to security@immutable.com.
Immutable zkEVM Contracts are released under the Apache-2.0 license. See LICENSE.md for more details.
FAQs
Immutable Smart Contracts
We found that @imtbl/contracts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.