实验游戏场
这个包裹是一个快速的小想法的集合,这些想法可能半生.
如果你发现一个特别的特征,你的兴趣, 请随意打开 gitHub上要讨论的问题.
另外,如果你有任何系统需要这个软件包中的对象,请确保 您指定 准确 npm 版本 在您的软件包中。 json, 作为后向兼容 实值 没有 为此软件包提供保证; API可能改变, 类可能消失.
项目
大脑钱包
一般来说,不推荐一个脑钱包,但它是我们在v3中提供的特征 及以下各点。 它允许使用用户名和 密码 但是,任何人 谁可以猜测一个用户名和密码 偷取资金, 而密码不能被更改。 但反向兼容和简单 测试,我们在这里提供.
import { BrainWallet } from "@ethersproject/experimental/brain-wallet";
// This is optional, but since a Brain Wallet can take 5-10s to generate,
// helps keep your users informed
function showProgress(percent) {
if (percent === 1) {
console.log("Done.");
} else {
console.log("Completed: " + Math.trunc(100 * percent) + "%");
}
}
// Generate a legacy-compatible Brain Wallet
BrainWallet.generateLegacy(username, password, showProgress).then((wallet) => {
console.log(wallet);
});
// Generate a new-style Brain Wallet, which contains a Mnemonic Phrase too
BrainWallet.generate(username, password, showProgess).then((wallet) => {
console.log(wallet);
});
非管理者
import { NonceManager } from "@ethersproject/experimental/nonce-manager";
let signer = "... any way you get a signer ...";
// The NonceManager Signer will automatically manage the nonce for you
// so you may blast the network with as many transactions as you would
// like. Transactions which have not been mined within XXX timeout and
// will be rebroadcast; keep in mind that unmined transactions remain
// in memory.
const managedSigner = new NonceManager(signer);
Eip1193 桥
import { Eip1193Bridge } from "@ethersproject/experimental/retry-provider";
const signer = "... any way you get an ethers Signer...";
const provider = "... any way you get an ethers Provider...";
const eip1193Provider = new Eip1193Provider(signer, provider);
许可证
MIT许可证.