@ab-org/sdk-core 0.1.0 → 0.1.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.
Files changed (37) hide show
  1. package/dist/index.d.ts +536 -16
  2. package/dist/index.js +1776 -16
  3. package/package.json +6 -5
  4. package/dist/core/capabilities.d.ts +0 -32
  5. package/dist/core/capabilities.js +0 -88
  6. package/dist/core/chains.d.ts +0 -23
  7. package/dist/core/chains.js +0 -83
  8. package/dist/core/errors.d.ts +0 -9
  9. package/dist/core/errors.js +0 -51
  10. package/dist/core/sessionStore.d.ts +0 -26
  11. package/dist/core/sessionStore.js +0 -129
  12. package/dist/core/types.d.ts +0 -75
  13. package/dist/core/types.js +0 -1
  14. package/dist/core/walletConnector.d.ts +0 -29
  15. package/dist/core/walletConnector.js +0 -153
  16. package/dist/core/walletExecution.d.ts +0 -22
  17. package/dist/core/walletExecution.js +0 -89
  18. package/dist/hooks/useAccount.d.ts +0 -11
  19. package/dist/hooks/useAccount.js +0 -32
  20. package/dist/hooks/useWalletConnect.d.ts +0 -16
  21. package/dist/hooks/useWalletConnect.js +0 -24
  22. package/dist/providers/base.d.ts +0 -15
  23. package/dist/providers/base.js +0 -30
  24. package/dist/providers/plugin/injectedEvmProvider.d.ts +0 -112
  25. package/dist/providers/plugin/injectedEvmProvider.js +0 -352
  26. package/dist/providers/plugin/injectedWalletRegistry.d.ts +0 -9
  27. package/dist/providers/plugin/injectedWalletRegistry.js +0 -34
  28. package/dist/providers/plugin/metamaskProvider.d.ts +0 -1
  29. package/dist/providers/plugin/metamaskProvider.js +0 -1
  30. package/dist/providers/social/baseSocialProvider.d.ts +0 -21
  31. package/dist/providers/social/baseSocialProvider.js +0 -11
  32. package/dist/providers/social/cubeSignerAuth.d.ts +0 -89
  33. package/dist/providers/social/cubeSignerAuth.js +0 -128
  34. package/dist/providers/social/cubistEvmWalletProvider.d.ts +0 -9
  35. package/dist/providers/social/cubistEvmWalletProvider.js +0 -175
  36. package/dist/providers/social/cubistProvider.d.ts +0 -52
  37. package/dist/providers/social/cubistProvider.js +0 -160
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ab-org/sdk-core",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist/**/*",
@@ -14,14 +14,15 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@cubist-labs/cubesigner-sdk": "^0.4.219",
17
- "eventemitter3": "^5.0.1",
18
- "@ab-org/wallet-utils": "0.0.7"
17
+ "eventemitter3": "^5.0.1"
19
18
  },
20
19
  "devDependencies": {
21
- "typescript": "^5.5.4"
20
+ "typescript": "^5.5.4",
21
+ "tsup": "^8.5.1",
22
+ "@ab-org/wallet-utils": "0.0.7"
22
23
  },
23
24
  "scripts": {
24
- "build": "tsc -p tsconfig.json",
25
+ "build": "tsup",
25
26
  "lint": "eslint 'src/**/*.{ts,tsx}'",
26
27
  "test": "vitest run --passWithNoTests"
27
28
  }
