How do I run a function in Pact REPL without a keyset I defined

53 Views Asked by At

I defined a keyset (i.e. "my-admin-keyset") in the pact environment data. I want to test a function without that keyset present.

However every function I run, signs with that keyset.

How do I exclude a keyset when running a function?

1

There are 1 best solutions below

0
Kitty Kad On BEST ANSWER

This can be done by defining things in transaction blocks in the REPL.

When you need the admin-keyset functionality, you can define the keys for that block you're testing.

(begin-tx)
(env-keys ["my-admin-keyset"])
; Your code ...
(commit-tx)

If you want to test without that keyset and with another keyset, just set the environment keys to something else, like this

(begin-tx)
(env-keys ["some-other-keyset"])
; Your code ...
(commit-tx)