- 新增 ARB Sepolia + BNB Testnet 多链支持 - 添加 LendingPanel 借贷系统组件 - 添加 LendingAdminPanel 管理面板 - 添加 USDCPanel USDC 操作组件 - 添加 HoldersPanel 持有人信息组件 - 添加 AutoTestPanel 自动化测试组件 - 重构 LP 组件为模块化结构 (LP/) - 添加多个调试和测试脚本 - 修复 USDC 精度动态配置 - 优化合约配置支持多链切换 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
76 lines
2.7 KiB
JavaScript
76 lines
2.7 KiB
JavaScript
import { createPublicClient, http, getAddress } from 'viem'
|
|
import { arbitrumSepolia } from 'viem/chains'
|
|
|
|
const client = createPublicClient({
|
|
chain: arbitrumSepolia,
|
|
transport: http('https://api.zan.top/node/v1/arb/sepolia/baf84c429d284bb5b676cb8c9ca21c07')
|
|
})
|
|
|
|
const TX_HASH = '0xf38e4201b397b2e267402e2b355c811fb0d99ce2c9f67b3b0fff26028a7a4df4'
|
|
|
|
async function main() {
|
|
console.log('\n检查交易详情...\n')
|
|
console.log('交易哈希:', TX_HASH, '\n')
|
|
|
|
try {
|
|
// 获取交易详情
|
|
const tx = await client.getTransaction({ hash: TX_HASH })
|
|
|
|
console.log('=== 交易基本信息 ===')
|
|
console.log('From:', tx.from)
|
|
console.log('To:', tx.to)
|
|
console.log('区块:', tx.blockNumber)
|
|
console.log('Gas Used:', tx.gas.toString())
|
|
console.log('\n函数调用 (input):', tx.input.slice(0, 200) + '...')
|
|
console.log('函数选择器:', tx.input.slice(0, 10))
|
|
|
|
// 获取交易回执
|
|
const receipt = await client.getTransactionReceipt({ hash: TX_HASH })
|
|
|
|
console.log('\n=== 交易回执 ===')
|
|
console.log('状态:', receipt.status === 'success' ? '✓ 成功' : '✗ 失败')
|
|
console.log('Gas 实际使用:', receipt.gasUsed.toString())
|
|
console.log('事件数量:', receipt.logs.length)
|
|
|
|
console.log('\n=== 事件日志 ===')
|
|
receipt.logs.forEach((log, i) => {
|
|
console.log(`\n事件 ${i + 1}:`)
|
|
console.log(' 合约:', log.address)
|
|
console.log(' Topics[0]:', log.topics[0])
|
|
|
|
// 识别 Transfer 事件 (keccak256("Transfer(address,address,uint256)"))
|
|
if (log.topics[0] === '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef') {
|
|
console.log(' 类型: Transfer 事件')
|
|
if (log.topics[1]) console.log(' From:', '0x' + log.topics[1].slice(26))
|
|
if (log.topics[2]) console.log(' To:', '0x' + log.topics[2].slice(26))
|
|
}
|
|
// 识别 SupplyCollateral 事件
|
|
else if (log.topics[0] === '0x...') { // 需要知道实际的事件签名
|
|
console.log(' 类型: SupplyCollateral 事件')
|
|
}
|
|
else {
|
|
console.log(' 类型: 未知事件')
|
|
}
|
|
|
|
console.log(' Data:', log.data.slice(0, 66) + (log.data.length > 66 ? '...' : ''))
|
|
})
|
|
|
|
// 解析函数选择器
|
|
const selector = tx.input.slice(0, 10)
|
|
console.log('\n=== 函数识别 ===')
|
|
const functionMap = {
|
|
'0x47e7ef24': 'deposit(address,uint256)',
|
|
'0xe8eda9df': 'supplyCollateral(address,uint256)',
|
|
'0x23b872dd': 'transferFrom(address,address,uint256)',
|
|
'0xf213159c': 'supply(uint256)',
|
|
'0x2e1a7d4d': 'withdraw(uint256)'
|
|
}
|
|
console.log('调用函数:', functionMap[selector] || '未知: ' + selector)
|
|
|
|
} catch (error) {
|
|
console.error('查询失败:', error.message)
|
|
}
|
|
}
|
|
|
|
main()
|