JSPM

ethwrapper

0.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q42444F
  • License MIT

♻️ Utility class to wrap/unwrap ETH on compatible networks

Package Exports

  • ethwrapper
  • ethwrapper/dist/ethwrapper.mjs
  • ethwrapper/dist/ethwrapper.umd.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ethwrapper) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

♻️ EthWrapper

Unit tests Lint Build npm version npm bundle size (scoped version)

A simple utility class that helps wrap and unwrap ETH on compatible networks (Ethereum, Optimism, Arbitrum One...)

Installation

npm i ethwrapper

Usage

import EthWrapper from "ethwrapper"

const ethwrapper = new EthWrapper({
    rpcEndpointUrl: 'http://public-rpc-url.com',
    wallet: {
        address: '0xYOUR_ADDRESS_HERE',
        privateKey: '0xYOUR_PRIVATE_KEY_HERE',
    },
    wethContractAddress: '0xWETH_CONTRACT_ADDRESS',
})

(async () => {
    const wrapHash = await ethwrapper.wrap({ amount: 0.001 })
    const unwrapHash = await ethwrapper.unwrap({ amount: 0.05 })
})()

EthWrapper needs three things to work :

  • A public or private JSON-RPC url related to the network you want to wrap/unwrap on
  • Your public and private keys in order to sign the contract calls
  • The WETH contract address on the chain you are working on