@parity/product-sdk 0.6.0 → 0.7.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/dist/address/index.d.ts +2 -2
- package/dist/{chunk-6W3TCR3W.js → chunk-JC4RBXLY.js} +27 -25
- package/dist/chunk-JC4RBXLY.js.map +1 -0
- package/dist/chunk-JVJ552RU.js +3 -0
- package/dist/{chunk-XSKBA5SR.js.map → chunk-JVJ552RU.js.map} +1 -1
- package/dist/cloud-storage/index.d.ts +1 -0
- package/dist/cloud-storage/index.js +3 -0
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +2 -2
- package/dist/identity/index.js.map +1 -1
- package/dist/index.d.ts +15 -15
- package/dist/index.js +4 -4
- package/dist/local-storage/index.d.ts +1 -0
- package/dist/local-storage/index.js +3 -0
- package/dist/react/index.d.ts +8 -8
- package/dist/react/index.js +8 -8
- package/dist/react/index.js.map +1 -1
- package/dist/{types-DVpAr2JN.d.ts → types-AjDV1BTd.d.ts} +17 -17
- package/package.json +16 -16
- package/src/address/index.ts +2 -0
- package/src/chain/index.ts +2 -0
- package/src/cloud-storage/index.ts +8 -0
- package/src/contracts/index.ts +2 -0
- package/src/core/createApp.ts +51 -43
- package/src/core/index.ts +2 -0
- package/src/core/logger.ts +2 -0
- package/src/core/types.ts +18 -16
- package/src/crypto/index.ts +2 -0
- package/src/host/index.ts +2 -0
- package/src/identity/dotns.ts +2 -0
- package/src/identity/index.ts +2 -0
- package/src/identity/product-account.ts +2 -0
- package/src/identity/types.ts +2 -0
- package/src/index.ts +7 -5
- package/src/local-storage/index.ts +8 -0
- package/src/react/context.ts +3 -1
- package/src/react/index.ts +5 -3
- package/src/react/provider.tsx +2 -0
- package/src/react/useChain.ts +2 -0
- package/src/react/{useStorage.ts → useLocalStorage.ts} +10 -8
- package/src/react/useWallet.ts +2 -0
- package/src/wallet/index.ts +2 -0
- package/dist/bulletin/index.d.ts +0 -1
- package/dist/bulletin/index.js +0 -3
- package/dist/chunk-6W3TCR3W.js.map +0 -1
- package/dist/chunk-XSKBA5SR.js +0 -3
- package/dist/storage/index.d.ts +0 -1
- package/dist/storage/index.js +0 -3
- package/src/bulletin/index.ts +0 -6
- package/src/storage/index.ts +0 -6
- /package/dist/{bulletin → cloud-storage}/index.js.map +0 -0
- /package/dist/{storage → local-storage}/index.js.map +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LogLevel } from '@parity/product-sdk-logger';
|
|
2
|
-
import {
|
|
2
|
+
import { CloudStorageEnvironment } from '@parity/product-sdk-cloud-storage';
|
|
3
3
|
import { ChainClient } from '@parity/product-sdk-chain-client';
|
|
4
4
|
import { ChainDefinition, TypedApi, PolkadotClient } from 'polkadot-api';
|
|
5
5
|
|
|
@@ -7,10 +7,10 @@ import { ChainDefinition, TypedApi, PolkadotClient } from 'polkadot-api';
|
|
|
7
7
|
* Core types for @parity/product-sdk
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
interface
|
|
12
|
-
/**
|
|
13
|
-
environment:
|
|
10
|
+
/** Cloud Storage configuration options */
|
|
11
|
+
interface CloudStorageConfig {
|
|
12
|
+
/** Cloud Storage environment to connect to */
|
|
13
|
+
environment: CloudStorageEnvironment;
|
|
14
14
|
}
|
|
15
15
|
/** Configuration for createApp */
|
|
16
16
|
interface AppConfig {
|
|
@@ -19,11 +19,11 @@ interface AppConfig {
|
|
|
19
19
|
/** Log level for SDK operations (default: 'info') */
|
|
20
20
|
logLevel?: LogLevel;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Cloud Storage configuration.
|
|
23
23
|
* - Omit or pass config object to enable (default: { environment: "paseo" })
|
|
24
|
-
* - Pass `false` to disable
|
|
24
|
+
* - Pass `false` to disable cloud storage initialization
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
cloudStorage?: CloudStorageConfig | false;
|
|
27
27
|
}
|
|
28
28
|
/** Wallet API exposed by the SDK */
|
|
29
29
|
interface WalletApi {
|
|
@@ -51,7 +51,7 @@ interface WalletApi {
|
|
|
51
51
|
createProof(message: Uint8Array): Promise<Uint8Array>;
|
|
52
52
|
}
|
|
53
53
|
/** Storage API exposed by the SDK */
|
|
54
|
-
interface
|
|
54
|
+
interface LocalStorageApi {
|
|
55
55
|
/** Get a value by key */
|
|
56
56
|
get(key: string): Promise<string | null>;
|
|
57
57
|
/** Set a value by key */
|
|
@@ -107,10 +107,10 @@ interface ChainApi {
|
|
|
107
107
|
*/
|
|
108
108
|
destroyAll(): void;
|
|
109
109
|
}
|
|
110
|
-
/**
|
|
111
|
-
interface
|
|
110
|
+
/** Cloud Storage API exposed by the SDK */
|
|
111
|
+
interface CloudStorageApi {
|
|
112
112
|
/**
|
|
113
|
-
* Upload data to
|
|
113
|
+
* Upload data to the Cloud.
|
|
114
114
|
*
|
|
115
115
|
* Requires a wallet to be connected and an account selected. Throws
|
|
116
116
|
* "No signer available …" otherwise.
|
|
@@ -129,12 +129,12 @@ interface BulletinApi {
|
|
|
129
129
|
interface App {
|
|
130
130
|
/** Wallet/signing operations */
|
|
131
131
|
wallet: WalletApi;
|
|
132
|
-
/** Key-value storage operations */
|
|
133
|
-
|
|
132
|
+
/** Local Key-value storage operations */
|
|
133
|
+
localStorage: LocalStorageApi;
|
|
134
134
|
/** Chain interaction operations */
|
|
135
135
|
chain: ChainApi;
|
|
136
|
-
/**
|
|
137
|
-
|
|
136
|
+
/** Cloud Storage operations (null if disabled via config) */
|
|
137
|
+
cloudStorage: CloudStorageApi | null;
|
|
138
138
|
/** Get app configuration */
|
|
139
139
|
getAppInfo(): AppConfig;
|
|
140
140
|
}
|
|
@@ -148,4 +148,4 @@ interface Account {
|
|
|
148
148
|
source: string;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
export type { App as A,
|
|
151
|
+
export type { App as A, ChainApi as C, LocalStorageApi as L, WalletApi as W, Account as a, AppConfig as b, CloudStorageApi as c, CloudStorageConfig as d };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parity/product-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Unified SDK for building products in the Polkadot ecosystem - umbrella package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"import": "./dist/address/index.js",
|
|
17
17
|
"types": "./dist/address/index.d.ts"
|
|
18
18
|
},
|
|
19
|
-
"./
|
|
20
|
-
"import": "./dist/
|
|
21
|
-
"types": "./dist/
|
|
19
|
+
"./cloud-storage": {
|
|
20
|
+
"import": "./dist/cloud-storage/index.js",
|
|
21
|
+
"types": "./dist/cloud-storage/index.d.ts"
|
|
22
22
|
},
|
|
23
23
|
"./chain": {
|
|
24
24
|
"import": "./dist/chain/index.js",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"import": "./dist/react/index.js",
|
|
49
49
|
"types": "./dist/react/index.d.ts"
|
|
50
50
|
},
|
|
51
|
-
"./storage": {
|
|
52
|
-
"import": "./dist/storage/index.js",
|
|
53
|
-
"types": "./dist/storage/index.d.ts"
|
|
51
|
+
"./local-storage": {
|
|
52
|
+
"import": "./dist/local-storage/index.js",
|
|
53
|
+
"types": "./dist/local-storage/index.d.ts"
|
|
54
54
|
},
|
|
55
55
|
"./wallet": {
|
|
56
56
|
"import": "./dist/wallet/index.js",
|
|
@@ -64,16 +64,16 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"polkadot-api": "^2.1.2",
|
|
66
66
|
"@parity/product-sdk-address": "0.1.1",
|
|
67
|
-
"@parity/product-sdk-
|
|
68
|
-
"@parity/product-sdk-
|
|
67
|
+
"@parity/product-sdk-cloud-storage": "0.5.1",
|
|
68
|
+
"@parity/product-sdk-chain-client": "0.5.1",
|
|
69
|
+
"@parity/product-sdk-contracts": "0.6.0",
|
|
69
70
|
"@parity/product-sdk-crypto": "0.1.1",
|
|
70
|
-
"@parity/product-sdk-host": "0.
|
|
71
|
-
"@parity/product-sdk-
|
|
72
|
-
"@parity/product-sdk-keys": "0.3.0",
|
|
71
|
+
"@parity/product-sdk-host": "0.5.0",
|
|
72
|
+
"@parity/product-sdk-keys": "0.3.1",
|
|
73
73
|
"@parity/product-sdk-logger": "0.1.1",
|
|
74
|
-
"@parity/product-sdk-signer": "0.
|
|
75
|
-
"@parity/product-sdk-
|
|
76
|
-
"@parity/product-sdk-
|
|
74
|
+
"@parity/product-sdk-signer": "0.4.0",
|
|
75
|
+
"@parity/product-sdk-tx": "0.2.5",
|
|
76
|
+
"@parity/product-sdk-local-storage": "0.2.0"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"react": "^18.0.0 || ^19.0.0"
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
],
|
|
100
100
|
"license": "Apache-2.0",
|
|
101
101
|
"scripts": {
|
|
102
|
-
"build": "tsup",
|
|
102
|
+
"build": "NODE_OPTIONS=--max-old-space-size=8192 tsup",
|
|
103
103
|
"clean": "rm -rf dist"
|
|
104
104
|
}
|
|
105
105
|
}
|
package/src/address/index.ts
CHANGED
package/src/chain/index.ts
CHANGED
package/src/contracts/index.ts
CHANGED
package/src/core/createApp.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
// Copyright 2026 Parity Technologies (UK) Ltd.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
1
3
|
/**
|
|
2
4
|
* createApp - Main entry point for the Product SDK
|
|
3
5
|
*
|
|
4
|
-
* Creates an App instance with wallet, storage, chain, and
|
|
6
|
+
* Creates an App instance with wallet, storage, chain, and cloud storage APIs.
|
|
5
7
|
*/
|
|
6
8
|
|
|
7
9
|
import type { ChainDefinition } from "polkadot-api";
|
|
@@ -9,15 +11,19 @@ import type {
|
|
|
9
11
|
App,
|
|
10
12
|
AppConfig,
|
|
11
13
|
WalletApi,
|
|
12
|
-
StorageApi,
|
|
13
14
|
ChainApi,
|
|
14
|
-
BulletinApi,
|
|
15
15
|
Account,
|
|
16
|
+
CloudStorageApi,
|
|
17
|
+
LocalStorageApi,
|
|
16
18
|
} from "./types.js";
|
|
17
19
|
import { configure, createLogger } from "@parity/product-sdk-logger";
|
|
18
|
-
import {
|
|
20
|
+
import { createLocalKvStore } from "@parity/product-sdk-local-storage";
|
|
19
21
|
import { SignerManager } from "@parity/product-sdk-signer";
|
|
20
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
CloudStorageClient,
|
|
24
|
+
calculateCid,
|
|
25
|
+
createLazySigner,
|
|
26
|
+
} from "@parity/product-sdk-cloud-storage";
|
|
21
27
|
import {
|
|
22
28
|
createChainClient,
|
|
23
29
|
getClient,
|
|
@@ -37,33 +43,33 @@ const log = createLogger("app");
|
|
|
37
43
|
* ```ts
|
|
38
44
|
* import { createApp } from '@parity/product-sdk';
|
|
39
45
|
*
|
|
40
|
-
* // Default:
|
|
46
|
+
* // Default: cloud storage enabled with paseo environment
|
|
41
47
|
* const app = await createApp({
|
|
42
48
|
* name: 'my-app',
|
|
43
49
|
* logLevel: 'info',
|
|
44
50
|
* });
|
|
45
51
|
*
|
|
46
|
-
* // Custom
|
|
52
|
+
* // Custom cloud storage environment
|
|
47
53
|
* const prodApp = await createApp({
|
|
48
54
|
* name: 'my-app',
|
|
49
|
-
*
|
|
55
|
+
* cloudStorage: { environment: 'polkadot' },
|
|
50
56
|
* });
|
|
51
57
|
*
|
|
52
|
-
* // Disable
|
|
53
|
-
* const
|
|
58
|
+
* // Disable cloud storage entirely
|
|
59
|
+
* const noCloudStorageApp = await createApp({
|
|
54
60
|
* name: 'my-app',
|
|
55
|
-
*
|
|
61
|
+
* cloudStorage: false,
|
|
56
62
|
* });
|
|
57
63
|
*
|
|
58
64
|
* // Connect wallet
|
|
59
65
|
* const { accounts } = await app.wallet.connect();
|
|
60
66
|
*
|
|
61
67
|
* // Use storage
|
|
62
|
-
* await app.
|
|
68
|
+
* await app.localStorage.set('key', 'value');
|
|
63
69
|
*
|
|
64
|
-
* // Use
|
|
65
|
-
* if (app.
|
|
66
|
-
* const cid = await app.
|
|
70
|
+
* // Use cloud storage (check for null if it might be disabled)
|
|
71
|
+
* if (app.cloudStorage) {
|
|
72
|
+
* const cid = await app.cloudStorage.upload('hello world');
|
|
67
73
|
* }
|
|
68
74
|
* ```
|
|
69
75
|
*/
|
|
@@ -76,44 +82,46 @@ export async function createApp(config: AppConfig): Promise<App> {
|
|
|
76
82
|
log.info("Creating Product SDK app", { name: config.name });
|
|
77
83
|
|
|
78
84
|
// Initialize storage (container-only - will throw if not in container)
|
|
79
|
-
const
|
|
85
|
+
const localKvStore = await createLocalKvStore({ prefix: config.name });
|
|
80
86
|
|
|
81
87
|
// Initialize signer manager
|
|
82
88
|
const signerManager = new SignerManager({
|
|
83
89
|
dappName: config.name,
|
|
84
90
|
});
|
|
85
91
|
|
|
86
|
-
// Initialize
|
|
92
|
+
// Initialize cloud storage client (configurable, defaults to paseo).
|
|
87
93
|
//
|
|
88
|
-
// The signer is wrapped lazily so the
|
|
94
|
+
// The signer is wrapped lazily so the cloud storage client can be built before
|
|
89
95
|
// an account is selected. Uploads will throw a clear error if no signer
|
|
90
96
|
// is available at submission time. Reads (fetch / fetchJson) don't need
|
|
91
97
|
// a signer and work regardless.
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
typeof config.
|
|
95
|
-
const
|
|
96
|
-
? await
|
|
97
|
-
environment:
|
|
98
|
+
const cloudStorageEnabled = config.cloudStorage !== false;
|
|
99
|
+
const cloudStorageEnvironment =
|
|
100
|
+
typeof config.cloudStorage === "object" ? config.cloudStorage.environment : "paseo";
|
|
101
|
+
const cloudStorageClient = cloudStorageEnabled
|
|
102
|
+
? await CloudStorageClient.create({
|
|
103
|
+
environment: cloudStorageEnvironment,
|
|
98
104
|
signer: createLazySigner(() => signerManager.getSigner()),
|
|
99
105
|
})
|
|
100
106
|
: null;
|
|
101
107
|
|
|
102
|
-
if (
|
|
103
|
-
log.debug("
|
|
108
|
+
if (cloudStorageEnabled) {
|
|
109
|
+
log.debug("Cloud Storage client (Bulletin) initialized", {
|
|
110
|
+
environment: cloudStorageEnvironment,
|
|
111
|
+
});
|
|
104
112
|
} else {
|
|
105
|
-
log.debug("
|
|
113
|
+
log.debug("Cloud Storage client disabled");
|
|
106
114
|
}
|
|
107
115
|
|
|
108
116
|
// Create storage API adapter
|
|
109
|
-
const
|
|
110
|
-
get: (key) =>
|
|
111
|
-
set: (key, value) =>
|
|
112
|
-
getJSON: <T>(key: string) =>
|
|
113
|
-
setJSON: <T>(key: string, value: T) =>
|
|
114
|
-
remove: (key) =>
|
|
117
|
+
const localStorageApi: LocalStorageApi = {
|
|
118
|
+
get: (key) => localKvStore.get(key),
|
|
119
|
+
set: (key, value) => localKvStore.set(key, value),
|
|
120
|
+
getJSON: <T>(key: string) => localKvStore.getJSON<T>(key),
|
|
121
|
+
setJSON: <T>(key: string, value: T) => localKvStore.setJSON(key, value),
|
|
122
|
+
remove: (key) => localKvStore.remove(key),
|
|
115
123
|
clear: async () => {
|
|
116
|
-
//
|
|
124
|
+
// LocalKvStore doesn't have clear - this is a no-op
|
|
117
125
|
log.debug("clear() is not supported in container storage mode");
|
|
118
126
|
},
|
|
119
127
|
};
|
|
@@ -153,27 +161,27 @@ export async function createApp(config: AppConfig): Promise<App> {
|
|
|
153
161
|
},
|
|
154
162
|
};
|
|
155
163
|
|
|
156
|
-
// Create
|
|
157
|
-
const
|
|
164
|
+
// Create Cloud Storage API adapter (null if disabled)
|
|
165
|
+
const cloudStorageApi: CloudStorageApi | null = cloudStorageClient
|
|
158
166
|
? {
|
|
159
167
|
upload: async (data) => {
|
|
160
168
|
const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
161
169
|
// Explicitly request a DAG-PB manifest so chunked uploads always
|
|
162
170
|
// resolve to a single root CID. Without this, AsyncBulletinClient
|
|
163
171
|
// can return `result.cid: undefined` for chunked-without-manifest
|
|
164
|
-
// uploads — but
|
|
172
|
+
// uploads — but CloudStorageApi.upload promises a string return, and
|
|
165
173
|
// app consumers expect a CID they can hand to `fetch(cid)`. Keep
|
|
166
174
|
// the defensive null-check below as belt-and-braces in case the
|
|
167
175
|
// upstream contract shifts.
|
|
168
|
-
const result = await
|
|
176
|
+
const result = await cloudStorageClient.store(bytes).withManifest(true).send();
|
|
169
177
|
if (!result.cid) {
|
|
170
178
|
throw new Error(
|
|
171
|
-
"
|
|
179
|
+
"Cloud storage upload returned no CID despite .withManifest(true). Upstream contract may have shifted — file an issue.",
|
|
172
180
|
);
|
|
173
181
|
}
|
|
174
182
|
return result.cid.toString();
|
|
175
183
|
},
|
|
176
|
-
fetch: (cid) =>
|
|
184
|
+
fetch: (cid) => cloudStorageClient.fetchBytes(cid),
|
|
177
185
|
computeCid: async (data) => {
|
|
178
186
|
const bytes = typeof data === "string" ? new TextEncoder().encode(data) : data;
|
|
179
187
|
const cid = await calculateCid(bytes);
|
|
@@ -184,14 +192,14 @@ export async function createApp(config: AppConfig): Promise<App> {
|
|
|
184
192
|
|
|
185
193
|
log.info("Product SDK app created", {
|
|
186
194
|
name: config.name,
|
|
187
|
-
|
|
195
|
+
cloudStorage: cloudStorageEnabled ? cloudStorageEnvironment : "disabled",
|
|
188
196
|
});
|
|
189
197
|
|
|
190
198
|
return {
|
|
191
199
|
wallet: walletApi,
|
|
192
|
-
|
|
200
|
+
localStorage: localStorageApi,
|
|
193
201
|
chain: chainApi,
|
|
194
|
-
|
|
202
|
+
cloudStorage: cloudStorageApi,
|
|
195
203
|
getAppInfo: () => ({ ...config }),
|
|
196
204
|
};
|
|
197
205
|
}
|
package/src/core/index.ts
CHANGED
package/src/core/logger.ts
CHANGED
package/src/core/types.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
+
// Copyright 2026 Parity Technologies (UK) Ltd.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
1
3
|
/**
|
|
2
4
|
* Core types for @parity/product-sdk
|
|
3
5
|
*/
|
|
4
6
|
|
|
5
7
|
import type { LogLevel } from "@parity/product-sdk-logger";
|
|
6
|
-
import type {
|
|
8
|
+
import type { CloudStorageEnvironment } from "@parity/product-sdk-cloud-storage";
|
|
7
9
|
import type { ChainClient } from "@parity/product-sdk-chain-client";
|
|
8
10
|
import type { ChainDefinition, TypedApi, PolkadotClient } from "polkadot-api";
|
|
9
11
|
|
|
10
12
|
export type { LogLevel };
|
|
11
13
|
export type { ChainClient };
|
|
12
14
|
|
|
13
|
-
/**
|
|
14
|
-
export interface
|
|
15
|
-
/**
|
|
16
|
-
environment:
|
|
15
|
+
/** Cloud Storage configuration options */
|
|
16
|
+
export interface CloudStorageConfig {
|
|
17
|
+
/** Cloud Storage environment to connect to */
|
|
18
|
+
environment: CloudStorageEnvironment;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
/** Configuration for createApp */
|
|
@@ -23,11 +25,11 @@ export interface AppConfig {
|
|
|
23
25
|
/** Log level for SDK operations (default: 'info') */
|
|
24
26
|
logLevel?: LogLevel;
|
|
25
27
|
/**
|
|
26
|
-
*
|
|
28
|
+
* Cloud Storage configuration.
|
|
27
29
|
* - Omit or pass config object to enable (default: { environment: "paseo" })
|
|
28
|
-
* - Pass `false` to disable
|
|
30
|
+
* - Pass `false` to disable cloud storage initialization
|
|
29
31
|
*/
|
|
30
|
-
|
|
32
|
+
cloudStorage?: CloudStorageConfig | false;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
/** Wallet API exposed by the SDK */
|
|
@@ -55,7 +57,7 @@ export interface WalletApi {
|
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
/** Storage API exposed by the SDK */
|
|
58
|
-
export interface
|
|
60
|
+
export interface LocalStorageApi {
|
|
59
61
|
/** Get a value by key */
|
|
60
62
|
get(key: string): Promise<string | null>;
|
|
61
63
|
/** Set a value by key */
|
|
@@ -117,10 +119,10 @@ export interface ChainApi {
|
|
|
117
119
|
destroyAll(): void;
|
|
118
120
|
}
|
|
119
121
|
|
|
120
|
-
/**
|
|
121
|
-
export interface
|
|
122
|
+
/** Cloud Storage API exposed by the SDK */
|
|
123
|
+
export interface CloudStorageApi {
|
|
122
124
|
/**
|
|
123
|
-
* Upload data to
|
|
125
|
+
* Upload data to the Cloud.
|
|
124
126
|
*
|
|
125
127
|
* Requires a wallet to be connected and an account selected. Throws
|
|
126
128
|
* "No signer available …" otherwise.
|
|
@@ -140,12 +142,12 @@ export interface BulletinApi {
|
|
|
140
142
|
export interface App {
|
|
141
143
|
/** Wallet/signing operations */
|
|
142
144
|
wallet: WalletApi;
|
|
143
|
-
/** Key-value storage operations */
|
|
144
|
-
|
|
145
|
+
/** Local Key-value storage operations */
|
|
146
|
+
localStorage: LocalStorageApi;
|
|
145
147
|
/** Chain interaction operations */
|
|
146
148
|
chain: ChainApi;
|
|
147
|
-
/**
|
|
148
|
-
|
|
149
|
+
/** Cloud Storage operations (null if disabled via config) */
|
|
150
|
+
cloudStorage: CloudStorageApi | null;
|
|
149
151
|
/** Get app configuration */
|
|
150
152
|
getAppInfo(): AppConfig;
|
|
151
153
|
}
|
package/src/crypto/index.ts
CHANGED
package/src/host/index.ts
CHANGED
package/src/identity/dotns.ts
CHANGED
package/src/identity/index.ts
CHANGED
package/src/identity/types.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Copyright 2026 Parity Technologies (UK) Ltd.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
1
3
|
/**
|
|
2
4
|
* @parity/product-sdk
|
|
3
5
|
*
|
|
@@ -16,7 +18,7 @@
|
|
|
16
18
|
* const { accounts } = await app.wallet.connect();
|
|
17
19
|
*
|
|
18
20
|
* // Use storage
|
|
19
|
-
* await app.
|
|
21
|
+
* await app.localStorage.set('key', 'value');
|
|
20
22
|
* ```
|
|
21
23
|
*
|
|
22
24
|
* @packageDocumentation
|
|
@@ -30,9 +32,9 @@ export type {
|
|
|
30
32
|
AppConfig,
|
|
31
33
|
LogLevel,
|
|
32
34
|
WalletApi,
|
|
33
|
-
|
|
35
|
+
LocalStorageApi,
|
|
34
36
|
ChainApi,
|
|
35
|
-
|
|
37
|
+
CloudStorageApi,
|
|
36
38
|
Account,
|
|
37
39
|
ChainClient,
|
|
38
40
|
ChainDefinition,
|
|
@@ -45,5 +47,5 @@ export type { LogEntry, LogHandler, LoggerConfig, Logger } from "./core/logger.j
|
|
|
45
47
|
export { isInsideContainer, isInsideContainerSync } from "@parity/product-sdk-host";
|
|
46
48
|
export { createChainClient } from "@parity/product-sdk-chain-client";
|
|
47
49
|
export { SignerManager } from "@parity/product-sdk-signer";
|
|
48
|
-
export {
|
|
49
|
-
export {
|
|
50
|
+
export { createLocalKvStore } from "@parity/product-sdk-local-storage";
|
|
51
|
+
export { CloudStorageClient, calculateCid } from "@parity/product-sdk-cloud-storage";
|
package/src/react/context.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Copyright 2026 Parity Technologies (UK) Ltd.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
1
3
|
/**
|
|
2
4
|
* React context for Product SDK
|
|
3
5
|
*/
|
|
@@ -17,7 +19,7 @@ export const ProductSDKContext = createContext<App | null>(null);
|
|
|
17
19
|
* ```tsx
|
|
18
20
|
* function MyComponent() {
|
|
19
21
|
* const app = useProductSDK();
|
|
20
|
-
* // Use app.wallet, app.
|
|
22
|
+
* // Use app.wallet, app.localStorage, etc.
|
|
21
23
|
* }
|
|
22
24
|
* ```
|
|
23
25
|
*/
|
package/src/react/index.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Copyright 2026 Parity Technologies (UK) Ltd.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
1
3
|
/**
|
|
2
4
|
* @parity/product-sdk/react
|
|
3
5
|
*
|
|
@@ -6,7 +8,7 @@
|
|
|
6
8
|
*
|
|
7
9
|
* @example
|
|
8
10
|
* ```tsx
|
|
9
|
-
* import { ProductSDKProvider, useWallet,
|
|
11
|
+
* import { ProductSDKProvider, useWallet, useLocalStorage } from '@parity/product-sdk/react';
|
|
10
12
|
*
|
|
11
13
|
* function App() {
|
|
12
14
|
* return (
|
|
@@ -18,7 +20,7 @@
|
|
|
18
20
|
*
|
|
19
21
|
* function MyApp() {
|
|
20
22
|
* const { isConnected, connect, accounts } = useWallet();
|
|
21
|
-
* const [theme, setTheme] =
|
|
23
|
+
* const [theme, setTheme] = useLocalStorage('theme', 'light');
|
|
22
24
|
*
|
|
23
25
|
* // ...
|
|
24
26
|
* }
|
|
@@ -36,6 +38,6 @@ export { ProductSDKContext, useProductSDK } from "./context.js";
|
|
|
36
38
|
export { useWallet } from "./useWallet.js";
|
|
37
39
|
export type { UseWalletState, UseWalletActions, UseWalletReturn } from "./useWallet.js";
|
|
38
40
|
|
|
39
|
-
export {
|
|
41
|
+
export { useLocalStorage, useLocalStorageString } from "./useLocalStorage.js";
|
|
40
42
|
|
|
41
43
|
export { useChain } from "./useChain.js";
|
package/src/react/provider.tsx
CHANGED