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

Allow users to pay for transaction fees using predicates #788

Closed
luizstacio opened this issue Feb 16, 2023 · 2 comments · Fixed by #789
Closed

Allow users to pay for transaction fees using predicates #788

luizstacio opened this issue Feb 16, 2023 · 2 comments · Fixed by #789
Assignees
Labels
feat Issue is a feature

Comments

@luizstacio
Copy link
Member

Users have to use their Wallet to pay for a transaction. However, there are many use cases where a user wants to pass a Predicate, instead of a Wallet, to pay for a transaction. The actual UTXOs used to pay for the transaction must be unlocked in the predicate passed.

For example:

const contract = ExampleContractAbi__factory.connect(wallet);

let response = await contract
    .functions
    .initialize_counter(42) // Build the ABI call
    .call() // Perform the network call

Here, we link a Wallet to the contract instance. Underneath, it will grab this wallet's funds to pay for the transaction.

With this new feature, one could pass in a Predicate instead of a Wallet, and, underneath, the predicate would be evaluated, and, if true, the UTXOs unlocked would be used to pay for the tx fees.

This is based by a feedback we got from an external developer, here's what was said about this feature request:

When I want to spend utxos from a predicate, there should be a wallet that offers the same kind of features as a wallet for a simple public key address. Currently, you need to initialize the wallet with a key, and that will also be the address that pays for the fees. If I have a predicate, I generally want to pay for the fees with the coins available in the utxos on the predicate address. A public-key based address should not be required to manage a predicate wallet.

Base issue: FuelLabs/fuels-rs#809

@arboleya
Copy link
Member

@luizstacio How is this issue different from this other one?

cc @camsjams

@luizstacio
Copy link
Member Author

luizstacio commented Feb 20, 2023

Issue #757 would include tests using a predicate to execute script call. Once this issue is done and scripts are done, it would be possible to implement tests for calling a Script using Predicate as a Wallet, closing the issue #757.

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

Successfully merging a pull request may close this issue.

2 participants