Skip to content

Commit

Permalink
feat: Add bitget wallet (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
wenty22 authored Feb 19, 2024
1 parent 7b8afa6 commit 3deba02
Show file tree
Hide file tree
Showing 11 changed files with 2,285 additions and 5,756 deletions.
5 changes: 5 additions & 0 deletions .changeset/popular-peas-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@node-real/walletkit": patch
---

Add bitget wallet
13 changes: 0 additions & 13 deletions .changeset/pre.json

This file was deleted.

4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

For more detail, please click [here](../CONTRIBUTING.md#notice-test-cases-for-adding-a-new-wallet)

<!--- If you are adding a new wallet, we hope you can complete the following tests before the code is merged into the main branch -->
|test case|support?|connected?|switch networks?|support testnet?|
<!--- If you are adding a new wallet, we hope you can complete the following tests before the code is merged into the alpha branch -->
|test case|supported?|connected?|switch networks?|support testnet?|
|-|-|-|-|-|
|PC, browser extension| ✔️ | ✔️ |||
|Android, in system browser| | | | |
Expand Down
17 changes: 11 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ Before adding a new wallet, you need to collect some information:
| ------------------ | --------------------------------------------------------------------------------------------------- | ----------------------------------- | -------- |
| wallet name | - | Trust Wallet | ✔️ |
| short name | If display space is insufficient, the short name will be displayed. | Trust | optional |
| wallet logo | logo in svg format. | - | ✔️ |
| wallet logo | Logo in svg format. It should be noted that WalletKit supports both dark and light modes, for better presentation, you can provide logos in the two modes respectively. | - | ✔️ |
| download url | - | https://trustwallet.com/download | ✔️ |
| deeplink | After clicking deeplink in the system browser, we can directly open dapp in the app's dapp browser. | trust://open_url?coin_id=60&url=xxx | ✔️ |
| WalletConnect link | If your app supports WalletConnect, please provides the WalletConnect uri. | trust://wc?uri=xxx | optional |
| WalletConnect uri | If your app supports WalletConnect, please provides the WalletConnect uri. | trust://wc?uri=xxx | optional |

Then you can add it to project by following steps:

Expand Down Expand Up @@ -132,6 +132,9 @@ export function trustWallet(props: TrustWalletProps = {}): WalletProps {
)}`;
return dappPath;
},
getQRCodeUri(uri) {
return `trust://wc?uri=${encodeURIComponent(uri)}`;
},
...restProps,
};
}
Expand Down Expand Up @@ -175,14 +178,14 @@ export interface WalletProps {
export * from './trustWallet';
```
5. Open `examples/test/pages/_app.tsx` to test the new wallet
5. Open `packages/walletkit/test/App.tsx` to test the new wallet
```tsx
import {
trustWallet, // import new wallet
metaMask,
walletConnect,
} from '@node-real/walletkit/wallets';
} from '@/wallets';
import { useState } from 'react';

const config = createConfig(
Expand All @@ -204,14 +207,16 @@ const config = createConfig(
);
```
6. Once the tests pass, the code can be merged into the `alpha` branch
## Notice!!! Test cases for adding a new wallet
Before merging the PR to main branch, we hope you complete the following tests, and fill the test results into the PR template, otherwise the PR may not be approved.
In general, wallet is available at several different platforms, such as PC browser extension, Android, iOS and WalletConnect. If your wallet supports the corresponding platform, please make sure your wallet is worked, can it be connected, can it switch networks, and can it support testnet?
|test case|steps|support?|connected?|switch networks?|support testnet?|
|test case|steps|Is this connection way supported?|Can it connect to the wallet??|Can it switch networks?|Does the wallet support testnet?|
|-|-|-|-|-|-|
|PC, browser extension|<ol><li>Open dapp in PC browser</li><li>Select your wallet, check the functions</li><ol>|✔️|✔️|✔️|✔️|
|Android, in system browser|<ol><li>Open dapp in Android system browser, select your wallet</li><li>The wallet app will be evoked, and the dapp will be open in the wallet dapp browser</li><li>Select your wallet, check the functions</li></ol>|✔️|✔️|❌|✔️|
Expand All @@ -231,7 +236,7 @@ A complete development workflow like following:
1. Create a new branch out of `main` branch
2. Make some changes, fix bugs or add new features
3. Run `pnpm changeset` to create a new changeset
4. Commit the code, code review is required, after code review, we can merge the code to `main`
4. Commit the code, code review is required, after code review, we can merge the code to `alpha`
branch
5. Then [github action](https://github.com/node-real/walletkit/actions) will automatically execute
and create a new [release PR](https://github.com/node-real/walletkit/pulls), merge this PR, a new
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@commitlint/cli": "^18.4.4",
"@commitlint/config-conventional": "^18.4.4",
"@commitlint/cli": "^18.6.1",
"@commitlint/config-conventional": "^18.6.2",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"eslint": "^8.56.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.3.5",
"husky": "^8.0.3",
"lint-staged": "^15.2.0",
"prettier": "^3.2.2"
"lint-staged": "^15.2.2",
"prettier": "^3.2.5"
}
}
1 change: 1 addition & 0 deletions packages/walletkit/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ declare global {
trustwallet: any;
tokenpocket: any;
okexchain: any;
bitkeep: any;
}
}

Expand Down
11 changes: 11 additions & 0 deletions packages/walletkit/src/wallets/bitgetWallet/icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const logo =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAYAAAAcaxDBAAAACXBIWXMAACE4AAAhOAFFljFgAAAFw2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNy4xLWMwMDAgNzkuZWRhMmIzZmFjLCAyMDIxLzExLzE3LTE3OjIzOjE5ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4b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7oRHVMmTg3UdlFs9HGEtbP7cEnUNW8YtrNoN5aZvlCm+uC6EeyVFPQ4I2Wlz0WL8bQEizG43G+z4wJeIgHynqmtMHWrFBtTHVh1rB53YxNJH8yejRUXtc5uG4ftIH2QEa1O0Ao1YdRHpUZUgGNqTFJp3oaDde+pTR7ZUg1uScX8kwl7b3rlc6FSG4E5xbF7zQTtWxec0O2y6yXU7JKxy6FCoVGYKEFwQEE1xMGmEl4MJCqlBr4zcjF6VCZvpzD5KnAVgCeSCMyuLYI7hymVMjDMTUjP8cR6l4G5xqI3V2EqfScHi0z5Acwu802Vy3hAuoFjCThW5Z82+yeCCGbrhOP4pyuYUptU8Y/Rh26CVinLQyGJm71QWlLhW1MJUP8QkMgfCzCuUKvm7hHDRWWVQCv8pt7oPbcn02BRi/nMWq2/jevJBSSQLettxqAK8zQSYABZqzAN4Qd7DzCRPhzCE/3LJTssMFnmL632rXBM6pywCSy9dBpu/5n1UjdutM1OeZrAYvpQs0RwinzZILioscK8U5W8qx8CuIknym+qlQbWhEm9DkZWu4CYWefHe+k5u2gbuvyEY//Xv2o1pzeO2KY92oE6i778ObT105dpukjcRBOasFcnMHcASQnUQxZVEVuR5dUaNXW22MhGqiTLmiLiH4cgaPTYXjc2YXL/+OzRDOR02DWvi2lX3f4fJONb+nPfc6UAAAAASUVORK5CYII=';

export const BitgetWalletTransparentIcon = (props: SVGIconProps) => {
return <img src={logo} width={34} height={34} {...props} />;
};

export const BitgetWalletIcon = (props: SVGIconProps) => {
return <img src={logo} width={34} height={34} {...props} />;
//width="68" height="68" viewBox="0 0 68 68"
};
65 changes: 65 additions & 0 deletions packages/walletkit/src/wallets/bitgetWallet/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { Chain } from 'wagmi';
import { PartialCustomProps, WalletProps } from '..';
import { CustomConnector } from '../custom/connector';
import { getInjectedProvider, hasInjectedProvider } from '../utils';
import { BitgetWalletIcon, BitgetWalletTransparentIcon } from './icon';
import { isMobile } from '@/index';

export const BITGET_WALLET_ID = 'bitgetWallet';
export const BITGET_WALLET_NAME = 'Bitget Wallet';

export function bitgetWallet(props: PartialCustomProps = {}): WalletProps {
const { connectorOptions, ...restProps } = props;

return {
id: BITGET_WALLET_ID,
name: BITGET_WALLET_NAME,
logos: {
default: <BitgetWalletIcon />,
transparent: <BitgetWalletTransparentIcon />,
},
downloadUrls: {
default: 'https://web3.bitget.com/',
},
spinnerColor: undefined,
showQRCode: false,
isInstalled: isBitgetWallet,
createConnector: (chains: Chain[]) => {
return new CustomConnector({
id: BITGET_WALLET_ID,
chains,
options: {
name: BITGET_WALLET_NAME,
shimDisconnect: true,
getProvider() {
if (typeof window === 'undefined') return;

if (isMobile()) {
return window.ethereum || window.bitkeep?.ethereum;
}

return getInjectedProvider('isBitgetWallet' as any) ?? window.bitkeep?.ethereum;
},
...connectorOptions,
},
});
},
getDeepLink: () => {
return `https://bkcode.vip?action=dapp&url=${window.location.href}`;
},
getQRCodeUri(uri) {
return `bitkeep://bkconnect/wc?uri=${encodeURIComponent(uri)}`;
},
...restProps,
};
}

export function isBitgetWallet() {
if (typeof window === 'undefined') return false;

if (isMobile()) {
return !!(window.ethereum || window.bitkeep);
}

return hasInjectedProvider('isBitgetWallet' as any) || window.bitkeep;
}
1 change: 1 addition & 0 deletions packages/walletkit/src/wallets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ export * from './mathWallet';
export * from './binanceWeb3Wallet';
export * from './coinbaseWallet';
export * from './coinbaseWallet/connector';
export * from './bitgetWallet';
// export * from './particleWallet';
// export * from './particleWallet/connector';
2 changes: 2 additions & 0 deletions packages/walletkit/test/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {

import {
binanceWeb3Wallet,
bitgetWallet,
coinbaseWallet,
mathWallet,
metaMask,
Expand Down Expand Up @@ -46,6 +47,7 @@ const client = createClient(
appName: 'WalletKit',
chains,
connectors: [
bitgetWallet(),
trustWallet(),
metaMask(),
okxWallet(),
Expand Down
Loading

0 comments on commit 3deba02

Please sign in to comment.