import * as React from "react"; import { ViewProperties } from "react-native"; import WalletConnect from '@walletconnect/client'; import { ApiHistoryItem, GetHistoryResult, GetNonceResult, RegisterPhoneNumberResult, SendSignedTxResult, SignedMessageResult, SignedRawTxResult, Transaction, VerifyOtpResult, } from '@cybavo/react-native-wallet-service'; declare module "@cybavo/react-native-wallet-service" { namespace WalletConnectSdk { /**Session status*/ export enum ConnectStatus { /** initilized, not received session request yet */ INIT = 0, /** There's a pending session request which is waiting to be approved or rejected */ SESSION_REQUESTING = 1, /** Session request has been approved */ SESSION_APPROVED = 2 } namespace WalletConnectHelper { /** * Return a valid tx json string * @param tx tx object to be sign, compliance with eth_sendTransaction's parameter, https://docs.walletconnect.org/json-rpc-api-methods/ethereum#eth_sendtransaction * @param transactionFee * @param nonce * */ function getValidSignParams(tx: object, transactionFee: string, nonce: number): object /** * Return if it's a session request by method * @param method */ function isSessionRequest(method: string): boolean function convertNumToHex(value: number, decimals: number): string function convertStringToHex(value: string | number): string function convertHexToString(hex: string): string function convertAmountToRawNumber(value: string | number, decimals: number): string function sanitizeHex(hex: string, originLength: boolean): string } namespace WalletConnectManager { /** * Get approved and connecting session map */ function getConnectingMap(): Map; /** * Get waiting approval session map */ function getPendingMap(): Map; /** * Get wallet ID by peer ID * @param peerId walletConnect sender's peer ID * @return walletId */ function getWalletId(peerId: string): number; /** * Get wallet address by peer ID * @param peerId walletConnect sender's peer ID * @return walletAddress */ function getAddress(peerId: string): string; /** * Establish new session by WalletConnect uri * @param uri walletConnect uri * @param walletId * @param clientMeta app's client metadata * @param callback called with sender's session request * @return ConnectWrapper */ function newSession( uri: string, address: string, walletId: number, clientMeta: ClientMeta, callback: (error: any | null, payload: Payload | null) => void ): ConnectWrapper /** * Reject a session request by peer ID * @param peerId walletConnect sender's peer ID * @param sessionError response information */ function rejectSession(peerId: string, sessionError?: SessionError): void; /** * Approve a session request by peer ID * @param peerId walletConnect sender's peer ID * @param sessionStatus response information * @param requestListener listener to receive call request * @param disconnectListener listener to receive disconnection event */ function approveSession( peerId: string, sessionStatus: SessionStatus, requestListener: (error: any | null, payload: Payload | null) => void, disconnectListener: (error: any | null, payload: Payload | null) => void ): void; /** * Approve a call request by peer ID * @param peerId walletConnect sender's peer ID * @param response response information */ function approveRequest(peerId: string, response: Partial): void; /** * Reject a call request by peer ID * @param peerId walletConnect sender's peer ID */ function rejectRequest(peerId: string, response: Partial): void; /** * Kill all pending and connecting sessions */ function killAllSession(sessionError?: SessionError): void; /** * Kill a session by peer ID * @param peerId walletConnect sender's peer ID * @param sessionError response information */ function killSession(peerId: string, sessionError?: SessionError): void; /** * Update a session peer ID * @param peerId walletConnect sender's peer ID * @param sessionStatus response information */ function updateSession(peerId: string, sessionStatus: SessionStatus): void; /** * Subscribe a specific event * @param peerId walletConnect sender's peer ID * @param event event name * @param callback event's callback */ function on(peerId: string, event: string, callback: (error: Error | null, payload: any | null) => void): void; } type ConnectWrapper = { getStatus(): ConnectStatus; getConnectTime(): moment.Moment; getConnector(): WalletConnect; getAddress(): string; getWalletId(): number; approveSession( sessionStatus: SessionStatus, requestListener: (error: any | null, payload: Payload | null) => void, disconnectListener: (error: any | null, payload: Payload | null) => void): void; } // function getWalletConnectors(): Promise>; type Payload = { id: number, jsonrpc: string, method: string, params: any[] } type ClientMeta = { /** User has finished PIN setup */ description: string; /** User has setup BackupChallenges */ url: string; /** Real name of user */ icons: string[]; /** Email of user */ name: string; }; type SessionStatus = { chainId: number; accounts: string[]; networkId?: number; rpcUrl?: string; } type SessionError = { message?: string; } type JsonRpcResponseSuccess = { id: number; jsonrpc: string; result: any; } type JsonRpcErrorMessage = { code?: number; message: string; } type JsonRpcResponseError = { id: number; jsonrpc: string; error: JsonRpcErrorMessage; } } /** * Facade of Wallet SDK Core. Must be initialized before invoke any of APIs */ namespace WalletSdk { /** * Init SDK, must be invoked before using any API * @param configuration SDK Configuration */ function init(configuration: { /** Service endpoint */ endpoint: string; /** Service API code */ apiCode: string; /** is apnsSandbox */ apnsSandbox: boolean; }): void; /** * Sdk meta info such as version, buildTypes, ... */ namespace sdkInfo { /** version name of SDK */ var VERSION_NAME: string; /** version code of SDK */ var VERSION_CODE: string; /** build type of SDK */ var BUILD_TYPE: string; } /** * Definition of all error codes */ namespace ErrorCodes { /** Unknown error */ const ErrUnknown = "-1"; /** Not signed in */ const ErrNotSignedIn = "-2"; /** Invalid PIN code */ const ErrInvalidPinCode = "-3"; /** Concurrent execution */ const ErrConcurrentExecution = "-4"; /** PIN secret not valid */ const ErrInvalidPinSecret = "-5"; /** Biometric Unsupported */ const ErrBiometricUnsupported = "-6"; /** User cancel operation */ const ErrUserCancel = "-7"; /** Admin cannot disable */ const ErrDisableAdmin = "101"; /** The Email address or password provided is not correct */ const ErrUserOrPasswordIncorrect = "102"; /** Account already exists */ const ErrUserExist = "103"; /** Accountwan banned */ const ErrUserDisabled = "104"; /** Email cannot be empty */ const ErrUserEmailEmpty = "105"; /** Email has been used */ const ErrUserEmailExist = "106"; /** Email format is incorrect */ const ErrUserEmailFormatError = "107"; /** Password should be 8-18 chars */ const ErrUserPasswordFormatError = "108"; /** Account can only be english char and 3-50 chars */ const ErrUserAccountFormatError = "109"; /** Permission is incorrect */ const ErrUserRoleError = "110"; /** Old password is incorrect */ const ErrorUserPasswordError = "111"; /** Invalid parameter */ const ErrInvalidParameter = "112"; /** Permission denied */ const ErrPermissionDenied = "113"; /** Need user setup pin before do this */ const ErrNotAuthByPIN = "114"; /** Need user bind OTP before do this */ const ErrNotAuthByOTP = "115"; /** Token is Invalid */ const ErrUserInvalidPasswordToken = "116"; /** Reject by User */ const ErrUserReject = "117"; /** Not Implemented */ const ErrNotImplemented = "118"; /** Error Encrypt failed */ const ErrEncryptFailed = "119"; /** Not support this kind of authorization */ const ErrUserAuthMethodInvalid = "120"; /** Unactivated user */ const ErrUserUnactivated = "125"; /** invalid user */ const ErrUserInvalid = "126"; /** User already activated */ const ErrUserAlreadyActivated = "127"; /** Need to setup OTP for auth before operation this action */ const ErrUserRequireOTPSetup = "128"; /** Only admin can be added from web */ const ErrOnlyAdminCanBeAdded = "129"; /** Get user info failed */ const ErrUserGetInfoFailed = "130"; /** User does not set pin yet */ const ErrUserNoPIN = "131"; /** User already exist */ const ErrAddUserDuplicate = "132"; /** Add User failed */ const ErrAddUserFailed = "133"; /** User unauthorized */ const ErrUserUnauthorized = "134"; /** Incorrect user PIN */ const ErrUserIncorrectPIN = "135"; /** Unknow client version */ const ErrClientVersion = "136"; /** Please update you CYBAVO Vault to access to the latest features! */ const ErrAppMustUpdate = "137"; /** Invalid device token */ const ErrInvalidDeviceToken = "138"; /** Incorrect user PIN. Retry limit exceeded. */ const ErrUserIncorrectPINMaxRetry = "139"; /** Shutdown in progress */ const ErrShutdownInProgress = "140"; /** User has been deactivated */ const ErrUserDeactivated = "141"; /** User name empty */ const ErrUserNameEmpty = "142"; /** Create mapped wallet fail */ const ErrMappedWallet = "143"; /** Only Token can create mapped wallet */ const ErrNotTokenWallet = "144"; /** Cannot create 2 mapped wallet to 1 wallet adress */ const ErrNotCreateMultiMappedToSameAddr = "145"; /** Only Mapped Wallet can use Mapped ID */ const ErrMappedWalletOnly = "146"; /** Failed to connect CC server */ const ErrConnectCCServer = "147"; /** User is locked */ const ErrUserIsLocked = "148"; /** Unlock link expired */ const ErrUnlockCodeExpired = "149"; /** Operation too frequent */ const ErrOperationTooFrequent = "150"; /** Update key in progress */ const ErrUpdateKeyInProgress = "151"; /** Invalid QR Code */ const ErrInvalidQRCode = "152"; /** Not able to restore PIN yet. Please contact admin to initial this process */ const ErrForgotPINNotReady = "153"; /** Invalid restore code */ const ErrInvalidRestoreCode = "154"; /** No wallet recovery data for user */ const ErrNoRecoveryCode = "155"; /** Register fail */ const ErrRegisterFail = "156"; /** Registration required */ const ErrRegistrationRequired = "157"; /** Unable to disable yourself */ const ErrDisableSelf = "158"; /** User did not request to recovery PIN */ const ErrForgotPINInvalid = "159"; /** Forgot PIN expired. Please ask user to submit again */ const ErrForgotPINExpired = "160"; /** Unable to change role */ const ErrUnableChangeRole = "161"; /** Already handle by other admin */ const ErrForgotPINHandled = "162"; /** Not approve by admin */ const ErrForgotPINNotApprove = "163"; /** Admin info not found */ const ErrAdminInfoNotFound = "164"; /** User permission was changed by others */ const ErrInvalidAdminPerm = "165"; /** The account is temporarily blocked because you entered the wrong PIN too many times */ const ErrUserIncorrectPINLock = "166"; /** User was unlocked */ const ErrUserIsUnlocked = "167"; /** The account is temporarily blocked because you entered the wrong answer too many times */ const ErrUserIncorrectSQLock = "168"; /** User already set PIN */ const ErrUserPINAlreadySet = "169"; /** Secure token not ready */ const ErrUserSecureTokenNotReady = "170"; /** User has not setup security questions yet */ const ErrUserSecurityQuestionsNotReady = "171"; /** Invalid Unlock token */ const ErrInvalidUnlockToken = "172"; /** hash is required to be exactly 32 bytes */ const ErrInvalidHashLength = "173"; /** Invalid ABI function */ const ErrInvalidAbiFunction = "174"; /** Frequent operation, please try again after 1 sec */ const ErrOperationTooFrequentShortly = "175"; /** User phone number not verified, need register phone number */ const ErrUserPhoneNumUnverified = "180"; /** Action token invalid */ const ErrActionTokenInvalid = "181"; /** OTP code(SMS code) invalid */ const ErrOTPCodeInvalid = "182"; /** Require too frequent */ const ErrRequireTooFrequent = "183"; /** Invalid Signature */ const ErrInvalidSignature = "184"; /** Biometrics setting not found, need updateDeviceInfo */ const ErrBiometricsNotFound = "185"; /** Device otp(SMS code) unverified, need getLoginSms then verifyOtp */ const ErrDeviceOtpUnverified = "186"; /** Walelt Create Failed */ const ErrWalletCreateFailed = "301"; /** Invalid Address, please make sure your address format is correct */ const ErrWalletAddressInvalid = "302"; /** Invalid currency */ const ErrWalletCurrencyInvalid = "303"; /** Wallet ID invalid */ const ErrWalletIDInvalid = "304"; /** Parse SetWalletPolicyRequest failed */ const ErrWalletPolicyParseFailed = "305"; /** Set SetWalletPolicyRequest failed */ const ErrWalletPolicySetFailed = "306"; /** Get SetWalletPolicyRequest failed */ const ErrWalletPolicyGetFailed = "307"; /** Policy Sign fail */ const ErrPolicySignFail = "308"; /** Policy Sign invalid */ const ErrPolicySignInvalid = "309"; /** Policy state error */ const ErrPolicyState = "310"; /** Policy transfer fail */ const ErrPolicyTransFail = "311"; /** Policy not found */ const ErrPolicyNotFound = "312"; /** Not pass policy enforcement */ const ErrPolicyNotPass = "313"; /** Invalid policy approver */ const ErrPolicyApprover = "314"; /** Policy: wallet not found */ const ErrPolicyWalletNotFound = "315"; /** Policy: currency not match */ const ErrPolicyCurrencyNotMatch = "316"; /** Policy: currency not support */ const ErrPolicyCurrencyNotSupport = "317"; /** Policy: not wallet creator */ const ErrPolicyNotWalletCreator = "318"; /** Policy: wallet address is incorrects */ const ErrPolicyWalletAddressDiff = "319"; /** Policy: the transaction count of wallet should be greater than zero */ const ErrPolicyWalletHeaderTrans = "320"; /** Policy: amount trans to value fail */ const ErrPolicyAmountTransferFail = "321"; /** Policy: the transaction amount of wallet should greater than zero */ const ErrPolicyWalletHeaderAmount = "322"; /** Policy: no outgoing address */ const ErrPolicyOutgoingAddressNull = "323"; /** Policy: outgoing address incorrect */ const ErrPolicyOutgoingAddressQFail = "324"; /** Policy: outgoing address inconsistent */ const ErrPolicyOutgoingAddressInconsistent = "325"; /** Policy: auditor duplicate order */ const ErrPolicyAuditorDuplicateOrder = "326"; /** Policy: auditor duplicated user */ const ErrPolicyAuditorDuplicateUser = "327"; /** Policy: approver duplicate order */ const ErrPolicyApproverDuplicateOrder = "328"; /** Policy: approver duplicate user */ const ErrPolicyApproverDuplicateUser = "329"; /** Policy: operator duplicate order */ const ErrPolicyOperatorDuplicateOrder = "330"; /** Policy: operator duplicate user */ const ErrPolicyOperatorDuplicateUser = "331"; /** Policy: operator amount trans fail */ const ErrPolicyOperatorAmountTransFail = "332"; /** Policy: the amount of operator should be greater than zero */ const ErrPolicyOperatorAmountUnderZero = "333"; /** Policy: the transaction count of operator should be greater than zero */ const ErrPolicyOperatorTransUnderZero = "334"; /** Policy: the amount of wallet should be greater than the amount of operator */ const ErrPolicyOperatorAmountOverMax = "335"; /** Policy: the transaction count of wallet should be greater than the transaction count of operator */ const ErrPolicyOperatorTransOverMax = "336"; /** Policy: approver amount trans fail */ const ErrPolicyApproverAmountTransFail = "337"; /** Policy: the amount of approver should be greater than zero */ const ErrPolicyApproverAmountUnderZero = "338"; /** Policy: the maximum operator amount should be greater than the minimum approver amount */ const ErrPolicyMaxAppOverMaxOp = "339"; /** Policy: No operator */ const ErrPolicyNoOperator = "340"; /** Policy: some user has not set pin */ const ErrPolicyPINNotSet = "341"; /** Policy: some user not exist */ const ErrPolicyUserNotExist = "342"; /** Policy: approver is not cosigner */ const ErrPolicyApproverNotCosigner = "343"; /** Policy: cosigners not approvers */ const ErrPolicyAllCosignersNotApprover = "344"; /** Policy: approver configure incorrectly */ const ErrPolicyApproverConfigureIncorrectly = "345"; /** Policy: level incorrect */ const ErrPolicyLevelIncorrect = "346"; /** Policy: Owner count incorrect */ const ErrPolicyOwnerIncorrect = "347"; /** Not wallet operator */ const ErrWalletNotOperation = "348"; /** Invalid schedule withdraw */ const ErrScheduleWithdrawNotFound = "349"; /** Permission denied. Only creator can delete schedule withdraw */ const ErrScheduleWithdrawNotCreator = "350"; /** No wallet to backup */ const ErrNoWalletToBackup = "351"; /** Invalid backup answer */ const ErrInvalidBackupAnswer = "352"; /** Another activated user with same mnemonic */ const ErrWalletMnemonicDuplicate = "353"; /** Exceed Operator Allow Amount */ const ErrScheduleWithdrawExceedPolicyAmount = "354"; /** Not Operator in WalletPolicy */ const ErrScheduleWithdrawNotOperator = "355"; /** Not Outgoing in WalletPolicy */ const ErrScheduleWithdrawNotOutgoing = "356"; /** Check balance failed */ const ErrScheduleWithdrawCheckBalanceFailed = "357"; /** Schedule withdraw invalid */ const ErrScheduleWithdrawInvalid = "358"; /** Fail to get transaction fee */ const ErrGetTransactionFeeError = "359"; /** Policy changed, unlock again if needed */ const ErrNotPendingNow = "360"; /** Invalid fee level */ const ErrInvalidFeeLevel = "361"; /** Fail to sign batch transaction */ const ErrSignBatchTransactionFailed = "362"; /** Wallet not ready to withdraw */ const ErrWalletKeyNotReady = "363"; /** Not batch wallet */ const ErrNotBatchWallet = "364"; /** Not batch transaction */ const ErrNotBatchTransaction = "365"; /** Exceed max batch amount */ const ErrExceedMaxBatchAmount = "366"; /** Doing batch transaction */ const ErrOngoingBatchTransaction = "367"; /** transaction id not found */ const ErrTxIDNotFound = "368"; /** Not wallet owner */ const ErrNotWalletOwner = "369"; /** Not Admin */ const ErrNotAdmin = "370"; /** Invalid wallet */ const ErrInvalidWalletId = "371"; /** Wallet already created */ const ErrWalletAlreadyCreated = "372"; /** Cannot send amount to yourself address */ const ErrTransactionSameAddress = "373"; /** Destination address must in outgoing address */ const ErrDestinationNotInOutgoingAddress = "374"; /** API Secret expired */ const ErrApiSecretExpired = "384"; /** API Secret not valid */ const ErrAPISecretNotValid = "385"; /** Balance: upper bound value transfer fail */ const ErrBalanceUpperTransFail = "401"; /** Balance: lower bound value transfer fail */ const ErrBalanceLowerTransFail = "402"; /** Balance: lower bound >= upper bound */ const ErrBalanceLOverU = "403"; /** Balance: Interval should between 1800 = 30mins~86400 = 1days */ const ErrBalanceIntervalIncorrect = "404"; /** Balance: Not found item in db */ const ErrBalanceDBNotFound = "405"; /** Balance: Item not match */ const ErrBalanceItemNotMatch = "406"; /** Invalid ID */ const ErrBalanceIdInvalid = "407"; /** No contract code at given address */ const ErrNoContractCode = "408"; /** Expired Token */ const ErrExpiredToken = "500"; /** Verify fail, incorrect number */ const ErrVerifyFail = "501"; /** Exceed maximum retry counts, please resend the verify number again */ const ErrVerifyExceed = "502"; /** No token present */ const ErrParameterNoToken = "701"; /** Unknown operation */ const ErrParameterInvalidOperation = "702"; /** Operation failed */ const ErrOperationFailed = "703"; /** Failed to get SKU info */ const ErrSKUInfoFailed = "704"; /** Exceed max allow user limitation, Upgrade your SKU to get more users */ const ErrSKUUserLimit = "705"; /** Exceed max allow wallet limitation, Upgrade your SKU to get more wallets */ const ErrSKUWalletLimit = "706"; /** Exceed max allow outgoping address limitation, Upgrade your SKU to get more outgoing address */ const ErrSKUOutgoingLimit = "707"; /** Insufficient fund */ const ErrTransactionInsufficientFund = "801"; /** UTXO Insufficient fund */ const ErrTransactionUTXOInsufficientFund = "802"; /** UTXO Temporarily Not Available */ const ErrUTXOTemporarilyNotAvailable = "803"; /** Fullnodes' syncing now, wait a few minutes to do the transaction */ const ErrFullNodeSyncing = "804"; /** Duplicate outgoing address */ const ErrOutgoingAddressDuplicate = "901"; /** Invalid outgoing address id */ const ErrOutgoingAddressIdInvalid = "902"; /** KMS out of service. Please try again later. */ const ErrKMSNotReady = "903"; /** Invalid Api Code. */ const ErrInvalidApiCode = "904"; /** Duplicate entry. */ const ErrDuplicateApp = "905"; /** WALLET SDK is outdated. Please upgrade your sdk. */ const ErrSDKOutdated = "906"; /** Inner Fee less than lower bound */ const ErrorFeeLowerBound = "907"; /** Inner Fee higher than upper bound */ const ErrorFeeUpperBound = "908"; /** Inner fee configuration incorrect */ const ErrorInnerFeeAmount = "909"; /** Inner fee transfer amount fail */ const ErrorTransferAmountFail = "910"; /** Inner fee fail to check fee */ const ErrFailToGetFee = "911"; /** Inner fee higher than amount */ const ErrFeeTooHigh = "912"; /** Parse transaction fail */ const ErrParseTransactionFail = "913"; /** Batch transaction not support inner fee now, please contact cybavo for next step */ const ErrNotSupportInnerFee = "914"; /** Transaction fee over upper bound */ const ErrorFeeOverUpper = "915"; /** Inner Fee address incorrect */ const ErrorInnerFeeAddress = "916"; /** Need at least 1 trx in wallet for energy usage. */ const ErrNoTRONForEnergy = "917"; /** Insufficient bandwidth, need to delegate bandwidth or tron */ const ErrorInsufficientBandWidth = "918"; /** Destination not create. Too little XRP(< 20) sent to create it. */ const ErrorDestNotExist = "919"; /** BTC is not enough to pay for transaction fee */ const ErrTransactionInsufficientBTCFee = "920"; /** ETH is not enough to pay for transaction fee */ const ErrTransactionInsufficientETHFee = "921"; /** BTC UTXOs is not enough to pay for transaction fee */ const ErrTransactionInsufficientBTCUTXOFee = "922"; /** Transfer amount is too small and considered as dust by blockchain */ const ErrDustFail = "923"; /** The number of UTXO set exceed max allow number(2500) */ const ErrUTXOExceedMax = "924"; /** BTC UTXOs are not enough to pay for platform fee */ const ErrUTXONotEnough = "925"; /** Insufficient fund, you must leave 0.000625 BNB for transaction fee */ const ErrInsufficientFundBNB = "926"; /** No Result from BNB fullnode */ const ErrorTxNoResult = "927"; /** Send Tx to BNB fullnode fail */ const ErrorSendTxFail = "928"; /** Illegal transaction format */ const ErrorIllegalFormat = "929"; /** Account was not created, please send at least 1 TRX to this address for account creation */ const ErrorAccountNotCreate = "930"; /** Destination Tag must be integer */ const ErrorIncorrectTag = "931"; /** Invalid EOS Account format */ const ErrInvalidEOSFormat = "932"; /** Invalid app id */ const ErrInvalidAppId = "933"; /** Invalid AWS Pinpoint app id */ const ErrInvalidPinpointAppId = "934"; /** This EOS Account already existed */ const ErrEOSAccountExisted = "935"; /** Google Auth error */ const ErrGoogleAuthError = "1001"; /** WeChat Auth error */ const ErrWechatAuthError = "1002"; /** Facebook Auth error */ const ErrFacebookAuthError = "1003"; /** LINE Auth error */ const ErrLineAuthError = "1004"; /** PIN token expired, need to sign in again to recover */ const ErrInvalidPINToken = "10001"; /** RAM operation bytes smaller than minimal amounts */ const ErrorRamOperationMinAmount = "10301"; } } /** * Auth includes user authentication related APIs. * * Once signed in, SDK core will maintain a session * * If session expires, [[Events.onSignInStateChanged]] with [[SignInState.SESSION_EXPIRED]] will be emitted * * ## Authentication * * Sign in with a new account will get an [[ErrorCodes.ErrRegistrationRequired]] error. * You can check this error and guide user to registration process. * Identity provider is corresponding to configuration on backend, such as "Google", "Facebook" or "WeChat" * * ```js * try { * await Auth.signIn(idToken, "Google") * } catch (error) { * if (ErrorCodes.ErrRegistrationRequired === error.code) { * // do registration instead * } else { * // error handling... * } * } * ``` * * ## SignInState * * Please note that SignInState is a local state, and not represent to real-time session state. * * When any API call requires a valid session, however, the session has been expired. The API call will receive an [[ErrorCodes.ErrExpiredToken]] error, * and [[Events.onSignInStateChanged]] will be emitted with [[SignInState.SESSION_EXPIRED]], too. * * Thus, the most common usage is when the app launching, invoke [[Auth.getSignInState]] to get current session state. If get [[SignInState.SIGNED_OUT]], * lead user to the Sign-in page. Register event [[Auth.Events.onSignInStateChanged]] with [[Auth.addListener]], and handle the state change anytime callback arrived. * * - **[[SignInState.SIGNED_IN]]**- Lead user to main page * - **[[SignInState.SIGNED_OUT]]** - Lead user to sign-in page * - **[[SignInState.SESSION_EXPIRED]] or [[SignInState.SESSION_INVALID]]** - Try to restore session or just lead user to sign-in page * * ## PIN Code Input * * PIN code can only be retrieved with a PinCodeInputView instance, such as [[NumericPinCodeInputView]]. * Render a PinCodeInputView, pass a callback function to [[NumericPinCodeInputViewProps.onChanged]] property. * The onChanged callback will be invoked when user input changed with current PIN code length. * Once the length matched your PIN code length, invoke [[NumericPinCodeInputViewProps.submit]] and retrieve a pinSecret. * Then, you can pass the PIN secret to APIs required a PIN code, such as [[Wallets.createTransaction]] * Once you get the PIN secret, consume it as soon as possible. * If you need to invoke another API, use PinCodeInputView to retrieve another PIN hash from user again. * * ### Example * * ```js * class MyComponent extends Component { * _onInputPinCode: async (length) => { * if (length === 6) { * const pinSecret = await this.refs.pinCodeInput.submit(); * await Auth.createWallet(pinSecret); * } * } * render: () => { * * } * } * ``` * * ## Retaining PinSecret * * By default, PinSecret can only be access ***ONCE***, unless you retain it explicitly by pass retain = true via a [[PinSecretBearer]], * then the PinSecret will be retained ***ONCE more*** to survive next access. If you need to extend it's lifecycle, pass retain = true via a [[PinSecretBearer]] * to retain one more time and so on. * * ### Example of retain * * ```js * const pinSecret = await this.refs.pinCodeInput.submit(); * // retain it to survive setupPinCode() * Auth.setupPinCode({ pinSecret, retain: true }, ...); * // since we've retained it, we can pass it to createWallet() * Wallets.createWallet(..., pinSecret, ...); * ``` * * ## PIN Code setup * [[getUserState]] returns an [[UserState]], which contains a [[UserState.setPin]] flag, indicates if the user has finished PIN code setup * * After User sign in, you could invoke [[getUserState]] to check if user has finished PIN code setup, If not, init the setup process. * * ```js * const { userState } = await Auth.getUserState() * if (!userState.setPin) { * // start PIN code setup * } * ``` * * * ## Perform PIN Code setup * ```js * // get pinSecret from PinCodeInputView... * Auth.setupPinCode(pinSecret); * ``` * * ## PIN Code change and recovery * [[getUserState]] returns an [[UserState]], which contains a [[UserState.setSecurityQuestions]]} flag, * indicates if the user has finished Security Questions setup * * Setup Backup Challenge for PIN code restoration needs few parameters: * - The PIN code string * - Three [[BackupChallenge]] object, contains a pair of String as question and answer. They will be necessary to backup and restore PIN code * * ```js * await Auth.setupBackupChallenge( * pinSecret, // PIN code * { question: q1, answer: a1 }, // Q&A #1 * { question: q2, answer: a2 }, // Q&A #2 * { question: q3, answer: a3 } // Q&A #3 * ); * ``` * * There are few ways to change PIN code: * * ### Change with Current PIN Code * If user still remembers current PIN code, use [[changePinCode]] API to change to new PIN code * * ### Change with Backup Challenges * If user forgot PIN coe but still remembers [[BackupChallenge]] use [[restorePinCode]] * to change PIN code by answering Backup Challenges. Use [[getRestoreQuestions]] to get questions, * and [[verifyRestoreQuestions]] to check questions before change PIN code * * ### Recovery by Administrator's assists * If user lost PIN code and Backup Challenges, use [[forgotPinCode]] API to notice administrator to initialize PIN code recovery process. * Once administrator approved, user will get a verification code via E-mail. Input the verification code and the new PIN code, * invoke [[recoverPinCode]] to recover PIN code. */ namespace Auth { /** * Emit events when authentication state updated * * ```js * import { Auth } from '@cybavo/react-native-wallet-service'; * * Auth.addListener(Auth.Events.onSignInStateChanged, * signInState => { * // do some handling * } * ); * ``` */ namespace Events { /** emit when SignInState changed */ const onSignInStateChanged = "onSignInStateChanged"; } /** * Definition of user session states, see [[Events.onSignInStateChanged]] */ enum SignInState { /** User signed in */ SIGNED_IN = 0, /** User signed out */ SIGNED_OUT = 1, /** User has signed in but session has expired */ SESSION_EXPIRED = 2, /** User has signed in but session is invalid */ SESSION_INVALID = 3, /** Unknown sign-in state. e.g., SDK initializing */ UNKNOWN = 4, /** User has signed in but need verify otp(sms code) */ NEED_VERIFY_OTP = 5, /** User has signed in but need register phone */ NEED_REGISTER_PHONE = 6, } /** * State of user * * see [[getUserState]], [[GetUserStateResult]] */ type UserState = { /** User has finished PIN setup */ setPin: boolean; /** User has setup BackupChallenges */ setSecurityQuestions: boolean; /** Real name of user */ realName: string; /** Email of user */ email: string; /** Preferred language setting of User */ language: string; /** Is enable biometric authentication */ enableBiometrics: boolean; /** Is enable walletconnect */ enableWalletconnect: boolean; /** Registered country code of user */ countryCode: string; /** Registered phone of user */ phone: string; }; /** * A pair of question and answer for backup/restoring PIN codes * * see [[setupPinCode]] * see [[restorePinCode]] * see [[recoverPinCode]] * see [[verifyRestoreQuestions]] * see [[getRestoreQuestions]] */ type BackupChallenge = { /** Qeuestion */ question: string; /** Answer */ answer: string; }; /** * Result of [[signIn]] API */ type SignInResult = {}; /** * Result of [[signUp]] API */ type SignUpResult = {}; /** * Result of [[getUserState]] API */ type GetUserStateResult = { /** Current user state */ userState: UserState; }; /** * Result of [[setupPinCode]] API */ type SetupPinCodeResult = {}; /** * Result of [[changePinCode]] API */ type ChangePinCodeResult = {}; /** * Result of [[setupBackupChallenge]] API */ type SetupBackupChallengeResult = {}; /** * Result of [[restorePinCode]] API */ type RestorePinCodeResult = {}; /** * Result of [[forgotPinCode]] API */ type ForgotPinCodeResult = {}; /** * Result of [[recoverPinCode]] API */ type RecoverPinCodeResult = {}; /** * Result of [[verifyRecoveryCode]] API */ type VerifyRecoveryCodeResult = {}; /** * Result of [[getRestoreQuestions]] API */ type GetRestoreQuestionsResult = { /** 1st question */ question1: string; /** 2nd question */ question2: string; /** 3rd question */ question3: string; }; /** * Result of [[verifyRestoreQuestions]] API */ type VerifyRestoreQuestionsResult = {}; /** * Result of [[setPushDeviceToken]] API */ type SetPushDeviceTokenResult = {}; /** * Result of [[RegisterPhoneNumber]] API */ type RegisterPhoneNumberResult = { /** actionToken for verifyOtp */ actionToken: string; }; /** * Result of [[VerifyOtp]] API */ type VerifyOtpResult = {}; /** * Adds a listener to be invoked when events of the specified type are * emitted. An optional calling context may be provided. The data arguments * emitted will be passed to the listener function. * * @param eventType - Name of the event to listen to * @param listener - Function to invoke when the specified event is emitted */ function addListener(eventType: string, listener: (...args: any[]) => any); /** * Get current SignInState, see [[SignInState]] */ function getSignInState(): Promise; /** * Sign in with 3rd party account system token * [[Events.onSignInStateChanged]] will be emitted * * @param token 3rd party user token * @param identityProvider 3rd party authentication identity provider, such as "Google", "Facebook", "LoginWithAmazon" ...etc * * If there is already a session, it will be replaced by new session, a [[SignInState.SIGNED_OUT]] * will be emitted followed by a [[SignInState.SIGNED_IN]] */ function signIn( token: string, identityProvider: string ): Promise; /** * Sign up with 3rd party account system token * @param token 3rd party user token * @param identityProvider 3rd party authentication identity provider, such as "Google", "Facebook", "LoginWithAmazon" ...etc * @param extras Extra attributes */ function signUp( token: string, identityProvider: string, extras: object ): Promise; /** * Sign out current session * [[SignInState.SIGNED_OUT]] will be emitted */ function signOut(): Promise; /** * Get current user state. i.e. is PIN Code setup completed */ function getUserState(): Promise; /** * Set user PIN code * @param pinSecret PIN Code */ function setupPinCode(pinSecret: number | PinSecretBearer): Promise; /** * Change user PIN code with current PIN code * @param newPinSecret New PIN code * @param currentPinSecret Current PIN code */ function changePinCode( newPinSecret: number | PinSecretBearer, currentPinSecret: number | PinSecretBearer ): Promise; /** * Set backup challenges, see [[restorePinCode]] * @param pinSecret PIN Code * @param challenge1 First BackupChallenge * @param challenge2 Second BackupChallenge * @param challenge3 Third BackupChallenge */ function setupBackupChallenge( pinSecret: number | PinSecretBearer, challenge1: BackupChallenge, challenge2: BackupChallenge, challenge3: BackupChallenge ): Promise; /** * Restore user PIN code with BackupChallenges, see [[setupBackupChallenge]] * @param newPinSecret New PIN code * @param challenge1 First BackupChallenge * @param challenge2 Second BackupChallenge * @param challenge3 Third BackupChallenge */ function restorePinCode( newPinSecret: number | PinSecretBearer, challenge1: BackupChallenge, challenge2: BackupChallenge, challenge3: BackupChallenge ): Promise; /** * Make a request to initiate PIN code recover process. After got the verificationCode, invoke [[recoverPinCode]] to reset PIN code */ function forgotPinCode(): Promise; /** * Recover user PIN code * @param newPinSecret PIN Code * @param recoveryCode The verification code generated in reset process */ function recoverPinCode( newPinSecret: number | PinSecretBearer, recoveryCode: string ): Promise; /** * Verify recovery code generated in reset process * @param recoveryCode The verification code generated in reset process */ function verifyRecoveryCode( recoveryCode: string ): Promise; /** * Get restore questions setup with setupPinCode() API */ function getRestoreQuestions(): Promise; /** * Verify restore questions setup with setupPinCode() API * @param challenge1 First BackupChallenge * @param challenge2 Second BackupChallenge * @param challenge3 Third BackupChallenge */ function verifyRestoreQuestions( challenge1: BackupChallenge, challenge2: BackupChallenge, challenge3: BackupChallenge ): Promise; /** * Set Push notification device token: Firebase Cloud Messaging (FCM) for Android and Apple Push Notification Service (APNS) for iOS * @param pushDeviceToken The device token retrieved from corresponding SDK depend on platforms */ function setPushDeviceToken(pushDeviceToken: string): Promise; /** * Register phone number * * @param country code ex. 886 * @param rest part of phone number ex. 900123456 * @param SMS expire time( second) */ function registerPhoneNumber( countryCode: string, phone: string, duration: number, ): Promise; /** * Verify otp(SMS code) * * @param actionToken returned by getSmsCod * @param SMS code that registered phone received */ function verifyOtp( actionToken: string, code: string ): Promise; } /** * Wallets includes user wallet related APIs * * # About Secure Token * * With Secure Token, user can make transaction without input PIN Code in a designated period. The Secure Token will NOT be persistent stored and will be reset after app life cycle * * ## Request Secure Token * * PIN Code is required to request Secure Token * * ```js * await Wallets.requestSecureToken(pinSecret); * ``` * * ## Make Transactions with Secure Token * Make a transaction with Secure Token but PIN Code. * If the Secure Token is Expired or Invalid, it will return [[ErrorCodes.ErrUserSecureTokenNotReady]] error code. * App shall redirect user to **Request Secure Token** flow described in above section. * * ```js * try { * await Wallets.createTransaction( * walletId, * outgoingAddress, * amount, * transactionFee, * description * ); * } catch (error) { * if (ErrorCodes.ErrUserSecureTokenNotReady === error.code) { * // request user to input PIN code * } * } * ``` * * ## Clear Secure Token * Clear Secure Token requested with [[requestSecureToken]], the promise rejected, Secure Token stored in SDK will still be revoked * * ```js * Wallets.clearSecureToken(); * ``` */ namespace Wallets { /** * Wallet type represents a wallet */ type Wallet = { /** Wallet ID */ walletId: number; /** Wallet type */ type: Wallet.Type; /** Wallet Address */ address: string; /** Name of wallet */ name: string; /** * Wallet currency, refer to [[getCurrencies]] API */ currency: number; /** * Wallet token contract address, refer to [[getCurrencies]] API */ tokenAddress: string; /** * Wallet simple currency name. i.e., BTC, ETH, BCH, ... For more detail, refer to [[getCurrencies]] API */ currencySymbol: string; /** * Parent wallet id for token wallets, such as ERC-20 wallets to Ethereum wallet */ parentWalletId: number; }; namespace Wallet { /** * Wallet types definition */ export enum Type { /** Regular wallet */ REGULAR = 0, /** Mapped wallet. i.e., an ERC-20 wallet maps to a parent ETH wallet */ MAPPED_WALLET = 2, /** Relayer wallet */ RELAYER_WALLET = 3, } } /** * Type of OTP */ export enum OtpType { /** (app didn't use)*/ SMS_SETUP_PHONE_OTP = 0, /** otp for transaction*/ SMS_VERIFY_OTP = 1, /** otp for signin*/ SMS_LOGIN_OTP = 2, /** (app didn't use)*/ EMAIL_VERIFY_OTP = 3, } /** * Type of biometric */ export enum BiometricsType { /* unknown */ UNKNOWN = 0, /* device not support biometric*/ NONE = 1, /* face ID*/ FACE = 2, /* finger print*/ FINGER = 3, } /** * Type definitions of EOS resource transactions */ enum EosResourceTransactionType { /** * Buy RAM */ BUY_RAM = 1, /** * Sell RAM */ SELL_RAM = 2, /** * Delegate CPU */ DELEGATE_CPU = 3, /** * Un-delegate CPU */ UNDELEGATE_CPU = 4, /** * Delegate NET */ DELEGATE_NET = 5, /** * Un-Delegate NET */ UNDELEGATE_NET = 6 } /** * Balance in an address, see [[getBalances]], [[GetBalancesResult]] */ type Balance = { /** Balance */ balance: string; /** Balance of token */ tokenBalance: string; /** Balance unconfirmed */ unconfirmedBalance: string; /** Fungible token IDs */ tokens: Array; /** Available balance */ availableBalance: string; }; /** * Transaction item * * see [[getHistory]], [[GetHistoryResult]] */ type Transaction = { /** TxID / TransactionId */ txid: string; /** Transfer from address */ fromAddress: string; /** Transfer to address */ toAddress: string; /** Transfer direction */ direction: Transaction.Direction; /** Transfer amount */ amount: string; /** Transfer transaction fee */ transactionFee: string; /** Transfer timestamp */ timestamp: number; /** Is transaction pending */ pending: boolean; /** Is transaction successful */ success: boolean; /** Error message */ error: string; /** Memo of specific currencies such as EOS and XRP */ memo: string; /** Description of the transaction, private to this wallet */ description: string; /** Is transaction for platform fee */ platformFee: boolean; /** Is transaction dropped from chain */ dropped: boolean; /** ABI method */ abiMethod: string; /** ABI arguments */ abiArguments: string; /** Is transaction replaceable */ replaceable: boolean; /** Is transaction replaced by another transaction */ replaced: boolean; /** TXID of replacement of this transaction if [[replaced]] == true */ replaceTxid: string; /** Nonce of transaction, only valid on ETH, same nonce means replacements */ nonce: number; /** Is preparing fee for this relayer transaction */ preparingFee: boolean; }; namespace Transaction { /** * Transaction direction */ export enum Direction { /** Transfer In */ IN = 0, /** Transfer Out */ OUT = 1 } } /** * Transaction Fee * * see [[getTransactionFee]], [[GetTransactionFeeResult]] */ type Fee = { /** Transaction fee amount */ amount: string; /** Transaction fee description. i.e. Estimated time */ description: string; }; /** * Currency, refer to [[getCurrencies]] */ type Currency = { /** * Currency of the cryptocurrency * If this cryptocurrency is a token such as ERC-20, the currency value will be the same as ETH */ currency: number; /** * Token contract address of the cryptocurrency. Only token will has this value */ tokenAddress: string; /** * Symbol of the cryptocurrency. i.e., BTC, ETH, XRP, ... */ symbol: string; /** * Display name of cryptocurrency. i.e., Bitcoin, Ethereum, Ripple, ... */ displayName: string; /** * Token version. ex ETH 721 */ tokenVersion: number; /** * Token decimals */ decimals: string; }; /** * MarketInfo, */ type MarketInfo = { /** * Currency */ currency: string; /** * Token symble */ symbol: string; price: string; trend: string; capitalization: string; dominance: string; queryDate: number; }; /** * CoinType, */ type CoinType = { /** * Currency of the cryptocurrency * If this cryptocurrency is a token such as ERC-20, the currency value will be the same as ETH */ currency: number; /** * Token contract address of the cryptocurrency. Only token will has this value */ tokenAddress: string; }; /** * API history item represents API log in walletconnect category * * see [[getWalletConnectApiHistory]], [[GetApiHistoryResult]] */ type ApiHistoryItem = { /** WalletID */ walletId: number; /** Wallet Name */ walletName: string; /** User ID */ userId: number; /** User Email */ userEmail: string; /** API name */ apiName: string; /** Create Time */ createTime: string; /** TXID for eth_sendRawTransaction */ txid: string; /** Failed message for eth_sendRawTransaction */ message: string; /** Transaction status */ status: number; /** access ID for eth_sendRawTransaction */ accessId: string; /** Used nonce status */ nonce?: number; /** Gas price */ gasPrice: string; /** Gas limit */ gasLimit: string; }; namespace ApiHistoryItem{ export enum Status { /** Transaction is pending */ WAITING = 0, /** Transaction is failed*/ FAILED = 1, /** Transaction is successful*/ DONE = 2, /** Transaction is dropped*/ DROPPED = 3, } } /** * Result of [[createWallet]] API */ type CreateWalletResult = { walletId: number; }; /** * Result of [[createWallet]] API */ type GetWalletsResult = { /** The wallets */ wallets: Array; }; /** * Result of [[getWallet]] API */ type GetWalletResult = { /** The wallet */ wallet: Wallet; }; /** * Result of [[getBalances]] API */ type GetBalancesResult = { /** * The Map of balances, the key will be same with parameters passed into [[getBalances]] */ balances: { [key: number]: Balance }; }; /** * Result of [[getHistory]] API */ type GetHistoryResult = { /** Start index of result, given by wallet.Wallets#getHistory() API */ start: number; /** Transaction items in range */ transactions: Array; /** Total count of history */ total: number; }; /** * Result of [[getTransactionFee]] API */ type GetTransactionFeeResult = { high: Fee; medium: Fee; low: Fee; }; /** * Result of [[getWalletUsage]] API */ type GetWalletUsageResult = { dailyTransactionAmountUsage: string; dailyTransactionAmountQuota: string; }; /** * Result of [[renameWallet]] API */ type RenameWalletResult = {}; /** * Result of [[requestSecureToken]] API */ type RequestSecureTokenResult = { /** * expiration time of secure token */ expireTime: number; /** * Unlock token */ unlockToken: string; }; /** * Result of [[walletConnectSync]] API */ type WalletConnectSyncResult = { /** Wallet IDs of added wallets */ walletIds: Array; }; /** * Result of [[getNonce]] API */ type GetNonceResult = { /** Pending nonce of specified wallet */ nonce: number; }; /** * Result of [[createTransaction]] API */ type CreateTransactionResult = { /** Unique system number of the transaction */ txno: number; /** Blockchain TX ID */ txid: string; }; /** * Result of [[replaceTransaction]] and [[cancelTransaction]] API */ type ReplaceTransactionResult = { /** Unique system number of the transaction */ txno: number; /** Blockchain TX ID */ txid: string; }; /** * Result of [[clearSecureToken]] API */ type ClearSecureTokenResult = {}; /** * Result of [[getCurrencies]] API */ type GetCurrenciesResult = { /** Completely currency list current supported */ currencies: Array; }; /** * Result of [[callAbiFunction]] API */ type CallAbiFunctionResult = { /** Blockchain TX ID */ txid: string; /** Signed Transaction */ signedTx: string; /** ABI function output */ output: string; }; /** * Result of [[getTransactionInfo]] API */ type GetTransactionInfoResult = { /** the number of block includes this transaction */ blockNumber: number; /** the confirm blocks of this transaction */ confirmBlocks: number; /** timestamp of blockNumber */ blockTimestamp: number; /** transaction fee */ fee: string; /** result string from chain. Can be used to identify error if failed */ result: string; /** If transaction was succeed */ success: boolean; /** transaction amount */ amount: string; /** transaction from address */ from: string; /** transaction to address */ to: string; /** contract address */ contractAddress: string; /** transaction data */ data: string; /** ABI method */ abiMethod: string; /** ABI arguments */ abiArguments: string; /** Is transaction replaceable */ replaceable: boolean; /** Is transaction replaced by another transaction */ replaced: boolean; /** TXID of replacement of this transaction if [[replaced]] == true */ replaceTxid: string; /** Nonce of transaction, only valid on ETH, same nonce means replacements */ nonce: number; }; /** * Result of [[getTransactionsInfo]] API */ type GetTransactionsInfoResult = { /** * Result of transactions, TXID as key and [[GetTransactionInfoResult]] as value */ transactionsInfo: { [txid: string]: GetTransactionInfoResult; }; }; /** * Result of [[getEosRamPrice]] API */ type GetEosRamPriceResult = { /** Price of RAM per KBytes */ ramPrice: string; }; /** * Result of [[getEosResourceState]] API */ type GetEosResourceStateResult = { /** Quota of RAM in bytes */ ramQuota: number; /** Usage of RAM in bytes */ ramUsage: number; /** Used NET in bytes */ netUsed: number; /** Available NET in bytes */ netAvailable: number; /** Max NET in bytes */ netMax: number; /** NET amount */ netAmount: number; /** NET amount exponential precision */ netAmountPrecision: number; /** NET refund */ netRefund: number; /** NET refund exponential precision */ netRefundPrecision: number; /** Used CPU in μs */ cpuUsed: number; /** Available CPU in μs */ cpuAvailable: number; /** Max CPU in μs */ cpuMax: number; /** CPU amount */ cpuAmount: number; /** CPU amount exponential precision */ cpuAmountPrecision: number; /** CPU refund */ cpuRefund: number; /** CPU refund exponential precision */ cpuRefundPrecision: number; }; /** * Result of [[validateEosAccount]] API */ type ValidateEosAccountResult = { /** Is given EOS account valid */ valid: boolean; /** Is given EOS account already exists */ exist: boolean; }; /** * Result of [[signRawTx]] API */ type SignedRawTxResult = { /** Signed Transaction */ signedTx: string; }; /** * Result of [[sendSignedTx]] API */ type SendSignedTxResult = { /** Transaction result */ state: boolean; /** Transaction Id*/ txid: string; }; /** * Result of [[estimateTransaction]] API */ type EstimateTransactionResult = { /** Estimated total amount to transaction */ tranasctionAmout: string; /** Estimated platform fee of transaction */ platformFee: string; /** Estimated blockchain fee of transaction */ blockchainFee: string; }; /** * Result of [[signMessage]] API */ type SignedMessageResult = { /** Signed message */ signedMessage: string; }; /** * Result of [[getWalletConnectApiHistory]] API */ type GetApiHistoryResult = { /** Start index of result, given by wallet.Wallets#getHistory() API */ start: number; /** Api history items in range, given by wallet.Wallets#getWalletConnectApiHistory() API */ apiHistoryItems: Array; /** Total count of history */ total: number; }; /** * Result of [[GetActionToken]] API */ type GetActionTokenResult = { actionToken: string; }; /** * Result of [[GetMarketInfos]] API */ type GetMarketInfosResult = { marketInfos: Array; }; /** * Result of [[GetSignedActionToken]] API */ type GetSignedActionTokenResult = {}; /** * Result of [[RegisterPubkey]] API */ type RegisterPubkeyResult = {}; /** * Result of [[UpdateDeviceInfo]] API */ type UpdateDeviceInfoResult = {}; /** * Result of [[IsBioKeyExist]] API */ type IsBioKeyExistResult = { exist: boolean }; type GetBiometricsTypeResult = { biometricsType: number }; /** * Create a new wallet * @param currency Currency of desired new wallet * @param tokenAddress Token address for tokens, i.e. an ERC-20 token wallet maps to an Ethereum wallet * @param parentWalletId Parent wallet for tokens, i.e. an ERC-20 token wallet maps to an Ethereum wallet * @param name Name of new wallet * @param pinSecret User Pin code * @param extraAttributes Extra attributes for specific currencies, pass null if unspecified. Supported extras: *
    *
  • account_name: string - Account name for EOS
  • *
*/ function createWallet( currency: number, tokenAddress: string, parentWalletId: number, name: string, pinSecret: number | PinSecretBearer, extraAttributes: object ): Promise; /** * Get wallet list of signed in user */ function getWallets(): Promise; /** * Get single wallet information * @param walletId Wallet ID to query */ function getWallet(walletId: number): Promise; /** * Get balances on a batch of addresses * @param addresses Array of addresses to query, the key of Map will be same with [[GetBalancesResult.balances]] */ function getBalances( addresses: Array<{ /** currency, refer to [[getCurrencies]] API */ currency: number; /** token contract address, refer to [[getCurrencies]] API */ tokenAddress: string; /** wallet address */ address: string; }> ): Promise; /** * Get transaction history from * * @param currency Currency of the address * @param tokenAddress Token Contract Address of thw address * @param walletAddress Wallet address * @param start Query start offset * @param count Query count returned * @param filters Filter parameters: *
    *
  • direction: Transaction.Direction - Direction of transaction
  • *
  • pending: boolean - Pending state of transactions
  • *
  • success: boolean - Success state of transactions
  • *
  • start_time: number - Start of time period to query, in Unix timestamp
  • *
  • end_time: number - End of time period to query, in Unix timestamp
  • *
*/ function getHistory( currency: number, tokenAddress: string, address: string, start: number, count: number, filters?: object ): Promise; /** * Get transaction transactionFee of specified currency * @param currency Currency to query */ function getTransactionFee( currency: number ): Promise; /** * Get wallet usage today * @param walletId Wallet ID to query */ function getWalletUsage(walletId: number): Promise; /** * Rename an existing wallet * @param walletId Wallet ID to rename * @param name New name of the wallet */ function renameWallet( walletId: number, name: string ): Promise; /** * Create a transaction from specified wallet to specified address * @param fromWalletId ID of wallet to withdraw from * @param toAddress Target address to send * @param amount Amount to transfer * @param transactionFee Transaction transactionFee to pay * @param description Description of the transaction * @param extraAttributes Extra attributes for specific currencies, pass null if unspecified. Supported extras: *
    *
  • memo: string - Memo for EOS or Destination tag for Ripple(XRP)
  • *
  • eos_transaction_type: [[EosResourceTransactionType]] - Resource transaction type for EOS, such as buy RAM, delegate CPU
  • *
  • num_bytes: number - Bytes of RAM for EOS RAM delegation/undelegation transactions. The minimal amounts are 1024 bytes
  • *
  • input_data: string - Hex string of input data. Must also set gas_limit when have this attributes
  • *
  • gas_limit: number - Must specify this if there were input_data
  • *
  • skip_email_notification: boolean - Determined whether or not to skip sending notification mail after create a transaction
  • *
* Note: When eos_transaction_type is [[SELL_RAM]], [[UNDELEGATE_CPU]] or [[UNDELEGATE_NET]], the receiver should always be address of wallet "fromWalletId" * @param pinSecret PIN Code */ function createTransaction( fromWalletId: number, toAddress: string, amount: string, transactionFee: string, description: string, pinSecret?: number | PinSecretBearer, extraAttributes?: object ): Promise; /** * Create a transaction from specified wallet to specified address * Authenticate by SMS * @param actionToken action token * @param smsCode sms code * @param fromWalletId ID of wallet to withdraw from * @param toAddress Target address to send * @param amount Amount to transfer * @param transactionFee Transaction transactionFee to pay * @param description Description of the transaction * @param extraAttributes Extra attributes for specific currencies, pass null if unspecified. Supported extras: *
    *
  • memo: string - Memo for EOS or Destination tag for Ripple(XRP)
  • *
  • eos_transaction_type: [[EosResourceTransactionType]] - Resource transaction type for EOS, such as buy RAM, delegate CPU
  • *
  • num_bytes: number - Bytes of RAM for EOS RAM delegation/undelegation transactions. The minimal amounts are 1024 bytes
  • *
  • input_data: string - Hex string of input data. Must also set gas_limit when have this attributes
  • *
  • gas_limit: number - Must specify this if there were input_data
  • *
  • skip_email_notification: boolean - Determined whether or not to skip sending notification mail after create a transaction
  • *
* Note: When eos_transaction_type is [[SELL_RAM]], [[UNDELEGATE_CPU]] or [[UNDELEGATE_NET]], the receiver should always be address of wallet "fromWalletId" * @param pinSecret PIN Code */ function createTransactionSms( actionToken: string, smsCode: string, fromWalletId: number, toAddress: string, amount: string, transactionFee: string, description: string, pinSecret?: number | PinSecretBearer, extraAttributes?: object ): Promise; /** * Create a transaction from specified wallet to specified address * Authenticate by Biometric * @param promptMessage Message that will be displayed in the fingerprint or face id prompt * @param cancelButtonText (Android only) Text to be displayed for the cancel button on biometric prompts, defaults to `Cancel` * @param fromWalletId ID of wallet to withdraw from * @param toAddress Target address to send * @param amount Amount to transfer * @param transactionFee Transaction transactionFee to pay * @param description Description of the transaction * @param extraAttributes Extra attributes for specific currencies, pass null if unspecified. Supported extras: *
    *
  • memo: string - Memo for EOS or Destination tag for Ripple(XRP)
  • *
  • eos_transaction_type: [[EosResourceTransactionType]] - Resource transaction type for EOS, such as buy RAM, delegate CPU
  • *
  • num_bytes: number - Bytes of RAM for EOS RAM delegation/undelegation transactions. The minimal amounts are 1024 bytes
  • *
  • input_data: string - Hex string of input data. Must also set gas_limit when have this attributes
  • *
  • gas_limit: number - Must specify this if there were input_data
  • *
  • skip_email_notification: boolean - Determined whether or not to skip sending notification mail after create a transaction
  • *
* Note: When eos_transaction_type is [[SELL_RAM]], [[UNDELEGATE_CPU]] or [[UNDELEGATE_NET]], the receiver should always be address of wallet "fromWalletId" * @param pinSecret PIN Code */ function createTransactionBio( promptMessage: string, cancelButtonText: string, fromWalletId: number, toAddress: string, amount: string, transactionFee: string, description: string, pinSecret?: number | PinSecretBearer, extraAttributes?: object ): Promise; /** * Replace an existing transaction with a greater fee * @param fromWalletId ID of wallet to withdraw from * @param txid TXID of transaction to replace * @param transactionFee Transaction transactionFee to pay * @param pinSecret PIN Code */ function increaseTransactionFee( fromWalletId: number, txid: string, transactionFee: string, pinSecret?: number | PinSecretBearer, ): Promise; /** * Replace an existing transaction with a greater fee * Authenticate by SMS * * @param actionToken action token * @param smsCode sms code * @param fromWalletId ID of wallet to withdraw from * @param txid TXID of transaction to replace * @param transactionFee Transaction transactionFee to pay * @param pinSecret PIN Code */ function increaseTransactionFeeSms( actionToken: string, smsCode: string, fromWalletId: number, txid: string, transactionFee: string, pinSecret?: number | PinSecretBearer, ): Promise; /** * Replace an existing transaction with a greater fee * Authenticate by Biometric * @param promptMessage Message that will be displayed in the fingerprint or face id prompt * @param cancelButtonText (Android only) Text to be displayed for the cancel button on biometric prompts, defaults to `Cancel` * @param fromWalletId ID of wallet to withdraw from * @param txid TXID of transaction to replace * @param transactionFee Transaction transactionFee to pay * @param pinSecret PIN Code */ function increaseTransactionFeeBio( promptMessage: string, cancelButtonText: string, fromWalletId: number, txid: string, transactionFee: string, pinSecret?: number | PinSecretBearer, ): Promise; /** * Cancel an existing transaction (Replace with a transaction with zero amount) * @param fromWalletId ID of wallet to withdraw from * @param txid TXID of transaction to replace * @param transactionFee Transaction transactionFee to pay * @param pinSecret PIN Code */ function cancelTransaction( fromWalletId: number, txid: string, transactionFee: string, pinSecret?: number | PinSecretBearer, ): Promise; /** * Cancel an existing transaction (Replace with a transaction with zero amount) * Authenticate by SMS * @param actionToken action token * @param smsCode sms code * @param fromWalletId ID of wallet to withdraw from * @param txid TXID of transaction to replace * @param transactionFee Transaction transactionFee to pay * @param pinSecret PIN Code */ function cancelTransactionSms( actionToken: string, smsCode: string, fromWalletId: number, txid: string, transactionFee: string, pinSecret?: number | PinSecretBearer, ): Promise; /** * Cancel an existing transaction (Replace with a transaction with zero amount) * Authenticate by Biometric * @param promptMessage Message that will be displayed in the fingerprint or face id prompt * @param cancelButtonText (Android only) Text to be displayed for the cancel button on biometric prompts, defaults to `Cancel` * @param fromWalletId ID of wallet to withdraw from * @param txid TXID of transaction to replace * @param transactionFee Transaction transactionFee to pay * @param pinSecret PIN Code */ function cancelTransactionBio( promptMessage: string, cancelButtonText: string, fromWalletId: number, txid: string, transactionFee: string, pinSecret?: number | PinSecretBearer, ): Promise; /** * Request a Secure Token that can be used to perform Wallet manipulations such as [[createTransaction]] without input PIN code in a specific time * The Secure Token will not be persistent stored and will be reset next application lifecycle * @param pinSecret PIN Code */ function requestSecureToken( pinSecret: number | PinSecretBearer ): Promise; /** * Request a Secure Token that can be used to perform Wallet manipulations such as [[createTransaction]] without input PIN code in a specific time * The Secure Token will not be persistent stored and will be reset next application lifecycle * Authenticate by SMS * @param actionToken action token * @param smsCode sms code * @param pinSecret PIN Code */ function requestSecureTokenSms( actionToken: string, smsCode: string, pinSecret: number | PinSecretBearer ): Promise; /** * Request a Secure Token that can be used to perform Wallet manipulations such as [[createTransaction]] without input PIN code in a specific time * The Secure Token will not be persistent stored and will be reset next application lifecycle * Authenticate by Biometric * @param promptMessage Message that will be displayed in the fingerprint or face id prompt * @param cancelButtonText (Android only) Text to be displayed for the cancel button on biometric prompts, defaults to `Cancel` * @param pinSecret PIN Code */ function requestSecureTokenBio( promptMessage: string, cancelButtonText: string, pinSecret: number | PinSecretBearer ): Promise; /** * Revoke current Secure Token created via [[requestSecureToken]] */ function clearSecureToken(): Promise; /** * Get supported currency list */ function getCurrencies(): Promise; /** * Get currency price list * @param wallets Array of currency/wallet to query * @param exchangeCurrencies Array of currencies which need to get price. e.g. 'USD','TWD' * @param approximateRates rate reference. When the price is 0, it can be calculated by other exchange currency's price multiply the rate. e.g. ["TWD", ["USD", 29.45]] */ function getCurrencyPrices(wallets: Array<{ /** currency, refer to [[getCurrencies]] API */ currency: number; /** token contract address, refer to [[getCurrencies]] API */ tokenAddress: string; }>, exchangeCurrencies: Array<{string}>, approximateRates: object): Promise; /** * Call ABI function * * @param walletId ID of wallet to call ABI function * @param name function name of ABI * @param inputs inputs of ABI function * @param pinSecret User Pin code */ function callAbiFunction( walletId: number, name: string, inputs: object, pinSecret: number | PinSecretBearer ): Promise; /** * Call ABI function * Authenticate by SMS * @param actionToken action token * @param smsCode sms code * @param walletId ID of wallet to call ABI function * @param name function name of ABI * @param inputs inputs of ABI function * @param pinSecret User Pin code */ function callAbiFunctionSms( actionToken: string, smsCode: string, walletId: number, name: string, inputs: object, pinSecret: number | PinSecretBearer ): Promise; /** * Call ABI function * Authenticate by Biometric * @param promptMessage Message that will be displayed in the fingerprint or face id prompt * @param cancelButtonText (Android only) Text to be displayed for the cancel button on biometric prompts, defaults to `Cancel` * @param walletId ID of wallet to call ABI function * @param name function name of ABI * @param inputs inputs of ABI function * @param pinSecret User Pin code */ function callAbiFunctionBio( promptMessage: string, cancelButtonText: string, walletId: number, name: string, inputs: object, pinSecret: number | PinSecretBearer ): Promise; /** * Call general ABI function with read operation * * @param walletId ID of wallet to call ABI function * @param name Function name of ABI * @param contractAddress contract address of ABI * @param abiJson ABI contract json * @param args Argument array of ABI function */ function callAbiFunctionRead( walletId: number, name: string, contractAddress: string, abiJson: string, args: Array, ): Promise; /** * Call general ABI function with write operation * * @param walletId ID of wallet to call ABI function * @param name Function name of ABI * @param contractAddress contract address of ABI * @param abiJson ABI contract json * @param args Argument array of ABI function * @param transactionFee Transaction fee to pay * @param pinSecret User Pin code */ function callAbiFunctionTransaction( walletId: number, name: string, contractAddress: string, abiJson: string, args: Array, transactionFee: string, pinSecret: number | PinSecretBearer ): Promise; /** * Call general ABI function with write operation * Authenticate by SMS * @param actionToken action token * @param smsCode sms code * @param walletId ID of wallet to call ABI function * @param name Function name of ABI * @param contractAddress contract address of ABI * @param abiJson ABI contract json * @param args Argument array of ABI function * @param transactionFee Transaction fee to pay * @param pinSecret User Pin code */ function callAbiFunctionTransactionSms( actionToken: string, smsCode: string, walletId: number, name: string, contractAddress: string, abiJson: string, args: Array, transactionFee: string, pinSecret: number | PinSecretBearer ): Promise; /** * Call general ABI function with write operation * Authenticate by Biometric * @param promptMessage Message that will be displayed in the fingerprint or face id prompt * @param cancelButtonText (Android only) Text to be displayed for the cancel button on biometric prompts, defaults to `Cancel` * @param walletId ID of wallet to call ABI function * @param name Function name of ABI * @param contractAddress contract address of ABI * @param abiJson ABI contract json * @param args Argument array of ABI function * @param transactionFee Transaction fee to pay * @param pinSecret User Pin code */ function callAbiFunctionTransactionBio( promptMessage: string, cancelButtonText: string, walletId: number, name: string, contractAddress: string, abiJson: string, args: Array, transactionFee: string, pinSecret: number | PinSecretBearer ): Promise; /** * Get transaction result for given txid * * @param currency currency to get transaction result * @param txid txid of transaction */ function getTransactionInfo( currency: number, txid: string ): Promise; /** * Get transactions result for given txids * * @param currency currency to get transaction result * @param txids txid of transaction */ function getTransactionsInfo( currency: number, txid: string[] ): Promise; /** * Get EOS RAM price */ function getEosRamPrice(): Promise; /** * Get EOS account resource state */ function getEosResourceState(): Promise; /** * Validate EOS account, such as format valid or already exists * * @param accountName EOS account name to validate */ function validateEosAccount( accountName: string ): Promise; /** * Sign raw transaction * * @param walletId wallet ID * @param rawTx raw transaction * @param pinSecret User Pin code */ function signRawTx( walletId: number, rawTx: string, pinSecret: number | PinSecretBearer ): Promise; /** * Sign raw transaction * Authenticate by SMS * @param actionToken action token * @param smsCode sms code * @param walletId wallet ID * @param rawTx raw transaction * @param pinSecret User Pin code */ function signRawTxSms( actionToken: string, smsCode: string, walletId: number, rawTx: string, pinSecret: number | PinSecretBearer ): Promise; /** * Create transaction by signed transaction * Authenticate by Biometric * @param promptMessage Message that will be displayed in the fingerprint or face id prompt * @param cancelButtonText (Android only) Text to be displayed for the cancel button on biometric prompts, defaults to `Cancel` * @param walletId wallet ID * @param signedTx signed transaction */ function sendSignedTxBio( promptMessage: string, cancelButtonText: string, walletId: number, signedTx: string ): Promise; /** * Estimate platform fee / chain fee for given transaction information * * @param currency Currency of desired new wallet * @param tokenAddress Token address for tokens, i.e. an ERC-20 token wallet maps to an Ethereum wallet * @param amount Amount to transfer * @param transactionFee Transaction transactionFee to pay * @param walletId Wallet ID to estimated transaction */ function estimateTransaction( currency: number, tokenAddress: string, amount: string, transactionFee: string, walletId?: number, ): Promise; /** * Sign message by wallet private key * note: Only support ETH & TRX. Result is same as following links: *
    *
  • ETH: https://github.com/MetaMask/eth-sig-util/blob/master/test/index.js#L39-L46
  • *
  • TRX: https://github.com/TRON-US/tronweb/blob/461934e246707bca41529ab82ebe76cf894ab460/src/lib/trx.js#L712-L731
  • *
* @param walletId wallet ID * @param message message to sign * @param pinSecret User Pin code */ function signMessage( walletId: number, message: string, pinSecret: number | PinSecretBearer ): Promise; /** * Sign message by wallet private key * note: Only support ETH & TRX. Result is same as following links: *
    *
  • ETH: https://github.com/MetaMask/eth-sig-util/blob/master/test/index.js#L39-L46
  • *
  • TRX: https://github.com/TRON-US/tronweb/blob/461934e246707bca41529ab82ebe76cf894ab460/src/lib/trx.js#L712-L731
  • *
* Authenticate by SMS * @param actionToken action token * @param smsCode sms code * @param walletId wallet ID * @param message message to sign * @param pinSecret User Pin code */ function signMessageSms( actionToken: string, smsCode: string, walletId: number, message: string, pinSecret: number | PinSecretBearer ): Promise; /** * Sign message by wallet private key * note: Only support ETH & TRX. Result is same as following links: *
    *
  • ETH: https://github.com/MetaMask/eth-sig-util/blob/master/test/index.js#L39-L46
  • *
  • TRX: https://github.com/TRON-US/tronweb/blob/461934e246707bca41529ab82ebe76cf894ab460/src/lib/trx.js#L712-L731
  • *
* Authenticate by Biometric * @param promptMessage Message that will be displayed in the fingerprint or face id prompt * @param cancelButtonText (Android only) Text to be displayed for the cancel button on biometric prompts, defaults to `Cancel` * @param walletId wallet ID * @param message message to sign * @param pinSecret User Pin code */ function signMessageBio( promptMessage: string, cancelButtonText: string, walletId: number, message: string, pinSecret: number | PinSecretBearer ): Promise; /** * Sign typed data(eth_signTypedData) via WalletConnect, this call will be logged as ApiHistoryItem with API name: eth_signTypedData * - https://docs.walletconnect.org/json-rpc-api-methods/ethereum#eth_signtypeddata * @param walletId wallet ID * @param typedData typed data json string * @param pinSecret User Pin code */ function walletConnectSignTypedData( walletId: number, typedData: string, pinSecret: number | PinSecretBearer ): Promise; /** * Sign typed data(eth_signTypedData) via WalletConnect, this call will be logged as ApiHistoryItem with API name: eth_signTypedData * - https://docs.walletconnect.org/json-rpc-api-methods/ethereum#eth_signtypeddata * Authenticate by SMS * @param actionToken action token * @param smsCode sms code * @param walletId wallet ID * @param typedData typed data json string * @param pinSecret User Pin code */ function walletConnectSignTypedDataSms( actionToken: string, smsCode: string, walletId: number, typedData: string, pinSecret: number | PinSecretBearer ): Promise; /** * Sign typed data(eth_signTypedData) via WalletConnect, this call will be logged as ApiHistoryItem with API name: eth_signTypedData * - https://docs.walletconnect.org/json-rpc-api-methods/ethereum#eth_signtypeddata * Authenticate by Biometric * @param promptMessage Message that will be displayed in the fingerprint or face id prompt * @param cancelButtonText (Android only) Text to be displayed for the cancel button on biometric prompts, defaults to `Cancel` * @param walletId wallet ID * @param typedData typed data json string * @param pinSecret User Pin code */ function walletConnectSignTypedDataBio( promptMessage: string, cancelButtonText: string, walletId: number, typedData: string, pinSecret: number | PinSecretBearer ): Promise; /** * Signs a transaction(eth_signTransaction) via WalletConnect, this call will be logged as ApiHistoryItem with API name: eth_signTransaction * - https://docs.walletconnect.org/json-rpc-api-methods/ethereum#eth_signtransaction * @param walletId wallet ID * @param tx transaction object or json string * @param autoNonce if true, auto fill transaction's nonce with wallet's current pending nonce * @param onLog receive log callback * @param pinSecret User Pin code */ function walletConnectSignTransaction( walletId: number, tx: object | string, transactionFee: string, pinSecret: number | PinSecretBearer, autoNonce: boolean, onLog: function ): Promise; /** * Signs a transaction(eth_signTransaction) via WalletConnect, this call will be logged as ApiHistoryItem with API name: eth_signTransaction * - https://docs.walletconnect.org/json-rpc-api-methods/ethereum#eth_signtransaction * @param actionToken action token * @param smsCode sms code * @param walletId wallet ID * @param tx transaction object or json string * @param autoNonce if true, auto fill transaction's nonce with wallet's current pending nonce * @param onLog receive log callback * @param pinSecret User Pin code */ function walletConnectSignTransactionSms( actionToken: string, smsCode: string, walletId: number, tx: object | string, transactionFee: string, pinSecret: number | PinSecretBearer, autoNonce: boolean, onLog: function ): Promise; /** * Signs a transaction(eth_signTransaction) via WalletConnect, this call will be logged as ApiHistoryItem with API name: eth_signTransaction * - https://docs.walletconnect.org/json-rpc-api-methods/ethereum#eth_signtransaction * Authenticate by Biometric * @param promptMessage Message that will be displayed in the fingerprint or face id prompt * @param cancelButtonText (Android only) Text to be displayed for the cancel button on biometric prompts, defaults to `Cancel` * @param walletId wallet ID * @param tx transaction object or json string * @param autoNonce if true, auto fill transaction's nonce with wallet's current pending nonce * @param onLog receive log callback * @param pinSecret User Pin code */ function walletConnectSignTransactionBio( promptMessage: string, cancelButtonText: string, walletId: number, tx: object | string, transactionFee: string, pinSecret: number | PinSecretBearer, autoNonce: boolean, onLog: function ): Promise; /** * Sign message by wallet private key(eth_sign, personal_sign) via WalletConnect, * this call will be logged as ApiHistoryItem with API name: eth_sign * note: Only support ETH & TRX. Result is same as following links: *
    *
  • ETH: https://github.com/MetaMask/eth-sig-util/blob/master/test/index.js#L39-L46
  • *
  • TRX: https://github.com/TRON-US/tronweb/blob/461934e246707bca41529ab82ebe76cf894ab460/src/lib/trx.js#L712-L731
  • *
* @param walletId wallet ID * @param message message to sign * @param pinSecret User Pin code */ function walletConnectSignMessage( walletId: number, message: string, pinSecret: number | PinSecretBearer ): Promise; /** * Sign message by wallet private key(eth_sign, personal_sign) via WalletConnect, * this call will be logged as ApiHistoryItem with API name: eth_sign * note: Only support ETH & TRX. Result is same as following links: *
    *
  • ETH: https://github.com/MetaMask/eth-sig-util/blob/master/test/index.js#L39-L46
  • *
  • TRX: https://github.com/TRON-US/tronweb/blob/461934e246707bca41529ab82ebe76cf894ab460/src/lib/trx.js#L712-L731
  • *
* Authenticate by SMS * @param actionToken action token * @param smsCode sms code * @param walletId wallet ID * @param message message to sign * @param pinSecret User Pin code */ function walletConnectSignMessageSms( actionToken: string, smsCode: string, walletId: number, message: string, pinSecret: number | PinSecretBearer ): Promise; /** * Sign message by wallet private key(eth_sign, personal_sign) via WalletConnect, * this call will be logged as ApiHistoryItem with API name: eth_sign * note: Only support ETH & TRX. Result is same as following links: *
    *
  • ETH: https://github.com/MetaMask/eth-sig-util/blob/master/test/index.js#L39-L46
  • *
  • TRX: https://github.com/TRON-US/tronweb/blob/461934e246707bca41529ab82ebe76cf894ab460/src/lib/trx.js#L712-L731
  • *
* Authenticate by Biometric * @param promptMessage Message that will be displayed in the fingerprint or face id prompt * @param cancelButtonText (Android only) Text to be displayed for the cancel button on biometric prompts, defaults to `Cancel` * @param walletId wallet ID * @param message message to sign * @param pinSecret User Pin code */ function walletConnectSignMessageBio( promptMessage: string, cancelButtonText: string, walletId: number, message: string, pinSecret: number | PinSecretBearer ): Promise; /** * Create transaction by signed transaction(eth_sendTransaction) via WalletConnect, * this call will be logged as ApiHistoryItem with API name: eth_sendRawTransaction * * @param walletId wallet ID * @param signedTx signed transaction */ function walletConnectSendSignedTransaction( walletId: number, signedTx: string ): Promise; /** * Get WalletConnect API history from * * @param walletId wallet ID * @param start Query start offset * @param count Query count returned * @param filters Filter parameters: *
    *
  • api_name: string - API name
  • *
  • start_time: number - Start of time period to query, in Unix timestamp
  • *
  • end_time: number - End of time period to query, in Unix timestamp
  • *
*/ function getWalletConnectApiHistory( walletId: number, start: number, count: number, filters?: object ): Promise; /** * Trigger update to add pending currency and wallet which created by {@linkplain #walletConnectSendSignedTransaction(long, String, Callback)} * without filter * */ function walletConnectSync(): Promise; /** * Get pending nonce of specified wallet * without filter * * * @param walletId wallet ID */ function getNonce( walletId: number ): Promise; /** * Cancel an existing transaction which created by {@linkplain #walletConnectSendSignedTransaction(long, String, Callback)} (Replace with a transaction with zero amount) * * @param walletId wallet ID * @param accessId ID of ApiHistoryItem to replace * @param transactionFee transaction object json string * @param pinSecret User Pin code */ function cancelWalletConnectTransaction( walletId: number, accessId: string, transactionFee: string, pinSecret: number | PinSecretBearer ): Promise; /** * Cancel an existing transaction which created by {@linkplain #walletConnectSendSignedTransaction(long, String, Callback)} (Replace with a transaction with zero amount) * Authenticate by SMS * @param actionToken action token * @param smsCode sms code * @param walletId wallet ID * @param accessId ID of ApiHistoryItem to replace * @param transactionFee transaction object json string * @param pinSecret User Pin code */ function cancelWalletConnectTransactionSms( actionToken: string, smsCode: string, walletId: number, accessId: string, transactionFee: string, pinSecret: number | PinSecretBearer ): Promise; /** * Cancel an existing transaction which created by {@linkplain #walletConnectSendSignedTransaction(long, String, Callback)} (Replace with a transaction with zero amount) * Authenticate by Biometric * @param promptMessage Message that will be displayed in the fingerprint or face id prompt * @param cancelButtonText (Android only) Text to be displayed for the cancel button on biometric prompts, defaults to `Cancel` * @param walletId wallet ID * @param accessId ID of ApiHistoryItem to replace * @param transactionFee transaction object json string * @param pinSecret User Pin code */ function cancelWalletConnectTransactionBio( promptMessage: string, cancelButtonText: string, walletId: number, accessId: string, transactionFee: string, pinSecret: number | PinSecretBearer ): Promise; /** * get SMS code by passing OtpType * * * @param otpType OtpType * * @param SMS expire duration */ function getSmsCode( otpType: number, duration: number ): Promise; /** * get SMS code for sign-in * * * @param SMS expire duration */ function getLoginSmsCode( duration: number ): Promise; /** * get SMS code for transaction * * * @param SMS expire duration */ function getTransactionSmsCode( duration: number ): Promise; /** * get SMS code for transaction * * * @param promptMessage Message that will be displayed in the fingerprint or face id prompt * * @param cancelButtonText (Android only)Text to be displayed for the cancel button on biometric prompts, defaults to `Cancel` */ function getSignedActionToken( promptMessage: string, cancelButtonText: number ): Promise; /** * is biometrics key pair exist */ function isBioKeyExist( ): Promise; /** * Get device's biometrics type */ function getBiometricsType( ): Promise; /** * Update device's biometrics type, biometricsType will auto assign if passed null value * * @param biometricsType BiometricsType */ function updateDeviceInfo( biometricsType: number ): Promise; /** * register public key for biometrics authentication */ function registerPubkey( ): Promise; /** * get action token */ function getActionToken( ): Promise; /** * get market infos */ function getMarketInfos( ): Promise; } // views interface PinCodeInputViewProps extends ViewProperties { /** Maximum length of PIN code */ maxLength?: number, } interface NumericPinCodeInputViewProps extends PinCodeInputViewProps { /** Is keep the pinSecret key while notify onPinCodeChanged */ keepKey?: boolean, /** Make keypad order fixed */ fixedOrder?: boolean, /** Vibrate when keypad button pressed */ hapticFeedback?: boolean, /** Horizontal spacing of buttons in keypad */ horizontalSpacing?: number, /** Vertical spacing of buttons in keypad */ verticalSpacing?: number, // button styles /** Width of buttons */ buttonWidth?: number, /** Height of buttons */ buttonHeight?: number, /** Text size of buttons */ buttonTextSize?: number, /** Text color of buttons */ buttonTextColor?: string, /** Pressed text color of buttons */ buttonTextColorPressed?: string, /** Disabled text color of buttons */ buttonTextColorDisabled?: string, /** Background color of buttons */ buttonBackgroundColor?: string, /** Pressed background color of buttons */ buttonBackgroundColorPressed?: string, /** Disabled background color of buttons */ buttonBackgroundColorDisabled?: string, /** Border radius of buttons */ buttonBorderRadius?: number, /** Border width of buttons */ buttonBorderWidth?: number, /** Border color of buttons */ buttonBorderColor?: string, /** Pressed order radius of buttons */ buttonBorderColorPressed?: string, /** Disabled order radius of buttons */ buttonBorderColorDisabled?: string, /** (Android-only) Ripple color of buttons */ androidButtonRippleColor?: string, // backspace button styles /** Width of the BACKSPACE(⌫) button */ backspaceButtonWidth?: number, /** Height of the BACKSPACE(⌫) button */ backspaceButtonHeight?: number, /** Text size of the BACKSPACE(⌫) button */ backspaceButtonTextSize?: number, /** Text color of the BACKSPACE(⌫) button */ backspaceButtonTextColor?: string, /** Pressed text color of the BACKSPACE(⌫) button */ backspaceButtonTextColorPressed?: string, /** Disabled text color of the BACKSPACE(⌫) button */ backspaceButtonTextColorDisabled?: string, /** Background color of the BACKSPACE(⌫) button */ backspaceButtonBackgroundColor?: string, /** Pressed background color of the BACKSPACE(⌫) button */ backspaceButtonBackgroundColorPressed?: string, /** Disabled background color of the BACKSPACE(⌫) button */ backspaceButtonBackgroundColorDisabled?: string, /** Border radius of the BACKSPACE(⌫) button */ backspaceButtonBorderRadius?: number, /** Border width of the BACKSPACE(⌫) button */ backspaceButtonBorderWidth?: number, /** Border color of the BACKSPACE(⌫) button */ backspaceButtonBorderColor?: string, /** Pressed border color of the BACKSPACE(⌫) button */ backspaceButtonBorderColorPressed?: string, /** Disabled border color of the BACKSPACE(⌫) button */ backspaceButtonBorderColorDisabled?: string, /** (Android-only) Ripple color of the the BACKSPACE(⌫) button */ androidBackspaceButtonRippleColor?: string, /** Backspace text */ backspaceButtonText?: string, /** * Callback when PIN code changed * @param length length of current input */ onChanged?: (length: number) => void, } type PinSecretBearer = { /** The PinSecret retrieved from [[NumericPinCodeInputView.submit]] API */ pinSecret: number; /** To retain the pinSecret or not */ retain?: boolean; }; /** * PIN code input view Component with numeric inputs (0-9) */ class NumericPinCodeInputView extends React.Component { /** * Submit PIN code to SDK core and get PIN secret * * @returns A promise of PIN secret corresponding to current PIN code */ submit(): Promise /** * Submit PIN code to SDK core and get PIN secret(for multiple time) * * @returns A promise of PIN secret corresponding to current PIN code */ submitForMultiple(): Promise /** * Get input plain text * * @returns A promise of plain text */ submitPlain(): Promise /** * Reset current PIN code input */ clear(): void } /** * Push notification helper class provides definition of notification and helpers */ namespace PushNotification { export enum Type { /** Unknown type */ UNKNOWN = 0, /** Transaction push notification */ TRANSACTION = 1, } /** * Helper function to parse payload of Push notification * param payload The payload string from FCM, typically remoteMessage.getData().get("pinpoint.jsonBody") */ function parse(payload: string): PushNotification | TransactionNotification; } type PushNotification = { /** * Type of the notification */ type: number; } interface TransactionNotification extends PushNotification { /** Wallet ID */ walletID: number; /** Currency */ currency: number; /** Token address */ tokenAddress: string; /** Transaction direction */ direction: Wallets.Transaction.Direction; /** Transaction amount */ amount: string; /** Transaction fee */ fee: string; /** Transaction from address */ fromAddress: string; /** Transaction to address */ toAddress: string; /** Transaction timestamp */ timestamp: number; /** Transaction TXID */ txid: string; /** Transaction description */ description: string; } }