terra
>>> from terra_sdk.key.mnemonic import MnemonicKey
>>> mk = MnemonicKey()
>>> wallet = terra.wallet(mk)
>>> wallet.account_number()
27
terra
>>> from terra_sdk.key.mnemonic import MnemonicKey
>>> mk = MnemonicKey()
>>> wallet = terra.wallet(mk)
>>> wallet.account_number()
27
terra
curl https://network.terra.dev/addrbook.json > ~/.terrad/config/addrbook.json
terra
"""Data objects pertaining to accounts."""
from __future__ import annotations
from typing import List
import attr
from terra_sdk.core import AccAddress, Coins
from terra_sdk.util.json import JSONSerializable
from .public_key import PublicKey
__all__ = ["Account", "LazyGradedVestingAccount"]
[docs]@attr.s
class Account(JSONSerializable):
"""Stores information about an account."""
address: AccAddress = attr.ib()
""""""
coins: Coins = attr.ib(converter=Coins)
""""""
public_key: PublicKey = attr.ib()
""""""
account_number: int = attr.ib(converter=int)
""""""
sequence: int = attr.ib(converter=int)
""""""
[docs] def to_data(self) -> dict:
return {
"type": "core/Account",
"value": {
"address": self.address,
"coins": self.coins.to_data(),
"public_key": self.public_key.to_data(),
"account_number": str(self.account_number),
"sequence": str(self.sequence),
},
}
@classmethod
def from_data(cls, data: dict) -> Account:
data = data["value"]
return cls(
address=data["address"],
coins=Coins.from_data(data["coins"]),
public_key=PublicKey.from_data(data["public_key"]),
account_number=data["account_number"],
sequence=data["sequence"],
)
[docs]@attr.s
class LazyGradedVestingAccount(Account):
"""Stores information about an account with vesting."""
address: AccAddress = attr.ib()
""""""
coins: Coins = attr.ib(converter=Coins)
""""""
public_key: PublicKey = attr.ib()
""""""
account_number: int = attr.ib(converter=int)
""""""
sequence: int = attr.ib(converter=int)
""""""
original_vesting: Coins = attr.ib(converter=Coins)
""""""
delegated_free: Coins = attr.ib(converter=Coins)
""""""
delegated_vesting: Coins = attr.ib(converter=Coins)
""""""
end_time: int = attr.ib(converter=int)
""""""
vesting_schedules: List[dict] = attr.ib()
""""""
[docs] def to_data(self) -> dict:
return {
"type": "core/LazyGradedVestingAccount",
"value": {
"address": self.address,
"coins": self.coins.to_data(),
"public_key": self.public_key and self.public_key.to_data(),
"account_number": str(self.account_number),
"sequence": str(self.sequence),
"original_vesting": self.original_vesting.to_data(),
"delegated_free": self.delegated_free.to_data(),
"delegated_vesting": self.delegated_vesting.to_data(),
"end_time": str(self.end_time),
"vesting_schedules": self.vesting_schedules,
},
}
@classmethod
def from_data(cls, data: dict) -> LazyGradedVestingAccount:
data = data["value"]
return cls(
address=data["address"],
coins=Coins.from_data(data["coins"]),
public_key=PublicKey.from_data(data["public_key"]),
account_number=data["account_number"],
sequence=data["sequence"],
original_vesting=Coins.from_data(data["original_vesting"]),
delegated_free=Coins.from_data(data["delegated_free"]),
delegated_vesting=Coins.from_data(data["delegated_vesting"]),
end_time=data["end_time"],
vesting_schedules=data["vesting_schedules"],
)
terra
>>> terra.market.parameters()
{'base_pool': '7000000000000.000000000000000000', 'pool_recovery_period': '200', 'min_spread': '0.005000000000000000'}
terra
$ terracli keys migrate [--home] [--keyring-backend]
terra
Known seed node list:
5d9b8ac70000bd4ab1de3ccaf85eb43f8e315146@seed.terra.delightlabs.io:26656
[email protected]:26656
[email protected]:26656
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us