Skip to content

Commit

Permalink
feat: gateWallet (#1888)
Browse files Browse the repository at this point in the history
* feat: gateWallet

* update: gateWallet

* chore: optimize svg with svgo

* chore: alphabetize custom wallet list and remove translations

* revert: add translations for all languages apart from en_US

* revert: remove site/data/*/** docs

* chore: changeset

* update: remove translations and optimize svg logo

* fix: gatewallet svg

---------

Co-authored-by: Magomed Khamidov <53529533+KosmosKey@users.noreply.github.com>
Co-authored-by: Daniel Sinclair <d@niel.nyc>
  • Loading branch information
3 people committed Mar 27, 2024
1 parent 5c60239 commit 6c240ba
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .changeset/gorgeous-hairs-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@rainbow-me/rainbowkit": patch
"example": patch
"site": patch
---

Added Gate Wallet support with `gateWallet` wallet connector
2 changes: 2 additions & 0 deletions packages/example/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
foxWallet,
frameWallet,
frontierWallet,
gateWallet,
imTokenWallet,
kresusWallet,
ledgerWallet,
Expand Down Expand Up @@ -170,6 +171,7 @@ const config = getDefaultConfig({
foxWallet,
frameWallet,
frontierWallet,
gateWallet,
imTokenWallet,
kresusWallet,
ledgerWallet,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { isAndroid } from '../../../utils/isMobile';
import { DefaultWalletOptions, Wallet } from '../../Wallet';
import {
getInjectedConnector,
hasInjectedProvider,
} from '../../getInjectedConnector';
import { getWalletConnectConnector } from '../../getWalletConnectConnector';

export type GateWalletOptions = DefaultWalletOptions;

export const gateWallet = ({
projectId,
walletConnectParameters,
}: GateWalletOptions): Wallet => {
const isGateInjected = hasInjectedProvider({ namespace: 'gatewallet' });
const shouldUseWalletConnect = !isGateInjected;

return {
id: 'gate',
name: 'Gate Wallet',
rdns: 'io.gate.wallet',
iconUrl: async () => (await import('./gateWallet.svg')).default,
iconAccent: '#fff',
iconBackground: '#fff',
downloadUrls: {
android:
'https://play.google.com/store/apps/details?id=com.gateio.gateio',
ios: 'https://apps.apple.com/us/app/gate-io-buy-bitcoin-crypto/id1294998195',
mobile: 'https://www.gate.io/mobileapp',
qrCode: 'https://www.gate.io/web3',
chrome:
'https://chromewebstore.google.com/detail/gate-wallet/cpmkedoipcpimgecpmgpldfpohjplkpp',
browserExtension: 'https://www.gate.io/web3',
},
mobile: {
getUri: shouldUseWalletConnect
? (uri: string) => {
return isAndroid()
? uri
: `gtweb3wallet://wc?uri=${encodeURIComponent(uri)}`;
}
: undefined,
},
qrCode: shouldUseWalletConnect
? {
getUri: (uri: string) => uri,
instructions: {
learnMoreUrl: 'https://www.gate.io/learn',
steps: [
{
description: 'wallet_connectors.gate.qr_code.step1.description',
step: 'install',
title: 'wallet_connectors.gate.qr_code.step1.title',
},
{
description: 'wallet_connectors.gate.qr_code.step2.description',
step: 'create',
title: 'wallet_connectors.gate.qr_code.step2.title',
},
{
description: 'wallet_connectors.gate.qr_code.step3.description',
step: 'scan',
title: 'wallet_connectors.gate.qr_code.step3.title',
},
],
},
}
: undefined,
extension: {
instructions: {
learnMoreUrl: 'https://www.gate.io/learn',
steps: [
{
description: 'wallet_connectors.gate.extension.step1.description',
step: 'install',
title: 'wallet_connectors.gate.extension.step1.title',
},
{
description: 'wallet_connectors.gate.extension.step2.description',
step: 'create',
title: 'wallet_connectors.gate.extension.step2.title',
},
{
description: 'wallet_connectors.gate.extension.step3.description',
step: 'refresh',
title: 'wallet_connectors.gate.extension.step3.title',
},
],
},
},

createConnector: shouldUseWalletConnect
? getWalletConnectConnector({
projectId,
walletConnectParameters,
})
: getInjectedConnector({ namespace: 'gatewallet' }),
};
};
2 changes: 2 additions & 0 deletions packages/rainbowkit/src/wallets/walletConnectors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { enkryptWallet } from './enkryptWallet/enkryptWallet';
import { foxWallet } from './foxWallet/foxWallet';
import { frameWallet } from './frameWallet/frameWallet';
import { frontierWallet } from './frontierWallet/frontierWallet';
import { gateWallet } from './gateWallet/gateWallet';
import { imTokenWallet } from './imTokenWallet/imTokenWallet';
import { injectedWallet } from './injectedWallet/injectedWallet';
import { kresusWallet } from './kresusWallet/kresusWallet';
Expand Down Expand Up @@ -66,6 +67,7 @@ export {
foxWallet,
frameWallet,
frontierWallet,
gateWallet,
imTokenWallet,
injectedWallet,
kresusWallet,
Expand Down
6 changes: 6 additions & 0 deletions site/data/en-US/docs/custom-wallet-list.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ import { frameWallet } from '@rainbow-me/rainbowkit/wallets';
import { frontierWallet } from '@rainbow-me/rainbowkit/wallets';
```

#### Gate Wallet

```tsx
import { gateWallet } from '@rainbow-me/rainbowkit/wallets';
```

#### Ledger Live

```tsx
Expand Down

0 comments on commit 6c240ba

Please sign in to comment.