Skip to content

Commit

Permalink
v0.25.1
Browse files Browse the repository at this point in the history
  • Loading branch information
stringhandler committed Jan 21, 2022
1 parent d4058f4 commit 61e985c
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 104 deletions.
Empty file.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

64 changes: 33 additions & 31 deletions applications/tari_collectibles/web-app/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import {
ListSubheader,
Toolbar,
} from "@mui/material";
import AccountBalanceWalletIcon from "@mui/icons-material/AccountBalanceWallet";
import DashboardIcon from "@mui/icons-material/Dashboard";
import CreateIcon from "@mui/icons-material/Create";
import AddIcon from "@mui/icons-material/Add";
Expand Down Expand Up @@ -117,38 +116,41 @@ const AccountsMenu = (props) => {
const [accounts, setAccounts] = useState([]);
const [error, setError] = useState("");

useEffect(async () => {
console.log("refreshing accounts");
setError("");
binding
.command_asset_wallets_list()
.then((accounts) => {
console.log("accounts", accounts);
setAccounts(accounts);
})
.catch((e) => {
// todo error handling
console.error("accounts_list error:", e);
setError(e.message);
});
useEffect( () => {
async function inner() {
console.log("refreshing accounts");
setError("");
binding
.command_asset_wallets_list()
.then((accounts) => {
console.log("accounts", accounts);
setAccounts(accounts);
})
.catch((e) => {
// todo error handling
console.error("accounts_list error:", e);
setError(e.message);
});


await listen("asset_wallets::updated", event => {
console.log("accounts have changed");
setError("");
binding
.command_asset_wallets_list()
.then((accounts) => {
console.log("accounts", accounts);
setAccounts(accounts);
})
.catch((e) => {
// todo error handling
console.error("accounts_list error:", e);
setError(e.message);
});
}
);
await listen("asset_wallets::updated", event => {
console.log("accounts have changed");
setError("");
binding
.command_asset_wallets_list()
.then((accounts) => {
console.log("accounts", accounts);
setAccounts(accounts);
})
.catch((e) => {
// todo error handling
console.error("accounts_list error:", e);
setError(e.message);
});
}
);
}
inner();
}, [props.walletId]);


Expand Down
2 changes: 1 addition & 1 deletion applications/tari_collectibles/web-app/src/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import {Container, Grid, Button } from "@mui/material";
import {Container, Grid } from "@mui/material";
import React from "react";
import { AssetCard, Spinner } from "./components";
import binding from "./binding";
Expand Down
130 changes: 65 additions & 65 deletions applications/tari_collectibles/web-app/src/Setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,71 +33,71 @@ import { Spinner } from "./components";
import binding from "./binding";
import {withRouter, useParams, useHistory} from "react-router-dom";

const chunk = (arr, len) => {
const chunks = [];
let i = 0;
let n = arr.length;

while (i < n) {
chunks.push(arr.slice(i, (i += len)));
}

return chunks;
};

const SeedWords = ({ wallet, password}) => {
const [seedWords, setSeedWords] = useState([]);
const [error, setError] = useState("");
const history= useHistory();
useEffect(() => {
binding
.command_wallets_seed_words(wallet.id, password)
.then((words) => setSeedWords(words))
.catch((e) => {

console.error("error: ", e);
setError(e.message);
});
}, [wallet.id, password]);

const display = (seedWords) => {
console.log(seedWords);
if (seedWords.length === 0) return <Spinner />;

const chunks = chunk(seedWords, 6);
return (
<div>
{chunks.map((words, i) => (
<pre key={i}>{words.join(" ")}</pre>
))}
</div>
);
};

return (
<div>
<Typography variant="h3" sx={{ mb: "30px" }}>
Seed words
</Typography>
{error ? (
<Alert severity="error">{error}</Alert>
) : (
<span />
)}
<p>
Save these seed words securely. This is the recovery phrase for this
wallet.
</p>
{display(seedWords)}
<Button
disabled={seedWords.length === 0}
onClick={() => history.push(`/`)}
>
I have saved my seed words
</Button>
</div>
);
};
// const chunk = (arr, len) => {
// const chunks = [];
// let i = 0;
// let n = arr.length;
//
// while (i < n) {
// chunks.push(arr.slice(i, (i += len)));
// }
//
// return chunks;
// };
//
// const SeedWords = ({ wallet, password}) => {
// const [seedWords, setSeedWords] = useState([]);
// const [error, setError] = useState("");
// const history= useHistory();
// useEffect(() => {
// binding
// .command_wallets_seed_words(wallet.id, password)
// .then((words) => setSeedWords(words))
// .catch((e) => {
//
// console.error("error: ", e);
// setError(e.message);
// });
// }, [wallet.id, password]);
//
// const display = (seedWords) => {
// console.log(seedWords);
// if (seedWords.length === 0) return <Spinner />;
//
// const chunks = chunk(seedWords, 6);
// return (
// <div>
// {chunks.map((words, i) => (
// <pre key={i}>{words.join(" ")}</pre>
// ))}
// </div>
// );
// };
//
// return (
// <div>
// <Typography variant="h3" sx={{ mb: "30px" }}>
// Seed words
// </Typography>
// {error ? (
// <Alert severity="error">{error}</Alert>
// ) : (
// <span />
// )}
// <p>
// Save these seed words securely. This is the recovery phrase for this
// wallet.
// </p>
// {display(seedWords)}
// <Button
// disabled={seedWords.length === 0}
// onClick={() => history.push(`/`)}
// >
// I have saved my seed words
// </Button>
// </div>
// );
// };

const CreateWallet = ({ setAuthenticated }) => {
const [password, setPassword] = useState("");
Expand Down

0 comments on commit 61e985c

Please sign in to comment.