@fileverse/heartbit-core
Advanced tools
Comparing version 1.0.0 to 2.0.0
{ | ||
"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", |
110
README.md
@@ -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. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
539
145
39633
1
8
5