From 6a4f6113a104480af2f8608fb632e7e4c87178bd Mon Sep 17 00:00:00 2001 From: Mikhail Wall Date: Fri, 28 Jun 2024 20:05:02 +0200 Subject: [PATCH 1/7] chore: added autodeposit info --- bidder-openapi-spec.json | 795 ++++++++++++------- get-started/bidders/bidder-node-commands.mdx | 68 +- 2 files changed, 577 insertions(+), 286 deletions(-) diff --git a/bidder-openapi-spec.json b/bidder-openapi-spec.json index 94b87c05..ceaf4be0 100644 --- a/bidder-openapi-spec.json +++ b/bidder-openapi-spec.json @@ -1,401 +1,628 @@ { - "openapi": "3.0.0", - "info": { - "title": "Bidder API", - "version": "1.0.0-alpha-oas3", - "license": { - "name": "Business Source License 1.1", - "url": "https://github.com/primev/mev-commit/blob/main/LICENSE" + "openapi" : "3.0.0", + "info" : { + "title" : "Bidder API", + "version" : "1.0.0-alpha-oas3", + "license" : { + "name" : "Business Source License 1.1", + "url" : "https://github.com/primev/mev-commit/blob/main/LICENSE" } }, - "paths": { - "/v1/bidder/bid": { - "post": { - "summary": "SendBid", - "description": "Send a bid to the bidder mev-commit node.", - "operationId": "Bidder_SendBid", - "responses": { - "200": { - "description": "A successful response.(streaming responses)", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "result": { - "$ref": "#/components/schemas/v1Commitment" + "paths" : { + "/v1/bidder/auto_deposit/{amount}" : { + "post" : { + "summary" : "AutoDeposit", + "description" : "AutoDeposit is called by the bidder node to add deposit in the bidder registry and move funds automatily from one window to another.", + "operationId" : "Bidder_AutoDeposit", + "responses" : { + "200" : { + "description" : "A successful response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/v1AutoDepositResponse" + } + } + } + }, + "default" : { + "description" : "An unexpected error response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/googlerpcStatus" + } + } + } + } + }, + "parameters" : [ { + "name" : "amount", + "description" : "Amount of ETH to be deposited in wei.", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "windowNumber", + "description" : "Optional window number for querying deposit. If not specified, the current block number is used.", + "in" : "query", + "required" : false, + "schema" : { + "type" : "string", + "format" : "uint64" + } + }, { + "name" : "blockNumber", + "description" : "Optional block number for querying deposit. If specified, calculate window based on this block number.", + "in" : "query", + "required" : false, + "schema" : { + "type" : "string", + "format" : "uint64" + } + } ] + } + }, + "/v1/bidder/auto_deposit_status" : { + "get" : { + "summary" : "AutoDepositStatus", + "description" : "AutoDepositStatus is called by the bidder node to get the status of the auto deposit.", + "operationId" : "Bidder_AutoDepositStatus", + "responses" : { + "200" : { + "description" : "A successful response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/v1AutoDepositStatusResponse" + } + } + } + }, + "default" : { + "description" : "An unexpected error response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/googlerpcStatus" + } + } + } + } + } + } + }, + "/v1/bidder/bid" : { + "post" : { + "summary" : "SendBid", + "description" : "Send a bid to the bidder mev-commit node.", + "operationId" : "Bidder_SendBid", + "responses" : { + "200" : { + "description" : "A successful response.(streaming responses)", + "content" : { + "application/json" : { + "schema" : { + "type" : "object", + "properties" : { + "result" : { + "$ref" : "#/components/schemas/v1Commitment" }, - "error": { - "$ref": "#/components/schemas/googlerpcStatus" + "error" : { + "$ref" : "#/components/schemas/googlerpcStatus" } }, - "title": "Stream result of v1Commitment" + "title" : "Stream result of v1Commitment" } } } }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/googlerpcStatus" + "default" : { + "description" : "An unexpected error response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/googlerpcStatus" } } } } }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/bidderapiv1Bid" + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/bidderapiv1Bid" } } }, - "description": "Unsigned bid message from bidders to the bidder mev-commit node.", - "required": true + "description" : "Unsigned bid message from bidders to the bidder mev-commit node.", + "required" : true } } }, - "/v1/bidder/deposit/{amount}": { - "post": { - "summary": "Deposit", - "description": "Deposit is called by the bidder node to add deposit in the bidder registry.", - "operationId": "Bidder_Deposit", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/v1DepositResponse" + "/v1/bidder/cancel_and_withdraw_auto_deposit" : { + "post" : { + "summary" : "CancelAndWithdrawAutoDeposit", + "description" : "CancelAndWithdrawAutoDeposit is called by the bidder node to cancel the auto deposit and withdraw the funds.", + "operationId" : "Bidder_CancelAndWithdrawAutoDeposit", + "responses" : { + "200" : { + "description" : "A successful response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/v1CancelAutoDepositResponse" } } } }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/googlerpcStatus" + "default" : { + "description" : "An unexpected error response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/googlerpcStatus" } } } } - }, - "parameters": [ - { - "name": "amount", - "description": "Amount of ETH to be deposited in wei.", - "in": "path", - "required": true, - "schema": { - "type": "string" + } + } + }, + "/v1/bidder/cancel_auto_deposit" : { + "post" : { + "summary" : "CancelAutoDeposit", + "description" : "CancelAutoDeposit is called by the bidder node to cancel the auto deposit.", + "operationId" : "Bidder_CancelAutoDeposit", + "responses" : { + "200" : { + "description" : "A successful response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/v1CancelAutoDepositResponse" + } + } } }, - { - "name": "windowNumber", - "description": "Optional window number for querying deposit. If not specified, the current block number is used.", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "uint64" + "default" : { + "description" : "An unexpected error response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/googlerpcStatus" + } + } + } + } + } + } + }, + "/v1/bidder/deposit/{amount}" : { + "post" : { + "summary" : "Deposit", + "description" : "Deposit is called by the bidder node to add deposit in the bidder registry.", + "operationId" : "Bidder_Deposit", + "responses" : { + "200" : { + "description" : "A successful response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/v1DepositResponse" + } + } } }, - { - "name": "blockNumber", - "description": "Optional block number for querying deposit. If specified, calculate window based on this block number.", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "uint64" + "default" : { + "description" : "An unexpected error response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/googlerpcStatus" + } + } } } - ] + }, + "parameters" : [ { + "name" : "amount", + "description" : "Amount of ETH to be deposited in wei.", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "windowNumber", + "description" : "Optional window number for querying deposit. If not specified, the current block number is used.", + "in" : "query", + "required" : false, + "schema" : { + "type" : "string", + "format" : "uint64" + } + }, { + "name" : "blockNumber", + "description" : "Optional block number for querying deposit. If specified, calculate window based on this block number.", + "in" : "query", + "required" : false, + "schema" : { + "type" : "string", + "format" : "uint64" + } + } ] } }, - "/v1/bidder/get_deposit": { - "get": { - "summary": "GetDeposit", - "description": "GetDeposit is called by the bidder to get its deposit in the bidder registry.", - "operationId": "Bidder_GetDeposit", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/v1DepositResponse" + "/v1/bidder/get_deposit" : { + "get" : { + "summary" : "GetDeposit", + "description" : "GetDeposit is called by the bidder to get its deposit in the bidder registry.", + "operationId" : "Bidder_GetDeposit", + "responses" : { + "200" : { + "description" : "A successful response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/v1DepositResponse" } } } }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/googlerpcStatus" + "default" : { + "description" : "An unexpected error response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/googlerpcStatus" } } } } }, - "parameters": [ - { - "name": "windowNumber", - "description": "Optional window number for querying deposits. If not specified, the current block number is used.", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "uint64" - } + "parameters" : [ { + "name" : "windowNumber", + "description" : "Optional window number for querying deposits. If not specified, the current block number is used.", + "in" : "query", + "required" : false, + "schema" : { + "type" : "string", + "format" : "uint64" } - ] + } ] } }, - "/v1/bidder/get_min_deposit": { - "get": { - "summary": "GetMinDeposit", - "description": "GetMinDeposit is called by the bidder to get the minimum deposit required in the bidder registry to make bids.", - "operationId": "Bidder_GetMinDeposit", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/v1DepositResponse" + "/v1/bidder/withdraw" : { + "post" : { + "summary" : "Withdraw", + "description" : "Withdraw is called by the bidder to withdraw deposit from the bidder registry.", + "operationId" : "Bidder_Withdraw", + "responses" : { + "200" : { + "description" : "A successful response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/v1WithdrawResponse" } } } }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/googlerpcStatus" + "default" : { + "description" : "An unexpected error response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/googlerpcStatus" } } } } - } + }, + "parameters" : [ { + "name" : "windowNumber", + "description" : "Optional window number for withdrawing deposits. If not specified, the last window number is used.", + "in" : "query", + "required" : false, + "schema" : { + "type" : "string", + "format" : "uint64" + } + } ] } }, - "/v1/bidder/withdraw": { - "post": { - "summary": "Withdraw", - "description": "Withdraw is called by the bidder to withdraw deposit from the bidder registry.", - "operationId": "Bidder_Withdraw", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/v1WithdrawResponse" + "/v1/bidder/withdraw_from_specific_windows" : { + "post" : { + "summary" : "WithdrawFromSpecificWindows", + "description" : "WithdrawFromSpecificWindows is called by the bidder node to withdraw funds from specific windows.", + "operationId" : "Bidder_WithdrawFromSpecificWindows", + "responses" : { + "200" : { + "description" : "A successful response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/v1AutoDepositResponse" } } } }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/googlerpcStatus" + "default" : { + "description" : "An unexpected error response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/googlerpcStatus" } } } } }, - "parameters": [ - { - "name": "windowNumber", - "description": "Optional window number for withdrawing deposits. If not specified, the last window number is used.", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "uint64" + "parameters" : [ { + "name" : "windowNumbers", + "description" : "Window numbers for withdrawing deposits.", + "in" : "query", + "required" : true, + "explode" : true, + "schema" : { + "type" : "array", + "items" : { + "type" : "string", + "format" : "uint64" } } - ] + } ] } } }, - "components": { - "schemas": { - "bidderapiv1Bid": { - "type": "object", - "example": { - "amount": "1000000000000000000", - "block_number": 123456, - "tx_hashes": [ - "fe4cb47db3630551beedfbd02a71ecc69fd59758e2ba699606e2d5c74284ffa7", - "71c1348f2d7ff7e814f9c3617983703435ea7446de420aeac488bf1de35737e8" - ] + "components" : { + "schemas" : { + "bidderapiv1AutoDeposit" : { + "type" : "object", + "properties" : { + "amount" : { + "type" : "string" + }, + "windowNumber" : { + "type" : "string", + "format" : "uint64" + } + } + }, + "bidderapiv1Bid" : { + "type" : "object", + "example" : { + "amount" : "1000000000000000000", + "block_number" : 123456, + "tx_hashes" : [ "fe4cb47db3630551beedfbd02a71ecc69fd59758e2ba699606e2d5c74284ffa7", "71c1348f2d7ff7e814f9c3617983703435ea7446de420aeac488bf1de35737e8" ] }, - "properties": { - "txHashes": { - "type": "array", - "items": { - "type": "string", - "pattern": "[a-fA-F0-9]{64}" + "properties" : { + "txHashes" : { + "type" : "array", + "items" : { + "type" : "string", + "pattern" : "[a-fA-F0-9]{64}" }, - "description": "Hex string encoding of the hashes of the transactions that the bidder wants to include in the block." + "description" : "Hex string encoding of the hashes of the transactions that the bidder wants to include in the block." }, - "amount": { - "type": "string", - "description": "Amount of ETH that the bidder is willing to pay to the provider for including the transaction in the block.", - "pattern": "[0-9]+" + "amount" : { + "type" : "string", + "description" : "Amount of ETH that the bidder is willing to pay to the provider for including the transaction in the block.", + "pattern" : "[0-9]+" }, - "blockNumber": { - "type": "string", - "format": "int64", - "description": "Max block number that the bidder wants to include the transaction in." + "blockNumber" : { + "type" : "string", + "format" : "int64", + "description" : "Max block number that the bidder wants to include the transaction in." }, - "decayStartTimestamp": { - "type": "string", - "format": "int64", - "description": "Timestamp at which the bid starts decaying." + "decayStartTimestamp" : { + "type" : "string", + "format" : "int64", + "description" : "Timestamp at which the bid starts decaying." }, - "decayEndTimestamp": { - "type": "string", - "format": "int64", - "description": "Timestamp at which the bid ends decaying." + "decayEndTimestamp" : { + "type" : "string", + "format" : "int64", + "description" : "Timestamp at which the bid ends decaying." } }, - "description": "Unsigned bid message from bidders to the bidder mev-commit node.", - "title": "Bid message", - "required": ["txHashes", "amount", "blockNumber"] + "description" : "Unsigned bid message from bidders to the bidder mev-commit node.", + "title" : "Bid message", + "required" : [ "txHashes", "amount", "blockNumber" ] }, - "googlerpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" + "googlerpcStatus" : { + "type" : "object", + "properties" : { + "code" : { + "type" : "integer", + "format" : "int32" }, - "message": { - "type": "string" + "message" : { + "type" : "string" }, - "details": { - "type": "array", - "items": { - "$ref": "#/components/schemas/protobufAny" + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/protobufAny" } } } }, - "protobufAny": { - "type": "object", - "properties": { - "@type": { - "type": "string" + "protobufAny" : { + "type" : "object", + "properties" : { + "@type" : { + "type" : "string" + } + }, + "additionalProperties" : { } + }, + "v1AutoDepositResponse" : { + "type" : "object", + "example" : [ { + "amount" : "1000000000000000000", + "window_number" : 1 + }, { + "amount" : "1000000000000000000", + "window_number" : 2 + }, { + "amount" : "1000000000000000000", + "window_number" : 3 + } ], + "properties" : { + "amountsAndWindowNumbers" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/bidderapiv1AutoDeposit" + } + } + }, + "description" : "AutoDeposit deposit from the bidder registry.", + "title" : "AutoDeposit response" + }, + "v1AutoDepositStatusResponse" : { + "type" : "object", + "example" : { + "amounts_and_window_numbers" : [ { + "amount" : "1000000000000000000", + "window_number" : 1 + }, { + "amount" : "1000000000000000000", + "window_number" : 2 + }, { + "amount" : "1000000000000000000", + "window_number" : 3 + } ], + "isWorking" : true + }, + "properties" : { + "amountsAndWindowNumbers" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/bidderapiv1AutoDeposit" + } + }, + "isWorking" : { + "type" : "boolean" + } + }, + "description" : "AutoDeposit deposit from the bidder registry.", + "title" : "AutoDeposit response" + }, + "v1CancelAutoDepositResponse" : { + "type" : "object", + "example" : { + "window_numbers" : [ 1, 2, 3 ] + }, + "properties" : { + "windowNumbers" : { + "type" : "array", + "items" : { + "type" : "string", + "format" : "uint64" + } } }, - "additionalProperties": {} + "description" : "CancelAutoDeposit deposit from the bidder registry.", + "title" : "CancelAutoDeposit response" }, - "v1Commitment": { - "type": "object", - "properties": { - "txHashes": { - "type": "array", - "items": { - "type": "string", - "pattern": "[a-fA-F0-9]{64}" + "v1Commitment" : { + "type" : "object", + "properties" : { + "txHashes" : { + "type" : "array", + "items" : { + "type" : "string", + "pattern" : "[a-fA-F0-9]{64}" }, - "description": "Hex string encoding of the hash of the transaction that the bidder wants to include in the block." + "description" : "Hex string encoding of the hash of the transaction that the bidder wants to include in the block." }, - "bidAmount": { - "type": "string", - "description": "Amount of ETH that the bidder has agreed to pay to the provider for including the transaction in the block." + "bidAmount" : { + "type" : "string", + "description" : "Amount of ETH that the bidder has agreed to pay to the provider for including the transaction in the block." }, - "blockNumber": { - "type": "string", - "format": "int64", - "description": "Max block number that the bidder wants to include the transaction in." + "blockNumber" : { + "type" : "string", + "format" : "int64", + "description" : "Max block number that the bidder wants to include the transaction in." }, - "receivedBidDigest": { - "type": "string", - "description": "Hex string encoding of digest of the bid message signed by the bidder." + "receivedBidDigest" : { + "type" : "string", + "description" : "Hex string encoding of digest of the bid message signed by the bidder." }, - "receivedBidSignature": { - "type": "string", - "description": "Hex string encoding of signature of the bidder that sent this bid." + "receivedBidSignature" : { + "type" : "string", + "description" : "Hex string encoding of signature of the bidder that sent this bid." }, - "commitmentDigest": { - "type": "string", - "description": "Hex string encoding of digest of the commitment." + "commitmentDigest" : { + "type" : "string", + "description" : "Hex string encoding of digest of the commitment." }, - "commitmentSignature": { - "type": "string", - "description": "Hex string encoding of signature of the commitment signed by the provider confirming this transaction." + "commitmentSignature" : { + "type" : "string", + "description" : "Hex string encoding of signature of the commitment signed by the provider confirming this transaction." }, - "providerAddress": { - "type": "string", - "description": "Hex string encoding of the address of the provider that signed the commitment signature." + "providerAddress" : { + "type" : "string", + "description" : "Hex string encoding of the address of the provider that signed the commitment signature." }, - "decayStartTimestamp": { - "type": "string", - "format": "int64", - "description": "Timestamp at which the bid starts decaying." + "decayStartTimestamp" : { + "type" : "string", + "format" : "int64", + "description" : "Timestamp at which the bid starts decaying." }, - "decayEndTimestamp": { - "type": "string", - "format": "int64", - "description": "Timestamp at which the bid ends decaying." + "decayEndTimestamp" : { + "type" : "string", + "format" : "int64", + "description" : "Timestamp at which the bid ends decaying." }, - "dispatchTimestamp": { - "type": "string", - "format": "int64", - "description": "Timestamp at which the commitment is published." + "dispatchTimestamp" : { + "type" : "string", + "format" : "int64", + "description" : "Timestamp at which the commitment is published." } } }, - "v1DepositResponse": { - "type": "object", - "example": { - "amount": "1000000000000000000", - "window_number": 1 + "v1DepositResponse" : { + "type" : "object", + "example" : { + "amount" : "1000000000000000000", + "window_number" : 1 }, - "properties": { - "amount": { - "type": "string" + "properties" : { + "amount" : { + "type" : "string" }, - "windowNumber": { - "type": "string", - "format": "uint64" + "windowNumber" : { + "type" : "string", + "format" : "uint64" } }, - "description": "Get deposit for bidder in the bidder registry.", - "title": "Deposit response" + "description" : "Get deposit for bidder in the bidder registry.", + "title" : "Deposit response" }, - "v1WithdrawResponse": { - "type": "object", - "example": { - "amount": "1000000000000000000", - "window_number": 1 + "v1WithdrawResponse" : { + "type" : "object", + "example" : { + "amount" : "1000000000000000000", + "window_number" : 1 }, - "properties": { - "amount": { - "type": "string" + "properties" : { + "amount" : { + "type" : "string" }, - "windowNumber": { - "type": "string", - "format": "uint64" + "windowNumber" : { + "type" : "string", + "format" : "uint64" } }, - "description": "Withdraw deposit from the bidder registry.", - "title": "Withdraw response" + "description" : "Withdraw deposit from the bidder registry.", + "title" : "Withdraw response" } } } -} +} \ No newline at end of file diff --git a/get-started/bidders/bidder-node-commands.mdx b/get-started/bidders/bidder-node-commands.mdx index cf5e0b1c..803abd66 100644 --- a/get-started/bidders/bidder-node-commands.mdx +++ b/get-started/bidders/bidder-node-commands.mdx @@ -37,8 +37,72 @@ This command will allow you to withdraw funds from the specific [window](/concep Window number is the number where the bidder deposited funds. ```shell ❯_ terminal -cast send 0x7ffa86fF89489Bca72Fec2a978e33f9870B2Bd25 "withdrawBidderAmountFromWindow(address,uint256)" $ADDRESS \ ---rpc-url https://chainrpc.testnet.mev-commit.xyz --private-key $KEY +curl -X POST http://localhost:13523/v1/bidder/withdraw?windowNumber=1 \ +``` + +## Autodeposit Funds + +The auto deposit feature allows you to automate the process of depositing funds for multiple windows ahead. This is useful for ensuring your bidder account always has funds available for future windows. + +Autodeposit will split the initial deposit amount across the specified number of windows. The deposit amount is the total amount to be deposited across all windows. Currently default amount of windows is 3. + +By setting up auto deposit, you can deposit funds for a specific window and automate the process for subsequent windows, reducing the need for manual intervention. + +The withdrawal functionality allows you to withdraw deposited funds from specific windows. This can be useful if you need to reclaim funds that were previously deposited. + +## Start Auto Deposit + +To start the auto deposit process: + +```shell ❯_ terminal +curl -X POST http://localhost:13523/v1/bidder/auto_deposit \ + -H "Content-Type: application/json" \ + -d '{ + "amount": "1000000000000000000", + "windowNumber": 3 + }' +``` + +## Get Auto Deposit Status + +To get the status of the auto deposit process: + +```shell ❯_ terminal +curl -s http://localhost:13523/v1/bidder/auto_deposit_status +``` + +## Cancel Auto Deposit + +To cancel the auto deposit process: + +```shell ❯_ terminal +curl -X POST http://localhost:13523/v1/bidder/cancel_auto_deposit +``` + +This will stop the ongoing auto deposit process. + +## Cancel And Withdraw Auto Deposit + +To cancel the auto deposit process and withdraw the funds: + +```shell ❯_ terminal +curl -X POST http://localhost:13523/v1/bidder/cancel_and_withdraw_auto_deposit +``` + +This will stop the ongoing auto deposit process and withdraw the funds deposited for the current windows. + +The funds will be withdrawn when the current window is greater than the last window for which funds were deposited. + +## Withdraw Funds + +To withdraw funds from the several windows, you can use the following command: + +```shell ❯_ terminal +curl -X POST http://localhost:13523/v1/bidder/withdraw_from_specific_windows + -H "Content-Type: application/json" \ + -d '{ + "windows": [1, 2, 3] + }' ``` ## Checking the Balance of your Wallet From 37310f1b40eb5da15633546691823f1532a7aa45 Mon Sep 17 00:00:00 2001 From: Mikhail Wall Date: Fri, 28 Jun 2024 21:10:42 +0200 Subject: [PATCH 2/7] fix: fix formatting for bidder-openapi-spec.json --- bidder-openapi-spec.json | 953 ++++++++++++++++++++------------------- 1 file changed, 489 insertions(+), 464 deletions(-) diff --git a/bidder-openapi-spec.json b/bidder-openapi-spec.json index ceaf4be0..be11d138 100644 --- a/bidder-openapi-spec.json +++ b/bidder-openapi-spec.json @@ -1,92 +1,96 @@ { - "openapi" : "3.0.0", - "info" : { - "title" : "Bidder API", - "version" : "1.0.0-alpha-oas3", - "license" : { - "name" : "Business Source License 1.1", - "url" : "https://github.com/primev/mev-commit/blob/main/LICENSE" + "openapi": "3.0.0", + "info": { + "title": "Bidder API", + "version": "1.0.0-alpha-oas3", + "license": { + "name": "Business Source License 1.1", + "url": "https://github.com/primev/mev-commit/blob/main/LICENSE" } }, - "paths" : { - "/v1/bidder/auto_deposit/{amount}" : { - "post" : { - "summary" : "AutoDeposit", - "description" : "AutoDeposit is called by the bidder node to add deposit in the bidder registry and move funds automatily from one window to another.", - "operationId" : "Bidder_AutoDeposit", - "responses" : { - "200" : { - "description" : "A successful response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/v1AutoDepositResponse" + "paths": { + "/v1/bidder/auto_deposit/{amount}": { + "post": { + "summary": "AutoDeposit", + "description": "AutoDeposit is called by the bidder node to add deposit in the bidder registry and move funds automatily from one window to another.", + "operationId": "Bidder_AutoDeposit", + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1AutoDepositResponse" } } } }, - "default" : { - "description" : "An unexpected error response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/googlerpcStatus" + "default": { + "description": "An unexpected error response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/googlerpcStatus" } } } } }, - "parameters" : [ { - "name" : "amount", - "description" : "Amount of ETH to be deposited in wei.", - "in" : "path", - "required" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "windowNumber", - "description" : "Optional window number for querying deposit. If not specified, the current block number is used.", - "in" : "query", - "required" : false, - "schema" : { - "type" : "string", - "format" : "uint64" - } - }, { - "name" : "blockNumber", - "description" : "Optional block number for querying deposit. If specified, calculate window based on this block number.", - "in" : "query", - "required" : false, - "schema" : { - "type" : "string", - "format" : "uint64" + "parameters": [ + { + "name": "amount", + "description": "Amount of ETH to be deposited in wei.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "windowNumber", + "description": "Optional window number for querying deposit. If not specified, the current block number is used.", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "uint64" + } + }, + { + "name": "blockNumber", + "description": "Optional block number for querying deposit. If specified, calculate window based on this block number.", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "uint64" + } } - } ] + ] } }, - "/v1/bidder/auto_deposit_status" : { - "get" : { - "summary" : "AutoDepositStatus", - "description" : "AutoDepositStatus is called by the bidder node to get the status of the auto deposit.", - "operationId" : "Bidder_AutoDepositStatus", - "responses" : { - "200" : { - "description" : "A successful response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/v1AutoDepositStatusResponse" + "/v1/bidder/auto_deposit_status": { + "get": { + "summary": "AutoDepositStatus", + "description": "AutoDepositStatus is called by the bidder node to get the status of the auto deposit.", + "operationId": "Bidder_AutoDepositStatus", + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1AutoDepositStatusResponse" } } } }, - "default" : { - "description" : "An unexpected error response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/googlerpcStatus" + "default": { + "description": "An unexpected error response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/googlerpcStatus" } } } @@ -94,77 +98,77 @@ } } }, - "/v1/bidder/bid" : { - "post" : { - "summary" : "SendBid", - "description" : "Send a bid to the bidder mev-commit node.", - "operationId" : "Bidder_SendBid", - "responses" : { - "200" : { - "description" : "A successful response.(streaming responses)", - "content" : { - "application/json" : { - "schema" : { - "type" : "object", - "properties" : { - "result" : { - "$ref" : "#/components/schemas/v1Commitment" + "/v1/bidder/bid": { + "post": { + "summary": "SendBid", + "description": "Send a bid to the bidder mev-commit node.", + "operationId": "Bidder_SendBid", + "responses": { + "200": { + "description": "A successful response.(streaming responses)", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "result": { + "$ref": "#/components/schemas/v1Commitment" }, - "error" : { - "$ref" : "#/components/schemas/googlerpcStatus" + "error": { + "$ref": "#/components/schemas/googlerpcStatus" } }, - "title" : "Stream result of v1Commitment" + "title": "Stream result of v1Commitment" } } } }, - "default" : { - "description" : "An unexpected error response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/googlerpcStatus" + "default": { + "description": "An unexpected error response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/googlerpcStatus" } } } } }, - "requestBody" : { - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/bidderapiv1Bid" + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/bidderapiv1Bid" } } }, - "description" : "Unsigned bid message from bidders to the bidder mev-commit node.", - "required" : true + "description": "Unsigned bid message from bidders to the bidder mev-commit node.", + "required": true } } }, - "/v1/bidder/cancel_and_withdraw_auto_deposit" : { - "post" : { - "summary" : "CancelAndWithdrawAutoDeposit", - "description" : "CancelAndWithdrawAutoDeposit is called by the bidder node to cancel the auto deposit and withdraw the funds.", - "operationId" : "Bidder_CancelAndWithdrawAutoDeposit", - "responses" : { - "200" : { - "description" : "A successful response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/v1CancelAutoDepositResponse" + "/v1/bidder/cancel_and_withdraw_auto_deposit": { + "post": { + "summary": "CancelAndWithdrawAutoDeposit", + "description": "CancelAndWithdrawAutoDeposit is called by the bidder node to cancel the auto deposit and withdraw the funds.", + "operationId": "Bidder_CancelAndWithdrawAutoDeposit", + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1CancelAutoDepositResponse" } } } }, - "default" : { - "description" : "An unexpected error response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/googlerpcStatus" + "default": { + "description": "An unexpected error response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/googlerpcStatus" } } } @@ -172,28 +176,28 @@ } } }, - "/v1/bidder/cancel_auto_deposit" : { - "post" : { - "summary" : "CancelAutoDeposit", - "description" : "CancelAutoDeposit is called by the bidder node to cancel the auto deposit.", - "operationId" : "Bidder_CancelAutoDeposit", - "responses" : { - "200" : { - "description" : "A successful response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/v1CancelAutoDepositResponse" + "/v1/bidder/cancel_auto_deposit": { + "post": { + "summary": "CancelAutoDeposit", + "description": "CancelAutoDeposit is called by the bidder node to cancel the auto deposit.", + "operationId": "Bidder_CancelAutoDeposit", + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1CancelAutoDepositResponse" } } } }, - "default" : { - "description" : "An unexpected error response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/googlerpcStatus" + "default": { + "description": "An unexpected error response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/googlerpcStatus" } } } @@ -201,428 +205,449 @@ } } }, - "/v1/bidder/deposit/{amount}" : { - "post" : { - "summary" : "Deposit", - "description" : "Deposit is called by the bidder node to add deposit in the bidder registry.", - "operationId" : "Bidder_Deposit", - "responses" : { - "200" : { - "description" : "A successful response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/v1DepositResponse" + "/v1/bidder/deposit/{amount}": { + "post": { + "summary": "Deposit", + "description": "Deposit is called by the bidder node to add deposit in the bidder registry.", + "operationId": "Bidder_Deposit", + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1DepositResponse" } } } }, - "default" : { - "description" : "An unexpected error response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/googlerpcStatus" + "default": { + "description": "An unexpected error response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/googlerpcStatus" } } } } }, - "parameters" : [ { - "name" : "amount", - "description" : "Amount of ETH to be deposited in wei.", - "in" : "path", - "required" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "windowNumber", - "description" : "Optional window number for querying deposit. If not specified, the current block number is used.", - "in" : "query", - "required" : false, - "schema" : { - "type" : "string", - "format" : "uint64" - } - }, { - "name" : "blockNumber", - "description" : "Optional block number for querying deposit. If specified, calculate window based on this block number.", - "in" : "query", - "required" : false, - "schema" : { - "type" : "string", - "format" : "uint64" + "parameters": [ + { + "name": "amount", + "description": "Amount of ETH to be deposited in wei.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "windowNumber", + "description": "Optional window number for querying deposit. If not specified, the current block number is used.", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "uint64" + } + }, + { + "name": "blockNumber", + "description": "Optional block number for querying deposit. If specified, calculate window based on this block number.", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "uint64" + } } - } ] + ] } }, - "/v1/bidder/get_deposit" : { - "get" : { - "summary" : "GetDeposit", - "description" : "GetDeposit is called by the bidder to get its deposit in the bidder registry.", - "operationId" : "Bidder_GetDeposit", - "responses" : { - "200" : { - "description" : "A successful response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/v1DepositResponse" + "/v1/bidder/get_deposit": { + "get": { + "summary": "GetDeposit", + "description": "GetDeposit is called by the bidder to get its deposit in the bidder registry.", + "operationId": "Bidder_GetDeposit", + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1DepositResponse" } } } }, - "default" : { - "description" : "An unexpected error response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/googlerpcStatus" + "default": { + "description": "An unexpected error response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/googlerpcStatus" } } } } }, - "parameters" : [ { - "name" : "windowNumber", - "description" : "Optional window number for querying deposits. If not specified, the current block number is used.", - "in" : "query", - "required" : false, - "schema" : { - "type" : "string", - "format" : "uint64" + "parameters": [ + { + "name": "windowNumber", + "description": "Optional window number for querying deposits. If not specified, the current block number is used.", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "uint64" + } } - } ] + ] } }, - "/v1/bidder/withdraw" : { - "post" : { - "summary" : "Withdraw", - "description" : "Withdraw is called by the bidder to withdraw deposit from the bidder registry.", - "operationId" : "Bidder_Withdraw", - "responses" : { - "200" : { - "description" : "A successful response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/v1WithdrawResponse" + "/v1/bidder/withdraw": { + "post": { + "summary": "Withdraw", + "description": "Withdraw is called by the bidder to withdraw deposit from the bidder registry.", + "operationId": "Bidder_Withdraw", + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1WithdrawResponse" } } } }, - "default" : { - "description" : "An unexpected error response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/googlerpcStatus" + "default": { + "description": "An unexpected error response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/googlerpcStatus" } } } } }, - "parameters" : [ { - "name" : "windowNumber", - "description" : "Optional window number for withdrawing deposits. If not specified, the last window number is used.", - "in" : "query", - "required" : false, - "schema" : { - "type" : "string", - "format" : "uint64" + "parameters": [ + { + "name": "windowNumber", + "description": "Optional window number for withdrawing deposits. If not specified, the last window number is used.", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "uint64" + } } - } ] + ] } }, - "/v1/bidder/withdraw_from_specific_windows" : { - "post" : { - "summary" : "WithdrawFromSpecificWindows", - "description" : "WithdrawFromSpecificWindows is called by the bidder node to withdraw funds from specific windows.", - "operationId" : "Bidder_WithdrawFromSpecificWindows", - "responses" : { - "200" : { - "description" : "A successful response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/v1AutoDepositResponse" + "/v1/bidder/withdraw_from_specific_windows": { + "post": { + "summary": "WithdrawFromSpecificWindows", + "description": "WithdrawFromSpecificWindows is called by the bidder node to withdraw funds from specific windows.", + "operationId": "Bidder_WithdrawFromSpecificWindows", + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1AutoDepositResponse" } } } }, - "default" : { - "description" : "An unexpected error response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/googlerpcStatus" + "default": { + "description": "An unexpected error response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/googlerpcStatus" } } } } }, - "parameters" : [ { - "name" : "windowNumbers", - "description" : "Window numbers for withdrawing deposits.", - "in" : "query", - "required" : true, - "explode" : true, - "schema" : { - "type" : "array", - "items" : { - "type" : "string", - "format" : "uint64" + "parameters": [ + { + "name": "windowNumbers", + "description": "Window numbers for withdrawing deposits.", + "in": "query", + "required": true, + "explode": true, + "schema": { + "type": "array", + "items": { + "type": "string", + "format": "uint64" + } } } - } ] + ] } } }, - "components" : { - "schemas" : { - "bidderapiv1AutoDeposit" : { - "type" : "object", - "properties" : { - "amount" : { - "type" : "string" - }, - "windowNumber" : { - "type" : "string", - "format" : "uint64" + "components": { + "schemas": { + "bidderapiv1AutoDeposit": { + "type": "object", + "properties": { + "amount": { + "type": "string" + }, + "windowNumber": { + "type": "string", + "format": "uint64" } } }, - "bidderapiv1Bid" : { - "type" : "object", - "example" : { - "amount" : "1000000000000000000", - "block_number" : 123456, - "tx_hashes" : [ "fe4cb47db3630551beedfbd02a71ecc69fd59758e2ba699606e2d5c74284ffa7", "71c1348f2d7ff7e814f9c3617983703435ea7446de420aeac488bf1de35737e8" ] + "bidderapiv1Bid": { + "type": "object", + "example": { + "amount": "1000000000000000000", + "block_number": 123456, + "tx_hashes": [ + "fe4cb47db3630551beedfbd02a71ecc69fd59758e2ba699606e2d5c74284ffa7", + "71c1348f2d7ff7e814f9c3617983703435ea7446de420aeac488bf1de35737e8" + ] }, - "properties" : { - "txHashes" : { - "type" : "array", - "items" : { - "type" : "string", - "pattern" : "[a-fA-F0-9]{64}" + "properties": { + "txHashes": { + "type": "array", + "items": { + "type": "string", + "pattern": "[a-fA-F0-9]{64}" }, - "description" : "Hex string encoding of the hashes of the transactions that the bidder wants to include in the block." - }, - "amount" : { - "type" : "string", - "description" : "Amount of ETH that the bidder is willing to pay to the provider for including the transaction in the block.", - "pattern" : "[0-9]+" - }, - "blockNumber" : { - "type" : "string", - "format" : "int64", - "description" : "Max block number that the bidder wants to include the transaction in." - }, - "decayStartTimestamp" : { - "type" : "string", - "format" : "int64", - "description" : "Timestamp at which the bid starts decaying." - }, - "decayEndTimestamp" : { - "type" : "string", - "format" : "int64", - "description" : "Timestamp at which the bid ends decaying." + "description": "Hex string encoding of the hashes of the transactions that the bidder wants to include in the block." + }, + "amount": { + "type": "string", + "description": "Amount of ETH that the bidder is willing to pay to the provider for including the transaction in the block.", + "pattern": "[0-9]+" + }, + "blockNumber": { + "type": "string", + "format": "int64", + "description": "Max block number that the bidder wants to include the transaction in." + }, + "decayStartTimestamp": { + "type": "string", + "format": "int64", + "description": "Timestamp at which the bid starts decaying." + }, + "decayEndTimestamp": { + "type": "string", + "format": "int64", + "description": "Timestamp at which the bid ends decaying." } }, - "description" : "Unsigned bid message from bidders to the bidder mev-commit node.", - "title" : "Bid message", - "required" : [ "txHashes", "amount", "blockNumber" ] + "description": "Unsigned bid message from bidders to the bidder mev-commit node.", + "title": "Bid message", + "required": ["txHashes", "amount", "blockNumber"] }, - "googlerpcStatus" : { - "type" : "object", - "properties" : { - "code" : { - "type" : "integer", - "format" : "int32" + "googlerpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" }, - "message" : { - "type" : "string" + "message": { + "type": "string" }, - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/protobufAny" + "details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/protobufAny" } } } }, - "protobufAny" : { - "type" : "object", - "properties" : { - "@type" : { - "type" : "string" + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" } }, - "additionalProperties" : { } + "additionalProperties": {} }, - "v1AutoDepositResponse" : { - "type" : "object", - "example" : [ { - "amount" : "1000000000000000000", - "window_number" : 1 - }, { - "amount" : "1000000000000000000", - "window_number" : 2 - }, { - "amount" : "1000000000000000000", - "window_number" : 3 - } ], - "properties" : { - "amountsAndWindowNumbers" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/bidderapiv1AutoDeposit" + "v1AutoDepositResponse": { + "type": "object", + "example": [ + { + "amount": "1000000000000000000", + "window_number": 1 + }, + { + "amount": "1000000000000000000", + "window_number": 2 + }, + { + "amount": "1000000000000000000", + "window_number": 3 + } + ], + "properties": { + "amountsAndWindowNumbers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/bidderapiv1AutoDeposit" } } }, - "description" : "AutoDeposit deposit from the bidder registry.", - "title" : "AutoDeposit response" + "description": "AutoDeposit deposit from the bidder registry.", + "title": "AutoDeposit response" }, - "v1AutoDepositStatusResponse" : { - "type" : "object", - "example" : { - "amounts_and_window_numbers" : [ { - "amount" : "1000000000000000000", - "window_number" : 1 - }, { - "amount" : "1000000000000000000", - "window_number" : 2 - }, { - "amount" : "1000000000000000000", - "window_number" : 3 - } ], - "isWorking" : true + "v1AutoDepositStatusResponse": { + "type": "object", + "example": { + "amounts_and_window_numbers": [ + { + "amount": "1000000000000000000", + "window_number": 1 + }, + { + "amount": "1000000000000000000", + "window_number": 2 + }, + { + "amount": "1000000000000000000", + "window_number": 3 + } + ], + "isWorking": true }, - "properties" : { - "amountsAndWindowNumbers" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/bidderapiv1AutoDeposit" + "properties": { + "amountsAndWindowNumbers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/bidderapiv1AutoDeposit" } }, - "isWorking" : { - "type" : "boolean" + "isWorking": { + "type": "boolean" } }, - "description" : "AutoDeposit deposit from the bidder registry.", - "title" : "AutoDeposit response" + "description": "AutoDeposit deposit from the bidder registry.", + "title": "AutoDeposit response" }, - "v1CancelAutoDepositResponse" : { - "type" : "object", - "example" : { - "window_numbers" : [ 1, 2, 3 ] + "v1CancelAutoDepositResponse": { + "type": "object", + "example": { + "window_numbers": [1, 2, 3] }, - "properties" : { - "windowNumbers" : { - "type" : "array", - "items" : { - "type" : "string", - "format" : "uint64" + "properties": { + "windowNumbers": { + "type": "array", + "items": { + "type": "string", + "format": "uint64" } } }, - "description" : "CancelAutoDeposit deposit from the bidder registry.", - "title" : "CancelAutoDeposit response" + "description": "CancelAutoDeposit deposit from the bidder registry.", + "title": "CancelAutoDeposit response" }, - "v1Commitment" : { - "type" : "object", - "properties" : { - "txHashes" : { - "type" : "array", - "items" : { - "type" : "string", - "pattern" : "[a-fA-F0-9]{64}" + "v1Commitment": { + "type": "object", + "properties": { + "txHashes": { + "type": "array", + "items": { + "type": "string", + "pattern": "[a-fA-F0-9]{64}" }, - "description" : "Hex string encoding of the hash of the transaction that the bidder wants to include in the block." - }, - "bidAmount" : { - "type" : "string", - "description" : "Amount of ETH that the bidder has agreed to pay to the provider for including the transaction in the block." - }, - "blockNumber" : { - "type" : "string", - "format" : "int64", - "description" : "Max block number that the bidder wants to include the transaction in." - }, - "receivedBidDigest" : { - "type" : "string", - "description" : "Hex string encoding of digest of the bid message signed by the bidder." - }, - "receivedBidSignature" : { - "type" : "string", - "description" : "Hex string encoding of signature of the bidder that sent this bid." - }, - "commitmentDigest" : { - "type" : "string", - "description" : "Hex string encoding of digest of the commitment." - }, - "commitmentSignature" : { - "type" : "string", - "description" : "Hex string encoding of signature of the commitment signed by the provider confirming this transaction." - }, - "providerAddress" : { - "type" : "string", - "description" : "Hex string encoding of the address of the provider that signed the commitment signature." - }, - "decayStartTimestamp" : { - "type" : "string", - "format" : "int64", - "description" : "Timestamp at which the bid starts decaying." - }, - "decayEndTimestamp" : { - "type" : "string", - "format" : "int64", - "description" : "Timestamp at which the bid ends decaying." - }, - "dispatchTimestamp" : { - "type" : "string", - "format" : "int64", - "description" : "Timestamp at which the commitment is published." + "description": "Hex string encoding of the hash of the transaction that the bidder wants to include in the block." + }, + "bidAmount": { + "type": "string", + "description": "Amount of ETH that the bidder has agreed to pay to the provider for including the transaction in the block." + }, + "blockNumber": { + "type": "string", + "format": "int64", + "description": "Max block number that the bidder wants to include the transaction in." + }, + "receivedBidDigest": { + "type": "string", + "description": "Hex string encoding of digest of the bid message signed by the bidder." + }, + "receivedBidSignature": { + "type": "string", + "description": "Hex string encoding of signature of the bidder that sent this bid." + }, + "commitmentDigest": { + "type": "string", + "description": "Hex string encoding of digest of the commitment." + }, + "commitmentSignature": { + "type": "string", + "description": "Hex string encoding of signature of the commitment signed by the provider confirming this transaction." + }, + "providerAddress": { + "type": "string", + "description": "Hex string encoding of the address of the provider that signed the commitment signature." + }, + "decayStartTimestamp": { + "type": "string", + "format": "int64", + "description": "Timestamp at which the bid starts decaying." + }, + "decayEndTimestamp": { + "type": "string", + "format": "int64", + "description": "Timestamp at which the bid ends decaying." + }, + "dispatchTimestamp": { + "type": "string", + "format": "int64", + "description": "Timestamp at which the commitment is published." } } }, - "v1DepositResponse" : { - "type" : "object", - "example" : { - "amount" : "1000000000000000000", - "window_number" : 1 + "v1DepositResponse": { + "type": "object", + "example": { + "amount": "1000000000000000000", + "window_number": 1 }, - "properties" : { - "amount" : { - "type" : "string" + "properties": { + "amount": { + "type": "string" }, - "windowNumber" : { - "type" : "string", - "format" : "uint64" + "windowNumber": { + "type": "string", + "format": "uint64" } }, - "description" : "Get deposit for bidder in the bidder registry.", - "title" : "Deposit response" + "description": "Get deposit for bidder in the bidder registry.", + "title": "Deposit response" }, - "v1WithdrawResponse" : { - "type" : "object", - "example" : { - "amount" : "1000000000000000000", - "window_number" : 1 + "v1WithdrawResponse": { + "type": "object", + "example": { + "amount": "1000000000000000000", + "window_number": 1 }, - "properties" : { - "amount" : { - "type" : "string" + "properties": { + "amount": { + "type": "string" }, - "windowNumber" : { - "type" : "string", - "format" : "uint64" + "windowNumber": { + "type": "string", + "format": "uint64" } }, - "description" : "Withdraw deposit from the bidder registry.", - "title" : "Withdraw response" + "description": "Withdraw deposit from the bidder registry.", + "title": "Withdraw response" } } } -} \ No newline at end of file +} From 8cac9757fd71c586fce91d5d589d8106d8d7e410 Mon Sep 17 00:00:00 2001 From: Mikhail Wall Date: Fri, 28 Jun 2024 22:04:28 +0200 Subject: [PATCH 3/7] chore: updated bid api --- api-reference/bidder/autodeposit.mdx | 4 ++++ api-reference/bidder/autodepositstatus.mdx | 4 ++++ api-reference/bidder/cancelandwithdrawad.mdx | 4 ++++ api-reference/bidder/cancelautodeposit.mdx | 4 ++++ api-reference/bidder/getmindeposit.mdx | 4 ---- api-reference/bidder/withdraw.mdx | 4 ++++ api-reference/bidder/withdrawspecwindows.mdx | 4 ++++ mint.json | 9 +++++++-- 8 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 api-reference/bidder/autodeposit.mdx create mode 100644 api-reference/bidder/autodepositstatus.mdx create mode 100644 api-reference/bidder/cancelandwithdrawad.mdx create mode 100644 api-reference/bidder/cancelautodeposit.mdx delete mode 100644 api-reference/bidder/getmindeposit.mdx create mode 100644 api-reference/bidder/withdraw.mdx create mode 100644 api-reference/bidder/withdrawspecwindows.mdx diff --git a/api-reference/bidder/autodeposit.mdx b/api-reference/bidder/autodeposit.mdx new file mode 100644 index 00000000..f9c296f7 --- /dev/null +++ b/api-reference/bidder/autodeposit.mdx @@ -0,0 +1,4 @@ +--- +title: Add Auto Deposit +openapi: post /v1/bidder/auto_deposit/{amount} +--- \ No newline at end of file diff --git a/api-reference/bidder/autodepositstatus.mdx b/api-reference/bidder/autodepositstatus.mdx new file mode 100644 index 00000000..974ec2ef --- /dev/null +++ b/api-reference/bidder/autodepositstatus.mdx @@ -0,0 +1,4 @@ +--- +title: Get Auto Deposit Status +openapi: get /v1/bidder/auto_deposit_status +--- \ No newline at end of file diff --git a/api-reference/bidder/cancelandwithdrawad.mdx b/api-reference/bidder/cancelandwithdrawad.mdx new file mode 100644 index 00000000..3810d54e --- /dev/null +++ b/api-reference/bidder/cancelandwithdrawad.mdx @@ -0,0 +1,4 @@ +--- +title: Cancel and Withdraw Auto Deposit +openapi: post /v1/bidder/cancel_and_withdraw_auto_deposit +--- \ No newline at end of file diff --git a/api-reference/bidder/cancelautodeposit.mdx b/api-reference/bidder/cancelautodeposit.mdx new file mode 100644 index 00000000..640f4e26 --- /dev/null +++ b/api-reference/bidder/cancelautodeposit.mdx @@ -0,0 +1,4 @@ +--- +title: Cancel Auto Deposit +openapi: post /v1/bidder/cancel_auto_deposit +--- \ No newline at end of file diff --git a/api-reference/bidder/getmindeposit.mdx b/api-reference/bidder/getmindeposit.mdx deleted file mode 100644 index b23f7b7e..00000000 --- a/api-reference/bidder/getmindeposit.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: Retrieve Min Deposit -openapi: get /v1/bidder/get_min_deposit ---- diff --git a/api-reference/bidder/withdraw.mdx b/api-reference/bidder/withdraw.mdx new file mode 100644 index 00000000..8cfb1668 --- /dev/null +++ b/api-reference/bidder/withdraw.mdx @@ -0,0 +1,4 @@ +--- +title: Withdraw Deposit +openapi: post /v1/bidder/withdraw +--- \ No newline at end of file diff --git a/api-reference/bidder/withdrawspecwindows.mdx b/api-reference/bidder/withdrawspecwindows.mdx new file mode 100644 index 00000000..2f269729 --- /dev/null +++ b/api-reference/bidder/withdrawspecwindows.mdx @@ -0,0 +1,4 @@ +--- +title: Withdraw Deposit From Specific Windows +openapi: post /v1/bidder/withdraw_from_specific_windows +--- \ No newline at end of file diff --git a/mint.json b/mint.json index cfffb8c1..df459728 100644 --- a/mint.json +++ b/mint.json @@ -130,8 +130,13 @@ "pages": [ "api-reference/bidder/sendbid", "api-reference/bidder/getdeposit", - "api-reference/bidder/getmindeposit", - "api-reference/bidder/deposit" + "api-reference/bidder/deposit", + "api-reference/bidder/withdraw", + "api-reference/bidder/withdrawspecwindows", + "api-reference/bidder/autodeposit", + "api-reference/bidder/autodepositstatus", + "api-reference/bidder/cancelautodeposit", + "api-reference/bidder/cancelandwithdrawad" ] } ], From 1fee81456c90125545c2083584c8df77aeef02f2 Mon Sep 17 00:00:00 2001 From: Mikhail Wall Date: Wed, 10 Jul 2024 14:51:55 +0200 Subject: [PATCH 4/7] chore: added debug --- api-reference/debug/canceltx.mdx | 4 + api-reference/debug/pendingtxs.mdx | 4 + api-reference/debug/topology.mdx | 4 + bidder-openapi-spec.json | 2 +- debug-openapi-spec.json | 214 +++++++++++++++++++++++++++++ mint.json | 8 ++ provider-openapi-spec.json | 2 +- 7 files changed, 236 insertions(+), 2 deletions(-) create mode 100644 api-reference/debug/canceltx.mdx create mode 100644 api-reference/debug/pendingtxs.mdx create mode 100644 api-reference/debug/topology.mdx create mode 100644 debug-openapi-spec.json diff --git a/api-reference/debug/canceltx.mdx b/api-reference/debug/canceltx.mdx new file mode 100644 index 00000000..e2cf4f24 --- /dev/null +++ b/api-reference/debug/canceltx.mdx @@ -0,0 +1,4 @@ +--- +title: Cancel Transaction +openapi: post /v1/debug/cancel_transaction/{txHash} +--- \ No newline at end of file diff --git a/api-reference/debug/pendingtxs.mdx b/api-reference/debug/pendingtxs.mdx new file mode 100644 index 00000000..791670cc --- /dev/null +++ b/api-reference/debug/pendingtxs.mdx @@ -0,0 +1,4 @@ +--- +title : Pending Transactions +openapi: get /v1/debug/pending_transactions +--- \ No newline at end of file diff --git a/api-reference/debug/topology.mdx b/api-reference/debug/topology.mdx new file mode 100644 index 00000000..f24f44ae --- /dev/null +++ b/api-reference/debug/topology.mdx @@ -0,0 +1,4 @@ +--- +title: Topology +openapi: get /v1/debug/topology +--- \ No newline at end of file diff --git a/bidder-openapi-spec.json b/bidder-openapi-spec.json index be11d138..15c41306 100644 --- a/bidder-openapi-spec.json +++ b/bidder-openapi-spec.json @@ -2,7 +2,7 @@ "openapi": "3.0.0", "info": { "title": "Bidder API", - "version": "1.0.0-alpha-oas3", + "version": "1.0.0", "license": { "name": "Business Source License 1.1", "url": "https://github.com/primev/mev-commit/blob/main/LICENSE" diff --git a/debug-openapi-spec.json b/debug-openapi-spec.json new file mode 100644 index 00000000..f2524c9b --- /dev/null +++ b/debug-openapi-spec.json @@ -0,0 +1,214 @@ +{ + "openapi" : "3.0.0", + "info" : { + "title" : "Debug API", + "version" : "1.0.0", + "license" : { + "name" : "Business Source License 1.1", + "url" : "https://github.com/primev/mev-commit/blob/main/LICENSE" + } + }, + "paths" : { + "/v1/debug/cancel_transaction/{txHash}" : { + "post" : { + "summary" : "CancelTransaction", + "description" : "CancelTransaction is called by the provider to cancel a transaction sent from this wallet.", + "operationId" : "DebugService_CancelTransaction", + "responses" : { + "200" : { + "description" : "A successful response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/v1CancelTransactionResponse" + } + } + } + }, + "default" : { + "description" : "An unexpected error response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/googlerpcStatus" + } + } + } + } + }, + "parameters" : [ { + "name" : "txHash", + "description" : "Hex string encoding of the hash of the transaction that the bidder wants to cancel.", + "in" : "path", + "required" : true, + "schema" : { + "type" : "string" + } + } ] + } + }, + "/v1/debug/pending_transactions" : { + "get" : { + "summary" : "GetPendingTransactions", + "description" : "GetPendingTransactions is called by the provider to get the pending transactions for the wallet.", + "operationId" : "DebugService_GetPendingTransactions", + "responses" : { + "200" : { + "description" : "A successful response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/v1PendingTransactionsResponse" + } + } + } + }, + "default" : { + "description" : "An unexpected error response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/googlerpcStatus" + } + } + } + } + } + } + }, + "/v1/debug/topology" : { + "get" : { + "summary" : "GetTopology", + "description" : "GetTopology is called by the user to get the topology of the node. The topology\nincludes connectivity information about the node.", + "operationId" : "DebugService_GetTopology", + "responses" : { + "200" : { + "description" : "A successful response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/v1TopologyResponse" + } + } + } + }, + "default" : { + "description" : "An unexpected error response.", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/googlerpcStatus" + } + } + } + } + } + } + } + }, + "components" : { + "schemas" : { + "googlerpcStatus" : { + "type" : "object", + "properties" : { + "code" : { + "type" : "integer", + "format" : "int32" + }, + "message" : { + "type" : "string" + }, + "details" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/protobufAny" + } + } + } + }, + "protobufAny" : { + "type" : "object", + "properties" : { + "@type" : { + "type" : "string" + } + }, + "additionalProperties" : { } + }, + "protobufNullValue" : { + "type" : "string", + "description" : "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\nThe JSON representation for `NullValue` is JSON `null`." + }, + "v1CancelTransactionResponse" : { + "type" : "object", + "example" : { + "txHash" : "71c1348f2d7ff7e814f9c3617983703435ea7446de420aeac488bf1de35737e8" + }, + "properties" : { + "txHash" : { + "type" : "string", + "description" : "Hex string encoding of the hash of the transaction that the bidder wants to cancel.", + "pattern" : "[a-fA-F0-9]{64}" + } + }, + "description" : "Hash of the cancellation transaction request.", + "title" : "Cancel response", + "required" : [ "txHash" ] + }, + "v1PendingTransactionsResponse" : { + "type" : "object", + "properties" : { + "pendingTransactions" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/v1TransactionInfo" + }, + "description" : "List of pending transactions in the provider provider_registry." + } + }, + "description" : "Transaction info returned by the provider.", + "title" : "Pending transactions list", + "required" : [ "pendingTransactions" ] + }, + "v1TopologyResponse" : { + "type" : "object", + "properties" : { + "topology" : { + "type" : "object", + "description" : "Topology of the node." + } + }, + "description" : "Topology of the node.", + "title" : "Topology", + "required" : [ "topology" ] + }, + "v1TransactionInfo" : { + "type" : "object", + "example" : { + "created" : "2009-11-10 23:00:00 +0000 UTC m=+0.000000001", + "nonce" : 1234, + "txHash" : "71c1348f2d7ff7e814f9c3617983703435ea7446de420aeac488bf1de35737e8" + }, + "properties" : { + "txHash" : { + "type" : "string", + "description" : "Hex string encoding of the hash of the transaction that the bidder wants to include in the block.", + "pattern" : "[a-fA-F0-9]{64}" + }, + "nonce" : { + "type" : "string", + "format" : "int64", + "description" : "Nonce used for the transaction." + }, + "created" : { + "type" : "string", + "description" : "Time when the transaction was created." + } + }, + "description" : "Transaction info returned by the provider.", + "title" : "Transaction info", + "required" : [ "txHash", "nonce", "created" ] + } + } + } +} \ No newline at end of file diff --git a/mint.json b/mint.json index df459728..14a49fef 100644 --- a/mint.json +++ b/mint.json @@ -138,6 +138,14 @@ "api-reference/bidder/cancelautodeposit", "api-reference/bidder/cancelandwithdrawad" ] + }, + { + "group": "Debug", + "pages": [ + "api-reference/debug/canceltx", + "api-reference/debug/pendingtxs", + "api-reference/debug/topology" + ] } ], "footerSocials": { diff --git a/provider-openapi-spec.json b/provider-openapi-spec.json index b4bb1595..ad353f1b 100644 --- a/provider-openapi-spec.json +++ b/provider-openapi-spec.json @@ -2,7 +2,7 @@ "openapi": "3.0.0", "info": { "title": "Provider API", - "version": "1.0.0-alpha-oas3", + "version": "1.0.0", "license": { "name": "Business Source License 1.1", "url": "https://github.com/primev/mev-commit/blob/main/LICENSE" From 9b3e416d272f589afb32388a60102de333831ebb Mon Sep 17 00:00:00 2001 From: Mikhail Wall Date: Wed, 10 Jul 2024 14:58:44 +0200 Subject: [PATCH 5/7] fix: run lint --- debug-openapi-spec.json | 296 ++++++++++++++++++++-------------------- 1 file changed, 149 insertions(+), 147 deletions(-) diff --git a/debug-openapi-spec.json b/debug-openapi-spec.json index f2524c9b..c00e4fc1 100644 --- a/debug-openapi-spec.json +++ b/debug-openapi-spec.json @@ -1,74 +1,76 @@ { - "openapi" : "3.0.0", - "info" : { - "title" : "Debug API", - "version" : "1.0.0", - "license" : { - "name" : "Business Source License 1.1", - "url" : "https://github.com/primev/mev-commit/blob/main/LICENSE" + "openapi": "3.0.0", + "info": { + "title": "Debug API", + "version": "1.0.0", + "license": { + "name": "Business Source License 1.1", + "url": "https://github.com/primev/mev-commit/blob/main/LICENSE" } }, - "paths" : { - "/v1/debug/cancel_transaction/{txHash}" : { - "post" : { - "summary" : "CancelTransaction", - "description" : "CancelTransaction is called by the provider to cancel a transaction sent from this wallet.", - "operationId" : "DebugService_CancelTransaction", - "responses" : { - "200" : { - "description" : "A successful response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/v1CancelTransactionResponse" + "paths": { + "/v1/debug/cancel_transaction/{txHash}": { + "post": { + "summary": "CancelTransaction", + "description": "CancelTransaction is called by the provider to cancel a transaction sent from this wallet.", + "operationId": "DebugService_CancelTransaction", + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1CancelTransactionResponse" } } } }, - "default" : { - "description" : "An unexpected error response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/googlerpcStatus" + "default": { + "description": "An unexpected error response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/googlerpcStatus" } } } } }, - "parameters" : [ { - "name" : "txHash", - "description" : "Hex string encoding of the hash of the transaction that the bidder wants to cancel.", - "in" : "path", - "required" : true, - "schema" : { - "type" : "string" + "parameters": [ + { + "name": "txHash", + "description": "Hex string encoding of the hash of the transaction that the bidder wants to cancel.", + "in": "path", + "required": true, + "schema": { + "type": "string" + } } - } ] + ] } }, - "/v1/debug/pending_transactions" : { - "get" : { - "summary" : "GetPendingTransactions", - "description" : "GetPendingTransactions is called by the provider to get the pending transactions for the wallet.", - "operationId" : "DebugService_GetPendingTransactions", - "responses" : { - "200" : { - "description" : "A successful response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/v1PendingTransactionsResponse" + "/v1/debug/pending_transactions": { + "get": { + "summary": "GetPendingTransactions", + "description": "GetPendingTransactions is called by the provider to get the pending transactions for the wallet.", + "operationId": "DebugService_GetPendingTransactions", + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1PendingTransactionsResponse" } } } }, - "default" : { - "description" : "An unexpected error response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/googlerpcStatus" + "default": { + "description": "An unexpected error response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/googlerpcStatus" } } } @@ -76,28 +78,28 @@ } } }, - "/v1/debug/topology" : { - "get" : { - "summary" : "GetTopology", - "description" : "GetTopology is called by the user to get the topology of the node. The topology\nincludes connectivity information about the node.", - "operationId" : "DebugService_GetTopology", - "responses" : { - "200" : { - "description" : "A successful response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/v1TopologyResponse" + "/v1/debug/topology": { + "get": { + "summary": "GetTopology", + "description": "GetTopology is called by the user to get the topology of the node. The topology\nincludes connectivity information about the node.", + "operationId": "DebugService_GetTopology", + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/v1TopologyResponse" } } } }, - "default" : { - "description" : "An unexpected error response.", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/googlerpcStatus" + "default": { + "description": "An unexpected error response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/googlerpcStatus" } } } @@ -106,109 +108,109 @@ } } }, - "components" : { - "schemas" : { - "googlerpcStatus" : { - "type" : "object", - "properties" : { - "code" : { - "type" : "integer", - "format" : "int32" + "components": { + "schemas": { + "googlerpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" }, - "message" : { - "type" : "string" + "message": { + "type": "string" }, - "details" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/protobufAny" + "details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/protobufAny" } } } }, - "protobufAny" : { - "type" : "object", - "properties" : { - "@type" : { - "type" : "string" + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string" } }, - "additionalProperties" : { } + "additionalProperties": {} }, - "protobufNullValue" : { - "type" : "string", - "description" : "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\nThe JSON representation for `NullValue` is JSON `null`." + "protobufNullValue": { + "type": "string", + "description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\nThe JSON representation for `NullValue` is JSON `null`." }, - "v1CancelTransactionResponse" : { - "type" : "object", - "example" : { - "txHash" : "71c1348f2d7ff7e814f9c3617983703435ea7446de420aeac488bf1de35737e8" + "v1CancelTransactionResponse": { + "type": "object", + "example": { + "txHash": "71c1348f2d7ff7e814f9c3617983703435ea7446de420aeac488bf1de35737e8" }, - "properties" : { - "txHash" : { - "type" : "string", - "description" : "Hex string encoding of the hash of the transaction that the bidder wants to cancel.", - "pattern" : "[a-fA-F0-9]{64}" + "properties": { + "txHash": { + "type": "string", + "description": "Hex string encoding of the hash of the transaction that the bidder wants to cancel.", + "pattern": "[a-fA-F0-9]{64}" } }, - "description" : "Hash of the cancellation transaction request.", - "title" : "Cancel response", - "required" : [ "txHash" ] + "description": "Hash of the cancellation transaction request.", + "title": "Cancel response", + "required": ["txHash"] }, - "v1PendingTransactionsResponse" : { - "type" : "object", - "properties" : { - "pendingTransactions" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/v1TransactionInfo" + "v1PendingTransactionsResponse": { + "type": "object", + "properties": { + "pendingTransactions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/v1TransactionInfo" }, - "description" : "List of pending transactions in the provider provider_registry." + "description": "List of pending transactions in the provider provider_registry." } }, - "description" : "Transaction info returned by the provider.", - "title" : "Pending transactions list", - "required" : [ "pendingTransactions" ] + "description": "Transaction info returned by the provider.", + "title": "Pending transactions list", + "required": ["pendingTransactions"] }, - "v1TopologyResponse" : { - "type" : "object", - "properties" : { - "topology" : { - "type" : "object", - "description" : "Topology of the node." + "v1TopologyResponse": { + "type": "object", + "properties": { + "topology": { + "type": "object", + "description": "Topology of the node." } }, - "description" : "Topology of the node.", - "title" : "Topology", - "required" : [ "topology" ] + "description": "Topology of the node.", + "title": "Topology", + "required": ["topology"] }, - "v1TransactionInfo" : { - "type" : "object", - "example" : { - "created" : "2009-11-10 23:00:00 +0000 UTC m=+0.000000001", - "nonce" : 1234, - "txHash" : "71c1348f2d7ff7e814f9c3617983703435ea7446de420aeac488bf1de35737e8" + "v1TransactionInfo": { + "type": "object", + "example": { + "created": "2009-11-10 23:00:00 +0000 UTC m=+0.000000001", + "nonce": 1234, + "txHash": "71c1348f2d7ff7e814f9c3617983703435ea7446de420aeac488bf1de35737e8" }, - "properties" : { - "txHash" : { - "type" : "string", - "description" : "Hex string encoding of the hash of the transaction that the bidder wants to include in the block.", - "pattern" : "[a-fA-F0-9]{64}" + "properties": { + "txHash": { + "type": "string", + "description": "Hex string encoding of the hash of the transaction that the bidder wants to include in the block.", + "pattern": "[a-fA-F0-9]{64}" }, - "nonce" : { - "type" : "string", - "format" : "int64", - "description" : "Nonce used for the transaction." + "nonce": { + "type": "string", + "format": "int64", + "description": "Nonce used for the transaction." }, - "created" : { - "type" : "string", - "description" : "Time when the transaction was created." + "created": { + "type": "string", + "description": "Time when the transaction was created." } }, - "description" : "Transaction info returned by the provider.", - "title" : "Transaction info", - "required" : [ "txHash", "nonce", "created" ] + "description": "Transaction info returned by the provider.", + "title": "Transaction info", + "required": ["txHash", "nonce", "created"] } } } -} \ No newline at end of file +} From 0c2f95495b883c81fb56d844aaf7692a7bfb871a Mon Sep 17 00:00:00 2001 From: Mikhail Wall Date: Wed, 10 Jul 2024 15:15:46 +0200 Subject: [PATCH 6/7] fix: fixed api after new pr --- api-reference/bidder/cancelandwithdrawad.mdx | 4 - api-reference/bidder/withdrawfromwindows.mdx | 4 + api-reference/bidder/withdrawspecwindows.mdx | 4 - bidder-openapi-spec.json | 139 ++++++++++--------- get-started/bidders/bidder-node-commands.mdx | 14 +- mint.json | 5 +- 6 files changed, 84 insertions(+), 86 deletions(-) delete mode 100644 api-reference/bidder/cancelandwithdrawad.mdx create mode 100644 api-reference/bidder/withdrawfromwindows.mdx delete mode 100644 api-reference/bidder/withdrawspecwindows.mdx diff --git a/api-reference/bidder/cancelandwithdrawad.mdx b/api-reference/bidder/cancelandwithdrawad.mdx deleted file mode 100644 index 3810d54e..00000000 --- a/api-reference/bidder/cancelandwithdrawad.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: Cancel and Withdraw Auto Deposit -openapi: post /v1/bidder/cancel_and_withdraw_auto_deposit ---- \ No newline at end of file diff --git a/api-reference/bidder/withdrawfromwindows.mdx b/api-reference/bidder/withdrawfromwindows.mdx new file mode 100644 index 00000000..7b5cd7e1 --- /dev/null +++ b/api-reference/bidder/withdrawfromwindows.mdx @@ -0,0 +1,4 @@ +--- +title: Withdraw Deposit From Windows +openapi: post /v1/bidder/withdraw_from_windows +--- \ No newline at end of file diff --git a/api-reference/bidder/withdrawspecwindows.mdx b/api-reference/bidder/withdrawspecwindows.mdx deleted file mode 100644 index 2f269729..00000000 --- a/api-reference/bidder/withdrawspecwindows.mdx +++ /dev/null @@ -1,4 +0,0 @@ ---- -title: Withdraw Deposit From Specific Windows -openapi: post /v1/bidder/withdraw_from_specific_windows ---- \ No newline at end of file diff --git a/bidder-openapi-spec.json b/bidder-openapi-spec.json index 15c41306..75855b76 100644 --- a/bidder-openapi-spec.json +++ b/bidder-openapi-spec.json @@ -2,7 +2,7 @@ "openapi": "3.0.0", "info": { "title": "Bidder API", - "version": "1.0.0", + "version": "1.0.0-oas3", "license": { "name": "Business Source License 1.1", "url": "https://github.com/primev/mev-commit/blob/main/LICENSE" @@ -147,35 +147,6 @@ } } }, - "/v1/bidder/cancel_and_withdraw_auto_deposit": { - "post": { - "summary": "CancelAndWithdrawAutoDeposit", - "description": "CancelAndWithdrawAutoDeposit is called by the bidder node to cancel the auto deposit and withdraw the funds.", - "operationId": "Bidder_CancelAndWithdrawAutoDeposit", - "responses": { - "200": { - "description": "A successful response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/v1CancelAutoDepositResponse" - } - } - } - }, - "default": { - "description": "An unexpected error response.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/googlerpcStatus" - } - } - } - } - } - } - }, "/v1/bidder/cancel_auto_deposit": { "post": { "summary": "CancelAutoDeposit", @@ -202,7 +173,17 @@ } } } - } + }, + "parameters": [ + { + "name": "withdraw", + "in": "query", + "required": false, + "schema": { + "type": "boolean" + } + } + ] } }, "/v1/bidder/deposit/{amount}": { @@ -347,18 +328,18 @@ ] } }, - "/v1/bidder/withdraw_from_specific_windows": { + "/v1/bidder/withdraw_from_windows": { "post": { - "summary": "WithdrawFromSpecificWindows", - "description": "WithdrawFromSpecificWindows is called by the bidder node to withdraw funds from specific windows.", - "operationId": "Bidder_WithdrawFromSpecificWindows", + "summary": "WithdrawFromWindows", + "description": "WithdrawFromWindows is called by the bidder node to withdraw funds from multiple windows.", + "operationId": "Bidder_WithdrawFromWindows", "responses": { "200": { "description": "A successful response.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/v1AutoDepositResponse" + "$ref": "#/components/schemas/v1WithdrawFromWindowsResponse" } } } @@ -445,6 +426,13 @@ "type": "string", "format": "int64", "description": "Timestamp at which the bid ends decaying." + }, + "revertingTxHashes": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Optional array of tx hashes that are allowed to revert or be discarded." } }, "description": "Unsigned bid message from bidders to the bidder mev-commit node.", @@ -480,35 +468,27 @@ }, "v1AutoDepositResponse": { "type": "object", - "example": [ - { - "amount": "1000000000000000000", - "window_number": 1 - }, - { - "amount": "1000000000000000000", - "window_number": 2 - }, - { - "amount": "1000000000000000000", - "window_number": 3 - } - ], + "example": { + "amount_per_window": "1000000000000000000", + "start_block_number": "1" + }, "properties": { - "amountsAndWindowNumbers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/bidderapiv1AutoDeposit" - } + "startBlockNumber": { + "type": "string", + "format": "uint64" + }, + "amountPerWindow": { + "type": "string" } }, - "description": "AutoDeposit deposit from the bidder registry.", + "description": "Response on AutoDeposit request.", "title": "AutoDeposit response" }, "v1AutoDepositStatusResponse": { "type": "object", "example": { - "amounts_and_window_numbers": [ + "isWorking": true, + "window_balances": [ { "amount": "1000000000000000000", "window_number": 1 @@ -521,11 +501,10 @@ "amount": "1000000000000000000", "window_number": 3 } - ], - "isWorking": true + ] }, "properties": { - "amountsAndWindowNumbers": { + "windowBalances": { "type": "array", "items": { "$ref": "#/components/schemas/bidderapiv1AutoDeposit" @@ -535,8 +514,8 @@ "type": "boolean" } }, - "description": "AutoDeposit deposit from the bidder registry.", - "title": "AutoDeposit response" + "description": "AutoDeposit status from the bidder registry.", + "title": "AutoDeposit status response" }, "v1CancelAutoDepositResponse": { "type": "object", @@ -609,6 +588,13 @@ "type": "string", "format": "int64", "description": "Timestamp at which the commitment is published." + }, + "revertingTxHashes": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Optional array of tx hashes that are allowed to revert or be discarded." } } }, @@ -630,6 +616,35 @@ "description": "Get deposit for bidder in the bidder registry.", "title": "Deposit response" }, + "v1WithdrawFromWindowsResponse": { + "type": "object", + "example": { + "withdraw_responses": [ + { + "amount": "1000000000000000000", + "window_number": 1 + }, + { + "amount": "1000000000000000000", + "window_number": 2 + }, + { + "amount": "1000000000000000000", + "window_number": 3 + } + ] + }, + "properties": { + "withdrawResponses": { + "type": "array", + "items": { + "$ref": "#/components/schemas/v1WithdrawResponse" + } + } + }, + "description": "Withdraw deposit from the bidder registry.", + "title": "Withdraw from multiple windows response" + }, "v1WithdrawResponse": { "type": "object", "example": { diff --git a/get-started/bidders/bidder-node-commands.mdx b/get-started/bidders/bidder-node-commands.mdx index 803abd66..155a6c72 100644 --- a/get-started/bidders/bidder-node-commands.mdx +++ b/get-started/bidders/bidder-node-commands.mdx @@ -81,24 +81,12 @@ curl -X POST http://localhost:13523/v1/bidder/cancel_auto_deposit This will stop the ongoing auto deposit process. -## Cancel And Withdraw Auto Deposit - -To cancel the auto deposit process and withdraw the funds: - -```shell ❯_ terminal -curl -X POST http://localhost:13523/v1/bidder/cancel_and_withdraw_auto_deposit -``` - -This will stop the ongoing auto deposit process and withdraw the funds deposited for the current windows. - -The funds will be withdrawn when the current window is greater than the last window for which funds were deposited. - ## Withdraw Funds To withdraw funds from the several windows, you can use the following command: ```shell ❯_ terminal -curl -X POST http://localhost:13523/v1/bidder/withdraw_from_specific_windows +curl -X POST http://localhost:13523/v1/bidder/withdraw_from_windows -H "Content-Type: application/json" \ -d '{ "windows": [1, 2, 3] diff --git a/mint.json b/mint.json index 14a49fef..c49feeb8 100644 --- a/mint.json +++ b/mint.json @@ -132,11 +132,10 @@ "api-reference/bidder/getdeposit", "api-reference/bidder/deposit", "api-reference/bidder/withdraw", - "api-reference/bidder/withdrawspecwindows", + "api-reference/bidder/withdrawfromwindows", "api-reference/bidder/autodeposit", "api-reference/bidder/autodepositstatus", - "api-reference/bidder/cancelautodeposit", - "api-reference/bidder/cancelandwithdrawad" + "api-reference/bidder/cancelautodeposit" ] }, { From a004403c46fe3029a485e8b65bc0f0269616fcb0 Mon Sep 17 00:00:00 2001 From: aloknerurkar Date: Thu, 11 Jul 2024 01:44:15 +0530 Subject: [PATCH 7/7] Update bidder-node-commands.mdx --- get-started/bidders/bidder-node-commands.mdx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/get-started/bidders/bidder-node-commands.mdx b/get-started/bidders/bidder-node-commands.mdx index 155a6c72..07f7f777 100644 --- a/get-started/bidders/bidder-node-commands.mdx +++ b/get-started/bidders/bidder-node-commands.mdx @@ -55,12 +55,7 @@ The withdrawal functionality allows you to withdraw deposited funds from specifi To start the auto deposit process: ```shell ❯_ terminal -curl -X POST http://localhost:13523/v1/bidder/auto_deposit \ - -H "Content-Type: application/json" \ - -d '{ - "amount": "1000000000000000000", - "windowNumber": 3 - }' +curl -X POST http://localhost:13523/v1/bidder/auto_deposit/{amount} ``` ## Get Auto Deposit Status @@ -76,7 +71,7 @@ curl -s http://localhost:13523/v1/bidder/auto_deposit_status To cancel the auto deposit process: ```shell ❯_ terminal -curl -X POST http://localhost:13523/v1/bidder/cancel_auto_deposit +curl -X POST http://localhost:13523/v1/bidder/cancel_auto_deposit?withdraw=true ``` This will stop the ongoing auto deposit process.