From 1921af90c12f4f7444ee38c07659a07155ea6b4b Mon Sep 17 00:00:00 2001 From: Unique Divine <51418232+Unique-Divine@users.noreply.github.com> Date: Tue, 11 Feb 2025 10:34:40 -0600 Subject: [PATCH] feat(evm-core-ts): Add ERC20 caller to the ethers export. (#2204) * feat(evm-core-ts): Add ERC20 caller to the ethers export. * chore: changelog * uncommit toy project --- evm-core-ts/CHANGELOG.md | 12 ++++++++++++ evm-core-ts/package.json | 2 +- evm-core-ts/src/ethers/index.ts | 10 ++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 evm-core-ts/CHANGELOG.md diff --git a/evm-core-ts/CHANGELOG.md b/evm-core-ts/CHANGELOG.md new file mode 100644 index 000000000..e3824036e --- /dev/null +++ b/evm-core-ts/CHANGELOG.md @@ -0,0 +1,12 @@ +# Changelog - Nibiru/evm-core-ts + +Record of pull requests and differences between versions for +the `@nibiruchain/evm-core` package on `npm`. + +## [0.0.x] + +- v0.0.2: [#2204](https://github.com/NibiruChain/nibiru/pull/2204) - Add ERC20 +caller to the "ethers" export. +- v0.0.1: [#2197](https://github.com/NibiruChain/nibiru/pull/2197) - Export +precompile addresses, ABIs, and ethers v6 adapters for strongly typed contracts. +This includes the FunToken, Wasm, and Nibiru Oracle precompiled contracts. diff --git a/evm-core-ts/package.json b/evm-core-ts/package.json index f45b70050..8cc757402 100644 --- a/evm-core-ts/package.json +++ b/evm-core-ts/package.json @@ -1,7 +1,7 @@ { "name": "@nibiruchain/evm-core", "description": "Lightweight Nibiru EVM TypeScript library for type-safe interactions with precompiled contracts, essential constants, and other core utilites.", - "version": "0.0.1", + "version": "0.0.2", "private": false, "include": ["src"], "scripts": { diff --git a/evm-core-ts/src/ethers/index.ts b/evm-core-ts/src/ethers/index.ts index d97f36344..52a2dac30 100644 --- a/evm-core-ts/src/ethers/index.ts +++ b/evm-core-ts/src/ethers/index.ts @@ -19,7 +19,9 @@ import { type IOracle, type IFunToken, type NibiruOracleChainLinkLike, + type ERC20Minter, NibiruOracleChainLinkLike__factory, + ERC20Minter__factory, } from "./typechain" export const wasmPrecompile = (runner: ContractRunner): IWasm => @@ -54,3 +56,11 @@ export const chainlinkLike = ( addr: string, ): NibiruOracleChainLinkLike => NibiruOracleChainLinkLike__factory.connect(addr, runner) + +/** + * Returns a typed contract instance for a standard ERC20 contract. + * */ +export const erc20Caller = ( + runner: ContractRunner, + addr: string, +): ERC20Minter => ERC20Minter__factory.connect(addr, runner)