hotspot-app
hotspot-app copied to clipboard
[#1341] feat: Allow QR code scanning of "transfer_hotspot_v2" transactions
Issue: https://github.com/helium/hotspot-app/issues/1341
This PR adds the ability to scan a QR code allowing users to pre-fill the "Transfer Hotspot" form (while also skipping the "has valid activity" check if directed as such in the code itself). The expected payload for the newly supported QR code is:
{
type: "transfer"
newOwnerAddress: string
hotspotAddress?: string
skipActivityCheck?: boolean
isSeller?: boolean
}
This PR also updates src/providers/AppLinkProvider.tsx
to determine a specific "ScanDataType" for scanned data, then handles each individually
// ScanDataType describes both the scanned data format as well as intended use.
// For example, multiple types are intended to pre-fill the payment "send" form but can provide
// varying levels of information (like single or multiple recipients, optional memo fields, etc).
enum ScanDataType {
// Deeplink to somewhere in the app
DEEPLINK,
// Hotspot address update
LOCATION_UPDATE,
// DC burn
DC_BURN,
// Hotspot transfer
TRANSFER,
// Hotspot transfer with only address provided
TRANSFER_ADDRESS_ONLY,
// Payment
PAYMENT,
// Payment with only address provided
PAYMENT_ADDRESS_ONLY,
// Payment to multiple recipients
PAYMENT_MULTI,
// Payment to multiple recipients and optional memos
PAYMENT_MULTI_MEMO,
}