@portkey/services
Introduction
Provide verification services
Installation
- NPM
- YARN
npm install @portkey/services
yarn add @portkey/services
How to user
import { FetchRequest } from "@portkey/request";
import { DIDGraphQL } from "@portkey/graphql";
const fetchRequest = new FetchRequest("...");
const didGraphQL = new DIDGraphQL({ config: "..." });
const services = new Services(fetchRequest, didGraphQL, "referralConfig....");
services.communityRecovery
Interface that might be needed for social recovery and registration.
Example:
services.communityRecovery.register({
chainId: "AELF",
guardianIdentifier: "xxxx@gmail.com",
});
Function | Description | Version |
---|---|---|
register | When obtaining the user's guardian verification information, call this interface to complete registration. | - |
recovery | When obtaining the user's guardian verification information, call this interface to complete social recovery. | - |
getHolderInfo | Get account information. | - |
getHolderInfoByManager | Query account information via managerAddress. | - |
getRegisterInfo | Check if the account is registered and on which chain. | - |
checkGoogleRecaptcha | Check if Google Recaptcha is required. | - |
getShowDeletionEntrance | Check if account deletion functionality is displayed. | - |
checkDeletion | Check account assets, devices, and guardians to determine if account deletion is possible. | - |
deletionAccount | Used for account deletion. | - |
Function | Description | Version |
---|---|---|
getRecommendationVerifier | When registering, the system will assign a verifier. Calling this method will get the recommended verifier services. | - |
getVerificationCode | When using an email, call this interface to send a verification code to the email through the verifier. | - |
verifyVerificationCode | Verify if the verification code is correct. | - |
sendAppleUserExtraInfo | Send authorisation information for Apple users, such as username, etc. This is necessary if the user is authorising login for the first time. | - |
getAppleUserExtraInfo | Get authorisation information for Apple users. | - |
verifyGoogleToken | Verify the token for Google users, while generating verificationDoc and signature . | - |
verifyAppleToken | Verify the token for Apple users, while generating verificationDoc and signature . | - |
verifyTelegramToken | Verify the token for Telegram users, while generating verificationDoc and signature . | - |
verifyTwitterToken | Verify the token for Twitter users, while generating verificationDoc and signature . | - |
verifyFacebookToken | Verify the token for Facebook users, while generating verificationDoc and signature . | - |
getTelegramAuthToken | Generate verificationDoc and signature when the application calls this interface in Telegram bot. | v2.7.+ |
Function | Description | Version |
---|---|---|
getRegisterStatus | Retrieve the registration result, and determine whether the registration was successful based on the return value, as well as the user's caHash and caAddress . | - |
getRecoverStatus | Retrieve the social recovery result, and determine whether it was successful based on the return value, as well as the user's caHash and caAddress . | - |
getChainsInfo | Retrieve information about the currently supported chains, including chainId , endPoint , contractAddress , etc. | - |
getCAHolderInfo | Retrieve information such as the user's caHash, caAddress, nickName, etc. | - |
services.assets
Interface that might be needed for retrieving user assets.
Example:
services.assets.fetchTokenPrice({ symbols: ["ELF", "ETH"] });
Function | Description | Version |
---|---|---|
fetchAccountTokenList | Retrieve the list of user's tokens. | - |
getSymbolImages | Retrieve the token icon. | - |
fetchAccountNftCollectionList | Retrieve the collection list of NFTs owned by the user. | - |
fetchAccountNftCollectionItemList | Retrieve the NFTs owned by the user through NFT collection. | - |
fetchAccountNftItem | Retrieve details of the NFTs owned by the user. | - |
fetchTokenPrice | Retrieve the price of the token. | - |
getAccountAssetsByKeywords | Used for getting user assets via keywords. | - |
services.token
Example: Retrieve the default transaction fee
services.token.fetchTxFee({ chainIds: ["AELF", "tDVV"] });
Function | Description | Version |
---|---|---|
fetchTxFee | Retrieve the default transaction fee. | - |
services.transaction
Example: Retrieve information of users who transact recently
services.transaction.getRecentTransactionUsers({ chainIds: ["AELF", "tDVV"] });
services.activity
An interface of user's recent transaction records.
Example:
services.transaction.getActivityList({
width: 294,
height: -1,
maxResultCount: 10,
skipCount: 0,
caAddressInfos: [{ chainId: "AELF", caAddress: "xxxxxx" }],
chainId: "AELF",
symbol: "ELF",
});
Function | Description | Version |
---|---|---|
getActivityList | Query the activity list of user transactions. | - |
getActivityDetail | Query the activity details of transactions. | - |
getRecentContactActivities | Query the transaction records with contacts. | - |
services.security
It's regarding user account security.
Example:
sservices.security.getWalletBalanceCheck({
caHash: "xxxxx",
checkTransferSafeChainId: "AELF",
});
Function | Description | Version |
---|---|---|
getWalletBalanceCheck | Detect account security through user balance, supporting features such as cross-chain transfers and prohibiting transfers in the event of low security level (insufficient guardians). | - |
getPaymentSecurityList | Retrieve the user's token transfer limit. | - |