mm-btc 0.4.0__py3-none-any.whl → 0.4.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mm_btc/blockstream.py CHANGED
@@ -62,40 +62,40 @@ class BlockstreamClient:
62
62
  self.base_url = TESTNET_BASE_URL if testnet else MAINNET_BASE_URL
63
63
 
64
64
  async def get_address(self, address: str) -> Result[Address]:
65
- result: Result[Address] = Result.failure("not started yet")
65
+ result: Result[Address] = Result.err("not started yet")
66
66
  for _ in range(self.attempts):
67
67
  res = await self._request(f"/address/{address}")
68
68
  try:
69
69
  if res.status_code == 400:
70
- return res.to_result_failure("400 Bad Request")
71
- return res.to_result_success(Address(**res.parse_json_body()))
70
+ return res.to_err_result("400 Bad Request")
71
+ return res.to_ok_result(Address(**res.parse_json_body()))
72
72
  except Exception as e:
73
- result = res.to_result_failure(e)
73
+ result = res.to_err_result(e)
74
74
  return result
75
75
 
76
76
  async def get_confirmed_balance(self, address: str) -> Result[int]:
77
77
  return (await self.get_address(address)).and_then(
78
- lambda a: Result.success(a.chain_stats.funded_txo_sum - a.chain_stats.spent_txo_sum)
78
+ lambda a: Result.ok(a.chain_stats.funded_txo_sum - a.chain_stats.spent_txo_sum)
79
79
  )
80
80
 
81
81
  async def get_utxo(self, address: str) -> Result[list[Utxo]]:
82
- result: Result[list[Utxo]] = Result.failure("not started yet")
82
+ result: Result[list[Utxo]] = Result.err("not started yet")
83
83
  for _ in range(self.attempts):
84
84
  res = await self._request(f"/address/{address}/utxo")
85
85
  try:
86
- return res.to_result_success([Utxo(**out) for out in res.parse_json_body()])
86
+ return res.to_ok_result([Utxo(**out) for out in res.parse_json_body()])
87
87
  except Exception as e:
88
- result = res.to_result_failure(e)
88
+ result = res.to_err_result(e)
89
89
  return result
90
90
 
91
91
  async def get_mempool(self) -> Result[Mempool]:
92
- result: Result[Mempool] = Result.failure("not started yet")
92
+ result: Result[Mempool] = Result.err("not started yet")
93
93
  for _ in range(self.attempts):
94
94
  res = await self._request("/mempool")
95
95
  try:
96
- return res.to_result_success(Mempool(**res.parse_json_body()))
96
+ return res.to_ok_result(Mempool(**res.parse_json_body()))
97
97
  except Exception as e:
98
- result = res.to_result_failure(e)
98
+ result = res.to_err_result(e)
99
99
  return result
100
100
 
101
101
  async def _request(self, url: str) -> HttpResponse:
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mm-btc
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Requires-Python: >=3.12
5
5
  Requires-Dist: bitcoinlib~=0.7.3
6
6
  Requires-Dist: bit~=0.8.0
7
7
  Requires-Dist: hdwallet~=3.4.0
8
- Requires-Dist: mm-crypto-utils>=0.3.1
8
+ Requires-Dist: mm-crypto-utils>=0.3.4
9
9
  Requires-Dist: mnemonic~=0.21
10
10
  Requires-Dist: typer~=0.15.2
@@ -1,5 +1,5 @@
1
1
  mm_btc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- mm_btc/blockstream.py,sha256=cJyECppf4qjnDHDrwdZUzQTJ0RIHTR5ykhqoedAzQsk,3371
2
+ mm_btc/blockstream.py,sha256=FfQ3QYx9jsEIYVQDttyrYHjWn9nZSt0g2RVJ0BP2nW4,3323
3
3
  mm_btc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  mm_btc/tx.py,sha256=7KTMNuL1n8rRj_245BV1bH9M2_PctNvlvPsLEsRTYx4,245
5
5
  mm_btc/wallet.py,sha256=_pGTuAf6Y9KzaWTTSg_tn6WEoRsGqhxJuPof0_xyrmM,2333
@@ -11,7 +11,7 @@ mm_btc/cli/cmd/create_tx_cmd.py,sha256=QHhfA91FGWf5r6DkWTaXInZJi6HYLfxueA1GtcBD2
11
11
  mm_btc/cli/cmd/decode_tx_cmd.py,sha256=0jGlUjnA1X2Q2aYwSBeAjqVNZIBsW5X2lEwIpSfWJsU,175
12
12
  mm_btc/cli/cmd/mnemonic_cmd.py,sha256=CY6tPsqOTNfM-4WhKDhqitCi2OeqSIUMEUTFIRGHwIg,1254
13
13
  mm_btc/cli/cmd/utxo_cmd.py,sha256=B3vI2BPWMSPVvMLGBctJw-C9k9vVLUg4nKFEIYNtmgY,307
14
- mm_btc-0.4.0.dist-info/METADATA,sha256=nDKkAIMrgMP6GntwePrLKr8_LDN6AEPOLluK2Gfo_7U,261
15
- mm_btc-0.4.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
- mm_btc-0.4.0.dist-info/entry_points.txt,sha256=KphzLNE9eb9H1DO-L0gvBQaQT5ImedyVCN4a6svfiRg,46
17
- mm_btc-0.4.0.dist-info/RECORD,,
14
+ mm_btc-0.4.1.dist-info/METADATA,sha256=bt6CX5gfr_y91jQTnwavrJZ5itFuvo_jSHR_LNjpcdE,261
15
+ mm_btc-0.4.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
+ mm_btc-0.4.1.dist-info/entry_points.txt,sha256=KphzLNE9eb9H1DO-L0gvBQaQT5ImedyVCN4a6svfiRg,46
17
+ mm_btc-0.4.1.dist-info/RECORD,,
File without changes