Using the SDK

In this Section, you will learn what are the functions provided by the SDK to integrate authentication, user management, and Movement transaction execution into your project.

Functions Overview

  1. signInWithGoogle: (network: MovementNetwork, apiKey: string, logEnabled?: boolean) => Promise<SignInWithGoogleReturn>

const signInWithGoogle: (network: MovementNetwork, apiKey: string, logEnabled?: boolean) => Promise<SignInWithGoogleReturn>

This function allows users to sign in with Google using OAuthProvider.

* @param {MovementNetwork} network - The network on which the transaction will be executed.
* @param {string} apiKey - Your API key generated from the {@link https://dashboard.lync.world|LYNC dashboard}.
* @param {boolean} [logEnabled=true] - Enable/disable logging. The default is true.

* @returns {object} SignInWithGoogleReturn - Returns an object with the success status and the user data or error message.

* @typedef {enum} MovementNetwork - { Mainnet = 1; Testnet = 2; Devnet = 3; }
* @typedef {object} SignInWithGoogleReturn - { success: true; user: ParsedUserData } | { success: false; message: string };
* @typedef {object} ParsedUserData - { email: string; avatar: string; name: string; accountAddress: string; providerId: string; id: string; privateKey: string; network: "Mainnet" | "Testnet" | "Devnet"; }

2. signOutUser: (logEnabled?: boolean) => Promise<SignOutUserReturn>

const signOutUser: (logEnabled?: boolean) => Promise<SignOutUserReturn>

This function is used to sign out a user from the application. It uses Firebase's signOut function to sign out the user.

3. getUserData: (email: string, network: MovementNetwork, apiKey: string, logEnabled?: boolean) => Promise<GetUserProfileReturn>

This function is used to get the user data from the server using the getUserProfile function.

4. movementTransaction: (args: MovementTransactionFuncArgs, apiKey: string, logEnabled?: boolean) => Promise<MovementTransactionReturn>

This function will initiate and execute a transaction on the specified Movement network and return an object containing a success status and transaction result or an error message.

Last updated