Skip to main content

@portkey/services

Introduction

Provide verification services

Installation

npm install @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",
});

ICommunityRecoveryService

FunctionDescriptionVersion
registerWhen obtaining the user's guardian verification information, call this interface to complete registration.-
recoveryWhen obtaining the user's guardian verification information, call this interface to complete social recovery.-
getHolderInfoGet account information.-
getHolderInfoByManagerQuery account information via managerAddress.-
getRegisterInfoCheck if the account is registered and on which chain.-
checkGoogleRecaptchaCheck if Google Recaptcha is required.-
getShowDeletionEntranceCheck if account deletion functionality is displayed.-
checkDeletionCheck account assets, devices, and guardians to determine if account deletion is possible.-
deletionAccountUsed for account deletion.-

IVerificationService

FunctionDescriptionVersion
getRecommendationVerifierWhen registering, the system will assign a verifier. Calling this method will get the recommended verifier services.-
getVerificationCodeWhen using an email, call this interface to send a verification code to the email through the verifier.-
verifyVerificationCodeVerify if the verification code is correct.-
sendAppleUserExtraInfoSend authorisation information for Apple users, such as username, etc. This is necessary if the user is authorising login for the first time.-
getAppleUserExtraInfoGet authorisation information for Apple users.-
verifyGoogleTokenVerify the token for Google users, while generating verificationDoc and signature.-
verifyAppleTokenVerify the token for Apple users, while generating verificationDoc and signature.-
verifyTelegramTokenVerify the token for Telegram users, while generating verificationDoc and signature.-
verifyTwitterTokenVerify the token for Twitter users, while generating verificationDoc and signature.-
verifyFacebookTokenVerify the token for Facebook users, while generating verificationDoc and signature.-
getTelegramAuthTokenGenerate verificationDoc and signature when the application calls this interface in Telegram bot.v2.7.+

ISearchService

FunctionDescriptionVersion
getRegisterStatusRetrieve the registration result, and determine whether the registration was successful based on the return value, as well as the user's caHash and caAddress.-
getRecoverStatusRetrieve the social recovery result, and determine whether it was successful based on the return value, as well as the user's caHash and caAddress.-
getChainsInfoRetrieve information about the currently supported chains, including chainId, endPoint, contractAddress, etc.-
getCAHolderInfoRetrieve 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"] });

IAssetsService

FunctionDescriptionVersion
fetchAccountTokenListRetrieve the list of user's tokens.-
getSymbolImagesRetrieve the token icon.-
fetchAccountNftCollectionListRetrieve the collection list of NFTs owned by the user.-
fetchAccountNftCollectionItemListRetrieve the NFTs owned by the user through NFT collection.-
fetchAccountNftItemRetrieve details of the NFTs owned by the user.-
fetchTokenPriceRetrieve the price of the token.-
getAccountAssetsByKeywordsUsed for getting user assets via keywords.-

services.token

Example: Retrieve the default transaction fee

services.token.fetchTxFee({ chainIds: ["AELF", "tDVV"] });

ITokenService

FunctionDescriptionVersion
fetchTxFeeRetrieve 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",
});

IActivityService

FunctionDescriptionVersion
getActivityListQuery the activity list of user transactions.-
getActivityDetailQuery the activity details of transactions.-
getRecentContactActivitiesQuery the transaction records with contacts.-

services.security

It's regarding user account security.
Example:

sservices.security.getWalletBalanceCheck({
caHash: "xxxxx",
checkTransferSafeChainId: "AELF",
});

ISecurityService

FunctionDescriptionVersion
getWalletBalanceCheckDetect account security through user balance, supporting features such as cross-chain transfers and prohibiting transfers in the event of low security level (insufficient guardians).-
getPaymentSecurityListRetrieve the user's token transfer limit.-