Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added notification hooks #84

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/api/mutation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { useNewAccountReal } from './use-new-account-real';
import { useNewAccountVirtual } from './use-new-account-virtual';
import { useNewAccountWallet } from './use-new-account-wallet';
import { useNotificationEvent } from './use-notification-event';
import { useNotificationsUpdateStatus } from './use-notifications-update-status';
import { useP2pAdvertCreate } from './use-p2p-advert-create';
import { useP2pAdvertUpdate } from './use-p2p-advert-update';
import { useP2pAdvertiserUpdate } from './use-p2p-advertiser-update';
Expand Down Expand Up @@ -115,6 +116,7 @@ export {
useNewAccountVirtual,
useNewAccountWallet,
useNotificationEvent,
useNotificationsUpdateStatus,
useP2pAdvertCreate,
useP2pAdvertUpdate,
useP2pAdvertiserUpdate,
Expand Down
11 changes: 11 additions & 0 deletions src/api/mutation/use-notifications-update-status.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { useMutation } from '../../base';
import { AugmentedMutationOptions } from '../../base/use-mutation';

export const useNotificationsUpdateStatus = ({ ...props }: Omit<AugmentedMutationOptions<'notifications_update_status'>, 'name'> = {}) => {
const { data, ...rest } = useMutation({ name: 'notifications_update_status', ...props });

return {
data: data?.notifications_update_status,
...rest,
};
};
3 changes: 2 additions & 1 deletion src/api/subscription/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useNotificationsList } from './use-notifications-list';
import { useP2PAdvertiserInfo } from './use-p2p-advertiser-info';
import { useP2PSettings } from './use-p2p-settings';
import { useP2POrderList } from './use-p2p-order-list';
import { useP2POrderInfo } from './use-p2p-order-info';
import { useExchangeRates } from './use-exchange-rates';

export { useExchangeRates, useP2PAdvertiserInfo, useP2PSettings, useP2POrderList, useP2POrderInfo };
export { useNotificationsList, useExchangeRates, useP2PAdvertiserInfo, useP2PSettings, useP2POrderList, useP2POrderInfo };
9 changes: 9 additions & 0 deletions src/api/subscription/use-notifications-list.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { useAuthorizedSubscription } from '../../base';

export const useNotificationsList = () => {
const { data, ...rest } = useAuthorizedSubscription('notifications_list');
return {
data: data?.notifications_list,
...rest,
};
};
151 changes: 79 additions & 72 deletions src/types/api.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ import type {
NewRealMoneyAccountDerivInvestmentEuropeLtdResponse,
NewVirtualMoneyAccountRequest,
NewVirtualMoneyAccountResponse,
NotificationsListRequest,
NotificationsListResponse,
OAuthApplicationsRequest,
OAuthApplicationsResponse,
P2PAdvertCreateRequest,
Expand Down Expand Up @@ -496,64 +498,64 @@ export type TPrivateSocketEndpoints = {
* Available Trading Accounts
*/
trading_platform_available_accounts?:
| {
/**
* A list of Deriv landing companies that can work with this account type
*/
linkable_landing_companies?: ('svg' | 'maltainvest')[];
/**
* The type of market tradable by this account
*/
market_type?: 'financial' | 'gaming' | 'all';
/**
* Landing Company legal name
*/
name?: string;
/**
* Legal requirements for the Landing Company
*/
requirements?: {
/**
* After first deposit requirements
*/
after_first_deposit?: {
/**
* Financial assessment requirements
*/
financial_assessment?: string[];
};
/**
* Compliance requirements
*/
compliance?: {
/**
* Compliance MT5 requirements
*/
mt5?: string[];
/**
* Compliance tax information requirements
*/
tax_information?: string[];
};
/**
* Sign up requirements
*/
signup?: string[];
/**
* Withdrawal requirements
*/
withdrawal?: string[];
};
/**
* Landing Company short code
*/
shortcode?: string;
/**
* Sub account type
*/
sub_account_type?: 'standard' | 'swap_free' | 'stp';
}[]
| null;
| {
/**
* A list of Deriv landing companies that can work with this account type
*/
linkable_landing_companies?: ('svg' | 'maltainvest')[];
/**
* The type of market tradable by this account
*/
market_type?: 'financial' | 'gaming' | 'all';
/**
* Landing Company legal name
*/
name?: string;
/**
* Legal requirements for the Landing Company
*/
requirements?: {
/**
* After first deposit requirements
*/
after_first_deposit?: {
/**
* Financial assessment requirements
*/
financial_assessment?: string[];
};
/**
* Compliance requirements
*/
compliance?: {
/**
* Compliance MT5 requirements
*/
mt5?: string[];
/**
* Compliance tax information requirements
*/
tax_information?: string[];
};
/**
* Sign up requirements
*/
signup?: string[];
/**
* Withdrawal requirements
*/
withdrawal?: string[];
};
/**
* Landing Company short code
*/
shortcode?: string;
/**
* Sub account type
*/
sub_account_type?: 'standard' | 'swap_free' | 'stp';
}[]
| null;
/**
* Echo of the request made.
*/
Expand Down Expand Up @@ -880,14 +882,14 @@ export type TPrivateSocketEndpoints = {
};
response: {
trading_platform_deposit?:
| {
/**
* The reference number for the related deposit to the trading account
*/
transaction_id?: number;
[k: string]: unknown;
}
| 1;
| {
/**
* The reference number for the related deposit to the trading account
*/
transaction_id?: number;
[k: string]: unknown;
}
| 1;
};
/**
* Echo of the request made.
Expand Down Expand Up @@ -1218,6 +1220,10 @@ type TSocketEndpoints = {
request: NewVirtualMoneyAccountRequest;
response: NewVirtualMoneyAccountResponse;
};
notifications_list: {
request: NotificationsListRequest;
response: NotificationsListResponse;
};
oauth_apps: {
request: OAuthApplicationsRequest;
response: OAuthApplicationsResponse;
Expand Down Expand Up @@ -1489,6 +1495,7 @@ export type TSocketSubscribableEndpointNames = Extract<
| 'cashier_payments'
| 'crypto_estimations'
| 'exchange_rates'
| 'notifications_list'
| 'p2p_advert_info'
| 'p2p_advertiser_create'
| 'p2p_advertiser_info'
Expand Down Expand Up @@ -1564,12 +1571,12 @@ export type TSocketRequestPayload<
T extends TSocketEndpointNames | TSocketPaginateableEndpointNames = TSocketEndpointNames,
> =
Partial<TSocketRequestCleaned<T>> extends TSocketRequestCleaned<T>
? T extends TSocketPaginateableEndpointNames
? TSocketPaginatateableRequestCleaned<T>
: TSocketRequestCleaned<T>
: T extends TSocketPaginateableEndpointNames
? TSocketPaginatateableRequestCleaned<T>
: TSocketRequestCleaned<T>;
? T extends TSocketPaginateableEndpointNames
? TSocketPaginatateableRequestCleaned<T>
: TSocketRequestCleaned<T>
: T extends TSocketPaginateableEndpointNames
? TSocketPaginatateableRequestCleaned<T>
: TSocketRequestCleaned<T>;

export type TSocketPaginateableEndpointNames = KeysMatching<
TSocketEndpoints,
Expand Down
Loading