Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
before(() => {
service = Wallet.createRandom().address;
});
exports.mockPayment = async (operator, params) => {
const senderWallet = Wallet.createRandom();
const recipientWallet = Wallet.createRandom();
const payment = exports.mergeDeep({
amount: utils.parseUnits('100', 18),
currency: {
ct: exports.address1,
id: utils.bigNumberify(0)
},
sender: {
wallet: senderWallet.address,
nonce: utils.bigNumberify(1),
balances: {
current: utils.parseUnits('9399.8', 18),
previous: utils.parseUnits('9500', 18)
},
fees: {
single: {
before(async () => {
address = Wallet.createRandom().address;
});
before(() => {
address = Wallet.createRandom().address;
});
before(() => {
address = Wallet.createRandom().address;
});
before(() => {
address = Wallet.createRandom().address;
});
public fromRandomKey (): ArianeeWallet {
const randomWallet = etherWallet.createRandom();
const mnemonic = randomWallet.mnemonic;
const account = this.web3.eth.accounts.privateKeyToAccount(
randomWallet.privateKey
);
return this.buildAriaWalletFrom({ account, mnemonic });
}
}
if (publicExtendedKey && privateKeyGenerator) {
return Promise.resolve([
new PrivateKeysGetter(privateKeyGenerator),
publicExtendedKey
]);
}
let extendedPrvKey = await storeService.get(EXTENDED_PRIVATE_KEY_PATH);
if (!extendedPrvKey) {
log.info(
"No (extended public key, private key generation function) pair was provided and no extended private key was found in store. Generating a random extended private key"
);
extendedPrvKey = fromMnemonic(Wallet.createRandom().mnemonic).extendedKey;
await storeService.set([
{ path: EXTENDED_PRIVATE_KEY_PATH, value: extendedPrvKey }
]);
} else {
log.info("Using extended private key found in the store.");
}
const [
privKeyGenerator,
extendedPubKey
] = generatePrivateKeyGeneratorAndXPubPair(extendedPrvKey);
return Promise.resolve([
new PrivateKeysGetter(privKeyGenerator),
extendedPubKey
]);
}
export async function createAccountAndPasswordEncryptKey(password) {
const newWallet = Wallet.createRandom()
const address = await newWallet.getAddress()
const passwordEncryptedPrivateKey = JSON.parse(
await newWallet.encrypt(password, walletEncryptionOptions)
)
return {
address,
passwordEncryptedPrivateKey,
}
}