Class ETOPaySdk

Main object that contains all the functionality for interfacing with the ETOPaySdk.

Constructors

  • Create a new instance of the ETOPaySdk

    Returns ETOPaySdk

    a new ETOPaySdk instance.

Methods

  • Confirm the purchase for the given purchase ID.

    Parameters

    • pin: string

      The pin for confirmation of purchase

    • purchase_id: string

      The purchase id to confirm.

    Returns Promise<void>

  • Creates a payment contract for depositing money in wallet using viviswap [EURO --> Crypto]

    Parameters

    • pin: string

      The wallet pin

    Returns Promise<ViviswapDeposit>

    The details of the added payment contract

  • Creates a payment detail for the wallet crypto address in viviswap

    Parameters

    • pin: string

      The wallet pin

    Returns Promise<ViviswapAddressDetail>

    The details of the added payment detail

  • Creates a new user for the SDK.

    Parameters

    • username: string

      The input string representing the username.

    Returns Promise<void>

  • Creates a new random wallet and returns the mnemonic.

    Parameters

    • pin: string

      The input string representing the pin.

    Returns Promise<string>

  • Creates a purchase request for buying an artefact

    Parameters

    • receiver: string

      The receiver of the purchase request.

    • amount: number

      The amount of the purchase.

    • product_hash: string

      The hash of the underlying product/artefact

    • app_data: string

      The app data for the purchase. This is application specific string or stringified object data.

    • purchase_type: string

      The type of the purchase. Either a COMPLIMENT or a PURCHASE

    Returns Promise<string>

    The purchase id of the created purchase request as string

  • Creates a wallet backup.

    Parameters

    • pin: string

      The input string representing the pin.

    • backup_password: string

      Password used to create the backup.

    Returns Promise<Uint8Array<ArrayBuffer>>

  • Creates a wallet from a backup.

    Parameters

    • pin: string

      The input string representing the pin.

    • backup: Uint8Array<ArrayBuffer>

      The bytes of the backup file.

    • backup_password: string

      Password used to create the backup.

    Returns Promise<void>

  • Initializes a wallet from an existing mnemonic.

    Parameters

    • pin: string

      The input string representing the pin.

    • mnemonic: string

      The input string representing the mnemonic

    Returns Promise<void>

  • Creates a payment contract for withdrawing money from wallet using viviswap [Crypto --> EUR] and if the pin is provided automatically triggers a withdrawal

    Parameters

    • amount: number

      The amount to withdraw from the wallet

    • Optional pin: string

      The pin for verification. Optional.

    • Optional data: Uint8Array<ArrayBuffer>

      The associated data with the transaction. Optional.

    Returns Promise<ViviswapWithdrawal>

    The details of the created payment contract

  • Deletes the user in etopay. Hazmat!

    Parameters

    • Optional pin: string

      The wallet pin for confirmation. Optional in case there is an active wallet.

    Returns Promise<void>

  • Deletes and existing wallet.

    Parameters

    • pin: string

      The input string representing the pin.

    Returns Promise<void>

  • Returns void

  • Generate a new receiver address based on selected network in the config.

    Parameters

    • pin: string

      The input string representing the pin.

    Returns Promise<string>

    The receiver wallet address as string

  • Get sdk build information.

    Returns string

    The sdk build information as a string.

  • Gets the current exchange rate for the cryptocurrency to EURO

    Returns Promise<number>

    The exchange rate as a floating point number

  • Fetches the KYC details for the postident provider

    Returns Promise<CaseDetailsResponse>

    The case details

    Remarks

    This method is only available if the SDK is compiled with support for postident.

  • Fetches the KYC details for a user by the viviswap onboarding process

    Returns Promise<ViviswapKycStatus>

    The KYC details

  • Fetch available networks.

    Returns Promise<Network[]>

    Sdk networks

  • Get the preferred network.

    Returns Promise<string>

    The id of preferred network id, or undefined if none exists.

  • Fetches the purchase details from the given purchase ID.

    Parameters

    • purchase_id: string

      The purchase id to query to details.

    Returns Promise<PurchaseDetails>

    The purchase details

  • Get the recovery share.

    Returns Promise<string>

    The recovery share as a string, or undefined if none exists.

  • Gets the detail of a particular swap(deposit or withdrawal) created at viviswap based on the given order id.

    Parameters

    • order_id: string

      The amount to withdraw from the wallet

    Returns Promise<Order>

    The details of the created order

  • Gets the detailed lists of swaps (deposit and withdrawal) created at viviswap

    Parameters

    • start: number

      The start page

    • limit: number

      The limit per page

    Returns Promise<OrderList>

    The list of created orders

  • Gets the detailed lists of purchases (COMPLIMENTS and PURCHASES)

    Parameters

    • start: number

      The start page

    • limit: number

      The limit per page

    Returns Promise<TxList>

    The details of the created purchases

  • Get the open AMLA KYC questions

    Returns Promise<OpenAmlaQuestions>

    A list of the currently open AMLA questions.

  • Get the currently open/missing documents for KYC

    Returns Promise<OpenDocuments>

    A list of the currently open documents.

  • Fetches the current balance of the base crypto network on the wallet

    Parameters

    • pin: string

      The input string representing the pin.

    Returns Promise<number>

    The current balance as a double precision floating point number

  • Gets the details of a specific wallet transaction

    Parameters

    • pin: string

      The wallet pin

    • tx_id: string

      The ID of the transaction to get details for.

    Returns Promise<WalletTxInfo>

    The details of the wallet transaction as a serialized JSON string.

  • Gets the detailed lists of wallet transactions

    Parameters

    • pin: string

      The wallet pin

    • start: number

      The start page

    • limit: number

      The limit per page

    Returns Promise<WalletTxInfoList>

    The list of wallet transactions

  • Initializes the etopay logger

    Parameters

    • level: Level

      The log level.

    Returns void

  • Initializes an existing user in the SDK

    Parameters

    • username: string

      The input string representing the username.

    Returns Promise<void>

  • Fetches the kyc verification status for the user

    Parameters

    • username: string

      The input string representing the username.

    Returns Promise<boolean>

    The kyc verification status as a boolean value

  • Check if the password to use for wallet operations is set. Use setWalletPassword to set a new or change an existing password.

    Returns Promise<boolean>

  • Refreshes the access token for the user in the SDK.

    Parameters

    • access_token: string

      The input string representing the access token.

    Returns Promise<void>

  • Change the pin used to encrypt the wallet password

    Parameters

    • pin: string

      The old pin

    • new_pin: string

      The new pin to be set for the wallet

    Returns Promise<void>

  • Sends the given amount to the given address

    Parameters

    • pin: string

      The pin for verification

    • address: string

      The address of the receiver

    • amount: number

      The amount to send in the selected currency

    • Optional data: Uint8Array<ArrayBuffer>

      The data associated with the transaction. Optional.

    Returns Promise<string>

    the transaction id.

  • Set the configuration as a JSON-encoded string.

    Parameters

    • config: string

      The input string representing the configuration.

    Returns Promise<void>

    Example

    {
    "auth_provider": "<authentication provider name>",
    "backend_url": "<valid URL to the backend API>",
    "storage_path": "/path/to/valid/folder",
    "log_level": "info",
    }
  • Selects the network for the ETOPay SDK.

    Parameters

    • network_key: string

    Returns Promise<void>

  • Set the preferred network.

    Parameters

    • Optional network: string

      the id of the network, or null to reset it.

    Returns Promise<void>

  • Set the recovery share.

    Parameters

    • share: string

      The recovery share to set.

    Returns Promise<void>

  • Set the answer to an open AMLA KYC question

    Parameters

    • question_id: string

      The ID of the question to set the answer to.

    • answers: string[]

      a list of the selected available answers for the question.

    • Optional freetext_answer: string

      an optional free-text answer.

    Returns Promise<void>

  • Set / upload an open KYC document

    Parameters

    • document_id: string

      The ID of the document to upload.

    • expiration_date: string

      the expiration date of this document.

    • document_number: string

      the official document number.

    • Optional front_image_data: Uint8Array<ArrayBuffer>

      the image data of the front side of the document.

    • Optional front_image_filename: string

      the filename (including extension) of the front side of the document.

    • Optional back_image_data: Uint8Array<ArrayBuffer>

      the image data of the back side of the document. Leave empty for not specifying a back side image.

    • Optional back_image_filename: string

      the filename (including extension) of the back side of the document. Leave empty for not specifying a back side image.

    Returns Promise<void>

  • Set Viviswap KYC identity details

    Parameters

    • official_document_type: OfficialDocumentType

      The type of the official document.

    • expiration_date: string

      The expiration date of the official document.

    • document_number: string

      The number of the official document.

    • official_document_front_image_data: Uint8Array<ArrayBuffer>

      The data of the image of the front of the official document.

    • official_document_front_image_filename: string

      The filename (including extension) of the image of the front of the official document.

    • official_document_back_image_data: Uint8Array<ArrayBuffer>

      The data of the image of the back of the official document. Leave as empty string to no provide a back image.

    • official_document_back_image_filename: string

      The filename (including extension) of the image of the back of the official document. Leave as empty string to no provide a back image.

    • personal_video_data: Uint8Array<ArrayBuffer>

      The data of the 30 second personal video recording.

    • personal_video_filename: string

      The filename (including extenstion) of the 30 second personal video recording.

    Returns Promise<void>

  • Set Viviswap KYC residence details

    Parameters

    • country_code: string

      User country code

    • region: string

      User region

    • zip_code: string

      User zip code

    • city: string

      User city

    • address_line_1: string

      User address line 1

    • address_line_2: string

      User address line 2

    • is_public_entry: boolean

      Inidcates that a valid public entry of this clients address can be found.

    • public_entry_reference: string

      if is_public_entry is true, then this must contain the resource link.

    • has_no_official_document: boolean

      indicates if the client does not have any document verifying their address.

    • Optional official_document_image_data: Uint8Array<ArrayBuffer>

      if has_no_official_document is false, then this must contain the bytes of the document file that verifies that this person is currently living at the address.

    • Optional official_document_image_filename: string

      the filename (including extension) of the document.

    Returns Promise<void>

  • Set the password to use for wallet operations. If the password was already set, this changes it.

    Parameters

    • pin: string

      The pin used to encrypt the password

    • new_password: string

      The password to set for the wallet

    Returns Promise<void>

  • Initialize the KYC process for Postident

    Returns Promise<NewCaseIdResponse>

    The ID of the new Postident KYC case.

    Remarks

    This method is only available if the SDK is compiled with support for postident.

  • Starts the KYC verification process for viviswap

    Parameters

    • mail: string

      The email address of the user as a string.

    • terms_accepted: boolean

      The terms of conditions accepted flag for the user as a boolean

    Returns Promise<NewViviswapUser>

    The new viviswap user

  • Submits the partial KYC details for the viviswap onboarding process

    Returns Promise<void>

  • Updates the IBAN of the user

    Parameters

    • pin: string

      The pin for verification

    • address: string

      The IBAN number to be updated

    Returns Promise<ViviswapAddressDetail>

    The details of the added IBAN

  • Updates the partial KYC details for the viviswap onboarding process

    Parameters

    • is_individual: boolean

      Flag indicating if the user is an individual.

    • is_pep: boolean

      Flag indicating if the user is a politically exposed person.

    • is_us_citizen: boolean

      Flag indicating if the user is a US citizen.

    • is_regulatory_disclosure: boolean

      Flag indicating if the user has made a regulatory disclosure.

    • country_of_residence: string

      The country of residence of the user.

    • nationality: string

      The nationality of the user.

    • full_name: string

      The full name of the user.

    • date_of_birth: string

      The date of birth of the user.

    Returns Promise<ViviswapPartiallyKycDetails>

    The KYC updated details

  • Triggers the backend to update the KYC status in the postident KYC provider

    Parameters

    • case_id: string

      The input string representing the case_id to be updated

    Returns Promise<void>

    Remarks

    This method is only available if the SDK is compiled with support for postident.

  • Verify if the provided mnemonic is the one stored in the wallet.

    Parameters

    • pin: string

      The input string representing the pin.

    • mnemonic: string

      The input string representing the mnemonic.

    Returns Promise<boolean>

    • whether the mnemonics are the same or not.
  • Verifies the pin for the wallet

    Parameters

    • pin: string

      The pin to be verified

    Returns Promise<void>