From f933d69f48611c48b00fc8a262f6f574b37160be Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Wed, 27 Nov 2024 14:03:19 +0000 Subject: [PATCH] Remove candid endpoints from User canisters (#6905) --- Cargo.lock | 2 - backend/canisters/user/CHANGELOG.md | 1 + backend/canisters/user/api/Cargo.toml | 2 - backend/canisters/user/api/can.did | 1369 ----------------- backend/canisters/user/api/src/main.rs | 71 - .../canisters/user/impl/src/queries/bio.rs | 2 +- .../impl/src/queries/cached_btc_address.rs | 2 +- .../user/impl/src/queries/chit_events.rs | 2 +- .../user/impl/src/queries/contacts.rs | 2 +- .../user/impl/src/queries/deleted_message.rs | 2 +- .../canisters/user/impl/src/queries/events.rs | 2 +- .../user/impl/src/queries/events_by_index.rs | 2 +- .../user/impl/src/queries/events_window.rs | 2 +- .../impl/src/queries/hot_group_exclusions.rs | 2 +- .../user/impl/src/queries/initial_state.rs | 2 +- .../user/impl/src/queries/local_user_index.rs | 2 +- .../impl/src/queries/message_activity_feed.rs | 2 +- .../src/queries/messages_by_message_index.rs | 2 +- .../user/impl/src/queries/public_profile.rs | 2 +- .../impl/src/queries/saved_crypto_accounts.rs | 2 +- .../user/impl/src/queries/search_messages.rs | 2 +- .../impl/src/queries/token_swap_status.rs | 2 +- .../user/impl/src/queries/updates.rs | 2 +- .../user/impl/src/updates/accept_p2p_swap.rs | 2 +- .../src/updates/add_hot_group_exclusions.rs | 4 +- .../user/impl/src/updates/add_reaction.rs | 2 +- .../user/impl/src/updates/approve_transfer.rs | 2 +- .../src/updates/archive_unarchive_chats.rs | 2 +- .../user/impl/src/updates/block_user.rs | 2 +- .../user/impl/src/updates/btc_address.rs | 2 +- .../src/updates/cancel_message_reminder.rs | 2 +- .../user/impl/src/updates/cancel_p2p_swap.rs | 2 +- .../user/impl/src/updates/claim_daily_chit.rs | 2 +- .../user/impl/src/updates/configure_wallet.rs | 2 +- .../user/impl/src/updates/create_community.rs | 2 +- .../user/impl/src/updates/create_group.rs | 2 +- .../user/impl/src/updates/delete_community.rs | 2 +- .../impl/src/updates/delete_direct_chat.rs | 2 +- .../user/impl/src/updates/delete_group.rs | 2 +- .../user/impl/src/updates/delete_messages.rs | 2 +- .../user/impl/src/updates/edit_message.rs | 2 +- .../user/impl/src/updates/join_video_call.rs | 2 +- .../user/impl/src/updates/leave_community.rs | 2 +- .../user/impl/src/updates/leave_group.rs | 2 +- .../src/updates/manage_favourite_chats.rs | 2 +- .../src/updates/mark_achievements_seen.rs | 2 +- .../mark_message_activity_feed_read.rs | 2 +- .../user/impl/src/updates/mark_read.rs | 2 +- .../impl/src/updates/mute_notifications.rs | 4 +- .../user/impl/src/updates/pin_chat_v2.rs | 2 +- .../user/impl/src/updates/remove_reaction.rs | 2 +- .../user/impl/src/updates/report_message.rs | 2 +- .../user/impl/src/updates/retrieve_btc.rs | 2 +- .../impl/src/updates/save_crypto_account.rs | 2 +- .../user/impl/src/updates/send_message.rs | 2 +- .../src/updates/send_message_with_transfer.rs | 4 +- .../user/impl/src/updates/set_avatar.rs | 2 +- .../user/impl/src/updates/set_bio.rs | 2 +- .../impl/src/updates/set_community_indexes.rs | 2 +- .../user/impl/src/updates/set_contact.rs | 2 +- .../impl/src/updates/set_message_reminder.rs | 2 +- .../user/impl/src/updates/set_pin_number.rs | 2 +- .../user/impl/src/updates/submit_proposal.rs | 2 +- .../user/impl/src/updates/swap_tokens.rs | 2 +- .../user/impl/src/updates/tip_message.rs | 2 +- .../user/impl/src/updates/unblock_user.rs | 2 +- .../impl/src/updates/undelete_messages.rs | 2 +- .../user/impl/src/updates/unpin_chat_v2.rs | 2 +- .../user/impl/src/updates/withdraw_crypto.rs | 2 +- 69 files changed, 68 insertions(+), 1511 deletions(-) delete mode 100644 backend/canisters/user/api/can.did diff --git a/Cargo.lock b/Cargo.lock index 05c1ae655f..ffd9e8692a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8414,13 +8414,11 @@ version = "0.1.0" dependencies = [ "bot_api_gateway_canister", "candid", - "candid_gen", "chat_events", "ic-ledger-types", "icrc-ledger-types", "proposals_bot_canister", "serde", - "serde_bytes", "ts-rs", "ts_export", "types", diff --git a/backend/canisters/user/CHANGELOG.md b/backend/canisters/user/CHANGELOG.md index 6b172c13ee..8929c003a5 100644 --- a/backend/canisters/user/CHANGELOG.md +++ b/backend/canisters/user/CHANGELOG.md @@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Remove all code to migrate events to stable memory ([#6858](https://github.com/open-chat-labs/open-chat/pull/6858)) - Remove the old `gate` field which has been superseded by `gate_config` ([#6902](https://github.com/open-chat-labs/open-chat/pull/6902)) +- Remove candid endpoints from User canisters ([#6905](https://github.com/open-chat-labs/open-chat/pull/6905)) ## [[2.0.1459](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1459-user)] - 2024-11-18 diff --git a/backend/canisters/user/api/Cargo.toml b/backend/canisters/user/api/Cargo.toml index 64f1d5686b..80bd42f784 100644 --- a/backend/canisters/user/api/Cargo.toml +++ b/backend/canisters/user/api/Cargo.toml @@ -8,13 +8,11 @@ edition = "2021" [dependencies] bot_api_gateway_canister = { path = "../../bot_api_gateway/api" } candid = { workspace = true } -candid_gen = { path = "../../../libraries/candid_gen" } chat_events = { path = "../../../libraries/chat_events" } ic-ledger-types = { workspace = true } icrc-ledger-types = { workspace = true } proposals_bot_canister = { path = "../../proposals_bot/api" } serde = { workspace = true } -serde_bytes = { workspace = true } ts_export = { path = "../../../libraries/ts_export" } ts-rs = { workspace = true } types = { path = "../../../libraries/types" } diff --git a/backend/canisters/user/api/can.did b/backend/canisters/user/api/can.did deleted file mode 100644 index 730245a948..0000000000 --- a/backend/canisters/user/api/can.did +++ /dev/null @@ -1,1369 +0,0 @@ -import "../../../libraries/types/can.did"; - -type SendMessageV2Args = record { - recipient : UserId; - thread_root_message_index : opt MessageIndex; - message_id : MessageId; - content : MessageContentInitial; - replies_to : opt ReplyContext; - forwarding : bool; - block_level_markdown : bool; - message_filter_failed : opt nat64; - pin : opt text; - correlation_id : nat64; -}; - -type SendMessageResponse = variant { - Success : SendMessageSuccess; - TransferSuccessV2 : record { - chat_id : ChatId; - event_index : EventIndex; - message_index : MessageIndex; - timestamp : TimestampMillis; - expires_at : opt TimestampMillis; - transfer : CompletedCryptoTransaction; - }; - MessageEmpty; - TextTooLong : nat32; - RecipientBlocked; - RecipientNotFound; - InvalidPoll : InvalidPollReason; - InvalidRequest : text; - TransferFailed : text; - TransferCannotBeZero; - TransferCannotBeToSelf; - P2PSwapSetUpFailed : text; - DuplicateMessageId; - UserSuspended; - PinRequired; - PinIncorrect : Milliseconds; - TooManyFailedPinAttempts : Milliseconds; - InternalError : text; -}; - -type SendMessageSuccess = record { - chat_id : ChatId; - event_index : EventIndex; - message_index : MessageIndex; - timestamp : TimestampMillis; - expires_at : opt TimestampMillis; -}; - -type StartVideoCallArgs = record { - message_id : MessageId; - initiator : UserId; - initiator_username : text; - initiator_display_name : opt text; - initiator_avatar_id : opt nat; - max_duration : opt Milliseconds; - call_type : VideoCallType; -}; - -type StartVideoCallResponse = variant { - Success; - NotAuthorized; -}; - -type EditMessageV2Args = record { - user_id : UserId; - thread_root_message_index : opt MessageIndex; - message_id : MessageId; - content : MessageContentInitial; - block_level_markdown : opt bool; - correlation_id : nat64; -}; - -type EditMessageResponse = variant { - Success; - MessageNotFound; - ChatNotFound; - UserBlocked; - UserSuspended; -}; - -type DeleteMessagesArgs = record { - user_id : UserId; - thread_root_message_index : opt MessageIndex; - message_ids : vec MessageId; - correlation_id : nat64; -}; - -type DeleteMessagesResponse = variant { - Success; - ChatNotFound; - UserSuspended; -}; - -type UndeleteMessagesArgs = record { - user_id : UserId; - thread_root_message_index : opt MessageIndex; - message_ids : vec MessageId; - correlation_id : nat64; -}; - -type UndeleteMessagesResponse = variant { - Success : record { - messages : vec Message; - }; - ChatNotFound; - UserSuspended; -}; - -type AddReactionArgs = record { - user_id : UserId; - thread_root_message_index : opt MessageIndex; - message_id : MessageId; - reaction : text; - correlation_id : nat64; -}; - -type AddReactionResponse = variant { - Success; - SuccessV2 : PushEventResult; - NoChange; - InvalidReaction; - MessageNotFound; - ChatNotFound; - UserSuspended; -}; - -type RemoveReactionArgs = record { - user_id : UserId; - thread_root_message_index : opt MessageIndex; - message_id : MessageId; - reaction : text; - correlation_id : nat64; -}; - -type RemoveReactionResponse = variant { - Success; - SuccessV2 : PushEventResult; - NoChange; - MessageNotFound; - ChatNotFound; - UserSuspended; -}; - -type ReportMessageArgs = record { - them : UserId; - thread_root_message_index : opt MessageIndex; - message_id : MessageId; - delete : bool; -}; - -type ReportMessageResponse = variant { - Success; - UserSuspended; - ChatNotFound; - MessageNotFound; - AlreadyReported; - InternalError : text; -}; - -type ApproveTransferArgs = record { - spender : Account; - ledger_canister_id : CanisterId; - amount : nat; - expires_in : opt Milliseconds; - pin : opt text; -}; - -type ApproveTransferResponse = variant { - Success; - ApproveError : ICRC2_ApproveError; - PinRequired; - PinIncorrect : Milliseconds; - TooManyFailedPinAttempts : Milliseconds; - InternalError : text; -}; - -type SwapTokensArgs = record { - swap_id : nat; - input_token : TokenInfo; - output_token : TokenInfo; - input_amount : nat; - exchange_args : variant { - ICPSwap : ExchangeArgs; - Sonic : ExchangeArgs; - KongSwap : ExchangeArgs; - }; - min_output_amount : nat; - pin : opt text; -}; - -type ExchangeArgs = record { - swap_canister_id : CanisterId; - zero_for_one : bool; -}; - -type SwapTokensResponse = variant { - Success : record { - amount_out : nat; - }; - SwapFailed; - PinRequired; - PinIncorrect : Milliseconds; - TooManyFailedPinAttempts : Milliseconds; - InternalError : text; -}; - -type TokenSwapStatusArgs = record { - swap_id : nat; -}; - -type TokenSwapStatusResponse = variant { - Success : record { - started : TimestampMillis; - icrc2 : bool; - auto_withdrawals : bool; - deposit_account : opt variant { - Ok; - Err : text; - }; - transfer : opt variant { - Ok : nat64; - Err : text; - }; - transfer_or_approval : opt variant { - Ok : nat64; - Err : text; - }; - notify_dex : opt variant { - Ok; - Err : text; - }; - amount_swapped : opt variant { - Ok : variant { - Ok : nat; - Err : text; - }; - Err : text; - }; - withdraw_from_dex : opt variant { - Ok : nat; - Err : text; - }; - success : opt bool; - }; - NotFound; -}; - -type AcceptP2PSwapArgs = record { - user_id : UserId; - thread_root_message_index : opt MessageIndex; - message_id : MessageId; - pin : opt text; -}; - -type AcceptP2PSwapResponse = variant { - Success : AcceptSwapSuccess; - InsufficientFunds; - StatusError : SwapStatusError; - SwapNotFound; - ChatNotFound; - UserSuspended; - PinRequired; - PinIncorrect : Milliseconds; - TooManyFailedPinAttempts : Milliseconds; - InternalError : text; -}; - -type CancelP2PSwapArgs = record { - user_id : UserId; - message_id : MessageId; -}; - -type CancelP2PSwapResponse = variant { - Success; - StatusError : SwapStatusError; - SwapNotFound; - ChatNotFound; -}; - -type EndVideoCallArgs = record { - user_id : UserId; - message_id : MessageId; -}; - -type EndVideoCallResponse = variant { - Success; - MessageNotFound; - AlreadyEnded; -}; - -type JoinVideoCallArgs = record { - user_id : UserId; - message_id : MessageId; -}; - -type JoinVideoCallResponse = variant { - Success; - MessageNotFound; - AlreadyEnded; - UserSuspended; - UserBlocked; - ChatNotFound; -}; - -type ClaimDailyChitResponse = variant { - Success : record { - chit_earned : nat32; - chit_balance : int32; - streak : nat16; - next_claim : TimestampMillis; - }; - AlreadyClaimed : TimestampMillis; -}; - -type TipMessageArgs = record { - chat : Chat; - recipient : UserId; - thread_root_message_index : opt MessageIndex; - message_id : MessageId; - ledger : CanisterId; - token : Cryptocurrency; - amount : nat; - fee : nat; - decimals : nat8; - pin : opt text; -}; - -type TipMessageResponse = variant { - Success; - ChatNotFound; - MessageNotFound; - CannotTipSelf; - NotAuthorized; - TransferCannotBeZero; - TransferNotToMessageSender; - TransferFailed : text; - ChatFrozen; - UserSuspended; - UserLapsed; - Retrying : text; - PinRequired; - PinIncorrect : Milliseconds; - TooManyFailedPinAttempts : Milliseconds; - InternalError : text; -}; - -type MarkAchievementsSeenArgs = record { - last_seen : TimestampMillis; -}; - -type MarkAchievementsSeenResponse = variant { - Success; -}; - -type MarkMessageActivityFeedReadArgs = record { - read_up_to : TimestampMillis; -}; - -type MarkMessageActivityFeedReadResponse = variant { - Success; -}; - -type MarkReadArgs = record { - messages_read : vec ChatMessagesRead; - community_messages_read : vec CommunityMessagesRead; -}; - -type ChatMessagesRead = record { - chat_id : ChatId; - read_up_to : opt MessageIndex; - threads : vec ThreadRead; - date_read_pinned : opt TimestampMillis; -}; - -type CommunityMessagesRead = record { - community_id : CommunityId; - channels_read : vec ChannelMessagesRead; -}; - -type ChannelMessagesRead = record { - channel_id : ChannelId; - read_up_to : opt MessageIndex; - threads : vec ThreadRead; - date_read_pinned : opt TimestampMillis; -}; - -type ThreadRead = record { - root_message_index : MessageIndex; - read_up_to : MessageIndex; -}; - -type MarkReadResponse = variant { - Success; -}; - -type BlockUserArgs = record { - user_id : UserId; -}; - -type BlockUserResponse = variant { - Success; - UserSuspended; -}; - -type UnblockUserArgs = record { - user_id : UserId; -}; - -type UnblockUserResponse = variant { - Success; - UserSuspended; -}; - -type DeleteDirectChatArgs = record { - user_id : UserId; - block_user : bool; -}; - -type DeleteDirectChatResponse = variant { - Success; - ChatNotFound; -}; - -type CreateGroupArgs = record { - is_public : bool; - name : text; - description : text; - avatar : opt Document; - history_visible_to_new_joiners : bool; - messages_visible_to_non_members: opt bool; - permissions_v2 : opt GroupPermissions; - rules : Rules; - events_ttl : opt Milliseconds; - gate_config : opt AccessGateConfig; -}; - -type CreateGroupSuccessResult = record { - chat_id : ChatId; -}; - -type CreateGroupResponse = variant { - Success : CreateGroupSuccessResult; - NameTooShort : FieldTooShortResult; - NameTooLong : FieldTooLongResult; - NameReserved; - DescriptionTooLong : FieldTooLongResult; - AvatarTooBig : FieldTooLongResult; - AccessGateInvalid; - MaxGroupsCreated : nat32; - NameTaken; - Throttled; - InternalError; - RulesTooLong : FieldTooLongResult; - RulesTooShort : FieldTooShortResult; - UserSuspended; - UnauthorizedToCreatePublicGroup; -}; - -type LeaveGroupArgs = record { - chat_id : ChatId; - correlation_id : nat64; -}; - -type LeaveGroupResponse = variant { - Success; - GroupNotFound; - GroupNotPublic; - InternalError : text; - CallerNotInGroup; - OwnerCannotLeave; - UserSuspended; - ChatFrozen; -}; - -type DeleteGroupArgs = record { - chat_id : ChatId; -}; - -type DeleteGroupResponse = variant { - Success; - NotAuthorized; - UserSuspended; - ChatFrozen; - InternalError : text; -}; - -type CreateCommunityArgs = record { - is_public : bool; - name : text; - description : text; - avatar : opt Document; - banner : opt Document; - history_visible_to_new_joiners : bool; - permissions : opt CommunityPermissions; - rules : Rules; - gate_config : opt AccessGateConfig; - default_channels : vec text; - default_channel_rules : opt Rules; - primary_language : text; -}; - -type CreateCommunitySuccessResult = record { - community_id : CommunityId; -}; - -type CreateCommunityResponse = variant { - Success : CreateCommunitySuccessResult; - NameTooShort : FieldTooShortResult; - NameTooLong : FieldTooLongResult; - NameReserved; - DescriptionTooLong : FieldTooLongResult; - AvatarTooBig : FieldTooLongResult; - BannerTooBig : FieldTooLongResult; - AccessGateInvalid; - MaxCommunitiesCreated : nat32; - NameTaken; - Throttled; - InternalError : text; - RulesTooLong : FieldTooLongResult; - RulesTooShort : FieldTooShortResult; - UserSuspended; - Unauthorized; - DefaultChannelsInvalid; -}; - -type LeaveCommunityArgs = record { - community_id : CommunityId; -}; - -type LeaveCommunityResponse = variant { - Success; - CommunityNotFound; - CommunityNotPublic; - InternalError : text; - UserNotInCommunity; - LastOwnerCannotLeave; - UserSuspended; - CommunityFrozen; -}; - -type DeleteCommunityArgs = record { - community_id : CommunityId; -}; - -type DeleteCommunityResponse = variant { - Success; - NotAuthorized; - UserSuspended; - UserLapsed; - CommunityFrozen; - InternalError : text; -}; - -type SetAvatarArgs = record { - avatar : opt Document; -}; - -type SetAvatarResponse = variant { - Success; - AvatarTooBig : FieldTooLongResult; - UserSuspended; -}; - -type MuteNotificationsArgs = record { - chat_id : ChatId; -}; - -type MuteNotificationsResponse = variant { - Success; - ChatNotFound; - InternalError : text; -}; - -type UnmuteNotificationsArgs = record { - chat_id : ChatId; -}; - -type UnmuteNotificationsResponse = variant { - Success; - ChatNotFound; - InternalError : text; -}; - -type AddHotGroupExclusionsArgs = record { - groups : vec ChatId; - duration : opt Milliseconds; -}; - -type AddHotGroupExclusionsResponse = variant { - Success; -}; - -type SetBioArgs = record { - text : text; -}; - -type SetBioResponse = variant { - Success; - TooLong : FieldTooLongResult; - UserSuspended; -}; - -type SetCommunityIndexesArgs = record { - indexes : vec record { CommunityId; nat32 }; -}; - -type SetCommunityIndexesResponse = variant { - Success; -}; - -type SetContactArgs = record { - contact : OptionalContact; -}; - -type OptionalContact = record { - user_id : UserId; - nickname : TextUpdate; -}; - -type SetContactResponse = variant { - Success; - NoChange; - NicknameTooLong : FieldTooLongResult; - NicknameTooShort : FieldTooShortResult; - UserSuspended; -}; - -type SetMessageReminderV2Args = record { - chat : Chat; - thread_root_message_index : opt MessageIndex; - event_index : EventIndex; - notes : opt text; - remind_at : TimestampMillis; -}; - -type SetMessageReminderResponse = variant { - Success : nat64; - ReminderDateInThePast; - NotesTooLong : FieldTooLongResult; - UserSuspended; -}; - -type CancelMessageReminderArgs = record { - reminder_id : nat64; -}; - -type CancelMessageReminderResponse = variant { - Success; -}; - -type SetPinNumberArgs = record { - new : opt text; - verification : variant { - None; - PIN : text; - Delegation : SignedDelegation; - }; -}; - -type SignedDelegation = record { - delegation : record { - pubkey : blob; - expiration : TimestampNanos; - }; - signature : blob; -}; - -type SetPinNumberResponse = variant { - Success; - TooShort : FieldTooShortResult; - TooLong : FieldTooLongResult; - PinRequired; - PinIncorrect : Milliseconds; - TooManyFailedPinAttempts : Milliseconds; - MalformedSignature : text; - DelegationTooOld; -}; - -type SendMessageWithTransferToChannelArgs = record { - community_id : CommunityId; - channel_id : ChannelId; - thread_root_message_index : opt MessageIndex; - message_id : MessageId; - content : MessageContentInitial; - sender_name : text; - sender_display_name : opt text; - replies_to : opt GroupReplyContext; - mentioned : vec User; - block_level_markdown : bool; - community_rules_accepted : opt Version; - channel_rules_accepted : opt Version; - message_filter_failed : opt nat64; - pin : opt text; -}; - -type SendMessageWithTransferToChannelResponse = variant { - Success : record { - event_index : EventIndex; - message_index : MessageIndex; - timestamp : TimestampMillis; - expires_at : opt TimestampMillis; - transfer : CompletedCryptoTransaction; - }; - TextTooLong : nat32; - RecipientBlocked; - UserNotInCommunity : opt CompletedCryptoTransaction; - UserNotInChannel : CompletedCryptoTransaction; - ChannelNotFound : CompletedCryptoTransaction; - CryptocurrencyNotSupported : Cryptocurrency; - InvalidRequest : text; - TransferFailed : text; - TransferCannotBeZero; - TransferCannotBeToSelf; - P2PSwapSetUpFailed : text; - UserSuspended; - UserLapsed; - CommunityFrozen; - RulesNotAccepted; - CommunityRulesNotAccepted; - Retrying : record { text; CompletedCryptoTransaction }; - PinRequired; - PinIncorrect : Milliseconds; - TooManyFailedPinAttempts : Milliseconds; - InternalError : text; -}; - -type SendMessageWithTransferToGroupArgs = record { - group_id : ChatId; - thread_root_message_index : opt MessageIndex; - message_id : MessageId; - content : MessageContentInitial; - sender_name : text; - sender_display_name : opt text; - replies_to : opt GroupReplyContext; - mentioned : vec User; - block_level_markdown : bool; - rules_accepted : opt Version; - message_filter_failed : opt nat64; - pin : opt text; - correlation_id : nat64; -}; - -type SendMessageWithTransferToGroupResponse = variant { - Success : record { - event_index : EventIndex; - message_index : MessageIndex; - timestamp : TimestampMillis; - expires_at : opt TimestampMillis; - transfer : CompletedCryptoTransaction; - }; - TextTooLong : nat32; - RecipientBlocked; - CallerNotInGroup : opt CompletedCryptoTransaction; - CryptocurrencyNotSupported : Cryptocurrency; - InvalidRequest : text; - TransferFailed : text; - TransferCannotBeZero; - TransferCannotBeToSelf; - P2PSwapSetUpFailed : text; - UserSuspended; - UserLapsed; - ChatFrozen; - RulesNotAccepted; - Retrying : record { text; CompletedCryptoTransaction }; - PinRequired; - PinIncorrect : Milliseconds; - TooManyFailedPinAttempts : Milliseconds; - InternalError : text; -}; - -type WithdrawCryptoArgs = record { - withdrawal : PendingCryptoTransaction; - pin : opt text; -}; - -type WithdrawCryptoResponse = variant { - Success : CompletedCryptoTransaction; - TransactionFailed : FailedCryptoTransaction; - CurrencyNotSupported; - PinRequired; - PinIncorrect : Milliseconds; - TooManyFailedPinAttempts : Milliseconds; - InternalError : text; -}; - -type PinChatV2Request = record { - chat : ChatInList; -}; - -type PinChatV2Response = variant { - Success; - ChatNotFound; -}; - -type UnpinChatV2Request = record { - chat : ChatInList; -}; - -type UnpinChatV2Response = variant { - Success; - ChatNotFound; -}; - -type ChatInList = variant { - Direct : ChatId; - Group : ChatId; - Favourite : Chat; - Community : record { CommunityId; ChannelId }; -}; - -type ManageFavouriteChatsArgs = record { - to_add : vec Chat; - to_remove : vec Chat; -}; - -type ManageFavouriteChatsResponse = variant { - Success; - UserSuspended; -}; - -type ArchiveUnarchiveChatsArgs = record { - to_archive : vec Chat; - to_unarchive : vec Chat; -}; - -type ArchiveUnarchiveChatsResponse = variant { - Success; - PartialSuccess : record { chats_not_found : vec Chat }; - Failure; - UserSuspended; -}; - -type NamedAccount = record { - name : text; - account : text; -}; - -type SaveCryptoAccountResponse = variant { - Success; - Invalid; - NameTaken; - UserSuspended; -}; - -type SavedCryptoAccountsResponse = variant { - Success : vec NamedAccount; -}; - -type SubmitProposalArgs = record { - governance_canister_id : CanisterId; - proposal : ProposalToSubmit; - ledger : CanisterId; - token : Cryptocurrency; - proposal_rejection_fee : nat; - transaction_fee : nat; -}; - -type ProposalToSubmit = record { - title : text; - summary : text; - url : text; - action : ProposalToSubmitAction; -}; - -type ProposalToSubmitAction = variant { - Motion; - TransferSnsTreasuryFunds : record { - treasury : variant { - ICP; - SNS; - }; - amount : nat; - to : Icrc1Account; - memo : opt nat64; - }; - UpgradeSnsToNextVersion; - UpgradeSnsControlledCanister : record { - canister_id : CanisterId; - new_canister_wasm : blob; - mode : variant { - Install; - Reinstall; - Upgrade; - }; - }; - ExecuteGenericNervousSystemFunction : record { - function_id : nat64; - payload : blob; - }; -}; - -type SubmitProposalResponse = variant { - Success; - GovernanceCanisterNotSupported; - InsufficientPayment : nat; - UserSuspended; - TransferFailed : text; - Retrying : text; - InternalError : text; -}; - -type InitialStateResponse = variant { - Success : record { - timestamp : TimestampMillis; - direct_chats : DirectChatsInitial; - group_chats : GroupChatsInitial; - favourite_chats : FavouriteChatsInitial; - communities : CommunitiesInitial; - avatar_id : opt nat; - blocked_users : vec UserId; - suspended : bool; - pin_number_settings : opt PinNumberSettings; - local_user_index_canister_id : CanisterId; - achievements : vec ChitEarned; - achievements_last_seen : TimestampMillis; - total_chit_earned : int32; - chit_balance : int32; - streak : nat16; - streak_ends : TimestampMillis; - next_daily_claim : TimestampMillis; - is_unique_person : bool; - wallet_config: WalletConfig; - referrals : vec Referral; - message_activity_summary : MessageActivitySummary; - }; -}; - -type DirectChatsInitial = record { - summaries : vec DirectChatSummary; - pinned : vec ChatId; -}; - -type GroupChatsInitial = record { - summaries : vec UserCanisterGroupChatSummary; - pinned : vec ChatId; -}; - -type CachedGroupChatSummaries = record { - summaries : vec GroupChatSummary; - timestamp : TimestampMillis; -}; - -type FavouriteChatsInitial = record { - chats : vec Chat; - pinned : vec Chat; -}; - -type CommunitiesInitial = record { - summaries : vec UserCanisterCommunitySummary; -}; - -type PinNumberSettings = record { - length : nat8; - attempts_blocked_until : opt TimestampMillis; -}; - -type UpdatesArgs = record { - updates_since : TimestampMillis; -}; - -type UpdatesResponse = variant { - Success : record { - timestamp : TimestampMillis; - username : opt text; - display_name : TextUpdate; - direct_chats : DirectChatsUpdates; - group_chats : GroupChatsUpdates; - favourite_chats : FavouriteChatsUpdates; - communities : CommunitiesUpdates; - avatar_id : DocumentIdUpdate; - blocked_users : opt vec UserId; - pin_number_settings : variant { - SetToSome : PinNumberSettings; - SetToNone; - NoChange; - }; - suspended : opt bool; - achievements : vec ChitEarned; - achievements_last_seen : opt TimestampMillis; - total_chit_earned : int32; - chit_balance : int32; - streak : nat16; - streak_ends : TimestampMillis; - next_daily_claim : TimestampMillis; - is_unique_person : opt bool; - wallet_config: opt WalletConfig; - referrals : vec Referral; - message_activity_summary : opt MessageActivitySummary; - }; - SuccessNoUpdates; -}; - -type MessageActivitySummary = record { - read_up_to : TimestampMillis; - latest_event_timestamp : TimestampMillis; - unread_count : nat32; -}; - -type DirectChatsUpdates = record { - added : vec DirectChatSummary; - updated : vec DirectChatSummaryUpdates; - removed : vec ChatId; - pinned : opt vec ChatId; -}; - -type GroupChatsUpdates = record { - added : vec UserCanisterGroupChatSummary; - updated : vec UserCanisterGroupChatSummaryUpdates; - removed : vec ChatId; - pinned : opt vec ChatId; -}; - -type CommunitiesUpdates = record { - added : vec UserCanisterCommunitySummary; - updated : vec UserCanisterCommunitySummaryUpdates; - removed : vec CommunityId; -}; - -type FavouriteChatsUpdates = record { - chats : opt vec Chat; - pinned : opt vec Chat; -}; - -type UserCanisterGroupChatSummary = record { - chat_id : ChatId; - local_user_index_canister_id : CanisterId; - read_by_me_up_to : opt MessageIndex; - threads_read : vec record { MessageIndex; MessageIndex }; - archived : bool; - date_read_pinned : opt TimestampMillis; -}; - -type UserCanisterGroupChatSummaryUpdates = record { - chat_id : ChatId; - read_by_me_up_to : opt MessageIndex; - threads_read : vec record { MessageIndex; MessageIndex }; - archived : opt bool; - date_read_pinned : opt TimestampMillis; -}; - -type UserCanisterCommunitySummary = record { - community_id : CommunityId; - local_user_index_canister_id : CanisterId; - channels : vec UserCanisterChannelSummary; - index : nat32; - archived : bool; - pinned : vec ChannelId; -}; - -type UserCanisterCommunitySummaryUpdates = record { - community_id : CommunityId; - channels : vec UserCanisterChannelSummaryUpdates; - index : opt nat32; - archived : opt bool; - pinned : opt vec ChannelId; -}; - -type UserCanisterChannelSummary = record { - channel_id : ChannelId; - read_by_me_up_to : opt MessageIndex; - threads_read : vec record { MessageIndex; MessageIndex }; - archived : bool; - date_read_pinned : opt TimestampMillis; -}; - -type UserCanisterChannelSummaryUpdates = record { - channel_id : ChannelId; - read_by_me_up_to : opt MessageIndex; - threads_read : vec record { MessageIndex; MessageIndex }; - archived : opt bool; - date_read_pinned : opt TimestampMillis; -}; - -type EventsArgs = record { - user_id : UserId; - thread_root_message_index : opt MessageIndex; - start_index : EventIndex; - ascending : bool; - max_messages : nat32; - max_events : nat32; - latest_known_update : opt TimestampMillis; -}; - -type EventsByIndexArgs = record { - user_id : UserId; - thread_root_message_index : opt MessageIndex; - events : vec EventIndex; - latest_known_update : opt TimestampMillis; -}; - -type EventsWindowArgs = record { - user_id : UserId; - thread_root_message_index : opt MessageIndex; - mid_point : MessageIndex; - max_messages : nat32; - max_events : nat32; - latest_known_update : opt TimestampMillis; -}; - -type EventsResponse = variant { - Success : EventsSuccessResult; - ChatNotFound; - ThreadMessageNotFound; - ReplicaNotUpToDateV2 : TimestampMillis; -}; - -type MessagesByMessageIndexArgs = record { - user_id : UserId; - thread_root_message_index : opt MessageIndex; - messages : vec MessageIndex; - latest_known_update : opt TimestampMillis; -}; - -type MessagesByMessageIndexResponse = variant { - Success : MessagesSuccessResult; - ChatNotFound; - ThreadMessageNotFound; - ReplicaNotUpToDateV2 : TimestampMillis; -}; - -type SearchMessagesArgs = record { - user_id : UserId; - search_term : text; - max_results : nat8; -}; - -type SearchMessagesResponse = variant { - Success : SearchMessagesSuccessResult; - TermTooShort : nat8; - TermTooLong : nat8; - InvalidTerm; - ChatNotFound; -}; - -type SearchMessagesSuccessResult = record { - matches : vec MessageMatch; -}; - -type BioArgs = record {}; - -type BioResponse = variant { - Success : text; -}; - -type ContactsArgs = record {}; - -type ContactsResponse = variant { - Success : record { - contacts : vec Contact; - }; -}; - -type Contact = record { - user_id : UserId; - nickname : opt text; -}; - -type PublicProfileArgs = record {}; - -type PublicProfileResponse = variant { - Success : PublicProfile; -}; - -type PublicProfile = record { - username : text; - display_name : opt text; - avatar_id : opt nat; - bio : text; - is_premium : bool; - phone_is_verified : bool; - created : TimestampMillis; -}; - -type HotGroupExclusionsArgs = record {}; - -type HotGroupExclusionsResponse = variant { - Success : vec ChatId; -}; - -type DeletedMessageArgs = record { - user_id : UserId; - message_id : MessageId; -}; - -type DeletedMessageResponse = variant { - Success : record { - content : MessageContent; - }; - ChatNotFound; - NotAuthorized; - MessageNotFound; - MessageHardDeleted; -}; - -type LocalUserIndexResponse = variant { - Success : CanisterId; -}; - -type ChitEventsArgs = record { - from : opt TimestampMillis; - to : opt TimestampMillis; - skip : opt nat32; - max : nat32; - ascending : bool; -}; - -type ChitEventsResponse = variant { - Success : record { - events : vec ChitEarned; - total : nat32; - }; -}; - -type CachedBtcAddressResponse = variant { - Success : text; - NotFound; -}; - -type BtcAddressResponse = variant { - Success : text; - InternalError : text; -}; - -type RetrieveBtcArgs = record { - amount : nat64; - address : text; -}; - -type RetrieveBtcResponse = variant { - Success : nat64; - ApproveError : text; - RetrieveBtcError : text; - InternalError : text; -}; - -type ConfigureWalletArgs = record { - config : WalletConfig; -}; - -type WalletConfig = variant { - Auto : AutoWallet; - Manual : ManualWallet; -}; - -type AutoWallet = record { - min_cents_visible : nat32; -}; - -type ManualWallet = record { - tokens : vec CanisterId; -}; - -type ConfigureWalletResponse = variant { - Success; -}; - -type Referral = record { - user_id : UserId; - status : ReferralStatus; -}; - -type MessageActivityFeedArgs = record { - since : TimestampMillis; -}; - -type MessageActivityFeedResponse = variant { - Success: record { - events : vec MessageActivityEvent; - total : nat32; - }; -}; - -type MessageActivityEvent = record { - chat : Chat; - thread_root_message_index : opt MessageIndex; - message_index : MessageIndex; - message_id : MessageId; - event_index : EventIndex; - activity : MessageActivity; - timestamp : TimestampMillis; - user_id : opt UserId; -}; - -type MessageActivity = variant { - Mention; - Reaction; - QuoteReply; - Tip; - Crypto; - PollVote; - P2PSwapAccepted; -}; - -service : { - send_message_v2 : (SendMessageV2Args) -> (SendMessageResponse); - edit_message_v2 : (EditMessageV2Args) -> (EditMessageResponse); - delete_messages : (DeleteMessagesArgs) -> (DeleteMessagesResponse); - undelete_messages : (UndeleteMessagesArgs) -> (UndeleteMessagesResponse); - add_reaction : (AddReactionArgs) -> (AddReactionResponse); - remove_reaction : (RemoveReactionArgs) -> (RemoveReactionResponse); - tip_message : (TipMessageArgs) -> (TipMessageResponse); - mark_achievements_seen : (MarkAchievementsSeenArgs) -> (MarkAchievementsSeenResponse); - mark_message_activity_feed_read : (MarkMessageActivityFeedReadArgs) -> (MarkMessageActivityFeedReadResponse); - mark_read : (MarkReadArgs) -> (MarkReadResponse); - block_user : (BlockUserArgs) -> (BlockUserResponse); - unblock_user : (UnblockUserArgs) -> (UnblockUserResponse); - delete_direct_chat : (DeleteDirectChatArgs) -> (DeleteDirectChatResponse); - create_group : (CreateGroupArgs) -> (CreateGroupResponse); - leave_group : (LeaveGroupArgs) -> (LeaveGroupResponse); - delete_group : (DeleteGroupArgs) -> (DeleteGroupResponse); - create_community : (CreateCommunityArgs) -> (CreateCommunityResponse); - leave_community : (LeaveCommunityArgs) -> (LeaveCommunityResponse); - delete_community : (DeleteCommunityArgs) -> (DeleteCommunityResponse); - set_avatar : (SetAvatarArgs) -> (SetAvatarResponse); - mute_notifications : (MuteNotificationsArgs) -> (MuteNotificationsResponse); - unmute_notifications : (UnmuteNotificationsArgs) -> (UnmuteNotificationsResponse); - add_hot_group_exclusions : (AddHotGroupExclusionsArgs) -> (AddHotGroupExclusionsResponse); - set_bio : (SetBioArgs) -> (SetBioResponse); - set_community_indexes : (SetCommunityIndexesArgs) -> (SetCommunityIndexesResponse); - set_contact : (SetContactArgs) -> (SetContactResponse); - set_message_reminder_v2 : (SetMessageReminderV2Args) -> (SetMessageReminderResponse); - cancel_message_reminder : (CancelMessageReminderArgs) -> (CancelMessageReminderResponse); - set_pin_number : (SetPinNumberArgs) -> (SetPinNumberResponse); - send_message_with_transfer_to_channel : (SendMessageWithTransferToChannelArgs) -> (SendMessageWithTransferToChannelResponse); - send_message_with_transfer_to_group : (SendMessageWithTransferToGroupArgs) -> (SendMessageWithTransferToGroupResponse); - withdraw_crypto_v2 : (WithdrawCryptoArgs) -> (WithdrawCryptoResponse); - pin_chat_v2 : (PinChatV2Request) -> (PinChatV2Response); - unpin_chat_v2 : (UnpinChatV2Request) -> (UnpinChatV2Response); - manage_favourite_chats : (ManageFavouriteChatsArgs) -> (ManageFavouriteChatsResponse); - archive_unarchive_chats : (ArchiveUnarchiveChatsArgs) -> (ArchiveUnarchiveChatsResponse); - save_crypto_account : (NamedAccount) -> (SaveCryptoAccountResponse); - submit_proposal : (SubmitProposalArgs) -> (SubmitProposalResponse); - report_message : (ReportMessageArgs) -> (ReportMessageResponse); - approve_transfer : (ApproveTransferArgs) -> (ApproveTransferResponse); - swap_tokens : (SwapTokensArgs) -> (SwapTokensResponse); - accept_p2p_swap : (AcceptP2PSwapArgs) -> (AcceptP2PSwapResponse); - cancel_p2p_swap : (CancelP2PSwapArgs) -> (CancelP2PSwapResponse); - start_video_call : (StartVideoCallArgs) -> (StartVideoCallResponse); - join_video_call : (JoinVideoCallArgs) -> (JoinVideoCallResponse); - end_video_call : (EndVideoCallArgs) -> (EndVideoCallResponse); - claim_daily_chit : (EmptyArgs) -> (ClaimDailyChitResponse); - configure_wallet : (ConfigureWalletArgs) -> (ConfigureWalletResponse); - - events : (EventsArgs) -> (EventsResponse) query; - events_by_index : (EventsByIndexArgs) -> (EventsResponse) query; - events_window : (EventsWindowArgs) -> (EventsResponse) query; - messages_by_message_index : (MessagesByMessageIndexArgs) -> (MessagesByMessageIndexResponse) query; - deleted_message : (DeletedMessageArgs) -> (DeletedMessageResponse) query; - - initial_state : (EmptyArgs) -> (InitialStateResponse) query; - updates : (UpdatesArgs) -> (UpdatesResponse) query; - search_messages : (SearchMessagesArgs) -> (SearchMessagesResponse) query; // Search just the messages of one direct chat - bio : (BioArgs) -> (BioResponse) query; - contacts : (ContactsArgs) -> (ContactsResponse) query; - public_profile : (PublicProfileArgs) -> (PublicProfileResponse) query; - hot_group_exclusions : (HotGroupExclusionsArgs) -> (HotGroupExclusionsResponse) query; - saved_crypto_accounts : (EmptyArgs) -> (SavedCryptoAccountsResponse) query; - token_swap_status : (TokenSwapStatusArgs) -> (TokenSwapStatusResponse) query; - local_user_index : (EmptyArgs) -> (LocalUserIndexResponse) query; - chit_events : (ChitEventsArgs) -> (ChitEventsResponse) query; - message_activity_feed : (MessageActivityFeedArgs) -> (MessageActivityFeedResponse) query; - - cached_btc_address : (EmptyArgs) -> (CachedBtcAddressResponse) query; - btc_address : (EmptyArgs) -> (BtcAddressResponse); - retrieve_btc : (RetrieveBtcArgs) -> (RetrieveBtcResponse); -}; diff --git a/backend/canisters/user/api/src/main.rs b/backend/canisters/user/api/src/main.rs index 4fb83adb48..4d58c09ae3 100644 --- a/backend/canisters/user/api/src/main.rs +++ b/backend/canisters/user/api/src/main.rs @@ -1,79 +1,8 @@ -use candid_gen::generate_candid_method; use std::env; use ts_export::generate_ts_method; #[allow(deprecated)] fn main() { - generate_candid_method!(user, message_activity_feed, query); - generate_candid_method!(user, bio, query); - generate_candid_method!(user, cached_btc_address, query); - generate_candid_method!(user, chit_events, query); - generate_candid_method!(user, contacts, query); - generate_candid_method!(user, deleted_message, query); - generate_candid_method!(user, events, query); - generate_candid_method!(user, events_by_index, query); - generate_candid_method!(user, events_window, query); - generate_candid_method!(user, hot_group_exclusions, query); - generate_candid_method!(user, initial_state, query); - generate_candid_method!(user, local_user_index, query); - generate_candid_method!(user, messages_by_message_index, query); - generate_candid_method!(user, public_profile, query); - generate_candid_method!(user, search_messages, query); - generate_candid_method!(user, saved_crypto_accounts, query); - generate_candid_method!(user, token_swap_status, query); - generate_candid_method!(user, updates, query); - - generate_candid_method!(user, accept_p2p_swap, update); - generate_candid_method!(user, add_hot_group_exclusions, update); - generate_candid_method!(user, add_reaction, update); - generate_candid_method!(user, approve_transfer, update); - generate_candid_method!(user, archive_unarchive_chats, update); - generate_candid_method!(user, block_user, update); - generate_candid_method!(user, btc_address, update); - generate_candid_method!(user, cancel_message_reminder, update); - generate_candid_method!(user, cancel_p2p_swap, update); - generate_candid_method!(user, claim_daily_chit, update); - generate_candid_method!(user, configure_wallet, update); - generate_candid_method!(user, create_community, update); - generate_candid_method!(user, create_group, update); - generate_candid_method!(user, delete_community, update); - generate_candid_method!(user, delete_direct_chat, update); - generate_candid_method!(user, delete_group, update); - generate_candid_method!(user, delete_messages, update); - generate_candid_method!(user, edit_message_v2, update); - generate_candid_method!(user, end_video_call, update); - generate_candid_method!(user, join_video_call, update); - generate_candid_method!(user, leave_community, update); - generate_candid_method!(user, leave_group, update); - generate_candid_method!(user, manage_favourite_chats, update); - generate_candid_method!(user, mark_achievements_seen, update); - generate_candid_method!(user, mark_message_activity_feed_read, update); - generate_candid_method!(user, mark_read, update); - generate_candid_method!(user, mute_notifications, update); - generate_candid_method!(user, pin_chat_v2, update); - generate_candid_method!(user, remove_reaction, update); - generate_candid_method!(user, report_message, update); - generate_candid_method!(user, retrieve_btc, update); - generate_candid_method!(user, save_crypto_account, update); - generate_candid_method!(user, send_message_with_transfer_to_channel, update); - generate_candid_method!(user, send_message_with_transfer_to_group, update); - generate_candid_method!(user, send_message_v2, update); - generate_candid_method!(user, set_avatar, update); - generate_candid_method!(user, set_bio, update); - generate_candid_method!(user, set_community_indexes, update); - generate_candid_method!(user, set_contact, update); - generate_candid_method!(user, set_message_reminder_v2, update); - generate_candid_method!(user, set_pin_number, update); - generate_candid_method!(user, start_video_call, update); - generate_candid_method!(user, submit_proposal, update); - generate_candid_method!(user, swap_tokens, update); - generate_candid_method!(user, tip_message, update); - generate_candid_method!(user, unblock_user, update); - generate_candid_method!(user, undelete_messages, update); - generate_candid_method!(user, unmute_notifications, update); - generate_candid_method!(user, unpin_chat_v2, update); - generate_candid_method!(user, withdraw_crypto_v2, update); - let directory = env::current_dir().unwrap().join("tsBindings/user"); if directory.exists() { std::fs::remove_dir_all(&directory).unwrap(); diff --git a/backend/canisters/user/impl/src/queries/bio.rs b/backend/canisters/user/impl/src/queries/bio.rs index b29446b052..65a94956f2 100644 --- a/backend/canisters/user/impl/src/queries/bio.rs +++ b/backend/canisters/user/impl/src/queries/bio.rs @@ -2,7 +2,7 @@ use crate::read_state; use canister_api_macros::query; use user_canister::bio::{Response::*, *}; -#[query(candid = true, msgpack = true)] +#[query(msgpack = true)] fn bio(_args: Args) -> Response { read_state(|state| Success(state.data.bio.value.clone())) } diff --git a/backend/canisters/user/impl/src/queries/cached_btc_address.rs b/backend/canisters/user/impl/src/queries/cached_btc_address.rs index c43288a017..2765b93fb2 100644 --- a/backend/canisters/user/impl/src/queries/cached_btc_address.rs +++ b/backend/canisters/user/impl/src/queries/cached_btc_address.rs @@ -3,7 +3,7 @@ use crate::read_state; use canister_api_macros::query; use user_canister::cached_btc_address::{Response::*, *}; -#[query(guard = "caller_is_owner", candid = true, msgpack = true)] +#[query(guard = "caller_is_owner", msgpack = true)] fn cached_btc_address(_args: Args) -> Response { match read_state(|state| state.data.btc_address.clone()) { Some(btc_address) => Success(btc_address), diff --git a/backend/canisters/user/impl/src/queries/chit_events.rs b/backend/canisters/user/impl/src/queries/chit_events.rs index 86ccf74902..a69bf6f383 100644 --- a/backend/canisters/user/impl/src/queries/chit_events.rs +++ b/backend/canisters/user/impl/src/queries/chit_events.rs @@ -3,7 +3,7 @@ use crate::{read_state, RuntimeState}; use canister_api_macros::query; use user_canister::chit_events::*; -#[query(guard = "caller_is_owner", candid = true, msgpack = true)] +#[query(guard = "caller_is_owner", msgpack = true)] fn chit_events(args: Args) -> Response { read_state(|state| chit_events_impl(args, state)) } diff --git a/backend/canisters/user/impl/src/queries/contacts.rs b/backend/canisters/user/impl/src/queries/contacts.rs index bedba69a3d..f689a29bec 100644 --- a/backend/canisters/user/impl/src/queries/contacts.rs +++ b/backend/canisters/user/impl/src/queries/contacts.rs @@ -3,7 +3,7 @@ use crate::read_state; use canister_api_macros::query; use user_canister::contacts::{Response::*, *}; -#[query(guard = "caller_is_owner", candid = true, msgpack = true)] +#[query(guard = "caller_is_owner", msgpack = true)] fn contacts(_args: Args) -> Response { read_state(|state| { Success(SuccessResult { diff --git a/backend/canisters/user/impl/src/queries/deleted_message.rs b/backend/canisters/user/impl/src/queries/deleted_message.rs index a37cfbb07b..b90298240a 100644 --- a/backend/canisters/user/impl/src/queries/deleted_message.rs +++ b/backend/canisters/user/impl/src/queries/deleted_message.rs @@ -4,7 +4,7 @@ use canister_api_macros::query; use chat_events::{MessageContentInternal, Reader}; use user_canister::deleted_message::{Response::*, *}; -#[query(guard = "caller_is_owner", candid = true, msgpack = true)] +#[query(guard = "caller_is_owner", msgpack = true)] fn deleted_message(args: Args) -> Response { read_state(|state| deleted_message_impl(args, state)) } diff --git a/backend/canisters/user/impl/src/queries/events.rs b/backend/canisters/user/impl/src/queries/events.rs index 949b0b923f..67e971b00c 100644 --- a/backend/canisters/user/impl/src/queries/events.rs +++ b/backend/canisters/user/impl/src/queries/events.rs @@ -7,7 +7,7 @@ use chat_events::{ChatEventsListReader, Reader}; use types::{EventIndex, EventOrExpiredRange, EventsResponse, MessageIndex, TimestampMillis, UserId}; use user_canister::events::{Response::*, *}; -#[query(guard = "caller_is_owner_or_local_user_index", candid = true, msgpack = true)] +#[query(guard = "caller_is_owner_or_local_user_index", msgpack = true)] fn events(args: Args) -> Response { read_state(|state| { read_events( diff --git a/backend/canisters/user/impl/src/queries/events_by_index.rs b/backend/canisters/user/impl/src/queries/events_by_index.rs index eaffe4dc26..4d24cfe1be 100644 --- a/backend/canisters/user/impl/src/queries/events_by_index.rs +++ b/backend/canisters/user/impl/src/queries/events_by_index.rs @@ -6,7 +6,7 @@ use chat_events::{ChatEventsListReader, Reader}; use types::{EventOrExpiredRange, UserId}; use user_canister::events_by_index::*; -#[query(guard = "caller_is_owner_or_local_user_index", candid = true, msgpack = true)] +#[query(guard = "caller_is_owner_or_local_user_index", msgpack = true)] fn events_by_index(args: Args) -> Response { read_state(|state| { read_events( diff --git a/backend/canisters/user/impl/src/queries/events_window.rs b/backend/canisters/user/impl/src/queries/events_window.rs index 4ceda13eec..8556032b73 100644 --- a/backend/canisters/user/impl/src/queries/events_window.rs +++ b/backend/canisters/user/impl/src/queries/events_window.rs @@ -6,7 +6,7 @@ use chat_events::{ChatEventsListReader, Reader}; use types::{EventOrExpiredRange, UserId}; use user_canister::events_window::*; -#[query(guard = "caller_is_owner_or_local_user_index", candid = true, msgpack = true)] +#[query(guard = "caller_is_owner_or_local_user_index", msgpack = true)] fn events_window(args: Args) -> Response { read_state(|state| { read_events( diff --git a/backend/canisters/user/impl/src/queries/hot_group_exclusions.rs b/backend/canisters/user/impl/src/queries/hot_group_exclusions.rs index a6c6817b39..789c95cc50 100644 --- a/backend/canisters/user/impl/src/queries/hot_group_exclusions.rs +++ b/backend/canisters/user/impl/src/queries/hot_group_exclusions.rs @@ -3,7 +3,7 @@ use crate::{read_state, RuntimeState}; use canister_api_macros::query; use user_canister::hot_group_exclusions::{Response::*, *}; -#[query(guard = "caller_is_owner", candid = true, msgpack = true)] +#[query(guard = "caller_is_owner", msgpack = true)] fn hot_group_exclusions(_args: Args) -> Response { read_state(hot_group_exclusions_impl) } diff --git a/backend/canisters/user/impl/src/queries/initial_state.rs b/backend/canisters/user/impl/src/queries/initial_state.rs index 4d7738eb42..a8aefba4cc 100644 --- a/backend/canisters/user/impl/src/queries/initial_state.rs +++ b/backend/canisters/user/impl/src/queries/initial_state.rs @@ -5,7 +5,7 @@ use types::UserId; use user_canister::initial_state::{Response::*, *}; use utils::time::{today, tomorrow}; -#[query(guard = "caller_is_owner", candid = true, msgpack = true)] +#[query(guard = "caller_is_owner", msgpack = true)] fn initial_state(_args: Args) -> Response { read_state(initial_state_impl) } diff --git a/backend/canisters/user/impl/src/queries/local_user_index.rs b/backend/canisters/user/impl/src/queries/local_user_index.rs index 3a952327d0..8e844cf26c 100644 --- a/backend/canisters/user/impl/src/queries/local_user_index.rs +++ b/backend/canisters/user/impl/src/queries/local_user_index.rs @@ -2,7 +2,7 @@ use crate::{read_state, RuntimeState}; use canister_api_macros::query; use user_canister::local_user_index::{Response::*, *}; -#[query(candid = true, msgpack = true)] +#[query(msgpack = true)] fn local_user_index(_args: Args) -> Response { read_state(local_user_index_impl) } diff --git a/backend/canisters/user/impl/src/queries/message_activity_feed.rs b/backend/canisters/user/impl/src/queries/message_activity_feed.rs index c00006f931..19dc451cac 100644 --- a/backend/canisters/user/impl/src/queries/message_activity_feed.rs +++ b/backend/canisters/user/impl/src/queries/message_activity_feed.rs @@ -3,7 +3,7 @@ use crate::{guards::caller_is_owner, RuntimeState}; use canister_api_macros::query; use user_canister::message_activity_feed::{Response::*, *}; -#[query(guard = "caller_is_owner", candid = true, msgpack = true)] +#[query(guard = "caller_is_owner", msgpack = true)] fn message_activity_feed(args: Args) -> Response { read_state(|state| message_activity_feed_impl(args, state)) } diff --git a/backend/canisters/user/impl/src/queries/messages_by_message_index.rs b/backend/canisters/user/impl/src/queries/messages_by_message_index.rs index 62d1c84c5d..0c2b4d7b32 100644 --- a/backend/canisters/user/impl/src/queries/messages_by_message_index.rs +++ b/backend/canisters/user/impl/src/queries/messages_by_message_index.rs @@ -6,7 +6,7 @@ use chat_events::Reader; use types::{EventIndex, MessagesResponse}; use user_canister::messages_by_message_index::{Response::*, *}; -#[query(guard = "caller_is_owner", candid = true, msgpack = true)] +#[query(guard = "caller_is_owner", msgpack = true)] fn messages_by_message_index(args: Args) -> Response { read_state(|state| messages_by_message_index_impl(args, state)) } diff --git a/backend/canisters/user/impl/src/queries/public_profile.rs b/backend/canisters/user/impl/src/queries/public_profile.rs index 54dbc4d667..9e8fb5652a 100644 --- a/backend/canisters/user/impl/src/queries/public_profile.rs +++ b/backend/canisters/user/impl/src/queries/public_profile.rs @@ -2,7 +2,7 @@ use crate::read_state; use canister_api_macros::query; use user_canister::public_profile::{Response::*, *}; -#[query(candid = true, msgpack = true)] +#[query(msgpack = true)] fn public_profile(_args: Args) -> Response { read_state(|state| { Success(PublicProfile { diff --git a/backend/canisters/user/impl/src/queries/saved_crypto_accounts.rs b/backend/canisters/user/impl/src/queries/saved_crypto_accounts.rs index f85ebab8c6..5e411d51fc 100644 --- a/backend/canisters/user/impl/src/queries/saved_crypto_accounts.rs +++ b/backend/canisters/user/impl/src/queries/saved_crypto_accounts.rs @@ -3,7 +3,7 @@ use crate::{read_state, RuntimeState}; use canister_api_macros::query; use user_canister::saved_crypto_accounts::{Response::*, *}; -#[query(guard = "caller_is_owner", candid = true, msgpack = true)] +#[query(guard = "caller_is_owner", msgpack = true)] fn saved_crypto_accounts(_args: Args) -> Response { read_state(saved_crypto_accounts_impl) } diff --git a/backend/canisters/user/impl/src/queries/search_messages.rs b/backend/canisters/user/impl/src/queries/search_messages.rs index 6bf8d49584..7ca51f687e 100644 --- a/backend/canisters/user/impl/src/queries/search_messages.rs +++ b/backend/canisters/user/impl/src/queries/search_messages.rs @@ -9,7 +9,7 @@ use user_canister::search_messages::{Response::*, *}; const MIN_TERM_LENGTH: u8 = 3; const MAX_TERM_LENGTH: u8 = 30; -#[query(guard = "caller_is_owner", candid = true, msgpack = true)] +#[query(guard = "caller_is_owner", msgpack = true)] fn search_messages(args: Args) -> Response { read_state(|state| search_messages_impl(args, state)) } diff --git a/backend/canisters/user/impl/src/queries/token_swap_status.rs b/backend/canisters/user/impl/src/queries/token_swap_status.rs index 3db29a8d31..e2cd718aa7 100644 --- a/backend/canisters/user/impl/src/queries/token_swap_status.rs +++ b/backend/canisters/user/impl/src/queries/token_swap_status.rs @@ -3,7 +3,7 @@ use crate::{read_state, RuntimeState}; use canister_api_macros::query; use user_canister::token_swap_status::{Response::*, *}; -#[query(guard = "caller_is_owner", candid = true, msgpack = true)] +#[query(guard = "caller_is_owner", msgpack = true)] fn token_swap_status(args: Args) -> Response { read_state(|state| token_swap_status_impl(args, state)) } diff --git a/backend/canisters/user/impl/src/queries/updates.rs b/backend/canisters/user/impl/src/queries/updates.rs index baf0ddcefc..d2bf8a51a5 100644 --- a/backend/canisters/user/impl/src/queries/updates.rs +++ b/backend/canisters/user/impl/src/queries/updates.rs @@ -5,7 +5,7 @@ use types::{OptionUpdate, TimestampMillis, UserId}; use user_canister::updates::{Response::*, *}; use utils::time::{today, tomorrow}; -#[query(guard = "caller_is_owner", candid = true, msgpack = true)] +#[query(guard = "caller_is_owner", msgpack = true)] fn updates(args: Args) -> Response { read_state(|state| updates_impl(args.updates_since, state)) } diff --git a/backend/canisters/user/impl/src/updates/accept_p2p_swap.rs b/backend/canisters/user/impl/src/updates/accept_p2p_swap.rs index df21d052b2..0f9e4760c8 100644 --- a/backend/canisters/user/impl/src/updates/accept_p2p_swap.rs +++ b/backend/canisters/user/impl/src/updates/accept_p2p_swap.rs @@ -17,7 +17,7 @@ use user_canister::{P2PSwapStatusChange, UserCanisterEvent}; use utils::consts::MEMO_P2P_SWAP_ACCEPT; use utils::time::NANOS_PER_MILLISECOND; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn accept_p2p_swap(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/add_hot_group_exclusions.rs b/backend/canisters/user/impl/src/updates/add_hot_group_exclusions.rs index 66cb8e96c6..54bf40bbba 100644 --- a/backend/canisters/user/impl/src/updates/add_hot_group_exclusions.rs +++ b/backend/canisters/user/impl/src/updates/add_hot_group_exclusions.rs @@ -4,7 +4,7 @@ use canister_api_macros::update; use canister_tracing_macros::trace; use user_canister::add_hot_group_exclusions::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn add_hot_group_exclusions(args: Args) -> Response { run_regular_jobs(); @@ -12,7 +12,7 @@ fn add_hot_group_exclusions(args: Args) -> Response { mutate_state(|state| add_hot_group_exclusions_impl(args, state)) } -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn add_recommended_group_exclusions(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/add_reaction.rs b/backend/canisters/user/impl/src/updates/add_reaction.rs index b3bc5e1071..5ca4218bc7 100644 --- a/backend/canisters/user/impl/src/updates/add_reaction.rs +++ b/backend/canisters/user/impl/src/updates/add_reaction.rs @@ -7,7 +7,7 @@ use types::{Achievement, EventIndex}; use user_canister::add_reaction::{Response::*, *}; use user_canister::{ToggleReactionArgs, UserCanisterEvent}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn add_reaction(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/approve_transfer.rs b/backend/canisters/user/impl/src/updates/approve_transfer.rs index 666d56d1be..84d22991f7 100644 --- a/backend/canisters/user/impl/src/updates/approve_transfer.rs +++ b/backend/canisters/user/impl/src/updates/approve_transfer.rs @@ -8,7 +8,7 @@ use types::TimestampNanos; use user_canister::approve_transfer::{Response::*, *}; use utils::time::NANOS_PER_MILLISECOND; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn approve_transfer(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/archive_unarchive_chats.rs b/backend/canisters/user/impl/src/updates/archive_unarchive_chats.rs index 376fbf789d..76cd089ca8 100644 --- a/backend/canisters/user/impl/src/updates/archive_unarchive_chats.rs +++ b/backend/canisters/user/impl/src/updates/archive_unarchive_chats.rs @@ -5,7 +5,7 @@ use canister_tracing_macros::trace; use types::{Chat, TimestampMillis, Timestamped}; use user_canister::archive_unarchive_chats::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn archive_unarchive_chats(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/block_user.rs b/backend/canisters/user/impl/src/updates/block_user.rs index 7ffddb38fd..2be970c8dd 100644 --- a/backend/canisters/user/impl/src/updates/block_user.rs +++ b/backend/canisters/user/impl/src/updates/block_user.rs @@ -4,7 +4,7 @@ use canister_api_macros::update; use canister_tracing_macros::trace; use user_canister::block_user::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn block_user(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/btc_address.rs b/backend/canisters/user/impl/src/updates/btc_address.rs index c2dcc7ac18..169fe0cfba 100644 --- a/backend/canisters/user/impl/src/updates/btc_address.rs +++ b/backend/canisters/user/impl/src/updates/btc_address.rs @@ -5,7 +5,7 @@ use canister_tracing_macros::trace; use ckbtc_minter_canister::CKBTC_MINTER_CANISTER_ID; use user_canister::btc_address::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn btc_address(_args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/cancel_message_reminder.rs b/backend/canisters/user/impl/src/updates/cancel_message_reminder.rs index 91eeab7523..d0ad25a120 100644 --- a/backend/canisters/user/impl/src/updates/cancel_message_reminder.rs +++ b/backend/canisters/user/impl/src/updates/cancel_message_reminder.rs @@ -6,7 +6,7 @@ use canister_tracing_macros::trace; use user_canister::cancel_message_reminder::{Response::*, *}; use utils::consts::OPENCHAT_BOT_USER_ID; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn cancel_message_reminder(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/cancel_p2p_swap.rs b/backend/canisters/user/impl/src/updates/cancel_p2p_swap.rs index 2cf67b7760..f7e6497d7c 100644 --- a/backend/canisters/user/impl/src/updates/cancel_p2p_swap.rs +++ b/backend/canisters/user/impl/src/updates/cancel_p2p_swap.rs @@ -6,7 +6,7 @@ use canister_tracing_macros::trace; use types::CancelP2PSwapResult; use user_canister::cancel_p2p_swap::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn cancel_p2p_swap(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/claim_daily_chit.rs b/backend/canisters/user/impl/src/updates/claim_daily_chit.rs index a9ca3845de..13f2116903 100644 --- a/backend/canisters/user/impl/src/updates/claim_daily_chit.rs +++ b/backend/canisters/user/impl/src/updates/claim_daily_chit.rs @@ -8,7 +8,7 @@ use types::{Achievement, ChitEarned, ChitEarnedReason, UserId}; use user_canister::claim_daily_chit::{Response::*, *}; use utils::time::tomorrow; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn claim_daily_chit(_args: Args) -> Response { mutate_state(claim_daily_chit_impl) diff --git a/backend/canisters/user/impl/src/updates/configure_wallet.rs b/backend/canisters/user/impl/src/updates/configure_wallet.rs index 7c64e4485d..4a9c25a917 100644 --- a/backend/canisters/user/impl/src/updates/configure_wallet.rs +++ b/backend/canisters/user/impl/src/updates/configure_wallet.rs @@ -5,7 +5,7 @@ use canister_tracing_macros::trace; use types::Timestamped; use user_canister::configure_wallet::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn configure_wallet(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/create_community.rs b/backend/canisters/user/impl/src/updates/create_community.rs index 0662517294..9207c79342 100644 --- a/backend/canisters/user/impl/src/updates/create_community.rs +++ b/backend/canisters/user/impl/src/updates/create_community.rs @@ -13,7 +13,7 @@ use utils::text_validation::{ RulesValidationError, }; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn create_community(mut args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/create_group.rs b/backend/canisters/user/impl/src/updates/create_group.rs index 2bbc787b40..75f52840a8 100644 --- a/backend/canisters/user/impl/src/updates/create_group.rs +++ b/backend/canisters/user/impl/src/updates/create_group.rs @@ -13,7 +13,7 @@ use utils::text_validation::{ validate_description, validate_group_name, validate_rules, NameValidationError, RulesValidationError, }; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn create_group(mut args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/delete_community.rs b/backend/canisters/user/impl/src/updates/delete_community.rs index 457a038783..71e6dee6ec 100644 --- a/backend/canisters/user/impl/src/updates/delete_community.rs +++ b/backend/canisters/user/impl/src/updates/delete_community.rs @@ -5,7 +5,7 @@ use canister_tracing_macros::trace; use community_canister::c2c_delete_community; use user_canister::delete_community::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn delete_community(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/delete_direct_chat.rs b/backend/canisters/user/impl/src/updates/delete_direct_chat.rs index 3084b8f309..2398074321 100644 --- a/backend/canisters/user/impl/src/updates/delete_direct_chat.rs +++ b/backend/canisters/user/impl/src/updates/delete_direct_chat.rs @@ -5,7 +5,7 @@ use canister_tracing_macros::trace; use chat_events::{DirectChatKeyPrefix, DirectChatThreadKeyPrefix, KeyPrefix}; use user_canister::delete_direct_chat::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn delete_direct_chat(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/delete_group.rs b/backend/canisters/user/impl/src/updates/delete_group.rs index d130035724..000ac256c1 100644 --- a/backend/canisters/user/impl/src/updates/delete_group.rs +++ b/backend/canisters/user/impl/src/updates/delete_group.rs @@ -5,7 +5,7 @@ use canister_tracing_macros::trace; use group_canister::c2c_delete_group; use user_canister::delete_group::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn delete_group(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/delete_messages.rs b/backend/canisters/user/impl/src/updates/delete_messages.rs index b191c0b857..d3f3594fd5 100644 --- a/backend/canisters/user/impl/src/updates/delete_messages.rs +++ b/backend/canisters/user/impl/src/updates/delete_messages.rs @@ -10,7 +10,7 @@ use user_canister::UserCanisterEvent; use utils::consts::OPENCHAT_BOT_USER_ID; use utils::time::MINUTE_IN_MS; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn delete_messages(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/edit_message.rs b/backend/canisters/user/impl/src/updates/edit_message.rs index 6135d1235a..92187d9579 100644 --- a/backend/canisters/user/impl/src/updates/edit_message.rs +++ b/backend/canisters/user/impl/src/updates/edit_message.rs @@ -8,7 +8,7 @@ use user_canister::edit_message_v2::{Response::*, *}; use user_canister::UserCanisterEvent; use utils::consts::OPENCHAT_BOT_USER_ID; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn edit_message_v2(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/join_video_call.rs b/backend/canisters/user/impl/src/updates/join_video_call.rs index 6f099e9473..e9b7317a7c 100644 --- a/backend/canisters/user/impl/src/updates/join_video_call.rs +++ b/backend/canisters/user/impl/src/updates/join_video_call.rs @@ -9,7 +9,7 @@ use user_canister::{ JoinVideoCall, UserCanisterEvent, }; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn join_video_call(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/leave_community.rs b/backend/canisters/user/impl/src/updates/leave_community.rs index c3cedc3ab0..d7babd1460 100644 --- a/backend/canisters/user/impl/src/updates/leave_community.rs +++ b/backend/canisters/user/impl/src/updates/leave_community.rs @@ -5,7 +5,7 @@ use canister_tracing_macros::trace; use community_canister::c2c_leave_community; use user_canister::leave_community::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn leave_community(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/leave_group.rs b/backend/canisters/user/impl/src/updates/leave_group.rs index 24ed2a796e..9f9b627196 100644 --- a/backend/canisters/user/impl/src/updates/leave_group.rs +++ b/backend/canisters/user/impl/src/updates/leave_group.rs @@ -5,7 +5,7 @@ use canister_tracing_macros::trace; use group_canister::c2c_leave_group; use user_canister::leave_group::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn leave_group(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/manage_favourite_chats.rs b/backend/canisters/user/impl/src/updates/manage_favourite_chats.rs index d0e46c940d..0243799737 100644 --- a/backend/canisters/user/impl/src/updates/manage_favourite_chats.rs +++ b/backend/canisters/user/impl/src/updates/manage_favourite_chats.rs @@ -5,7 +5,7 @@ use canister_tracing_macros::trace; use types::Achievement; use user_canister::manage_favourite_chats::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn manage_favourite_chats(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/mark_achievements_seen.rs b/backend/canisters/user/impl/src/updates/mark_achievements_seen.rs index ba9b3cad2f..6914017e80 100644 --- a/backend/canisters/user/impl/src/updates/mark_achievements_seen.rs +++ b/backend/canisters/user/impl/src/updates/mark_achievements_seen.rs @@ -4,7 +4,7 @@ use canister_api_macros::update; use canister_tracing_macros::trace; use user_canister::mark_achievements_seen::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn mark_achievements_seen(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/mark_message_activity_feed_read.rs b/backend/canisters/user/impl/src/updates/mark_message_activity_feed_read.rs index 1e5a4ce02a..451410d07f 100644 --- a/backend/canisters/user/impl/src/updates/mark_message_activity_feed_read.rs +++ b/backend/canisters/user/impl/src/updates/mark_message_activity_feed_read.rs @@ -4,7 +4,7 @@ use canister_api_macros::update; use canister_tracing_macros::trace; use user_canister::mark_message_activity_feed_read::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn mark_message_activity_feed_read(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/mark_read.rs b/backend/canisters/user/impl/src/updates/mark_read.rs index 224ea9008f..beb73ef1a2 100644 --- a/backend/canisters/user/impl/src/updates/mark_read.rs +++ b/backend/canisters/user/impl/src/updates/mark_read.rs @@ -6,7 +6,7 @@ use user_canister::mark_read::{Response::*, *}; use user_canister::{MarkMessagesReadArgs, UserCanisterEvent}; use utils::consts::OPENCHAT_BOT_USER_ID; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn mark_read(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/mute_notifications.rs b/backend/canisters/user/impl/src/updates/mute_notifications.rs index 9609172552..e7da7a476d 100644 --- a/backend/canisters/user/impl/src/updates/mute_notifications.rs +++ b/backend/canisters/user/impl/src/updates/mute_notifications.rs @@ -5,13 +5,13 @@ use canister_tracing_macros::trace; use types::{ChatId, Timestamped}; use user_canister::mute_notifications::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn mute_notifications(args: Args) -> Response { toggle_mute_notifications_impl(args.chat_id, true) } -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn unmute_notifications(args: Args) -> Response { toggle_mute_notifications_impl(args.chat_id, false) diff --git a/backend/canisters/user/impl/src/updates/pin_chat_v2.rs b/backend/canisters/user/impl/src/updates/pin_chat_v2.rs index 50148cf9eb..8e2041fed2 100644 --- a/backend/canisters/user/impl/src/updates/pin_chat_v2.rs +++ b/backend/canisters/user/impl/src/updates/pin_chat_v2.rs @@ -6,7 +6,7 @@ use types::Achievement; use user_canister::pin_chat_v2::{Response::*, *}; use user_canister::ChatInList; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn pin_chat_v2(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/remove_reaction.rs b/backend/canisters/user/impl/src/updates/remove_reaction.rs index a6fa41bd2b..30a0f3cd23 100644 --- a/backend/canisters/user/impl/src/updates/remove_reaction.rs +++ b/backend/canisters/user/impl/src/updates/remove_reaction.rs @@ -7,7 +7,7 @@ use types::EventIndex; use user_canister::remove_reaction::{Response::*, *}; use user_canister::{ToggleReactionArgs, UserCanisterEvent}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn remove_reaction(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/report_message.rs b/backend/canisters/user/impl/src/updates/report_message.rs index b4427817c6..5dc1ec1882 100644 --- a/backend/canisters/user/impl/src/updates/report_message.rs +++ b/backend/canisters/user/impl/src/updates/report_message.rs @@ -7,7 +7,7 @@ use types::{CanisterId, Chat, EventIndex, UserId}; use user_canister::report_message::{Response::*, *}; use user_index_canister::c2c_report_message; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn report_message(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/retrieve_btc.rs b/backend/canisters/user/impl/src/updates/retrieve_btc.rs index 7d305dbefc..56bdb94c0b 100644 --- a/backend/canisters/user/impl/src/updates/retrieve_btc.rs +++ b/backend/canisters/user/impl/src/updates/retrieve_btc.rs @@ -7,7 +7,7 @@ use types::Cryptocurrency; use user_canister::retrieve_btc::{Response::*, *}; use utils::time::{MINUTE_IN_MS, NANOS_PER_MILLISECOND}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn retrieve_btc(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/save_crypto_account.rs b/backend/canisters/user/impl/src/updates/save_crypto_account.rs index 874eb917d0..95ab859772 100644 --- a/backend/canisters/user/impl/src/updates/save_crypto_account.rs +++ b/backend/canisters/user/impl/src/updates/save_crypto_account.rs @@ -6,7 +6,7 @@ use canister_tracing_macros::trace; use ic_ledger_types::AccountIdentifier; use user_canister::save_crypto_account::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn save_crypto_account(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/send_message.rs b/backend/canisters/user/impl/src/updates/send_message.rs index 6a1ae47fd5..a908ae7812 100644 --- a/backend/canisters/user/impl/src/updates/send_message.rs +++ b/backend/canisters/user/impl/src/updates/send_message.rs @@ -20,7 +20,7 @@ use utils::consts::{MEMO_MESSAGE, OPENCHAT_BOT_USER_ID}; // The args are mutable because if the request contains a pending transfer, we process the transfer // and then update the message content to contain the completed transfer. -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn send_message_v2(mut args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/send_message_with_transfer.rs b/backend/canisters/user/impl/src/updates/send_message_with_transfer.rs index 91f04b5fc3..f3d13ae90f 100644 --- a/backend/canisters/user/impl/src/updates/send_message_with_transfer.rs +++ b/backend/canisters/user/impl/src/updates/send_message_with_transfer.rs @@ -19,7 +19,7 @@ use user_canister::{send_message_v2, send_message_with_transfer_to_channel}; use utils::consts::{MEMO_MESSAGE, MEMO_P2P_SWAP_CREATE, MEMO_PRIZE, PRIZE_FEE_PERCENT}; use utils::time::{NANOS_PER_MILLISECOND, SECOND_IN_MS}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn send_message_with_transfer_to_channel( args: send_message_with_transfer_to_channel::Args, @@ -144,7 +144,7 @@ async fn send_message_with_transfer_to_channel( } } -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn send_message_with_transfer_to_group( args: send_message_with_transfer_to_group::Args, diff --git a/backend/canisters/user/impl/src/updates/set_avatar.rs b/backend/canisters/user/impl/src/updates/set_avatar.rs index 4afc8237be..47098dd566 100644 --- a/backend/canisters/user/impl/src/updates/set_avatar.rs +++ b/backend/canisters/user/impl/src/updates/set_avatar.rs @@ -7,7 +7,7 @@ use types::{Achievement, CanisterId, Timestamped}; use user_canister::set_avatar::*; use utils::document_validation::validate_avatar; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn set_avatar(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/set_bio.rs b/backend/canisters/user/impl/src/updates/set_bio.rs index 042cd18f25..d9fbbc16ca 100644 --- a/backend/canisters/user/impl/src/updates/set_bio.rs +++ b/backend/canisters/user/impl/src/updates/set_bio.rs @@ -7,7 +7,7 @@ use user_canister::set_bio::{Response::*, *}; const MAX_BIO_LEN: u32 = 2000; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn set_bio(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/set_community_indexes.rs b/backend/canisters/user/impl/src/updates/set_community_indexes.rs index 16c0889510..d0da7bac92 100644 --- a/backend/canisters/user/impl/src/updates/set_community_indexes.rs +++ b/backend/canisters/user/impl/src/updates/set_community_indexes.rs @@ -5,7 +5,7 @@ use canister_tracing_macros::trace; use types::Timestamped; use user_canister::set_community_indexes::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn set_community_indexes(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/set_contact.rs b/backend/canisters/user/impl/src/updates/set_contact.rs index 26afc934fd..0601ea81ec 100644 --- a/backend/canisters/user/impl/src/updates/set_contact.rs +++ b/backend/canisters/user/impl/src/updates/set_contact.rs @@ -5,7 +5,7 @@ use canister_api_macros::update; use canister_tracing_macros::trace; use user_canister::set_contact::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn set_contact(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/set_message_reminder.rs b/backend/canisters/user/impl/src/updates/set_message_reminder.rs index 9dc702a093..151e4237ed 100644 --- a/backend/canisters/user/impl/src/updates/set_message_reminder.rs +++ b/backend/canisters/user/impl/src/updates/set_message_reminder.rs @@ -11,7 +11,7 @@ use user_canister::C2CReplyContext; const MAX_NOTES_LENGTH: usize = 1000; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn set_message_reminder_v2(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/set_pin_number.rs b/backend/canisters/user/impl/src/updates/set_pin_number.rs index 0d26e68ccc..18aac90d62 100644 --- a/backend/canisters/user/impl/src/updates/set_pin_number.rs +++ b/backend/canisters/user/impl/src/updates/set_pin_number.rs @@ -11,7 +11,7 @@ use utils::time::{MINUTE_IN_MS, NANOS_PER_MILLISECOND}; const MIN_LENGTH: usize = 4; const MAX_LENGTH: usize = 20; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn set_pin_number(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/submit_proposal.rs b/backend/canisters/user/impl/src/updates/submit_proposal.rs index 4e5c248c6f..6505f1a78a 100644 --- a/backend/canisters/user/impl/src/updates/submit_proposal.rs +++ b/backend/canisters/user/impl/src/updates/submit_proposal.rs @@ -7,7 +7,7 @@ use types::icrc1::PendingCryptoTransaction; use types::{CanisterId, UserId}; use user_canister::submit_proposal::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn submit_proposal(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/swap_tokens.rs b/backend/canisters/user/impl/src/updates/swap_tokens.rs index 79af29fcb3..6af361b0ce 100644 --- a/backend/canisters/user/impl/src/updates/swap_tokens.rs +++ b/backend/canisters/user/impl/src/updates/swap_tokens.rs @@ -17,7 +17,7 @@ use user_canister::swap_tokens::{Response::*, *}; use utils::consts::{MEMO_SWAP, MEMO_SWAP_APPROVAL}; use utils::time::{NANOS_PER_MILLISECOND, SECOND_IN_MS}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn swap_tokens(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/tip_message.rs b/backend/canisters/user/impl/src/updates/tip_message.rs index a2cfa17076..d35ed1def1 100644 --- a/backend/canisters/user/impl/src/updates/tip_message.rs +++ b/backend/canisters/user/impl/src/updates/tip_message.rs @@ -15,7 +15,7 @@ use user_canister::UserCanisterEvent; use utils::consts::MEMO_TIP; use utils::time::NANOS_PER_MILLISECOND; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn tip_message(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/unblock_user.rs b/backend/canisters/user/impl/src/updates/unblock_user.rs index 9a5d5c7613..5644a96b5a 100644 --- a/backend/canisters/user/impl/src/updates/unblock_user.rs +++ b/backend/canisters/user/impl/src/updates/unblock_user.rs @@ -4,7 +4,7 @@ use canister_api_macros::update; use canister_tracing_macros::trace; use user_canister::unblock_user::{Response::*, *}; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn unblock_user(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/undelete_messages.rs b/backend/canisters/user/impl/src/updates/undelete_messages.rs index c6e4de70ac..37194e8b9b 100644 --- a/backend/canisters/user/impl/src/updates/undelete_messages.rs +++ b/backend/canisters/user/impl/src/updates/undelete_messages.rs @@ -8,7 +8,7 @@ use user_canister::undelete_messages::{Response::*, *}; use user_canister::UserCanisterEvent; use utils::consts::OPENCHAT_BOT_USER_ID; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn undelete_messages(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/unpin_chat_v2.rs b/backend/canisters/user/impl/src/updates/unpin_chat_v2.rs index 4c74df72c7..dc4c8e0939 100644 --- a/backend/canisters/user/impl/src/updates/unpin_chat_v2.rs +++ b/backend/canisters/user/impl/src/updates/unpin_chat_v2.rs @@ -5,7 +5,7 @@ use canister_tracing_macros::trace; use user_canister::unpin_chat_v2::{Response::*, *}; use user_canister::ChatInList; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] fn unpin_chat_v2(args: Args) -> Response { run_regular_jobs(); diff --git a/backend/canisters/user/impl/src/updates/withdraw_crypto.rs b/backend/canisters/user/impl/src/updates/withdraw_crypto.rs index 0dfd44cde3..bb5f6fddd7 100644 --- a/backend/canisters/user/impl/src/updates/withdraw_crypto.rs +++ b/backend/canisters/user/impl/src/updates/withdraw_crypto.rs @@ -7,7 +7,7 @@ use canister_tracing_macros::trace; use user_canister::withdraw_crypto_v2::{Response::*, *}; use utils::consts::MEMO_SEND; -#[update(guard = "caller_is_owner", candid = true, msgpack = true)] +#[update(guard = "caller_is_owner", msgpack = true)] #[trace] async fn withdraw_crypto_v2(args: Args) -> Response { run_regular_jobs();