From 06a8ec8cb9d5e9e9c64fc839b38d159cceb244e8 Mon Sep 17 00:00:00 2001 From: guoshijiang Date: Mon, 12 Sep 2022 16:54:57 +0800 Subject: [PATCH] fix --- config.yml | 8 +++++++- wallet/tron/tron.go | 37 +++++++++++++++++++--------------- walletdispatcher/dispatcher.go | 6 ++++-- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/config.yml b/config.yml index 4c00855..9491cdb 100644 --- a/config.yml +++ b/config.yml @@ -8,7 +8,7 @@ network: mainnet fullnode: btc: rpcs: - - rpc_url: 'https://electrum.blockstream.info' + - rpc_url: 'https://electrum.coineuskal.com:50002' rpc_user: rpc_pass: confirmations: 1 @@ -18,6 +18,12 @@ fullnode: confirmations: 4 tp_api_url: 'https://api.etherscan.io/api?' tp_api_key: 'W972DC11QYVEWRSWCRYHTT4H362PK43P8N' + trx: + rpcs: + - rpc_url: '34.237.210.82:50051' + confirmations: 4 + tp_api_url: '' + tp_api_key: '' solana: public_api: 'https://public-api.solscan.io' diff --git a/wallet/tron/tron.go b/wallet/tron/tron.go index adabe3f..05faaaf 100644 --- a/wallet/tron/tron.go +++ b/wallet/tron/tron.go @@ -90,7 +90,6 @@ func (a *WalletAdaptor) GetBalance(req *wallet2.BalanceRequest) (*wallet2.Balanc Msg: "get balance fail", }, err } - if symbol != req.Chain { err = fmt.Errorf("contract's symbol %v != symbol:%v", symbol, req.Coin) return &wallet2.BalanceResponse{ @@ -255,21 +254,6 @@ func (a *WalletAdaptor) GetTxByHash(req *wallet2.TxHashRequest) (*wallet2.TxHash } } -func (a *WalletAdaptor) GetAccount(req *wallet2.AccountRequest) (*wallet2.AccountResponse, error) { - //TODO implement me - panic("implement me") -} - -func (a *WalletAdaptor) GetUtxo(req *wallet2.UtxoRequest) (*wallet2.UtxoResponse, error) { - //TODO implement me - panic("implement me") -} - -func (a *WalletAdaptor) GetMinRent(req *wallet2.MinRentRequest) (*wallet2.MinRentResponse, error) { - //TODO implement me - panic("implement me") -} - func (wa *WalletAdaptor) GetNonce(req *wallet2.NonceRequest) (*wallet2.NonceResponse, error) { log.Info("QueryNonce", "req", req) return &wallet2.NonceResponse{ @@ -639,6 +623,27 @@ func (a *WalletAdaptor) VerifyUtxoSignedTx(req *wallet2.VerifySignedTxRequest) ( }, nil } +func (a *WalletAdaptor) GetMinRent(req *wallet2.MinRentRequest) (*wallet2.MinRentResponse, error) { + return &wallet2.MinRentResponse{ + Code: common.ReturnCode_ERROR, + Msg: "tron don't support this api", + }, nil +} + +func (a *WalletAdaptor) GetAccount(req *wallet2.AccountRequest) (*wallet2.AccountResponse, error) { + return &wallet2.AccountResponse{ + Code: common.ReturnCode_ERROR, + Msg: "tron don't support this api", + }, nil +} + +func (a *WalletAdaptor) GetUtxo(req *wallet2.UtxoRequest) (*wallet2.UtxoResponse, error) { + return &wallet2.UtxoResponse{ + Code: common.ReturnCode_ERROR, + Msg: "tron don't support this api", + }, nil +} + type semaphore chan struct{} func (s semaphore) Acquire() { diff --git a/walletdispatcher/dispatcher.go b/walletdispatcher/dispatcher.go index 4c90ba4..15e068e 100644 --- a/walletdispatcher/dispatcher.go +++ b/walletdispatcher/dispatcher.go @@ -38,6 +38,7 @@ func New(conf *config.Config) (*WalletDispatcher, error) { bitcoin.ChainName: bitcoin.NewChainAdaptor, ethereum.ChainName: ethereum.NewChainAdaptor, solana.ChainName: solana.NewChainAdaptor, + // tron.ChainName: tron.NewWalletAdaptor, } supportedChains := []string{bitcoin.ChainName, ethereum.ChainName, solana.ChainName} for _, c := range conf.Chains { @@ -62,9 +63,10 @@ func NewLocal(network config.NetWorkType) *WalletDispatcher { walletAdaptorFactoryMap := map[string]func(network config.NetWorkType) wallet.WalletAdaptor{ bitcoin.ChainName: bitcoin.NewLocalChainAdaptor, ethereum.ChainName: ethereum.NewLocalWalletAdaptor, + solana.ChainName: solana.NewLocalWalletAdaptor, + // tron.ChainName: tron.NewLocalWalletAdaptor, } - supportedChains := []string{bitcoin.ChainName, ethereum.ChainName} - + supportedChains := []string{bitcoin.ChainName, ethereum.ChainName, solana.ChainName} for _, c := range supportedChains { if factory, ok := walletAdaptorFactoryMap[c]; ok { dispatcher.registry[c] = factory(network)