87 lines
2.7 KiB
TypeScript
87 lines
2.7 KiB
TypeScript
|
|
import { WalletConnectModal } from '@walletconnect/modal';
|
||
|
|
import { SignClient } from '@walletconnect/sign-client';
|
||
|
|
import { ModuleInterface, ModuleType, WalletNetwork } from '../types';
|
||
|
|
export interface IParsedWalletConnectSession {
|
||
|
|
id: string;
|
||
|
|
name: string;
|
||
|
|
description: string;
|
||
|
|
url: string;
|
||
|
|
icons: string;
|
||
|
|
accounts: Array<{
|
||
|
|
network: 'pubnet' | 'testnet';
|
||
|
|
publicKey: string;
|
||
|
|
}>;
|
||
|
|
}
|
||
|
|
export declare const WALLET_CONNECT_ID = "wallet_connect";
|
||
|
|
export declare class WalletConnectModule implements ModuleInterface {
|
||
|
|
wcParams: IWalletConnectConstructorParams;
|
||
|
|
moduleType: ModuleType;
|
||
|
|
productId: string;
|
||
|
|
productName: string;
|
||
|
|
productUrl: string;
|
||
|
|
productIcon: string;
|
||
|
|
private client?;
|
||
|
|
private activeSession?;
|
||
|
|
private qrModal;
|
||
|
|
isAvailable(): Promise<boolean>;
|
||
|
|
constructor(wcParams: IWalletConnectConstructorParams);
|
||
|
|
getAddress(): Promise<{
|
||
|
|
address: string;
|
||
|
|
}>;
|
||
|
|
signTransaction(xdr: string, opts?: {
|
||
|
|
networkPassphrase?: string;
|
||
|
|
address?: string;
|
||
|
|
path?: string;
|
||
|
|
submit?: boolean;
|
||
|
|
submitUrl?: string;
|
||
|
|
}): Promise<{
|
||
|
|
signedTxXdr: string;
|
||
|
|
signerAddress?: string;
|
||
|
|
}>;
|
||
|
|
signAuthEntry(): Promise<{
|
||
|
|
signedAuthEntry: string;
|
||
|
|
signerAddress?: string;
|
||
|
|
}>;
|
||
|
|
signMessage(): Promise<{
|
||
|
|
signedMessage: string;
|
||
|
|
signerAddress?: string;
|
||
|
|
}>;
|
||
|
|
getNetwork(): Promise<{
|
||
|
|
network: string;
|
||
|
|
networkPassphrase: string;
|
||
|
|
}>;
|
||
|
|
/**
|
||
|
|
* Allows manually setting the current active session to be used in the kit when doing WalletConnect requests
|
||
|
|
*
|
||
|
|
* @param sessionId The session ID is a placeholder for the session "topic", term used in WalletConnect
|
||
|
|
* */
|
||
|
|
setSession(sessionId: string): void;
|
||
|
|
onSessionDeleted(cb: (sessionId: string) => void): void;
|
||
|
|
connectWalletConnect(): Promise<IParsedWalletConnectSession>;
|
||
|
|
disconnect(): Promise<void>;
|
||
|
|
closeSession(sessionId: string, reason?: string): Promise<void>;
|
||
|
|
getSessions(): Promise<IParsedWalletConnectSession[]>;
|
||
|
|
private getTargetSession;
|
||
|
|
}
|
||
|
|
export interface IWalletConnectConstructorParams {
|
||
|
|
projectId: string;
|
||
|
|
name: string;
|
||
|
|
description: string;
|
||
|
|
url: string;
|
||
|
|
icons: string[];
|
||
|
|
method: WalletConnectAllowedMethods;
|
||
|
|
network: WalletNetwork;
|
||
|
|
sessionId?: string;
|
||
|
|
client?: typeof SignClient;
|
||
|
|
modal?: WalletConnectModal;
|
||
|
|
onSessionDeleted?: (sessionId: string) => void;
|
||
|
|
}
|
||
|
|
export declare enum WalletConnectTargetChain {
|
||
|
|
PUBLIC = "stellar:pubnet",
|
||
|
|
TESTNET = "stellar:testnet"
|
||
|
|
}
|
||
|
|
export declare enum WalletConnectAllowedMethods {
|
||
|
|
SIGN = "stellar_signXDR",
|
||
|
|
SIGN_AND_SUBMIT = "stellar_signAndSubmitXDR"
|
||
|
|
}
|
||
|
|
//# sourceMappingURL=walletconnect.module.d.ts.map
|