0xPolygonMiden / miden-client

Client library that facilitates interaction with the Miden rollup
MIT License
32 stars 29 forks source link

feat: Make transactions general #237

Closed igamigo closed 6 months ago

igamigo commented 6 months ago

Closes #203 This PR adds TransactionRequest, a struct for defining transactions in a general way. This implies a client API change to Client::new_transaction(transaction_request: TransactionRequest). The TransactionTemplate enum was left in order to facilitate common transactions, and a client function was introduced to build the template into a TransactionRequest: Client::build_transaction_request(transaction_template: TransactionTemplate).

An integration test was also introduced in order to test note args functionality and custom tx code. The test creates a note with custom code that asserts the note args are as expected. After that, it runs a transaction that consumes the note with the expected note args. It also tests the custom tx code by running an assertion (the tx is executed twice, once with the assertion failing and the other one succeeding, also consuming the note).