Skip to content

Commit

Permalink
push
Browse files Browse the repository at this point in the history
  • Loading branch information
BroProgramerWeb3 committed Dec 29, 2023
1 parent 3272d14 commit 5de98b9
Show file tree
Hide file tree
Showing 12 changed files with 60,449 additions and 14,370 deletions.
51,084 changes: 51,074 additions & 10 deletions client/dist/index.764980e3.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/index.764980e3.js.map

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion client/src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import React, { Component } from "react";
import Blocks from 'Blocks'

class App extends Component {
state = { walletInfo: { address: 'fooxv6', balance: 9999 }};
state = { walletInfo: {}};

componentDidMount() {
fetch('http://localhost:2000/api/wallet-info')
.then(response => response.json())
.then(json => this.setState({ walletInfo: json}));

}

render() {
const { address, balance } = this.state.walletInfo;
Expand All @@ -12,6 +20,8 @@ state = { walletInfo: { address: 'fooxv6', balance: 9999 }};
</div>
<div>Address: {address}</div>
<div>Balance: {balance}</div>
<br />
<Blocks />
</div>
);
}
Expand Down
30 changes: 30 additions & 0 deletions client/src/components/Blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React, { Component } from 'react';

// this blocks component will make a request to the
// blocks endpoint of the backend, which will return data of te blocks
class Blocks extends Component {
state = { blocks: []};

componentDidMount() {
fetch('http://localhost:2000/api/blocks')
.then(response => response.json())
.then(json => this.setState({ blocks: json }));
}

render() {
console.log('this.state', this.state);

return (
<div>
<h3>Blocks</h3>
{this.state.blocks.map((block, index) => (
<div key={index}>
<p>Block data: {JSON.stringify(block)}</p>
</div>
))}
</div>
)
}
}

export default Blocks;
Loading

0 comments on commit 5de98b9

Please sign in to comment.