From 67656741183a11a0f06a177b4acb0ef30081ff7e Mon Sep 17 00:00:00 2001 From: silverpill Date: Wed, 16 Nov 2022 15:11:25 +0000 Subject: [PATCH] Add token gate feature flag to instance info --- docs/openapi.yaml | 4 ++++ src/mastodon_api/instance/types.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 421b88e..d4bbaeb 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -1242,6 +1242,10 @@ components: description: Blockchain features. type: object properties: + gate: + description: Token gate feature flag. + type: boolean + example: true minter: description: Minter feature flag. type: boolean diff --git a/src/mastodon_api/instance/types.rs b/src/mastodon_api/instance/types.rs index 0fe30dd..3965102 100644 --- a/src/mastodon_api/instance/types.rs +++ b/src/mastodon_api/instance/types.rs @@ -14,6 +14,7 @@ struct InstanceStats { #[derive(Serialize)] struct BlockchainFeatures { + gate: bool, minter: bool, subscriptions: bool, } @@ -63,11 +64,13 @@ impl InstanceInfo { Some(BlockchainConfig::Ethereum(ethereum_config)) => { let features = if let Some(contract_set) = maybe_blockchain { BlockchainFeatures { + gate: contract_set.gate.is_some(), minter: contract_set.collectible.is_some(), subscriptions: contract_set.subscription.is_some(), } } else { BlockchainFeatures { + gate: false, minter: false, subscriptions: false, } @@ -85,6 +88,7 @@ impl InstanceInfo { }, Some(BlockchainConfig::Monero(monero_config)) => { let features = BlockchainFeatures { + gate: false, minter: false, subscriptions: true, };