Faster, cheaper and safer Dapp access

A new, open sourced component to Wallet Connect

Tagged

Matthew Wright

Oct 3, 2024

Quick summary

🛠️ Just a heads up that this post is mainly aimed at Dapp & Wallet developers

At EthCC 2020 we introduced our new method for making Dapps faster, cheaper and safer to access from mobile wallets.

We’ve done this with Wallet Connect, the standard for securely connecting mobile wallets to desktop Dapps.

Here’s how, why it matters, and what you can do as a Dapp or Wallet developer to speed its adoption. You can also see the full talk here.

We’ve open sourced our work as we want everyone to be able to easily access Dapps. For Dapp developers it’s just four new lines of code.

Quick background on Argent

For those new to Argent, the picture below is a quick overview. We’re a smart contract wallet with the ease of use and security of a bank — without the bank.

We also make it radically easier to access Dapps.

Argent provides the best features of a bank without the custody

The Argent foundation from which you can explore the world of Dapps

Using Wallet Connect today

Argent – the safest way to use WalletConnect

Argent’s first integration with Wallet Connect — note that ‘Pre-authorise’ and ‘Call Contract’ are separate steps, something we later solved, as detailed in this post

Argent first integrated Wallet Connect a few months ago. This meant you could use your mobile Argent wallet to access a desktop Dapp like Pool Together.

Importantly, we designed our integration differently to the traditional Wallet Connect approach. Why?

1. You should only approve what you want to spend

Most Dapps ask you to authorize them to potentially take a nearly unlimited amount of tokens (10⁵⁰ actually) from your wallet. Argent only prompts you to approve the amount you want to spend.

2. You should be protected by your daily limit

With Argent, when you authorize a Dapp to interact with your wallet you’re protected by your daily transfer limit. This means there’s no risk of anyone draining your wallet. You can go over your daily limit with the help of your Guardians (friends or hardware wallets you trust).

3. You should be able to easily revoke a Dapp’s access to a token

Changed your mind about a Dapp? Revoke their access with a tap.

We felt our integration was as smooth as any involving a blockchain but we weren’t fully satisfied.

The problem was having to approve an ERC20 before a contract call. In Pool Together, for example, this meant having to make two transactions to buy some tickets. And having to wait for the first transaction to be mined.

The result could be a little cumbersome, wasn’t the best use of gas and time, and left room for further minimising the risks of super high ERC20 approvals.

We pushed ourselves to find a better way.

How can we do better?

Fortunately we can harness the power of smart contract wallets as they can bundle lots of transactions into one. This significantly simplifies the experience.

How have we done this?

  • We have added a new approveAndCall() method to the wallet
  • This orchestrates the approval of the exact amount of token required THEN executes the contract call.

All in one atomic transaction!

The result is a faster, cheaper and safer Dapp experience, as the video below shows…

The new and improved Dapp experience

Here’s how it works for Dapps

We’ve tried to make things easier for Dapp developers by creating a small NPM library: @argent/smartwallet-utils.

It’s only four new lines of code. The library also solves the problem Dapp developers have with smart contract wallet signatures.

ERC-20 ApproveAndCall method for Argent and Dapps, EIP1271

Here’s Julien explaining it in more detail at ETHCC.

We’d love other smart-contract based wallets to add their config

We’ve open sourced this work. To increase adoption our library defines a simple interface to represent a wallet. Other smart contract wallet providers can simply add their implementation of that interface in the library to enable its features. It can be enabled in 50 lines of Javascript.

ERC-20 ApproveAndCall config for smart contract wallets

Next steps for Dapp Developers

[Easier], better, faster, stronger — Ethereum 2020