Socket
Socket
Sign inDemoInstall

@fileverse/heartbit-core

Package Overview
Dependencies
11
Maintainers
4
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 2.0.0

dist/index.cjs

18

package.json
{
"name": "@fileverse/heartbit-core",
"version": "1.0.0",
"version": "2.0.0",
"description": "",
"type": "module",
"main": "./dist/esm/index.ts",
"types": "./dist/types/index.d.ts",
"typings": "./dist/types/index.d.ts",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"typings": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"default": "./dist/esm/index.js"
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}

@@ -24,5 +24,7 @@ },

},
"devDependencies": {
"tsup": "^8.0.2"
},
"scripts": {
"build": "pnpm run clean && pnpm run build:esm+types",
"build:esm+types": "tsc --project tsconfig.build.json --outDir ./dist/esm --declaration --declarationMap --declarationDir ./dist/types",
"build": "pnpm run clean && tsup",
"clean": "rm -rf dist",

@@ -29,0 +31,0 @@ "test:build": "publint --strict",

@@ -33,7 +33,7 @@ # HeartBit Core

const coreSDK = new HeartBitCore({
chain: "0xaa36a7",
chain: "0xaa36a7",
});
```
### Example Usage
### Example Usage - mintHeartBit (Signed Mint)

@@ -44,28 +44,28 @@ This minimal example demonstrates how to use `HeartBitCore` for minting and querying data.

async function main() {
const message = "Hello World!";
const signature = "0x...signed message";
const startTime = 1706898250;
const endTime = 1706898251;
const hash = "Hello World"; // This is an identifier for the token, if this hash changes you mint a new token in that case
const message = "Hello World!";
const signature = "0x...signed message";
const startTime = 1706898250;
const endTime = 1706898251;
const hash = "ipfs://somecid"; // unique identifier for token. eg ipfs://somecid in that case
// Mint HeartBit
// Mint HeartBit
await coreSDK.mintHeartBit({
message,
signature,
startTime,
endTime,
hash,
});
await coreSDK.mintHeartBit({
message,
signature,
startTime,
endTime,
hash,
});
// Get TotalSupply for a hash
// Get TotalSupply for a hash
const totalSupply = await coreSDK.getTotalHeartBitCountByHash({ hash });
const totalSupply = await coreSDK.getTotalHeartBitCountByHash({ hash });
// Get Total Mints By User
const address = "0x...ethaddress";
const mintsByUser = await coreSDK.getHeartBitByUser({
hash,
address,
});
// Get Total Mints By User
const address = "0x...ethaddress";
const mintsByUser = await coreSDK.getHeartBitByUser({
hash,
address,
});
}

@@ -76,30 +76,72 @@ ```

### Example Usage - unSignedMintHeartBit (Unsigned Mint)
This minimal example demonstrates how to use `HeartBitCore` for minting heartbit without signature.
```javascript
async function main() {
const startTime = 1706898250;
const endTime = 1706898251;
const hash = "ipfs://cid"; // unique identifier for token. eg ipfs://somecid that case
const apiKey = "hello";
const address = "0x...ethaddress";
// Mint HeartBit
await coreSDK.unSignedMintHeartBit({
startTime,
endTime,
hash,
address,
apiKey,
});
// Get TotalSupply for a hash
const totalSupply = await coreSDK.getTotalHeartBitCountByHash({ hash });
// Get Total Mints By User
const mintsByUser = await coreSDK.getHeartBitByUser({
hash,
address,
});
}
```
### Interfaces
```javascript
type SupportedChain = "0xaa36a7" | "0x2105";
type SupportedChain = "0xaa36a7" | "0x2105" | "0x64";
interface HeartBitCoreOptions {
chain: SupportedChain;
rpcUrl?: string;
chain: SupportedChain;
rpcUrl?: string;
}
interface TotalHeartBitCountArgs {
hash: string; // keccak256 hash of a string
hash: string; // unique identifier for token. eg ipfs://somecid
}
interface HeartBitCountByUserArgs {
hash: string; // keccak256 hash of a string
address: string; // ethereum wallet address
hash: string; // unique identifier for token. eg ipfs://somecid
address: string; // ethereum wallet address
}
interface MintHeartBitArgs {
message: string;
signature: string;
startTime: number; // in seconds
endTime: number; // in seconds
hash: string; // keccak256 hash of a string
message: string;
signature: string;
startTime: number; // in seconds
endTime: number; // in seconds
hash: string; // unique identifier for token. eg ipfs://somecid
}
interface UnSignedMintArgs {
startTime: number;
endTime: number;
hash: string; // unique identifier for token. eg ipfs://somecid
address: string; // target wallet address to which heartbits should be minted
apiKey: string; // Api Key
}
```
Checkout [HeartBit React](https://github.com/fileverse/HeartBitSDK/edit/main/packages/heartbit-react) which uses the `HeartBitCore` to integrate HeartBit functionality in a react app.
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