Skip to content

Commit 54911f6

Browse files
committed
2 parents 4b54101 + 8f0a978 commit 54911f6

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

6-nfts-for-financial-applications/fond/app/src/components/Context.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ class BlockProvider extends Component {
3232
this.setState({address: (accountAddresses) ? accountAddresses[0].address : null})
3333
}
3434

35-
buy = async () => {
35+
buy = async (amount) => {
3636
let manifest = new ManifestBuilder()
3737
.callMethod(this.state.address, "lock_fee", ['Decimal("100")'])
38-
.withdrawFromAccountByAmount(this.state.address, 10, "resource_tdx_a_1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqegh4k9")
39-
.takeFromWorktopByAmount(10, "resource_tdx_a_1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqegh4k9", "bucket1")
40-
.callMethod(this.componentAddress, "buy_gumball", ['Bucket("bucket1")'])
38+
.withdrawFromAccountByAmount(this.state.address, amount, "resource_tdx_a_1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqegh4k9")
39+
.takeFromWorktopByAmount(amount, "resource_tdx_a_1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzqegh4k9", "bucket1")
40+
.callMethod(this.componentAddress, "invest_in_campaigns", ['Bucket("bucket1")', 'Decimal("0")'])
4141
.callMethod(this.state.address, "deposit_batch", ['Expression("ENTIRE_WORKTOP")'])
4242
.build()
4343
.toString();
@@ -55,8 +55,12 @@ class BlockProvider extends Component {
5555
const receipt = await this.transactionApi.transactionReceiptPost({
5656
v0CommittedTransactionRequest: { intent_hash: hash.value },
5757
})
58+
59+
console.log(receipt.committed.receipt.state_updates)
5860
}
5961

62+
async componentDidMount () {}
63+
6064
render() {
6165
return (
6266
<BlockContext.Provider value={{

6-nfts-for-financial-applications/fond/app/src/components/Invest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {BlockContext} from "./Context"
33
// import {BigNumber} from "ethers"
44

55
export default function Invest() {
6-
const {buy} = useContext(BlockContext)
6+
const {address, buy} = useContext(BlockContext)
77
const [amount, setAmount] = useState(0)
88

99
return (
@@ -19,7 +19,7 @@ export default function Invest() {
1919
<input type="text" placeholder="0" className="input input-bordered w-full pr-16"
2020
onChange={(e) => setAmount(parseInt(e.target.value))}/>
2121
<button className="btn btn-primary absolute top-0 right-0 rounded-l-none"
22-
onClick={() => buy(amount)}
22+
onClick={() => buy(amount)} disabled={address == null}
2323
>Invest</button>
2424
</div>
2525
</div>

0 commit comments

Comments
 (0)