Argent Vault on Ethereum L1
How to make sure your dapp works seamlessly with Argent!
What is Argent Vault?
Argent is the first smart wallet for Ethereum. It’s the only non-custodial mobile wallet that combines easy access to dapps and security features such as recovery without seed phrases, trusted contacts and multisig. These features are made possible by Argent’s smart contract architecture.
Argent website: https://www.argent.xyz
Smart Contracts Repository: https://github.com/argentlabs/argent-contracts/
What is WalletConnect?
WalletConnect is an open source protocol for connecting decentralized applications ("dapps") to mobile wallets, via QR code scanning or deep linking. A user can interact securely with any dapp from their mobile phone, making WalletConnect-enabled wallets a safer choice compared to desktop or browser extension wallets.
WalletConnect and Argent
As a mobile wallet, Argent fully supports the WalletConnect protocol. Since Argent is a smart contract based wallet, you need to pay attention to some specific features.
Checking the correct signature
Externally Owned Accounts (EOA) can sign messages with their associated private keys, however, smart contracts cannot. EIP-1271 outlines a standard way for contracts to verify if a provided signature is valid when an account is a contract.
The Argent wallet implements theisValidSignature()
method, as per EIP-1271. A dapp that wants to verify the signature of an Argent user should therefore call isValidSignature()
on the Argent wallet instead of ecrecover()
(as would be used to verify signatures from EOA accounts).
The parameter _hash
should be EIP-191 compliant. See full example here in JavaScript (using ethers.js library):
Wallet detection
We have developed and deployed a simple contract to detect if a given address corresponds to an Argent wallet. The contract exposes a single isArgentWallet(address)
method that returns true if the code deployed at the input address matches a deployed version of the Argent wallet.
The detector contract is deployed on Ropsten testnet and Mainnet:
Multicall
Argent wallets support the ability to batch transactions into a single transaction, for example an ERC20 approval followed by a contract call.
The best practice is to check if the wallet is an Argent wallet using the wallet detector contract and then batch the transactions:
Meta transactions and relayers
Argent wallet uses the concept of meta transactions. These are a particular type of transaction which are signed by one or more key pairs (in our case the wallet's owner and potentially their guardians) but are submitted to the Ethereum network by a relayer. The relayer pays the gas fee (in ETH) and the wallet will refund the relayer (in ETH or ERC20 tokens) up to an amount signed by the wallet's owner.
From the dapp's perspective, this is managed by the Argent mobile application. The dapp will submit a regular { to, value, data }
transaction to the web3 provider. This transaction will be transmitted to the Argent mobile application through WalletConnect. The mobile wallet will transform the data into a meta transaction:
to
will be the ArgentRelayerManager
contract addressdata
will be the encoded data of the call to theexecute()
method with the relevant parameters
The dapp will receive the transaction hash in order to monitor the status of the transaction and events will be emitted as usual.
Our relayer has the ability to replay a transaction with a higher gas price due to fluctuating network conditions. The transaction hash is modified and the dapp will not be aware of the new transaction hash.
One solution could be for the dapp to observe a specific event being emitted instead of transaction status. We are working on defining a standard for a dapp to be notified when a transaction is replaced and the transaction hash changes (contact us if you are interested in this).
Login UX best practice
To improve the login experience for Argent users, we recommend showing an Argent branded login button at the top level. This ensures people less familiar with WalletConnect can log in to your app. When clicking on the Argent login, you then present the WalletConnect QR code.
You can find an example of this implementation on https://app.flexa.network/connect
FAQ
Can I use the ERC20 permit function?
It depends on how the ERC20 smart contract implements the permit()
method. If you look below (source Etherscan) at the Maker DAI implementation, you will notice at line 24 the use of ecrecover()
and not EIP-1271 to verify the signature. Here, the call will fail with Argent wallets.
Argent may override the "infinite value" and ask a user to input a smaller amount due to the additional security risk of allowing large persistent approvals. When checking the allowance in your dapp you need to check for the exact amount the user wants to spend.
Can I use 3rd party relayers with Argent?
Yes, but the relayer needs to implement a call to the execute()
method of our RelayerManager
smart contract. You will have to get the wallet owner signing the correct payload which is not straightforward. Please contact us if you're interested in this topic.
Do you estimate gas?
Yes, we use eth_estimateGas
before sending any transaction.
Do you support WalletConnect mobile deeplinks?
Yes, WalletConnect will work on mobile browsers (or native mobile apps) and will deep link to the Argent wallet.
How can I test the integration?
You can test Argent on Ropsten on both iOS and Android. Contact dapps@argent.xyz to receive a test build.
Last updated