Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
guoshijiang committed Sep 12, 2022
1 parent 0fbf962 commit 06a8ec8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
8 changes: 7 additions & 1 deletion config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand Down
37 changes: 21 additions & 16 deletions wallet/tron/tron.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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() {
Expand Down
6 changes: 4 additions & 2 deletions walletdispatcher/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand Down

0 comments on commit 06a8ec8

Please sign in to comment.