better-near-auth
Version:
Sign in with NEAR (SIWN) plugin for Better Auth
176 lines • 6.24 kB
TypeScript
import { z } from "zod";
import { type AccountId } from "near-kit/schemas";
import type { AccountState } from "near-kit";
export type { AccountId };
export interface NearAccount {
id: string;
userId: string;
accountId: string;
network: "mainnet" | "testnet";
publicKey: string;
isPrimary: boolean;
createdAt: Date;
}
export declare const socialImageSchema: z.ZodObject<{
url: z.ZodOptional<z.ZodString>;
ipfs_cid: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
export declare const profileSchema: z.ZodObject<{
name: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
image: z.ZodOptional<z.ZodObject<{
url: z.ZodOptional<z.ZodString>;
ipfs_cid: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
backgroundImage: z.ZodOptional<z.ZodObject<{
url: z.ZodOptional<z.ZodString>;
ipfs_cid: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
linktree: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
}, z.core.$strip>;
export type SocialImage = z.infer<typeof socialImageSchema>;
export type Profile = z.infer<typeof profileSchema>;
export declare const LinkAccountRequest: z.ZodObject<{
signedMessage: z.ZodObject<{
accountId: z.ZodString;
publicKey: z.ZodString;
signature: z.ZodString;
state: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
message: z.ZodString;
recipient: z.ZodString;
nonce: z.ZodString;
accountId: z.ZodString;
}, z.core.$strip>;
export declare const NonceRequest: z.ZodObject<{
accountId: z.ZodString;
networkId: z.ZodUnion<readonly [z.ZodLiteral<"mainnet">, z.ZodLiteral<"testnet">]>;
}, z.core.$strip>;
export declare const VerifyRequest: z.ZodObject<{
signedMessage: z.ZodObject<{
accountId: z.ZodString;
publicKey: z.ZodString;
signature: z.ZodString;
state: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
message: z.ZodString;
recipient: z.ZodString;
nonce: z.ZodString;
accountId: z.ZodString;
}, z.core.$strip>;
export declare const RelayRequest: z.ZodObject<{
payload: z.ZodString;
}, z.core.$strip>;
export type RelayRequestT = z.infer<typeof RelayRequest>;
export declare const RelayResponse: z.ZodObject<{
txHash: z.ZodString;
status: z.ZodEnum<{
pending: "pending";
completed: "completed";
failed: "failed";
}>;
}, z.core.$strip>;
export type RelayResponseT = z.infer<typeof RelayResponse>;
export declare const RelayStatusResponse: z.ZodObject<{
status: z.ZodEnum<{
pending: "pending";
completed: "completed";
failed: "failed";
}>;
gasUsed: z.ZodOptional<z.ZodString>;
outcome: z.ZodOptional<z.ZodUnknown>;
}, z.core.$strip>;
export type RelayStatusResponseT = z.infer<typeof RelayStatusResponse>;
export declare const ViewContractRequest: z.ZodObject<{
contractId: z.ZodString;
methodName: z.ZodString;
args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
}, z.core.$strip>;
export type ViewContractRequestT = z.infer<typeof ViewContractRequest>;
export declare const NonceResponse: z.ZodObject<{
nonce: z.ZodString;
}, z.core.$strip>;
export declare const VerifyResponse: z.ZodObject<{
token: z.ZodString;
success: z.ZodLiteral<true>;
user: z.ZodObject<{
id: z.ZodString;
accountId: z.ZodString;
network: z.ZodUnion<readonly [z.ZodLiteral<"mainnet">, z.ZodLiteral<"testnet">]>;
}, z.core.$strip>;
}, z.core.$strip>;
export declare const ProfileResponse: z.ZodNullable<z.ZodObject<{
name: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
image: z.ZodOptional<z.ZodObject<{
url: z.ZodOptional<z.ZodString>;
ipfs_cid: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
backgroundImage: z.ZodOptional<z.ZodObject<{
url: z.ZodOptional<z.ZodString>;
ipfs_cid: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
linktree: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
}, z.core.$strip>>;
export declare const ViewContractResponse: z.ZodObject<{
result: z.ZodUnknown;
}, z.core.$strip>;
export declare const ProfileRequest: z.ZodObject<{
accountId: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
export type ProfileRequestT = z.infer<typeof ProfileRequest>;
export type NonceRequestT = z.infer<typeof NonceRequest>;
export type NonceResponseT = z.infer<typeof NonceResponse>;
export type VerifyRequestT = z.infer<typeof VerifyRequest>;
export type VerifyResponseT = z.infer<typeof VerifyResponse>;
export type ProfileResponseT = z.infer<typeof ProfileResponse>;
export type ViewContractResponseT = z.infer<typeof ViewContractResponse>;
export declare const RelayedTransactionSchema: z.ZodObject<{
id: z.ZodString;
userId: z.ZodString;
txHash: z.ZodString;
senderId: z.ZodString;
receiverId: z.ZodString;
network: z.ZodString;
status: z.ZodString;
gasUsed: z.ZodOptional<z.ZodString>;
createdAt: z.ZodString;
updatedAt: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
export type RelayedTransactionT = z.infer<typeof RelayedTransactionSchema>;
export declare const RelayHistoryResponse: z.ZodObject<{
transactions: z.ZodArray<z.ZodObject<{
id: z.ZodString;
userId: z.ZodString;
txHash: z.ZodString;
senderId: z.ZodString;
receiverId: z.ZodString;
network: z.ZodString;
status: z.ZodString;
gasUsed: z.ZodOptional<z.ZodString>;
createdAt: z.ZodString;
updatedAt: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
}, z.core.$strip>;
export type RelayHistoryResponseT = z.infer<typeof RelayHistoryResponse>;
export interface RelayedTransactionRecord {
id: string;
userId: string;
txHash: string;
senderId: string;
receiverId: string;
network: "mainnet" | "testnet";
status: string;
gasUsed?: string;
createdAt: Date;
updatedAt: Date;
}
export interface RelayerInfo extends AccountState {
accountId: string;
mode: "ephemeral" | "explicit";
network: "mainnet" | "testnet";
hasKey: boolean;
createdAt?: Date;
lastUsedAt?: Date;
}
//# sourceMappingURL=types.d.ts.map