@tinycloud/web-sdk 2.11.1-beta.0 → 3.0.0-beta.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.
@@ -0,0 +1,25 @@
1
+ import { type CanonicalTinyCloudIdentity, type ClientSession, type OpenKeyManageKeySigningStrategyOptions } from "@tinycloud/sdk-core";
2
+ import { TinyCloudWeb, type Config } from "./modules/tcw";
3
+ /** Configuration for one OAuth-bound canonical TinyCloud sign-in. */
4
+ export interface EstablishManageKeySessionOptions {
5
+ /** The canonical identity claim returned with a consented OAuth token. */
6
+ identity: CanonicalTinyCloudIdentity | unknown;
7
+ /** OAuth bearer signer configuration. No browser session credentials are used. */
8
+ signer: Omit<OpenKeyManageKeySigningStrategyOptions, "identity">;
9
+ /** TinyCloud client configuration, including the app's requested capabilities. */
10
+ tinycloud: Omit<Config, "provider" | "signStrategy" | "autoBootstrapAccount">;
11
+ }
12
+ /** Result of a completed TinyCloud sign-in using the OAuth canonical key. */
13
+ export interface EstablishManageKeySessionResult {
14
+ client: TinyCloudWeb;
15
+ identity: CanonicalTinyCloudIdentity;
16
+ /** The verified TinyCloud session produced by the public SDK sign-in flow. */
17
+ session: ClientSession;
18
+ }
19
+ /**
20
+ * Sign in through the public TinyCloud web SDK using a consented OAuth
21
+ * canonical key. The identity is token-bound; callers cannot select another
22
+ * address or key ID, and the signer makes cookie-free requests only.
23
+ */
24
+ export declare function establishManageKeySession(options: EstablishManageKeySessionOptions): Promise<EstablishManageKeySessionResult>;
25
+ //# sourceMappingURL=manage-key-session.d.ts.map
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import { TinyCloudNode, type BootstrapWarning, type DelegateToOptions, type DelegateToResult, type ISessionStorage, type SignStrategy, type ValidatedRuntimeDelegation, type UnifiedOwnerRootInput, type UnifiedOwnerRootReceipt } from "@tinycloud/node-sdk/core";
13
13
  import { IKVService, ISQLService, IDuckDbService, IDataVaultService, ISecretsService, ISpaceService, ISpace, ISharingService, ICapabilityKeyRegistry, IHooksService, IEncryptionService, DelegationManager, Delegation, DelegationRevocationReceipt, CreateDelegationParams, Result, DelegationError, ClientSession, Extension, type TelemetryConfig, ISpaceCreationHandler, type Manifest, type ComposedManifestRequest, type AccountService, type ResolvedDelegate, type PermissionEntry, type NetworkDescriptor, type CreateOwnerDelegationParams, type OwnerDelegationReceipt, type RegisterOwnerSharePolicyParams, type OwnerSharePolicyRegistrationReceipt, type LocalNodeIdentityStore, SignInOptions } from "@tinycloud/sdk-core";
14
- import type { providers } from "ethers";
14
+ import { type BrowserProvider, type BrowserWalletProvider } from "../adapters/browserProvider";
15
15
  import { RPCProviders, ClientConfig } from "../providers";
16
16
  import type { NotificationConfig } from "../notifications/types";
17
17
  import type { PortableDelegation, DelegatedAccess } from "@tinycloud/node-sdk/core";
@@ -136,8 +136,10 @@ export interface ShareReceiveResult<T = unknown> {
136
136
  spaceId: string;
137
137
  }
