@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/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# @tarobase/core
|
|
2
|
+
|
|
3
|
+
Core functionality for Tarobase SDKs. This package provides the shared functionality used by both the web and server SDKs.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @tarobase/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
This package is typically not used directly, but is instead used as a dependency by `@tarobase/web` and `@tarobase/server`. If you're building a browser application, use `@tarobase/web`. If you're building a server application, use `@tarobase/server`.
|
|
14
|
+
|
|
15
|
+
## API Reference
|
|
16
|
+
|
|
17
|
+
### Core Types
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
export interface ClientConfig {
|
|
21
|
+
appId: string;
|
|
22
|
+
apiUrl: string;
|
|
23
|
+
authMethod: string;
|
|
24
|
+
privyConfig?: any;
|
|
25
|
+
chain?: string;
|
|
26
|
+
useSessionStorage?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface AuthProvider {
|
|
30
|
+
login(): Promise<User | null>;
|
|
31
|
+
runTransaction(evmTransactionData?: EVMTransaction, solTransactionData?: SolTransaction, options?: SetOptions): Promise<TransactionResult>;
|
|
32
|
+
signMessage(message: string): Promise<string>;
|
|
33
|
+
restoreSession(): Promise<User | null>;
|
|
34
|
+
logout(): Promise<void>;
|
|
35
|
+
getNativeMethods(): Promise<any>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface User {
|
|
39
|
+
address: string;
|
|
40
|
+
provider: AuthProvider;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Core Operations
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
// Initialize the SDK
|
|
48
|
+
function configInit(newConfig: Partial<ClientConfig>, options?: SessionOptions): Promise<void>;
|
|
49
|
+
|
|
50
|
+
// Get the current configuration
|
|
51
|
+
function getConfig(): Promise<ClientConfig>;
|
|
52
|
+
|
|
53
|
+
// Data operations
|
|
54
|
+
function get(path: string): Promise<any>;
|
|
55
|
+
function set(path: string, data: any, options?: SetOptions): Promise<any>;
|
|
56
|
+
function setMany(paths: { [key: string]: any }, options?: SetOptions): Promise<any>;
|
|
57
|
+
function setFile(path: string, file: File, metadata?: any): Promise<any>;
|
|
58
|
+
function getFiles(path: string): Promise<any>;
|
|
59
|
+
function runQuery(queryString: string, variables?: any): Promise<any>;
|
|
60
|
+
function runQueryMany(queryString: string, variables?: any): Promise<any>;
|
|
61
|
+
|
|
62
|
+
// Subscription
|
|
63
|
+
function subscribe(path: string, options?: SubscriptionOptions): Promise<() => void>;
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Contributing
|
|
67
|
+
|
|
68
|
+
Please see the main repository for contribution guidelines.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AuthProvider } from '../types';
|
|
2
|
+
export interface ClientConfig {
|
|
3
|
+
name: string;
|
|
4
|
+
logoUrl: string;
|
|
5
|
+
apiKey: string;
|
|
6
|
+
authMethod: 'none' | 'privy' | 'wallet' | 'rainbowkit' | 'coinbase-smart-wallet' | 'onboard' | 'phantom';
|
|
7
|
+
wsApiUrl: string;
|
|
8
|
+
apiUrl: string;
|
|
9
|
+
appId: string;
|
|
10
|
+
authApiUrl: string;
|
|
11
|
+
chain: string;
|
|
12
|
+
rpcUrl: string;
|
|
13
|
+
skipBackendInit: boolean;
|
|
14
|
+
authProvider: AuthProvider | null;
|
|
15
|
+
isServer: boolean;
|
|
16
|
+
privyConfig?: {
|
|
17
|
+
appId: string;
|
|
18
|
+
config: any;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare let clientConfig: ClientConfig;
|
|
22
|
+
export declare function init(newConfig: Partial<ClientConfig>): Promise<void>;
|
|
23
|
+
export declare function getConfig(): Promise<ClientConfig>;
|
|
@@ -0,0 +1,29 @@
|
|
|
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>;
|
|
@@ -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/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { init } from './client/config';
|
|
2
|
+
export { getConfig, ClientConfig } from './client/config';
|
|
3
|
+
export { get, set, setMany, setFile, getFiles, runQuery, runQueryMany, SetOptions } from './client/operations';
|
|
4
|
+
export { subscribe } from './client/subscription';
|
|
5
|
+
export * from './types';
|
|
6
|
+
export { getIdToken } from './utils/utils';
|
|
7
|
+
export { WebSessionManager } from './utils/web-session-manager';
|
|
8
|
+
export { ServerSessionManager } from './utils/server-session-manager';
|
|
9
|
+
export { createSessionWithPrivy, createSessionWithSignature, refreshSession, signSessionCreateMessage } from './utils/auth-api';
|
|
10
|
+
export { Tarobase as Tarobase6 } from './utils/sol/taro6CvKqwrYrDc16ufYgzQ2NZcyyVKStffbtudrhRuDevnet-program';
|
|
11
|
+
export { Tarobase as TarobasePoof } from './utils/sol/poof4b5pk1L9tmThvBmaABjcyjfhFGbMbQP5BXk2QZpMainnet-program';
|
|
12
|
+
export { buildSetDocumentsTransaction, convertRemainingAccounts, RemainingAccount, genSolanaMessage } from './utils/sol/sol-utils';
|