Skip to content

Commit

Permalink
Merge pull request #56 from fileverse/update-interfaces-core
Browse files Browse the repository at this point in the history
Update React Interface
  • Loading branch information
nadeem-fileverse authored Apr 3, 2024
2 parents ae0393a + 9e1c76b commit 71d197d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions packages/heartbit-react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ const CustomHearBit = () => {
const { mintHeartBit, getTotalHeartMintsByUser, getTotalHeartBitByHash } = useHeartBit()
const [startTime, setStartTime] = useState<number | null>(null) // should be in seconds

const address = '0x...someaddress'
const account = '0x...someaddress'
const hash = 'ipfs://cid' // This is an identifier for the token, if this hash changes you mint a new token eg: ipfs://cid
useEffect(() => {
const fetchBalances = async () => {
const totalMintsByHash = await getTotalHeartBitByHash({ hash }); // Total Supply for a hash
const totalMintsByUser = await getTotalHeartMintsByUser({ address, hash }); // Total mints for a user by hash
const totalMintsByUser = await getTotalHeartMintsByUser({ account, hash }); // Total mints for a user by hash

console.log({ totalMintsByHash, totalMintsByUser})
}
Expand Down Expand Up @@ -144,7 +144,7 @@ interface HeartBitProps
coreOptions: HeartBitCoreOptions;
getSignatureArgsHook: () => Promise<SignatureArgs>; // this is a required hook, this allows to call sign message operation on the user wallet, must return SignatureArgs
hash: string; // This is an identifier for the token, if this hash changes you mint a new token. eg: ipfs://cid
address?: string; // user wallet address
account?: string; // user wallet address
showTotalMintsByHash?: boolean; // Default to false, if true will show total mints for a hash to the right of component
showTotalMintsByUser?: boolean; // Defaults to false, if true will show total mints by a user on a hash to right of the component
}
Expand All @@ -163,7 +163,7 @@ interface TotalHeartBitCountArgs {
}
interface HeartBitCountByUserArgs {
hash: string; // This is an identifier for the token, if this hash changes you mint a new token. eg: ipfs://cid
address: string; // ethereum wallet address
account: string; // ethereum wallet address
}
interface MintHeartBitArgs {
message: string;
Expand Down
8 changes: 4 additions & 4 deletions packages/heartbit-react/src/components/HeartBit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const HeartBitWithProvider = (props: HeartBitProps) => {
const {
getSignatureArgsHook,
hash,
address,
account,
showTotalMintsByHash = false,
showTotalMintsByUser = false,
} = props;
Expand All @@ -63,9 +63,9 @@ const HeartBitWithProvider = (props: HeartBitProps) => {
const totalMintsByHash = await getTotalHeartBitByHash({ hash });
balances.totalMintsByHash = totalMintsByHash;
}
if (showTotalMintsByUser && address) {
if (showTotalMintsByUser && account) {
const totalMintsByUser = await getTotalHeartMintsByUser({
address,
account,
hash,
});
balances.totalMintsByUser = totalMintsByUser;
Expand All @@ -77,7 +77,7 @@ const HeartBitWithProvider = (props: HeartBitProps) => {
setLoading(false);
}
}, [
address,
account,
getTotalHeartBitByHash,
getTotalHeartMintsByUser,
hash,
Expand Down
2 changes: 1 addition & 1 deletion packages/heartbit-react/src/components/HeartBit/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface HeartBitProps
coreOptions: HeartBitCoreOptions;
getSignatureArgsHook: () => Promise<SignatureArgs>;
hash: string;
address?: string;
account?: string;
showTotalMintsByHash?: boolean;
showTotalMintsByUser?: boolean;
}

0 comments on commit 71d197d

Please sign in to comment.