Initialize TypeScript library for Telegram Web App wallet integration
- Added configuration files: .eslintrc.js, .gitignore, .npmrc, .prettierrc, and multiple tsconfig files for different module systems. - Created package.json with dependencies and scripts for building, testing, and publishing. - Implemented core functionality in src/ directory, including wallet management, encryption, and storage handling. - Added README.md for documentation on installation, usage, and development setup. - Introduced initial types and constants for better type safety and code organization.
This commit is contained in:
commit
a21ea39c36
19 files changed
+5094
No files matched your search
@@ -0,0 +1,44 @@
|
||||
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 & {
|
||||
subscribe: (cb: (ev: StorageEvent) => void) => void;
|
||||
}
|
||||
|
||||
export type InjectionConfig = {
|
||||
callbackUrl: string;
|
||||
isDev?: boolean;
|
||||
connectTimeout?: number;
|
||||
storage?: WalletStorage;
|
||||
}
|
||||
|
||||
export type WebApp = typeof WebAppConst;
|
||||
export interface ConnectRequest {
|
||||
method: 'connect';
|
||||
callback: string;
|
||||
}
|
||||
|
||||
export interface SignTransactionRequest {
|
||||
method: 'signTransaction';
|
||||
id: number;
|
||||
tx: 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;
|
||||
}
|
||||
Reference in new issue
Block a user