How to pass not hard coded addrresses in predicate?

I hound some tutorial how to deploy and use predicate in ts docs - link

In this tutorial public keys are hardcoded and then predicate was builded, is there any way to build it with external variable and passing those variables when new Predicate instance is created?

The TypeScript SDK can certainly pass in a parameter of a Public Key at call time, but that would result in a security issue as anyone could pass in their desired public key.

We do, however have a roadmap item for Configurable Constants, much like the Rust-SDK, see the issue for Configure Time Constants here.


You can use a “configurable” block in your predicate in the same way you would for a contract. Then you can use the SDK (Rust, not sure about TS) to set the values dynamically.

1 Like

oh, thanks for answer
is there any links with examples in fuel labs github?

Probably the link above to the SDK book is the best example.

1 Like

I appreciate this is not suitable for the desired use case, but I just also want to share this link to the TS documentation, demonstrating how arguments are passed to a predicate, for those that end up at this post for that reason.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.