Remove either error id pattern in Samples

This commit is contained in:
Seungheon Oh 2022-06-17 14:29:00 -05:00
parent 0bc5706770
commit e386cc5e75
No known key found for this signature in database
GPG key ID: 9B0E12D357369B66
6 changed files with 31 additions and 30 deletions

View file

@ -34,8 +34,8 @@ import Plutarch.Api.V1 (mkValidator, validatorHash)
import Plutarch.Context (
MintingBuilder,
SpendingBuilder,
buildMinting,
buildSpending,
buildMintingUnsafe,
buildSpendingUnsafe,
fee,
input,
mint,
@ -139,7 +139,7 @@ mintGST =
. withValue (gst <> minAda)
. withDatum governorOutputDatum
]
in either error id $ buildMinting builder
in buildMintingUnsafe builder
{- | A valid script context to create a proposal.
@ -259,7 +259,7 @@ createProposal =
. withValue gst
. withDatum governorInputDatum
]
in either error id $ buildSpending builder
in buildSpendingUnsafe builder
{- This script context should be a valid transaction for minting authority for the effect scrips.
@ -378,7 +378,7 @@ mintGATs =
. withValue gst
. withDatum governorInputDatum
]
in either error id $ buildSpending builder
in buildSpendingUnsafe builder
{- | A valid script context for changing the state datum of the governor.
@ -458,4 +458,4 @@ mutateState =
. withValue gst
. withDatum governorInputDatum
]
in either error id $ buildSpending builder
in buildSpendingUnsafe builder

View file

@ -46,8 +46,8 @@ import Data.Tagged (Tagged (..), untag)
import Plutarch.Context (
BaseBuilder,
MintingBuilder,
buildMinting,
buildTxInfo,
buildMintingUnsafe,
buildTxInfoUnsafe,
input,
mint,
output,
@ -162,7 +162,7 @@ proposalCreation =
)
. withDatum govAfter
]
in either error id $ buildMinting builder
in buildMintingUnsafe builder
proposalRef :: TxOutRef
proposalRef = TxOutRef "0b2086cbf8b6900f8cb65e012de4516cb66b5cb08a9aaba12a8b88be" 1
@ -236,7 +236,7 @@ cosignProposal newSigners =
)
. withDatum stakeDatum
]
in either error id $ buildTxInfo builder
in buildTxInfoUnsafe builder
--------------------------------------------------------------------------------
@ -377,7 +377,7 @@ voteOnProposal params =
)
. withDatum stakeOutputDatum
]
in either error id $ buildTxInfo builder
in buildTxInfoUnsafe builder
--------------------------------------------------------------------------------
@ -442,7 +442,7 @@ mkTransitionTxInfo from to effects votes startingTime validTime =
. withValue (pst <> minAda)
. withDatum proposalOutputDatum
]
in either error id $ buildTxInfo builder
in buildTxInfoUnsafe builder
{- | Create a valid 'TxInfo' that advances a proposal, given the parameters.
Note that 'TransitionParameters.initialProposalStatus' should not be 'Finished'.

View file

@ -31,8 +31,8 @@ import Plutarch.Api.V1 (mkValidator, validatorHash)
import Plutarch.Context (
MintingBuilder,
SpendingBuilder,
buildMinting,
buildSpending,
buildMintingUnsafe,
buildSpendingUnsafe,
input,
mint,
output,
@ -87,7 +87,7 @@ stakeCreation =
. withValue (st <> Value.singleton "da8c30857834c6ae7203935b89278c532b3995245295456f993e1d24" "LQ" 424242424242)
. withDatum datum
]
in either error id $ buildMinting builder
in buildMintingUnsafe builder
-- | This ScriptContext should fail because the datum has too much GT.
stakeCreationWrongDatum :: ScriptContext
@ -150,4 +150,4 @@ stakeDepositWithdraw config =
. withValue (st <> Value.assetClassValue (untag stake.gtClassRef) (untag stakeBefore.stakedAmount))
. withDatum stakeAfter
]
in either error id $ buildSpending builder
in buildSpendingUnsafe builder

View file

@ -20,7 +20,7 @@ module Sample.Treasury (
import Plutarch.Context (
MintingBuilder,
UTXO,
buildMinting,
buildMintingUnsafe,
credential,
input,
mint,
@ -83,7 +83,7 @@ validCtx =
. withValue (Value.singleton gatCs gatTn 1 <> minAda)
. withTxId "52b67b60260da3937510ad545c7f46f8d9915bd27e1082e76947fb309f913bd3"
]
in either error id $ buildMinting builder
in buildMintingUnsafe builder
treasuryRef :: TxOutRef
treasuryRef =
@ -124,4 +124,4 @@ trCtxGATNameNotAddress =
. withValue (Value.singleton gatCs gatTn 1 <> minAda)
. withTxId "52b67b60260da3937510ad545c7f46f8d9915bd27e1082e76947fb309f913bd3"
]
in either error id $ buildMinting builder
in buildMintingUnsafe builder