From d9568fe3f03e1a147140b443d5869910370bb5d1 Mon Sep 17 00:00:00 2001 From: lk419649 Date: Wed, 27 Dec 2023 20:21:22 +0800 Subject: [PATCH 01/12] chore: Support TokenPocket --- .dumi/theme/builtins/IconSearch/fields.ts | 2 +- packages/assets/src/wallets/index.ts | 1 + .../assets/src/wallets/tokenpocket-wallet.tsx | 20 +++ .../__snapshots__/index.test.tsx.snap | 148 +++++++++++++++--- .../src/components/tokenpocket-colorful.tsx | 22 +++ packages/icons/src/index.ts | 2 + .../icons/src/svgs/tokenpocket-colorful.svg | 29 ++++ .../wagmi/src/wallets/tokenpocket-wallet.tsx | 15 ++ 8 files changed, 216 insertions(+), 23 deletions(-) create mode 100644 packages/assets/src/wallets/tokenpocket-wallet.tsx create mode 100644 packages/icons/src/components/tokenpocket-colorful.tsx create mode 100644 packages/icons/src/svgs/tokenpocket-colorful.svg create mode 100644 packages/wagmi/src/wallets/tokenpocket-wallet.tsx diff --git a/.dumi/theme/builtins/IconSearch/fields.ts b/.dumi/theme/builtins/IconSearch/fields.ts index cde0ae4d1..dcbaef66c 100644 --- a/.dumi/theme/builtins/IconSearch/fields.ts +++ b/.dumi/theme/builtins/IconSearch/fields.ts @@ -18,7 +18,7 @@ const chain = [ 'Avalanche', ]; -const tool = ['CoinbaseWallet', 'Etherscan', 'MetaMask', 'WalletConnect']; +const tool = ['CoinbaseWallet', 'Etherscan', 'MetaMask', 'WalletConnect', 'Tokenpocket']; const datum = [...chain, ...tool]; diff --git a/packages/assets/src/wallets/index.ts b/packages/assets/src/wallets/index.ts index 401770072..de5007bcc 100644 --- a/packages/assets/src/wallets/index.ts +++ b/packages/assets/src/wallets/index.ts @@ -1,3 +1,4 @@ export * from './meta-mask'; export * from './wallet-connect'; export * from './coinbase-wallet'; +export * from './tokenpocket-wallet'; diff --git a/packages/assets/src/wallets/tokenpocket-wallet.tsx b/packages/assets/src/wallets/tokenpocket-wallet.tsx new file mode 100644 index 000000000..d43eec6b2 --- /dev/null +++ b/packages/assets/src/wallets/tokenpocket-wallet.tsx @@ -0,0 +1,20 @@ +import type { WalletMetadata } from '@ant-design/web3-common'; +import { TokenpocketColorful, ChromeCircleColorful } from '@ant-design/web3-icons'; + +export const metadata_TokenpocketWallet: WalletMetadata = { + icon: , + name: 'TokenPocket Wallet', + remark: 'TokenPocket Wallet', + app: { + link: 'https://www.tokenpocket.pro/en/download/app', + }, + extensions: [ + { + key: 'Chrome', + browserIcon: , + browserName: 'Chrome', + link: 'https://chromewebstore.google.com/detail/mfgccjchihfkkindfppnaooecgfneiii', + description: 'Access your wallet right from your favorite web browser.', + }, + ], +}; diff --git a/packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap b/packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap index bbd3792cc..5945cf772 100644 --- a/packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap @@ -326,6 +326,110 @@ exports[`Test Icons > should render all icons 8`] = ` `; exports[`Test Icons > should render all icons 9`] = ` + + + +`; + +exports[`Test Icons > should render all icons 10`] = ` should render all icons 9`] = ` `; -exports[`Test Icons > should render all icons 10`] = ` +exports[`Test Icons > should render all icons 11`] = ` should render all icons 10`] = ` `; -exports[`Test Icons > should render all icons 11`] = ` +exports[`Test Icons > should render all icons 12`] = ` should render all icons 11`] = ` `; -exports[`Test Icons > should render all icons 12`] = ` +exports[`Test Icons > should render all icons 13`] = ` should render all icons 12`] = ` `; -exports[`Test Icons > should render all icons 13`] = ` +exports[`Test Icons > should render all icons 14`] = ` should render all icons 13`] = ` `; -exports[`Test Icons > should render all icons 14`] = ` +exports[`Test Icons > should render all icons 15`] = ` should render all icons 14`] = ` `; -exports[`Test Icons > should render all icons 15`] = ` +exports[`Test Icons > should render all icons 16`] = ` should render all icons 15`] = ` `; -exports[`Test Icons > should render all icons 16`] = ` +exports[`Test Icons > should render all icons 17`] = ` should render all icons 16`] = ` `; -exports[`Test Icons > should render all icons 17`] = ` +exports[`Test Icons > should render all icons 18`] = ` should render all icons 17`] = ` `; -exports[`Test Icons > should render all icons 18`] = ` +exports[`Test Icons > should render all icons 19`] = ` should render all icons 18`] = ` `; -exports[`Test Icons > should render all icons 19`] = ` +exports[`Test Icons > should render all icons 20`] = ` should render all icons 19`] = ` `; -exports[`Test Icons > should render all icons 20`] = ` +exports[`Test Icons > should render all icons 21`] = ` should render all icons 20`] = ` `; -exports[`Test Icons > should render all icons 21`] = ` +exports[`Test Icons > should render all icons 22`] = ` should render all icons 21`] = ` `; -exports[`Test Icons > should render all icons 22`] = ` +exports[`Test Icons > should render all icons 23`] = ` should render all icons 22`] = ` `; -exports[`Test Icons > should render all icons 23`] = ` +exports[`Test Icons > should render all icons 24`] = ` should render all icons 23`] = ` `; -exports[`Test Icons > should render all icons 24`] = ` +exports[`Test Icons > should render all icons 25`] = ` should render all icons 24`] = ` `; -exports[`Test Icons > should render all icons 25`] = ` +exports[`Test Icons > should render all icons 26`] = ` should render all icons 25`] = ` `; -exports[`Test Icons > should render all icons 26`] = ` +exports[`Test Icons > should render all icons 27`] = ` should render all icons 26`] = ` `; -exports[`Test Icons > should render all icons 27`] = ` +exports[`Test Icons > should render all icons 28`] = ` should render all icons 27`] = ` `; -exports[`Test Icons > should render all icons 28`] = ` +exports[`Test Icons > should render all icons 29`] = ` should render all icons 28`] = ` `; -exports[`Test Icons > should render all icons 29`] = ` +exports[`Test Icons > should render all icons 30`] = ` should render all icons 29`] = ` `; -exports[`Test Icons > should render all icons 30`] = ` +exports[`Test Icons > should render all icons 31`] = ` should render all icons 30`] = ` `; -exports[`Test Icons > should render all icons 31`] = ` +exports[`Test Icons > should render all icons 32`] = ` ( + (props, ref) => { + const { getPrefixCls } = React.useContext(ConfigProvider.ConfigContext); + const prefixCls = getPrefixCls('web3-icon-tokenpocket-colorful'); + return ( + + ); + }, +); +TokenpocketColorful.displayName = 'TokenpocketColorful'; diff --git a/packages/icons/src/index.ts b/packages/icons/src/index.ts index 98dcffa06..3ad023150 100644 --- a/packages/icons/src/index.ts +++ b/packages/icons/src/index.ts @@ -36,3 +36,5 @@ export * from './components/polygon-circle-colorful'; export * from './components/fantom-circle-colorful'; export * from './components/chrome-circle-colorful'; + +export * from './components/tokenpocket-colorful'; diff --git a/packages/icons/src/svgs/tokenpocket-colorful.svg b/packages/icons/src/svgs/tokenpocket-colorful.svg new file mode 100644 index 000000000..099b18395 --- /dev/null +++ b/packages/icons/src/svgs/tokenpocket-colorful.svg @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/wagmi/src/wallets/tokenpocket-wallet.tsx b/packages/wagmi/src/wallets/tokenpocket-wallet.tsx new file mode 100644 index 000000000..d5743899d --- /dev/null +++ b/packages/wagmi/src/wallets/tokenpocket-wallet.tsx @@ -0,0 +1,15 @@ +import { type Wallet } from '@ant-design/web3-common'; +import { metadata_TokenpocketWallet } from '@ant-design/web3-assets'; +import type { WalletFactory } from '../interface'; + +export const TokenpocketWallet: WalletFactory = { + name: 'TokenPocket Wallet', + create: (): Wallet => { + return { + ...metadata_TokenpocketWallet, + hasWalletReady: async () => { + return true; + }, + }; + }, +}; From 5e1077786d522619e8a9710dd601edca3e2a3ce4 Mon Sep 17 00:00:00 2001 From: lk419649 Date: Wed, 27 Dec 2023 20:46:21 +0800 Subject: [PATCH 02/12] fix: add NUnit --- packages/wagmi/src/wallets/index.ts | 1 + .../wagmi/src/wallets/tokenpocket-wallet.test.tsx | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx diff --git a/packages/wagmi/src/wallets/index.ts b/packages/wagmi/src/wallets/index.ts index 401770072..de5007bcc 100644 --- a/packages/wagmi/src/wallets/index.ts +++ b/packages/wagmi/src/wallets/index.ts @@ -1,3 +1,4 @@ export * from './meta-mask'; export * from './wallet-connect'; export * from './coinbase-wallet'; +export * from './tokenpocket-wallet'; diff --git a/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx b/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx new file mode 100644 index 000000000..de5e4b47a --- /dev/null +++ b/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx @@ -0,0 +1,15 @@ +// TokenpocketWallet.test.ts +import { describe, it, expect } from 'vitest'; +import { TokenpocketWallet } from '@ant-design/web3-wagmi'; + +describe('TokenPocket Wallet', () => { + const wallet = TokenpocketWallet.create(); + it('name', async () => { + expect(wallet.name).toBe('TokenPocket Wallet'); + }); + it('should create a wallet with the correct properties', () => { + for (const key in wallet) { + expect(wallet).toHaveProperty(key); + } + }); +}); From b8f3e8e662da2f96cbc773d6e72172aba4d80d6b Mon Sep 17 00:00:00 2001 From: lk419649 Date: Wed, 27 Dec 2023 20:52:29 +0800 Subject: [PATCH 03/12] fix: Supplementary unit tests --- packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx b/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx index de5e4b47a..35ad52f00 100644 --- a/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx +++ b/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx @@ -7,6 +7,12 @@ describe('TokenPocket Wallet', () => { it('name', async () => { expect(wallet.name).toBe('TokenPocket Wallet'); }); + + it('always return true for hasWalletReady', async () => { + const install = await wallet.hasWalletReady?.(); + expect(install).toBe(true); + }); + it('should create a wallet with the correct properties', () => { for (const key in wallet) { expect(wallet).toHaveProperty(key); From a4cc5090406e051fa5b9f66f35ad7dbd2c308004 Mon Sep 17 00:00:00 2001 From: lk419649 Date: Thu, 28 Dec 2023 10:23:32 +0800 Subject: [PATCH 04/12] fix: rename TP name --- .dumi/theme/builtins/IconSearch/fields.ts | 2 +- packages/assets/src/wallets/index.ts | 2 +- packages/assets/src/wallets/token-pocket.tsx | 20 ++++++++++++++++++ .../src/components/tokenpocket-colorful.tsx | 4 ++-- packages/wagmi/src/wallets/index.ts | 2 +- .../wagmi/src/wallets/token-pocket.test.tsx | 21 +++++++++++++++++++ packages/wagmi/src/wallets/token-pocket.tsx | 15 +++++++++++++ 7 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 packages/assets/src/wallets/token-pocket.tsx create mode 100644 packages/wagmi/src/wallets/token-pocket.test.tsx create mode 100644 packages/wagmi/src/wallets/token-pocket.tsx diff --git a/.dumi/theme/builtins/IconSearch/fields.ts b/.dumi/theme/builtins/IconSearch/fields.ts index dcbaef66c..84b67d382 100644 --- a/.dumi/theme/builtins/IconSearch/fields.ts +++ b/.dumi/theme/builtins/IconSearch/fields.ts @@ -18,7 +18,7 @@ const chain = [ 'Avalanche', ]; -const tool = ['CoinbaseWallet', 'Etherscan', 'MetaMask', 'WalletConnect', 'Tokenpocket']; +const tool = ['CoinbaseWallet', 'Etherscan', 'MetaMask', 'WalletConnect', 'TokenPocket']; const datum = [...chain, ...tool]; diff --git a/packages/assets/src/wallets/index.ts b/packages/assets/src/wallets/index.ts index de5007bcc..e131aaff6 100644 --- a/packages/assets/src/wallets/index.ts +++ b/packages/assets/src/wallets/index.ts @@ -1,4 +1,4 @@ export * from './meta-mask'; export * from './wallet-connect'; export * from './coinbase-wallet'; -export * from './tokenpocket-wallet'; +export * from './token-pocket'; diff --git a/packages/assets/src/wallets/token-pocket.tsx b/packages/assets/src/wallets/token-pocket.tsx new file mode 100644 index 000000000..671033aee --- /dev/null +++ b/packages/assets/src/wallets/token-pocket.tsx @@ -0,0 +1,20 @@ +import type { WalletMetadata } from '@ant-design/web3-common'; +import { TokenPocketColorful, ChromeCircleColorful } from '@ant-design/web3-icons'; + +export const metadata_TokenPocket: WalletMetadata = { + icon: , + name: 'TokenPocket', + remark: 'TokenPocket', + app: { + link: 'https://www.tokenpocket.pro/en/download/app', + }, + extensions: [ + { + key: 'Chrome', + browserIcon: , + browserName: 'Chrome', + link: 'https://chromewebstore.google.com/detail/mfgccjchihfkkindfppnaooecgfneiii', + description: 'Access your wallet right from your favorite web browser.', + }, + ], +}; diff --git a/packages/icons/src/components/tokenpocket-colorful.tsx b/packages/icons/src/components/tokenpocket-colorful.tsx index 49d7c96e2..4e185550a 100644 --- a/packages/icons/src/components/tokenpocket-colorful.tsx +++ b/packages/icons/src/components/tokenpocket-colorful.tsx @@ -5,7 +5,7 @@ import { type IconBaseProps } from '@ant-design/icons/lib/components/Icon'; import classnames from 'classnames'; import { ConfigProvider } from 'antd'; -export const TokenpocketColorful = React.forwardRef( +export const TokenPocketColorful = React.forwardRef( (props, ref) => { const { getPrefixCls } = React.useContext(ConfigProvider.ConfigContext); const prefixCls = getPrefixCls('web3-icon-tokenpocket-colorful'); @@ -19,4 +19,4 @@ export const TokenpocketColorful = React.forwardRef { + const wallet = TokenPocket.create(); + it('name', async () => { + expect(wallet.name).toBe('TokenPocket'); + }); + + it('always return true for hasWalletReady', async () => { + const install = await wallet.hasWalletReady?.(); + expect(install).toBe(true); + }); + + it('should create a wallet with the correct properties', () => { + for (const key in wallet) { + expect(wallet).toHaveProperty(key); + } + }); +}); diff --git a/packages/wagmi/src/wallets/token-pocket.tsx b/packages/wagmi/src/wallets/token-pocket.tsx new file mode 100644 index 000000000..78527738d --- /dev/null +++ b/packages/wagmi/src/wallets/token-pocket.tsx @@ -0,0 +1,15 @@ +import { type Wallet } from '@ant-design/web3-common'; +import { metadata_TokenPocket } from '@ant-design/web3-assets'; +import type { WalletFactory } from '../interface'; + +export const TokenPocket: WalletFactory = { + name: 'TokenPocket', + create: (): Wallet => { + return { + ...metadata_TokenPocket, + hasWalletReady: async () => { + return true; + }, + }; + }, +}; From 2d48d7b035926bde4fe0bec5139abfc5ecd48144 Mon Sep 17 00:00:00 2001 From: lk419649 Date: Thu, 28 Dec 2023 10:31:56 +0800 Subject: [PATCH 05/12] chore: add changeset --- .changeset/large-drinks-provide.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/large-drinks-provide.md diff --git a/.changeset/large-drinks-provide.md b/.changeset/large-drinks-provide.md new file mode 100644 index 000000000..f43059160 --- /dev/null +++ b/.changeset/large-drinks-provide.md @@ -0,0 +1,7 @@ +--- +'@ant-design/web3-assets': major +'@ant-design/web3-icons': minor +'@ant-design/web3-wagmi': minor +--- + +feat: add TokenPocket wallet icon and metadata From 19e1fc0a5cb38a6af57e2aab9db563de0c5361d8 Mon Sep 17 00:00:00 2001 From: lk419649 Date: Thu, 28 Dec 2023 10:37:32 +0800 Subject: [PATCH 06/12] fix: Modify upper and lower case letters --- packages/assets/src/wallets/tokenpocket-wallet.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/assets/src/wallets/tokenpocket-wallet.tsx b/packages/assets/src/wallets/tokenpocket-wallet.tsx index d43eec6b2..114cac191 100644 --- a/packages/assets/src/wallets/tokenpocket-wallet.tsx +++ b/packages/assets/src/wallets/tokenpocket-wallet.tsx @@ -1,8 +1,8 @@ import type { WalletMetadata } from '@ant-design/web3-common'; -import { TokenpocketColorful, ChromeCircleColorful } from '@ant-design/web3-icons'; +import { TokenPocketColorful, ChromeCircleColorful } from '@ant-design/web3-icons'; export const metadata_TokenpocketWallet: WalletMetadata = { - icon: , + icon: , name: 'TokenPocket Wallet', remark: 'TokenPocket Wallet', app: { From 45c419f2d73abf8a3f986116399fe092407f241d Mon Sep 17 00:00:00 2001 From: lk419649 Date: Thu, 28 Dec 2023 10:41:19 +0800 Subject: [PATCH 07/12] fix: rename --- packages/assets/src/wallets/tokenpocket-wallet.tsx | 2 +- packages/wagmi/src/wallets/token-pocket.test.tsx | 1 - packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx | 7 +++---- packages/wagmi/src/wallets/tokenpocket-wallet.tsx | 8 ++++---- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/assets/src/wallets/tokenpocket-wallet.tsx b/packages/assets/src/wallets/tokenpocket-wallet.tsx index 114cac191..57c4a5b79 100644 --- a/packages/assets/src/wallets/tokenpocket-wallet.tsx +++ b/packages/assets/src/wallets/tokenpocket-wallet.tsx @@ -1,7 +1,7 @@ import type { WalletMetadata } from '@ant-design/web3-common'; import { TokenPocketColorful, ChromeCircleColorful } from '@ant-design/web3-icons'; -export const metadata_TokenpocketWallet: WalletMetadata = { +export const metadata_TokenPocket: WalletMetadata = { icon: , name: 'TokenPocket Wallet', remark: 'TokenPocket Wallet', diff --git a/packages/wagmi/src/wallets/token-pocket.test.tsx b/packages/wagmi/src/wallets/token-pocket.test.tsx index 821a8842a..ad727bfe6 100644 --- a/packages/wagmi/src/wallets/token-pocket.test.tsx +++ b/packages/wagmi/src/wallets/token-pocket.test.tsx @@ -1,4 +1,3 @@ -// TokenpocketWallet.test.ts import { describe, it, expect } from 'vitest'; import { TokenPocket } from '@ant-design/web3-wagmi'; diff --git a/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx b/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx index 35ad52f00..d20733a6b 100644 --- a/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx +++ b/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx @@ -1,9 +1,8 @@ -// TokenpocketWallet.test.ts import { describe, it, expect } from 'vitest'; -import { TokenpocketWallet } from '@ant-design/web3-wagmi'; +import { TokenPocket } from '@ant-design/web3-wagmi'; -describe('TokenPocket Wallet', () => { - const wallet = TokenpocketWallet.create(); +describe('TokenPocket', () => { + const wallet = TokenPocket.create(); it('name', async () => { expect(wallet.name).toBe('TokenPocket Wallet'); }); diff --git a/packages/wagmi/src/wallets/tokenpocket-wallet.tsx b/packages/wagmi/src/wallets/tokenpocket-wallet.tsx index d5743899d..78527738d 100644 --- a/packages/wagmi/src/wallets/tokenpocket-wallet.tsx +++ b/packages/wagmi/src/wallets/tokenpocket-wallet.tsx @@ -1,12 +1,12 @@ import { type Wallet } from '@ant-design/web3-common'; -import { metadata_TokenpocketWallet } from '@ant-design/web3-assets'; +import { metadata_TokenPocket } from '@ant-design/web3-assets'; import type { WalletFactory } from '../interface'; -export const TokenpocketWallet: WalletFactory = { - name: 'TokenPocket Wallet', +export const TokenPocket: WalletFactory = { + name: 'TokenPocket', create: (): Wallet => { return { - ...metadata_TokenpocketWallet, + ...metadata_TokenPocket, hasWalletReady: async () => { return true; }, From 08614888f744601230f06413e167f5b163d06557 Mon Sep 17 00:00:00 2001 From: lk419649 Date: Thu, 28 Dec 2023 10:50:21 +0800 Subject: [PATCH 08/12] fix: delete 'Wallet' --- packages/assets/src/wallets/tokenpocket-wallet.tsx | 4 ++-- packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/assets/src/wallets/tokenpocket-wallet.tsx b/packages/assets/src/wallets/tokenpocket-wallet.tsx index 57c4a5b79..671033aee 100644 --- a/packages/assets/src/wallets/tokenpocket-wallet.tsx +++ b/packages/assets/src/wallets/tokenpocket-wallet.tsx @@ -3,8 +3,8 @@ import { TokenPocketColorful, ChromeCircleColorful } from '@ant-design/web3-icon export const metadata_TokenPocket: WalletMetadata = { icon: , - name: 'TokenPocket Wallet', - remark: 'TokenPocket Wallet', + name: 'TokenPocket', + remark: 'TokenPocket', app: { link: 'https://www.tokenpocket.pro/en/download/app', }, diff --git a/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx b/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx index d20733a6b..ad727bfe6 100644 --- a/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx +++ b/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx @@ -4,7 +4,7 @@ import { TokenPocket } from '@ant-design/web3-wagmi'; describe('TokenPocket', () => { const wallet = TokenPocket.create(); it('name', async () => { - expect(wallet.name).toBe('TokenPocket Wallet'); + expect(wallet.name).toBe('TokenPocket'); }); it('always return true for hasWalletReady', async () => { From 6395ddc39adcf9f74a19a2c0e81def74e5a882a0 Mon Sep 17 00:00:00 2001 From: lk419649 Date: Thu, 28 Dec 2023 10:58:23 +0800 Subject: [PATCH 09/12] fix: delete unuse file --- .../assets/src/wallets/tokenpocket-wallet.tsx | 20 ------------------- .../src/wallets/tokenpocket-wallet.test.tsx | 20 ------------------- .../wagmi/src/wallets/tokenpocket-wallet.tsx | 15 -------------- 3 files changed, 55 deletions(-) delete mode 100644 packages/assets/src/wallets/tokenpocket-wallet.tsx delete mode 100644 packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx delete mode 100644 packages/wagmi/src/wallets/tokenpocket-wallet.tsx diff --git a/packages/assets/src/wallets/tokenpocket-wallet.tsx b/packages/assets/src/wallets/tokenpocket-wallet.tsx deleted file mode 100644 index 671033aee..000000000 --- a/packages/assets/src/wallets/tokenpocket-wallet.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import type { WalletMetadata } from '@ant-design/web3-common'; -import { TokenPocketColorful, ChromeCircleColorful } from '@ant-design/web3-icons'; - -export const metadata_TokenPocket: WalletMetadata = { - icon: , - name: 'TokenPocket', - remark: 'TokenPocket', - app: { - link: 'https://www.tokenpocket.pro/en/download/app', - }, - extensions: [ - { - key: 'Chrome', - browserIcon: , - browserName: 'Chrome', - link: 'https://chromewebstore.google.com/detail/mfgccjchihfkkindfppnaooecgfneiii', - description: 'Access your wallet right from your favorite web browser.', - }, - ], -}; diff --git a/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx b/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx deleted file mode 100644 index ad727bfe6..000000000 --- a/packages/wagmi/src/wallets/tokenpocket-wallet.test.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { describe, it, expect } from 'vitest'; -import { TokenPocket } from '@ant-design/web3-wagmi'; - -describe('TokenPocket', () => { - const wallet = TokenPocket.create(); - it('name', async () => { - expect(wallet.name).toBe('TokenPocket'); - }); - - it('always return true for hasWalletReady', async () => { - const install = await wallet.hasWalletReady?.(); - expect(install).toBe(true); - }); - - it('should create a wallet with the correct properties', () => { - for (const key in wallet) { - expect(wallet).toHaveProperty(key); - } - }); -}); diff --git a/packages/wagmi/src/wallets/tokenpocket-wallet.tsx b/packages/wagmi/src/wallets/tokenpocket-wallet.tsx deleted file mode 100644 index 78527738d..000000000 --- a/packages/wagmi/src/wallets/tokenpocket-wallet.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { type Wallet } from '@ant-design/web3-common'; -import { metadata_TokenPocket } from '@ant-design/web3-assets'; -import type { WalletFactory } from '../interface'; - -export const TokenPocket: WalletFactory = { - name: 'TokenPocket', - create: (): Wallet => { - return { - ...metadata_TokenPocket, - hasWalletReady: async () => { - return true; - }, - }; - }, -}; From c606aa384d0f50163fe1d52f97dbce22936a4ce8 Mon Sep 17 00:00:00 2001 From: gin-lsl Date: Thu, 28 Dec 2023 13:21:41 +0800 Subject: [PATCH 10/12] feat: remove unused SVG code --- .../__snapshots__/index.test.tsx.snap | 28 ++----------------- .../src/svgs/arbitrum-circle-colorful.svg | 8 ++---- .../src/svgs/ethereum-circle-colorful.svg | 8 ++---- .../icons/src/svgs/fantom-circle-colorful.svg | 8 ++---- 4 files changed, 8 insertions(+), 44 deletions(-) diff --git a/packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap b/packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap index 5945cf772..03665b456 100644 --- a/packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap @@ -768,19 +768,7 @@ exports[`Test Icons > should render all icons 17`] = ` - - - - - + should render all icons 22`] = ` - - - - - + - - - - - + @@ -24,4 +20,4 @@ - \ No newline at end of file + diff --git a/packages/icons/src/svgs/ethereum-circle-colorful.svg b/packages/icons/src/svgs/ethereum-circle-colorful.svg index a3e8f5f0f..661d3d617 100644 --- a/packages/icons/src/svgs/ethereum-circle-colorful.svg +++ b/packages/icons/src/svgs/ethereum-circle-colorful.svg @@ -7,11 +7,7 @@ - - - - - + @@ -24,4 +20,4 @@ - \ No newline at end of file + diff --git a/packages/icons/src/svgs/fantom-circle-colorful.svg b/packages/icons/src/svgs/fantom-circle-colorful.svg index e91f6bd64..1eefdee27 100644 --- a/packages/icons/src/svgs/fantom-circle-colorful.svg +++ b/packages/icons/src/svgs/fantom-circle-colorful.svg @@ -8,11 +8,7 @@ - - - - - + @@ -22,4 +18,4 @@ - \ No newline at end of file + From c389c5bccbf620c3d4265684d7dd7c183cfb4c8b Mon Sep 17 00:00:00 2001 From: gin-lsl Date: Thu, 28 Dec 2023 13:22:14 +0800 Subject: [PATCH 11/12] test: update icon id test logic --- packages/icons/src/__tests__/index.test.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/icons/src/__tests__/index.test.tsx b/packages/icons/src/__tests__/index.test.tsx index 7e6d7ac63..e26a73558 100644 --- a/packages/icons/src/__tests__/index.test.tsx +++ b/packages/icons/src/__tests__/index.test.tsx @@ -14,15 +14,21 @@ describe('Test Icons', () => { it('icon path referenced id should start with `ant-web3-icon-`', async () => { const comps = await getComponents('components'); + const relIdRegex = /url\(#[a-zA-Z0-9-]+\)/g; + comps.forEach((Comp) => { const { container } = render(); - const pathWithFill = container.querySelectorAll('path[fill^="url(#"]'); + const htmlText = container.innerHTML; + + // find all `url(#id)` in the html text + const matches = htmlText.match(relIdRegex); - // The `id` referenced by the `fill` attr of the `path` element - // must start with `ant-web3-icon-` - pathWithFill.forEach((path) => { - expect(path.getAttribute('fill')).toMatch(/^url\(#ant-web3-icon-/); + matches?.forEach((match) => { + expect( + match, + `${Comp.displayName} reference id: ${match} is not start with ant-web3-icon-`, + ).toMatch(/^url\(#ant-web3-icon-/); }); }); }); From dd5b897adc30634d815cd2c196da8bbff5be5c72 Mon Sep 17 00:00:00 2001 From: gin-lsl Date: Thu, 28 Dec 2023 13:37:20 +0800 Subject: [PATCH 12/12] text: update snapshot --- .../src/__tests__/__snapshots__/index.test.tsx.snap | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap b/packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap index 03665b456..2121f3248 100644 --- a/packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/icons/src/__tests__/__snapshots__/index.test.tsx.snap @@ -1490,19 +1490,8 @@ exports[`Test Icons > should render all icons 32`] = ` id="Protocol=Arbitrum-One,-Effect=None-Clipped" transform="translate(1307, 5728)" > - - - -