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

write a how to on black box testing uplc #128

Open
aleeusgr opened this issue Jul 18, 2023 · 0 comments
Open

write a how to on black box testing uplc #128

aleeusgr opened this issue Jul 18, 2023 · 0 comments

Comments

@aleeusgr
Copy link
Owner

I would like to know if I can test a smart contract written in Plutus with the Helios library.

If you want to run automated tests on a validator using Helios Emulator, try my toolbox:

Hmm, I think I will need to look for something else. Unless I can find a way to port CBOR encoded Plutus script into Helios

cschmitz

14/07/2023 12:01
That should be possible
The tx builder only really cares about UplcProgram, which can be deserialized from cbor
And the emulator only cares about the output of the tx builder
No need to port anything to Helios

Implementation

omething like

const uplcProgram = UplcProgram.fromCbor("");

// if it is a minting policy
const mph = uplcProgram.mintingPolicyHash;
tx.mintTokens(mph, [[, ], ...], );
tx.attachScript(uplcProgram);

// if you want to send to a spending validator
const vh = uplcProgram.validatorHash;
const scriptAddress = Address.fromValidatorHash(vh);

tx.addOutput(new TxOutput(
scriptAddress,
new Value(1000000)
);

// if you want to spend from a validator
tx.addInput(await network.getUtxos(scriptAddress)[0], );
tx.attachScript(uplcProgram);
https://discord.com/channels/997177025972424815/997177026517676055/1129286387150106688

@aleeusgr aleeusgr changed the title integrate plutus-apps write a how to on black box testing compiled validators Nov 5, 2023
@aleeusgr aleeusgr changed the title write a how to on black box testing compiled validators write a how to on black box testing uplc Nov 7, 2023
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