-
Notifications
You must be signed in to change notification settings - Fork 240
/
trust-wallet.ts
51 lines (48 loc) · 1.33 KB
/
trust-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
import { WalletOptions, WalletConfig } from "@thirdweb-dev/react-core";
import { WCMeta } from "../types/wc";
import { WalletConnectBase } from "./wallet-connect/WalletConnectBase";
import { WalletConnectConfig } from "./wallet-connect/wallet-connect";
import { TRUST_ICON } from "../../assets/svgs";
export class TrustWallet extends WalletConnectBase {
static id = "trust" as const;
static meta = {
name: "Trust Wallet",
iconURL: TRUST_ICON,
links: {
native: "trust:",
universal: "https://link.trustwallet.com",
},
};
getMeta(): WCMeta {
return TrustWallet.meta;
}
}
/**
* Wallet config for Trust Wallet.
*
* @param config - The config for TrustWallet
* @returns The wallet config to be used by the ThirdwebProvider
*
* @example
* ```jsx
* import { ThirdwebProvider, trustWallet } from "@thirdweb-dev/react-native";
*
* <ThirdwebProvider
* supportedWallets={[trustWallet()]}>
* <YourApp />
* </ThirdwebProvider>
* ```
*/
export const trustWallet = (config?: WalletConnectConfig) => {
return {
id: TrustWallet.id,
meta: TrustWallet.meta,
create: (options: WalletOptions) =>
new TrustWallet({
...options,
walletId: "trust",
projectId: config?.projectId,
}),
recommended: config?.recommended,
} satisfies WalletConfig<WalletConnectBase>;
};