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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web3Modal API v2 spec #239

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6778066
wip
bkrem Apr 25, 2024
116c5c0
Update docs/specs/meta-clients/web3modal/api.md
bkrem May 6, 2024
008e4bc
Update docs/specs/meta-clients/web3modal/api.md
bkrem May 6, 2024
69cc212
Update docs/specs/meta-clients/web3modal/api.md
bkrem May 6, 2024
4591ea2
Update docs/specs/meta-clients/web3modal/api.md
bkrem May 6, 2024
267a7cc
chore: tweak title
bkrem May 7, 2024
cd22163
chore: separate out v1 spec and backlink from v2 spec
bkrem May 7, 2024
85153e5
chore: adds missing documentation for ios-data/android-data endpoints
bkrem May 10, 2024
a1fc82e
chore: adds missing documentation for `token` image endpoint
bkrem May 10, 2024
6f7dbfa
chore: adds missing documentation for `currency` endpoint
bkrem May 10, 2024
d4de975
chore: adds missing documentation for `get-analytics-config` endpoint
bkrem May 10, 2024
9c7bc6e
chore: remove redundant `/public/` path segments
bkrem May 10, 2024
95d26f0
fix: remove redundant `get-` prefix from `analytics-config` route
bkrem May 10, 2024
1e98cea
fix: typo
bkrem May 30, 2024
0fff040
feat: adds granular image dimension params to spec
bkrem May 30, 2024
fcc664a
chore: adds `POST /v2/wallets` endpoint variant
bkrem Jun 5, 2024
87420ad
fix: provide both mobile.deep_link/mobile.universal_link over opaque
bkrem Jun 12, 2024
2d8db88
refactor: simplify GET/POST /v2/wallets` to only `POST` variant
bkrem Jun 12, 2024
d84b320
refactor: break out compound `sv=` param into query key for each part
bkrem Jun 12, 2024
00580b2
chore: mandate use of `Accept-Encoding` compression headers
bkrem Jul 3, 2024
9c12054
Update docs/specs/meta-clients/web3modal/api.md
bkrem Jul 17, 2024
e0f756c
Update docs/specs/meta-clients/web3modal/api.md
bkrem Jul 17, 2024
f23a56d
fix: wording
bkrem Jul 19, 2024
58c9c6d
fix: align query param example keys
bkrem Jul 19, 2024
8812c59
Update docs/specs/meta-clients/web3modal/api.md
bkrem Aug 7, 2024
dce37ae
Update docs/specs/meta-clients/web3modal/api.md
bkrem Aug 7, 2024
6d25827
chore: replace page/entries with offset/limit parameters
bkrem Aug 7, 2024
dd12fb0
chore: use `coinbaseWalletSDK` identifier
bkrem Aug 8, 2024
f7248ba
chore: add env= and os= optional query params
bkrem Aug 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 142 additions & 0 deletions docs/specs/meta-clients/web3modal/api-v1-legacy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# API

Web3Modal has it's own api available at [api.web3modal.com](https://api.web3modal.com) that is used to fetch wallet data from a WalletConnect maintained [wallet & dapp registry](https://walletconnect.com/explorer).

All responses are cached for a minimum of 2h.

## Headers

All api requests must contain following headers. See [types](./types.md)

```ts
interface Headers {
"x-project-id": string;
chris13524 marked this conversation as resolved.
Show resolved Hide resolved
"x-sdk-type": SdkType;
"x-sdk-version": SdkVersion;
}
```

## Methods

### GET `/getWallets`

Returns total count and wallet data, based on provided body inputs. See [types](./types.md).

```ts
interface Request {
headers: Headers;
}

interface UrlQueryParams {
page: string; // eg. 1
entries: string; // eg. 100
search?: string; // eg. MetaMa...
include?: string; // eg. id1,id2,id3
exclude?: string; // eg. id1,id2,id3
chains?: string; // eg. eip155:1,solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
platform?: "ios" | "android";
}

interface Response {
chris13524 marked this conversation as resolved.
Show resolved Hide resolved
count: number;
data: Array<{
id: string;
name: string;
homepage: string;
image_id: string;
chris13524 marked this conversation as resolved.
Show resolved Hide resolved
order: number;
mobile_link: string | null;
desktop_link: string | null;
webapp_link: string | null;
app_store: string | null;
play_store: string | null;
injected:
| {
namespace: string;
injected_id: string;
}[]
| null;
}>;
}
```

### GET `/getWalletImage/:wallet_id`

Returns image logo for requested `wallet_id`. See [types](./types.md).

```ts
interface Request {
headers: Headers;
}

type Response = Blob;
```

### GET `/public/getAssetImage/:asset_id`

Returns image for public asset for requested `asset_id`, i.e network logo, token logo or connector logo.

```ts
interface Request {
headers: Headers;
}

type Response = Blob;
```

#### Known Static Asset IDs

There are a number of known static asset IDs that can be used to fetch images, e.g. for networks and connectors:

```typescript
// Maps EIP155 chain IDs -> `asset_id`
chris13524 marked this conversation as resolved.
Show resolved Hide resolved
const EIP155NetworkImageIds = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ronin is missing

// Ethereum
1: "692ed6ba-e569-459a-556a-776476829e00",
// Arbitrum
42161: "600a9a04-c1b9-42ca-6785-9b4b6ff85200",
// Avalanche
43114: "30c46e53-e989-45fb-4549-be3bd4eb3b00",
// Binance Smart Chain
56: "93564157-2e8e-4ce7-81df-b264dbee9b00",
// Fantom
250: "06b26297-fe0c-4733-5d6b-ffa5498aac00",
// Optimism
10: "ab9c186a-c52f-464b-2906-ca59d760a400",
// Polygon
137: "41d04d42-da3b-4453-8506-668cc0727900",
// Gnosis
100: "02b53f6a-e3d4-479e-1cb4-21178987d100",
// Evmos
9001: "f926ff41-260d-4028-635e-91913fc28e00",
// ZkSync
324: "b310f07f-4ef7-49f3-7073-2a0a39685800",
// Filecoin
314: "5a73b3dd-af74-424e-cae0-0de859ee9400",
// Iotx
4689: "34e68754-e536-40da-c153-6ef2e7188a00",
// Metis,
1088: "3897a66d-40b9-4833-162f-a2c90531c900",
// Moonbeam
1284: "161038da-44ae-4ec7-1208-0ea569454b00",
// Moonriver
1285: "f1d73bb6-5450-4e18-38f7-fb6484264a00",
// Zora
7777777: "845c60df-d429-4991-e687-91ae45791600",
// Celo
42220: "ab781bbc-ccc6-418d-d32d-789b15da1f00",
// Base
8453: "7289c336-3981-4081-c5f4-efc26ac64a00",
// Aurora
1313161554: "3ff73439-a619-4894-9262-4470c773a100",
};

// Maps connector name -> `asset_id`
const ConnectorImageIds = {
coinbaseWallet: "0c2840c3-5b04-4c44-9661-fbd4b49e1800",
safe: "461db637-8616-43ce-035a-d89b8a1d5800",
ledger: "54a1aa77-d202-4f8d-0fb2-5d2bb6db0300",
walletConnect: "ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",
injected: "07ba87ed-43aa-4adf-4540-9e6a2b9cae00",
};
```
Loading