Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 5115x 1x 1x 2x 16x | import * as ts from 'typescript'
import {capitalize} from '@wharfkit/contract'
// Generates a namespace name for a contract (eg. _EosioToken for eosio.token)
export function generateNamespaceName(contractName: string) {
return contractName
.split('.')
.map((namePart) => capitalize(namePart))
.join('')
}
export function generateNamespace(
namespaceName: string,
children,
isExport = true
): ts.ModuleDeclaration {
return ts.factory.createModuleDeclaration(
isExport ? [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)] : [], // modifiers
ts.factory.createIdentifier(namespaceName),
ts.factory.createModuleBlock(children),
ts.NodeFlags.Namespace
)
}
|