Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(tx-builder): allow building unsigned transactions #939

Merged

Conversation

sdbondi
Copy link
Member

@sdbondi sdbondi commented Feb 19, 2024

Description

refactor(tx-builder): allow building unsigned transactions

Motivation and Context

We have a few interfaces for submitting transactions, each of these has several fields that are duplicated across types. Some have missing fields simply because a particular transaction feature is unused. This PR adds the UnsignedTransaction type that is built using the TransactionBuilder and given to a wallet for signing.

We could also build a typescript version of the transaction builder to make building well-formed transactions easy.

This PR also adds an optional field to accept the UnsignedTransaction to the wallet daemon. If not specified, the separate fields are used as before to preserve backward compatibility. The idea would be to remove these later in another PR.

How Has This Been Tested?

Updated some cucumber steps to use this

What process can a PR reviewer use to test or verify this change?

   let transaction = Transaction::builder()
        .fee_transaction_pay_from_component(source_component_address, Amount(1))
        .call_method(source_component_address, "withdraw_confidential", args![
            resource_address,
            withdraw_proof
        ])
        .put_last_instruction_output_on_workspace(b"bucket")
        .call_method(destination_account, "deposit", args![Workspace("bucket")])
        .build_unsigned_transaction();

// Send off to the wallet for signing and submission
    let submit_req = TransactionSubmitRequest {
        transaction: Some(transaction),
       signing_key_index: Some(signing_key_index),
     ..Default::default()
   }

Breaking Changes

  • None
  • Requires data directory to be deleted
  • Other - Please specify

Copy link

github-actions bot commented Feb 19, 2024

Test Results (CI)

498 tests  +1   497 ✅ +3   2h 50m 10s ⏱️ + 1m 18s
 60 suites ±0     0 💤 ±0 
  2 files   ±0     1 ❌  - 2 

For more details on these failures, see this check.

Results for commit a7d0329. ± Comparison against base commit f449801.

♻️ This comment has been updated with latest results.

@sdbondi sdbondi force-pushed the transaction-unsigned-transaction branch 4 times, most recently from 71644d8 to 5d6efd0 Compare February 20, 2024 10:02
@sdbondi sdbondi force-pushed the transaction-unsigned-transaction branch from 5d6efd0 to 16da161 Compare February 20, 2024 10:06
stringhandler
stringhandler previously approved these changes Feb 27, 2024
* development:
  feat(walletd/js/client): use abstract transport to allow for WebRTC transport (tari-project#943)
  fix(engine): prevent creation of mismatched resource type bucket (tari-project#940)
  chore: update to latest feature-dan2 (tari-project#937)
  feat!: optional versions in transaction inputs (tari-project#922)
  feat: add tari-generate (tari-project#941)
@sdbondi sdbondi merged commit 5354335 into tari-project:development Mar 12, 2024
10 checks passed
@sdbondi sdbondi deleted the transaction-unsigned-transaction branch March 12, 2024 09:36
sdbondi added a commit to sdbondi/tari-dan that referenced this pull request Mar 12, 2024
* development:
  fix(wallet): preserve parent when recording substate addresses (tari-project#955)
  refactor(engine)!: store NFT data as CBOR value (tari-project#957)
  fix(vn/webui): fix template table (tari-project#962)
  fix(walletd): fix query for NonFungible (tari-project#950)
  refactor(tx-builder): allow building unsigned transactions (tari-project#939)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants