feat: add support for XLS-40d + add script to auto-generate models from rippled code (#2491)

Add support for XLS-40 and adds a script to automatically
generate transaction models from rippled source code.

### Context of Change

https://github.com/XRPLF/XRPL-Standards/pull/136
https://github.com/XRPLF/rippled/pull/4636
This commit is contained in:
Mayukha Vadari
2023-11-15 17:19:50 -05:00
committed by GitHub
parent 22dd17d6b7
commit c8f25a6347
17 changed files with 701 additions and 46 deletions

View File

@@ -4,19 +4,18 @@
* folder.
*/
const fs = require('fs')
const path = require('path')
const NORMAL_TYPES = ['number', 'string']
const NUMBERS = ['0', '1']
// TODO: rewrite this to use regex
async function main() {
if (process.argv.length < 3) {
console.log(`Usage: ${process.argv[0]} ${process.argv[1]} TxName`)
process.exit(1)
}
const modelName = process.argv[2]
const filename = `./src/models/transactions/${modelName}.ts`
async function main(modelName) {
const filename = path.join(
path.dirname(__filename),
`../src/models/transactions/${modelName}.ts`,
)
const [model, txName] = await getModel(filename)
return processModel(model, txName)
}
@@ -144,4 +143,12 @@ ${output}`
return output
}
main().then(console.log)
if (require.main === module) {
if (process.argv.length < 3) {
console.log(`Usage: ${process.argv[0]} ${process.argv[1]} TxName`)
process.exit(1)
}
main(process.argv[2]).then(console.log)
}
module.exports = main