@tinycloud/web-sdk 2.11.0 → 3.0.0-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.
- package/dist/adapters/BrowserENSResolver.d.ts +3 -3
- package/dist/adapters/BrowserWalletSigner.d.ts +7 -8
- package/dist/adapters/browserProvider.d.ts +6 -0
- package/dist/adapters/index.d.ts +1 -0
- package/dist/credentials/browser.d.ts +18 -2
- package/dist/credentials/element.d.ts +42 -0
- package/dist/credentials/index.d.ts +1 -0
- package/dist/credentials/interpreter.d.ts +6 -1
- package/dist/credentials/service.d.ts +2 -1
- package/dist/credentials/types.d.ts +92 -9
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +1 -1
- package/dist/modules/tcw.d.ts +15 -5
- package/dist/providers/extension.d.ts +3 -3
- package/dist/providers/types.d.ts +9 -6
- package/dist/providers/utils.d.ts +4 -9
- package/package.json +3 -8
- package/dist/modules/registry/Registry.d.ts +0 -59
package/dist/modules/tcw.d.ts
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @packageDocumentation
|
|
11
11
|
*/
|
|
12
|
-
import { TinyCloudNode, type BootstrapWarning, type DelegateToOptions, type DelegateToResult, type ISessionStorage, type SignStrategy } from "@tinycloud/node-sdk/core";
|
|
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
|
|
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
|
|
140
|
-
provider:
|
|
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) */
|
|
@@ -275,12 +277,20 @@ export declare class TinyCloudWeb {
|
|
|
275
277
|
get isWalletConnected(): boolean;
|
|
276
278
|
/** Sign protocol bytes with the established session key without exposing key material. */
|
|
277
279
|
signSessionBytes(bytes: Uint8Array): Promise<Uint8Array>;
|
|
280
|
+
createUnifiedOwnerRoot(input: UnifiedOwnerRootInput): Promise<UnifiedOwnerRootReceipt>;
|
|
278
281
|
autoSignCredentialBytes(bytes: Uint8Array): Promise<Uint8Array | undefined>;
|
|
279
282
|
approveCredentialBytes(bytes: Uint8Array): Promise<Uint8Array>;
|
|
283
|
+
activateCompactRuntimeDelegation(input: {
|
|
284
|
+
readonly authorization: string;
|
|
285
|
+
readonly cid: string;
|
|
286
|
+
readonly host: string;
|
|
287
|
+
}): Promise<ValidatedRuntimeDelegation>;
|
|
280
288
|
credentialSpaceOwnerDid(spaceId: string): string;
|
|
289
|
+
/** Root authorization CID of the active session, which {@link session} omits. */
|
|
290
|
+
accountAuthorizationCid(): string;
|
|
281
291
|
extend(_extension: Extension): void;
|
|
282
292
|
cleanup(): void;
|
|
283
|
-
connectWallet(provider:
|
|
293
|
+
connectWallet(provider: BrowserWalletProvider, options?: {
|
|
284
294
|
spacePrefix?: string;
|
|
285
295
|
}): void;
|
|
286
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,
|
|
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 {
|
|
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:
|
|
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?:
|
|
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?:
|
|
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?: "
|
|
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?: "
|
|
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 {
|
|
7
|
-
import {
|
|
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 -
|
|
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:
|
|
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": "
|
|
3
|
+
"version": "3.0.0-beta.0",
|
|
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": "
|
|
48
|
-
"@tinycloud/sdk-core": "
|
|
46
|
+
"@tinycloud/node-sdk": "3.0.0-beta.0",
|
|
47
|
+
"@tinycloud/sdk-core": "3.0.0-beta.0",
|
|
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
|