Skip to content

Commit e8a4901

Browse files
authored
feat: add support for Coinbase Wallet (#653)
* feat: add support for Coinbase wallet
1 parent 8c71674 commit e8a4901

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed

packages/use-solana/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"@solana/wallet-adapter-brave": "0.1.10",
3939
"@solana/wallet-adapter-clover": "^0.4.12",
4040
"@solana/wallet-adapter-coin98": "^0.5.13",
41+
"@solana/wallet-adapter-coinbase": "^0.1.5",
4142
"@solana/wallet-adapter-exodus": "^0.1.11",
4243
"@solana/wallet-adapter-glow": "^0.1.11",
4344
"@solana/wallet-adapter-huobi": "^0.1.8",

packages/use-solana/src/providers.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
BRAVEWALLET,
44
CLOVER,
55
COIN98,
6+
COINBASEWALLET,
67
EXODUS,
78
FILE,
89
GLOW,
@@ -20,6 +21,7 @@ import type { WalletAdapterNetwork } from "@solana/wallet-adapter-base";
2021
import { BraveWalletAdapter } from "@solana/wallet-adapter-brave";
2122
import { CloverWalletAdapter } from "@solana/wallet-adapter-clover";
2223
import { Coin98WalletAdapter } from "@solana/wallet-adapter-coin98";
24+
import { CoinbaseWalletAdapter } from "@solana/wallet-adapter-coinbase";
2325
import { ExodusWalletAdapter } from "@solana/wallet-adapter-exodus";
2426
import { GlowWalletAdapter } from "@solana/wallet-adapter-glow";
2527
import { HuobiWalletAdapter } from "@solana/wallet-adapter-huobi";
@@ -44,6 +46,7 @@ export enum DefaultWalletType {
4446
BraveWallet = "BraveWallet",
4547
Clover = "Clover",
4648
Coin98 = "Coin98",
49+
CoinbaseWallet = "CoinbaseWallet",
4750
Exodus = "Exodus",
4851
Glow = "Glow",
4952
Huobi = "Huobi",
@@ -161,6 +164,14 @@ export const DEFAULT_WALLET_PROVIDERS: WalletProviderMap<
161164
isInstalled: () => window.coin98 !== undefined,
162165
isMobile: true,
163166
},
167+
[DefaultWalletType.CoinbaseWallet]: {
168+
name: "Coinbase Wallet",
169+
url: "https://www.coinbase.com/wallet",
170+
icon: COINBASEWALLET,
171+
makeAdapter: () => new SolanaWalletAdapter(new CoinbaseWalletAdapter()),
172+
isInstalled: () => window.coinbaseSolana !== undefined,
173+
isMobile: true,
174+
},
164175
[DefaultWalletType.Clover]: {
165176
name: "Clover",
166177
url: "https://clover.finance",

packages/use-solana/src/typings/window.d.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ type ConnectOptions = {
99
onlyIfTrusted?: boolean;
1010
};
1111

12+
export interface CoinbaseWalletProvider {
13+
publicKey?: PublicKey;
14+
signTransaction(transaction: Transaction): Promise<Transaction>;
15+
signAllTransactions(transactions: Transaction[]): Promise<Transaction[]>;
16+
signAndSendTransaction(
17+
transaction: Transaction,
18+
options?: SendOptions
19+
): Promise<{ signature: TransactionSignature }>;
20+
signMessage(message: Uint8Array): Promise<{ signature: Uint8Array }>;
21+
connect(): Promise<void>;
22+
disconnect(): Promise<void>;
23+
}
24+
1225
type ExodusEvent = "accountChanged" | "connect" | "disconnect";
1326
type ExodusRequestMethod =
1427
| "connect"
@@ -122,6 +135,7 @@ declare global {
122135
disconnect: () => void;
123136
};
124137
};
138+
coinbaseSolana?: CoinbaseWalletProvider;
125139
clover_solana?: {
126140
signAllTransactions?: (txs: Transaction[]) => Promise<Transaction[]>;
127141
signTransaction: (tx: Transaction) => Promise<Transaction>;

packages/wallet-adapter-icons/src/index.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,27 @@ export const PHANTOM: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (
201201
</svg>
202202
);
203203

204+
export const COINBASEWALLET: React.FC<React.SVGProps<SVGSVGElement>> = (
205+
props
206+
) => (
207+
<svg
208+
width="1024"
209+
height="1024"
210+
viewBox="0 0 1024 1024"
211+
fill="none"
212+
xmlns="http://www.w3.org/2000/svg"
213+
{...props}
214+
>
215+
<rect width="1024" height="1024" fill="#0052FF" />
216+
<path
217+
fillRule="evenodd"
218+
clipRule="evenodd"
219+
d="M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z"
220+
fill="white"
221+
/>
222+
</svg>
223+
);
224+
204225
export const SLOPE: React.FC<React.SVGProps<SVGSVGElement>> = (props) => (
205226
<svg
206227
fill="none"

yarn.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2318,6 +2318,7 @@ __metadata:
23182318
"@solana/wallet-adapter-brave": 0.1.10
23192319
"@solana/wallet-adapter-clover": ^0.4.12
23202320
"@solana/wallet-adapter-coin98": ^0.5.13
2321+
"@solana/wallet-adapter-coinbase": ^0.1.5
23212322
"@solana/wallet-adapter-exodus": ^0.1.11
23222323
"@solana/wallet-adapter-glow": ^0.1.11
23232324
"@solana/wallet-adapter-huobi": ^0.1.8
@@ -2495,6 +2496,17 @@ __metadata:
24952496
languageName: node
24962497
linkType: hard
24972498

2499+
"@solana/wallet-adapter-coinbase@npm:^0.1.5":
2500+
version: 0.1.11
2501+
resolution: "@solana/wallet-adapter-coinbase@npm:0.1.11"
2502+
dependencies:
2503+
"@solana/wallet-adapter-base": ^0.9.16
2504+
peerDependencies:
2505+
"@solana/web3.js": ^1.50.1
2506+
checksum: 712bf7b8d4b395dbf07541d42633bcbaf6b4aed5e083c96dc48a696063dd9a895077ef2984e8a58016c21b31aeedafd09ef946233efb7338da39ea16c66dec78
2507+
languageName: node
2508+
linkType: hard
2509+
24982510
"@solana/wallet-adapter-exodus@npm:^0.1.11":
24992511
version: 0.1.11
25002512
resolution: "@solana/wallet-adapter-exodus@npm:0.1.11"

0 commit comments

Comments
 (0)