Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Support specified wallet to get balance information #814

Draft
wants to merge 2 commits into
base: bixin_dev
Choose a base branch
from

Conversation

shuaiLiWang
Copy link

@shuaiLiWang shuaiLiWang commented Jun 21, 2021

What does this implement/fix? Explain your changes.

commit1:get_wallet_balance支持指定钱包获取余额

 涉及到资金的其他两个接口:
 回调接口update_status 因为回调的时当前钱包的资产,并且以后逻辑更改成前端按需调用,所以 这个接口暂不更新
 获取所有资金接口 get_all_wallet_balance,本就没有涉及到self.wallet的使用

commit2:转账相关接口支持指定钱包操作

Does this close any currently open issues?

If it fixes a bug or resolves a feature request, be sure to link to that issue.

Pull request type

Put an x in the boxes that apply

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

Where has this been tested?

Any other comments?

@shuaiLiWang shuaiLiWang self-assigned this Jun 21, 2021
@shuaiLiWang shuaiLiWang marked this pull request as draft June 21, 2021 07:11
@shuaiLiWang shuaiLiWang removed their assignment Jun 21, 2021
@shuaiLiWang shuaiLiWang changed the title Support specified wallet to get balance information 【WIF】Support specified wallet to get balance information Jun 21, 2021
@shuaiLiWang shuaiLiWang force-pushed the add_id_for_get_balance branch from 9b8dbcc to f7e4df0 Compare June 22, 2021 10:05
@shuaiLiWang shuaiLiWang force-pushed the add_id_for_get_balance branch from f7e4df0 to ed4e5ba Compare June 23, 2021 10:15
@shuaiLiWang shuaiLiWang changed the title 【WIF】Support specified wallet to get balance information Support specified wallet to get balance information Jun 23, 2021
Copy link

@taimanhui taimanhui left a comment

Choose a reason for hiding this comment

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

我只看了一部分,感觉第二个commit好像多做了一些和发送无关的内容,你是想直接全部去掉self.wallet吗,但是又好像不太彻底...
最好只改现在app需要的那部分,或者其实前端多使用select_wallet还是switch_wallet(我忘了是哪个)也能够解决问题,除了取余额之类的操作,发送相关的不太可能说需要同时对两个钱包去进行调用,那么完全可以多做切换就好了...

@@ -925,9 +925,9 @@ def get_coins(self, coins_info):
coins.append(utxo)
return coins

def format_return_data(self, feerate, size, block):
def format_return_data(self, feerate, size, block, coin):

Choose a reason for hiding this comment

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

这个其实只是btc的用,所以,写死btc就好了

@@ -960,7 +960,9 @@ def get_default_fee_info(self, feerate=None, coin="btc", eth_tx_info=None):
"normal": {"gas_price": 79, "time": 3, "gas_limit": 40000, "fee": "0.00316", "fiat": "4.33 USD"},
"slow": {"gas_price": 72, "time": 10, "gas_limit": 40000, "fee": "0.00288", "fiat": "3.95 USD"}}
"""
self._assert_wallet_isvalid()

wallet = self.get_wallet_by_name(id) if id else self.wallet

Choose a reason for hiding this comment

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

不太合理,把id作为一个必须的属性,然后去掉self.wallet会更好点,就是直接抛弃self.wallet了。那么get_wallet_by_name里找不到wallet的话可以抛出找不到钱包的统一异常

@@ -1122,6 +1127,8 @@ def get_fee_by_feerate(self, coin="btc", outputs=None, message=None, feerate=Non
else if coin is "eth":
json like {"gas_price": 110, "time": 0.25, "gas_limit": 36015, "fee": "0.00396165", "fiat": "5.43 USD"}
"""
wallet = self.get_wallet_by_name(id) if id else self.wallet

Choose a reason for hiding this comment

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

同上

"""
Confirm to create transaction, for btc only
:param tx: tx that created by get_fee_by_feerate
:return: json like {"tx":""}
"""

try:
self._assert_wallet_isvalid()
wallet = self.get_wallet_by_name(id) if id else self.wallet

Choose a reason for hiding this comment

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

要检查是btc的钱包

@shuaiLiWang
Copy link
Author

shuaiLiWang commented Jun 24, 2021

我只看了一部分,感觉第二个commit好像多做了一些和发送无关的内容,你是想直接全部去掉self.wallet吗,但是又好像不太彻底...
最好只改现在app需要的那部分,或者其实前端多使用select_wallet还是switch_wallet(我忘了是哪个)也能够解决问题,除了取余额之类的操作,发送相关的不太可能说需要同时对两个钱包去进行调用,那么完全可以多做切换就好了...

现在的新页面设计是需要的 总资产里边点进去需要支持直接转账 并且回到钱包页面的时候 不能切换钱包
之前跟前端讨论让他们暂时switch_wallet切换 他们说那样太麻烦了 又因为我们在做解耦 就想着把这块改了
self.wallet没有全部去除是为了暂时兼容 不影响老的流程使用

@taimanhui
Copy link

上周最后的结论是隐藏掉所有资产页面进去之后的转账功能,等我们解耦之后才来处理,所以这个留着或者关掉都可以,做个记录

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants