-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa1406a
commit fbfa82d
Showing
56 changed files
with
1,818 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default { | ||
activityList: '/api/app/user/activities/activities', | ||
activity: '/api/app/user/activities/activity', | ||
activityListWithAddress: '/api/app/user/activities/transactions', | ||
reportTransaction: '/api/app/report/transaction', | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
export default { | ||
fetchAccountTokenList: '/api/app/user/assets/token', | ||
fetchAccountTokenListV2: '/api/app/v2/user/assets/token', | ||
fetchAccountNftCollectionList: '/api/app/user/assets/nftCollections', | ||
fetchAccountNftCollectionItemList: '/api/app/user/assets/nftItems', | ||
fetchAccountNftCollectionItem: { | ||
target: '/api/app/user/assets/nftItem', | ||
config: { | ||
method: 'POST', | ||
timeout: 20 * 1000, | ||
}, | ||
}, | ||
// nft and tokens | ||
fetchAccountAssetsByKeywords: '/api/app/user/assets/searchUserAssets', | ||
fetchAccountAssetsByKeywordsV2: '/api/app/v2/user/assets/searchUserAssets', | ||
// nft and token in crypto box | ||
fetchCryptoBoxAccountAssetsByKeywords: '/api/app/v2/user/assets/searchUserPackageAssets', | ||
fetchTokenPrice: { | ||
target: '/api/app/tokens/prices', | ||
config: { method: 'GET' }, | ||
}, | ||
fetchTokenAllowanceList: '/api/app/tokens/allowances', | ||
getSymbolImages: { | ||
target: '/api/app/user/assets/symbolImages', | ||
config: { method: 'GET' }, | ||
}, | ||
getTokenBalance: { | ||
target: '/api/app/user/assets/tokenBalance', | ||
config: { method: 'GET' }, | ||
}, | ||
getAssetsEstimation: { | ||
target: '/api/app/user/assets/asset-estimation', | ||
config: { method: 'GET' }, | ||
}, | ||
getAwakenTokenList: { | ||
target: '/api/app/user/assets/awaken/token', | ||
config: { method: 'GET' }, | ||
}, | ||
} as const; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export default { | ||
getSwapRoutes: { | ||
target: '/api/app/route/best-swap-routes', | ||
config: { method: 'GET' }, | ||
}, | ||
getAwakenGasFee: { | ||
target: '/api/app/transaction-fee', | ||
config: { method: 'GET' }, | ||
}, | ||
getAwakenTokenPrice: { | ||
target: '/api/app/token/price', | ||
config: { method: 'GET' }, | ||
}, | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
getChains: '/api/app/getChains', | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { BaseConfig } from '../../types'; | ||
|
||
const BASE_URL = `/api/app/contacts`; | ||
const BASE_URL_V2 = `/api/app/address-book`; | ||
|
||
const KeyList = [ | ||
'addContact', | ||
'editContact', | ||
'deleteContact', | ||
'checkContactName', | ||
'readImputation', | ||
'contactPrivacyList', | ||
'updateContactPrivacy', | ||
] as const; | ||
|
||
const KeyListV2 = [ | ||
'createSaved', | ||
'updateSaved', | ||
'deleteSaved', | ||
'checkSavedName', | ||
'getSavedList', | ||
'getSupportNetworkList', | ||
] as const; | ||
|
||
const ApiObject: Record<(typeof KeyList)[number], BaseConfig> = { | ||
addContact: { | ||
target: `${BASE_URL}`, | ||
config: { method: 'POST' }, | ||
}, | ||
editContact: { | ||
target: `${BASE_URL}`, | ||
config: { method: 'PUT' }, | ||
}, | ||
deleteContact: { | ||
target: `${BASE_URL}`, | ||
config: { method: 'DELETE' }, | ||
}, | ||
checkContactName: { | ||
target: `${BASE_URL}/exist`, | ||
config: { method: 'GET' }, | ||
}, | ||
readImputation: { | ||
target: `${BASE_URL}/read`, | ||
config: { method: 'POST' }, | ||
}, | ||
contactPrivacyList: { | ||
target: `/api/app/privacyPermission`, | ||
config: { method: 'GET' }, | ||
}, | ||
updateContactPrivacy: { | ||
target: `/api/app/privacyPermission`, | ||
config: { method: 'POST' }, | ||
}, | ||
}; | ||
const ApiObjectV2: Record<(typeof KeyListV2)[number], BaseConfig> = { | ||
createSaved: { | ||
target: `${BASE_URL_V2}/create`, | ||
config: { method: 'POST' }, | ||
}, | ||
updateSaved: { | ||
target: `${BASE_URL_V2}/update`, | ||
config: { method: 'POST' }, | ||
}, | ||
deleteSaved: { | ||
target: `${BASE_URL_V2}/delete`, | ||
config: { method: 'POST' }, | ||
}, | ||
checkSavedName: { | ||
target: `${BASE_URL_V2}/exist`, | ||
config: { method: 'GET' }, | ||
}, | ||
getSavedList: { | ||
target: `${BASE_URL_V2}/read`, | ||
config: { method: 'GET' }, | ||
}, | ||
getSupportNetworkList: { | ||
target: `${BASE_URL_V2}/network`, | ||
config: { method: 'GET' }, | ||
}, | ||
}; | ||
|
||
export default Object.assign(ApiObject, ApiObjectV2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface CheckContactNameResponseType { | ||
existed: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
export default { | ||
getTokenList: { | ||
target: '/api/app/transfer/token/list', | ||
config: { method: 'GET' }, | ||
}, | ||
getTokenListByNetwork: { | ||
target: '/api/app/transfer/network/tokens', | ||
config: { method: 'GET' }, | ||
}, | ||
getDepositTokenList: { | ||
target: '/api/app/transfer/token/option', | ||
config: { method: 'GET' }, | ||
}, | ||
getNetworkList: { | ||
target: '/api/app/transfer/network/list', | ||
config: { method: 'GET' }, | ||
}, | ||
getDepositInfo: { | ||
target: '/api/app/transfer/deposit/info', | ||
config: { method: 'GET' }, | ||
}, | ||
depositCalculator: { | ||
target: '/api/app/transfer/deposit/calculator', | ||
config: { method: 'GET' }, | ||
}, | ||
recordList: { | ||
target: '/api/app/transfer/record/list', | ||
config: { method: 'GET' }, | ||
}, | ||
getTransferToken: { | ||
target: '/api/app/transfer/connect/token', | ||
config: { method: 'POST' }, | ||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, | ||
}, | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default { | ||
fetchEncrypt: '/api/app/account/device/encrypt', | ||
fetchDecrypt: '/api/app/account/device/decrypt', | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export default { | ||
addBookmark: '/api/app/bookmarks', | ||
deleteAllBookmark: { | ||
target: '/api/app/bookmarks', | ||
config: { method: 'DELETE' }, | ||
}, | ||
deleteBookmark: '/api/app/bookmarks/modify', | ||
getBookmarks: { | ||
target: '/api/app/bookmarks', | ||
config: { method: 'GET' }, | ||
}, | ||
getCryptoCurrencyList: { | ||
target: '/api/app/cryptocurrency/list', | ||
config: { method: 'GET' }, | ||
}, | ||
markFavorite: { | ||
target: '/api/app/cryptocurrency/mark', | ||
}, | ||
unMarkFavorite: { | ||
target: '/api/app/cryptocurrency/unmark', | ||
}, | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { ESBaseConfig } from './type'; | ||
|
||
const Method = 'GET'; | ||
const BaseESUrl = `/api/app/`; | ||
|
||
const KeyList = [ | ||
'getUserTokenList', | ||
'getChainsInfo', | ||
'getRegisterResult', | ||
'getRecoverResult', | ||
'getContactList', | ||
'getContactListNew', | ||
'getCaHolder', | ||
] as const; | ||
|
||
const ApiObject: Record<(typeof KeyList)[number], ESBaseConfig> = { | ||
getUserTokenList: { | ||
target: `${BaseESUrl}search/usertokenindex`, | ||
config: { method: Method }, | ||
}, | ||
getChainsInfo: { | ||
target: `${BaseESUrl}search/chainsinfoindex`, | ||
config: { method: Method, params: { sort: 'chainId' } }, | ||
}, | ||
getRegisterResult: { | ||
target: `${BaseESUrl}search/accountregisterindex`, | ||
config: { method: Method }, | ||
}, | ||
getRecoverResult: { | ||
target: `${BaseESUrl}search/accountrecoverindex`, | ||
config: { method: Method }, | ||
}, | ||
getContactList: { | ||
target: `${BaseESUrl}contacts/list`, | ||
config: { method: Method }, | ||
}, | ||
getContactListNew: { | ||
target: `${BaseESUrl}address-book/list`, | ||
config: { method: Method }, | ||
}, | ||
getCaHolder: { | ||
target: `${BaseESUrl}search/caholderindex`, | ||
config: { method: Method }, | ||
}, | ||
}; | ||
|
||
export default ApiObject; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { CustomFetchConfig } from '@portkey-wallet/utils/fetch'; | ||
import { BaseConfig, RequestConfig } from '../../types'; | ||
|
||
export interface ESConfig extends CustomFetchConfig { | ||
params?: { | ||
filter?: string; | ||
sort?: string; | ||
sortType?: 0 | 1; | ||
skipCount?: number; | ||
maxResultCount?: number; | ||
}; | ||
} | ||
|
||
export type ESBaseConfig = BaseConfig & { | ||
config: ESConfig; | ||
}; | ||
|
||
export type ES_API_REQ_FUNCTION = (config?: RequestConfig & ESConfig) => Promise<{ type: 'timeout' } | any>; | ||
|
||
export interface IGetContactListParams { | ||
page: number; | ||
size: number; | ||
modificationTime: string; | ||
keyword?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { request } from '@portkey-wallet/api/api-did'; | ||
import { GetContractListApiType } from '@portkey-wallet/types/types-ca/contact'; | ||
import { TGetContactListApiType } from '@portkey-wallet/types/types-ca/contactNew'; | ||
|
||
import { IGetContactListParams } from '../type'; | ||
|
||
export const getContactList = ( | ||
baseURL: string, | ||
{ page, size, modificationTime, keyword }: IGetContactListParams, | ||
): Promise<GetContractListApiType> => { | ||
return request.es.getContactList({ | ||
baseURL, | ||
params: { | ||
filter: `modificationTime: [* TO ${modificationTime}] AND isDeleted: false`, | ||
sort: 'modificationTime', | ||
sortType: 0, | ||
skipCount: (page - 1) * size, | ||
maxResultCount: size, | ||
keyword, | ||
}, | ||
}); | ||
}; | ||
|
||
export const getContactEventList = ( | ||
baseURL: string, | ||
{ page, size, modificationTime, fetchTime, keyword }: IGetContactListParams & { fetchTime: string }, | ||
): Promise<GetContractListApiType> => { | ||
return request.es.getContactList({ | ||
baseURL, | ||
params: { | ||
filter: `modificationTime: [${modificationTime} TO ${fetchTime}]`, | ||
sort: 'modificationTime', | ||
sortType: 0, | ||
skipCount: (page - 1) * size, | ||
maxResultCount: size, | ||
keyword, | ||
}, | ||
}); | ||
}; | ||
|
||
export const getContactListV2 = ( | ||
baseURL: string, | ||
{ page, size, modificationTime, keyword }: IGetContactListParams, | ||
): Promise<TGetContactListApiType> => { | ||
return request.es.getContactListNew({ | ||
baseURL, | ||
params: { | ||
filter: `modificationTime: [* TO ${modificationTime}] AND isDeleted: false`, | ||
sort: 'modificationTime', | ||
sortType: 0, | ||
skipCount: (page - 1) * size, | ||
maxResultCount: size, | ||
keyword, | ||
}, | ||
}); | ||
}; | ||
|
||
export const getContactEventListV2 = ( | ||
baseURL: string, | ||
{ page, size, modificationTime, fetchTime, keyword }: IGetContactListParams & { fetchTime: string }, | ||
): Promise<TGetContactListApiType> => { | ||
return request.es.getContactListNew({ | ||
baseURL, | ||
params: { | ||
filter: `modificationTime: [${modificationTime} TO ${fetchTime}]`, | ||
sort: 'modificationTime', | ||
sortType: 0, | ||
skipCount: (page - 1) * size, | ||
maxResultCount: size, | ||
keyword, | ||
}, | ||
}); | ||
}; | ||
|
||
export const getCaHolder = ( | ||
baseURL: string, | ||
{ caHash }: { caHash: string }, | ||
): Promise<{ | ||
items: Array<{ | ||
userId: string; | ||
caAddress: string; | ||
caHash: string; | ||
id: string; | ||
nickName: string; | ||
avatar: string; | ||
}>; | ||
}> => { | ||
return request.es.getCaHolder({ | ||
baseURL, | ||
params: { | ||
filter: `caHash: ${caHash}`, | ||
}, | ||
}); | ||
}; |
Oops, something went wrong.