-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from hollow-leaf/fix/backend
feat: extension createNft
- Loading branch information
Showing
7 changed files
with
155 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
import { useAccount, useBalance } from "wagmi"; | ||
import { useQuery } from "@tanstack/react-query"; | ||
import { PDBalance } from "../services/contract" | ||
|
||
|
||
export function Balance(){ | ||
export function Balance(props:any){ | ||
|
||
const { address } = useAccount() | ||
|
||
const { data, isError, isLoading } = useBalance({ | ||
address: address, | ||
}) | ||
const { isLoading, error, data } = useQuery({ | ||
queryKey: ["getBalance"], | ||
queryFn: () => | ||
PDBalance(props.address).then(res=>{ | ||
console.log(res) | ||
return res | ||
}) | ||
|
||
}); | ||
|
||
if (isLoading) return <div>Fetching balance…</div> | ||
if (isError) return <div>Error fetching balance</div> | ||
if (error) return <div>Error fetching balance</div> | ||
|
||
return ( | ||
<div> | ||
Balance: {data?.formatted} {data?.symbol} | ||
Balance: {Number(data)} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { createNewNft } from "../services/contract"; | ||
import { useAccount } from "wagmi" | ||
|
||
export default function CreateNft(){ | ||
|
||
const { address } = useAccount() | ||
|
||
|
||
return ( | ||
<section> | ||
<h6>Create NFT</h6> | ||
<div className="nice-form-group"> | ||
<label>Name</label> | ||
<input id="name" type="text" placeholder="" /> | ||
</div> | ||
<div className="nice-form-group"> | ||
<label>Price</label> | ||
<input id="price" type="number" placeholder="" /> | ||
</div> | ||
<div className="nice-form-group"> | ||
<label>Supply</label> | ||
<input id="supply" type="number" placeholder="" /> | ||
</div> | ||
<div className="nice-form-group"> | ||
<button id="createbutton" className="button-13" role="button" onClick={()=>{if(address){createHandler(address)}}}>Create</button> | ||
</div> | ||
</section> | ||
) | ||
} | ||
|
||
async function createHandler(address:string){ | ||
var name = (document.getElementById("name") as HTMLInputElement)?.value; | ||
var price = (document.getElementById("price") as HTMLInputElement)?.value; | ||
var supply = (document.getElementById("supply") as HTMLInputElement)?.value; | ||
console.log(name, price, supply) | ||
if(name&&price&&supply){ | ||
await createNewNft(address, name, Number(supply), Number(price)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters