import { tx , wallet } from "@cityofzion/neon-core" ; import { signWithPrivateKey } from "./sign" ; import { ClaimGasConfig , DoInvokeConfig , ManagedApiBasicConfig , SendAssetConfig , } from "./types" ; param config return export async function fillUrl < U extends tx . BaseTransaction , T extends ManagedApiBasicConfig < U > > ( config ) { if ( config . url ) { return config ; } config . url = await config . api . getRPCEndpoint ( ) ; return config ; } param config return export async function fillBalance < T extends DoInvokeConfig | SendAssetConfig > ( config ) { if ( ! ( config . balance instanceof wallet . Balance ) ) { config . balance = await config . api . getBalance ( config . account ! . address ) ; } return config ; } param config return export async function fillSigningFunction < U extends tx . BaseTransaction , T extends ManagedApiBasicConfig < U > > ( config ) { if ( ! config . signingFunction ) { if ( config . account ) { config . signingFunction = signWithPrivateKey ( config . account . privateKey ) ; } else { throw new Error ( "No account found!" ) ; } } return config ; } param config return export async function fillClaims < U extends tx . BaseTransaction , _T extends ManagedApiBasicConfig < U > > ( config ) { if ( ! ( config . claims instanceof wallet . Claims ) ) { config . claims = await config . api . getClaims ( config . account ! . address ) ; } if ( ! config . claims . claims || config . claims . claims . length === 0 ) { throw new Error ( `No Claims found` ) ; } return config ; }