Skip to content

Commit

Permalink
web-wallet: Update Wallet service to use dusk-wallet-js 0.4.4
Browse files Browse the repository at this point in the history
Resolves #1595
  • Loading branch information
ascartabelli committed May 7, 2024
1 parent 6b55d2c commit 44dcfc5
Show file tree
Hide file tree
Showing 12 changed files with 272 additions and 128 deletions.
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.4.4",
"@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

0 comments on commit 44dcfc5

Please sign in to comment.