References¶
Models¶
models.py contains every relations regarding nekoyume blockchain and game moves.
-
class
nekoyume.models.
Block
(**kwargs)¶ This object contains block information.
-
broadcast
(sent_node: bool = None, my_node: bool = None, session=<sqlalchemy.orm.scoping.scoped_session object>, click=None) → bool¶ - It broadcast this block to every nodes you know.
매개 변수: - sent_node -- sent
nekoyume.models.Node
. this node ignore sent node. - my_node -- my
nekoyume.models.Node
. received node ignore my node when they broadcast received object.
- sent_node -- sent
-
created_at
¶ block creation datetime
-
creator
¶ block creator's address
-
difficulty
¶ difficulty of hashcash
-
hash
¶ current block's hash
-
id
¶ block id
-
prev_hash
¶ previous block's hash
-
root_hash
¶ hash of every linked move's ordered hash list
-
serialize
(use_bencode: bool = True, include_suffix: bool = False, include_moves: bool = False, include_hash: bool = False)¶ This function serialize block.
매개 변수: - use_bencode -- check if you want to encode using bencode.
- include_suffix -- check if you want to include suffix.
- include_moves -- check if you want to include linked moves.
- include_hash -- check if you want to include block hash.
-
suffix
¶ suffix for hashcash
-
classmethod
sync
(node: nekoyume.models.Node = None, session=<sqlalchemy.orm.scoping.scoped_session object>, click=None) → bool¶ Sync blockchain with other node.
매개 변수: node -- sync target nekoyume.models.Node
.
-
valid
¶ Check if this object is valid or not
-
-
class
nekoyume.models.
Buy
(**kwargs)¶
-
class
nekoyume.models.
Combine
(**kwargs)¶
-
class
nekoyume.models.
CreateNovice
(**kwargs)¶
-
class
nekoyume.models.
HackAndSlash
(**kwargs)¶
-
class
nekoyume.models.
LevelUp
(**kwargs)¶
-
class
nekoyume.models.
Move
(**kwargs)¶ This object contain general move information.
-
block
¶ move's block
-
block_id
¶ move's block id. if the move isn't confirmed yet, this will be null
-
broadcast
(sent_node=None, my_node=None, session=<sqlalchemy.orm.scoping.scoped_session object>)¶ - It broadcast this move to every nodes you know.
매개 변수: - sent_node -- sent
nekoyume.models.Node
. this node ignore sent node. - my_node -- my
nekoyume.models.Node
. received node ignore my node when they broadcast received object.
- sent_node -- sent
-
confirmed
¶ Check if this object is confirmed or not
-
created_at
¶ move creation datetime.
-
details
¶ move details. it contains parameters of move
-
get_randoms
() → list¶ get random numbers by Hash random
-
hash
¶ Get move hash
-
id
¶ move's hash
-
name
¶ move name
-
roll
(randoms: list, dice: str, combine=True)¶ Roll dices based on given randoms
>>> from nekoyume.models import Move >>> move = Move() >>> move.roll([1, 7, 3], '2d6') 6
Params randoms: random numbers from nekoyume.models.Move.get_randoms()
Params dice: dice to roll (e.g. 2d6) Params combine: return combined result or not if rolling it multiple.
-
serialize
(use_bencode=True, include_signature=False, include_id=False, include_block=False)¶ This function serialize block.
매개 변수: - use_bencode -- check if you want to encode using bencode.
- include_signature -- check if you want to include signature.
- include_id -- check if you want to include linked moves.
- include_block -- check if you want to include block.
-
signature
¶ move's signature
-
tax
¶ move tax (not implemented yet)
-
user
¶ move's owner
-
valid
¶ Check if this object is valid or not
-
-
class
nekoyume.models.
MoveDetail
(**kwargs)¶ This object contains move's key/value information.
-
key
¶ MoveDetail's key
-
move_id
¶ move id
-
value
¶ MoveDetail's value
-
-
class
nekoyume.models.
Node
(**kwargs)¶ This object contains node information you know.
-
classmethod
broadcast
(endpoint: str, serialized_obj: dict, sent_node=None, my_node=None, session=<sqlalchemy.orm.scoping.scoped_session object>) → bool¶ It broadcast serialized_obj to every nodes you know.
매개 변수: - endpoint -- endpoint of node to broadcast
- serialized_obj -- object that will be broadcasted.
- sent_node -- sent
nekoyume.models.Node
. this node ignore sent node. - my_node -- my
nekoyume.models.Node
. received node ignore my node when they broadcast received object.
-
last_connected_at
¶ last connected datetime of the node
-
classmethod
update
(node=None)¶ Update recent node list by scrapping other nodes' information.
-
url
¶ URL of node
-
classmethod
-
class
nekoyume.models.
Say
(**kwargs)¶
-
class
nekoyume.models.
Sell
(**kwargs)¶
-
class
nekoyume.models.
Send
(**kwargs)¶
-
class
nekoyume.models.
Sleep
(**kwargs)¶
-
class
nekoyume.models.
User
(private_key, session=<sqlalchemy.orm.scoping.scoped_session object>)¶ It contains user's keys and avatar information.
-
address
¶ It returns address of the user.
-
avatar
(block_id=None)¶ get avatar of the user.
Params block_id: Avatar's block timing. If None, it sets last block.
-
create_block
(moves, commit=True, click=None)¶ Create a block.
-
move
(new_move, tax=0, commit=True)¶ make a move of the user.
Params new_move: Move object to make Params tax: Tax to apply Params commit: commit in this function automatically or not
-
moves
¶ return the user's moves.
-
sign
(move: nekoyume.models.Move)¶ put signature into the given move using the user's private key.
-
-
nekoyume.models.
get_address
(public_key: str) → str¶ Get address based on the public key