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.1.tar.gz (14.4 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.1-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: whw-0.1.1.tar.gz
  • Upload date:
  • Size: 14.4 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.1.tar.gz
Algorithm Hash digest
SHA256 47ca78e474130b99cf00a33b687c68ede5ea32a683215ba25dbd91526a9a5891
MD5 1e8204c9aaa3b141bd7e114133d48085
BLAKE2b-256 8f8e4abddffca5f8b919c8facc6eb78e65e597dfaa9ea638e2280d92fc32446a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: whw-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 61c467d498c9be2755a402a3e4648ba92cfec935cad3e5ad886a6ad1feaecf92
MD5 43fcc4448beead6a9b8f372ccd968560
BLAKE2b-256 3f75403f2ab4ab01233568e63d52e1c2ad9f7426036de4f55eb4101c33440204

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