@pooflabs/web 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { User } from '../../types';
1
+ import { User } from '@pooflabs/core';
2
2
  export interface UseAuthResult {
3
3
  login: () => Promise<void>;
4
4
  logout: () => Promise<void>;
@@ -1,6 +1,6 @@
1
- export { deserializeTransaction } from './providers/sol/sol-utils';
2
- import { AuthProvider, User } from '../types';
3
- export declare const SURFNET_RPC_URL = "https://surfpool.fly.dev";
4
- export declare function getAuthProvider(): Promise<AuthProvider>;
1
+ export { PhantomWalletProvider, PhantomWalletConfig } from './providers/phantom-wallet-provider';
2
+ export { PrivyWalletProvider } from './providers/privy-wallet-provider';
3
+ import { AuthProvider, User, ClientConfig } from '@pooflabs/core';
4
+ export declare function getAuthProvider(config?: Partial<ClientConfig>): Promise<AuthProvider>;
5
5
  export declare function login(): Promise<User | null>;
6
6
  export declare function logout(): Promise<void>;
@@ -1,75 +1,17 @@
1
- import type { EVMTransaction, SolTransaction, TransactionResult, User, AuthProvider } from '../../types';
2
- import { PublicKey, Transaction, VersionedTransaction } from '@solana/web3.js';
3
- import { CreatePhantomConfig } from '@phantom/wallet-sdk';
4
- import { SetOptions } from '../../client/operations';
1
+ import type { EVMTransaction, SolTransaction, TransactionResult, User, AuthProvider, SetOptions } from '@pooflabs/core';
2
+ export interface PhantomWalletConfig {
3
+ appId?: string;
4
+ autoConnect?: boolean;
5
+ providerType?: 'injected' | 'embedded';
6
+ }
5
7
  export declare class PhantomWalletProvider implements AuthProvider {
6
- private connection;
7
- private initialized;
8
- private networkUrl;
9
- private embeddedWallet;
10
- private embeddedConfig;
11
- constructor(networkUrl?: string, embeddedConfig?: CreatePhantomConfig);
12
- private init;
13
- /**
14
- * Shows the embedded wallet UI
15
- */
16
- showWallet(): void;
17
- /**
18
- * Hides the embedded wallet UI
19
- */
20
- hideWallet(): void;
21
- /**
22
- * Opens the swap screen in the embedded wallet
23
- * @param options Swap options (buy token, sell token, amount)
24
- */
25
- openSwap(options: {
26
- buy: string;
27
- sell?: string;
28
- amount?: string;
29
- }): void;
30
- /**
31
- * Opens the buy screen in the embedded wallet
32
- * @param options Buy options (token to buy, amount in USD)
33
- */
34
- openBuy(options: {
35
- amount?: number;
36
- buy: string;
37
- }): void;
38
- private getProvider;
39
- /**
40
- * Ensures the wallet is connected and returns the provider
41
- * This method will attempt to connect if not already connected
42
- */
43
- private ensureConnected;
8
+ constructor(networkUrl?: string, config?: PhantomWalletConfig);
44
9
  login(): Promise<User | null>;
45
10
  restoreSession(): Promise<User | null>;
46
11
  address(): Promise<string | null>;
47
12
  runTransaction(evmTransactionData?: EVMTransaction, solTransactionData?: SolTransaction, options?: SetOptions): Promise<TransactionResult>;
48
- signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
49
13
  signMessage(message: string): Promise<string>;
14
+ signTransaction(transaction: any): Promise<any>;
50
15
  logout(): Promise<void>;
51
16
  getNativeMethods(): Promise<any>;
52
17
  }
53
- declare global {
54
- interface Window {
55
- phantom?: {
56
- solana?: {
57
- isPhantom: boolean;
58
- isConnected: boolean;
59
- publicKey: PublicKey;
60
- connect: () => Promise<{
61
- publicKey: PublicKey;
62
- }>;
63
- disconnect: () => Promise<void>;
64
- signMessage: (message: Uint8Array, encoding: string) => Promise<{
65
- signature: Uint8Array;
66
- }>;
67
- signTransaction: (transaction: Transaction | VersionedTransaction) => Promise<Transaction>;
68
- signAndSendTransaction: (transaction: Transaction | VersionedTransaction) => Promise<{
69
- signature: string;
70
- }>;
71
- };
72
- };
73
- CUSTOM_TAROBASE_APP_ID_HEADER?: string;
74
- }
75
- }
@@ -1,7 +1,5 @@
1
- import type { EVMTransaction, SolTransaction, TransactionResult } from '../../types';
2
- import { AuthProvider, User } from '../../types';
1
+ import type { EVMTransaction, SolTransaction, TransactionResult, AuthProvider, User, SetOptions } from '@pooflabs/core';
3
2
  import { Transaction, VersionedTransaction } from '@solana/web3.js';
4
- import { SetOptions } from '../../client/operations';
5
3
  export declare class PrivyWalletProvider implements AuthProvider {
6
4
  private static instance;
7
5
  private containerElement;
package/dist/global.d.ts CHANGED
@@ -1,10 +1,7 @@
1
- import { ClientConfig } from './client/config';
2
- import { User } from './types';
3
- import { Transaction, VersionedTransaction } from '@solana/web3.js';
1
+ import { User, ClientConfig } from '@pooflabs/core';
4
2
  export declare function init(newConfig: Partial<ClientConfig>): Promise<void>;
5
3
  export declare function onAuthStateChanged(callback: (user: User | null) => void): void;
6
4
  export declare function login(): Promise<User | null>;
7
5
  export declare function logout(): Promise<void>;
8
6
  export declare function setCurrentUser(user: User | null): void;
9
7
  export declare function getCurrentUser(): User | null;
10
- export declare function signTransaction(transaction: Transaction | VersionedTransaction): Promise<Transaction | VersionedTransaction>;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- export { init, getCurrentUser, onAuthStateChanged, login, logout, signTransaction } from "./global";
2
- export { getConfig } from './client/config';
3
- export { getAuthProvider, deserializeTransaction } from './auth';
4
- export { get, set, setMany, setFile, getFiles, runQuery, runQueryMany, syncItems } from './client/operations';
5
- export { subscribe } from './client/subscription';
6
- export * from './types';
1
+ export { init, getCurrentUser, onAuthStateChanged, login, logout } from "./global";
2
+ export { getConfig } from '@pooflabs/core';
3
+ export { getAuthProvider } from './auth';
4
+ export { get, set, setMany, setFile, getFiles, runQuery, runQueryMany, runExpression, runExpressionMany } from '@pooflabs/core';
5
+ export { subscribe } from '@pooflabs/core';
6
+ export * from '@pooflabs/core';
7
7
  export { useAuth } from './auth/hooks/useAuth';
8
- export { getIdToken } from './auth/utils/utils';
8
+ export { getIdToken } from '@pooflabs/core';
9
+ export { PhantomWalletProvider, PhantomWalletConfig } from './auth/providers/phantom-wallet-provider';
10
+ export { PrivyWalletProvider } from './auth/providers/privy-wallet-provider';