-
Notifications
You must be signed in to change notification settings - Fork 5
Implement new EVM chains #182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
cde1e2f
Feature: Implemented new EVM chains.
nesitor 745df74
Fix: Added chain argument on initialization.
51df98a
Fix: Remove venv folder to keep on track.
d675694
Fix: Added chain auto-loading if it's not defined.
d97a1e1
Fix: Added chain auto-loading by default configuration if the user do…
12db402
Fix: Solve issue with str chain value
189e3b5
Fix: Solve typing issue passing the chain argument.
5d67f0a
Fix: Disable temporarily the chain field change to test it deeply.
39c5798
Fix: Update to already released aleph_message dependency.
nesitor c8663c7
Fix: Removed build action for macos-12 as it's deprecated on GitHub a…
nesitor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.