SDK Demo App
Initialize User
This step is required before interacting with SDK functions. Logs user into database allowing for verification, and sets up GSN provider allowing for gasless transactions.
Function Name: verify
Parameters: void
Returns: Promise<boolean>
Is Verified: false
Get Terms
Reads terms onchain from an array of deployed contracts.
Function Name: getTerms
Parameters: termsContractAddress: string[]
Returns: Promise<TermResponse[]>
Pin JSON
Takes in an object and pins to the pinning services.
Function Name: pinJSON
Parameters: toPin: object
Returns: Promise<PinResponse>
Get Pinned Data
Takes an ipfs hash returning the pinned data from the pinning service.
Function Name: getPinnedData
Parameters: ipfsHash: string
Returns: Promise<any>
Get PDF Bytes
Takes an agreement hash returning a Uint8Array used to easily download/view the agreemnt as a pdf locally.
Function Name: getPDFBytes
Parameters: agreementHash: string
Returns: Promise<Uint8Array>
Get Agreements
Retrieves an array of agreements based on the provided search criteria. (examples shows 10 most recent)
Function Name: getAgreements
Parameters: searchCriteria: SearchAgreements
Returns: Promise<AgreementDataWithHash[]>
Create an Agreement
Creates an agreemnt and sends it to the notary.
Function Name: createAgreement
Parameters: agreementData: AgreementData
Returns: Promise<CreatedAgreementData>
Promisors Wallet Address (this will be the wallet that countersigns the agreement)
NFT Contract Address
Owned Token ID from the above contract
Countersign an Agreement
Validates agreement updating it in the notary and puts in on chain gasless to the user. (switch the account set as promisor and re-validate to countersign)
Function Name: createAgreement
Parameters: countersignAgreementData: CounterSignAgreementData
Returns: Promise<Agreement>
Update Offerer
Updates the offerer of an agreement. Used when the owner of the token ID in the agreement is transferred to a new wallet. (Must be called by new token owner)
Function Name: updateOfferer
Parameters: updateOfferer: UpdateOfferer
Returns: Promise<UpdateOffererResponse>
Agreement Hash
Offerer On-Chain Signature (found in agreement return data)
Get Amount Owed
Retrieves the amount currently owed for a specific agreement by querying the validator module and the associated payment token. (Must be countersigned)
Function Name: getAmountOwedNow
Parameters: agreementHash: string
Returns: Promise<AmountOwedNow>
Agreement Hash
Amount: -
Contract Address: -
Is Agreement Valid
Checks the validity of an agreement by sending the agreement hash to the notary service for validation. (Agreement must be countersigned)
Function Name: isAgreementValid
Parameters: agreementHash: string
Returns: Promise<boolean>
Agreement Hash
Is Valid: false
Cancel User Transaction
Cancels a user transaction by burning the nonce associated with the transaction on-chain.
Function Name: cancelUserTransaction
Parameters: nonce: string
Returns: Promise<boolean>
Agreement Nonce
Is Cancelled: false