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

Feature/addresses custom tags #49

Closed
wants to merge 12 commits into from
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"react-query": "^3.39.3",
"react-share": "^5.0.3",
"reactflow": "^11.10.1",
"tailwind-scrollbar-hide": "^1.1.7",
"uuid": "^9.0.1",
"vite-plugin-environment": "^1.1.3",
"yarn": "^1.22.21"
Expand Down
6 changes: 3 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { QueryClientProvider } from "react-query";
import useCustomQueryClient from "./hooks/useCustomQueryClient";
import authService from "./services/auth/auth.services";

import "./services/firebase/firebase";
import "./services/firebase";

import PrivateApp from "./PrivateApp";
import PublicApp from "./PublicApp";
import useAuthState from "./hooks/useAuthState";
import { MobileWarningTemplate } from "./templates";

function App() {
const queryClient = useCustomQueryClient();
const user = authService.useAuthState().user;
const { user } = useAuthState();

return (
<>
Expand Down
61 changes: 61 additions & 0 deletions src/api/compliance/compliance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import type {
import type {
ErrorResponse
} from '../model/errorResponse'
import type {
RiskFeed
} from '../model/riskFeed'
import { instance } from '.././instance';


Expand Down Expand Up @@ -86,3 +89,61 @@ export const useAnalysisAddressData = <TData = Awaited<ReturnType<typeof analysi



/**
* Get risk feed
*/
export const getRiskFeed = (

signal?: AbortSignal
) => {


return instance<RiskFeed>(
{url: `/compliance/risk-feed`, method: 'GET', signal
},
);
}


export const getGetRiskFeedQueryKey = () => {
return [`/compliance/risk-feed`] as const;
}


export const getGetRiskFeedQueryOptions = <TData = Awaited<ReturnType<typeof getRiskFeed>>, TError = ErrorResponse>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getRiskFeed>>, TError, TData>, }
) => {

const {query: queryOptions} = options ?? {};

const queryKey = queryOptions?.queryKey ?? getGetRiskFeedQueryKey();



const queryFn: QueryFunction<Awaited<ReturnType<typeof getRiskFeed>>> = ({ signal }) => getRiskFeed(signal);





return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getRiskFeed>>, TError, TData> & { queryKey: QueryKey }
}

export type GetRiskFeedQueryResult = NonNullable<Awaited<ReturnType<typeof getRiskFeed>>>
export type GetRiskFeedQueryError = ErrorResponse

export const useGetRiskFeed = <TData = Awaited<ReturnType<typeof getRiskFeed>>, TError = ErrorResponse>(
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getRiskFeed>>, TError, TData>, }

): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {

const queryOptions = getGetRiskFeedQueryOptions(options)

const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };

query.queryKey = queryOptions.queryKey ;

return query;
}



12 changes: 12 additions & 0 deletions src/api/model/filteredTransactions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Generated by orval v6.23.0 🍺
* Do not edit manually.
* compliance-queries-api
* The ward's compliance queires endpoints
* OpenAPI spec version: 1.0
*/
import type { Transaction } from './transaction';

export interface FilteredTransactions {
transactions: Transaction[];
}
11 changes: 11 additions & 0 deletions src/api/model/getAccountTags200.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Generated by orval v6.23.0 🍺
* Do not edit manually.
* compliance-queries-api
* The ward's compliance queires endpoints
* OpenAPI spec version: 1.0
*/

export type GetAccountTags200 = {
tags?: string[];
};
12 changes: 2 additions & 10 deletions src/api/model/getTransactionsBetweenAddressesParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,11 @@

export type GetTransactionsBetweenAddressesParams = {
/**
* The source address
* The source address to filter
*/
src: string;
/**
* The destination address
* The destination address to filter
*/
dst: string;
/**
* The page of transactions to return
*/
page?: number;
/**
* The number of transactions to return
*/
page_size?: number;
};
5 changes: 2 additions & 3 deletions src/api/model/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ export * from './category';
export * from './entity';
export * from './errorResponse';
export * from './exposure';
export * from './getCombinedTransactions200';
export * from './getCombinedTransactionsParams';
export * from './getTransactionsBetweenAddresses200';
export * from './filteredTransactions';
export * from './getAccountTags200';
export * from './getTransactionsBetweenAddressesParams';
export * from './label';
export * from './output';
Expand Down
12 changes: 12 additions & 0 deletions src/api/model/riskFeed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Generated by orval v6.23.0 🍺
* Do not edit manually.
* compliance-queries-api
* The ward's compliance queires endpoints
* OpenAPI spec version: 1.0
*/
import type { RiskFeedAddress } from './riskFeedAddress';

export interface RiskFeed {
addresses: RiskFeedAddress[];
}
13 changes: 13 additions & 0 deletions src/api/model/riskFeedAddress.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* Generated by orval v6.23.0 🍺
* Do not edit manually.
* compliance-queries-api
* The ward's compliance queires endpoints
* OpenAPI spec version: 1.0
*/

