Module: wallet_factory
Class for interacting with Infernet's WalletFactory
contract on-chain.
The WalletFactory
contract is responsible for creating new payment wallets for users.
Public Methods
create_wallet(owner: ChecksumAddress) -> InfernetWallet
: Create a new payment wallet for the given owner.is_valid_wallet(wallet: ChecksumAddress) -> bool
: Check if a given wallet is a valid payment wallet.
Example Usage
```python
from infernet_client.chain.wallet_factory import WalletFactory
from infernet_client.chain.rpc import RPC
rpc = RPC("http://localhost:8545")
wallet_factory = WalletFactory("0x123...", rpc)
wallet = await wallet_factory.create_wallet("0x456...")
is_valid = await wallet_factory.is_valid_wallet(wallet.address)
```
WalletFactory
Source code in src/infernet_client/chain/wallet_factory.py
__init__(address, rpc)
Class for interacting with Infernet's WalletFactory
contract on-chain.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
address |
ChecksumAddress
|
Address of the |
required |
rpc |
RPC
|
RPC object for interacting with the chain. |
required |
Returns:
Name | Type | Description |
---|---|---|
WalletFactory |
None
|
Instance of the |
Source code in src/infernet_client/chain/wallet_factory.py
create_wallet(owner)
async
Create a new payment wallet for the given owner.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
owner |
ChecksumAddress
|
Address of the wallet owner. |
required |
Returns:
Name | Type | Description |
---|---|---|
InfernetWallet |
InfernetWallet
|
Instance of the |
Source code in src/infernet_client/chain/wallet_factory.py
is_valid_wallet(wallet)
async
Check if a given wallet is a valid payment wallet. Reads from the isValidWallet
function of the WalletFactory
contract.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wallet |
ChecksumAddress
|
Address of the wallet. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the wallet is a valid payment wallet, False otherwise. |