- Added new dependencies: @polkadot/util and @gear-js/api to package.json and example/package.json. - Implemented a test function in App component to interact with GearApi for balance transfer. - Updated transaction signing logic to support both raw and payload types. - Refactored Wallet class to improve socket connection handling and transaction management. - Enhanced WalletStore by removing unnecessary listener setup code.
35 lines
752 B
TypeScript
35 lines
752 B
TypeScript
import { default as WebAppConst } from "@twa-dev/sdk";
|
|
import type { InjectedWindow } from "@polkadot/extension-inject/types";
|
|
|
|
declare global {
|
|
interface Window extends InjectedWindow {}
|
|
}
|
|
|
|
export type WalletStorage = Storage;
|
|
|
|
export type WebApp = typeof WebAppConst;
|
|
export interface ConnectRequest {
|
|
method: 'connect';
|
|
callback: string;
|
|
}
|
|
|
|
export interface SignTransactionRequest {
|
|
method: 'sT';
|
|
id: number;
|
|
tx: `p:${string}` | `bytes:${string}`;
|
|
wallet?: string;
|
|
callback: string;
|
|
}
|
|
|
|
export interface ConnectResult {
|
|
success: boolean;
|
|
wallets?: string[];
|
|
error?: string;
|
|
}
|
|
|
|
export interface SignTransactionResult {
|
|
success: boolean;
|
|
id: number;
|
|
signedTx?: string;
|
|
error?: string;
|
|
} |