@pooflabs/web 0.0.2 → 0.0.4
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.
- package/README.md +171 -85
- package/dist/auth/hooks/useAuth.d.ts +1 -1
- package/dist/auth/index.d.ts +3 -2
- package/dist/auth/providers/phantom-wallet-provider.d.ts +3 -2
- package/dist/auth/providers/privy-wallet-provider.d.ts +5 -3
- package/dist/auth/providers/sol/poof4b5pk1L9tmThvBmaABjcyjfhFGbMbQP5BXk2QZpDevnet-program.d.ts +1381 -0
- package/dist/auth/providers/sol/poof4b5pk1L9tmThvBmaABjcyjfhFGbMbQP5BXk2QZpMainnet-program.d.ts +1381 -0
- package/dist/auth/providers/sol/sol-utils.d.ts +42 -0
- package/dist/auth/providers/sol/taro6CvKqwrYrDc16ufYgzQ2NZcyyVKStffbtudrhRuDevnet-program.d.ts +1161 -0
- package/dist/auth/utils/auth-api.d.ts +5 -0
- package/dist/auth/utils/session-manager.d.ts +14 -0
- package/dist/auth/utils/utils.d.ts +8 -0
- package/dist/client/config.d.ts +20 -0
- package/dist/client/operations.d.ts +30 -0
- package/dist/client/subscription.d.ts +10 -0
- package/dist/global.d.ts +2 -2
- package/dist/index.d.ts +6 -6
- package/dist/index.esm.js +5713 -8258
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5724 -8276
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +45 -0
- package/dist/utils/api.d.ts +8 -0
- package/package.json +15 -17
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function genNonce(): Promise<any>;
|
|
2
|
+
export declare function createSessionWithSignature(address: string, message: string, signature: string): Promise<any>;
|
|
3
|
+
export declare function createSessionWithPrivy(authToken: string, address: string, idToken: string): Promise<any>;
|
|
4
|
+
export declare function refreshSession(refreshToken: string): Promise<any>;
|
|
5
|
+
export declare function signSessionCreateMessage(_signMessageFunction: (message: string) => Promise<string>): Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare class SessionManager {
|
|
2
|
+
private static TAROBASE_SESSION_STORAGE_KEY;
|
|
3
|
+
static storeSession(address: string, accessToken: string, idToken: string, refreshToken: string): Promise<void>;
|
|
4
|
+
static getSession(): Promise<{
|
|
5
|
+
address: string;
|
|
6
|
+
session: any;
|
|
7
|
+
} | null>;
|
|
8
|
+
static clearSession(): void;
|
|
9
|
+
static isAuthenticated(): boolean;
|
|
10
|
+
static getIdToken(): string | null;
|
|
11
|
+
static getRefreshToken(): string | null;
|
|
12
|
+
static updateIdTokenAndAccessToken(idToken: string, accessToken: string): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export default SessionManager;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function getMessageStatement(): Promise<string>;
|
|
2
|
+
export declare function createAuthHeader(): Promise<{
|
|
3
|
+
Authorization: string;
|
|
4
|
+
} | null>;
|
|
5
|
+
export declare function getUserInfo(): Promise<any>;
|
|
6
|
+
export declare function getIdToken(): string | null;
|
|
7
|
+
export declare function getRefreshToken(): string | null;
|
|
8
|
+
export declare function updateIdTokenAndAccessToken(idToken: string, accessToken: string): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ClientConfig {
|
|
2
|
+
name: string;
|
|
3
|
+
logoUrl: string;
|
|
4
|
+
apiKey: string;
|
|
5
|
+
authMethod: 'none' | 'privy' | 'wallet' | 'rainbowkit' | 'coinbase-smart-wallet' | 'onboard' | 'phantom';
|
|
6
|
+
wsApiUrl: string;
|
|
7
|
+
apiUrl: string;
|
|
8
|
+
appId: string;
|
|
9
|
+
authApiUrl: string;
|
|
10
|
+
chain: string;
|
|
11
|
+
rpcUrl: string;
|
|
12
|
+
skipBackendInit: boolean;
|
|
13
|
+
privyConfig?: {
|
|
14
|
+
appId: string;
|
|
15
|
+
config: any;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare let clientConfig: ClientConfig;
|
|
19
|
+
export declare function init(newConfig: Partial<ClientConfig>): Promise<void>;
|
|
20
|
+
export declare function getConfig(): Promise<ClientConfig>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type SetOptions = {
|
|
2
|
+
shouldSubmitTx?: boolean;
|
|
3
|
+
_overrides?: {
|
|
4
|
+
headers?: Record<string, string>;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export declare function get(path: string, opts?: {
|
|
8
|
+
prompt?: string | undefined;
|
|
9
|
+
bypassCache?: boolean;
|
|
10
|
+
_overrides?: {
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
}): Promise<any>;
|
|
14
|
+
export declare function runQuery(absolutePath: string, queryName: string, queryArgs: any): Promise<any>;
|
|
15
|
+
export declare function runQueryMany(many: {
|
|
16
|
+
absolutePath: string;
|
|
17
|
+
queryName: string;
|
|
18
|
+
queryArgs: any;
|
|
19
|
+
}[]): Promise<any>;
|
|
20
|
+
export declare function set(path: string, document: any, options?: SetOptions): Promise<any>;
|
|
21
|
+
export declare function setMany(many: {
|
|
22
|
+
path: string;
|
|
23
|
+
document: any;
|
|
24
|
+
}[], options?: SetOptions): Promise<any>;
|
|
25
|
+
export declare function clearCache(path?: string, opts?: {
|
|
26
|
+
prompt?: string;
|
|
27
|
+
}): void;
|
|
28
|
+
export declare function getFiles(path: string): Promise<any>;
|
|
29
|
+
export declare function setFile(path: string, file: File | null): Promise<boolean>;
|
|
30
|
+
export declare function syncItems(paths: string[]): Promise<any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SubscriptionOptions } from '../types';
|
|
2
|
+
export declare function subscribe(path: string, subscriptionOptions: SubscriptionOptions): Promise<() => Promise<void>>;
|
|
3
|
+
export declare function closeAllSubscriptions(): Promise<void>;
|
|
4
|
+
export declare function clearCache(path?: string): void;
|
|
5
|
+
export declare function getCachedData(path: string, prompt?: string): any | null;
|
|
6
|
+
declare global {
|
|
7
|
+
interface Window {
|
|
8
|
+
CUSTOM_TAROBASE_APP_ID_HEADER?: string;
|
|
9
|
+
}
|
|
10
|
+
}
|
package/dist/global.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ClientConfig } from './client/config';
|
|
2
|
+
import { User } from './types';
|
|
3
3
|
export declare function init(newConfig: Partial<ClientConfig>): Promise<void>;
|
|
4
4
|
export declare function onAuthStateChanged(callback: (user: User | null) => void): void;
|
|
5
5
|
export declare function login(): Promise<User | null>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { init, getCurrentUser, onAuthStateChanged, login, logout } from "./global";
|
|
2
|
-
export { getConfig } from '
|
|
3
|
-
export { getAuthProvider } from './auth';
|
|
4
|
-
export { get, set, setMany, setFile, getFiles, runQuery, runQueryMany } from '
|
|
5
|
-
export { subscribe } from '
|
|
6
|
-
export * from '
|
|
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';
|
|
7
7
|
export { useAuth } from './auth/hooks/useAuth';
|
|
8
|
-
export { getIdToken } from '
|
|
8
|
+
export { getIdToken } from './auth/utils/utils';
|