Add blockchain ID to instance API response

This commit is contained in:
silverpill 2022-05-28 22:14:55 +00:00
parent 4ffec71c24
commit b95d409010
3 changed files with 15 additions and 1 deletions

View file

@ -6,12 +6,14 @@ Built on [ActivityPub](https://activitypub.rocks/) protocol, self-hosted, lightw
Unique features enabled by blockchain integration:
- [Sign-in with Ethereum wallet](https://eips.ethereum.org/EIPS/eip-4361).
- [Sign-in with a wallet](https://eips.ethereum.org/EIPS/eip-4361).
- Donations.
- Paid subscriptions.
- Proving membership with a token.
- Converting posts into NFTs.
Currently only Ethereum and other EVM-compatible blockchains are supported.
Smart contracts repo: https://codeberg.org/silverpill/mitra-contracts
Frontend repo: https://codeberg.org/silverpill/mitra-web

View file

@ -762,15 +762,23 @@ components:
description: Post character limit.
type: integer
example: 5000
blockchain_id:
description: CAIP-2 chain ID.
type: string
nullable: true
example: 'eip155:1'
blockchain_explorer_url:
description: Blockchain explorer base URL.
type: string
nullable: true
blockchain_contract_address:
description: Blockchain contract address.
type: string
nullable: true
ipfs_gateway_url:
description: IPFS gateway URL.
type: string
nullable: true
Mention:
type: object
properties:
@ -802,6 +810,7 @@ components:
- favourite
- mention
- reblog
- subscription
example: reply
created_at:
description: The timestamp of the notification.

View file

@ -14,6 +14,7 @@ pub struct InstanceInfo {
login_message: String,
post_character_limit: usize,
blockchain_id: Option<String>,
blockchain_explorer_url: Option<String>,
blockchain_contract_address: Option<String>,
ipfs_gateway_url: Option<String>,
@ -38,6 +39,8 @@ impl From<&Config> for InstanceInfo {
registrations: config.registrations_open,
login_message: config.login_message.clone(),
post_character_limit: config.post_character_limit,
blockchain_id: config.blockchain.as_ref()
.map(|val| val.chain_id.clone()),
blockchain_explorer_url: config.blockchain.as_ref()
.and_then(|val| val.explorer_url.clone()),
blockchain_contract_address: config.blockchain.as_ref()