anconprotocol / client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ancon Protocol Client Class

in order to instiate the the class you must provide a provider and the address which is currently connected to the dapp. Once the class is instiated you won't have to iniate a ethers provider.

API

EnrollL2Account()

> enrolls the user into Ancon Protocol, once the user has been enrolled he can interact with the protocol.

parameters

Name Type Description
cid string metadata cid
proof any the proof object. must be passed through abi proof

returns

Name Type Description
enroll object transaction receipt

getNetwork()

> returns the network the user is currently in

getPubKey

> returns an array with [recoveredAddress, transaction.from, pubkey]

parameters

Name Type Description
transactionHash string any transaction hash made by the user

postProof()

> handles the post requests to the Dag Store

parameters

Name Type Description
proofEndPoint string the endpoint to made the post ex: dagjson
requestOptions any the whole object to send. must use method post
enrolling? boolean send true if you are making a post to enroll a user

returns

Name Type Description
contentCid string metadata cid
proofKey string proof key from the recent change
proofHeight string proof height from the recent change
proofCid string proof cid that can be used to fetch the proof posted
ipfs string shows the ipfs cids

getProof()

> fetch the proof, passes it trough abi proof and return it ready to be used

parameters

Name Type Description
key string the proof key returned by post proof
height string the proof height returned by post proof

returns

Name Type Description
contentCid string metadata cid
proofKey string proof key from the recent change
proofHeight string proof height from the recent change
proofCid string proof cid that can be used to fetch the proof posted
ipfs string shows the ipfs cids

fetchDag()

> fetch the dag store with a cid

parameters

Name Type Description
cid string cid to fetch

returns

Name Type Description
cid string metadata cid
proofKey string proof key from that cid change
proofHeight string proof height from that cid change

getPastEvents()

> event waiter for the relayer, returns true once it was completed

mintNft()

> fetch the dag store with a cid

parameters

Name Type Description
hexData string hexData sent to the dag store
userProofKey string key from the user proof object

returns

Name Type Description
mint object mint transaction receipt

getMetadata()

> gets metadata from the user

parameters

Name Type Description
cid string cid metadata
address string address to get the metadata from

returns

Name Type Description
data object all the fields in the metadata

About


Languages

Language:TypeScript 73.0%Language:JavaScript 27.0%