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.
Process QR Codes for Airdrops
Process QR Codes for Airdrops
QR codes can contain specific details like the coinType, scanType, and the amount. When these details are included in a QR code, it not only provides the recipient's address but also initializes an airdrop process automatically.
coinType: The type of coin to be airdropped
scanType: A directive, such as
Passport.scanTypes.AIR_DROP, specifying the scan actionamount: The quantity of the coin to be airdropped
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 method allows you to request an airdrop by specifying parameters such as the amount and the SUI network you want to use. 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.
Example Code
Here is an example of how to use the passport.requestAirDrop function:
await passport.requestAirDrop({ amount: 1, coinType: ''});This code requests an airdrop of 1 unit of the specified coin type.