Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web-wallet: Update Wallet service to use dusk-wallet-js 0.5.2 #1611

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions web-wallet/__mocks__/Wallet.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
class Wallet {
constructor(seed, gasLimit = 2900000000, gasPrice = 1) {
this.gasLimit = gasLimit;
this.gasPrice = gasPrice;
constructor(seed) {
this.seed = seed;
this.wasm = {};
}

gasLimit;
gasPrice;
static get networkBlockHeight() {
return Promise.resolve(0);
}

seed;
wasm;

Expand Down
16 changes: 8 additions & 8 deletions web-wallet/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"type": "module",
"version": "0.5.0",
"dependencies": {
"@dusk-network/dusk-wallet-js": "0.4.2",
"@dusk-network/dusk-wallet-js": "0.5.2",
"@floating-ui/dom": "1.6.3",
"@mdi/js": "7.4.47",
"bip39": "3.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@
const executeOperations = {
stake: (amount, gasPrice, gasLimit) =>
walletStore
.stake(amount, gasPrice, gasLimit)
.stake(amount, { limit: gasLimit, price: gasPrice })
.then(getLastTransactionHash),
unstake: (gasPrice, gasLimit) =>
walletStore.unstake(gasPrice, gasLimit).then(getLastTransactionHash),
walletStore
.unstake({ limit: gasLimit, price: gasPrice })
.then(getLastTransactionHash),
"withdraw-rewards": (gasPrice, gasLimit) =>
walletStore
.withdrawReward(gasPrice, gasLimit)
.withdrawReward({ limit: gasLimit, price: gasPrice })
.then(getLastTransactionHash),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
/** @type {(to: string, amount: number, gasPrice:number, gasLimit:number) => Promise<string>} */
const executeSend = (to, amount, gasPrice, gasLimit) =>
walletStore
.transfer(to, amount, gasPrice, gasLimit)
.transfer(to, amount, { limit: gasLimit, price: gasPrice })
.then(getLastTransactionHash);

const collectSettings = collect([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ describe("getWallet", () => {
[
"wasm",
"seed",
"gasLimit",
"gasPrice",
"constructor",
"getBalance",
"getPsks",
Expand Down
5 changes: 1 addition & 4 deletions web-wallet/src/lib/services/wallet/getWallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ import { Wallet } from "@dusk-network/dusk-wallet-js";
/**
* Gets a `Wallet` instance.
* @param {Uint8Array} seed
* @param {Number} [gasLimit=2900000000]
* @param {Number} [gasPrice=1]
* @returns {Wallet}
*/

const getWallet = (seed, gasLimit, gasPrice) =>
new Wallet(Array.from(seed), gasLimit, gasPrice);
const getWallet = (seed) => new Wallet(Array.from(seed));

export default getWallet;
Loading