@@ -1,32 +0,0 @@
1
- import type { SupportedChain, SupportedToken, WalletSession } from "./types.js";
2
- export type WalletCapability = "eth_accounts" | "eth_requestAccounts" | "eth_chainId" | "eth_signTransaction" | "eth_sendTransaction" | "personal_sign" | "eth_signTypedData_v4" | "wallet_disconnect" | "wallet_rehydrate" | string;
3
- export interface SessionCapabilityPolicy {
4
- id: string;
5
- appId?: string;
6
- origin?: string;
7
- expiresAt?: number;
8
- methods?: WalletCapability[];
9
- chains?: SupportedChain[];
10
- tokens?: SupportedToken[];
11
- maxAmount?: string;
12
- revocable?: boolean;
13
- metadata?: Record<string, unknown>;
14
- }
15
- export interface SessionCapabilityCheck {
16
- capability: WalletCapability;
17
- chain?: SupportedChain;
18
- token?: SupportedToken;
19
- amount?: string | number | bigint;
20
- appId?: string;
21
- origin?: string;
22
- now?: number;
23
- }
24
- export declare class SessionCapabilityError extends Error {
25
- constructor(message: string);
26
- }
27
- export declare const createSessionCapabilityPolicy: (input?: Partial<SessionCapabilityPolicy>) => SessionCapabilityPolicy;
28
- export declare const isSessionExpired: (session: Pick<WalletSession, "expiresAt"> | null | undefined, now?: number) => boolean;
29
- export declare const isCapabilityPolicyExpired: (policy: SessionCapabilityPolicy | null | undefined, now?: number) => boolean;
30
- export declare const sessionSupportsCapability: (session: Pick<WalletSession, "capabilities"> | null | undefined, capability: WalletCapability) => boolean;
31
- export declare const describeSessionCapabilityPolicy: (policy: SessionCapabilityPolicy | null | undefined) => string[];
32
- export declare const assertSessionCapability: (session: WalletSession, check: SessionCapabilityCheck) => void;
@@ -1,88 +0,0 @@
1
- export class SessionCapabilityError extends Error {
2
- constructor(message) {
3
- super(message);
4
- this.name = "SessionCapabilityError";
5
- }
6
- }
7
- const toBigIntAmount = (value) => {
8
- if (typeof value === "bigint")
9
- return value;
10
- if (typeof value === "number")
11
- return BigInt(value);
12
- return BigInt(value);
13
- };
14
- export const createSessionCapabilityPolicy = (input = {}) => ({
15
- id: input.id ?? `cap:${Date.now()}`,
16
- appId: input.appId,
17
- origin: input.origin,
18
- expiresAt: input.expiresAt,
19
- methods: input.methods,
20
- chains: input.chains,
21
- tokens: input.tokens,
22
- maxAmount: input.maxAmount,
23
- revocable: input.revocable ?? true,
24
- metadata: input.metadata,
25
- });
26
- export const isSessionExpired = (session, now = Date.now()) => Boolean(session?.expiresAt && session.expiresAt <= now);
27
- export const isCapabilityPolicyExpired = (policy, now = Date.now()) => Boolean(policy?.expiresAt && policy.expiresAt <= now);
28
- export const sessionSupportsCapability = (session, capability) => {
29
- const capabilities = session?.capabilities;
30
- if (!capabilities || capabilities.length === 0)
31
- return true;
32
- return capabilities.includes(capability);
33
- };
34
- export const describeSessionCapabilityPolicy = (policy) => {
35
- if (!policy)
36
- return [];
37
- const lines = [];
38
- if (policy.origin)
39
- lines.push(`Origin: ${policy.origin}`);
40
- if (policy.appId)
41
- lines.push(`App: ${policy.appId}`);
42
- if (policy.methods?.length)
43
- lines.push(`Methods: ${policy.methods.join(", ")}`);
44
- if (policy.chains?.length)
45
- lines.push(`Chains: ${policy.chains.join(", ")}`);
46
- if (policy.tokens?.length)
47
- lines.push(`Tokens: ${policy.tokens.join(", ")}`);
48
- if (policy.maxAmount)
49
- lines.push(`Max amount: ${policy.maxAmount}`);
50
- if (policy.expiresAt)
51
- lines.push(`Expires at: ${new Date(policy.expiresAt).toISOString()}`);
52
- return lines;
53
- };
54
- export const assertSessionCapability = (session, check) => {
55
- const now = check.now ?? Date.now();
56
- if (isSessionExpired(session, now)) {
57
- throw new SessionCapabilityError("Wallet session has expired");
58
- }
59
- const policy = session.capabilityPolicy;
60
- if (isCapabilityPolicyExpired(policy, now)) {
61
- throw new SessionCapabilityError("Capability session has expired");
62
- }
63
- if (!sessionSupportsCapability(session, check.capability)) {
64
- throw new SessionCapabilityError(`Wallet session does not support capability "${check.capability}"`);
65
- }
66
- if (!policy)
67
- return;
68
- if (policy.appId && check.appId && policy.appId !== check.appId) {
69
- throw new SessionCapabilityError("Capability session is scoped to a different app");
70
- }
71
- if (policy.origin && check.origin && policy.origin !== check.origin) {
72
- throw new SessionCapabilityError("Capability session is scoped to a different origin");
73
- }
74
- if (policy.methods?.length && !policy.methods.includes(check.capability)) {
75
- throw new SessionCapabilityError(`Capability "${check.capability}" is not allowed for this session`);
76
- }
77
- if (check.chain && policy.chains?.length && !policy.chains.includes(check.chain)) {
78
- throw new SessionCapabilityError(`Chain "${check.chain}" is not allowed for this session`);
79
- }
80
- if (check.token && policy.tokens?.length && !policy.tokens.includes(check.token)) {
81
- throw new SessionCapabilityError(`Token "${check.token}" is not allowed for this session`);
82
- }
83
- if (policy.maxAmount && check.amount !== undefined) {
84
- if (toBigIntAmount(check.amount) > toBigIntAmount(policy.maxAmount)) {
85
- throw new SessionCapabilityError("Requested amount exceeds the capability session limit");
86
- }
87
- }
88
- };
@@ -1,23 +0,0 @@
1
- import type { SupportedChain } from "./types.js";
2
- export type ChainNamespace = "evm" | "solana" | "ab-core";
3
- export type ChainRpcFamily = "evm" | "solana" | "custom";
4
- export interface ChainDescriptor {
5
- chain: SupportedChain;
6
- namespace: ChainNamespace;
7
- reference: string;
8
- label: string;
9
- rpcFamily: ChainRpcFamily;
10
- evmChainId?: number;
11
- supportsSmartSessions: boolean;
12
- supportsAccountAbstraction: boolean;
13
- }
14
- export interface ChainContext {
15
- walletChain: SupportedChain;
16
- walletChainDescriptor: ChainDescriptor;
17
- settlementChain: SupportedChain;
18
- settlementChainDescriptor: ChainDescriptor;
19
- }
20
- export declare const getChainDescriptor: (chain: SupportedChain) => ChainDescriptor;
21
- export declare const getAllChainDescriptors: () => ChainDescriptor[];
22
- export declare const getSupportedChainFromEvmChainId: (value: string | number | bigint) => SupportedChain;
23
- export declare const createChainContext: (walletChain: SupportedChain, settlementChain?: SupportedChain) => ChainContext;
@@ -1,83 +0,0 @@
1
- const chainDescriptors = {
2
- AB_CORE: {
3
- chain: "AB_CORE",
4
- namespace: "ab-core",
5
- reference: "ab:core",
6
- label: "AB Core",
7
- rpcFamily: "custom",
8
- supportsSmartSessions: true,
9
- supportsAccountAbstraction: true,
10
- },
11
- ETH: {
12
- chain: "ETH",
13
- namespace: "evm",
14
- reference: "eip155:1",
15
- label: "Ethereum",
16
- rpcFamily: "evm",
17
- evmChainId: 1,
18
- supportsSmartSessions: true,
19
- supportsAccountAbstraction: true,
20
- },
21
- BSC: {
22
- chain: "BSC",
23
- namespace: "evm",
24
- reference: "eip155:56",
25
- label: "BNB Smart Chain",
26
- rpcFamily: "evm",
27
- evmChainId: 56,
28
- supportsSmartSessions: true,
29
- supportsAccountAbstraction: false,
30
- },
31
- ETH_TENDERLY: {
32
- chain: "ETH_TENDERLY",
33
- namespace: "evm",
34
- reference: "eip155:3030",
35
- label: "Ethereum Tenderly",
36
- rpcFamily: "evm",
37
- evmChainId: 3030,
38
- supportsSmartSessions: true,
39
- supportsAccountAbstraction: true,
40
- },
41
- BSC_TENDERLY: {
42
- chain: "BSC_TENDERLY",
43
- namespace: "evm",
44
- reference: "eip155:3131",
45
- label: "BNB Smart Chain Tenderly",
46
- rpcFamily: "evm",
47
- evmChainId: 3131,
48
- supportsSmartSessions: true,
49
- supportsAccountAbstraction: false,
50
- },
51
- SOL: {
52
- chain: "SOL",
53
- namespace: "solana",
54
- reference: "solana:mainnet-beta",
55
- label: "Solana",
56
- rpcFamily: "solana",
57
- supportsSmartSessions: true,
58
- supportsAccountAbstraction: false,
59
- },
60
- };
61
- export const getChainDescriptor = (chain) => chainDescriptors[chain];
62
- export const getAllChainDescriptors = () => Object.values(chainDescriptors);
63
- const normalizeEvmChainId = (value) => {
64
- if (typeof value === "number")
65
- return value;
66
- if (typeof value === "bigint")
67
- return Number(value);
68
- return Number(BigInt(value));
69
- };
70
- export const getSupportedChainFromEvmChainId = (value) => {
71
- const chainId = normalizeEvmChainId(value);
72
- const descriptor = getAllChainDescriptors().find((item) => item.namespace === "evm" && item.evmChainId === chainId);
73
- if (!descriptor) {
74
- throw new Error(`Unsupported EVM chainId: ${chainId}`);
75
- }
76
- return descriptor.chain;
77
- };
78
- export const createChainContext = (walletChain, settlementChain = walletChain) => ({
79
- walletChain,
80
- walletChainDescriptor: getChainDescriptor(walletChain),
81
- settlementChain,
82
- settlementChainDescriptor: getChainDescriptor(settlementChain),
83
- });
@@ -1,9 +0,0 @@
1
- export declare const EVM_TRANSACTION_SIGNING_UNSUPPORTED = "EVM_TRANSACTION_SIGNING_UNSUPPORTED";
2
- export declare class EvmTransactionSigningUnsupportedError extends Error {
3
- readonly providerName: string;
4
- readonly cause?: unknown | undefined;
5
- readonly code = "EVM_TRANSACTION_SIGNING_UNSUPPORTED";
6
- constructor(providerName: string, cause?: unknown | undefined);
7
- }
8
- export declare const isUnsupportedEvmTransactionSigningError: (error: unknown) => boolean;
9
- export declare const normalizeEvmTransactionSigningError: (providerName: string, error: unknown) => Error;
@@ -1,51 +0,0 @@
1
- export const EVM_TRANSACTION_SIGNING_UNSUPPORTED = "EVM_TRANSACTION_SIGNING_UNSUPPORTED";
2
- export class EvmTransactionSigningUnsupportedError extends Error {
3
- constructor(providerName, cause) {
4
- super(`${providerName} does not support EVM transaction signing`);
5
- this.providerName = providerName;
6
- this.cause = cause;
7
- this.code = EVM_TRANSACTION_SIGNING_UNSUPPORTED;
8
- this.name = "EvmTransactionSigningUnsupportedError";
9
- }
10
- }
11
- const getErrorCode = (error) => {
12
- if (typeof error !== "object" || error === null || !("code" in error))
13
- return undefined;
14
- const { code } = error;
15
- return typeof code === "number" || typeof code === "string" ? code : undefined;
16
- };
17
- const getErrorMessage = (error) => {
18
- if (error instanceof Error)
19
- return error.message;
20
- if (typeof error === "object" && error !== null && "message" in error) {
21
- const { message } = error;
22
- if (typeof message === "string")
23
- return message;
24
- }
25
- return String(error);
26
- };
27
- export const isUnsupportedEvmTransactionSigningError = (error) => {
28
- if (error instanceof EvmTransactionSigningUnsupportedError) {
29
- return true;
30
- }
31
- const code = getErrorCode(error);
32
- if (code === 4200 || code === -32601) {
33
- return true;
34
- }
35
- const message = getErrorMessage(error).toLowerCase();
36
- return (message.includes("eth_signtransaction") &&
37
- (message.includes("unsupported") ||
38
- message.includes("not support") ||
39
- message.includes("not found") ||
40
- message.includes("does not exist") ||
41
- message.includes("unrecognized")));
42
- };
43
- export const normalizeEvmTransactionSigningError = (providerName, error) => {
44
- if (error instanceof Error && !isUnsupportedEvmTransactionSigningError(error)) {
45
- return error;
46
- }
47
- if (isUnsupportedEvmTransactionSigningError(error)) {
48
- return new EvmTransactionSigningUnsupportedError(providerName, error);
49
- }
50
- return error instanceof Error ? error : new Error(String(error));
51
- };
@@ -1,26 +0,0 @@
1
- import EventEmitter from "eventemitter3";
2
- import type { BalanceInfo, WalletSession, WalletState } from "./types.js";
3
- export type WalletEvents = {
4
- "session:changed": [WalletSession | null];
5
- "session:rehydrated": [WalletSession];
6
- "session:expired": [WalletSession];
7
- "session:revoked": [WalletSession];
8
- "balance:changed": [BalanceInfo | null];
9
- "connecting:changed": [boolean];
10
- };
11
- export declare class SessionStore {
12
- private state;
13
- private emitter;
14
- constructor();
15
- getState(): WalletState;
16
- setConnecting(flag: boolean): void;
17
- setSession(session: WalletSession | null): void;
18
- rehydrateSession(session: WalletSession): void;
19
- clearSession(): void;
20
- expireSession(): void;
21
- revokeSession(): void;
22
- setBalance(balance: BalanceInfo | null): void;
23
- on<T extends keyof WalletEvents>(event: T, listener: (...args: WalletEvents[T]) => void): () => EventEmitter<WalletEvents, any>;
24
- private tryRehydrate;
25
- }
26
- export declare const sessionStore: SessionStore;
@@ -1,129 +0,0 @@
1
- import EventEmitter from "eventemitter3";
2
- const STORAGE_KEY = "ab:wallet:session";
3
- function getStorage() {
4
- try {
5
- return typeof localStorage !== "undefined" ? localStorage : null;
6
- }
7
- catch {
8
- return null;
9
- }
10
- }
11
- /** Only persist known JSON-serializable fields; session may contain DOM/React refs or circular refs. */
12
- function persistSession(session) {
13
- const storage = getStorage();
14
- if (!storage)
15
- return;
16
- if (!session) {
17
- storage.removeItem(STORAGE_KEY);
18
- return;
19
- }
20
- const serializable = {
21
- address: session.address,
22
- chain: session.chain,
23
- walletType: session.walletType,
24
- authSource: session.authSource,
25
- sessionId: session.sessionId,
26
- expiresAt: session.expiresAt,
27
- };
28
- if (session.capabilities?.length) {
29
- serializable.capabilities = session.capabilities;
30
- }
31
- try {
32
- storage.setItem(STORAGE_KEY, JSON.stringify(serializable));
33
- }
34
- catch {
35
- storage.removeItem(STORAGE_KEY);
36
- }
37
- }
38
- function readPersistedSession() {
39
- const storage = getStorage();
40
- if (!storage)
41
- return null;
42
- const raw = storage.getItem(STORAGE_KEY);
43
- if (!raw)
44
- return null;
45
- try {
46
- return JSON.parse(raw);
47
- }
48
- catch {
49
- storage.removeItem(STORAGE_KEY);
50
- return null;
51
- }
52
- }
53
- const staleProvider = {
54
- request() {
55
- return Promise.reject(new Error("Session restored from cache. Reconnect your wallet for transactions."));
56
- },
57
- disconnect() {
58
- return Promise.resolve();
59
- },
60
- };
61
- export class SessionStore {
62
- constructor() {
63
- this.state = {
64
- session: null,
65
- balance: null,
66
- isConnecting: false,
67
- };
68
- this.emitter = new EventEmitter();
69
- this.tryRehydrate();
70
- }
71
- getState() {
72
- return { ...this.state };
73
- }
74
- setConnecting(flag) {
75
- this.state.isConnecting = flag;
76
- this.emitter.emit("connecting:changed", flag);
77
- }
78
- setSession(session) {
79
- this.state.session = session;
80
- persistSession(session);
81
- this.emitter.emit("session:changed", session);
82
- }
83
- rehydrateSession(session) {
84
- this.state.session = session;
85
- persistSession(session);
86
- this.emitter.emit("session:changed", session);
87
- this.emitter.emit("session:rehydrated", session);
88
- }
89
- clearSession() {
90
- this.state.session = null;
91
- this.state.balance = null;
92
- persistSession(null);
93
- this.emitter.emit("session:changed", null);
94
- this.emitter.emit("balance:changed", null);
95
- }
96
- expireSession() {
97
- const currentSession = this.state.session;
98
- if (!currentSession)
99
- return;
100
- this.clearSession();
101
- this.emitter.emit("session:expired", currentSession);
102
- }
103
- revokeSession() {
104
- const currentSession = this.state.session;
105
- if (!currentSession)
106
- return;
107
- this.clearSession();
108
- this.emitter.emit("session:revoked", currentSession);
109
- }
110
- setBalance(balance) {
111
- this.state.balance = balance;
112
- this.emitter.emit("balance:changed", balance);
113
- }
114
- on(event, listener) {
115
- this.emitter.on(event, listener);
116
- return () => this.emitter.off(event, listener);
117
- }
118
- tryRehydrate() {
119
- const persisted = readPersistedSession();
120
- if (!persisted)
121
- return;
122
- if (persisted.expiresAt && persisted.expiresAt <= Date.now()) {
123
- persistSession(null);
124
- return;
125
- }
126
- this.state.session = { ...persisted, provider: staleProvider };
127
- }
128
- }
129
- export const sessionStore = new SessionStore();
@@ -1,75 +0,0 @@
1
- import type { SessionCapabilityPolicy, WalletCapability } from "./capabilities.js";
2
- import type { ChainContext } from "./chains.js";
3
- export type SupportedChain = "AB_CORE" | "ETH" | "BSC" | "SOL" | "ETH_TENDERLY" | "BSC_TENDERLY";
4
- export type SupportedToken = "USD1" | "USDC" | "USDT" | "ETH" | "AB";
5
- export type ProviderCategory = "plugin" | "social";
6
- export type WalletType = "injected" | "social" | "smart";
7
- export type WalletAuthSource = "google" | "twitter" | "wallet" | "session";
8
- export type EvmQuantity = string | number | bigint;
9
- export interface EvmAccessListItem {
10
- address: string;
11
- storageKeys?: string[];
12
- }
13
- export interface EvmTransactionRequest {
14
- from?: string;
15
- to?: string;
16
- data?: string;
17
- gas?: EvmQuantity;
18
- gasPrice?: EvmQuantity;
19
- maxFeePerGas?: EvmQuantity;
20
- maxPriorityFeePerGas?: EvmQuantity;
21
- nonce?: EvmQuantity;
22
- value?: EvmQuantity;
23
- type?: EvmQuantity;
24
- chainId?: EvmQuantity;
25
- accessList?: EvmAccessListItem[];
26
- }
27
- export interface WalletProviderRequest {
28
- method: string;
29
- params?: unknown[];
30
- }
31
- export interface WalletProvider {
32
- request<T = unknown>(payload: WalletProviderRequest): Promise<T>;
33
- disconnect(): Promise<void>;
34
- }
35
- export interface WalletConnectArgs {
36
- options?: unknown;
37
- payload?: unknown;
38
- }
39
- export interface WalletAdapter {
40
- id: string;
41
- title: string;
42
- icon?: string;
43
- category?: ProviderCategory;
44
- connect(args?: WalletConnectArgs): Promise<WalletSession>;
45
- disconnect(): Promise<void>;
46
- getProvider(): WalletProvider | null;
47
- /**
48
- * Silently restore a wallet session from persisted data without user interaction.
49
- * Returns a fresh session if the wallet can be reconnected, or null otherwise.
50
- */
51
- reconnect?(persistedSession: WalletSession): Promise<WalletSession | null>;
52
- }
53
- export interface WalletSession {
54
- address: string;
55
- chain: SupportedChain;
56
- provider: WalletProvider;
57
- walletType?: WalletType;
58
- authSource?: WalletAuthSource;
59
- sessionId?: string;
60
- expiresAt?: number;
61
- capabilities?: WalletCapability[];
62
- sessionData?: unknown;
63
- chainContext?: ChainContext;
64
- capabilityPolicy?: SessionCapabilityPolicy;
65
- }
66
- export interface BalanceInfo {
67
- formatted: string;
68
- symbol: SupportedToken;
69
- wei: bigint;
70
- }
71
- export interface WalletState {
72
- session: WalletSession | null;
73
- balance: BalanceInfo | null;
74
- isConnecting: boolean;
75
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,29 +0,0 @@
1
- import { type WalletCapability } from "./capabilities.js";
2
- import type { EvmTransactionRequest, WalletAdapter, WalletConnectArgs, WalletProviderRequest, WalletSession } from "./types.js";
3
- export declare class WalletConnector {
4
- private adapters;
5
- private currentAdapterId;
6
- constructor(adapters: WalletAdapter[]);
7
- private getAdapterById;
8
- private getCurrentAdapter;
9
- private clearActiveSession;
10
- private requireActiveSession;
11
- connect(adapterId: string, args?: WalletConnectArgs): Promise<WalletSession>;
12
- disconnect(): Promise<void>;
13
- rehydrateSession(adapterId: string, session: WalletSession): WalletSession;
14
- /**
15
- * Attempt to silently reconnect a wallet whose session was rehydrated
16
- * from localStorage. Uses the adapter's `reconnect()` if available,
17
- * falling back to `connect()` for backward compatibility.
18
- *
19
- * Returns the restored session on success, or `null` if reconnection
20
- * is not possible (e.g. wallet extension removed, social session expired).
21
- */
22
- tryAutoReconnect(): Promise<WalletSession | null>;
23
- supportsCapability(capability: WalletCapability): boolean;
24
- requestCurrentProvider<T = unknown>(payload: WalletProviderRequest): Promise<T>;
25
- sendEvmTransaction(transaction: EvmTransactionRequest): Promise<string>;
26
- signEvmTransaction(transaction: EvmTransactionRequest): Promise<string>;
27
- signMessage(message: string): Promise<string>;
28
- signTypedData(typedData: Record<string, unknown>): Promise<string>;
29
- }