@@ -417,7 +417,7 @@ const defaultActionByVariableType: {
417
417
data . addressData !== undefined &&
418
418
( data . addressData [ variableId ] as Uint8Array | undefined ) !== undefined
419
419
? data . addressData [ variableId ]
420
- : `Identifier "${ identifier } " refers to a AddressData, but no AddressData for "${ variableId } " were provided in the compilation data.` ,
420
+ : `Identifier "${ identifier } " refers to an AddressData, but no AddressData for "${ variableId } " were provided in the compilation data.` ,
421
421
CurrentBlockHeight : ( _ , data ) =>
422
422
bigIntToScriptNumber ( BigInt ( data . currentBlockHeight as number ) ) ,
423
423
CurrentBlockTime : ( _ , data ) => dateToLockTime ( data . currentBlockTime as Date ) ,
@@ -432,6 +432,11 @@ const defaultActionByVariableType: {
432
432
: `Identifier "${ identifier } " refers to a WalletData, but no WalletData for "${ variableId } " were provided in the compilation data.`
433
433
} ;
434
434
435
+ const aOrAnQuotedString = ( word : string ) =>
436
+ `${
437
+ [ 'a' , 'e' , 'i' , 'o' , 'u' ] . indexOf ( word [ 0 ] . toLowerCase ( ) ) === - 1 ? 'a' : 'an'
438
+ } "${ word } "`;
439
+
435
440
/**
436
441
* If the identifer can be successfully resolved as a variable, the result is
437
442
* returned as a Uint8Array. If the identifier references a known variable, but
@@ -462,9 +467,9 @@ export const resolveAuthenticationTemplateVariable = <CompilerOperationData>(
462
467
return data [ variableTypeToDataProperty [ selected . type ] ] === undefined
463
468
? `Identifier "${ identifier } " is a ${
464
469
selected . type
465
- } , but the compilation data does not include a " ${
470
+ } , but the compilation data does not include ${ aOrAnQuotedString (
466
471
variableTypeToDataProperty [ selected . type ]
467
- } " property.`
472
+ ) } property.`
468
473
: isOperation
469
474
? attemptCompilerOperation (
470
475
identifier ,
@@ -538,7 +543,7 @@ export const resolveScriptIdentifier = <CompilerOperationData>(
538
543
* @param environment a snapshot of the context around `scriptId`. See
539
544
* `CompilationEnvironment` for details.
540
545
* @param data the actual variable values (private keys, shared wallet data,
541
- * shared transaction data, etc.) to use in resolving variables.
546
+ * shared address data, etc.) to use in resolving variables.
542
547
*/
543
548
export const createIdentifierResolver = < CompilerOperationData > (
544
549
scriptId : string | undefined ,
0 commit comments