Learn how to authenticate users, create embedded wallets, and send transactions in your Flutter app
sendCode
method.
Note: you must provide the phone number in E.164 format.
sendCode
will return Success()
with no associated type. If the provided email address is invalid, or sending the OTP fails, sendCode
will return Failure()
containing a PrivyException
.
loginWithCode
method. Pass the following parameters to this method:
loginWithCode
will return Success()
with an encapsulated PrivyUser
.
If the provided OTP/phone number combination is invalid, loginWithCode
will return Failure()
, containing a PrivyException.
createEthereumWallet
method on your PrivyUser
instance.EmbeddedEthereumWallet
object is returned as an encapsulated value of Success()
.This method will fail if:allowAdditional
is not set to true.personal_sign
).Once you have an instance of an EmbeddedEthereumWallet
, you can make RPC requests by using the provider: EmbeddedEthereumWalletProvider
hook and using its request
method. For example, wallet.provider.request(request: rpcRequest)
. This request method will suspend and await if the embedded wallet needs to wait for any internal ready state.EthereumRpcRequest
object that contains:method
: the name of the JSON-RPC method for the wallet to execute (e.g. 'personal_sign'
)params
: an array of parameters required by your specified method
chainId
in the transaction request.Example usage: