@@ -57,7 +57,11 @@ func (s ScriptContextV3) ToPlutusData() data.PlutusData {
57
57
)
58
58
}
59
59
60
- func NewScriptContextV3 (txInfo TxInfo , redeemer Redeemer , purpose ScriptInfo ) ScriptContext {
60
+ func NewScriptContextV3 (
61
+ txInfo TxInfo ,
62
+ redeemer Redeemer ,
63
+ purpose ScriptInfo ,
64
+ ) ScriptContext {
61
65
return ScriptContextV3 {
62
66
TxInfo : txInfo ,
63
67
Redeemer : redeemer ,
@@ -162,7 +166,10 @@ func (t TxInfoV3) ToPlutusData() data.PlutusData {
162
166
)
163
167
}
164
168
165
- func NewTxInfoV3FromTransaction (tx lcommon.Transaction , resolvedInputs []lcommon.Utxo ) TxInfoV3 {
169
+ func NewTxInfoV3FromTransaction (
170
+ tx lcommon.Transaction ,
171
+ resolvedInputs []lcommon.Utxo ,
172
+ ) TxInfoV3 {
166
173
assetMint := tx .AssetMint ()
167
174
if assetMint == nil {
168
175
assetMint = & lcommon.MultiAsset [lcommon.MultiAssetTypeMint ]{}
@@ -180,11 +187,14 @@ func NewTxInfoV3FromTransaction(tx lcommon.Transaction, resolvedInputs []lcommon
180
187
),
181
188
)
182
189
ret := TxInfoV3 {
183
- Inputs : expandInputs (inputs , resolvedInputs ),
184
- ReferenceInputs : expandInputs (sortInputs (tx .ReferenceInputs ()), resolvedInputs ),
185
- Outputs : collapseOutputs (tx .Produced ()),
186
- Fee : tx .Fee (),
187
- Mint : * assetMint ,
190
+ Inputs : expandInputs (inputs , resolvedInputs ),
191
+ ReferenceInputs : expandInputs (
192
+ sortInputs (tx .ReferenceInputs ()),
193
+ resolvedInputs ,
194
+ ),
195
+ Outputs : collapseOutputs (tx .Produced ()),
196
+ Fee : tx .Fee (),
197
+ Mint : * assetMint ,
188
198
ValidRange : TimeRange {
189
199
tx .TTL (),
190
200
tx .ValidityIntervalStart (),
@@ -350,7 +360,10 @@ func sortInputs(inputs []lcommon.TransactionInput) []lcommon.TransactionInput {
350
360
return ret
351
361
}
352
362
353
- func expandInputs (inputs []lcommon.TransactionInput , resolvedInputs []lcommon.Utxo ) []ResolvedInput {
363
+ func expandInputs (
364
+ inputs []lcommon.TransactionInput ,
365
+ resolvedInputs []lcommon.Utxo ,
366
+ ) []ResolvedInput {
354
367
ret := make ([]ResolvedInput , len (inputs ))
355
368
for i , input := range inputs {
356
369
for _ , resolvedInput := range resolvedInputs {
@@ -371,8 +384,17 @@ func collapseOutputs(outputs []lcommon.Utxo) []lcommon.TransactionOutput {
371
384
return ret
372
385
}
373
386
374
- func sortedRedeemerKeys (redeemers lcommon.TransactionWitnessRedeemers ) []lcommon.RedeemerKey {
375
- tags := []lcommon.RedeemerTag {lcommon .RedeemerTagSpend , lcommon .RedeemerTagMint , lcommon .RedeemerTagCert , lcommon .RedeemerTagReward , lcommon .RedeemerTagVoting , lcommon .RedeemerTagProposing }
387
+ func sortedRedeemerKeys (
388
+ redeemers lcommon.TransactionWitnessRedeemers ,
389
+ ) []lcommon.RedeemerKey {
390
+ tags := []lcommon.RedeemerTag {
391
+ lcommon .RedeemerTagSpend ,
392
+ lcommon .RedeemerTagMint ,
393
+ lcommon .RedeemerTagCert ,
394
+ lcommon .RedeemerTagReward ,
395
+ lcommon .RedeemerTagVoting ,
396
+ lcommon .RedeemerTagProposing ,
397
+ }
376
398
ret := make ([]lcommon.RedeemerKey , 0 )
377
399
for _ , tag := range tags {
378
400
idxs := redeemers .Indexes (tag )
@@ -391,7 +413,10 @@ func sortedRedeemerKeys(redeemers lcommon.TransactionWitnessRedeemers) []lcommon
391
413
return ret
392
414
}
393
415
394
- func redeemersInfo (witnessSet lcommon.TransactionWitnessSet , toScriptPurpose toScriptPurposeFunc ) KeyValuePairs [ScriptInfo , Redeemer ] {
416
+ func redeemersInfo (
417
+ witnessSet lcommon.TransactionWitnessSet ,
418
+ toScriptPurpose toScriptPurposeFunc ,
419
+ ) KeyValuePairs [ScriptInfo , Redeemer ] {
395
420
var ret KeyValuePairs [ScriptInfo , Redeemer ]
396
421
redeemers := witnessSet .Redeemers ()
397
422
redeemerKeys := sortedRedeemerKeys (redeemers )
0 commit comments