def make_update(key: MichelsonType, val: Optional[MichelsonType]) -> dict: update = { 'key': key.to_micheline_value(mode=mode), 'key_hash': forge_script_expr(key.pack(legacy=True)) } if val is not None: update['value'] = val.to_micheline_value(mode=mode) return update
def transaction(cls, source: str, destination: str, amount: int, entrypoint: str, parameter: MichelsonType) \ -> 'OperationType': content = { 'kind': 'transaction', 'source': source, 'destination': destination, 'amount': str(amount), 'parameters': { 'entrypoint': entrypoint, 'value': parameter.to_micheline_value() } } return cls(content, ty=type(parameter))
def origination(cls, source: str, script: Type[MichelineSequence], storage: MichelsonType, balance: int = 0, delegate: Optional[str] = None) -> 'OperationType': content = { 'kind': 'origination', 'source': source, 'script': { 'code': script.as_micheline_expr(), 'storage': storage.to_micheline_value() }, 'balance': str(balance) } if delegate is not None: content['delegate'] = delegate return cls(content, ty=type(storage))