@big-whale-labs/seal-hub-kit
v0.0.36
Published
Set of functions useful when working with the commitments generated by [SealHub](https://hub.sealc.red)
Downloads
49
Keywords
Readme
SealHub Kit
Set of functions useful when working with the commitments generated by SealHub
Available functions
createMessage(address: string) => string
Create a message to sign
Parameters
address: string
— wallet owner address
generateInputs(signature: string, message: string, provider: Provider)
Generates an input to create a zk proof
Parameters
message: string
— a message created using thecreateMessage(wallet.address)
functionsignature: string
— signature made bywallet.signMessage(message)
provider: Provider
— abstract Ethereum provider
Returns
{
commitmentMerkleRootIndex: number
pathIndices: number[]
siblings: string[]
TPreComputes: string[][][][]
U: string[][]
s: string[][]
r: string[][]
}
Example
import { Wallet, providers } from 'ethers'
import { createMessage, generateCommitment } from '@big-whale-labs/seal-hub-kit'
const provider = new providers.InfuraProvider('goerli')
const wallet = new Wallet()
const message = createMessage(wallet.address)
const signature = wallet.signMessage(message)
const zkInput = generateInputs(signature, message, provider)
generateSignatureInputs(signature: string, message: string)
Generates an input to create a commitment's zk proof
Parameters
message: string
— a message created using thecreateMessage(wallet.address)
functionsignature: string
— signature made bywallet.signMessage(message)
Returns
{
TPreComputes: string[][][][]
U: string[][]
s: string[][]
r: string[][]
}
generateCommitment(signature: string, message: string) => string
Create a commitment based on the message and signature
Parameters
message: string
— a message created using thecreateMessage(wallet.address)
functionsignature: string
— signature made bywallet.signMessage(message)
Example
import { Wallet } from 'ethers'
import { createMessage, generateCommitment } from '@big-whale-labs/seal-hub-kit'
const wallet = new Wallet()
const message = createMessage(wallet.address)
const signature = wallet.signMessage(message)
const commitment = generateCommitment(signature, message)
hasCommitment(commitment: string | bigint, provider: Provider) => boolean
Checks for a commitment in the SealHub contract
Parameters
commitment: string | bigint
— hash generated bygenerateCommitment
provider: Provider
— abstract Ethereum provider
Available Scripts
yarn start
— development mode, rebuilds on changesyarn build
— builds utilsyarn release
— create a release and publish the package