Types¶
ether.types.AnyAddress
module-attribute
¶
AnyAddress = Union[Address, HexAddress, ChecksumAddress, bytes, str]
ether.types.Network
¶
Bases: BaseModel
The Network class represents an Ethereum-based network configuration.
ATTRIBUTE | DESCRIPTION |
---|---|
name |
The name of the network (e.g., "Ethereum", "Arbitrum").
TYPE:
|
rpc |
The RPC URL for interacting with the network.
TYPE:
|
token |
The network's native token (e.g., "ETH", "BNB").
TYPE:
|
chain_id |
The chain ID for the network. If not provided, it will be added automatically, when passing network to wallet.
TYPE:
|
explorer |
The URL for the blockchain explorer.
TYPE:
|
Example
from ether import Wallet, Network
network = Network(
name='BOB',
rpc='https://bob.drpc.org',
token='ETH',
explorer='https://explorer.gobob.xyz'
)
custom_wallet = Wallet('0xPrivateKey', network)
ether.types.Token
¶
Bases: BaseModel
The Token class represents an ERC-20 token.
ATTRIBUTE | DESCRIPTION |
---|---|
address |
The address of the token contract.
TYPE:
|
symbol |
The token's symbol (e.g., "ETH", "USDT").
TYPE:
|
decimals |
The number of decimal places the token supports.
TYPE:
|
Example
from ether import Wallet
wallet = Wallet('0xPrivateKey', 'Ethereum')
# Token details
token_address = '0xTokenAddressHere'
token = wallet.get_token(token_address)
print(f"Token {token.symbol} is loaded!")