Socket
Socket
Sign inDemoInstall

@fileverse/heartbit-react

Package Overview
Dependencies
6
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.25 to 1.0.0

18

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

@@ -18,2 +18,7 @@ "main": "./dist/index.umd.js",

},
"scripts": {
"dev": "vite build --watch",
"build": "tsc --project tsconfig.json && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
},
"peerDependencies": {

@@ -45,10 +50,5 @@ "react": "^18.2.0",

"dependencies": {
"classnames": "^2.5.1",
"@fileverse/heartbit-core": "0.0.22"
},
"scripts": {
"dev": "vite build --watch",
"build": "tsc --project tsconfig.json && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
"@fileverse/heartbit-core": "workspace:*",
"classnames": "^2.5.1"
}
}
}

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

A plug-and-play integration of the HeartBit SDK, which is a wrapper around [HeartBitCore](https://github.com/fileverse/HeartBitSDK/tree/main/packages/heartbit-core).
A plug-and-play integration of the [HeartBit SDK](https://github.com/fileverse/HeartBitSDK), which is a wrapper around [HeartBitCore](https://github.com/fileverse/HeartBitSDK/tree/main/packages/heartbit-core).

@@ -65,3 +65,3 @@ ## Getting Started

const hash = keccak256(toUtf8Bytes("MY_APP_TOKEN"));
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

@@ -78,5 +78,5 @@ return <HeartBit

[Here](<(https://codesandbox.io/p/devbox/hearbit-example-cxr375)>) is a working example using HeartBit.
[Here](https://codesandbox.io/p/devbox/hearbit-example-cxr375) is a working example using HeartBit.
## Customization
## Customisation

@@ -105,3 +105,3 @@ You can attach the HeartBit functionality to any UI component and instead of being restricted by our default heart icon. To achieve this, the `heartbit-react` package exports `HeartBitProvider` and `useHeartBit`. The `HeartBitProvider` is used to configure the core package with the `coreOptions`, and `useHeartBit` exposes the core functions of the HeartBit SDK, which we can call in a React component. Note that it can only be used in the context of `HeartBitProvider`.

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

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

endTime,
hash, // keccak256 hash of a string
hash, // This is an identifier for the token, if this hash changes you mint a new token in that case
message, // raw message that was signed

@@ -136,3 +136,51 @@ signature, // signed message

```
[Here](https://codesandbox.io/p/devbox/custom-heartbit-example-p6f7gr) is a working example using the `HeartBitProvider` and `useHeartBit`.
[Here](https://codesandbox.io/p/devbox/custom-heartbit-example-p6f7gr) is a working example using the `HeartBitProvider` and `useHeartBit`.
### Interface
```javascript
interface SignatureArgs {
message: string;
signature: string;
onMintCallback?: () => void; // will be called after NFT minting is done
}
interface HeartBitProps
extends Omit<HeartBitUIProps, "isDisabled" | "startFillPos"> {
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 in that case
address?: 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
}
type SupportedChain = "0xaa36a7" | "0x2105";
interface HeartBitCoreOptions {
chain: SupportedChain;
rpcUrl?: string;
}
interface HeartBitProviderProps {
children: React.ReactNode;
coreOptions: HeartBitCoreOptions;
}
interface TotalHeartBitCountArgs {
hash: string; // This is an identifier for the token, if this hash changes you mint a new token in that case
}
interface HeartBitCountByUserArgs {
hash: string; // This is an identifier for the token, if this hash changes you mint a new token in that case
address: string; // ethereum wallet address
}
interface MintHeartBitArgs {
message: string;
signature: string;
startTime: number; // in seconds
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
}
interface IHeartBitContext {
getTotalHeartMintsByUser: (opts: HeartBitCountByUserArgs) => Promise<number>;
getTotalHeartBitByHash: (opts: TotalHeartBitCountArgs) => Promise<number>;
mintHeartBit: (opts: MintHeartBitArgs) => Promise<void>;
}
```
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