Skip to main content

Module gestion wallet basé sur la blockchain Ethereum

Project description

WHW Wallet Web 3

Connection and Wallet Management Module on the Ethereum Blockchain.

Authors

Installation

Install my-project with pip

  pip install whw

Quick start

  1. You can quickly initialize a wallet with the WalletProvider class a. Import a private key
import whw

HTTP_PROVIDER = "The provider"  # The provider

private_key = "YOUR_PRIVATE_KEY"  # Your private key
path_private_key = "/path/to/your/key"  # Path to the private key

# Initialize the wallet with a private key
wallet = whw.WalletProvider(
    http_provider=HTTP_PROVIDER,
    name="your_name",
    service="import",
    key=private_key
)

# Initialize the wallet with the path to a file containing a private key
wallet = whw.WalletProvider(
    http_provider=HTTP_PROVIDER,
    name="your_name",
    service="import",
    key_path=path_private_key
)

b. Static methods of WalletProvider to get a wallet

import whw

wallet = whw.WalletProvider.get_wallet(
    http_provider=HTTP_PROVIDER,
    name="your_name",
    service="import",
    key=private_key
)

c. Create a new account

import whw

new_wallet = whw.WalletProvider(
    http_provider=HTTP_PROVIDER,
    name="your_name",
    service="create"
)

# or with the static method get_wallet
new_wallet = whw.WalletProvider.get_wallet(
    http_provider=HTTP_PROVIDER,
    name="your_name",
    service="create"
)

Documentation

OptionsSecurity - Creating Options for the Security Class

This class contains the account address and private key. It allows either importing a private key or generating a new one. The parameters are as follows:

  • service: two possible choices, "import" or "create"
    • import allows importing a private key either directly or from a file (in this case, provide the file path)
    • create generates a new private key compliant with the Ethereum blockchain
  • key: private key for import (only for import)
  • key_path: path to the private key file (only for import) Code:
from whw import OptionsSecurity

option = OptionsSecurity(
    service="create"  # or 'import'
    # key="YOUR_PRIVATE_KEY",
    # key_path="/path/to/your/private_key"
)

Security - Account Security Class

This class contains the address, private key, and transaction signing method. To initialize it, you can pass an instance of the OptionsSecurity class or a dictionary. If importing a private key, the dictionary format should be as follows: {'private_key': "YOUR_PRIVATE_KEY"}. The second parameter is the wallet name, which serves as a unique reference for each wallet.

Code:

from whw import OptionsSecurity, Security

option = OptionsSecurity(
    service="import",
    key="YOUR_PRIVATE_KEY"
)
security = Security(options=option, name_="name_wallet")

# or via a dictionary
security = Security(options={"private_key": "YOUR_PRIVATE_KEY"})

Wallet - Main Class of the Module

This class allows you to perform actions on your account such as transfers, adding tokens, viewing the balance, buying tokens, and selling tokens. The Wallet class takes an instance of the Security object and the HTTP PROVIDER as parameters.

Code:

from whw import OptionsSecurity, Security, Wallet

options = OptionsSecurity(
    service="import",
    key="YOUR_PRIVATE_KEY"
)
security = Security(options=options, name_="your_name")

wallet = Wallet(security=security, http_provider="YOUR_HTTP_PROVIDER")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whw-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

whw-0.1.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file whw-0.1.0.tar.gz.

File metadata

  • Download URL: whw-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for whw-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e966c0695194f331ce6c8ae1b137d4136ec25940f150d09161633a41ac9d8700
MD5 a0c836ececff796cca03688d581491a1
BLAKE2b-256 16464f6dd952bca4b084ccf1ee5abf74b8ca3e36b971b2ead375e43d2754f4c1

See more details on using hashes here.

File details

Details for the file whw-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: whw-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for whw-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02249c5720cf5f4c25b9aa611bb0168c2761ab3578ce41d1b326ce6d09c1c635
MD5 6600ef982f969e76c4cd74759ec50e78
BLAKE2b-256 f94ff407d0240a451bf195947a0c1343ac23e623786e297601b3d018a8e7db44

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page