hippius 0.2.51__tar.gz → 0.2.52__tar.gz

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.
Files changed (24) hide show
  1. {hippius-0.2.51 → hippius-0.2.52}/PKG-INFO +1 -1
  2. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/__init__.py +1 -1
  3. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/cli_handlers.py +150 -118
  4. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/ipfs.py +15 -17
  5. {hippius-0.2.51 → hippius-0.2.52}/pyproject.toml +1 -1
  6. {hippius-0.2.51 → hippius-0.2.52}/README.md +0 -0
  7. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/cli.py +0 -0
  8. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/cli_assets.py +0 -0
  9. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/cli_parser.py +0 -0
  10. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/cli_rich.py +0 -0
  11. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/client.py +0 -0
  12. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/config.py +0 -0
  13. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/db/README.md +0 -0
  14. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/db/env.db.template +0 -0
  15. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/db/migrations/20241201000001_create_key_storage_tables.sql +0 -0
  16. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/db/migrations/20241202000001_switch_to_subaccount_encryption.sql +0 -0
  17. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/db/setup_database.sh +0 -0
  18. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/db_utils.py +0 -0
  19. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/errors.py +0 -0
  20. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/incentives.py +0 -0
  21. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/ipfs_core.py +0 -0
  22. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/key_storage.py +0 -0
  23. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/substrate.py +0 -0
  24. {hippius-0.2.51 → hippius-0.2.52}/hippius_sdk/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hippius
3
- Version: 0.2.51
3
+ Version: 0.2.52
4
4
  Summary: Python SDK and CLI for Hippius blockchain storage
5
5
  Home-page: https://github.com/thenervelab/hippius-sdk
6
6
  Author: Dubs
