api / APIServerImpl

# APIServerImpl

`class APIServerImpl : APIServer`

### Constructors

<init> | `APIServerImpl(node: AbstractNode)`

### Properties

node | `val node: AbstractNode`

### Functions

buildTransaction

`fun buildTransaction(type: ContractDefRef, steps: List<TransactionBuildStep>): SerializedBytes<WireTransaction>`

TransactionBuildSteps would be invocations of contract.generateXXX() methods that all share a common TransactionBuilder and a common contract type (e.g. Cash or CommercialPaper) which would automatically be passed as the first argument (wed need that to be a criteria/pattern of the generateXXX methods).

commitTransaction | `fun commitTransaction(tx: SerializedBytes<WireTransaction>, signatures: List<WithKey>): SecureHash` Attempt to commit transaction (returned from build transaction) with the necessary signatures for that to be successful, otherwise exception is thrown.
fetchProtocolsRequiringAttention | `fun fetchProtocolsRequiringAttention(query: StatesQuery): Map<StateRef, ProtocolRequiringAttention>` Fetch protocols that require a response to some prompt/question by a human (on the "bank" side).
fetchStates | `fun fetchStates(states: List<StateRef>): Map<StateRef, ContractState?>`
fetchTransactions | `fun fetchTransactions(txs: List<SecureHash>): Map<SecureHash, SignedTransaction?>` Query for immutable transactions (results can be cached indefinitely by their id/hash).
generateTransactionSignature | `fun generateTransactionSignature(tx: SerializedBytes<WireTransaction>): WithKey` Generate a signature for this transaction signed by us.
invokeProtocolSync | `fun invokeProtocolSync(type: ProtocolRef, args: Map<String, Any?>): Any?` This method would not return until the protocol is finished (hence the "Sync").
provideProtocolResponse | `fun provideProtocolResponse(protocol: ProtocolInstanceRef, choice: SecureHash, args: Map<String, Any?>): Unit` Provide the response that a protocol is waiting for.
queryStates | `fun queryStates(query: StatesQuery): List<StateRef>` Query your "local" states (containing only outputs involving you) and return the hashes & indexes associated with them to probably be later inflated by fetchLedgerTransactions() or fetchStates() although because immutable you can cache them to avoid calling fetchLedgerTransactions() many times.
serverTime | `fun serverTime(): LocalDateTime` Report current UTC time as understood by the platform.