Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix spl-token #268

Merged
merged 2 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@types/chrome": "^0.0.178",
"@types/jest": "^27.0.2",
"@types/lodash": "^4.14.178",
"@types/lodash-es": "^4.17.12",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

lodash 和 lodash-es 确实存在重复使用

代码分析显示:

  • lodash 被广泛使用,有 34 处导入
  • lodash-es 仅在 5 处使用,主要在 core 和 solana/cosmos 相关组件

建议:

  • 统一使用 lodash-es,它支持 ES 模块,性能更好
  • 移除 lodash 依赖,避免重复

需要修改的文件:

  • packages/core/* (已使用 lodash-es)
  • packages/example/components/* (需要从 lodash 迁移到 lodash-es)
  • packages/providers/* (需要从 lodash 迁移到 lodash-es)
🔗 Analysis chain

需要验证 lodash-es 的必要性

项目中已经包含了 lodash(devDependencies),现在又添加了 lodash-es。这可能会导致重复依赖。

Also applies to: 62-62

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查项目中 lodash 和 lodash-es 的使用情况
echo "检查 lodash 的使用:"
rg "from 'lodash'" -t ts -t tsx
echo "检查 lodash-es 的使用:"
rg "from 'lodash-es'" -t ts -t tsx

Length of output: 222


Script:

#!/bin/bash
# 检查 lodash 和 lodash-es 的导入使用
echo "检查 lodash 的使用:"
rg "from ['\"]lodash['\"]"

echo -e "\n检查 lodash-es 的使用:"
rg "from ['\"]lodash-es['\"]"

echo -e "\n检查 require('lodash') 的使用:"
rg "require\(['\"]lodash['\"]"

echo -e "\n检查 require('lodash-es') 的使用:"
rg "require\(['\"]lodash-es['\"]"

# 检查文件类型
echo -e "\n项目中的 JavaScript/TypeScript 文件:"
fd "\.(js|jsx|ts|tsx)$"

Length of output: 33860

"@types/node": "^16.9.0",
"@types/react": "^17.0.21",
"@types/react-native": "^0.67.6",
Expand All @@ -47,12 +48,18 @@
"jest": "^27.2.4",
"lerna": "^5.6.2",
"lodash": "^4.17.21",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"prettier": "2.3.2",
"react": "^17.0.2",
"react-test-renderer": "^17.0.2",
"ts-jest": "^27.0.5",
"typescript": "^5"
},
"dependencies": {},
"dependencies": {
"@benfen/bfc.js": "^0.2.7",
"@solana/spl-token": "^0.4.9",
"lodash-es": "^4.17.21"
},
"packageManager": "[email protected]+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72"
}
1 change: 0 additions & 1 deletion packages/example/components/chains/solana/example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import params from './params';
import { createTransferTransaction, createVersionedTransaction, createTokenTransferTransaction } from './builder';
import nacl from 'tweetnacl';
import { toast } from '../../ui/use-toast';
// import { TOKEN_PROGRAM_ID } from '@solana/spl-token';

const NETWORK = clusterApiUrl('mainnet-beta');

Expand Down
Loading
Loading