export interface RiskFeedAddress {
address: string;
labels: string[];
risk: number;
}
11 changes: 11 additions & 0 deletions src/api/model/tagIndividualAddress200.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Generated by orval v6.23.0 🍺
* Do not edit manually.
* compliance-queries-api
* The ward's compliance queires endpoints
* OpenAPI spec version: 1.0
*/

export type TagIndividualAddress200 = {
tags?: string[];
};
18 changes: 18 additions & 0 deletions src/api/model/tagIndividualAddressParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Generated by orval v6.23.0 🍺
* Do not edit manually.
* compliance-queries-api
* The ward's compliance queires endpoints
* OpenAPI spec version: 1.0
*/

export type TagIndividualAddressParams = {
/**
* The address to tag
*/
address: string;
/**
* The tag to add
*/
tag: string;
};
142 changes: 142 additions & 0 deletions src/api/tagging/tagging.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/**
* Generated by orval v6.23.0 🍺
* Do not edit manually.
* compliance-queries-api
* The ward's compliance queires endpoints
* OpenAPI spec version: 1.0
*/
import {
useMutation,
useQuery
} from 'react-query'
import type {
MutationFunction,
QueryFunction,
QueryKey,
UseMutationOptions,
UseQueryOptions,
UseQueryResult
} from 'react-query'
import type {
ErrorResponse
} from '../model/errorResponse'
import type {
GetAccountTags200
} from '../model/getAccountTags200'
import type {
TagIndividualAddress200
} from '../model/tagIndividualAddress200'
import type {
TagIndividualAddressParams
} from '../model/tagIndividualAddressParams'
import { instance } from '.././instance';



/**
* Get account tags
*/
export const getAccountTags = (

signal?: AbortSignal
) => {


return instance<GetAccountTags200>(
{url: `/tags/get-account-tags`, method: 'GET', signal
},
);
}


export const getGetAccountTagsQueryKey = () => {
return [`/tags/get-account-tags`] as const;
}


export const getGetAccountTagsQueryOptions = <TData = Awaited<ReturnType<typeof getAccountTags>>, TError = ErrorResponse>( options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getAccountTags>>, TError, TData>, }
) => {

const {query: queryOptions} = options ?? {};

const queryKey = queryOptions?.queryKey ?? getGetAccountTagsQueryKey();



const queryFn: QueryFunction<Awaited<ReturnType<typeof getAccountTags>>> = ({ signal }) => getAccountTags(signal);





return { queryKey, queryFn, ...queryOptions} as UseQueryOptions<Awaited<ReturnType<typeof getAccountTags>>, TError, TData> & { queryKey: QueryKey }
}

export type GetAccountTagsQueryResult = NonNullable<Awaited<ReturnType<typeof getAccountTags>>>
export type GetAccountTagsQueryError = ErrorResponse

export const useGetAccountTags = <TData = Awaited<ReturnType<typeof getAccountTags>>, TError = ErrorResponse>(
options?: { query?:UseQueryOptions<Awaited<ReturnType<typeof getAccountTags>>, TError, TData>, }

): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {

const queryOptions = getGetAccountTagsQueryOptions(options)

const query = useQuery(queryOptions) as UseQueryResult<TData, TError> & { queryKey: QueryKey };

query.queryKey = queryOptions.queryKey ;

return query;
}



/**
* Tag individual address
*/
export const tagIndividualAddress = (
params: TagIndividualAddressParams,
) => {


return instance<TagIndividualAddress200>(
{url: `/tags/tag-individual-address`, method: 'POST',
params
},
);
}



export const getTagIndividualAddressMutationOptions = <TError = ErrorResponse,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof tagIndividualAddress>>, TError,{params: TagIndividualAddressParams}, TContext>, }
): UseMutationOptions<Awaited<ReturnType<typeof tagIndividualAddress>>, TError,{params: TagIndividualAddressParams}, TContext> => {
const {mutation: mutationOptions} = options ?? {};




const mutationFn: MutationFunction<Awaited<ReturnType<typeof tagIndividualAddress>>, {params: TagIndividualAddressParams}> = (props) => {
const {params} = props ?? {};

return tagIndividualAddress(params,)
}




return { mutationFn, ...mutationOptions }}

export type TagIndividualAddressMutationResult = NonNullable<Awaited<ReturnType<typeof tagIndividualAddress>>>

export type TagIndividualAddressMutationError = ErrorResponse

export const useTagIndividualAddress = <TError = ErrorResponse,
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof tagIndividualAddress>>, TError,{params: TagIndividualAddressParams}, TContext>, }
) => {

const mutationOptions = getTagIndividualAddressMutationOptions(options);

return useMutation(mutationOptions);
}

Loading
Loading