Skip to content

Commit b6f1f1d

Browse files
feat: 支持在移动端用链接跳转的方式链接钱包 (#1364)
* feat: support universal link * refactor: WalletItem * fix: plugin icon show logic * fix: url encode * chore: add changelog * fix: rename universalLink to deeplink * fix: typeerror * chore: revert test case * test: add test case * fix: lint * chore: update test case * test: improve test case * chore: add changeset * fix: update docs and fix ts error
1 parent 887c5d5 commit b6f1f1d

File tree

25 files changed

+1044
-584
lines changed

25 files changed

+1044
-584
lines changed

.changeset/heavy-rice-deliver.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@ant-design/web3-assets': minor
3+
'@ant-design/web3-common': minor
4+
'@ant-design/web3': minor
5+
---
6+
7+
feat: support UniversalLink for support connect some wallet in mobile

.changeset/odd-feet-search.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@ant-design/web3-solana': minor
3+
'@ant-design/web3-icons': minor
4+
---
5+
6+
feat: support SolflareWallet

packages/assets/src/wallets/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ export * from './trust';
1313
export * from './mobile-wallet';
1414
export * from './sui-wallet';
1515
export * from './suiet';
16+
export * from './solflare';

packages/assets/src/wallets/okx-wallet.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ export const metadata_OkxWallet: WalletMetadata = {
1717
description: 'Access your wallet right from your favorite web browser.',
1818
},
1919
],
20+
// TODO suport deeplink
2021
};

packages/assets/src/wallets/phantom.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@ export const metadata_Phantom: WalletMetadata = {
1717
description: 'Access your wallet right from your favorite web browser.',
1818
},
1919
],
20+
deeplink: {
21+
urlTemplate: 'https://phantom.com/ul/browse/${url}?ref=${ref}',
22+
},
2023
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import type { WalletMetadata } from '@ant-design/web3-common';
2+
import { ChromeCircleColorful, SolflareColorful } from '@ant-design/web3-icons';
3+
4+
export const metadata_Solflare: WalletMetadata = {
5+
icon: <SolflareColorful />,
6+
name: 'Solflare',
7+
remark: 'Solflare Wallet',
8+
app: {
9+
link: 'https://solflare.com/',
10+
},
11+
extensions: [
12+
{
13+
key: 'Chrome',
14+
browserIcon: <ChromeCircleColorful />,
15+
browserName: 'Chrome',
16+
link: 'https://chromewebstore.google.com/detail/solflare-wallet/bhhhlbepdkbapadjdnnojkbgioiodbic',
17+
description: 'Access your wallet right from your favorite web browser.',
18+
},
19+
],
20+
// TODO suport deeplink
21+
};

packages/common/src/types.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,18 @@ export type WalletMetadata = {
233233
* @descEn Whether the parameters of fast scan code are supported
234234
*/
235235
transferQRCodeFormatter?: (params: Record<string, any>) => string;
236+
/**
237+
* @desc 钱包支持的 Universal Link 配置
238+
* @descEn Wallet Universal Link configuration
239+
*/
240+
deeplink?: {
241+
/**
242+
* @desc Universal Link 的 URL 模板,用于构建钱包的通用链接
243+
* @descEn URL template for Universal Link, used to build universal links for the wallet
244+
* @example "https://phantom.com/ul/browse/${url}?ref=${ref}"
245+
*/
246+
urlTemplate: string;
247+
};
236248
};
237249

238250
export type Balance = BalanceMetadata & {

0 commit comments

Comments
 (0)