diff --git a/src/common/converters/tests/safe_app.rs b/src/common/converters/tests/safe_app.rs index 40fc1493d..17c4bc488 100644 --- a/src/common/converters/tests/safe_app.rs +++ b/src/common/converters/tests/safe_app.rs @@ -1,6 +1,7 @@ use crate::common::models::backend::safe_apps::SafeApp as BackendSafeApp; use crate::routes::safe_apps::models::{ SafeApp, SafeAppAccessControlPolicies, SafeAppDomainAllowlistPolicy, SafeAppProvider, + SafeAppSocialProfile, }; #[test] @@ -41,6 +42,13 @@ fn safe_apps_several_apps() { access_control: SafeAppAccessControlPolicies::NoRestrictions, tags: vec!["tag1".to_string()], features: vec![], + developer_website: Some("https://curve.fi".to_string()), + social_profiles: vec![ + SafeAppSocialProfile { + platform: "TWITTER".to_string(), + url: "https://twitter.com/curvefinance".to_string(), + }, + ], }, SafeApp { id: 24, @@ -51,6 +59,8 @@ fn safe_apps_several_apps() { chain_ids: vec!["1".to_string(), "4".to_string(),"10".to_string(),"56".to_string(),"100".to_string(),"137".to_string(),"246".to_string(), "42161".to_string(), "43114".to_string(), "73799".to_string()], provider: None, access_control: SafeAppAccessControlPolicies::NoRestrictions, + developer_website: None, + social_profiles: vec![], tags: vec!["tag2".to_string()], features: vec![], }, @@ -70,6 +80,21 @@ fn safe_apps_several_apps() { }), tags: vec![], features: vec!["BATCHED_TRANSACTIONS".to_string()], + developer_website: Some("https://1inch.io/".to_string()), + social_profiles: vec![ + SafeAppSocialProfile { + platform: "TWITTER".to_string(), + url: "https://twitter.com/1inchExchange".to_string(), + }, + SafeAppSocialProfile { + platform: "DISCORD".to_string(), + url: "https://discord.gg/1inch".to_string(), + }, + SafeAppSocialProfile { + platform: "GITHUB".to_string(), + url: "https://github.com/1inch".to_string(), + } + ], }, SafeApp { id: 30, @@ -82,6 +107,8 @@ fn safe_apps_several_apps() { access_control: SafeAppAccessControlPolicies::NoRestrictions, tags: vec![], features: vec![], + developer_website: None, + social_profiles: vec![], }, SafeApp { id: 25, @@ -92,6 +119,8 @@ fn safe_apps_several_apps() { chain_ids: vec!["1".to_string(), "4".to_string(), "10".to_string(),"56".to_string(),"100".to_string(),"137".to_string(),"246".to_string(), "73799".to_string(), "42161".to_string(), "43114".to_string()], provider: None, access_control: SafeAppAccessControlPolicies::NoRestrictions, + developer_website: None, + social_profiles: vec![], tags: vec!["tag1".to_string(), "tag2".to_string()], features: vec![], }, diff --git a/src/common/models/backend/safe_apps.rs b/src/common/models/backend/safe_apps.rs index 744898a51..e8833eebc 100644 --- a/src/common/models/backend/safe_apps.rs +++ b/src/common/models/backend/safe_apps.rs @@ -14,6 +14,15 @@ pub struct SafeApp { #[serde(default)] pub tags: Vec, pub features: Vec, + pub developer_website: Option, + pub social_profiles: Vec, +} + +#[derive(Deserialize, Debug, PartialEq, Clone)] +#[serde(rename_all = "camelCase")] +pub struct SafeAppSocialProfile { + pub platform: String, + pub url: String, } #[derive(Deserialize, Debug, PartialEq, Clone)] diff --git a/src/routes/safe_apps/converters.rs b/src/routes/safe_apps/converters.rs index 2ebe55f94..0598e193f 100644 --- a/src/routes/safe_apps/converters.rs +++ b/src/routes/safe_apps/converters.rs @@ -3,6 +3,7 @@ use crate::common::models::backend::safe_apps::{ }; use crate::routes::safe_apps::models::{ SafeApp, SafeAppAccessControlPolicies, SafeAppDomainAllowlistPolicy, SafeAppProvider, + SafeAppSocialProfile, }; impl From for SafeApp { @@ -34,6 +35,15 @@ impl From for SafeApp { _ => SafeAppAccessControlPolicies::Unknown, }, tags: safe_app.tags, + developer_website: safe_app.developer_website, + social_profiles: safe_app + .social_profiles + .into_iter() + .map(|profile| SafeAppSocialProfile { + platform: profile.platform.to_string(), + url: profile.url.to_string(), + }) + .collect(), features: safe_app.features, } } diff --git a/src/routes/safe_apps/models.rs b/src/routes/safe_apps/models.rs index 76f8ac91a..c56da31eb 100644 --- a/src/routes/safe_apps/models.rs +++ b/src/routes/safe_apps/models.rs @@ -16,6 +16,16 @@ pub struct SafeApp { #[serde(default)] pub tags: Vec, pub features: Vec, + pub developer_website: Option, + pub social_profiles: Vec, +} + +#[derive(Serialize, Debug, PartialEq, Clone)] +#[serde(rename_all = "camelCase")] +#[cfg_attr(test, derive(serde::Deserialize))] +pub struct SafeAppSocialProfile { + pub platform: String, + pub url: String, } #[derive(Serialize, Debug, PartialEq, Clone)] diff --git a/src/routes/safe_apps/tests/json/response_safe_apps.json b/src/routes/safe_apps/tests/json/response_safe_apps.json index 92079ddbe..0428773f4 100644 --- a/src/routes/safe_apps/tests/json/response_safe_apps.json +++ b/src/routes/safe_apps/tests/json/response_safe_apps.json @@ -13,6 +13,13 @@ "accessControl": { "type": "NO_RESTRICTIONS" }, + "developerWebsite": "https://curve.fi", + "socialProfiles": [ + { + "platform": "TWITTER", + "url": "https://twitter.com/curvefinance" + } + ], "tags": [ "tag1" ], @@ -40,6 +47,8 @@ "accessControl": { "type": "NO_RESTRICTIONS" }, + "developerWebsite": null, + "socialProfiles": [], "tags": [ "tag2" ], @@ -60,6 +69,21 @@ "type": "DOMAIN_ALLOWLIST", "value": ["https://gnosis-safe.io", "https://dev.gnosis-safe.io"] }, + "developerWebsite": "https://1inch.io/", + "socialProfiles": [ + { + "platform": "TWITTER", + "url": "https://twitter.com/1inchExchange" + }, + { + "platform": "DISCORD", + "url": "https://discord.gg/1inch" + }, + { + "platform": "GITHUB", + "url": "https://github.com/1inch" + } + ], "tags": [], "features": ["BATCHED_TRANSACTIONS"] }, @@ -75,7 +99,9 @@ "type": "NO_RESTRICTIONS" }, "tags": [], - "features": [] + "features": [], + "developerWebsite": null, + "socialProfiles": [] }, { "id": 25, @@ -99,6 +125,8 @@ "accessControl": { "type": "NO_RESTRICTIONS" }, + "developerWebsite": null, + "socialProfiles": [], "tags": [ "tag1", "tag2" diff --git a/src/routes/safe_apps/tests/json/response_safe_apps_url_query.json b/src/routes/safe_apps/tests/json/response_safe_apps_url_query.json index 82e23b4e0..98fbf9d54 100644 --- a/src/routes/safe_apps/tests/json/response_safe_apps_url_query.json +++ b/src/routes/safe_apps/tests/json/response_safe_apps_url_query.json @@ -10,7 +10,9 @@ "accessControl": { "type": "NO_RESTRICTIONS" }, + "developerWebsite": null, "tags": [], + "socialProfiles": [], "features": [] } ] diff --git a/src/tests/json/safe_apps/polygon_safe_app_url_query.json b/src/tests/json/safe_apps/polygon_safe_app_url_query.json index c63dbf086..2f4bcbe6e 100644 --- a/src/tests/json/safe_apps/polygon_safe_app_url_query.json +++ b/src/tests/json/safe_apps/polygon_safe_app_url_query.json @@ -11,6 +11,8 @@ "type": "NO_RESTRICTIONS" }, "tags": [], - "features": [] + "features": [], + "developerWebsite": null, + "socialProfiles": [] } ] diff --git a/src/tests/json/safe_apps/polygon_safe_apps.json b/src/tests/json/safe_apps/polygon_safe_apps.json index 050207ae5..6612080ab 100644 --- a/src/tests/json/safe_apps/polygon_safe_apps.json +++ b/src/tests/json/safe_apps/polygon_safe_apps.json @@ -13,6 +13,13 @@ "accessControl": { "type": "NO_RESTRICTIONS" }, + "developerWebsite": "https://curve.fi", + "socialProfiles": [ + { + "platform": "TWITTER", + "url": "https://twitter.com/curvefinance" + } + ], "tags": [ "tag1" ], @@ -29,6 +36,8 @@ "accessControl": { "type": "NO_RESTRICTIONS" }, + "developerWebsite": null, + "socialProfiles": [], "tags": ["tag2"], "features": [] }, @@ -47,6 +56,21 @@ "type": "DOMAIN_ALLOWLIST", "value": ["https://gnosis-safe.io", "https://dev.gnosis-safe.io"] }, + "developerWebsite": "https://1inch.io/", + "socialProfiles": [ + { + "platform": "TWITTER", + "url": "https://twitter.com/1inchExchange" + }, + { + "platform": "DISCORD", + "url": "https://discord.gg/1inch" + }, + { + "platform": "GITHUB", + "url": "https://github.com/1inch" + } + ], "tags": [], "features": ["BATCHED_TRANSACTIONS"] }, @@ -62,7 +86,9 @@ "type": "NO_RESTRICTIONS" }, "tags": [], - "features": [] + "features": [], + "developerWebsite": null, + "socialProfiles": [] }, { "id": 25, @@ -75,6 +101,8 @@ "accessControl": { "type": "NO_RESTRICTIONS" }, + "developerWebsite": null, + "socialProfiles": [], "tags": ["tag1", "tag2"], "features": [] }