Source

types/UserTypes.ts


import { SplitSignature } from './OrderTypes';

/**
 * @description User data information
 * @typedef {Object} UserData
 * @property {string} ethAddress wallet address of user
 * @property {string} starkKey stark key of user
 * @property {number} createdAt The time that user is created with millidseconds
 */
export interface UserDataResponse {
  ethAddress: string;
  starkKey: string;
  createdAt?: number;
  emailNotifications?: SettingNotificationParam[];
  registerOnChainTxHash?: string,
  signature?: SplitSignature, 
}

/**
 * @description UserType
 * @typedef {string} UserType Enum (UserType.PARTNER / UserType.CUSTOMER)
 */

/**
 * @enum {UserType} Type of users onboarding to Myria system (PARTNER/CUSTOMER)
 * UserType.Partner : Track all of registered user come to Myria through Partner/Game Studios
 * UserType.Customer: Track all of user come to Myria directly on the Website
 */
export enum UserType {
  PARTNER = 'PARTNER',
  CUSTOMER = 'CUSTOMER'
}

/**
 * @description User data's response
 * @typedef {Object} RegisteredUserData
 * @property {string} walletAddress metamask's wallet address of user
 * @property {string} starkKey stark key of user
 * @property {codeInfo} codeInfo the information about the status of account 
 * (USER_REGISTERED / USER_NOT_REGISTERED / GET_USER_INFO_ERROR)
 */

export interface RegisteredUserData {
  walletAddress: string;
  starkKey: string;
  codeInfo: string;
}

export interface UserApiInput {
  ethAddress: string;
  starkKey: string;
  signature: SplitSignature;
  userType?: UserType;
  referrerId?: string
}
export interface UserAssetETH {
  amount: string;
  quantizedAmount: string;
  assetId: string;
  assetType: string;
  quantum: string;
}

export interface UserAssetERC20 {
  tokenName: string;
  tokenAddress: string;
  tokenSymbol: string;
  avatarUrl: string;
  amount: string;
  tokenType: string;
}

export interface UserWalletApi {
  wallet_id: string;
  signature: string;
  message: string;
  userType?: string;
  referrerId?: string;
}

/**
 * @description User Reference Last Evaluated Key
 * @typedef {Object} UserLastEvaluatedKey
 * @property {string} referrerId The project ID/ referrerID (starkKey) of referrer who introduced new users to onboard Myria
 * @property {string} ethAddress The wallet address of referrer
 */
export interface UserLastEvaluatedKey {
  referrerId: string;
  ethAddress: string;
}

/**
 * @enum {KeyNotification} Type of Key Config Email (ALL, SettlementRequest, DepositRequest, WithdrawalRequest, TransferRequest, MintRequest, FullWithdrawalRequest, FalseFullWithdrawalRequest, BulkTransferTransactionsResult, MultiTransactionRequest, RoyaltyTransferRequest, TokenBurnRequest )
 * KeyNotification.All: Config All option notification email
 * KeyNotification.SettlementRequest: Config SettlementRequest
 * KeyNotification.DepositRequest: Config DepositRequest
 * KeyNotification.WithdrawalRequest: Config WithdrawalRequest
 * KeyNotification.TransferRequest: Config TransferRequest
 * KeyNotification.MintRequest: Config MintRequest
 * KeyNotification.FullWithdrawalRequest: Config FullWithdrawalRequest
 * KeyNotification.FalseFullWithdrawalRequest: Config FalseFullWithdrawalRequest
 * KeyNotification.BulkTransferTransactionsResult: Config BulkTransferTransactionsResult
 * KeyNotification.MultiTransactionRequest: Config MultiTransactionRequest
 * KeyNotification.RoyaltyTransferRequest: Config RoyaltyTransferRequest
 * KeyNotification.TokenBurnRequest: Config TokenBurnRequest
 */

export enum KeyNotification {
  All = "ALL",
  SettlementRequest = "SettlementRequest",
  DepositRequest = "DepositRequest",
  WithdrawalRequest = "WithdrawalRequest",
  TransferRequest = "TransferRequest",
  MintRequest = "MintRequest",
  FullWithdrawalRequest = "FullWithdrawalRequest",
  FalseFullWithdrawalRequest = "FalseFullWithdrawalRequest",
  BulkTransferTransactionsResult = "BulkTransferTransactionsResult",
  MultiTransactionRequest = "MultiTransactionRequest",
  RoyaltyTransferRequest = "RoyaltyTransferRequest",
  TokenBurnRequest = "TokenBurnRequest",
}

/**
 * @description Email notification config param
 * @typedef {Object} SettingNotificationConfigParam
 * @property {KeyNotification} key Key config notification email
 * @property {boolean} value value of key notification email
 */

export interface SettingNotificationParam {
  key: KeyNotification;
  value: boolean;
}

/**
 * @description Email notification information of user
 * @typedef {Object} SettingNotificationResponse
 * @property {SettingNotificationParam[]} emailNotifications Array information config email notification of user after trigger
 */

export interface SettingNotificationResponse {
  emailNotifications: SettingNotificationParam[]
}