ribbit-wallet-connect
Version:
Next-generation multi-chain wallet and payments app that makes crypto simple, secure, and usable in daily life.
99 lines (98 loc) • 2.54 kB
TypeScript
import { EntryFunctionArgument, TypeTag } from "@aptos-labs/ts-sdk";
export type DappMetadata = {
name: string;
url: string;
description: string;
logo: string;
};
export type RibbitSession = {
sessionId: string;
expiresAt: number;
};
export type RawTxnRequest = {
sender: string;
sequenceNumber: number;
moduleAddress: string;
moduleName: string;
functionName: string;
typeArgs?: TypeTag[];
args: EntryFunctionArgument[];
maxGasAmount: number | string;
gasUnitPrice: number | string;
expirationTimestampSecs: number | string;
chainId: number;
};
export interface ConnectRequest {
sessionId?: string;
dapp: DappMetadata;
}
export interface ConnectResponse {
sessionId?: string;
approved: boolean;
accounts?: string[];
chainId?: number;
message?: string;
error?: string;
}
export interface SessionData {
sessionId: string;
active: boolean;
dapp?: DappMetadata;
}
export declare enum TransportMessageType {
PING = "PING",
SEND_TRANSACTION = "SEND_TRANSACTION",
GET_WALLET_ADDRESS = "GET_WALLET_ADDRESS",
GET_WALLET_BALANCE = "GET_WALLET_BALANCE",
CONNECT_REQUEST = "CONNECT_REQUEST",
DISCONNECT_REQUEST = "DISCONNECT_REQUEST",
SESSION_STATUS = "SESSION_STATUS",
SIGN_TRANSACTION = "SIGN_TRANSACTION",
SIGN_MESSAGE = "SIGN_MESSAGE"
}
export interface SignMessageRequest {
message: string;
nonce?: number;
chainId: number;
}
export interface SignMessageResponse {
approved: boolean;
signature?: string;
error?: string;
publicKey?: string;
address?: string;
}
export interface SignTransactionRequest {
}
export interface RawTransactionRequest {
rawTxn: string;
chainId: number;
/** Optional metadata for UI confirmation */
meta?: {
/** Human-readable description for confirmation */
description?: string;
/** Any extra data for UI display */
[key: string]: any;
};
}
export interface RawTransactionResponse {
approved: boolean;
txHash?: string;
error?: string;
result?: any;
}
export interface WalletBalanceRequest {
chainId: number;
resourceType: string;
decimals: number;
}
export interface Transport {
sendMessage(method: string, payload: any): Promise<any>;
listen(): void;
registerHandler(method: string, handler: MessageHandler): void;
}
export declare enum SupraChainId {
TESTNET = 6,
MAINNET = 8
}
export type MessageHandler = (payload: any) => Promise<any>;