138
138
  export declare class TinyCloudWeb {
139
- /** The Ethereum provider */
140
- provider: providers.Web3Provider;
139
+ /** The connected wallet's raw EIP-1193 provider. */
140
+ provider: BrowserProvider;
141
+ /** The normalized EIP-1193 provider used by the SDK. */
142
+ eip1193Provider: BrowserProvider;
141
143
  /** Supported RPC Providers */
142
144
  static RPCProviders: typeof RPCProviders;
143
145
  /** Underlying TinyCloudNode (created after WASM init) */
@@ -288,7 +290,7 @@ export declare class TinyCloudWeb {
288
290
  accountAuthorizationCid(): string;
289
291
  extend(_extension: Extension): void;
290
292
  cleanup(): void;
291
- connectWallet(provider: providers.ExternalProvider | providers.Web3Provider, options?: {
293
+ connectWallet(provider: BrowserWalletProvider, options?: {
292
294
  spacePrefix?: string;
293
295
  }): void;
294
296
  createDelegation(params: {
@@ -2,13 +2,13 @@
2
2
  * Browser-coupled extension types.
3
3
  *
4
4
  * These types stay in web-sdk because they depend on browser-specific
5
- * APIs (@tinycloud/web-sdk-wasm, ethers Web3Provider, axios).
5
+ * APIs (@tinycloud/web-sdk-wasm, EIP-1193 provider, axios).
6
6
  *
7
7
  * @packageDocumentation
8
8
  */
9
9
  import { tcwSession } from "@tinycloud/web-sdk-wasm";
10
10
  import { AxiosInstance } from "axios";
11
- import { ethers } from "ethers";
11
+ import type { BrowserProvider } from "../adapters/browserProvider";
12
12
  import type { ClientSession, SiweConfig } from "@tinycloud/sdk-core";
13
13
  import type { ClientConfig } from "./config";
14
14
  /** Extra SIWE fields. */
@@ -26,7 +26,7 @@ export interface IConnected {
26
26
  /** List of enabled extensions. */
27
27
  extensions: Extension[];
28
28
  /** Web3 provider. */
29
- provider: ethers.providers.Web3Provider;
29
+ provider: BrowserProvider;
30
30
  /** Promise that is initialized on construction to run the "afterConnect" methods of extensions. */
31
31
  afterConnectHooksPromise: Promise<void>;
32
32
  /** Method to verify if extension is enabled. */
@@ -4,10 +4,13 @@
4
4
  * @packageDocumentation
5
5
  */
6
6
  import { z } from "zod";
7
- import { providers } from "ethers";
8
- import { ConnectionInfo } from "ethers/lib/utils";
9
7
  import type { AxiosRequestConfig } from "axios";
10
8
  import type { ClientSession } from "@tinycloud/sdk-core";
9
+ export type ConnectionInfo = Record<string, unknown>;
10
+ export type Networkish = string | number | {
11
+ chainId: number | string;
12
+ name?: string;
13
+ };
11
14
  /** Enum of supported EthersJS providers. */
12
15
  export declare enum RPCProviders {
13
16
  AlchemyProvider = "alchemy",
@@ -110,13 +113,13 @@ export type AnkrProvider = {
110
113
  export type CustomProvider = {
111
114
  service: RPCProviders.CustomProvider;
112
115
  url?: string | ConnectionInfo;
113
- network?: providers.Networkish;
116
+ network?: Networkish;
114
117
  };
115
118
  /** Generic provider settings. */
116
119
  export type GenericProvider = {
117
120
  service: RPCProviders;
118
121
  url?: string | ConnectionInfo;
119
- network?: providers.Networkish;
122
+ network?: Networkish;
120
123
  apiKey?: string | InfuraProviderProjectSettings;
121
124
  };
122
125
  /** Supported provider types. */
@@ -385,7 +388,7 @@ export declare const GenericProviderSchema: z.ZodObject<{
385
388
  projectSecret?: string;
386
389
  }>]>>;
387
390
  }, "strip", z.ZodTypeAny, {
388
- service?: "alchemy" | "ankr" | "cloudflare" | "custom" | "etherscan" | "infura" | "pocket";
391
+ service?: "custom" | "alchemy" | "ankr" | "cloudflare" | "etherscan" | "infura" | "pocket";
389
392
  apiKey?: string | {
390
393
  projectId?: string;
391
394
  projectSecret?: string;
@@ -393,7 +396,7 @@ export declare const GenericProviderSchema: z.ZodObject<{
393
396
  network?: unknown;
394
397
  url?: unknown;
395
398
  }, {
396
- service?: "alchemy" | "ankr" | "cloudflare" | "custom" | "etherscan" | "infura" | "pocket";
399
+ service?: "custom" | "alchemy" | "ankr" | "cloudflare" | "etherscan" | "infura" | "pocket";
397
400
  apiKey?: string | {
398
401
  projectId?: string;
399
402
  projectSecret?: string;
@@ -3,18 +3,13 @@
3
3
  *
4
4
  * @packageDocumentation
5
5
  */
6
- import { ethers } from "ethers";
7
- import { EnsData, RPCProvider } from "./types";
8
- /**
9
- * @param rpc - RPCProvider
10
- * @returns an ethers provider based on the RPC configuration.
11
- */
12
- export declare const getProvider: (rpc?: RPCProvider) => ethers.providers.BaseProvider;
6
+ import type { EnsData } from "./types";
7
+ import type { BrowserProvider } from "../adapters/browserProvider";
13
8
  /**
14
9
  * Resolves ENS data supported by TCW.
15
- * @param provider - Ethers provider.
10
+ * @param provider - EIP-1193 RPC provider.
16
11
  * @param address - User address.
17
12
  * @returns Object containing ENS data.
18
13
  */
19
- export declare const resolveEns: (provider: ethers.providers.BaseProvider, address: string) => Promise<EnsData>;
14
+ export declare const resolveEns: (provider: BrowserProvider, address: string) => Promise<EnsData>;
20
15
  //# sourceMappingURL=utils.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinycloud/web-sdk",
3
- "version": "2.11.1-beta.0",
3
+ "version": "3.0.0-beta.1",
4
4
  "description": "A set of tools and utilities to help you build your app with TinyCloud.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -41,16 +41,12 @@
41
41
  "test": "jest"
42
42
  },
43
43
  "dependencies": {
44
- "@metamask/detect-provider": "^1.2.0",
45
44
  "@multiformats/multiaddr": "^13.0.1",
46
45
  "@multiformats/multiaddr-to-uri": "^12.0.0",
47
- "@tinycloud/node-sdk": "2.11.1-beta.0",
48
- "@tinycloud/sdk-core": "2.11.1-beta.0",
46
+ "@tinycloud/node-sdk": "3.0.0-beta.1",
47
+ "@tinycloud/sdk-core": "3.0.0-beta.1",
49
48
  "@tinycloud/web-sdk-wasm": "1.7.6",
50
49
  "axios": "^1.7.9",
51
- "ethers": "^5.7.2",
52
- "lodash.merge": "^4.6.2",
53
- "siwe": "^3.0.0",
54
50
  "viem": "^2.45.0",
55
51
  "zod": "^3.22.0"
56
52
  },
@@ -59,7 +55,6 @@
59
55
  "@microsoft/api-documenter": "^7.26.5",
60
56
  "@microsoft/api-extractor": "^7.49.1",
61
57
  "@types/jest": "^30.0.0",
62
- "@types/lodash.merge": "^4.6.9",
63
58
  "@types/node": "^18.19.74",
64
59
  "@types/webpack": "^5.28.5",
65
60
  "@typescript-eslint/eslint-plugin": "^8.57.1",
@@ -1,59 +0,0 @@
1
- import { type Address } from "viem";
2
- import { providers } from "ethers";
3
- export declare const REGISTRY_CONTRACT_ADDRESS: {
4
- 1: string;
5
- 11155111: string;
6
- };
7
- export interface RegistryConfig {
8
- provider: providers.Web3Provider;
9
- }
10
- /**
11
- * Registry provides access to the TinyCloud Registry contract for resolving
12
- * account addresses to their associated node identifiers.
13
- */
14
- export declare class Registry {
15
- provider: providers.Web3Provider;
16
- /**
17
- * Creates a new instance of the Registry class.
18
- *
19
- * @param config - Configuration options for the Registry
20
- * @param config.rpcUrl - The RPC URL to connect to the blockchain
21
- * @param config.contractAddress - The address of the Registry contract
22
- */
23
- constructor(config: RegistryConfig);
24
- /**
25
- * Gets the node identifier associated with an account address.
26
- *
27
- * @param account - The account address to look up
28
- * @returns A Promise containing the node identifier string
29
- *
30
- * @example
31
- * ```ts
32
- * const registry = new Registry({
33
- * rpcUrl: 'https://mainnet.base.org',
34
- * contractAddress: '0x...'
35
- * });
36
- * const node = await registry.getNode('0x1234...');
37
- * console.log(node); // 'my-node-id'
38
- * ```
39
- */
40
- getNode(account: Address): Promise<string>;
41
- addressNode(): Promise<string>;
42
- /**
43
- * Checks if an account has a registered node.
44
- *
45
- * @param account - The account address to check
46
- * @returns A Promise containing a boolean indicating if the account has a node
47
- *
48
- * @example
49
- * ```ts
50
- * const hasNode = await registry.hasNode('0x1234...');
51
- * if (hasNode) {
52
- * const node = await registry.getNode('0x1234...');
53
- * }
54
- * ```
55
- */
56
- hasNode(account: Address): Promise<boolean>;
57
- }
58
- export default Registry;
59
- //# sourceMappingURL=Registry.d.ts.map