Skip to main content

wallet_scanQRCode

MetaMaskMobile

Requests that the user scan a QR code using their device camera. Introduced by EIP-945.

Params

(1)

1. regex

An array containing a regular expression (regex) string for matching arbitrary QR code strings.

regex

Result

(ScanQRCodeResult)

A string corresponding to the scanned QR code. If a regex string is provided, the resulting string matches it. If no regex string is provided, the resulting string matches an Ethereum address. If neither condition is met, the method returns an error.

string

Params

regex

Unsupported field schema for field root: Missing items definition.

{
  "type": "array"
}

Request

await window.ethereum.request({
"method": "wallet_scanQRCode",
"params": [
null
]
});