Overview
Use PassScan to facilitate seamless token transfers and airdrops, leveraging blockchain technology for efficient digital rights management. This feature empowers you to interact with user passport IDs and QR codes, streamlining processes in the blockchain ecosystem.
Initiate PassScan
Displaying PassScan programmatically
To display the PassScan page programmatically in Credenza, you can use the passport.openUI function. This function allows you to navigate to different pages within the application using code.
To open the PassScan, use the following code snippet:
passport.openUI(Passport.pages.SCANNER);
The passport.openUI function takes a parameter specifying the page to navigate to. In this case, Passport.pages.SCANNER is used to specify the PassScan page.
Navigate to PassScan
To begin using PassScan, first access the sidebar menu. Look for the PassScan menu item and select it. This item is located among other options such as Sign Out, Show ID, Wallet, and My Account.
Upon selecting PassScan, a modal window will appear. This modal prompts you to scan a QR code. Ensure the PassScan menu item is chosen to reach this screen.
Scan QR Code
Select PassScan from the sidebar menu. A modal window labeled Scan QR Code will appear. Scan the QR code to process the airdrop.
Interact with the Scan QR Code heading in the modal. Ensure the QR code is clearly visible within the scanning area.
QR Codes with User Address
The QR code you scan can contain the recipient's address. This feature is handy for sending tokens quickly without manual input.
After scanning the QR code, the system automatically opens the Send Tokens page. The recipient's address field will be prepopulated with the address obtained from the QR code. This streamlines the process and reduces errors.
Using PassScan for Token Purchases
You can use the PassScan feature in Credenza to facilitate token purchases. This enhances the ease of transactions, leveraging QR codes to automatically input necessary details and redirect you to the payment interface.
Process Overview
When you scan a QR code designed for token purchases, the system processes the code and extracts the necessary information. It then opens the transaction UI with this data to streamline the purchasing process.
Automatic Transition to Payment UI
After processing the QR code, PassScan automatically directs you to the payment interface.
The Passport sets up the page options with the necessary transaction details, such as the title, typeId, amount, tokenId, and contractAddress. It then opens the payment page for you to complete the transaction.
Request Loyalty Points via Scanner
To request loyalty points using the scanner, you need to scan a QR code that is configured with the ScanTypes.REQUEST_LOYALTY_POINTS type, eventId and contractAddress.
After the QR code is scanned, the Loyalty Points request will be processed programmatically using the following code:
The Scanner will handle the QR code data and execute the necessary actions to request the loyalty points.
Using passport.requestLoyaltyPoints Function
Alternatively, you can request loyalty points by using the passport.requestLoyaltyPoints function from the Passport API.
Use passport.requestLoyaltyPoints as an Alternative
Consider using the 'passport.requestLoyaltyPoints' function for loyalty points request. It's particularly useful when you want more control over the process or need to integrate it into automated workflows.
This method allows you to request loyalty points programmatically without needing to scan a QR code.
Process QR Codes for Airdrops
QR codes can contain specific details like the
contractAddress: string
tokenId?: string | number
amount?: number
targetAddress: stringWhen these details are included in a QR code, it not only provides the recipient's address but also initializes an airdrop process automatically.
After scanning a QR code with this information, PassScan will automatically initiate the airdrop. This makes token transfers more efficient by reducing the need for manual input.
Use Alternative Airdrop Method
Alternatively, you can use the passport.requestAirDrop function to process airdrops directly. This approach provides a programmatic way to handle airdrops without needing to scan a QR code.
Use passport.requestAirDrop as an Alternative
Consider using the 'passport.requestAirDrop' function for airdrops. It's particularly useful when you want more control over the airdrop process or need to integrate it into automated workflows.
Using passport.requestAirDrop
The passport.requestAirDrop function is another way to process airdrops seamlessly. It allows you to request an airdrop programmatically.