-
Notifications
You must be signed in to change notification settings - Fork 240
/
rainbow-wallet.ts
53 lines (50 loc) · 1.31 KB
/
rainbow-wallet.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import {
WalletOptions as WalletOptionsRC,
WalletConfig,
} from "@thirdweb-dev/react-core";
import { WalletConnectBase } from "./wallet-connect/WalletConnectBase";
import { WalletConnectConfig } from "./wallet-connect/wallet-connect";
import { RAINBOW_ICON } from "../../assets/svgs";
export class RainbowWallet extends WalletConnectBase {
static id = "rainbow" as const;
static meta = {
name: "Rainbow",
iconURL: RAINBOW_ICON,
links: {
native: "rainbow:",
universal: "https://rnbwapp.com",
},
};
getMeta() {
return RainbowWallet.meta;
}
}
/**
* Wallet config for Rainbow Wallet.
*
* @param config - The config for RainbowWallet
* @returns The wallet config to be used by the ThirdwebProvider
*
* @example
* ```jsx
* import { ThirdwebProvider, rainbowWallet } from "@thirdweb-dev/react-native";
*
* <ThirdwebProvider
* supportedWallets={[rainbowWallet()]}>
* <YourApp />
* </ThirdwebProvider>
* ```
*/
export const rainbowWallet = (config?: WalletConnectConfig) => {
return {
id: RainbowWallet.id,
meta: RainbowWallet.meta,
create: (options: WalletOptionsRC) =>
new RainbowWallet({
...options,
walletId: RainbowWallet.id,
projectId: config?.projectId,
}),
recommended: config?.recommended,
} satisfies WalletConfig;
};