import { tx , u } from "@cityofzion/neon-core" ; import { getVerificationSignatureForSmartContract } from "./common" ; import { ManagedApiBasicConfig } from "./types" ; param config return export async function addAttributeIfExecutingAsSmartContract < T extends ManagedApiBasicConfig < tx . BaseTransaction > > ( config ) { if ( ! config . sendingFromSmartContract ) { return config ; } config . tx ?. addAttribute ( tx . TxAttrUsage . Script , u . reverseHex ( config . sendingFromSmartContract ) ) ; return config ; } param config return export async function addSignatureIfExecutingAsSmartContract < T extends ManagedApiBasicConfig < tx . BaseTransaction > > ( config ) { if ( ! config . sendingFromSmartContract ) { return config ; } const witness = await getVerificationSignatureForSmartContract ( config . url ! , config . sendingFromSmartContract ) ; config . tx ! . addWitness ( witness ) ; return config ; }