From 50b4fdd30b622d09503de18c025716b3868fe727 Mon Sep 17 00:00:00 2001 From: imazur Date: Thu, 16 Nov 2023 12:40:18 +0200 Subject: [PATCH] Added Custody API.yml which will automatically generate API docs --- .../create-custody-transaction.api.mdx | 20 +- .../generate-unique-address.api.mdx | 15 +- .../custody-server/send-payment.api.mdx | 30 +- .../custody-server/send-refund.api.mdx | 25 +- api/anchor-platform/custody-server/sidebar.js | 2 +- docusaurus.config.js | 8 + openapi/anchor-platform/Custody API.yml | 234 ++++++++++++++++ openapi/anchor-platform/bundled_custody.yml | 265 ++++++++++++++++++ openapi/anchor-platform/schemas.yml | 29 ++ package.json | 4 +- 10 files changed, 588 insertions(+), 44 deletions(-) create mode 100644 openapi/anchor-platform/Custody API.yml create mode 100644 openapi/anchor-platform/bundled_custody.yml diff --git a/api/anchor-platform/custody-server/create-custody-transaction.api.mdx b/api/anchor-platform/custody-server/create-custody-transaction.api.mdx index 0f29dcda3..106a8c452 100644 --- a/api/anchor-platform/custody-server/create-custody-transaction.api.mdx +++ b/api/anchor-platform/custody-server/create-custody-transaction.api.mdx @@ -1,19 +1,19 @@ --- id: create-custody-transaction title: "Create Custody Transaction" -description: "Create Custody Transaction" +description: "Custody Server creates custody transaction record in DB." sidebar_label: "Create Custody Transaction" hide_title: true hide_table_of_contents: true -api: { "tags": [ "SEP-6", "SEP-24", "SEP-31" ], "description": "Custody Server creates custody transaction record in DB.\n", "operationId": "createCustodyTransaction", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "description": "SEP transaction ID", "type": "string" }, "memo": { "description": "Memo value, that is used to identify inbound or outbound payments", "type": "string" }, "memoType": { "description": "Type of memo, that is used to identify inbound or outbound payments", "type": "string", "enum": [ "id", "hash", "text" ] }, "protocol": { "description": "Protocol of SEP transaction", "type": "string", "enum": [ "6", "24", "31" ] }, "fromAccount": { "description": "Source Stellar account", "type": "string" }, "toAccount": { "description": "Destination Stellar account", "type": "string" }, "amount": { "description": "Amount of the asset, that is sent/received", "type": "string" }, "amountFee": { "description": "Fee of SEP transaction", "type": "string" }, "asset": { "description": "Asset, that is sent/received", "type": "string" }, "kind": { "description": "Kind of the SEP transaction", "type": "string", "enum": [ "deposit", "withdrawal", "receive" ] } }, "title": "CreateCustodyTransactionRequest" } } } }, "responses": { "200": { "description": "Success.", "content": { "application/json": { "schema": { "type": "object", "properties": {}, "title": "CreateCustodyTransactionResponse" } } } }, "500": { "description": "Internal Server Error.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "title": "Error" } } } } }, "method": "post", "path": "/transactions", "jsonRequestBodyExample": { "id": "123e4567-e89b-12d3-a456-426614174000", "memo": "12345", "memoType": "id", "protocol": "24", "fromAccount": "GA3X53JGZ5SLT733GNKH3CVV7RKCL4DXWCIZG2Y24HA24L6XNEHSQXT4", "toAccount": "GA3X53JGZ5SLT733GNKH3CVV7RKCL4DXWCIZG2Y24HA24L6XNEHSQXT4", "amount": "50", "amountAsset": "stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5", "kind": "deposit" }, "info": { "version": "2.0.0", "description": "The Custody Server API specification for the Stellar Anchor Platform project.\n\nThe Custody Server API defines requests made by the Platform to interact with custody services.\n", "title": "Custody Server API" }, "postman": { "name": "Create Custody Transaction", "description": { "content": "The Custody Server provides set of endpoints to interact with custody services.\n", "type": "text/plain" }, "url": { "path": [ "transactions" ], "host": [ "{{baseUrl}}" ], "query": [], "variable": [] }, "header": [ { "key": "Content-Type", "value": "application/json" }, { "key": "Accept", "value": "application/json" } ], "method": "POST", "body": { "mode": "raw", "raw": "\"\"", "options": { "raw": { "language": "json" } } } } } -sidebar_class_name: "put api-method" -info_path: api/anchor-platform/custody-server-api +api: {"description":"Custody Server creates custody transaction record in DB.","operationId":"createCustodyTransaction","tags":["Custody Transactions","SEP-6","SEP-24","SEP-31"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"description":"SEP transaction ID.","type":"string"},"memo":{"description":"Memo value, that is used to identify inbound or outbound payments.","type":"string"},"memoType":{"description":"Type of memo, that is used to identify inbound or outbound payments.","type":"string","enum":["id","hash","text"]},"protocol":{"description":"Protocol of SEP transaction.","type":"string","enum":[6,24,31]},"fromAccount":{"description":"Source Stellar account.","type":"string"},"toAccount":{"description":"Destination Stellar account.","type":"string"},"amount":{"description":"Amount of the asset, that is sent/received.","type":"string"},"amountFee":{"description":"Fee of SEP transaction.","type":"string"},"asset":{"description":"Asset, that is sent/received.","type":"string"},"kind":{"description":"Kind of the SEP transaction.","type":"string","enum":["deposit","withdrawal","receive"]}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}},"title":"CustodyError"}}}}},"method":"post","path":"/transactions","jsonRequestBodyExample":{"id":"string","memo":"string","memoType":"id","protocol":6,"fromAccount":"string","toAccount":"string","amount":"string","amountFee":"string","asset":"string","kind":"deposit"},"info":{"version":"2.0.0","description":"","title":"Custody Server API"},"postman":{"name":"Create Custody Transaction","description":{"content":"Custody Server creates custody transaction record in DB.","type":"text/plain"},"url":{"path":["transactions"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}}}} +sidebar_class_name: "post api-method" +info_path: api/anchor-platform/custody-server/custody-server-api custom_edit_url: null --- import { SepBadge } from "@site/src/components/SepBadge"; - + import ApiTabs from "@theme/ApiTabs"; import MimeTabs from "@theme/MimeTabs"; @@ -26,14 +26,16 @@ import TabItem from "@theme/TabItem"; ## Create Custody Transaction + + Custody Server creates custody transaction record in DB. -
Request Body
+
Request Body
-Success. +Success -
Schema
    +
    Schema
    • object
    -Internal Server Error. +Internal Server Error
    Schema
    diff --git a/api/anchor-platform/custody-server/generate-unique-address.api.mdx b/api/anchor-platform/custody-server/generate-unique-address.api.mdx index b2464ea8f..6b3ec1e48 100644 --- a/api/anchor-platform/custody-server/generate-unique-address.api.mdx +++ b/api/anchor-platform/custody-server/generate-unique-address.api.mdx @@ -1,19 +1,19 @@ --- id: generate-unique-address title: "Generate Unique Address" -description: "Generate Unique Address" +description: "Custody Server calls the configured custody service to generate deposit address and memo." sidebar_label: "Generate Unique Address" hide_title: true hide_table_of_contents: true -api: { "tags": [ "SEP-6", "SEP-24", "SEP-31" ], "description": "Custody Server calls the configured custody service to generate deposit address and memo.\n", "operationId": "generateUniqueAddress", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": {}, "title": "GenerateUniqueAddressRequest" } } } }, "responses": { "200": { "description": "Success.", "content": { "application/json": { "schema": { "type": "object", "properties": { "address": { "description": "Deposit address to which the client should send funds", "type": "string" }, "memo": { "description": "Memo value, that should be added to payment by the client", "type": "string" }, "memoType": { "description": "Type of memo, that should be added to payment by the client", "type": "string", "enum": [ "id", "hash", "text" ] } }, "title": "GenerateUniqueAddressResponse" } } } }, "500": { "description": "Internal Server Error.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "title": "Error" } } } } }, "method": "post", "path": "/assets/{asset}/addresses", "jsonRequestBodyExample": {}, "info": { "version": "2.0.0", "description": "The Custody Server API specification for the Stellar Anchor Platform project.\n\nThe Custody Server API defines requests made by the Platform to interact with custody services.\n", "title": "Custody Server API" }, "postman": { "name": "Generate Unique Address", "description": { "content": "The Custody Server provides set of endpoints to interact with custody services.\n", "type": "text/plain" }, "url": { "path": [ "assets", ":asset", "addresses" ], "host": [ "{{baseUrl}}" ], "query": [], "variable": [] }, "header": [ { "key": "Content-Type", "value": "application/json" }, { "key": "Accept", "value": "application/json" } ], "method": "POST", "body": { "mode": "raw", "raw": "\"\"", "options": { "raw": { "language": "json" } } } } } +api: {"description":"Custody Server calls the configured custody service to generate deposit address and memo.\n\nFormat of `asset` parameter - `stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5`\n","operationId":"generateUniqueAddress","tags":["Unique Address","SEP-6","SEP-24","SEP-31"],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Success.","content":{"application/json":{"schema":{"type":"object","properties":{"address":{"description":"Deposit address to which the client should send funds.","type":"string"},"memo":{"description":"Memo value, that should be added to payment by the client.","type":"string"},"memoType":{"description":"Type of memo, that should be added to payment by the client.","type":"string","enum":["id","hash","text"]}},"title":"GenerateUniqueAddressResponse"}}}},"500":{"description":"Internal Server Error.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}},"title":"CustodyError"}}}}},"method":"post","path":"/assets/{asset}/addresses","jsonRequestBodyExample":{},"info":{"version":"2.0.0","description":"","title":"Custody Server API"},"postman":{"name":"Generate Unique Address","description":{"content":"Custody Server calls the configured custody service to generate deposit address and memo.\n\nFormat of `asset` parameter - `stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5`\n","type":"text/plain"},"url":{"path":["assets",":asset","addresses"],"host":["{{baseUrl}}"],"query":[],"variable":[]},"header":[{"key":"Content-Type","value":"application/json"},{"key":"Accept","value":"application/json"}],"method":"POST","body":{"mode":"raw","raw":"\"\"","options":{"raw":{"language":"json"}}}}} sidebar_class_name: "post api-method" -info_path: api/anchor-platform/custody-server-api +info_path: api/anchor-platform/custody-server/custody-server-api custom_edit_url: null --- import { SepBadge } from "@site/src/components/SepBadge"; - + import ApiTabs from "@theme/ApiTabs"; import MimeTabs from "@theme/MimeTabs"; @@ -26,15 +26,18 @@ import TabItem from "@theme/TabItem"; ## Generate Unique Address + + Custody Server calls the configured custody service to generate deposit address and memo. Format of `asset` parameter - `stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5` -
    Request Body
      + +
      Request Body
      • object
      Success. -
      Schema
      +
      Schema
      Internal Server Error. diff --git a/api/anchor-platform/custody-server/send-payment.api.mdx b/api/anchor-platform/custody-server/send-payment.api.mdx index dc007b576..884c5f01b 100644 --- a/api/anchor-platform/custody-server/send-payment.api.mdx +++ b/api/anchor-platform/custody-server/send-payment.api.mdx @@ -1,19 +1,19 @@ --- id: send-payment -title: "Send payment" -description: "Send payment" -sidebar_label: "Send payment" +title: "Send Payment" +description: "Custody Server calls the configured custody service to send payment." +sidebar_label: "Send Payment" hide_title: true hide_table_of_contents: true -api: { "tags": [ "SEP-6", "SEP-24", "SEP-31" ], "description": "Custody Server calls configured Custody Service to send payment.\n", "operationId": "sendPayment", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": {}, "title": "SendPaymentRequest" } } } }, "responses": { "200": { "description": "Success.", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "description": "External TX ID from custody service", "type": "string" } }, "title": "SendPaymentResponse" } } } }, "400": { "description": "Invalid Request.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "title": "Invalid Request" } } } }, "404": { "description": "Custody Transaction is not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "title": "Custody Transaction is not found" } } } }, "429": { "description": "Custody Service rate limit is exceeded.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "title": "Custody Service rate limit is exceeded" } } } }, "500": { "description": "Internal Server Error.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "title": "Error" } } } }, "503": { "description": "Custody Service is unavailable.", "content": { "application/json": { "schema": { "type": "object", "properties": { "rawErrorMessage": { "type": "string" } }, "title": "Custody Service is unavailable" } } } } }, "method": "post", "path": "/transactions/{id}/payments", "jsonRequestBodyExample": {}, "info": { "version": "2.0.0", "description": "The Custody Server API specification for the Stellar Anchor Platform project.\n\nThe Custody Server API defines requests made by the Platform to interact with custody services.\n", "title": "Custody Server API" }, "postman": { "name": "Send Payment", "description": { "content": "The Custody Server provides set of endpoints to interact with custody services.\n", "type": "text/plain" }, "url": { "path": [ "transactions", ":id", "payments" ], "host": [ "{{baseUrl}}" ], "query": [], "variable": [] }, "header": [ { "key": "Content-Type", "value": "application/json" }, { "key": "Accept", "value": "application/json" } ], "method": "POST", "body": { "mode": "raw", "raw": "\"\"", "options": { "raw": { "language": "json" } } } } } +api: {"description":"Custody Server calls the configured custody service to send payment.","operationId":"sendPayment","tags":["Payments","SEP-6","SEP-24","SEP-31"],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"External TX ID from custody service."}},"title":"SendPaymentResponse"}}}},"400":{"description":"Invalid Request.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}},"title":"CustodyError"}}}},"404":{"description":"Custody Transaction is not found.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}},"title":"CustodyError"}}}},"429":{"description":"Custody Service rate limit is exceeded.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}},"title":"CustodyError"}}}},"500":{"description":"Internal Server Error.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}},"title":"CustodyError"}}}},"503":{"description":"Custody Service is unavailable.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}},"title":"CustodyError"}}}}},"method":"post","path":"/transactions/:id/payments","jsonRequestBodyExample":{},"info":{"version":"2.0.0","description":"","title":"Custody Server API"}} sidebar_class_name: "post api-method" -info_path: api/anchor-platform/custody-server-api +info_path: api/anchor-platform/custody-server/custody-server-api custom_edit_url: null --- import { SepBadge } from "@site/src/components/SepBadge"; - + import ApiTabs from "@theme/ApiTabs"; import MimeTabs from "@theme/MimeTabs"; @@ -26,30 +26,32 @@ import TabItem from "@theme/TabItem"; ## Send Payment + + Custody Server calls the configured custody service to send payment. -
      Request Body
        +
        Request Body
        • object
        -Success. +Success -
        Schema
        +
        Schema
        Invalid Request. -
        Schema
        +
        Schema
        Custody Transaction is not found. -
        Schema
        +
        Schema
        Custody Service rate limit is exceeded. -
        Schema
        +
        Schema
        Internal Server Error. -
        Schema
        +
        Schema
        Custody Service is unavailable. -
        Schema
        +
        Schema
        diff --git a/api/anchor-platform/custody-server/send-refund.api.mdx b/api/anchor-platform/custody-server/send-refund.api.mdx index 54ffe6c53..250ff464a 100644 --- a/api/anchor-platform/custody-server/send-refund.api.mdx +++ b/api/anchor-platform/custody-server/send-refund.api.mdx @@ -1,19 +1,19 @@ --- id: send-refund title: "Send Refund" -description: "Send Refund" +description: "Custody Server calls configured Custody Service to send refund. Custody transaction record is also created in DB." sidebar_label: "Send Refund" hide_title: true hide_table_of_contents: true -api: { "tags": [ "SEP-6", "SEP-24", "SEP-31" ], "description": "Custody Server calls configured Custody Service to send payment.\n", "operationId": "sendPayment", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "memo": { "description": "Memo value, that will be added to the refund payment", "type": "string" }, "memoType": { "description": "Type of memo, that will be added to the refund payment", "type": "string" }, "amount": { "description": "Amount, that will be refunded", "type": "string" }, "amountFee": { "description": "Fee of the refund", "type": "string" } }, "title": "SendPaymentRequest" } } } }, "responses": { "200": { "description": "Success.", "content": { "application/json": { "schema": { "type": "object", "properties": { "id": { "description": "External TX ID from custody service", "type": "string" } }, "title": "SendPaymentResponse" } } } }, "400": { "description": "Invalid Request.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "title": "Invalid Request" } } } }, "404": { "description": "Custody Transaction is not found.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "title": "Custody Transaction is not found" } } } }, "429": { "description": "Custody Service rate limit is exceeded.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "title": "Custody Service rate limit is exceeded" } } } }, "500": { "description": "Internal Server Error.", "content": { "application/json": { "schema": { "type": "object", "properties": { "error": { "type": "string" } }, "title": "Error" } } } }, "503": { "description": "Custody Service is unavailable.", "content": { "application/json": { "schema": { "type": "object", "properties": { "rawErrorMessage": { "type": "string" } }, "title": "Custody Service is unavailable" } } } } }, "method": "post", "path": "/transactions/{id}/payments", "jsonRequestBodyExample": {}, "info": { "version": "2.0.0", "description": "The Custody Server API specification for the Stellar Anchor Platform project.\n\nThe Custody Server API defines requests made by the Platform to interact with custody services.\n", "title": "Custody Server API" }, "postman": { "name": "Send Payment", "description": { "content": "The Custody Server provides set of endpoints to interact with custody services.\n", "type": "text/plain" }, "url": { "path": [ "transactions", ":id", "payments" ], "host": [ "{{baseUrl}}" ], "query": [], "variable": [] }, "header": [ { "key": "Content-Type", "value": "application/json" }, { "key": "Accept", "value": "application/json" } ], "method": "POST", "body": { "mode": "raw", "raw": "\"\"", "options": { "raw": { "language": "json" } } } } } +api: {"description":"Custody Server calls configured Custody Service to send refund. Custody transaction record is also created in DB.","operationId":"sendRefund","tags":["Refunds","SEP-6","SEP-24","SEP-31"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"memo":{"description":"Memo value, that will be added to the refund payment.","type":"string"},"memoType":{"description":"Type of memo, that will be added to the refund payment.","type":"string"},"amount":{"description":"Amount, that will be refunded.","type":"string"},"amountFee":{"description":"Fee of the refund.","type":"string"}}}}}},"responses":{"200":{"description":"Success.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","description":"External TX ID from custody service."}},"title":"SendPaymentResponse"}}}},"400":{"description":"Invalid Request.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}},"title":"CustodyError"}}}},"404":{"description":"Custody Transaction is not found.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}},"title":"CustodyError"}}}},"429":{"description":"Custody Service rate limit is exceeded.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}},"title":"CustodyError"}}}},"500":{"description":"Internal Server Error.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}},"title":"CustodyError"}}}},"503":{"description":"Custody Service is unavailable.","content":{"application/json":{"schema":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}},"title":"CustodyError"}}}}},"method":"post","path":"/transactions/:id/refunds","jsonRequestBodyExample":{"memo":"string","memoType":"string","amount":"string","amountFee":"string"},"info":{"version":"2.0.0","description":"","title":"Custody Server API"}} sidebar_class_name: "post api-method" -info_path: api/anchor-platform/custody-server-api +info_path: api/anchor-platform/custody-server/custody-server-api custom_edit_url: null --- import { SepBadge } from "@site/src/components/SepBadge"; - + import ApiTabs from "@theme/ApiTabs"; import MimeTabs from "@theme/MimeTabs"; @@ -26,31 +26,32 @@ import TabItem from "@theme/TabItem"; ## Send Refund -Custody Server calls configured Custody Service to send refund. -Custody transaction record is also created in DB. + + +Custody Server calls configured Custody Service to send refund. Custody transaction record is also created in DB.
        Request Body
        Success. -
        Schema
        +
        Schema
        Invalid Request. -
        Schema
        +
        Schema
        Custody Transaction is not found. -
        Schema
        +
        Schema
        Custody Service rate limit is exceeded. -
        Schema
        +
        Schema
        Internal Server Error. -
        Schema
        +
        Schema
        Custody Service is unavailable. -
        Schema
        +
        Schema
        diff --git a/api/anchor-platform/custody-server/sidebar.js b/api/anchor-platform/custody-server/sidebar.js index 11057bb75..94a2055e1 100644 --- a/api/anchor-platform/custody-server/sidebar.js +++ b/api/anchor-platform/custody-server/sidebar.js @@ -1 +1 @@ -module.exports = [ { "type": "doc", "id": "anchor-platform/custody-server" }, { "type": "category", "label": "Custody Transactions", "link": { "type": "generated-index", "title": "Custody Transactions", "slug": "/category/anchor-platform/custody-server/custody-transactions" }, "items": [ { "type": "doc", "id": "anchor-platform/custody-server/create-custody-transaction", "label": "Create Custody Transaction", "className": "api-method post" } ] }, { "type": "category", "label": "Unique Address", "link": { "type": "generated-index", "title": "Unique Address", "slug": "/category/anchor-platform/custody-server/unique-address" }, "items": [ { "type": "doc", "id": "anchor-platform/custody-server/generate-unique-address", "label": "Generate Unique Address", "className": "api-method post" } ] }, { "type": "category", "label": "Payments", "link": { "type": "generated-index", "title": "Payments", "slug": "/category/anchor-platform/custody-server/payments" }, "items": [ { "type": "doc", "id": "anchor-platform/custody-server/send-payment", "label": "Send Payment", "className": "api-method post" } ] }, { "type": "category", "label": "Refunds", "link": { "type": "generated-index", "title": "Refunds", "slug": "/category/anchor-platform/custody-server/refunds" }, "items": [ { "type": "doc", "id": "anchor-platform/custody-server/send-refund", "label": "Send Refund", "className": "api-method post" } ] }, { "type": "category", "label": "SEP-24", "link": { "type": "generated-index", "title": "SEP-24", "slug": "/category/anchor-platform/custody-server/sep-24" }, "items": [ { "type": "doc", "id": "anchor-platform/custody-server/create-custody-transaction", "label": "Create Custody Transaction", "className": "api-method post" }, { "type": "doc", "id": "/category/anchor-platform/custody-server/generate-unique-address", "label": "Generate Unique Address", "className": "api-method post" }, { "type": "doc", "id": "anchor-platform/custody-server/send-payment", "label": "Send Payment", "className": "api-method post" }, { "type": "doc", "id": "anchor-platform/custody-server/send-payment", "label": "Send Refund", "className": "api-method post" } ] }, { "type": "category", "label": "SEP-31", "link": { "type": "generated-index", "title": "SEP-31", "slug": "/category/anchor-platform/custody-server/sep-31" }, "items": [ { "type": "doc", "id": "anchor-platform/custody-server/create-custody-transaction", "label": "Create Custody Transaction", "className": "api-method post" }, { "type": "doc", "id": "/category/anchor-platform/custody-server/generate-unique-address", "label": "Generate Unique Address", "className": "api-method post" }, { "type": "doc", "id": "anchor-platform/custody-server/send-payment", "label": "Send Payment", "className": "api-method post" }, { "type": "doc", "id": "anchor-platform/custody-server/send-payment", "label": "Send Refund", "className": "api-method post" } ] } ]; \ No newline at end of file +module.exports = [{"type":"doc","id":"anchor-platform/custody-server/custody-server-api"},{"type":"category","label":"Custody Transactions","link":{"type":"generated-index","title":"Custody Transactions","slug":"/category/anchor-platform/custody-server/custody-transactions"},"items":[{"type":"doc","id":"anchor-platform/custody-server/create-custody-transaction","label":"Create Custody Transaction","className":"api-method post"}]},{"type":"category","label":"Payments","link":{"type":"generated-index","title":"Payments","slug":"/category/anchor-platform/custody-server/payments"},"items":[{"type":"doc","id":"anchor-platform/custody-server/send-payment","label":"Send Payment","className":"api-method post"}]},{"type":"category","label":"Refunds","link":{"type":"generated-index","title":"Refunds","slug":"/category/anchor-platform/custody-server/refunds"},"items":[{"type":"doc","id":"anchor-platform/custody-server/send-refund","label":"Send Refund","className":"api-method post"}]},{"type":"category","label":"Unique Address","link":{"type":"generated-index","title":"Unique Address","slug":"/category/anchor-platform/custody-server/unique-address"},"items":[{"type":"doc","id":"anchor-platform/custody-server/generate-unique-address","label":"Generate Unique Address","className":"api-method post"}]},{"type":"category","label":"SEP-6","link":{"type":"generated-index","title":"SEP-6","slug":"/category/anchor-platform/custody-server/sep-6"},"items":[{"type":"doc","id":"anchor-platform/custody-server/create-custody-transaction","label":"Create Custody Transaction","className":"api-method post"},{"type":"doc","id":"anchor-platform/custody-server/send-payment","label":"Send Payment","className":"api-method post"},{"type":"doc","id":"anchor-platform/custody-server/send-refund","label":"Send Refund","className":"api-method post"},{"type":"doc","id":"anchor-platform/custody-server/generate-unique-address","label":"Generate Unique Address","className":"api-method post"}]},{"type":"category","label":"SEP-24","link":{"type":"generated-index","title":"SEP-24","slug":"/category/anchor-platform/custody-server/sep-24"},"items":[{"type":"doc","id":"anchor-platform/custody-server/create-custody-transaction","label":"Create Custody Transaction","className":"api-method post"},{"type":"doc","id":"anchor-platform/custody-server/send-payment","label":"Send Payment","className":"api-method post"},{"type":"doc","id":"anchor-platform/custody-server/send-refund","label":"Send Refund","className":"api-method post"},{"type":"doc","id":"anchor-platform/custody-server/generate-unique-address","label":"Generate Unique Address","className":"api-method post"}]},{"type":"category","label":"SEP-31","link":{"type":"generated-index","title":"SEP-31","slug":"/category/anchor-platform/custody-server/sep-31"},"items":[{"type":"doc","id":"anchor-platform/custody-server/create-custody-transaction","label":"Create Custody Transaction","className":"api-method post"},{"type":"doc","id":"anchor-platform/custody-server/send-payment","label":"Send Payment","className":"api-method post"},{"type":"doc","id":"anchor-platform/custody-server/send-refund","label":"Send Refund","className":"api-method post"},{"type":"doc","id":"anchor-platform/custody-server/generate-unique-address","label":"Generate Unique Address","className":"api-method post"}]}]; \ No newline at end of file diff --git a/docusaurus.config.js b/docusaurus.config.js index f15fd2fb5..8db7edf7b 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -60,6 +60,14 @@ const config = { }, template: "src/template.mustache", // Customize API MDX with mustache template }, + anchor_custody_api: { + specPath: "openapi/anchor-platform/bundled_custody.yml", // Path to designated spec file + outputDir: "api/anchor-platform/custody-server", // Output directory for generated .mdx docs + sidebarOptions: { + groupPathsBy: "tag", + }, + template: "src/template.mustache", // Customize API MDX with mustache template + }, stellar_disbursement_platform: { specPath: "openapi/stellar-disbursement-platform/bundled.yml", // Path to designated spec file outputDir: "api/stellar-disbursement-platform/resources", // Output directory for generated .mdx docs diff --git a/openapi/anchor-platform/Custody API.yml b/openapi/anchor-platform/Custody API.yml new file mode 100644 index 000000000..4372dd14f --- /dev/null +++ b/openapi/anchor-platform/Custody API.yml @@ -0,0 +1,234 @@ +openapi: 3.0.0 +info: + version: "2.0.0" + description: | + title: Custody Server API +tags: + - name: "Custody Transactions" + description: "Custody Server creates custody transaction record in DB." + - name: "Payments" + description: "Custody Server calls the configured custody service to send payment." + - name: "Refunds" + description: "Custody Server calls configured Custody Service to send refund. Custody transaction record is also created in DB." + - name: "Unique Address" + description: "Custody Server calls the configured custody service to generate deposit address and memo." +paths: + /transactions: + post: + description: Custody Server creates custody transaction record in DB. + summary: Create Custody Transaction + operationId: createCustodyTransaction + tags: + - Custody Transactions + - SEP-6 + - SEP-24 + - SEP-31 + requestBody: + content: + application/json: + schema: + type: object + properties: + id: + description: SEP transaction ID. + type: string + memo: + description: Memo value, that is used to identify inbound or outbound payments. + type: string + memoType: + description: Type of memo, that is used to identify inbound or outbound payments. + type: string + enum: + - id + - hash + - text + protocol: + description: Protocol of SEP transaction. + type: string + enum: + - 6 + - 24 + - 31 + fromAccount: + description: Source Stellar account. + type: string + toAccount: + description: Destination Stellar account. + type: string + amount: + description: Amount of the asset, that is sent/received. + type: string + amountFee: + description: Fee of SEP transaction. + type: string + asset: + description: Asset, that is sent/received. + type: string + kind: + description: Kind of the SEP transaction. + type: string + enum: + - deposit + - withdrawal + - receive + responses: + '200': + description: Success + content: + application/json: + schema: + type: object + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: './schemas.yml#/components/schemas/CustodyError' + /transactions/:id/payments: + post: + description: Custody Server calls the configured custody service to send payment. + summary: Send Payment + operationId: sendPayment + tags: + - Payments + - SEP-6 + - SEP-24 + - SEP-31 + requestBody: + content: + application/json: + schema: + type: object + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: './schemas.yml#/components/schemas/SendPaymentResponse' + '400': + description: Invalid Request. + content: + application/json: + schema: + $ref: './schemas.yml#/components/schemas/CustodyError' + '404': + description: Custody Transaction is not found. + content: + application/json: + schema: + $ref: './schemas.yml#/components/schemas/CustodyError' + '429': + description: Custody Service rate limit is exceeded. + content: + application/json: + schema: + $ref: './schemas.yml#/components/schemas/CustodyError' + '500': + description: Internal Server Error. + content: + application/json: + schema: + $ref: './schemas.yml#/components/schemas/CustodyError' + '503': + description: Custody Service is unavailable. + content: + application/json: + schema: + $ref: './schemas.yml#/components/schemas/CustodyError' + /transactions/:id/refunds: + post: + description: Custody Server calls configured Custody Service to send refund. Custody transaction record is also created in DB. + summary: Send Refund + operationId: sendRefund + tags: + - Refunds + - SEP-6 + - SEP-24 + - SEP-31 + requestBody: + content: + application/json: + schema: + type: object + properties: + memo: + description: Memo value, that will be added to the refund payment. + type: string + memoType: + description: Type of memo, that will be added to the refund payment. + type: string + amount: + description: Amount, that will be refunded. + type: string + amountFee: + description: Fee of the refund. + type: string + responses: + '200': + description: Success. + content: + application/json: + schema: + $ref: './schemas.yml#/components/schemas/SendPaymentResponse' + '400': + description: Invalid Request. + content: + application/json: + schema: + $ref: './schemas.yml#/components/schemas/CustodyError' + '404': + description: Custody Transaction is not found. + content: + application/json: + schema: + $ref: './schemas.yml#/components/schemas/CustodyError' + '429': + description: Custody Service rate limit is exceeded. + content: + application/json: + schema: + $ref: './schemas.yml#/components/schemas/CustodyError' + '500': + description: Internal Server Error. + content: + application/json: + schema: + $ref: './schemas.yml#/components/schemas/CustodyError' + '503': + description: Custody Service is unavailable. + content: + application/json: + schema: + $ref: './schemas.yml#/components/schemas/CustodyError' + /assets/{asset}/addresses: + post: + description: | + Custody Server calls the configured custody service to generate deposit address and memo. + + Format of `asset` parameter - `stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5` + summary: Generate Unique Address + operationId: generateUniqueAddress + tags: + - Unique Address + - SEP-6 + - SEP-24 + - SEP-31 + requestBody: + content: + application/json: + schema: + type: object + responses: + '200': + description: Success. + content: + application/json: + schema: + $ref: './schemas.yml#/components/schemas/GenerateUniqueAddressResponse' + '500': + description: Internal Server Error. + content: + application/json: + schema: + $ref: './schemas.yml#/components/schemas/CustodyError' \ No newline at end of file diff --git a/openapi/anchor-platform/bundled_custody.yml b/openapi/anchor-platform/bundled_custody.yml new file mode 100644 index 000000000..de32f8b5f --- /dev/null +++ b/openapi/anchor-platform/bundled_custody.yml @@ -0,0 +1,265 @@ +openapi: 3.0.0 +info: + version: 2.0.0 + description: '' + title: Custody Server API +tags: + - name: Custody Transactions + description: Custody Server creates custody transaction record in DB. + - name: Payments + description: Custody Server calls the configured custody service to send payment. + - name: Refunds + description: Custody Server calls configured Custody Service to send refund. Custody transaction record is also created in DB. + - name: Unique Address + description: Custody Server calls the configured custody service to generate deposit address and memo. +paths: + /transactions: + post: + description: Custody Server creates custody transaction record in DB. + summary: Create Custody Transaction + operationId: createCustodyTransaction + tags: + - Custody Transactions + - SEP-6 + - SEP-24 + - SEP-31 + requestBody: + content: + application/json: + schema: + type: object + properties: + id: + description: SEP transaction ID. + type: string + memo: + description: Memo value, that is used to identify inbound or outbound payments. + type: string + memoType: + description: Type of memo, that is used to identify inbound or outbound payments. + type: string + enum: + - id + - hash + - text + protocol: + description: Protocol of SEP transaction. + type: string + enum: + - 6 + - 24 + - 31 + fromAccount: + description: Source Stellar account. + type: string + toAccount: + description: Destination Stellar account. + type: string + amount: + description: Amount of the asset, that is sent/received. + type: string + amountFee: + description: Fee of SEP transaction. + type: string + asset: + description: Asset, that is sent/received. + type: string + kind: + description: Kind of the SEP transaction. + type: string + enum: + - deposit + - withdrawal + - receive + responses: + '200': + description: Success + content: + application/json: + schema: + type: object + '500': + description: Internal Server Error + content: + application/json: + schema: + $ref: '#/components/schemas/CustodyError' + /transactions/:id/payments: + post: + description: Custody Server calls the configured custody service to send payment. + summary: Send Payment + operationId: sendPayment + tags: + - Payments + - SEP-6 + - SEP-24 + - SEP-31 + requestBody: + content: + application/json: + schema: + type: object + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: '#/components/schemas/SendPaymentResponse' + '400': + description: Invalid Request. + content: + application/json: + schema: + $ref: '#/components/schemas/CustodyError' + '404': + description: Custody Transaction is not found. + content: + application/json: + schema: + $ref: '#/components/schemas/CustodyError' + '429': + description: Custody Service rate limit is exceeded. + content: + application/json: + schema: + $ref: '#/components/schemas/CustodyError' + '500': + description: Internal Server Error. + content: + application/json: + schema: + $ref: '#/components/schemas/CustodyError' + '503': + description: Custody Service is unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/CustodyError' + /transactions/:id/refunds: + post: + description: Custody Server calls configured Custody Service to send refund. Custody transaction record is also created in DB. + summary: Send Refund + operationId: sendRefund + tags: + - Refunds + - SEP-6 + - SEP-24 + - SEP-31 + requestBody: + content: + application/json: + schema: + type: object + properties: + memo: + description: Memo value, that will be added to the refund payment. + type: string + memoType: + description: Type of memo, that will be added to the refund payment. + type: string + amount: + description: Amount, that will be refunded. + type: string + amountFee: + description: Fee of the refund. + type: string + responses: + '200': + description: Success. + content: + application/json: + schema: + $ref: '#/components/schemas/SendPaymentResponse' + '400': + description: Invalid Request. + content: + application/json: + schema: + $ref: '#/components/schemas/CustodyError' + '404': + description: Custody Transaction is not found. + content: + application/json: + schema: + $ref: '#/components/schemas/CustodyError' + '429': + description: Custody Service rate limit is exceeded. + content: + application/json: + schema: + $ref: '#/components/schemas/CustodyError' + '500': + description: Internal Server Error. + content: + application/json: + schema: + $ref: '#/components/schemas/CustodyError' + '503': + description: Custody Service is unavailable. + content: + application/json: + schema: + $ref: '#/components/schemas/CustodyError' + /assets/{asset}/addresses: + post: + description: | + Custody Server calls the configured custody service to generate deposit address and memo. + + Format of `asset` parameter - `stellar:USDC:GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5` + summary: Generate Unique Address + operationId: generateUniqueAddress + tags: + - Unique Address + - SEP-6 + - SEP-24 + - SEP-31 + requestBody: + content: + application/json: + schema: + type: object + responses: + '200': + description: Success. + content: + application/json: + schema: + $ref: '#/components/schemas/GenerateUniqueAddressResponse' + '500': + description: Internal Server Error. + content: + application/json: + schema: + $ref: '#/components/schemas/CustodyError' +components: + schemas: + CustodyError: + type: object + required: + - error + properties: + error: + type: string + SendPaymentResponse: + type: object + properties: + id: + type: string + description: External TX ID from custody service. + GenerateUniqueAddressResponse: + type: object + properties: + address: + description: Deposit address to which the client should send funds. + type: string + memo: + description: Memo value, that should be added to payment by the client. + type: string + memoType: + description: Type of memo, that should be added to payment by the client. + type: string + enum: + - id + - hash + - text diff --git a/openapi/anchor-platform/schemas.yml b/openapi/anchor-platform/schemas.yml index 0ab80b1f4..9d3a216d3 100644 --- a/openapi/anchor-platform/schemas.yml +++ b/openapi/anchor-platform/schemas.yml @@ -810,3 +810,32 @@ components: properties: id: type: string + CustodyError: + type: object + required: + - error + properties: + error: + type: string + SendPaymentResponse: + type: object + properties: + id: + type: string + description: External TX ID from custody service. + GenerateUniqueAddressResponse: + type: object + properties: + address: + description: Deposit address to which the client should send funds. + type: string + memo: + description: Memo value, that should be added to payment by the client. + type: string + memoType: + description: Type of memo, that should be added to payment by the client. + type: string + enum: + - id + - hash + - text diff --git a/package.json b/package.json index d8aab088c..ae3989ed2 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,9 @@ "api:clean": "docusaurus clean-api-docs all", "api:bundle": "yarn bundle-horizon && yarn bundle-anchor-platform && yarn bundle-stellar-disbursement-platform", "bundle-horizon": "redocly bundle openapi/horizon/main.yml --output openapi/horizon/bundled.yml", - "bundle-anchor-platform": "redocly bundle openapi/anchor-platform/Platform\\ API.yml --output openapi/anchor-platform/bundled.yml && yarn redocly bundle openapi/anchor-platform/Callbacks\\ API.yml --output openapi/anchor-platform/bundled_callback.yml", + "bundle-anchor-platform": "redocly bundle openapi/anchor-platform/Platform\\ API.yml --output openapi/anchor-platform/bundled.yml && yarn redocly bundle openapi/anchor-platform/Callbacks\\ API.yml --output openapi/anchor-platform/bundled_callback.yml && yarn redocly bundle openapi/anchor-platform/Custody\\ API.yml --output openapi/anchor-platform/bundled_custody.yml", "bundle-stellar-disbursement-platform": "redocly bundle openapi/stellar-disbursement-platform/main.yml --output openapi/stellar-disbursement-platform/bundled.yml", - "api:gen": "docusaurus gen-api-docs all && rm api/horizon/resources/*.info.mdx && rm api/anchor-platform/resources/*.info.mdx && rm api/anchor-platform/callbacks/*.info.mdx && rm api/stellar-disbursement-platform/resources/*.info.mdx", + "api:gen": "docusaurus gen-api-docs all && rm api/horizon/resources/*.info.mdx && rm api/anchor-platform/resources/*.info.mdx && rm api/anchor-platform/callbacks/*.info.mdx && rm api/stellar-disbursement-platform/resources/*.info.mdx && rm api/anchor-platform/custody-server/*.info.mdx", "api": "yarn api:clean && yarn api:bundle && yarn api:gen", "write-translations": "docusaurus write-translations", "write-heading-ids": "docusaurus write-heading-ids",