-
Notifications
You must be signed in to change notification settings - Fork 38
/
window.ts
27 lines (24 loc) · 1.31 KB
/
window.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { type SolanaSignInInput, type SolanaSignInOutput } from '@solana/wallet-standard-features';
import type { PublicKey, SendOptions, Transaction, TransactionSignature, VersionedTransaction } from '@solana/web3.js';
export interface GhostEvent {
connect(...args: unknown[]): unknown;
disconnect(...args: unknown[]): unknown;
accountChanged(...args: unknown[]): unknown;
}
export interface GhostEventEmitter {
on<E extends keyof GhostEvent>(event: E, listener: GhostEvent[E], context?: any): void;
off<E extends keyof GhostEvent>(event: E, listener: GhostEvent[E], context?: any): void;
}
export interface Ghost extends GhostEventEmitter {
publicKey: PublicKey | null;
connect(options?: { onlyIfTrusted?: boolean }): Promise<{ publicKey: PublicKey }>;
disconnect(): Promise<void>;
signAndSendTransaction<T extends Transaction | VersionedTransaction>(
transaction: T,
options?: SendOptions
): Promise<{ signature: TransactionSignature }>;
signTransaction<T extends Transaction | VersionedTransaction>(transaction: T): Promise<T>;
signAllTransactions<T extends Transaction | VersionedTransaction>(transactions: T[]): Promise<T[]>;
signMessage(message: Uint8Array): Promise<{ signature: Uint8Array }>;
signIn(input?: SolanaSignInInput): Promise<SolanaSignInOutput>;
}