@@ -26,7 +26,7 @@ from hippius_sdk.config import (
26
26
  from hippius_sdk.ipfs import IPFSClient, S3PublishResult, S3DownloadResult
27
27
  from hippius_sdk.utils import format_cid, format_size, hex_to_ipfs_cid
28
28
 
29
- __version__ = "0.2.51"
29
+ __version__ = "0.2.52"
30
30
  __all__ = [
31
31
  "HippiusClient",
32
32
  "IPFSClient",
@@ -3744,53 +3744,61 @@ def handle_verify_node(
3744
3744
  # Get current account info
3745
3745
  account = get_active_account()
3746
3746
  if not account:
3747
- error("No active account. Please set up an account first with 'hippius account create' or 'hippius seed set'")
3747
+ error(
3748
+ "No active account. Please set up an account first with 'hippius account create' or 'hippius seed set'"
3749
+ )
3748
3750
  return 1
3749
-
3751
+
3750
3752
  account_address = get_account_address(account)
3751
3753
  if not account_address:
3752
3754
  error(f"Could not get address for account '{account}'")
3753
3755
  return 1
3754
-
3755
- info(f"Verifying existing node using account: [bold cyan]{account}[/bold cyan] ({account_address})")
3756
-
3756
+
3757
+ info(
3758
+ f"Verifying existing node using account: [bold cyan]{account}[/bold cyan] ({account_address})"
3759
+ )
3760
+
3757
3761
  # Import and use incentives.py functionality
3758
3762
  from hippius_sdk.incentives import (
3759
- load_ipfs_seed, load_main_seed, encode_account_id, verify_peer_id,
3760
- blake2_256, manual_encode_challenge
3763
+ load_ipfs_seed,
3764
+ load_main_seed,
3765
+ encode_account_id,
3766
+ verify_peer_id,
3767
+ blake2_256,
3768
+ manual_encode_challenge,
3761
3769
  )
3762
3770
  from substrateinterface import SubstrateInterface, Keypair
3763
3771
  from nacl.signing import SigningKey
3764
3772
  import base58
3765
3773
  import secrets
3766
3774
  from binascii import hexlify
3767
-
3775
+
3768
3776
  # Initialize SubstrateInterface
3769
3777
  substrate = SubstrateInterface(url=client.substrate_client.url)
3770
-
3778
+
3771
3779
  # Get genesis hash and current block
3772
3780
  genesis_hash_hex = substrate.get_block_hash(0)
3773
3781
  genesis_hash = bytes.fromhex(genesis_hash_hex[2:])
3774
3782
  current_block_number = substrate.get_block_number(None)
3775
-
3783
+
3776
3784
  log(f"Current block number: {current_block_number}")
3777
-
3785
+
3778
3786
  # Process node_id
3779
3787
  if node_id.startswith("0x"):
3780
3788
  node_id_bytes = bytes.fromhex(node_id[2:])
3781
3789
  else:
3782
3790
  node_id_bytes = base58.b58decode(node_id)
3783
-
3791
+
3784
3792
  # Load IPFS and main seeds
3785
3793
  ipfs_seed, peerid_from_config = load_ipfs_seed(ipfs_config, ipfs_priv_b64)
3786
3794
  main_seed = load_main_seed(node_priv_hex)
3787
-
3795
+
3788
3796
  # Create signing keys
3789
3797
  main_sk = SigningKey(main_seed)
3790
3798
  main_pk = bytes(main_sk.verify_key)
3791
3799
  ipfs_sk = SigningKey(ipfs_seed)
3792
3800
  ipfs_pk = bytes(ipfs_sk.verify_key)
3793
-
3801
+
3794
3802
  # Handle IPFS peer ID
3795
3803
  if ipfs_peer_id:
3796
3804
  ipfs_peer_id_bytes = base58.b58decode(ipfs_peer_id)
@@ -3798,116 +3806,124 @@ def handle_verify_node(
3798
3806
  ipfs_peer_id_bytes = base58.b58decode(peerid_from_config)
3799
3807
  else:
3800
3808
  # For verification, IPFS peer ID might not be required for all node types
3801
- ipfs_peer_id_bytes = b''
3802
-
3809
+ ipfs_peer_id_bytes = b""
3810
+
3803
3811
  # Verify keys match node IDs
3804
3812
  if not verify_peer_id(main_pk, node_id_bytes, "Ed25519"):
3805
3813
  error("Main public key does not match node ID")
3806
3814
  return 1
3807
-
3808
- if ipfs_peer_id_bytes and not verify_peer_id(ipfs_pk, ipfs_peer_id_bytes, "Ed25519"):
3815
+
3816
+ if ipfs_peer_id_bytes and not verify_peer_id(
3817
+ ipfs_pk, ipfs_peer_id_bytes, "Ed25519"
3818
+ ):
3809
3819
  error("IPFS public key does not match peer ID")
3810
3820
  return 1
3811
-
3821
+
3812
3822
  # Create challenge data
3813
3823
  domain_bytes = domain.encode()
3814
- domain24 = b"HIPPIUS::REGISTER::v1" + b"\x00"*3
3824
+ domain24 = b"HIPPIUS::REGISTER::v1" + b"\x00" * 3
3815
3825
  node_id_hash = blake2_256(node_id_bytes)
3816
3826
  ipfs_peer_id_hash = blake2_256(ipfs_peer_id_bytes)
3817
-
3818
- nonce = (bytes.fromhex(nonce_hex[2:]) if nonce_hex and nonce_hex.startswith("0x")
3819
- else bytes.fromhex(nonce_hex) if nonce_hex
3820
- else secrets.token_bytes(32))
3821
-
3827
+
3828
+ nonce = (
3829
+ bytes.fromhex(nonce_hex[2:])
3830
+ if nonce_hex and nonce_hex.startswith("0x")
3831
+ else bytes.fromhex(nonce_hex)
3832
+ if nonce_hex
3833
+ else secrets.token_bytes(32)
3834
+ )
3835
+
3822
3836
  expires_at_block = current_block_number + expires_in
3823
3837
  account_bytes = encode_account_id(account_address)
3824
-
3838
+
3825
3839
  challenge_data = {
3826
- 'domain': domain24,
3827
- 'genesis_hash': genesis_hash,
3828
- 'account': account_bytes,
3829
- 'node_id_hash': node_id_hash,
3830
- 'ipfs_peer_id_hash': ipfs_peer_id_hash,
3831
- 'block_number': current_block_number,
3832
- 'nonce': nonce,
3833
- 'expires_at': expires_at_block,
3840
+ "domain": domain24,
3841
+ "genesis_hash": genesis_hash,
3842
+ "account": account_bytes,
3843
+ "node_id_hash": node_id_hash,
3844
+ "ipfs_peer_id_hash": ipfs_peer_id_hash,
3845
+ "block_number": current_block_number,
3846
+ "nonce": nonce,
3847
+ "expires_at": expires_at_block,
3834
3848
  }
3835
-
3849
+
3836
3850
  challenge_bytes = manual_encode_challenge(challenge_data, block_width)
3837
-
3851
+
3838
3852
  # Sign challenge
3839
3853
  main_sig = main_sk.sign(challenge_bytes).signature
3840
3854
  ipfs_sig = ipfs_sk.sign(challenge_bytes).signature
3841
-
3855
+
3842
3856
  # Build call parameters for verify_existing_node
3843
3857
  call_params = {
3844
3858
  "node_id": node_id,
3845
- "node_id_hex": "0x"+hexlify(node_id_bytes).decode(),
3846
- "ipfs_id_hex": "0x"+hexlify(ipfs_peer_id_bytes).decode(),
3859
+ "node_id_hex": "0x" + hexlify(node_id_bytes).decode(),
3860
+ "ipfs_id_hex": "0x" + hexlify(ipfs_peer_id_bytes).decode(),
3847
3861
  "main_key_type": "Ed25519",
3848
- "main_public_key": "0x"+main_pk.hex(),
3849
- "main_sig": "0x"+main_sig.hex(),
3862
+ "main_public_key": "0x" + main_pk.hex(),
3863
+ "main_sig": "0x" + main_sig.hex(),
3850
3864
  "ipfs_key_type": "Ed25519",
3851
- "ipfs_public_key": "0x"+ipfs_pk.hex(),
3852
- "ipfs_sig": "0x"+ipfs_sig.hex(),
3853
- "challenge_bytes": "0x"+challenge_bytes.hex(),
3865
+ "ipfs_public_key": "0x" + ipfs_pk.hex(),
3866
+ "ipfs_sig": "0x" + ipfs_sig.hex(),
3867
+ "challenge_bytes": "0x" + challenge_bytes.hex(),
3854
3868
  }
3855
-
3869
+
3856
3870
  if dry_run:
3857
3871
  log("Dry run mode - printing payload without submitting")
3858
3872
  payload = {
3859
- "genesis_hash_hex": "0x"+genesis_hash.hex(),
3873
+ "genesis_hash_hex": "0x" + genesis_hash.hex(),
3860
3874
  "current_block_number": current_block_number,
3861
- "challenge_bytes_hex": "0x"+challenge_bytes.hex(),
3875
+ "challenge_bytes_hex": "0x" + challenge_bytes.hex(),
3862
3876
  "call_module": "Registration",
3863
3877
  "call_function": "verify_existing_node",
3864
- "call_params": call_params
3878
+ "call_params": call_params,
3865
3879
  }
3866
3880
  console.print(json.dumps(payload, indent=2))
3867
3881
  return 0
3868
-
3882
+
3869
3883
  # Get keypair for signing
3870
3884
  from hippius_sdk.config import get_seed_phrase
3885
+
3871
3886
  seed_phrase = get_seed_phrase()
3872
3887
  if not seed_phrase:
3873
3888
  error("No seed phrase available for signing transaction")
3874
3889
  return 1
3875
-
3890
+
3876
3891
  kp = Keypair.create_from_uri(seed_phrase)
3877
-
3892
+
3878
3893
  # Submit transaction
3879
3894
  log("Submitting node verification transaction...")
3880
3895
  log(f"Using module: [bold cyan]Registration[/bold cyan]")
3881
3896
  call = substrate.compose_call(
3882
3897
  call_module="Registration",
3883
3898
  call_function="verify_existing_node",
3884
- call_params=call_params
3899
+ call_params=call_params,
3885
3900
  )
3886
3901
  extrinsic = substrate.create_signed_extrinsic(call=call, keypair=kp)
3887
3902
  receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
3888
-
3903
+
3889
3904
  result = {
3890
3905
  "extrinsic_hash": receipt.extrinsic_hash,
3891
3906
  "is_success": receipt.is_success,
3892
3907
  "error_message": receipt.error_message,
3893
- "triggered_events": [str(event) for event in receipt.triggered_events]
3908
+ "triggered_events": [str(event) for event in receipt.triggered_events],
3894
3909
  }
3895
-
3910
+
3896
3911
  if receipt.is_success:
3897
3912
  success(f"Node verification successful!")
3898
3913
  success(f"Transaction hash: {receipt.extrinsic_hash}")
3899
3914
  else:
3900
3915
  error(f"Node verification failed: {receipt.error_message}")
3901
-
3916
+
3902
3917
  log("Full result:")
3903
3918
  console.print(json.dumps(result, indent=2))
3904
-
3919
+
3905
3920
  return 0 if receipt.is_success else 1
3906
-
3921
+
3907
3922
  except Exception as e:
3908
3923
  error(f"Error verifying node: {e}")
3909
- if hasattr(e, '__traceback__'):
3924
+ if hasattr(e, "__traceback__"):
3910
3925
  import traceback
3926
+
3911
3927
  traceback.print_exc()
3912
3928
  return 1
3913
3929
 
@@ -3930,53 +3946,61 @@ def handle_verify_coldkey_node(
3930
3946
  # Get current account info
3931
3947
  account = get_active_account()
3932
3948
  if not account:
3933
- error("No active account. Please set up an account first with 'hippius account create' or 'hippius seed set'")
3949
+ error(
3950
+ "No active account. Please set up an account first with 'hippius account create' or 'hippius seed set'"
3951
+ )
3934
3952
  return 1
3935
-
3953
+
3936
3954
  account_address = get_account_address(account)
3937
3955
  if not account_address:
3938
3956
  error(f"Could not get address for account '{account}'")
3939
3957
  return 1
3940
-
3941
- info(f"Verifying existing coldkey node using account: [bold cyan]{account}[/bold cyan] ({account_address})")
3942
-
3958
+
3959
+ info(
3960
+ f"Verifying existing coldkey node using account: [bold cyan]{account}[/bold cyan] ({account_address})"
3961
+ )
3962
+
3943
3963
  # Import and use incentives.py functionality
3944
3964
  from hippius_sdk.incentives import (
3945
- load_ipfs_seed, load_main_seed, encode_account_id, verify_peer_id,
3946
- blake2_256, manual_encode_challenge
3965
+ load_ipfs_seed,
3966
+ load_main_seed,
3967
+ encode_account_id,
3968
+ verify_peer_id,
3969
+ blake2_256,
3970
+ manual_encode_challenge,
3947
3971
  )
3948
3972
  from substrateinterface import SubstrateInterface, Keypair
3949
3973
  from nacl.signing import SigningKey
3950
3974
  import base58
3951
3975
  import secrets
3952
3976
  from binascii import hexlify
3953
-
3977
+
3954
3978
  # Initialize SubstrateInterface
3955
3979
  substrate = SubstrateInterface(url=client.substrate_client.url)
3956
-
3980
+
3957
3981
  # Get genesis hash and current block
3958
3982
  genesis_hash_hex = substrate.get_block_hash(0)
3959
3983
  genesis_hash = bytes.fromhex(genesis_hash_hex[2:])
3960
3984
  current_block_number = substrate.get_block_number(None)
3961
-
3985
+
3962
3986
  log(f"Current block number: {current_block_number}")
3963
-
3987
+
3964
3988
  # Process node_id
3965
3989
  if node_id.startswith("0x"):
3966
3990
  node_id_bytes = bytes.fromhex(node_id[2:])
3967
3991
  else:
3968
3992
  node_id_bytes = base58.b58decode(node_id)
3969
-
3993
+
3970
3994
  # Load IPFS and main seeds
3971
3995
  ipfs_seed, peerid_from_config = load_ipfs_seed(ipfs_config, ipfs_priv_b64)
3972
3996
  main_seed = load_main_seed(node_priv_hex)
3973
-
3997
+
3974
3998
  # Create signing keys
3975
3999
  main_sk = SigningKey(main_seed)
3976
4000
  main_pk = bytes(main_sk.verify_key)
3977
4001
  ipfs_sk = SigningKey(ipfs_seed)
3978
4002
  ipfs_pk = bytes(ipfs_sk.verify_key)
3979
-
4003
+
3980
4004
  # Handle IPFS peer ID
3981
4005
  if ipfs_peer_id:
3982
4006
  ipfs_peer_id_bytes = base58.b58decode(ipfs_peer_id)
@@ -3984,115 +4008,123 @@ def handle_verify_coldkey_node(
3984
4008
  ipfs_peer_id_bytes = base58.b58decode(peerid_from_config)
3985
4009
  else:
3986
4010
  # For verification, IPFS peer ID might not be required for all node types
3987
- ipfs_peer_id_bytes = b''
3988
-
4011
+ ipfs_peer_id_bytes = b""
4012
+
3989
4013
  # Verify keys match node IDs
3990
4014
  if not verify_peer_id(main_pk, node_id_bytes, "Ed25519"):
3991
4015
  error("Main public key does not match node ID")
3992
4016
  return 1
3993
-
3994
- if ipfs_peer_id_bytes and not verify_peer_id(ipfs_pk, ipfs_peer_id_bytes, "Ed25519"):
4017
+
4018
+ if ipfs_peer_id_bytes and not verify_peer_id(
4019
+ ipfs_pk, ipfs_peer_id_bytes, "Ed25519"
4020
+ ):
3995
4021
  error("IPFS public key does not match peer ID")
3996
4022
  return 1
3997
-
4023
+
3998
4024
  # Create challenge data
3999
4025
  domain_bytes = domain.encode()
4000
- domain24 = b"HIPPIUS::REGISTER::v1" + b"\x00"*3
4026
+ domain24 = b"HIPPIUS::REGISTER::v1" + b"\x00" * 3
4001
4027
  node_id_hash = blake2_256(node_id_bytes)
4002
4028
  ipfs_peer_id_hash = blake2_256(ipfs_peer_id_bytes)
4003
-
4004
- nonce = (bytes.fromhex(nonce_hex[2:]) if nonce_hex and nonce_hex.startswith("0x")
4005
- else bytes.fromhex(nonce_hex) if nonce_hex
4006
- else secrets.token_bytes(32))
4007
-
4029
+
4030
+ nonce = (
4031
+ bytes.fromhex(nonce_hex[2:])
4032
+ if nonce_hex and nonce_hex.startswith("0x")
4033
+ else bytes.fromhex(nonce_hex)
4034
+ if nonce_hex
4035
+ else secrets.token_bytes(32)
4036
+ )
4037
+
4008
4038
  expires_at_block = current_block_number + expires_in
4009
4039
  account_bytes = encode_account_id(account_address)
4010
-
4040
+
4011
4041
  challenge_data = {
4012
- 'domain': domain24,
4013
- 'genesis_hash': genesis_hash,
4014
- 'account': account_bytes,
4015
- 'node_id_hash': node_id_hash,
4016
- 'ipfs_peer_id_hash': ipfs_peer_id_hash,
4017
- 'block_number': current_block_number,
4018
- 'nonce': nonce,
4019
- 'expires_at': expires_at_block,
4042
+ "domain": domain24,
4043
+ "genesis_hash": genesis_hash,
4044
+ "account": account_bytes,
4045
+ "node_id_hash": node_id_hash,
4046
+ "ipfs_peer_id_hash": ipfs_peer_id_hash,
4047
+ "block_number": current_block_number,
4048
+ "nonce": nonce,
4049
+ "expires_at": expires_at_block,
4020
4050
  }
4021
-
4051
+
4022
4052
  challenge_bytes = manual_encode_challenge(challenge_data, block_width)
4023
-
4053
+
4024
4054
  # Sign challenge
4025
4055
  main_sig = main_sk.sign(challenge_bytes).signature
4026
4056
  ipfs_sig = ipfs_sk.sign(challenge_bytes).signature
4027
-
4057
+
4028
4058
  # Build call parameters for verify_existing_coldkey_node
4029
4059
  call_params = {
4030
4060
  "node_id": node_id,
4031
- "node_id_hex": "0x"+hexlify(node_id_bytes).decode(),
4032
- "ipfs_id_hex": "0x"+hexlify(ipfs_peer_id_bytes).decode(),
4061
+ "node_id_hex": "0x" + hexlify(node_id_bytes).decode(),
4062
+ "ipfs_id_hex": "0x" + hexlify(ipfs_peer_id_bytes).decode(),
4033
4063
  "main_key_type": "Ed25519",
4034
- "main_public_key": "0x"+main_pk.hex(),
4035
- "main_sig": "0x"+main_sig.hex(),
4064
+ "main_public_key": "0x" + main_pk.hex(),
4065
+ "main_sig": "0x" + main_sig.hex(),
4036
4066
  "ipfs_key_type": "Ed25519",
4037
- "ipfs_public_key": "0x"+ipfs_pk.hex(),
4038
- "ipfs_sig": "0x"+ipfs_sig.hex(),
4039
- "challenge_bytes": "0x"+challenge_bytes.hex(),
4067
+ "ipfs_public_key": "0x" + ipfs_pk.hex(),
4068
+ "ipfs_sig": "0x" + ipfs_sig.hex(),
4069
+ "challenge_bytes": "0x" + challenge_bytes.hex(),
4040
4070
  }
4041
-
4071
+
4042
4072
  if dry_run:
4043
4073
  log("Dry run mode - printing payload without submitting")
4044
4074
  payload = {
4045
- "genesis_hash_hex": "0x"+genesis_hash.hex(),
4075
+ "genesis_hash_hex": "0x" + genesis_hash.hex(),
4046
4076
  "current_block_number": current_block_number,
4047
- "challenge_bytes_hex": "0x"+challenge_bytes.hex(),
4077
+ "challenge_bytes_hex": "0x" + challenge_bytes.hex(),
4048
4078
  "call_module": "Registration",
4049
4079
  "call_function": "verify_existing_coldkey_node",
4050
- "call_params": call_params
4080
+ "call_params": call_params,
4051
4081
  }
4052
4082
  console.print(json.dumps(payload, indent=2))
4053
4083
  return 0
4054
-
4084
+
4055
4085
  # Get keypair for signing
4056
4086
  from hippius_sdk.config import get_seed_phrase
4087
+
4057
4088
  seed_phrase = get_seed_phrase()
4058
4089
  if not seed_phrase:
4059
4090
  error("No seed phrase available for signing transaction")
4060
4091
  return 1
4061
-
4092
+
4062
4093
  kp = Keypair.create_from_uri(seed_phrase)
4063
-
4094
+
4064
4095
  # Submit transaction
4065
4096
  log("Submitting coldkey node verification transaction...")
4066
4097
  log(f"Using module: [bold cyan]Registration[/bold cyan]")
4067
4098
  call = substrate.compose_call(
4068
4099
  call_module="Registration",
4069
4100
  call_function="verify_existing_coldkey_node",
4070
- call_params=call_params
4101
+ call_params=call_params,
4071
4102
  )
4072
4103
  extrinsic = substrate.create_signed_extrinsic(call=call, keypair=kp)
4073
4104
  receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
4074
-
4105
+
4075
4106
  result = {
4076
4107
  "extrinsic_hash": receipt.extrinsic_hash,
4077
4108
  "is_success": receipt.is_success,
4078
4109
  "error_message": receipt.error_message,
4079
- "triggered_events": [str(event) for event in receipt.triggered_events]
4110
+ "triggered_events": [str(event) for event in receipt.triggered_events],
4080
4111
  }
4081
-
4112
+
4082
4113
  if receipt.is_success:
4083
4114
  success(f"Coldkey node verification successful!")
4084
4115
  success(f"Transaction hash: {receipt.extrinsic_hash}")
4085
4116
  else:
4086
4117
  error(f"Coldkey node verification failed: {receipt.error_message}")
4087
-
4118
+
4088
4119
  log("Full result:")
4089
4120
  console.print(json.dumps(result, indent=2))
4090
-
4121
+
4091
4122
  return 0 if receipt.is_success else 1
4092
-
4123
+
4093
4124
  except Exception as e:
4094
4125
  error(f"Error verifying coldkey node: {e}")
4095
- if hasattr(e, '__traceback__'):
4126
+ if hasattr(e, "__traceback__"):
4096
4127
  import traceback
4128
+
4097
4129
  traceback.print_exc()
4098
4130
  return 1
@@ -2294,9 +2294,6 @@ class IPFSClient:
2294
2294
  encrypted_data += chunk
2295
2295
  return encrypted_data
2296
2296
 
2297
- # Stream and decrypt the content using hybrid buffered approach
2298
- import nacl.secret
2299
-
2300
2297
  # Collect all encrypted data first
2301
2298
  logger.debug("Buffering encrypted content for decryption")
2302
2299
  encrypted_data = b""
@@ -2344,16 +2341,16 @@ class IPFSClient:
2344
2341
  os.path.dirname(os.path.abspath(output_path)), exist_ok=True
2345
2342
  )
2346
2343
 
2347
- download_client = AsyncIPFSClient(api_url=download_node)
2348
-
2349
- download_url = f"{download_node.rstrip('/')}/api/v0/cat?arg={cid}"
2344
+ # Use gateway style instead of cat API for better HTTP semantics
2345
+ download_url = f"{download_node.rstrip('/')}/ipfs/{cid}"
2350
2346
 
2351
2347
  # Download file into memory
2352
2348
  file_data = bytearray()
2353
- async with download_client.client.stream("POST", download_url) as response:
2354
- response.raise_for_status()
2355
- async for chunk in response.aiter_bytes(chunk_size=8192):
2356
- file_data.extend(chunk)
2349
+ async with httpx.AsyncClient() as client:
2350
+ async with client.stream("GET", download_url) as response:
2351
+ response.raise_for_status()
2352
+ async for chunk in response.aiter_bytes(chunk_size=8192):
2353
+ file_data.extend(chunk)
2357
2354
 
2358
2355
  # Convert to bytes for consistency
2359
2356
  file_data = bytes(file_data)
@@ -2523,15 +2520,16 @@ class IPFSClient:
2523
2520
  HippiusIPFSError: If IPFS stream fails
2524
2521
  """
2525
2522
  try:
2526
- download_client = AsyncIPFSClient(api_url=download_node)
2527
- download_url = f"{download_node.rstrip('/')}/api/v0/cat?arg={cid}"
2523
+ # Use gateway style instead of cat API for better HTTP semantics
2524
+ download_url = f"{download_node.rstrip('/')}/ipfs/{cid}"
2528
2525
 
2529
- async with download_client.client.stream("POST", download_url) as response:
2530
- response.raise_for_status()
2531
- logger.info(f"Started streaming from {download_node} for CID: {cid}")
2526
+ async with httpx.AsyncClient() as client:
2527
+ async with client.stream("GET", download_url) as response:
2528
+ response.raise_for_status()
2529
+ logger.info(f"Started streaming from {download_node} for CID: {cid}")
2532
2530
 
2533
- async for chunk in response.aiter_bytes(chunk_size=8192):
2534
- yield chunk
2531
+ async for chunk in response.aiter_bytes(chunk_size=8192):
2532
+ yield chunk
2535
2533
 
2536
2534
  except Exception as e:
2537
2535
  raise HippiusIPFSError(f"Failed to stream from {download_node}: {str(e)}")
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "hippius"
3
- version = "0.2.51"
3
+ version = "0.2.52"
4
4
  description = "Python SDK and CLI for Hippius blockchain storage"
5
5
  authors = ["Dubs <dubs@dubs.rs>"]
6
6
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes