npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cadawada-client

v0.0.21

Published

Cadawada Javascript Client

Readme

Account Module

Account Model Description


class Account { 
    /**
    * Allows users to signup to Cadawada by inputing a some information about themselves such as their business name, first and last name, email address, phone number and a password
     **/ 
    static async initiateOnboarding(body: InitiateOnboadingPayloadType): Promise<InitiateOnboardingResponseType>

    /**
   * Get the Users account details from the backend
   **/
    static getAccount(): UserProfileType

    /**
   *  Authorize a User credential and store the auth token for the session
   **/
    static async login(auth: UserIdentityType & { password: string }): Promise<LoginType>

    /**
   *  Update a user credential
   */
    static async updateOnboarding(body: UserIdentityType): Promise<InitiateOnboardingResponseType>

    /**
   *  Verify a users Phone Number using the Otp sent to the users phone during registration
   */
    static async verifyPhoneNumber(body: { otpCode: string }): Promise<any>    

   /**
   *  Verify a users Email using the Otp sent to the users email address during registration
   */
    static async verifyEmailAddress(body: { otpCode: string }): Promise<any>
}

Account Interface Description

interface InitiateOnboadingPayloadType {
  countryCode: string;
  emailAddress: string;
  firstName: string;
  lastName: string;
  accountType: ACCOUNT_TYPE;
  phoneNumber: string;
  businessName?: string;
  password: string;
}

type ACCOUNT_TYPE = "Business" | "Personal";

interface InitiateOnboardingResponseType extends UserProfileType {
  role: AccountRoleType;
  token: AuthTokenType;
}

type AccountRoleType = {
    id: number;
    name: string;
}

type AuthTokenType = {
    accessToken: string;
    expiresIn: number;
    refreshToken: string;
}

type UserProfileType = {
    user: UserType;
    account: AccountType;
    country: CountryType;
    currency: CurrencyType;
}

interface UserType {
  status: string;
  dateOfBirth?: string;
  firstName: string;
  lastName: string;
  selfie?: string;
}

type CountryType = {
    imageUrl: string,
    id: number,
    shortCode: string,
    name: string,
    diallingCode: string
}

type CurrencyType = {
    id: number,
    name: string,
    code: string
    countryCode: string
    countryId: string
    countryImageUrl: string
    countryName: string
    currencyIconUrl: null
}


type LoginType = {
    login: {
        user: UserProfileType
        account: AccountType
        token: AuthTokenType
        country: CountryType
        currency: CurrencyType
        pendingOnboarding: any
        pendingKyc: any
    }
}

type UserProfileType = {
  user: UserType;
  account: AccountType;
  country: CountryType;
  currency: CurrencyType;
};

 type AuthTokenType = {
    accessToken: string
    expiresIn: number,
    refreshToken: string
}

interface UserIdentityType {
  countryCode?: string;
  userIdentity: string;
}

AuthService Module

AuthService Model Description

class AuthService { 

    /**
     * the below properties are the static properties 
     * of Auth service Class 
    */
    private static phoneNumber: string
    private static diallingCode: string
    private static authToken: Partial<AuthTokenType> = {}
    private static userIdentity: UserIdentityType
    private static password: string
    private static environment: AuthEnvironmentType = 'production'
    private static isAuthorized: boolean = false;
    private static clientCredential: Partial<Record<AuthEnvironmentType, ClientCredentialType>> | ClientCredentialType = {}

    static setAuth(auth: CadawadaAuthType): void

    /**
     * Set the credentials that will be used by request to 
     * Authorize this users api call.
     * Should be called first to register the sessions Auth credentials
     * Any api transaction before this call will always fail
     */
    static setAuth(auth: CadawadaAuthType): void    


    /**
     * Stores the users auth token passed to it in session 
     */
    static setToken(token: AuthTokenType): void

    /**
     * Gets the users auth token stored in session 
     */ 
    static getToken(): Partial<AuthTokenType>

    /***
     * Gets the environment in which cadawada is running on whether
     * its development, staging or production 
     */
    static getEnvironment(): AuthEnvironmentType

    /**
     *  Gets the optional parameter of Type AuthEnvironmentType
     *  and returns the client id
    */
    static getClientId(env?: AuthEnvironmentType | undefined): any

    /**
     *  Gets the optional parameter of Type AuthEnvironmentType
     *  and returns the client Api key
    */
    static getClientApiKey(env?: AuthEnvironmentType | undefined): any
}

AuthService Interface Description

type AuthEnvironmentType = "production" | "development" | "staging";

type ClientCredentialType = {
  clientId: string;
  clientApiKey: string;
};

interface CadawadaAuthType {
  userIdentity?: UserIdentityType;
  password?: string;
  accessToken?: string;
  refreshToken?: string;
  environment?: AuthEnvironmentType;
  clientCredential?:
    | Partial<Record<AuthEnvironmentType, ClientCredentialType>>
    | ClientCredentialType;
}

type AuthTokenType = {
  accessToken: string;
  expiresIn: number;
  refreshToken: string;
};

type LoginType = {
  login: {
    user: UserProfileType;
    account: AccountType;
    token: AuthTokenType;
    country: CountryType;
    currency: CurrencyType;
    pendingOnboarding: any;
    pendingKyc: any;
  };
};

Currency Module

Currency Model description


class Currency {
  /**
   * Get and return the list of currencies from server.
  */
  static async getCurrencies({ environment }: RequestPayloadType = {}): Promise<CadawadaResponseType<CurrencyType[]>>

  /**
   * Get and return the exchange rate of currencies from server.
  */
  static getExchangeRate({amount = 1, ...others}: {
    sourceCurrencyCode: string;
    destinationCurrencyCode: string;
    amount?: number;
  }): 

}

Currency Interface Description


type ExchangeRateType = {
    destinationCurrencyCode: string
    exchangeRate: number
    sourceCurrencyCode: string
    transferCharges:number
    sourceAmount:number
    destinationAmount:number
}

type CurrencyType = {
    id: number,
    name: string,
    code: string
    countryCode: string
    countryId: string
    countryImageUrl: string
    countryName: string
    currencyIconUrl: null
}

type RequestPayloadType<T = unknown> = {environment?: AuthEnvironmentType} & T  

Platform Module

Platform Model description


class Platform {
  /**
   * Get and return the list of currencies from server.
  */
  static async getCurrencies({ environment }: RequestPayloadType = {}): Promise<CadawadaResponseType<CurrencyType[]>>

  /**
   * send otp to a users phone number for verification
  */
  static async sendOtp(body: Partial<UserIdentityType> & { destination: UserIdentityNameType }): Promise<CadawadaResponseType<{countDown: number}>>

}

Platform Interface Description


interface UserIdentityType {
  countryCode?: string;
  userIdentity: string;
}


type UserIdentityNameType = "PhoneNumber" | "Email";

type CountryType = {
    imageUrl: string,
    id: number,
    shortCode: string,
    name: string,
    diallingCode: string
}

type RequestPayloadType<T = unknown> = {environment?: AuthEnvironmentType} & T  

CadawadaRequest Module

CadawadaRequest Model description


class CadawadaRequest {
  /**
   * Get and return the list of currencies from server.
  */
  static async request<T = any>(req: CadawadaRequestType): Promise<CadawadaResponseType<T>>
}

CadawadaRequest Interface Description


type RequestPayloadType<T = unknown> = {environment?: AuthEnvironmentType} & T  

type AuthEnvironmentType = "production" | "development" | "staging";

Payment Module

Payment Model description


class Payment {
  /**
   * Get and return the list of countries that money can be transfered to.
  */
 static getTransferCountries(): Promise<CadawadaResponseType<TransferCountriesType>>
}

Payment Interface Description

type TransferCountriesType = {
    sourceCountries: Array<{
        country: CountryType
        currency: CurrencyType
        lowerTransferLimit: number

    }>
    destinationCountries: Array<{
        country: CountryType
        currency: CurrencyType
        lowerTransferLimit: number
    }>
}

Transfer Module

Transfer Model description


class Transfer {
  /*
   * Gets the different currencies that can be transfered to a particular country
  */
  static getCurrencyCatalog(): Promise<CadawadaResponseType<TransferCountryCurrencyCatalogType>>

  /*
   * Gets the different currencies that can be transfered to a particular country
  */
  static getTransferTypes(countryCode: string): Promise<CadawadaResponseType<TransferBeneficiaryType[]>>

  /**
   * 
   */
  static getBeneficiaryTransferForm({ beneficiaryTypeId, countryCode, currencyCode }: TransferBeneficiaryFormProps): Promise<CadawadaResponseType<TransferBeneficiaryFormType>>
 
  /*
  * 
  */
  static validateBeneficiary(body: any): Promise<CadawadaResponseType<TransferBeneficiaryFormType>>

  static validateBeneficiaryManual(body: any): Promise<CadawadaResponseType<TransferBeneficiaryFormType>>

}

Transfer Interface Description

type TransferCurrencyType = {
    currency: CurrencyType,
    transferLimit: {
        localLowerLimit: number,
        internationalLowerLimit: number
    }
}

type TransferCountryCurrencyCatalogType = {
    source: {
        country: CountryType
        currencies: Array<TransferCurrencyType>
    }
    destinations: Array<{
        country: CountryType
        currencies: Array<TransferCurrencyType>
    }>
}

type TransferBeneficiaryType = {
    name: string
    id: number
}

type TransferBeneficiaryFormProps = {
    beneficiaryTypeId: string, 
    countryCode: string,
    currencyCode: string
}

type TransferBeneficiaryFormType = {
    form: FormType[]
    beneficiaryType: TransferBeneficiaryType
    countryCode: string
    currencyCode: string
    transactionRoute: "Local" | "International"
}