2020-04-16 22:25:05 -04:00
|
|
|
_section: Experimental
|
|
|
|
|
|
|
|
The **Experimental** package is used for features that are not ready
|
|
|
|
to be included in the base library. The API should not be considered
|
|
|
|
stable and does not follow [[link-semver]] versioning, so applications
|
|
|
|
requiring it should specify the //exact version// needed.
|
|
|
|
|
2021-06-04 01:17:56 -04:00
|
|
|
These features are not available in the core ethers package, so to use them
|
|
|
|
you must install the ``@ethersproject/experimental`` package and import them
|
|
|
|
from that.
|
|
|
|
|
2020-05-08 03:24:40 -04:00
|
|
|
_subsection: BrainWallet @<experimental-brainwallet> @INHERIT<[[Wallet]]>
|
2020-04-16 22:25:05 -04:00
|
|
|
|
|
|
|
Ethers removed support for BrainWallets in v4, since they are unsafe and
|
|
|
|
many can be easily guessed, allowing attackers to steal the funds. This
|
|
|
|
class is offered to ensure older systems which used brain wallets can
|
|
|
|
still recover their funds and assets.
|
|
|
|
|
|
|
|
_property: BrainWallet.generate(username, password [ , progressCallback ]) => [[experimental-brainwallet]]
|
|
|
|
Generates a brain wallet, with a slightly improved experience, in which
|
|
|
|
the generated wallet has a mnemonic.
|
|
|
|
|
|
|
|
_property: BrainWallet.generateLegacy(username, password [ , progressCallback ]) => [[experimental-brainwallet]]
|
2020-10-03 13:30:15 -03:00
|
|
|
Generate a brain wallet which is compatible with the ethers v3 and earlier.
|
2020-04-16 22:25:05 -04:00
|
|
|
|
2021-06-04 01:17:56 -04:00
|
|
|
_code: Importing @lang<script>
|
|
|
|
|
|
|
|
// Node
|
|
|
|
const { BrainWallet } = require("@ethersproject/experimental");
|
|
|
|
|
|
|
|
// ESM/TypeScript
|
|
|
|
import { BrainWallet } from "@ethersproject/experimental";
|
|
|
|
|
2020-04-16 22:25:05 -04:00
|
|
|
|
|
|
|
_subsection: EIP1193Bridge @<experimental-eip1193bridge> @INHERIT<[[link-npm-events]]>
|
|
|
|
|
2020-05-08 03:24:40 -04:00
|
|
|
The **EIP1193Bridge** allows a normal Ethers [[Signer]] and [[Provider]] to be
|
2020-04-16 22:25:05 -04:00
|
|
|
exposed in as a standard [EIP-1193 Provider](link-eip-1193), which may be useful
|
|
|
|
when interacting with other libraries.
|
|
|
|
|
2021-06-04 01:17:56 -04:00
|
|
|
_code: Importing @lang<script>
|
|
|
|
|
|
|
|
// Node
|
|
|
|
const { Eip1193Bridge } = require("@ethersproject/experimental");
|
|
|
|
|
|
|
|
// ESM/TypeScript
|
|
|
|
import { Eip1193Bridge } from "@ethersproject/experimental";
|
|
|
|
|
2020-04-16 22:25:05 -04:00
|
|
|
|
2020-05-08 03:24:40 -04:00
|
|
|
_subsection: NonceManager @<experimental-noncemanager> @INHERIT<[[Signer]]>
|
2020-04-16 22:25:05 -04:00
|
|
|
|
|
|
|
The **NonceManager** is designed to manage the nonce for a Signer,
|
|
|
|
automatically increasing it as it sends transactions.
|
|
|
|
|
|
|
|
Currently the NonceManager does not handle re-broadcast. If you attempt
|
|
|
|
to send a lot of transactions to the network on a node that does not
|
|
|
|
control that account, the transaction pool may drop your transactions.
|
|
|
|
|
|
|
|
In the future, it'd be nice if the **NonceManager** remembered transactions
|
|
|
|
and watched for them on the network, rebroadcasting transactions that
|
|
|
|
appear to have been dropped.
|
|
|
|
|
|
|
|
Another future feature will be some sort of failure mode. For example, often
|
|
|
|
a transaction is dependent on another transaction being mined first.
|
|
|
|
|
|
|
|
_property: new NonceManager(signer)
|
|
|
|
Create a new NonceManager.
|
|
|
|
|
2020-05-08 03:24:40 -04:00
|
|
|
_property: nonceManager.signer => [[Signer]]
|
2020-04-16 22:25:05 -04:00
|
|
|
The signer whose nonce is being managed.
|
|
|
|
|
2020-05-08 03:24:40 -04:00
|
|
|
_property: nonceManager.provider => [[Provider]]
|
2020-04-16 22:25:05 -04:00
|
|
|
The provider associated with the signer.
|
|
|
|
|
|
|
|
_property: nonceManager.setTransactionCount(count) => void
|
|
|
|
Set the current transaction count (nonce) for the signer.
|
|
|
|
|
2020-11-22 23:03:50 -05:00
|
|
|
This may be useful in interacting with the signer outside of using
|
2020-04-16 22:25:05 -04:00
|
|
|
this class.
|
|
|
|
|
2021-02-04 17:22:26 -05:00
|
|
|
_property: nonceManager.incrementTransactionCount( [ count = 1 ]) => void
|
2020-04-16 22:25:05 -04:00
|
|
|
Bump the current transaction count (nonce) by //count//.
|
|
|
|
|
2020-11-22 23:03:50 -05:00
|
|
|
This may be useful in interacting with the signer outside of using
|
2020-04-16 22:25:05 -04:00
|
|
|
this class.
|
2021-06-04 01:17:56 -04:00
|
|
|
|
|
|
|
_code: Importing @lang<script>
|
|
|
|
|
|
|
|
// Node
|
|
|
|
const { NonceManager } = require("@ethersproject/experimental");
|
|
|
|
|
|
|
|
// ESM/TypeScript
|
|
|
|
import { NonceManager } from "@ethersproject/experimental";
|