@ab-org/sdk-core 0.1.1 → 0.1.2-beta.0

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.
@@ -0,0 +1 @@
1
+ export { CubeSignerAuth, createCubistEvmWalletProvider } from './chunk-5HURLKIK.js';
@@ -0,0 +1,88 @@
1
+ import { d as WalletAdapter, P as ProviderCategory, c as WalletSession, e as WalletConnectArgs, i as WalletProvider, T as TwitterCodeExchangeParams, b as CubeSignerSession, a as CubeSignerConfig, C as CubeSignerAuth } from './cubeSignerAuth-DrPc9FeB.js';
2
+
3
+ declare abstract class AbstractProvider implements WalletAdapter {
4
+ abstract readonly id: string;
5
+ abstract readonly title: string;
6
+ abstract readonly category: ProviderCategory;
7
+ protected currentSession: WalletSession | null;
8
+ abstract connect(args?: WalletConnectArgs): Promise<WalletSession>;
9
+ disconnect(): Promise<void>;
10
+ protected setSession(session: WalletSession): WalletSession;
11
+ protected clearSession(): void;
12
+ protected get session(): WalletSession | null;
13
+ protected requireSession(message?: string): WalletSession;
14
+ getProvider(): WalletProvider | null;
15
+ reconnect(_persistedSession: WalletSession): Promise<WalletSession | null>;
16
+ }
17
+
18
+ interface SocialLoginOptions {
19
+ hint?: string;
20
+ redirectUri?: string;
21
+ }
22
+ interface SocialConnectArgs extends WalletConnectArgs {
23
+ options?: SocialLoginOptions;
24
+ }
25
+ declare abstract class AbstractSocialProvider extends AbstractProvider {
26
+ readonly category: "social";
27
+ /**
28
+ * Authenticate and cache a social-wallet session.
29
+ *
30
+ * Some providers only need `options`, while others may require an
31
+ * additional credential payload (for example an OIDC token or OAuth result).
32
+ */
33
+ abstract signIn(options?: SocialLoginOptions, payload?: unknown): Promise<void>;
34
+ abstract signOut(): Promise<void>;
35
+ connect(args?: WalletConnectArgs): Promise<WalletSession>;
36
+ }
37
+
38
+ type CubistLoginMethod = {
39
+ type: "google";
40
+ idToken: string;
41
+ } | {
42
+ type: "twitter";
43
+ params: TwitterCodeExchangeParams;
44
+ };
45
+ interface CubistSessionAdapter {
46
+ /**
47
+ * Convert a raw CubeSigner session into a WalletSession
48
+ * (resolve the first key's address, chain, build a provider, etc.).
49
+ */
50
+ resolve(session: CubeSignerSession): Promise<WalletSession>;
51
+ }
52
+ declare class CubistSocialProvider extends AbstractSocialProvider {
53
+ readonly id = "cubist";
54
+ readonly title = "Cubist Social Wallet";
55
+ private auth;
56
+ private adapter;
57
+ private lastCubeSignerSession;
58
+ /** Stash the login method so `connect()` can auto-retry. */
59
+ private lastLogin;
60
+ constructor(config: CubeSignerConfig, adapter?: CubistSessionAdapter);
61
+ private createWalletSession;
62
+ private authenticate;
63
+ private getResolvedLoginMethod;
64
+ /**
65
+ * Preferred explicit sign-in entrypoint.
66
+ */
67
+ signInWith(method: CubistLoginMethod, _options?: SocialLoginOptions): Promise<void>;
68
+ /**
69
+ * Backward-compatible abstract implementation.
70
+ *
71
+ * - If `payload` is provided, it is treated as the login method.
72
+ * - Otherwise reuses the previously cached login method if available.
73
+ */
74
+ signIn(_options?: SocialLoginOptions, payload?: unknown): Promise<void>;
75
+ /**
76
+ * Explicit connect flow that both authenticates and returns the wallet session.
77
+ */
78
+ connectWith(method: CubistLoginMethod, options?: SocialLoginOptions): Promise<WalletSession>;
79
+ connect(args?: WalletConnectArgs): Promise<WalletSession>;
80
+ reconnect(persistedSession: WalletSession): Promise<WalletSession | null>;
81
+ signOut(): Promise<void>;
82
+ disconnect(): Promise<void>;
83
+ /** Direct access to the underlying CubeSignerAuth for advanced use-cases. */
84
+ get cubeSignerAuth(): CubeSignerAuth;
85
+ get cubeSignerSession(): CubeSignerSession | null;
86
+ }
87
+
88
+ export { AbstractSocialProvider as A, type CubistLoginMethod as C, type SocialConnectArgs as S, type CubistSessionAdapter as a, CubistSocialProvider as b, type SocialLoginOptions as c, AbstractProvider as d };
@@ -0,0 +1,2 @@
1
+ export { A as AbstractSocialProvider, C as CubistLoginMethod, a as CubistSessionAdapter, b as CubistSocialProvider, S as SocialConnectArgs, c as SocialLoginOptions } from './social-provider-Bq58TBRt.js';
2
+ import './cubeSignerAuth-DrPc9FeB.js';
@@ -0,0 +1,2 @@
1
+ export { AbstractSocialProvider, CubistSocialProvider } from './chunk-MVZIAM4H.js';
2
+ import './chunk-5HURLKIK.js';
@@ -0,0 +1,3 @@
1
+ export { C as CubeSignerAuth, a as CubeSignerConfig, b as CubeSignerSession, O as OidcLoginHooks, T as TwitterCodeExchangeParams } from './cubeSignerAuth-DrPc9FeB.js';
2
+ export { createCubistEvmWalletProvider } from './social-auth.js';
3
+ export { A as AbstractSocialProvider, C as CubistLoginMethod, a as CubistSessionAdapter, b as CubistSocialProvider, S as SocialConnectArgs, c as SocialLoginOptions } from './social-provider-Bq58TBRt.js';
package/dist/social.js ADDED
@@ -0,0 +1,2 @@
1
+ export { AbstractSocialProvider, CubistSocialProvider } from './chunk-MVZIAM4H.js';
2
+ export { CubeSignerAuth, createCubistEvmWalletProvider } from './chunk-5HURLKIK.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ab-org/sdk-core",
3
- "version": "0.1.1",
3
+ "version": "0.1.2-beta.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist/**/*",
@@ -8,12 +8,29 @@
8
8
  ],
9
9
  "main": "dist/index.js",
10
10
  "types": "dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js"
15
+ },
16
+ "./social": {
17
+ "types": "./dist/social.d.ts",
18
+ "import": "./dist/social.js"
19
+ },
20
+ "./social/auth": {
21
+ "types": "./dist/social-auth.d.ts",
22
+ "import": "./dist/social-auth.js"
23
+ },
24
+ "./social/provider": {
25
+ "types": "./dist/social-provider.d.ts",
26
+ "import": "./dist/social-provider.js"
27
+ }
28
+ },
11
29
  "publishConfig": {
12
30
  "access": "public",
13
31
  "registry": "https://registry.npmjs.org/"
14
32
  },
15
33
  "dependencies": {
16
- "@cubist-labs/cubesigner-sdk": "^0.4.219",
17
34
  "eventemitter3": "^5.0.1"
18
35
  },
19
36
  "devDependencies": {
@@ -22,7 +39,7 @@
22
39
  "@ab-org/wallet-utils": "0.0.7"
23
40
  },
24
41
  "scripts": {
25
- "build": "tsup",
42
+ "build": "pnpm exec tsup",
26
43
  "lint": "eslint 'src/**/*.{ts,tsx}'",
27
44
  "test": "vitest run --passWithNoTests"
28
45
  }