consumes: - application/json info: description: MassaStation HTTP server API. title: MassaStation version: 0.2.0 produces: - application/json schemes: - http - https swagger: "2.0" paths: /cmd/executeFunction: post: description: Calls the given function from the given smart contract. operationId: cmdExecuteFunction parameters: - in: body name: body required: true x-nullable: false schema: type: object required: - nickname - name - at properties: nickname: description: Account nickname used to sign the operation. type: string x-nullable: false name: description: Function name to call. type: string x-nullable: false async: description: Whether the function should be called without waiting for first event. type: boolean default: false at: description: Smart contract address exporting the function to call. type: string x-nullable: false args: description: Arguments to pass to the function. type: string default: "" maxGas: $ref: "#/definitions/Amount" description: Maximum number of gas unit that a operation will be able consume. coins: #$ref: "#/definitions/Amount" description: Set the coin amount that will be transferred to the smartContract. type: number # This is kept for backward compatibility default: 0 expiry: description: Set the expiry duration (in number of slots) of the transaction. type: integer default: 3 # DefaultExpiryInSlot fee: $ref: "#/definitions/Amount" description: Set the fee amount that will be given to the block creator. description: description: Description of the operation. type: string default: "" produces: - application/json responses: "200": description: OK. schema: type: object properties: operationId: description: Operation id. type: string firstEvent: description: first event emitted by the called smart contract. Kept for backward compatibility. $ref: "#/definitions/Events" "400": description: Bad request. schema: $ref: "#/definitions/Error" "422": description: Unprocessable Entity - syntax is correct, but the server was unable to process the contained instructions. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" /cmd/read-only/callsc: post: description: Read-only calls the given function from the given smart contract. operationId: cmdReadOnlyCallSC parameters: - in: body name: body required: true x-nullable: false schema: type: object required: - nickname - name - at properties: nickname: description: Account nickname used to sign the operation. type: string x-nullable: false name: description: Function name to call. type: string x-nullable: false at: description: Smart contract address exporting the function to call. type: string x-nullable: false args: description: Arguments to pass to the function. type: string default: "" coins: $ref: "#/definitions/Amount" description: Set the coin amount that will be transferred to the smartContract. fee: type: string description: Set the fee amount (in massa) that will be given to the block creator. default: "0" produces: - application/json responses: "200": description: OK. schema: $ref: "#/definitions/ReadOnlyResult" "400": description: Bad request. schema: $ref: "#/definitions/Error" "422": description: Unprocessable Entity - syntax is correct, but the server was unable to process the contained instructions. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" /cmd/read-only/executesc: post: description: Read-only execute smart contract operationId: cmdReadOnlyExecuteSC consumes: - multipart/form-data parameters: - in: formData name: nickname type: string required: true x-nullable: false description: Nickname of the account used to execute the byte code. - in: formData name: bytecode type: file required: true x-nullable: false description: Smart contract file in a Wasm format. - in: formData name: coins type: string description: Set the number of coins that will be sent along the deployment call. (NanoMassa) default: "0" - in: formData name: fee type: string description: Set the fee amount (in massa) that will be given to the block creator. default: "0" - in: formData name: datastore type: string default: "" description: base64 encoded datastore that will be sent along the smart contract. produces: - application/json responses: "200": description: OK. schema: $ref: "#/definitions/ReadOnlyResult" "400": description: Bad request. schema: $ref: "#/definitions/Error" "422": description: Unprocessable Entity - syntax is correct, but the server was unable to process the contained instructions. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" /cmd/deploySC: post: description: Deploys the given smart contract to the blockchain network. operationId: cmdDeploySC parameters: - in: body name: body required: true x-nullable: false schema: type: object required: - nickname - smartContract properties: nickname: description: Account nickname used to sign the operation. type: string x-nullable: false smartContract: description: Base64 encoded smart contract bytecode. type: string x-nullable: false maxCoins: description: Set the number of coins that will be sent along the deployment call. type: string default: "0" coins: description: Set the number of coins that will be sent along the deployment call. type: string default: "0" fee: description: Set the fee amount (in nanoMassa) that will be given to the block creator. type: string default: "0" parameters: description: Base64 encoded parameters that will be sent along the smart contract. type: string description: description: "Description of the operation" type: string default: "" maxGas: $ref: "#/definitions/Amount" description: Maximum number of gas unit the operation will be able to consume. produces: - application/json responses: "200": description: OK. schema: type: object properties: operationId: description: Operation id. type: string firstEvent: description: first event emitted by the called smart contract. $ref: "#/definitions/Events" "400": description: Bad request. schema: $ref: "#/definitions/Error" "422": description: Unprocessable Entity - syntax is correct, but the server was unable to process the contained instructions. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" /cmd/executeSC: post: description: Execute a smart contract bytecode. operationId: cmdExecuteSC parameters: - in: body name: body required: true x-nullable: false schema: type: object required: - nickname - bytecode properties: nickname: description: Account nickname used to sign the operation. type: string x-nullable: false bytecode: description: Base64 encoded smart contract bytecode. type: string x-nullable: false maxCoins: $ref: "#/definitions/Amount" description: Max spendable coins by the execution. default: "0" fee: $ref: "#/definitions/Amount" description: Set the fee amount (in nanoMassa) that will be given to the block creator. default: "0" description: description: "Description of the operation" type: string default: "" maxGas: $ref: "#/definitions/Amount" description: Maximum number of gas unit the operation will be able to consume. datastore: $ref: "#/definitions/Datastore" produces: - application/json responses: "200": description: OK. schema: type: object properties: operationId: description: Operation id. type: string "400": description: Bad request. schema: $ref: "#/definitions/Error" "422": description: Unprocessable Entity - syntax is correct, but the server was unable to process the contained instructions. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" /kpi: get: operationId: kpi parameters: - name: scope in: query type: array minItems: 0 uniqueItems: true collectionFormat: csv items: type: string enum: [wallet, node, stacking, blockchain] produces: - application/json responses: "200": description: kpi message. schema: type: object properties: wallet: type: array items: type: object properties: coin: type: string balance: type: number node: type: array items: type: object properties: memory: type: array items: type: number cpu: type: array items: type: number storage: type: array items: type: number network: type: array items: type: number stacking: type: array items: type: object properties: address: type: string rolls: type: integer slashing: type: integer gains: type: number /massa/addresses: get: description: Retrieves requested information about the given addresses. operationId: massaGetAddresses parameters: - in: query name: attributes type: array collectionFormat: multi description: | Specifies the attributes to return. If no attributes are provided, they are all returned. Possible values: | Attribute | Content | | ----------- | -----------| | balance | the pending balances (takes into account pending/non-final operations) and the final balances (takes into account only final operations). | items: type: string enum: [balance] - in: query name: addresses required: true x-nullable: false type: array collectionFormat: multi description: list of wanted addresses items: type: string produces: - application/json responses: "200": description: Addresses' infos retrieved schema: type: object properties: addressesAttributes: type: object additionalProperties: description: address key type: object properties: balance: type: object properties: pending: type: string final: type: string "400": description: Bad request. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" /massa/node: get: summary: Get Massa network infos description: Returns the currently used massa node infos operationId: getNode produces: - application/json responses: "200": description: Massa node schema: $ref: "#/definitions/MassaNodeItem" "404": description: Not found. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" /network: get: description: Retrieves the network configuration. operationId: getNetworkConfig produces: - application/json responses: "200": description: Network configuration returned. schema: $ref: "#/definitions/NetworkManagerItem" "400": description: Bad request. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" post: description: Creates a new network entry and optionally makes it the default. operationId: createNetwork parameters: - in: body name: body required: true x-nullable: false schema: type: object required: - name - url properties: name: type: string description: Unique network name. x-nullable: false url: type: string description: RPC URL for the network. x-nullable: false default: type: boolean description: Whether to make this network the default and current. default: false produces: - application/json responses: "200": description: Network created. schema: $ref: "#/definitions/NetworkManagerItem" "400": description: Bad request. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" /network/{network}: post: description: Switches the application to the specified network. operationId: switchNetwork parameters: - in: path name: network type: string required: true description: The network to switch to. responses: "200": description: Network successfully switched. schema: type: object $ref: "#/definitions/NetworkManagerItem" "404": description: Not found. schema: $ref: "#/definitions/Error" produces: - application/json put: description: Updates an existing network's properties or renames it. operationId: updateNetwork parameters: - in: path name: network type: string required: true description: Current name of the network to update. - in: body name: body required: true x-nullable: false schema: type: object properties: url: type: string description: New RPC URL. x-nullable: true default: type: boolean description: Whether to make this network the default and current. x-nullable: true newName: type: string description: New unique name for the network. x-nullable: true produces: - application/json responses: "200": description: Network updated. schema: $ref: "#/definitions/NetworkManagerItem" "400": description: Bad request. schema: $ref: "#/definitions/Error" "404": description: Not found. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" delete: description: Deletes an existing network. operationId: deleteNetwork parameters: - in: path name: network type: string required: true description: Name of the network to delete. produces: - application/json responses: "200": description: Network deleted. schema: $ref: "#/definitions/NetworkManagerItem" "400": description: Bad request. schema: $ref: "#/definitions/Error" "404": description: Not found. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" /plugin-manager: post: description: Install a plugin from a given URL. operationId: pluginManagerInstall parameters: - in: query name: source type: string format: url required: true x-nullable: false description: URL from which to retrieve the plug-in. produces: - application/json responses: "204": description: Plugin successfully installed "400": description: Bad request. schema: $ref: "#/definitions/Error" "404": description: Not found. schema: $ref: "#/definitions/Error" "422": description: Unprocessable Entity - The syntax is correct, but the server was unable to process the contained instructions. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" get: description: List all installed plugins. operationId: pluginManagerList responses: "200": description: List all installed plugins. schema: type: array items: $ref: "#/definitions/Plugin" "400": description: Bad request. schema: $ref: "#/definitions/Error" "404": description: Not found. schema: $ref: "#/definitions/Error" "422": description: Unprocessable Entity - The syntax is correct, but the server was unable to process the contained instructions. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" /plugin-manager/register: post: description: Register a plugin. This is used by plugins to register themselves to the plugin manager. operationId: pluginManagerRegister parameters: - in: body name: body required: true x-nullable: false schema: type: object required: - id - url properties: id: description: Plugin identifier. type: string x-nullable: false url: description: URL authority to use to connect to the plugin type: string x-nullable: false responses: "204": description: Plugin successfully installed "400": description: Bad request. schema: $ref: "#/definitions/Error" "404": description: Not found. schema: $ref: "#/definitions/Error" "422": description: Unprocessable Entity - The syntax is correct, but the server was unable to process the contained instructions. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" /plugin-manager/{id}: get: description: Returns the given plugin status. operationId: pluginManagerGetInformation parameters: - in: path name: id type: string required: true description: Plugin identifier. responses: "200": description: Get execution information from the plugin. schema: $ref: "#/definitions/Plugin" "400": description: Bad request. schema: $ref: "#/definitions/Error" "404": description: Not found. schema: $ref: "#/definitions/Error" "422": description: Unprocessable Entity - The syntax is correct, but the server was unable to process the contained instructions. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" delete: description: Uninstall the given plugin from the system. operationId: pluginManagerUninstall parameters: - in: path name: id required: true type: string description: Plugin identifier. responses: "204": description: Plugin successfully remove from the system. "400": description: Bad request. schema: $ref: "#/definitions/Error" "404": description: Not found. schema: $ref: "#/definitions/Error" "422": description: Unprocessable Entity - The syntax is correct, but the server was unable to process the contained instructions. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" /plugin-manager/{id}/execute: post: description: Execute a command on the given plugin such as update, stop, start, restart. operationId: pluginManagerExecuteCommand parameters: - in: path name: id type: string required: true description: Plugin unique identifier. - in: body name: body required: true x-nullable: false schema: type: object required: - command properties: command: description: Command to execute. type: string enum: ["update", "stop", "start", "restart"] x-nullable: false responses: "204": description: Command successfully executed. "400": description: Bad request. schema: $ref: "#/definitions/Error" "404": description: Not found. schema: $ref: "#/definitions/Error" "422": description: Unprocessable Entity - The syntax is correct, but the server was unable to process the contained instructions. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" "501": description: Not Implemented - the server does not support the functionality required to fulfill the request. schema: $ref: "#/definitions/Error" /plugin-manager/{id}/logo: get: summary: Get plugin logo operationId: pluginManagerGetLogo parameters: - in: path name: id type: string required: true description: Plugin unique identifier. produces: - image/* responses: "200": description: Plugin logo schema: type: file "400": description: Bad request. schema: $ref: "#/definitions/Error" "404": description: Not found. schema: $ref: "#/definitions/Error" "422": description: Unprocessable Entity - The syntax is correct, but the server was unable to process the contained instructions. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" /plugin-store: get: summary: Get list of available plugins from store description: Returns a list of PluginStoreItem structs operationId: getPluginStore produces: - application/json responses: "200": description: List of plugins schema: type: array items: $ref: "#/definitions/PluginStoreItem" "400": description: Bad request. schema: $ref: "#/definitions/Error" "404": description: Not found. schema: $ref: "#/definitions/Error" "422": description: Unprocessable Entity - The syntax is correct, but the server was unable to process the contained instructions. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" /events/{str}/{caller}: get: description: Returns the event matching the given data content and caller. operationId: eventsGetter produces: - application/json parameters: - in: path required: true name: str type: string description: Data content of the event. - in: path name: caller required: true type: string description: Creator of the transaction that triggered the event. responses: "200": description: Event retrieved schema: $ref: "#/definitions/Events" "400": description: Bad request. schema: $ref: "#/definitions/Error" "500": description: Internal Server Error - The server has encountered a situation it does not know how to handle. schema: $ref: "#/definitions/Error" /web/{resource}: get: description: Frontend router for the MassaStation. operationId: MassaStationWebApp produces: - application/json - text/javascript - text/html - text/css - text/webp - image/png parameters: - in: path name: resource required: true type: string description: Website resource. responses: "200": description: Page found "404": description: Resource not found. schema: $ref: "#/definitions/Error" /plugin/{author-name}/{plugin-name}: get: operationId: pluginRouter description: virtual endpoint handling requests for third party plugin. The actual handler is defined as an HTTP handler middleware. parameters: - in: path name: author-name type: string required: true description: Author of the plugin. - in: path name: plugin-name required: true type: string description: Name of the plugin. responses: "200": description: Dumb response. All content and HTTP code are possible for this endpoint. /version: get: description: "Get current massastation version" operationId: GetMassaStationVersion produces: - application/json responses: "200": description: Massa Station version retrieved. schema: $ref: "#/definitions/Version" "400": description: "Failed to retrieve Massa Station version" schema: $ref: "#/definitions/Version" definitions: Version: description: Current Massa Station version. type: string x-nullable: false Amount: description: Amount in integer string. type: string x-nullable: false default: "" Error: type: object description: Error object. required: - code - message properties: code: description: error code. type: string x-nullable: false message: description: error message. type: string x-nullable: false Events: type: object description: Events object (V0) properties: data: description: Event data. type: string address: description: SC address that emitted the event. type: string NetworkManagerItem: type: object description: Network manager item. properties: currentNetwork: description: actual network. type: string availableNetworkInfos: description: detailed available networks with status type: array items: $ref: "#/definitions/NetworkInfoItem" required: - currentNetwork - availableNetworkInfos NetworkInfoItem: type: object description: Detailed network information properties: name: type: string url: type: string chainId: type: integer version: type: string status: type: string enum: [up, down] PluginStoreItem: type: object description: Plugin item from store. properties: name: type: string author: type: string description: type: string version: type: string url: type: string logo: type: string massastationMinVersion: type: string isCompatible: type: boolean file: $ref: "#/definitions/File" os: type: string required: - name - description - version - url - file File: type: object properties: url: type: string checksum: type: string required: - url - checksum MassaNodeItem: type: object description: Massa node infos. properties: network: type: string url: type: string chainId: type: integer required: - network - url Plugin: type: object properties: id: description: Plugin identifier. type: string x-nullable: false name: description: Plugin name. type: string x-nullable: false author: description: Plugin author. type: string x-nullable: false description: description: Plugin description. type: string x-nullable: false home: description: Plugin home URL. type: string x-nullable: false status: description: Plugin status. enum: ["Starting", "Up", "Down", "ShuttingDown", "Crashed"] x-nullable: false logo: description: Plugin logo URL. type: string x-nullable: false version: description: Plugin version. type: string x-nullable: false updatable: description: Whether the plugin can be updated. type: boolean ReadOnlyResult: type: object properties: executed_at: $ref: "#/definitions/Timestamp" result: $ref: "#/definitions/Result" output_events: type: array items: $ref: "#/definitions/Event" gas_cost: type: integer state_changes: $ref: "#/definitions/StateChange" Timestamp: type: object properties: period: type: integer thread: type: integer Result: type: object properties: Ok: type: array items: type: object Error: type: string Event: type: object properties: context: $ref: "#/definitions/EventContext" data: type: string EventContext: type: object properties: slot: $ref: "#/definitions/Timestamp" block: type: object read_only: type: boolean index_in_slot: type: integer call_stack: type: array items: type: string origin_operation_id: type: object is_final: type: boolean is_error: type: boolean StateChange: type: object properties: ledger_changes: type: object additionalProperties: $ref: "#/definitions/LedgerEntryChange" async_pool_changes: type: array items: type: object pos_changes: $ref: "#/definitions/PosChanges" executed_ops_changes: type: object additionalProperties: type: object executed_denunciations_changes: type: array items: type: object execution_trail_hash_change: type: object LedgerEntryChange: type: object properties: Update: $ref: "#/definitions/LedgerUpdate" LedgerUpdate: type: object properties: balance: $ref: "#/definitions/ChangeSet" bytecode: type: object datastore: type: array items: type: object ChangeSet: type: object properties: Set: type: object PosChanges: type: object properties: seed_bits: $ref: "#/definitions/SeedBitsInfo" roll_changes: type: object additionalProperties: type: object production_stats: type: object additionalProperties: type: object deferred_credits: $ref: "#/definitions/DeferredCreditsInfo" SeedBitsInfo: type: object properties: order: type: string head: $ref: "#/definitions/BitVecHeadInfo" bits: type: integer data: type: array items: type: object BitVecHeadInfo: type: object properties: width: type: integer index: type: integer DeferredCreditsInfo: type: object properties: credits: type: object additionalProperties: type: object Base64Bytes: title: "Base64Bytes" description: "Bytes in base64 string" type: string DataStoreEntry: title: "Datastore entry" description: "A tuple which contains (key, value) in b64 string" type: array maxItems: 2 items: $ref: "#/definitions/Base64Bytes" example: [ [ abcdef ], [ ghjklm ] ] Datastore: title: "Datastore" description: "Contract datastore" type: array items: $ref: "#/definitions/DataStoreEntry"