Class: Attendify

Attendify()

Attendify is API library for proof of attendance infrastructure on XRPL It allows for creation of new claim events, checking whether claim is possible, claiming, verifying NFT ownership, and fetching list of participants for a particular event

Constructor

new Attendify()

Initializes a new instance of the Attendify class
Version:
  • 1.2.4
Author:
  • JustAnotherDevv
Source:

Methods

(async) addParticipant(walletAddress, eventId) → {boolean}

Adds a participant to an event or creates event array for participants Saves the JSON with participants to local JSON file
Parameters:
Name Type Description
walletAddress string The address of the participant's wallet
eventId number The ID of the event
Source:
Returns:
- `true` if the participant was added successfully, `false` otherwise
Type
boolean

(async) attendeesLookup(minter, eventId) → {Array.<array>}

Looks up the list of users that started process of claiming the NFT
Parameters:
Name Type Description
minter string The wallet address of the event creator
eventId string ID of selected claim event
Source:
To Do:
  • Add permissions to configure who can access the list of participants
Throws:
  • If the `minter` or `eventId` parameters are not provided.
    Type
    Error
  • If the event does not exist
    Type
    Error
Returns:
An array of objects with data for users that requested to participate in event
Type
Array.<array>

(async) batchMint(walletAddress, nftokenCount, url, title, minterSeed, curentEventId) → {object}

Mints NFTs for created event and saves IPFS hash with data about event to Uri field
Parameters:
Name Type Description
walletAddress string Account of user requesting creation of event
nftokenCount integer Amount of NFTs that should be minted for event
url string IPFS hash with metadata for NFT
title string Name of event
minterSeed string The seed of the wallet that will be minting the NFTs
curentEventId number The event ID of the NFTs. Defaults to the next event ID in the sequence
Source:
Throws:
- If any of the required parameters are missing or if there is an issue minting the NFTs
Type
Error
Returns:
- An object containing the metadata related to new event for which NFTs were minted
Type
object

(async) checkIfAccountExists(walletAddress)

Parameters:
Name Type Description
walletAddress string The address of the participant's wallet
Source:
Returns:
true if account was found on selected network or false if it wasn't

(async) createSellOfferForClaim(buyer, minterSeed, TokenID) → {object}

Creates a sell offer for NFT from selected event The offer has to be accepted by the buyer once it was returned * In current design checks to see whether or not there are still any NFTs * to claim are done outside of this class in related API route
Parameters:
Name Type Description
buyer string wallet address of user trying to claim NFT
minterSeed string seed of wallet storing NFTs from selected event
TokenID string ID for NFT that should be claimed
Source:
To Do:
  • Whitelist system to only allow claiming from certain adresses
  • Deadline system where NFTs can only be claimed before the event ends
  • Return previously created offer for user that's already event participant
Throws:
- If any of the required parameters are missing or if there is an issue creating the sell offer
Type
Error
Returns:
- The metadata of the sell offer for a given NFT from selected event
Type
object

(async) getAccountTickets(walletAddress, client) → {Array.<object>}

Retrieves a list of all tickets owned by a particular address
Parameters:
Name Type Description
walletAddress string The wallet address to check
client object The XRPL client to use for the request
Source:
Returns:
- An array of tickets owned by the given address. If no tickets are found, returns an empty array
Type
Array.<object>

(async) getBatchNFTokens(address, taxonopt) → {Array.<object>}

Checks for all NFTs owned by a particular address
Parameters:
Name Type Attributes Description
address string The wallet address to check
taxon string <optional>
An optional parameter used to filter the NFTs by taxon
Source:
Returns:
- An array of NFTs owned by the given address. If no NFTs are found, returns an empty array
Type
Array.<object>

(async) getNewAccount() → {object}

Creates new XRPL wallet and funds it
Source:
Returns:
- Object with new wallet that was created and funded
Type
object

(async) verifyOwnership(walletAddress, signature, minter, eventId) → {boolean}

Verifies whether or not walletAddress account is owner of NFT from event with eventId that was issued by wallet that matches minter parameter. This step only works if user has interacted with the app previously by generating unique id that has to be included in the signed tx memo and turned into hex value * Wallet from signature has to match walletAddress
Parameters:
Name Type Description
walletAddress string Address of wallet for the user wanting to verify
signature string Signature that should be signed by the same account as walletAddress. This could be done either using XUMM or `sign` function from xrpl library. The mock transaction from signature has to contain memo with number generated for walletAddress. See test.js for example implementation of this
minter string The address of the wallet that minted the NFT
eventId number The event ID of the NFT
Source:
Returns:
Indicats whether the walletAddress owns any NFT from particular event
Type
boolean