@@ -37,7 +37,7 @@ import {
3737import SignatureTemplate from './SignatureTemplate.js' ;
3838import { Transaction } from './Transaction.js' ;
3939import { EncodedConstructorArgument , EncodedFunctionArgument } from './Argument.js' ;
40- import { addressToLockScript , extendedStringify , snakeCase , zip } from './utils.js' ;
40+ import { addressToLockScript , extendedStringify , zip } from './utils.js' ;
4141import { Contract } from './Contract.js' ;
4242
4343interface BuildTemplateOptions {
@@ -89,9 +89,9 @@ export const buildTemplate = async ({
8989 const hashtypeName = getHashTypeName ( input . template . getHashType ( false ) ) ;
9090 const signatureString = `${ placeholderKeyName } .${ signatureAlgorithmName } .${ hashtypeName } ` ;
9191
92- template . entities [ snakeCase ( contract . name + 'Parameters' ) ] . scripts ! . push ( lockScriptName , unlockScriptName ) ;
93- template . entities [ snakeCase ( contract . name + 'Parameters' ) ] . variables = {
94- ...template . entities [ snakeCase ( contract . name + 'Parameters' ) ] . variables ,
92+ template . entities [ contract . name + '_parameters' ] . scripts ! . push ( lockScriptName , unlockScriptName ) ;
93+ template . entities [ contract . name + '_parameters' ] . variables = {
94+ ...template . entities [ contract . name + '_parameters' ] . variables ,
9595 [ placeholderKeyName ] : {
9696 description : placeholderKeyName ,
9797 name : placeholderKeyName ,
@@ -132,7 +132,7 @@ const generateTemplateEntities = (
132132) : WalletTemplate [ 'entities' ] => {
133133 const functionParameters = Object . fromEntries < WalletTemplateVariable > (
134134 abiFunction . inputs . map ( ( input , index ) => ( [
135- snakeCase ( input . name ) ,
135+ input . name ,
136136 {
137137 description : `"${ input . name } " parameter of function "${ abiFunction . name } "` ,
138138 name : input . name ,
@@ -143,7 +143,7 @@ const generateTemplateEntities = (
143143
144144 const constructorParameters = Object . fromEntries < WalletTemplateVariable > (
145145 artifact . constructorInputs . map ( ( input ) => ( [
146- snakeCase ( input . name ) ,
146+ input . name ,
147147 {
148148 description : `"${ input . name } " parameter of this contract` ,
149149 name : input . name ,
@@ -153,12 +153,12 @@ const generateTemplateEntities = (
153153 ) ;
154154
155155 const entities = {
156- [ snakeCase ( artifact . contractName + 'Parameters' ) ] : {
156+ [ artifact . contractName + '_parameters' ] : {
157157 description : 'Contract creation and function parameters' ,
158- name : snakeCase ( artifact . contractName + 'Parameters' ) ,
158+ name : artifact . contractName + '_parameters' ,
159159 scripts : [
160- snakeCase ( artifact . contractName + '_lock' ) ,
161- snakeCase ( artifact . contractName + '_unlock' ) ,
160+ artifact . contractName + '_lock' ,
161+ artifact . contractName + '_unlock' ,
162162 ] ,
163163 variables : {
164164 ...functionParameters ,
@@ -169,7 +169,7 @@ const generateTemplateEntities = (
169169
170170 // function_index is a special variable that indicates the function to execute
171171 if ( artifact . abi . length > 1 ) {
172- entities [ snakeCase ( artifact . contractName + 'Parameters' ) ] . variables . function_index = {
172+ entities [ artifact . contractName + '_parameters' ] . variables . function_index = {
173173 description : 'Script function index to execute' ,
174174 name : 'function_index' ,
175175 type : 'WalletData' ,
@@ -188,8 +188,8 @@ const generateTemplateScripts = (
188188) : WalletTemplate [ 'scripts' ] => {
189189 // definition of locking scripts and unlocking scripts with their respective bytecode
190190 return {
191- [ snakeCase ( artifact . contractName + '_unlock' ) ] : generateTemplateUnlockScript ( artifact , abiFunction , encodedFunctionArgs ) ,
192- [ snakeCase ( artifact . contractName + '_lock' ) ] : generateTemplateLockScript ( artifact , addressType , encodedConstructorArgs ) ,
191+ [ artifact . contractName + '_unlock' ] : generateTemplateUnlockScript ( artifact , abiFunction , encodedFunctionArgs ) ,
192+ [ artifact . contractName + '_lock' ] : generateTemplateLockScript ( artifact , addressType , encodedConstructorArgs ) ,
193193 } ;
194194} ;
195195
@@ -200,7 +200,7 @@ const generateTemplateLockScript = (
200200) : WalletTemplateScriptLocking => {
201201 return {
202202 lockingType : addressType ,
203- name : snakeCase ( artifact . contractName + '_lock' ) ,
203+ name : artifact . contractName + '_lock' ,
204204 script : [
205205 `// "${ artifact . contractName } " contract constructor parameters` ,
206206 formatParametersForDebugging ( artifact . constructorInputs , constructorArguments ) ,
@@ -224,15 +224,15 @@ const generateTemplateUnlockScript = (
224224
225225 return {
226226 // this unlocking script must pass our only scenario
227- passes : [ snakeCase ( artifact . contractName + 'Evaluate' ) ] ,
228- name : snakeCase ( artifact . contractName + '_unlock' ) ,
227+ passes : [ artifact . contractName + '_evaluate' ] ,
228+ name : artifact . contractName + '_unlock' ,
229229 script : [
230230 `// "${ abiFunction . name } " function parameters` ,
231231 formatParametersForDebugging ( abiFunction . inputs , encodedFunctionArgs ) ,
232232 '' ,
233233 ...functionIndexString ,
234234 ] . join ( '\n' ) ,
235- unlocks : snakeCase ( artifact . contractName + '_lock' ) ,
235+ unlocks : artifact . contractName + '_lock' ,
236236 } ;
237237} ;
238238
@@ -250,8 +250,8 @@ const generateTemplateScenarios = (
250250
251251 const scenarios = {
252252 // single scenario to spend out transaction under test given the CashScript parameters provided
253- [ snakeCase ( artifact . contractName + 'Evaluate' ) ] : {
254- name : snakeCase ( artifact . contractName + 'Evaluate' ) ,
253+ [ artifact . contractName + '_evaluate' ] : {
254+ name : artifact . contractName + '_evaluate' ,
255255 description : 'An example evaluation where this script execution passes.' ,
256256 data : {
257257 // encode values for the variables defined above in `entities` property
@@ -272,7 +272,7 @@ const generateTemplateScenarios = (
272272
273273 if ( artifact . abi . length > 1 ) {
274274 const functionIndex = artifact . abi . findIndex ( ( func ) => func . name === transaction . abiFunction . name ) ;
275- scenarios ! [ snakeCase ( artifact . contractName + 'Evaluate' ) ] . data ! . bytecode ! . function_index = functionIndex . toString ( ) ;
275+ scenarios ! [ artifact . contractName + '_evaluate' ] . data ! . bytecode ! . function_index = functionIndex . toString ( ) ;
276276 }
277277
278278 return scenarios ;
@@ -382,7 +382,7 @@ export const generateTemplateScenarioParametersValues = (
382382 . map ( ( [ input , arg ] ) => {
383383 const encodedArgumentHex = binToHex ( arg as Uint8Array ) ;
384384 const prefixedEncodedArgument = addHexPrefixExceptEmpty ( encodedArgumentHex ) ;
385- return [ snakeCase ( input . name ) , prefixedEncodedArgument ] as const ;
385+ return [ input . name , prefixedEncodedArgument ] as const ;
386386 } ) ;
387387
388388 return Object . fromEntries ( entries ) ;
@@ -400,7 +400,7 @@ export const generateTemplateScenarioKeys = (
400400
401401 const entries = typesAndArguments
402402 . filter ( ( [ , arg ] ) => arg instanceof SignatureTemplate )
403- . map ( ( [ input , arg ] ) => ( [ snakeCase ( input . name ) , binToHex ( ( arg as SignatureTemplate ) . privateKey ) ] as const ) ) ;
403+ . map ( ( [ input , arg ] ) => ( [ input . name , binToHex ( ( arg as SignatureTemplate ) . privateKey ) ] as const ) ) ;
404404
405405 return Object . fromEntries ( entries ) ;
406406} ;
@@ -415,14 +415,14 @@ export const formatParametersForDebugging = (types: readonly AbiInput[], args: E
415415 if ( arg instanceof SignatureTemplate ) {
416416 const signatureAlgorithmName = getSignatureAlgorithmName ( arg . getSignatureAlgorithm ( ) ) ;
417417 const hashtypeName = getHashTypeName ( arg . getHashType ( false ) ) ;
418- return `<${ snakeCase ( input . name ) } .${ signatureAlgorithmName } .${ hashtypeName } > // ${ input . type } ` ;
418+ return `<${ input . name } .${ signatureAlgorithmName } .${ hashtypeName } > // ${ input . type } ` ;
419419 }
420420
421421 const typeStr = input . type === 'bytes' ? `bytes${ arg . length } ` : input . type ;
422422
423423 // we output these values as pushdata, comment will contain the type and the value of the variable
424424 // e.g. <timeout> // int = <0xa08601>
425- return `<${ snakeCase ( input . name ) } > // ${ typeStr } = <${ `0x${ binToHex ( arg ) } ` } >` ;
425+ return `<${ input . name } > // ${ typeStr } = <${ `0x${ binToHex ( arg ) } ` } >` ;
426426 } ) . join ( '\n' ) ;
427427} ;
428428
0 commit comments