1.0.2 • Published 1 year ago

@tableland/nonce v1.0.2

Weekly downloads
-
License
MIT AND Apache-2....
Repository
github
Last release
1 year ago

@tableland/nonce

License: MIT AND Apache-2.0 Version standard-readme compliant

Redis-based EVM wallet nonce manager.

Background

This package is a nonce manager for Ethereum wallets using a Redis store. A nonce manager is required to ensure the backend wallet nonce is in sync with the onchain transactions. For example—with a Vercel web app, if a set of different users send transactions that are sponsored by the backend wallet, the nonce manager will ensure that the transactions are sent with the correct nonce. Without this, Vercel might send transactions out of order, and the transactions will fail.

Install

You can install via npm.

npm install @tableland/nonce

Usage

The example below is shown with ethers v5.

import { Wallet, getDefaultProvider } from "ethers";
import { NonceManager } from "@tableland/nonce";

const privateKey = "59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"; // Your private key
const wallet = new Wallet(privateKey);
const provider = getDefaultProvider("http://127.0.0.1:8545"); // Your RPC URL

// Set up the nonce manager
const signer = new NonceManager(wallet.connect(provider))

Development

See the web package for how the nonce manager is used in the context of Studio.

Contributing

PRs accepted. Studio is still under initial development, so if you are interested in helping out, feel free to connect on Discord: https://tableland.xyz/discord

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT AND Apache-2.0, © 2021-2024 Tableland Network Contributors

1.0.2

1 year ago

1.0.0-pre.0

1 year ago

0.0.0-pre.1

1 year ago

0.0.0-pre.0

1 year ago