|
@@ -1,16 +1,16 @@
|
|
|
-import { get, patch, post } from '@src/api';
|
|
|
-import { ESNSType } from '@src/constants/Login';
|
|
|
-import { IFilter } from 'metarare';
|
|
|
-import { EItemType, ECurrencyType, ESaleType } from '@src/constants/Enums';
|
|
|
-import { isDev, isLocal, LOCAL_ENDPOINT } from '@src/constants/NodeEnv';
|
|
|
+import { get, patch, post } from "@src/api";
|
|
|
+import { ESNSType } from "@src/constants/Login";
|
|
|
+import { IFilter } from "metarare";
|
|
|
+import { EItemType, ECurrencyType, ESaleType } from "@src/constants/Enums";
|
|
|
+import { isDev, isLocal, LOCAL_ENDPOINT } from "@src/constants/NodeEnv";
|
|
|
|
|
|
const getHost = () => {
|
|
|
if (isLocal) {
|
|
|
return LOCAL_ENDPOINT;
|
|
|
} else if (isDev) {
|
|
|
- return 'https://apibeta.meta-rare.net';
|
|
|
+ return "https://api.pepemomy.com";
|
|
|
} else {
|
|
|
- return 'https://api.meta-rare.net';
|
|
|
+ return "https://api.meta-rare.net";
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -41,7 +41,13 @@ const fetchCollectionActivity = (name: string) => {
|
|
|
return post({ url });
|
|
|
};
|
|
|
|
|
|
-const fetchCollectionItem = ({ name, filter }: { name: string; filter: IFilter }) => {
|
|
|
+const fetchCollectionItem = ({
|
|
|
+ name,
|
|
|
+ filter
|
|
|
+}: {
|
|
|
+ name: string;
|
|
|
+ filter: IFilter;
|
|
|
+}) => {
|
|
|
const url = `${host}/v1/collection/item/${name}`;
|
|
|
|
|
|
return post({ url, body: filter });
|
|
@@ -72,8 +78,6 @@ const fetchExploreHint = (filter: IFilter) => {
|
|
|
return post({ url, body: filter });
|
|
|
};
|
|
|
|
|
|
-
|
|
|
-
|
|
|
const fetchExploreKeyword = (collectionName: string) => {
|
|
|
const url = `${host}/v1/explore/keyword`;
|
|
|
|
|
@@ -94,13 +98,29 @@ const fetchHomeArtists = (filter: IFilter) => {
|
|
|
};
|
|
|
|
|
|
// sale
|
|
|
-const saleHighestPrice = ({ bid_price, currency, sale_id }: { bid_price: number; currency: ECurrencyType; sale_id: number }) => {
|
|
|
+const saleHighestPrice = ({
|
|
|
+ bid_price,
|
|
|
+ currency,
|
|
|
+ sale_id
|
|
|
+}: {
|
|
|
+ bid_price: number;
|
|
|
+ currency: ECurrencyType;
|
|
|
+ sale_id: number;
|
|
|
+}) => {
|
|
|
const url = `${host}/v1/sale/auction`;
|
|
|
|
|
|
return post({ url, body: { bid_price, currency, sale_id } });
|
|
|
};
|
|
|
|
|
|
-const saleBid = ({ bid_price, currency, sale_id }: { bid_price: number; currency: ECurrencyType; sale_id: number }) => {
|
|
|
+const saleBid = ({
|
|
|
+ bid_price,
|
|
|
+ currency,
|
|
|
+ sale_id
|
|
|
+}: {
|
|
|
+ bid_price: number;
|
|
|
+ currency: ECurrencyType;
|
|
|
+ sale_id: number;
|
|
|
+}) => {
|
|
|
const url = `${host}/v1/sale/bid`;
|
|
|
|
|
|
return post({ url, body: { bid_price, currency, sale_id } });
|
|
@@ -118,16 +138,51 @@ const fetchBid = (id: number) => {
|
|
|
return get({ url });
|
|
|
};
|
|
|
|
|
|
-const saleBuy = ({ bid_price, currency, sale_id }: { bid_price: number; currency: ECurrencyType; sale_id: number }) => {
|
|
|
+const saleBuy = ({
|
|
|
+ bid_price,
|
|
|
+ currency,
|
|
|
+ sale_id
|
|
|
+}: {
|
|
|
+ bid_price: number;
|
|
|
+ currency: ECurrencyType;
|
|
|
+ sale_id: number;
|
|
|
+}) => {
|
|
|
const url = `${host}/v1/sale/buy`;
|
|
|
|
|
|
return post({ url, body: { bid_price, currency, sale_id } });
|
|
|
};
|
|
|
|
|
|
-const resale = ({ currency, end_at, price, sale_type, start_at, start_price, token_id }: { currency: ECurrencyType; end_at?: string; price?: number; sale_type: ESaleType; start_at?: string; start_price?: number; token_id: number }) => {
|
|
|
+const resale = ({
|
|
|
+ currency,
|
|
|
+ end_at,
|
|
|
+ price,
|
|
|
+ sale_type,
|
|
|
+ start_at,
|
|
|
+ start_price,
|
|
|
+ token_id
|
|
|
+}: {
|
|
|
+ currency: ECurrencyType;
|
|
|
+ end_at?: string;
|
|
|
+ price?: number;
|
|
|
+ sale_type: ESaleType;
|
|
|
+ start_at?: string;
|
|
|
+ start_price?: number;
|
|
|
+ token_id: number;
|
|
|
+}) => {
|
|
|
const url = `${host}/v1/sale/resale`;
|
|
|
|
|
|
- return post({ url, body: { currency, end_at, price, sale_type, start_at, start_price, token_id } });
|
|
|
+ return post({
|
|
|
+ url,
|
|
|
+ body: {
|
|
|
+ currency,
|
|
|
+ end_at,
|
|
|
+ price,
|
|
|
+ sale_type,
|
|
|
+ start_at,
|
|
|
+ start_price,
|
|
|
+ token_id
|
|
|
+ }
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
const changeSaleStatus = (id: number) => {
|
|
@@ -146,7 +201,7 @@ const fetchSaleRanking = (filter: IFilter) => {
|
|
|
const url = `${host}/v1/sale/ranking`;
|
|
|
|
|
|
return get({ url, params: filter });
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
// token
|
|
|
const fetchToken = (id: number) => {
|
|
@@ -167,7 +222,13 @@ const fetchBaseInfo = (type: EItemType) => {
|
|
|
return get({ url });
|
|
|
};
|
|
|
|
|
|
-const changeLike = ({ tokenId, isLike }: { tokenId: number; isLike: boolean }) => {
|
|
|
+const changeLike = ({
|
|
|
+ tokenId,
|
|
|
+ isLike
|
|
|
+}: {
|
|
|
+ tokenId: number;
|
|
|
+ isLike: boolean;
|
|
|
+}) => {
|
|
|
const url = `${host}/v1/token/like`;
|
|
|
|
|
|
return patch({ url, body: { token_id: tokenId, is_like: isLike } });
|
|
@@ -204,7 +265,13 @@ const fetchUserBid = (filter: IFilter) => {
|
|
|
return post({ url, body: filter });
|
|
|
};
|
|
|
|
|
|
-const fetchUserCollection = ({ name, filter }: { name: string; filter: IFilter }) => {
|
|
|
+const fetchUserCollection = ({
|
|
|
+ name,
|
|
|
+ filter
|
|
|
+}: {
|
|
|
+ name: string;
|
|
|
+ filter: IFilter;
|
|
|
+}) => {
|
|
|
const url = `${host}/v1/user/collection/${name}`;
|
|
|
|
|
|
return post({ url, body: filter });
|
|
@@ -222,13 +289,25 @@ const fetchUserLike = ({ name, filter }: { name: string; filter: IFilter }) => {
|
|
|
return post({ url, body: filter });
|
|
|
};
|
|
|
|
|
|
-const fetchUserOwned = ({ name, filter }: { name: string; filter: IFilter }) => {
|
|
|
+const fetchUserOwned = ({
|
|
|
+ name,
|
|
|
+ filter
|
|
|
+}: {
|
|
|
+ name: string;
|
|
|
+ filter: IFilter;
|
|
|
+}) => {
|
|
|
const url = `${host}/v1/user/owned/${name}`;
|
|
|
|
|
|
return post({ url, body: filter });
|
|
|
};
|
|
|
|
|
|
-const fetchUserOnSale = ({ name, filter }: { name: string; filter: IFilter }) => {
|
|
|
+const fetchUserOnSale = ({
|
|
|
+ name,
|
|
|
+ filter
|
|
|
+}: {
|
|
|
+ name: string;
|
|
|
+ filter: IFilter;
|
|
|
+}) => {
|
|
|
const url = `${host}/v1/user/onsale/${name}`;
|
|
|
|
|
|
return post({ url, body: filter });
|
|
@@ -252,7 +331,17 @@ const changeUserProfile = (formData: FormData) => {
|
|
|
return patch({ url, body: formData });
|
|
|
};
|
|
|
|
|
|
-const transfer = ({ amount, currency, to_address, code }: { amount: number; currency: ECurrencyType; to_address: string; code: string }) => {
|
|
|
+const transfer = ({
|
|
|
+ amount,
|
|
|
+ currency,
|
|
|
+ to_address,
|
|
|
+ code
|
|
|
+}: {
|
|
|
+ amount: number;
|
|
|
+ currency: ECurrencyType;
|
|
|
+ to_address: string;
|
|
|
+ code: string;
|
|
|
+}) => {
|
|
|
const url = `${host}/v1/user/transfer`;
|
|
|
|
|
|
return post({ url, body: { amount, currency, to_address, code } });
|
|
@@ -270,7 +359,13 @@ const signIn = (code: string, type: ESNSType) => {
|
|
|
return post({ url, body: { code, type } });
|
|
|
};
|
|
|
|
|
|
-const sendEmail = ({ amount, currency }: { amount: number; currency: ECurrencyType }) => {
|
|
|
+const sendEmail = ({
|
|
|
+ amount,
|
|
|
+ currency
|
|
|
+}: {
|
|
|
+ amount: number;
|
|
|
+ currency: ECurrencyType;
|
|
|
+}) => {
|
|
|
const url = `${host}/v1/user/certification/code`;
|
|
|
|
|
|
return post({ url, body: { amount, currency } });
|