Socket
Socket
Sign inDemoInstall

@fileverse/heartbit-react

Package Overview
Dependencies
18
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.2.0

4

package.json
{
"name": "@fileverse/heartbit-react",
"version": "2.1.0",
"version": "2.2.0",
"type": "module",

@@ -49,5 +49,5 @@ "main": "./dist/index.umd.js",

"dependencies": {
"@fileverse/heartbit-core": "^2.2.0",
"@fileverse/heartbit-core": "^2.3.0",
"classnames": "^2.5.1"
}
}

@@ -31,3 +31,3 @@ # HeartBit React

First of all, you want to set up your wallet providers. For this example, we will be using the `BrowserProvider` from `ethers` as our provider. We will create a React component that will render `HeartBit`, and we are going to configure the network by passing the `coreOption` as props to it. It requires the `getSignatureArgsHook` as props as well, which it calls internally to get the `message`, `signature`, and optionally an `onMintCallback`, a function that will be called after mint is completed. We would also define `hash` which is a keccak256 hash that will be used for generating the tokenId on the smart contract, and we will use `SIWE` for generating the `message` and `signature`. The code below should do the trick:
First of all, you want to set up your wallet providers. For this example, we will be using the `BrowserProvider` from `ethers` as our provider. We will create a React component that will render `HeartBit`, and we are going to configure the network by passing the `coreOption` as props to it. It requires the `getSignatureArgsHook` as props as well, which it calls internally to get the `message`, `signature`, and optionally an `onMintCallback`, a function that will be called after mint is completed. We would also define `hash` that will be used for generating the tokenId on the smart contract generally use `ipfs hash` here for `eg: ipfs://cid`, and we will use `SIWE` for generating the `message` and `signature`. The code below should do the trick:

@@ -65,3 +65,3 @@ ```javascript

const hash = keccak256(toUtf8Bytes("window.location.href")); // This is an identifier for the token, if this hash changes you mint a new token in that case
const hash = "ipfs//cid"; // This is an identifier for the token, if this hash changes you mint a new token in that case

@@ -104,3 +104,3 @@ return <HeartBit

const address = '0x...someaddress'
const hash = '0x....somehash' // This is an identifier for the token, if this hash changes you mint a new token in that case
const hash = 'ipfs://cid' // This is an identifier for the token, if this hash changes you mint a new token eg: ipfs://cid
useEffect(() => {

@@ -125,3 +125,3 @@ const fetchBalances = async () => {

endTime,
hash, // This is an identifier for the token, if this hash changes you mint a new token in that case
hash, // This is an identifier for the token, if this hash changes you mint a new token. eg: ipfs://cid
message, // raw message that was signed

@@ -135,6 +135,7 @@ signature, // signed message

```
[Here](https://codesandbox.io/p/devbox/custom-heartbit-example-p6f7gr) is a working example using the `HeartBitProvider` and `useHeartBit`.
### Interface
### Interface
```javascript

@@ -150,3 +151,3 @@ interface SignatureArgs {

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 in that case
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

@@ -157,3 +158,2 @@ showTotalMintsByHash?: boolean; // Default to false, if true will show total mints for a hash to the right of component

type SupportedChain = "0xaa36a7" | "0x2105" | "0x64";

@@ -169,6 +169,6 @@ interface HeartBitCoreOptions {

interface TotalHeartBitCountArgs {
hash: string; // This is an identifier for the token, if this hash changes you mint a new token in that case
hash: string; // This is an identifier for the token, if this hash changes you mint a new token. eg: ipfs://cid
}
interface HeartBitCountByUserArgs {
hash: string; // This is an identifier for the token, if this hash changes you mint a new token in that case
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

@@ -181,3 +181,3 @@ }

endTime: number; // in seconds
hash: string; // This is an identifier for the token, if this hash changes you mint a new token in that case
hash: string; // This is an identifier for the token, if this hash changes you mint a new token. eg: ipfs://cid
}

@@ -184,0 +184,0 @@ interface IHeartBitContext {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc