diff --git a/README.md b/README.md index 91a0f3a..793e07a 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,25 @@ $ yarn build This command generates static content into the `build` directory and can be served using any static contents hosting service. +### Bonadocs Playground Setup + +To set up and use the Bonadocs playground for interacting with Paycrest's gateway contract and APIs, follow these steps: + +1. **Create a Bonadocs Playground**: + - Go to [Bonadocs](https://bonadocs.com) and create a new playground. + - Add both USDT and the gateway contract on the chains where the gateway is deployed. + +2. **Add Bonadocs Actions**: + - Update the `docs/api.md` file to include Bonadocs actions for querying API endpoints using the `fetch` API in JavaScript. + - Update the `docs/contracts/Gateway.md` file to include Bonadocs actions for interacting with the gateway contract to create orders. + +3. **Configure Docusaurus**: + - Update the `docusaurus.config.js` file to include Bonadocs playground configuration. + +4. **Run the Playground**: + - Start the local development server using `yarn start`. + - Access the Bonadocs playground through the documentation site. + ## Contributing We welcome contributions to the Paycrest docs! To get started, follow these steps: diff --git a/docs/api.md b/docs/api.md index 5f2a90b..4f10daf 100644 --- a/docs/api.md +++ b/docs/api.md @@ -74,6 +74,12 @@ function App() { } ``` + + --- ## Fetch Supported Institutions @@ -140,6 +146,12 @@ function App() { } ``` + + --- ## Verify Account @@ -220,6 +232,12 @@ function App() { } ``` + + --- ## Fetch Supported Currencies @@ -299,6 +317,12 @@ function App() { } ``` + + --- ## Fetch Payment Order by ID @@ -401,6 +425,12 @@ function App() { } ``` + + --- ## Fetch All Payment Orders @@ -507,3 +537,9 @@ function App() { ); } ``` + + diff --git a/docs/contracts/Gateway.md b/docs/contracts/Gateway.md index dbab001..8269b1d 100644 --- a/docs/contracts/Gateway.md +++ b/docs/contracts/Gateway.md @@ -1,115 +1,121 @@ -# Gateway - -This contract serves as a gateway for creating orders and managing settlements. - -### fee - -```solidity -struct fee { - uint256 protocolFee; - uint256 liquidityProviderAmount; -} -``` - -### constructor - -```solidity -constructor() public -``` - -### initialize - - - -Initialize function. - -### onlyAggregator - -```solidity -modifier onlyAggregator() -``` - -_Modifier that allows only the aggregator to call a function._ - -### pause - - - -Pause the contract. - -### unpause - - - -Unpause the contract. - -### createOrder - - - -See `{createOrder-IGateway}`. - -### \_handler - -```solidity -function _handler(address _token, uint256 _amount, address _refundAddress, address _senderFeeRecipient, uint256 _senderFee, bytes32 _institutionCode) internal view -``` - -Internal function to handle order creation. - -#### Parameters - -| Name | Type | Description | -| -------------------- | ------- | --------------------------------------------------------- | -| \_token | address | The address of the token being traded. | -| \_amount | uint256 | The amount of tokens being traded. | -| \_refundAddress | address | The address to refund the tokens in case of cancellation. | -| \_senderFeeRecipient | address | The address of the recipient for the sender fee. | -| \_senderFee | uint256 | The amount of the sender fee. | -| \_institutionCode | bytes32 | The code of the institution associated with the order. | - -### settle - - - -See `{settle-IGateway}`. - -### refund - - - -See `{refund-IGateway}`. - -### getOrderInfo - - - -See `{getOrderInfo-IGateway}`. - -### isTokenSupported - - - -See `{isTokenSupported-IGateway}`. - -### getSupportedInstitutionByCode - - - -See `{getSupportedInstitutionByCode-IGateway}`. - -### getSupportedInstitutions - - - -See `{getSupportedInstitutions-IGateway}`. - -### getFeeDetails - - - -See `{getFeeDetails-IGateway}`. +# Gateway + +This contract serves as a gateway for creating orders and managing settlements. + +### fee + +```solidity +struct fee { + uint256 protocolFee; + uint256 liquidityProviderAmount; +} +``` + +### constructor + +```solidity +constructor() public +``` + +### initialize + + + +Initialize function. + +### onlyAggregator + +```solidity +modifier onlyAggregator() +``` + +_Modifier that allows only the aggregator to call a function._ + +### pause + + + +Pause the contract. + +### unpause + + + +Unpause the contract. + +### createOrder + + + +See `{createOrder-IGateway}`. + +### \_handler + +```solidity +function _handler(address _token, uint256 _amount, address _refundAddress, address _senderFeeRecipient, uint256 _senderFee, bytes32 _institutionCode) internal view +``` + +Internal function to handle order creation. + +#### Parameters + +| Name | Type | Description | +| -------------------- | ------- | --------------------------------------------------------- | +| \_token | address | The address of the token being traded. | +| \_amount | uint256 | The amount of tokens being traded. | +| \_refundAddress | address | The address to refund the tokens in case of cancellation. | +| \_senderFeeRecipient | address | The address of the recipient for the sender fee. | +| \_senderFee | uint256 | The amount of the sender fee. | +| \_institutionCode | bytes32 | The code of the institution associated with the order. | + +### settle + + + +See `{settle-IGateway}`. + +### refund + + + +See `{refund-IGateway}`. + +### getOrderInfo + + + +See `{getOrderInfo-IGateway}`. + +### isTokenSupported + + + +See `{isTokenSupported-IGateway}`. + +### getSupportedInstitutionByCode + + + +See `{getSupportedInstitutionByCode-IGateway}`. + +### getSupportedInstitutions + + + +See `{getSupportedInstitutions-IGateway}`. + +### getFeeDetails + + + +See `{getFeeDetails-IGateway}`. + + diff --git a/docusaurus.config.js b/docusaurus.config.js index 0afdb9c..d2e6604 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -1,5 +1,3 @@ -// @ts-check - import {themes as prismThemes} from 'prism-react-renderer'; /** @type {import('@docusaurus/types').Config} */ @@ -54,4 +52,15 @@ export default { darkTheme: prismThemes.dracula, }, }, -}; \ No newline at end of file + plugins: [ + [ + '@docusaurus/plugin-content-docs', + { + id: 'bonadocs', + path: 'bonadocs', + routeBasePath: 'bonadocs', + sidebarPath: require.resolve('./sidebars.js'), + }, + ], + ], +};