You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
);
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
The text was updated successfully, but these errors were encountered: