@pooflabs/core 0.0.1
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 +68 -0
- package/dist/client/config.d.ts +23 -0
- package/dist/client/operations.d.ts +29 -0
- package/dist/client/subscription.d.ts +10 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +7617 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +7578 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types.d.ts +44 -0
- package/dist/utils/api.d.ts +8 -0
- package/dist/utils/auth-api.d.ts +5 -0
- package/dist/utils/server-session-manager.d.ts +25 -0
- package/dist/utils/sol/poof4b5pk1L9tmThvBmaABjcyjfhFGbMbQP5BXk2QZpDevnet-program.d.ts +1381 -0
- package/dist/utils/sol/poof4b5pk1L9tmThvBmaABjcyjfhFGbMbQP5BXk2QZpMainnet-program.d.ts +1381 -0
- package/dist/utils/sol/sol-utils.d.ts +41 -0
- package/dist/utils/sol/taro6CvKqwrYrDc16ufYgzQ2NZcyyVKStffbtudrhRuDevnet-program.d.ts +1161 -0
- package/dist/utils/utils.d.ts +8 -0
- package/dist/utils/web-session-manager.d.ts +13 -0
- package/package.json +61 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
2
|
+
import { SetOptions } from "./client/operations";
|
|
3
|
+
export interface AuthProvider {
|
|
4
|
+
login(): Promise<User | null>;
|
|
5
|
+
runTransaction(evmTransactionData?: EVMTransaction, solTransactionData?: SolTransaction, options?: SetOptions): Promise<TransactionResult>;
|
|
6
|
+
signMessage(message: string): Promise<string>;
|
|
7
|
+
restoreSession(): Promise<User | null>;
|
|
8
|
+
logout(): Promise<void>;
|
|
9
|
+
getNativeMethods(): Promise<any>;
|
|
10
|
+
}
|
|
11
|
+
export interface User {
|
|
12
|
+
address: string;
|
|
13
|
+
provider: AuthProvider;
|
|
14
|
+
}
|
|
15
|
+
export interface EVMTransaction {
|
|
16
|
+
contractAddress: string;
|
|
17
|
+
contractAbi: string | any;
|
|
18
|
+
functionName: string;
|
|
19
|
+
value: string;
|
|
20
|
+
txArgs: any[];
|
|
21
|
+
}
|
|
22
|
+
export interface SolTransaction {
|
|
23
|
+
appId: string;
|
|
24
|
+
txArgs: any[];
|
|
25
|
+
lutKey: PublicKey | null;
|
|
26
|
+
preInstructions: TransactionInstruction[];
|
|
27
|
+
}
|
|
28
|
+
export interface TransactionResult {
|
|
29
|
+
transactionSignature?: any;
|
|
30
|
+
signedTransaction?: any;
|
|
31
|
+
blockNumber: number;
|
|
32
|
+
gasUsed: string;
|
|
33
|
+
data?: any;
|
|
34
|
+
}
|
|
35
|
+
export interface TransactionReceipt {
|
|
36
|
+
}
|
|
37
|
+
export interface SubscriptionOptions {
|
|
38
|
+
prompt?: string;
|
|
39
|
+
onData?: (data: any) => void;
|
|
40
|
+
onError?: (error: any) => void;
|
|
41
|
+
}
|
|
42
|
+
export type TransactionOptions = {
|
|
43
|
+
shouldSubmit?: boolean;
|
|
44
|
+
};
|
|
@@ -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, privyIdToken: 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,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-side SessionManager
|
|
3
|
+
* --------------------------
|
|
4
|
+
* • Singleton (use `ServerSessionManager.instance`)
|
|
5
|
+
* • Keeps session data in-memory for the life of the Node process
|
|
6
|
+
* • If `getSession()` finds no cached session it calls `createSession()`
|
|
7
|
+
* to obtain fresh tokens (mock implementation provided).
|
|
8
|
+
*/
|
|
9
|
+
export interface ServerSession {
|
|
10
|
+
address: string;
|
|
11
|
+
accessToken: string;
|
|
12
|
+
idToken: string;
|
|
13
|
+
refreshToken: string;
|
|
14
|
+
}
|
|
15
|
+
export declare class ServerSessionManager {
|
|
16
|
+
static readonly instance: ServerSessionManager;
|
|
17
|
+
private session;
|
|
18
|
+
private constructor();
|
|
19
|
+
getSession(): Promise<ServerSession>;
|
|
20
|
+
setSession(session: ServerSession): void;
|
|
21
|
+
clearSession(): void;
|
|
22
|
+
isAuthenticated(): boolean;
|
|
23
|
+
getIdToken(): string | null;
|
|
24
|
+
getRefreshToken(): string | null;
|
|
25
|
+
}
|