Skip to content

Commit

Permalink
add back in terra wallet generation but make imports conditional
Browse files Browse the repository at this point in the history
terra will still fail if you try and deploy it since the modules its
importing are not defined in the requirements file
  • Loading branch information
mattac21 committed Aug 7, 2024
1 parent cadeca4 commit d0d7ab1
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions scripts/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,16 +357,27 @@ def create_tx(

def create_wallet(client) -> LocalWallet:
""" Create a wallet from a mnemonic and return it"""
seed_bytes = Bip39SeedGenerator(MNEMONIC).Generate()
bip44_def_ctx = Bip44.FromSeed(seed_bytes, Bip44Coins.COSMOS).DeriveDefaultPath()
wallet = LocalWallet(
PrivateKey(bip44_def_ctx.PrivateKey().Raw().ToBytes()),
prefix=ADDRESS_PREFIX
)
balance = client.query_bank_balance(str(wallet.address()), DENOM)
print("Wallet Address: ", wallet.address(), " with account balance: ", balance)
if CHAIN == "terra":
from terra_sdk.client.lcd import LCDClient
from terra_sdk.key.mnemonic import MnemonicKey
mk = MnemonicKey(mnemonic=MNEMONIC)
terra = LCDClient(REST_URL, CHAIN_ID)
terra_wallet = terra.wallet(mk)
wallet = LocalWallet(PrivateKey(terra_wallet.key.private_key), prefix="terra")
balance = client.query_bank_balance(str(wallet.address()), DENOM)
print("Wallet Address: ", wallet.address(), " with account balance: ", balance)
else:
seed_bytes = Bip39SeedGenerator(MNEMONIC).Generate()
bip44_def_ctx = Bip44.FromSeed(seed_bytes, Bip44Coins.COSMOS).DeriveDefaultPath()
wallet = LocalWallet(
PrivateKey(bip44_def_ctx.PrivateKey().Raw().ToBytes()),
prefix=ADDRESS_PREFIX
)
balance = client.query_bank_balance(str(wallet.address()), DENOM)
print("Wallet Address: ", wallet.address(), " with account balance: ", balance)
return wallet


def init_deployed_contracts_info():
DEPLOYED_CONTRACTS_INFO["info"] = {}
DEPLOYED_CONTRACTS_INFO["info"]["chain_id"] = CHAIN_ID
Expand Down

0 comments on commit d0d7ab1

Please sign in to comment.