Skip to content

Commit

Permalink
rename.
Browse files Browse the repository at this point in the history
  • Loading branch information
b4rtaz committed Nov 22, 2022
1 parent 3428b5f commit 2d93d2e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
13 changes: 5 additions & 8 deletions packages/auth/src/Auth.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { ApiModule, Core, CoreProvider, ResponseAdapter } from '@moralisweb3/common-core';
import { ApiModule, Core, CoreProvider } from '@moralisweb3/common-core';
import { makeRequestMessage, RequestMessageOptions } from './methods/requestMessage';
import { makeVerify, VerifyEvmOptions, VerifyOptions, VerifySolOptions } from './methods/verify';
import { VerifyChallengeEvmJSONResponse, VerifyChallengeEvmResponse } from './operations/evm';
import { VerifyChallengeSolanaJSONResponse, VerifyChallengeSolanaResponse } from './operations/solana';
import { VerifyChallengeEvmResponseAdapter } from './operations/evm';
import { VerifyChallengeSolanaResponseAdapter } from './operations/solana';

export const BASE_URL = 'https://authapi.moralis.io';

type VerifyEvmResponse = Promise<ResponseAdapter<VerifyChallengeEvmResponse, VerifyChallengeEvmJSONResponse>>;
type VerifySolanaResponse = Promise<ResponseAdapter<VerifyChallengeSolanaResponse, VerifyChallengeSolanaJSONResponse>>;

export class Auth extends ApiModule {
public static readonly moduleName = 'auth';

Expand All @@ -31,8 +28,8 @@ export class Auth extends ApiModule {
public requestMessage = (options: RequestMessageOptions) => makeRequestMessage(this.core)(options);

// Function overloading to make typescript happy
public verify(options: VerifyEvmOptions): VerifyEvmResponse;
public verify(options: VerifySolOptions): VerifySolanaResponse;
public verify(options: VerifyEvmOptions): Promise<VerifyChallengeEvmResponseAdapter>;
public verify(options: VerifySolOptions): Promise<VerifyChallengeSolanaResponseAdapter>;
public verify(options: VerifyOptions) {
return makeVerify(this.core)(options);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Core, Camelize, Operation, DateInput } from '@moralisweb3/common-core';
import { Core, Camelize, Operation, DateInput, ResponseAdapter } from '@moralisweb3/common-core';
import { EvmAddress, EvmAddressish, EvmChainish, EvmChainResolver } from '@moralisweb3/common-evm-utils';
import { operations } from '../../generated/types';

Expand All @@ -25,6 +25,9 @@ export type RequestChallengeEvmJSONResponse = SuccessResponse;

export type RequestChallengeEvmResponse = ReturnType<typeof deserializeResponse>;

export interface RequestChallengeEvmResponseAdapter
extends ResponseAdapter<RequestChallengeEvmResponse, RequestChallengeEvmJSONResponse> {}

export const requestChallengeEvmOperation: Operation<
RequestChallengeEvmRequest,
RequestChallengeEvmJSONRequest,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Camelize, maybe, Operation } from '@moralisweb3/common-core';
import { Camelize, maybe, Operation, ResponseAdapter } from '@moralisweb3/common-core';
import { EvmAddress, EvmChain } from '@moralisweb3/common-evm-utils';
import { operations } from '../../generated/types';

Expand All @@ -19,6 +19,9 @@ export type VerifyChallengeEvmJSONResponse = SuccessResponse;

export type VerifyChallengeEvmResponse = ReturnType<typeof deserializeResponse>;

export interface VerifyChallengeEvmResponseAdapter
extends ResponseAdapter<VerifyChallengeEvmResponse, VerifyChallengeEvmJSONResponse> {}

export const verifyChallengeEvmOperation: Operation<
VerifyChallengeEvmRequest,
VerifyChallengeEvmJSONRequest,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Camelize, Operation, DateInput } from '@moralisweb3/common-core';
import { Camelize, Operation, DateInput, ResponseAdapter } from '@moralisweb3/common-core';
import { SolAddress, SolAddressish, SolNetwork, SolNetworkish } from '@moralisweb3/common-sol-utils';
import { operations } from '../../generated/types';

Expand All @@ -25,6 +25,9 @@ export type RequestChallengeSolanaJSONResponse = SuccessResponse;

export type RequestChallengeSolanaResponse = ReturnType<typeof deserializeResponse>;

export interface RequestChallengeSolanaResponseAdapter
extends ResponseAdapter<RequestChallengeSolanaResponse, RequestChallengeSolanaJSONResponse> {}

export const requestChallengeSolanaOperation: Operation<
RequestChallengeSolanaRequest,
RequestChallengeSolanaJSONRequest,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Camelize, maybe, Operation } from '@moralisweb3/common-core';
import { Camelize, maybe, Operation, ResponseAdapter } from '@moralisweb3/common-core';
import { SolAddress, SolNetwork } from '@moralisweb3/common-sol-utils';
import { operations } from '../../generated/types';

Expand All @@ -19,6 +19,9 @@ export type VerifyChallengeSolanaJSONResponse = SuccessResponse;

export type VerifyChallengeSolanaResponse = ReturnType<typeof deserializeResponse>;

export interface VerifyChallengeSolanaResponseAdapter
extends ResponseAdapter<VerifyChallengeSolanaResponse, VerifyChallengeSolanaJSONResponse> {}

export const verifyChallengeSolanaOperation: Operation<
VerifyChallengeSolanaRequest,
VerifyChallengeSolanaJSONRequest,
Expand Down

0 comments on commit 2d93d2e

Please sign in to comment.