-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feature: Implemented new EVM chains. * Fix: Added chain argument on initialization. * Fix: Remove venv folder to keep on track. * Fix: Added chain auto-loading if it's not defined. * Fix: Added chain auto-loading by default configuration if the user don't request it explicitly. * Fix: Solve issue with str chain value * Fix: Solve typing issue passing the chain argument. * Fix: Disable temporarily the chain field change to test it deeply. * Fix: Update to already released aleph_message dependency. * Fix: Removed build action for macos-12 as it's deprecated on GitHub actions. --------- Co-authored-by: Andres D. Molins <[email protected]>
- Loading branch information
Showing
8 changed files
with
153 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ MANIFEST | |
|
||
# Per-project virtualenvs | ||
.venv*/ | ||
venv/* | ||
**/device.key | ||
|
||
# environment variables | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from decimal import Decimal | ||
from pathlib import Path | ||
from typing import Awaitable, Optional | ||
|
||
from aleph_message.models import Chain | ||
from eth_account import Account # type: ignore | ||
|
||
from .common import get_fallback_private_key | ||
from .ethereum import ETHAccount | ||
|
||
|
||
class EVMAccount(ETHAccount): | ||
def __init__(self, private_key: bytes, chain: Optional[Chain] = None): | ||
super().__init__(private_key, chain) | ||
# Decide if we have to send also the specified chain value or always use ETH | ||
# if chain: | ||
# self.CHAIN = chain | ||
|
||
@staticmethod | ||
def from_mnemonic(mnemonic: str, chain: Optional[Chain] = None) -> "EVMAccount": | ||
Account.enable_unaudited_hdwallet_features() | ||
return EVMAccount( | ||
private_key=Account.from_mnemonic(mnemonic=mnemonic).key, chain=chain | ||
) | ||
|
||
def get_token_balance(self) -> Decimal: | ||
raise ValueError(f"Token not implemented for this chain {self.CHAIN}") | ||
|
||
def get_super_token_balance(self) -> Decimal: | ||
raise ValueError(f"Super token not implemented for this chain {self.CHAIN}") | ||
|
||
def create_flow(self, receiver: str, flow: Decimal) -> Awaitable[str]: | ||
raise ValueError(f"Flow creation not implemented for this chain {self.CHAIN}") | ||
|
||
def get_flow(self, receiver: str): | ||
raise ValueError(f"Get flow not implemented for this chain {self.CHAIN}") | ||
|
||
def update_flow(self, receiver: str, flow: Decimal) -> Awaitable[str]: | ||
raise ValueError(f"Flow update not implemented for this chain {self.CHAIN}") | ||
|
||
def delete_flow(self, receiver: str) -> Awaitable[str]: | ||
raise ValueError(f"Flow deletion not implemented for this chain {self.CHAIN}") | ||
|
||
|
||
def get_fallback_account( | ||
path: Optional[Path] = None, chain: Optional[Chain] = None | ||
) -> ETHAccount: | ||
return ETHAccount(private_key=get_fallback_private_key(path=path), chain=chain) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters