Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERC-7253: Universal Wallet Uplink (UwU Link) 馃憠馃憟 #7253

Closed
wants to merge 9 commits into from
118 changes: 118 additions & 0 deletions EIPS/eip-7253.md
@@ -0,0 +1,118 @@
---
eip: 7253
title: Universal Wallet Uplink aka UwU Link
description: A data format for interface and mobile wallet signature requests
author: Tina Zheng (@tinaszheng), Chelsy Wu (@chelsywu)
discussions-to: https://ethereum-magicians.org/t/eip-7253-uwu-link/14869
status: Draft
type: Standards Track
category: ERC
created: 2023-06-28
---

## Abstract

This EIP defines a data format for interfaces to specify transaction or message signature requests without the need for a session-based wallet connection scheme.
馃ズ
馃憠 馃憟

## Motivation

The increasing adoption of mobile-based crypto wallets underscores a need for more convenient and reliable ways of interacting with decentralized app interfaces. The current user experience of mobile wallet to dapp interactions is limited to the session-based connection scheme via the third-party service, WalletConnect. This EIP introduces a scheme as an additional option for wallet users to receive transaction and message signature requests without WalletConnect.

## Specification

Using UwU Link, interfaces can skip the wallet connection step and display a transaction request object and an optional webhook URL as part of a QR code. The wallet should scan the QR code, parse the transaction request object, send the transaction, and, if the webhook URL exists, call it with the method and the returned transaction hash.

Request format:

```txt
uwulink{
method: "eth_sendTransaction" | "eth_signTypedData" | "personal_sign",
chain_id: number,
value: {
to: string,
data: string,
value: BigNumberish
},
webhook_url?: string,
dapp: {
name: string,
url?: string,
icon?: string
}
}
}
```

If the webhook_url is defined, the wallet should send a `POST` request with the method and the returned transaction hash or signature in the body:

```js
const transactionHash = await signTransaction({ ...uwulink.value, from: account, })
fetch(uwulink.webhook_url, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({ "method": uwulink.method, "response": transactionHash })
})
```

Visual representation of the UX flow:
TODO: Insert images with captions here

### Optional: wallet address sending

Sometimes, it can be helpful for interfaces to know the wallet's address. For example, the interface may want to display the user's token or ETH balance, or check the user's token allowances to know whether or not to first send an approval transaction. This can be done using a similar specification:

```txt
uwulink{method:"get_address","webhook_url":"uwulinkcallback.com/<uuid>",dapp:{"name":"UwULink demo",url:"interface-url.example",icon:""}}}
```

The wallet should call the webhook URL with the method and the user's address.

```js
fetch('uwulinkcallback.com/<uuid>', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({ "method": "get_address", "response": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" })
})
```

### Optional: batched transactions with conditional inclusion

A dapp may need to request several transaction or message signing requests as part of one user action. For example, to swap on Uniswap from PEPE to ETH, a user may need to approve Permit2 on PEPE, sign a permit message to update the Permit2 allowance on PEPE, and then finally do the Swap from PEPE to ETH. This EIP also specifies a way to use lens contracts to prepare signature requests based on `msg.sender`:

```txt
uwulink{"method":"contract_prepare", "contract_address": "0xabc..", params: { arguments_to_lens_here } }
```

TODO: Insert steps here!

## Rationale

- UwU Link does not require a third-party, centralized server to work, as all transaction and signature requests can happen through a QR code. Although the webhook is considered an off-chain and serverful component of UwU Link, it is ultimately optional to the interface, and we believe the webhook specification is light enough such that interfaces can sub in their own webhook implementations easily.

## Backwards Compatibility

There are no backwards compatibility concerns as both wallets and dapps can support UwU Link, WalletConnect, and other existing schemes in parallel.

## Reference Implementation

Example request

```txt
uwulink{method:"eth_sendTransaction",chainId:1,value:{"to":"example.eth",data:"0x0",value:0},"webhook_url":"uwulinkcallback.com/<uuid>",dapp:{"name":"UwULink demo",url:"interface-url.example",icon:""}}}
```

## Security Considerations

Needs discussion.

## Copyright

Copyright and related rights waived via [CC0](../LICENSE.md).