UNPKG

client-aftermath-ts-sdk

Version:
66 lines (65 loc) 2.81 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.UserData = void 0; const caller_1 = require("../../general/utils/caller"); class UserData extends caller_1.Caller { // ========================================================================= // Constructor // ========================================================================= constructor(config) { super(config, "user-data"); } // ========================================================================= // API // ========================================================================= /** * Fetches the API for users public key. * @async * @param { SuiAddress } inputs - An object containing the walletAddress. * @returns { Promise<string | undefined> } A promise that resolves users public key. */ getUserPublicKey(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.fetchApi(`public-key`, inputs); }); } /** * Fetches the API to create users public key. * @async * @param { ApiUserDataCreateUserBody } inputs - The inputs for creating users public key on BE side. * @returns { Promise<boolean> } A promise that resolves to result if user pk has been created. */ createUserPublicKey(inputs) { return __awaiter(this, void 0, void 0, function* () { return this.fetchApi(`save-public-key`, inputs); }); } /** * Fetches the API for user create message to sign. * @returns { string } message to sign with action related to the service you interact with. */ createUserAccountMessageToSign() { return { action: `CREATE_USER_ACCOUNT`, }; } /** * Fetches the API for creating sign and terms message to sign. * @returns { string } message to sign with action related to the service you interact with. */ createSignTermsAndConditionsMessageToSign() { return { action: `SIGN_TERMS_AND_CONDITIONS`, }; } } exports.UserData = UserData;