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

make transactionBuilder.inputs public to generate SourceOutputs #198

Closed
mr-zwets opened this issue Jul 15, 2024 · 2 comments
Closed

make transactionBuilder.inputs public to generate SourceOutputs #198

mr-zwets opened this issue Jul 15, 2024 · 2 comments

Comments

@mr-zwets
Copy link
Member

mr-zwets commented Jul 15, 2024

For walletConnect signing with SIGHASH_UTXOS, users need access to the transactions' sourceOutputs.

It is easy to generate sourceOutputs with the transactionBuilder.inputs

but transactionBuilder.inputs is currently a private property.

    // Generate source outputs from inputs (for signing with SIGHASH_UTXOS)
    const sourceOutputs = this.inputs.map((input) => {
      const sourceOutput = {
        amount: input.satoshis,
        to: input.unlocker.generateLockingBytecode(),
        token: input.token,
      };

      return cashScriptOutputToLibauthOutput(sourceOutput);
    });

releated to issue #191 "Create a way for the advanced transaction builder to communicate with WalletConnect for signing"

@mr-zwets
Copy link
Member Author

somewhat related, the ninjas.cash mint used the following code when constructing the listSourceOutputs for walletconnect

contract: {
        abiFunction: transaction.abiFunction,
        redeemScript: contract.redeemScript,
        artifact: contract.artifact,
      }

https://github.com/cashninjas/ninjas.cash/blob/ee64614776d95389dcb1389e9760be574aea8c0a/js/mint.js#L260

however as Salemkode pointed out transaction.abiFunction is private in TS

@mr-zwets
Copy link
Member Author

transactionBuilder.inputs and transaction.abiFunction are now public in v0.10.0 😄

so this issue can be closed now 👍
pinging @salemkode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant