[go: up one dir, main page]

SDK/bindings: wrap operations in an Operation object

What

This MR combines the bindings for sdk-bindings operations into a single object.

Closes SDK-99

Why

In order to sign multiple operations at once, a operation list must be created. Such a list can only exist in the four languages if the operations are of the same type.

How

By creating an Operation instance type that replaces all operation instance types (Reveal, Transaction, Origination, Delegation). All new functions become functions with the names of the operations (reveal, transaction, origination, delegation).

Manually testing the MR

Launch the nix environment:

cd contrib/sdk-bindings
nix-shell

Run tests:

make test

Or testing manually:

cd rust/
maturin develop
python3

And test in the python REPL, for example:

from tezos import *

source = PublicKeyHash.from_b58check("tz3S6P2LccJNrejt27KvJRb3BcuS5vGghkP8")
destination = Contract.from_b58check("KT1G4D3W9cf86dzAmZBN9nwUn7sYh4DYMRb4")
entrypoint = Entrypoint("foo")
transaction = Operation.transaction(
    source=source,
    fee=2,
    counter=603,
    gas_limit=59,
    storage_limit=109,
    amount=90,
    destination=destination,
    entrypoint=entrypoint,
)
transaction.forge().hex()
# Prints '6c023f3b21e54e98db3845a2a5033d96877f7f9cea8702db043b6d5a0151f9612eb937431bcb785af89f3aae78d4e03f8200ffff03666f6f00000002030b'

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR

Merge request reports

Loading