diff --git a/js/hubs/components/HubsModal.js b/js/hubs/components/HubsModal.js index c1518541..5c257287 100644 --- a/js/hubs/components/HubsModal.js +++ b/js/hubs/components/HubsModal.js @@ -47,7 +47,7 @@ const HubsModal = (props) => { >
- {`Hubs featuring: ${metadata.properties.artist.substring( + {`Hubs featuring: ${metadata.properties.artist?.substring( 0, 100 )} - "${metadata.properties.title.substring(0, 100)}"`} diff --git a/js/sdk/src/contexts/Audio/audio.js b/js/sdk/src/contexts/Audio/audio.js index 43bda805..455b8e66 100644 --- a/js/sdk/src/contexts/Audio/audio.js +++ b/js/sdk/src/contexts/Audio/audio.js @@ -296,7 +296,7 @@ const audioPlayerContextHelper = ({ if (playlistEntry) { setPlaylist([...playlist, playlistEntry]) return { - msg: `${playlistEntry.artist.substring( + msg: `${playlistEntry.artist?.substring( 0, 100 )} - ${playlistEntry.title.substring(0, 100)} added to queue`, diff --git a/js/web/components/CollectorModal.js b/js/web/components/CollectorModal.js index 42b8be27..bd4b224c 100644 --- a/js/web/components/CollectorModal.js +++ b/js/web/components/CollectorModal.js @@ -66,7 +66,7 @@ const CollectorModal = (props) => { >
- {`${metadata.properties.artist.substring( + {`${metadata.properties.artist?.substring( 0, 100 )} - "${metadata.properties.title.substring( diff --git a/js/web/components/HubsModal.js b/js/web/components/HubsModal.js index abf5cc1e..96d73100 100644 --- a/js/web/components/HubsModal.js +++ b/js/web/components/HubsModal.js @@ -56,7 +56,7 @@ const HubsModal = (props) => { >
- {`Hubs featuring: ${metadata.properties.artist.substring( + {`Hubs featuring: ${metadata.properties.artist?.substring( 0, 100 )} - "${metadata.properties.title.substring( diff --git a/js/web/components/ReleaseCard.js b/js/web/components/ReleaseCard.js index 8ba87a4c..c2b69b7b 100644 --- a/js/web/components/ReleaseCard.js +++ b/js/web/components/ReleaseCard.js @@ -172,8 +172,8 @@ const ReleaseCard = (props) => { - {metadata?.properties?.artist.substring(0, 100) || - metadata?.artist.substring(0, 100)}{' '} + {metadata?.properties?.artist?.substring(0, 100) || + metadata?.artist?.substring(0, 100)}{' '} - {title} @@ -186,7 +186,7 @@ const ReleaseCard = (props) => { src={ artwork?.meta.status === undefined ? '' : artwork.meta.previewUrl } - alt={metadata.artist} + alt={metadata.artist | 'alt'} layout="responsive" height={350} width={350} diff --git a/programs/nina/src/errors.rs b/programs/nina/src/errors.rs index 385242d6..fad9c30b 100644 --- a/programs/nina/src/errors.rs +++ b/programs/nina/src/errors.rs @@ -103,5 +103,7 @@ pub enum ErrorCode { #[msg("Post Update Via Hub Delegated Payer Mismatch")] PostUpdateViaHubPostDelegatePayerMismatch, #[msg("Post Init Via Hub Delegated Payer Mismatch")] - PostInitViaHubDelegatePayerMismatch + PostInitViaHubDelegatePayerMismatch, + #[msg("Hub Init Delegated Payer Mismatch")] + HubInitDelegatePayerMismatch, } \ No newline at end of file diff --git a/programs/nina/src/instructions/hub_init.rs b/programs/nina/src/instructions/hub_init.rs index 9d4886ee..6040669d 100644 --- a/programs/nina/src/instructions/hub_init.rs +++ b/programs/nina/src/instructions/hub_init.rs @@ -1,18 +1,22 @@ use anchor_lang::prelude::*; use anchor_spl::token::{self, Token}; use crate::state::*; -use crate::utils::{wrapped_sol}; +use crate::utils::{wrapped_sol,file_service_account}; +use crate::errors::ErrorCode; #[derive(Accounts)] #[instruction(params: HubInitParams)] pub struct HubInit<'info> { #[account(mut)] - pub authority: Signer<'info>, + pub payer: Signer<'info>, + /// CHECK: This is safe because we check in the handler that authority === payer + /// or that payer is nina operated file-service wallet + pub authority: UncheckedAccount<'info>, #[account( init, seeds = [b"nina-hub".as_ref(), params.handle.as_bytes()], bump, - payer = authority, + payer = payer, space = 337 )] pub hub: AccountLoader<'info, Hub>, @@ -26,7 +30,7 @@ pub struct HubInit<'info> { init, seeds = [b"nina-hub-collaborator".as_ref(), hub.key().as_ref(), authority.key().as_ref()], bump, - payer = authority, + payer = payer, space = 147, )] pub hub_collaborator: Account<'info, HubCollaborator>, @@ -40,6 +44,12 @@ pub fn handler ( ctx: Context, params: HubInitParams, ) -> Result<()> { + if ctx.accounts.payer.key() != ctx.accounts.authority.key() { + if ctx.accounts.payer.key() != file_service_account::ID { + return Err(ErrorCode::HubInitDelegatePayerMismatch.into()); + } + } + Hub::check_hub_fees( params.publish_fee, params.referral_fee diff --git a/tests/index.js b/tests/index.js index 98ef66f0..8812073d 100644 --- a/tests/index.js +++ b/tests/index.js @@ -3757,6 +3757,7 @@ describe('Hub', async () => { await nina.rpc.hubInit( hubParams, { accounts: { + payer: provider.wallet.publicKey, authority: provider.wallet.publicKey, hub, hubSigner, @@ -3819,6 +3820,7 @@ describe('Hub', async () => { await nina.rpc.hubInit( hubParams, { accounts: { + payer: provider.wallet.publicKey, authority: provider.wallet.publicKey, hub, hubSigner,