@parity/product-sdk 0.0.0-dev.407.1 → 0.0.0-dev.421.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/address/index.d.ts +2 -1
- package/dist/core/index.d.ts +49 -2
- package/dist/index.d.ts +2 -49
- package/dist/nfts/index.d.ts +1 -0
- package/dist/nfts/index.js +3 -0
- package/dist/nfts/index.js.map +1 -0
- package/package.json +18 -13
- package/src/nfts/contract.test.ts +58 -0
- package/src/nfts/index.ts +8 -0
package/dist/address/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export * from '@parity/product-sdk-address';
|
|
2
|
-
import '@parity/product-sdk-cloud-storage';
|
|
3
2
|
import '@parity/product-sdk-chain-client';
|
|
3
|
+
import '@parity/product-sdk-cloud-storage';
|
|
4
4
|
import '@parity/product-sdk-contracts';
|
|
5
5
|
import '@parity/product-sdk-crypto';
|
|
6
6
|
import '@parity/product-sdk-host';
|
|
7
7
|
import '@parity/product-sdk-individuality';
|
|
8
8
|
import '@parity/product-sdk-local-storage';
|
|
9
|
+
import '@parity/product-sdk-nfts';
|
|
9
10
|
import '@parity/product-sdk-renderer';
|
|
10
11
|
import '@parity/product-sdk-signer';
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { createApp } from '../index.js';
|
|
2
1
|
export { LogEntry, LogHandler, LogLevel, Logger, LoggerConfig, configure, createLogger } from '@parity/product-sdk-logger';
|
|
3
|
-
|
|
2
|
+
import { c as AppConfig, b as App } from '../types-BpWw-OJl.js';
|
|
3
|
+
export { A as Account, d as AppInfo, C as ChainApi, a as CloudStorageApi, e as CloudStorageConfig, D as DotNsIdentitySignature, L as LocalStorageApi, S as SignMessageWithDotNsIdentityArgs, W as WalletApi } from '../types-BpWw-OJl.js';
|
|
4
4
|
export { ChainClient } from '@parity/product-sdk-chain-client';
|
|
5
5
|
export { ChainDefinition, PolkadotClient, TypedApi } from 'polkadot-api';
|
|
6
6
|
import '@parity/result';
|
|
@@ -10,3 +10,50 @@ import '@parity/product-sdk-signer';
|
|
|
10
10
|
import '@parity/product-sdk-local-storage';
|
|
11
11
|
import '@parity/product-sdk-cloud-storage';
|
|
12
12
|
import '../dotns-CtmOwVQW.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* createApp - Main entry point for the Product SDK
|
|
16
|
+
*
|
|
17
|
+
* Creates an App instance with wallet, storage, chain, and cloud storage APIs.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Create a new Product SDK app instance
|
|
22
|
+
*
|
|
23
|
+
* @param config - Application configuration
|
|
24
|
+
* @returns App instance with all APIs
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { createApp } from '@parity/product-sdk';
|
|
29
|
+
*
|
|
30
|
+
* // Default: cloud storage enabled with paseo environment
|
|
31
|
+
* const app = await createApp({
|
|
32
|
+
* logLevel: 'info',
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* // Custom cloud storage environment
|
|
36
|
+
* const prodApp = await createApp({
|
|
37
|
+
* cloudStorage: { environment: 'polkadot' },
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // Disable cloud storage entirely
|
|
41
|
+
* const noCloudStorageApp = await createApp({
|
|
42
|
+
* cloudStorage: false,
|
|
43
|
+
* });
|
|
44
|
+
*
|
|
45
|
+
* // Connect wallet
|
|
46
|
+
* const { accounts } = await app.wallet.connect();
|
|
47
|
+
*
|
|
48
|
+
* // Use storage
|
|
49
|
+
* await app.localStorage.set('key', 'value');
|
|
50
|
+
*
|
|
51
|
+
* // Use cloud storage (check for null if it might be disabled)
|
|
52
|
+
* if (app.cloudStorage) {
|
|
53
|
+
* const cid = await app.cloudStorage.upload('hello world');
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare function createApp(config?: AppConfig): Promise<App>;
|
|
58
|
+
|
|
59
|
+
export { App, AppConfig, createApp };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
export { createApp } from './core/index.js';
|
|
1
2
|
export { LogEntry, LogHandler, LogLevel, Logger, LoggerConfig, configure, createLogger } from '@parity/product-sdk-logger';
|
|
2
|
-
|
|
3
|
-
export { A as Account, d as AppInfo, C as ChainApi, a as CloudStorageApi, D as DotNsIdentitySignature, L as LocalStorageApi, S as SignMessageWithDotNsIdentityArgs, W as WalletApi } from './types-BpWw-OJl.js';
|
|
3
|
+
export { A as Account, b as App, c as AppConfig, d as AppInfo, C as ChainApi, a as CloudStorageApi, D as DotNsIdentitySignature, L as LocalStorageApi, S as SignMessageWithDotNsIdentityArgs, W as WalletApi } from './types-BpWw-OJl.js';
|
|
4
4
|
export { Result, err, isErrorOf, ok } from '@parity/result';
|
|
5
5
|
export { SdkError, isSdkError } from '@parity/product-sdk-errors';
|
|
6
6
|
export { isInsideContainer, isInsideContainerSync } from '@parity/product-sdk-host';
|
|
@@ -10,50 +10,3 @@ export { createLocalKvStore } from '@parity/product-sdk-local-storage';
|
|
|
10
10
|
export { CloudStorageClient, calculateCid } from '@parity/product-sdk-cloud-storage';
|
|
11
11
|
export { ChainDefinition, PolkadotClient, TypedApi } from 'polkadot-api';
|
|
12
12
|
import './dotns-CtmOwVQW.js';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* createApp - Main entry point for the Product SDK
|
|
16
|
-
*
|
|
17
|
-
* Creates an App instance with wallet, storage, chain, and cloud storage APIs.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Create a new Product SDK app instance
|
|
22
|
-
*
|
|
23
|
-
* @param config - Application configuration
|
|
24
|
-
* @returns App instance with all APIs
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* import { createApp } from '@parity/product-sdk';
|
|
29
|
-
*
|
|
30
|
-
* // Default: cloud storage enabled with paseo environment
|
|
31
|
-
* const app = await createApp({
|
|
32
|
-
* logLevel: 'info',
|
|
33
|
-
* });
|
|
34
|
-
*
|
|
35
|
-
* // Custom cloud storage environment
|
|
36
|
-
* const prodApp = await createApp({
|
|
37
|
-
* cloudStorage: { environment: 'polkadot' },
|
|
38
|
-
* });
|
|
39
|
-
*
|
|
40
|
-
* // Disable cloud storage entirely
|
|
41
|
-
* const noCloudStorageApp = await createApp({
|
|
42
|
-
* cloudStorage: false,
|
|
43
|
-
* });
|
|
44
|
-
*
|
|
45
|
-
* // Connect wallet
|
|
46
|
-
* const { accounts } = await app.wallet.connect();
|
|
47
|
-
*
|
|
48
|
-
* // Use storage
|
|
49
|
-
* await app.localStorage.set('key', 'value');
|
|
50
|
-
*
|
|
51
|
-
* // Use cloud storage (check for null if it might be disabled)
|
|
52
|
-
* if (app.cloudStorage) {
|
|
53
|
-
* const cid = await app.cloudStorage.upload('hello world');
|
|
54
|
-
* }
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
declare function createApp(config?: AppConfig): Promise<App>;
|
|
58
|
-
|
|
59
|
-
export { App, AppConfig, createApp };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@parity/product-sdk-nfts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parity/product-sdk",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.421.0",
|
|
4
4
|
"description": "Unified SDK for building products in the Polkadot ecosystem - umbrella package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -48,6 +48,10 @@
|
|
|
48
48
|
"import": "./dist/individuality/index.js",
|
|
49
49
|
"types": "./dist/individuality/index.d.ts"
|
|
50
50
|
},
|
|
51
|
+
"./nfts": {
|
|
52
|
+
"import": "./dist/nfts/index.js",
|
|
53
|
+
"types": "./dist/nfts/index.d.ts"
|
|
54
|
+
},
|
|
51
55
|
"./react": {
|
|
52
56
|
"import": "./dist/react/index.js",
|
|
53
57
|
"types": "./dist/react/index.d.ts"
|
|
@@ -75,21 +79,22 @@
|
|
|
75
79
|
],
|
|
76
80
|
"dependencies": {
|
|
77
81
|
"polkadot-api": "^2.1.6",
|
|
78
|
-
"@parity/product-sdk-chain-client": "0.0.0-dev.407.1",
|
|
79
|
-
"@parity/product-sdk-crypto": "0.1.1",
|
|
80
|
-
"@parity/product-sdk-cloud-storage": "0.0.0-dev.407.1",
|
|
81
|
-
"@parity/product-sdk-host": "0.23.0",
|
|
82
82
|
"@parity/product-sdk-address": "0.2.0",
|
|
83
|
-
"@parity/product-sdk-
|
|
84
|
-
"@parity/product-sdk-
|
|
85
|
-
"@parity/product-sdk-
|
|
86
|
-
"@parity/
|
|
83
|
+
"@parity/product-sdk-cloud-storage": "0.0.0-dev.421.0",
|
|
84
|
+
"@parity/product-sdk-chain-client": "0.0.0-dev.421.0",
|
|
85
|
+
"@parity/product-sdk-contracts": "0.0.0-dev.421.0",
|
|
86
|
+
"@parity/product-sdk-crypto": "0.1.1",
|
|
87
|
+
"@parity/product-sdk-host": "0.0.0-dev.421.0",
|
|
88
|
+
"@parity/product-sdk-individuality": "0.0.0-dev.421.0",
|
|
89
|
+
"@parity/product-sdk-keys": "0.0.0-dev.421.0",
|
|
87
90
|
"@parity/product-sdk-errors": "0.2.0",
|
|
88
|
-
"@parity/product-sdk-local-storage": "0.3.13",
|
|
89
|
-
"@parity/product-sdk-renderer": "0.3.0",
|
|
90
|
-
"@parity/product-sdk-tx": "0.4.11",
|
|
91
91
|
"@parity/product-sdk-logger": "0.1.1",
|
|
92
|
-
"@parity/
|
|
92
|
+
"@parity/result": "0.2.0",
|
|
93
|
+
"@parity/product-sdk-nfts": "0.0.0-dev.421.0",
|
|
94
|
+
"@parity/product-sdk-signer": "0.0.0-dev.421.0",
|
|
95
|
+
"@parity/product-sdk-local-storage": "0.0.0-dev.421.0",
|
|
96
|
+
"@parity/product-sdk-tx": "0.0.0-dev.421.0",
|
|
97
|
+
"@parity/product-sdk-renderer": "0.3.0"
|
|
93
98
|
},
|
|
94
99
|
"peerDependencies": {
|
|
95
100
|
"react": "^18.0.0 || ^19.0.0"
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Copyright 2026 Parity Technologies (UK) Ltd.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* Compile-time guard for the chain contract in `@parity/product-sdk-nfts`.
|
|
5
|
+
*
|
|
6
|
+
* That package types its chain parameter structurally, listing the storage
|
|
7
|
+
* entries it needs rather than naming a descriptor — same trade as
|
|
8
|
+
* `IndividualityChain`, and the same gap: a hand-written contract can drift from
|
|
9
|
+
* the real chain silently, because the package's own test doubles satisfy it by
|
|
10
|
+
* construction. See `../individuality/contract.test.ts` for why this assertion
|
|
11
|
+
* has to live in `@parity/product-sdk` to mean anything, and why it checks the
|
|
12
|
+
* sibling's built `dist` rather than its `src`.
|
|
13
|
+
*
|
|
14
|
+
* The `ItemDefs` line below is the one that earned this file. PAPI generates its
|
|
15
|
+
* key as `FixedSizeArray<2, number>` rather than the `[number, number]` tuple it
|
|
16
|
+
* gives `CollectionMetadata` and `ItemMetadata`, because the runtime's metadata
|
|
17
|
+
* declares the key type as an array. The raw storage layout is nonetheless two
|
|
18
|
+
* Twox64Concat segments — a genuine two-key map, verified against live state
|
|
19
|
+
* with `rpc.state_getKeys` — so a prefix scan by collection is sound at the
|
|
20
|
+
* protocol level. Whether PAPI's *typing* admits the one-arg `getEntries` that
|
|
21
|
+
* `NftsChain` asks for is a different question, and this is what answers it.
|
|
22
|
+
*
|
|
23
|
+
* **Paseo only, and that asymmetry is the point.** `devnet-asset-hub` carries
|
|
24
|
+
* neither `Scarcity` nor `NftClaims`, so the negative control below is not a
|
|
25
|
+
* hypothetical: it is the live state of the other supported network.
|
|
26
|
+
*/
|
|
27
|
+
import type { getChainAPI } from "@parity/product-sdk-chain-client";
|
|
28
|
+
import type { NftsChain, NftsCreditsChain } from "@parity/product-sdk-nfts";
|
|
29
|
+
import { expect, test } from "vitest";
|
|
30
|
+
|
|
31
|
+
// The false branch must be `false`, not `never`. `never` is assignable to
|
|
32
|
+
// `true`, so a `never` branch would make the assertion unfalsifiable.
|
|
33
|
+
type Assert<T extends true> = T;
|
|
34
|
+
|
|
35
|
+
type PaseoClient = Awaited<ReturnType<typeof getChainAPI<"paseo">>>;
|
|
36
|
+
type DevnetClient = Awaited<ReturnType<typeof getChainAPI<"devnet">>>;
|
|
37
|
+
|
|
38
|
+
// The test: this alias fails to typecheck if the contract drifts from the
|
|
39
|
+
// descriptor, so it needs no export and no runtime reference.
|
|
40
|
+
type PaseoSatisfiesContract = Assert<PaseoClient extends NftsChain ? true : false>;
|
|
41
|
+
|
|
42
|
+
// The credits read spans both chains the preset carries, so the same client
|
|
43
|
+
// has to satisfy the second contract too.
|
|
44
|
+
type PaseoSatisfiesCredits = Assert<PaseoClient extends NftsCreditsChain ? true : false>;
|
|
45
|
+
|
|
46
|
+
// The negative control, and a real fact about the network rather than a
|
|
47
|
+
// hypothetical: devnet Asset Hub has no `Scarcity` and no `NftClaims`. If
|
|
48
|
+
// `NftsChain` ever stopped constraining, this `@ts-expect-error` would report
|
|
49
|
+
// as unused and the file would fail.
|
|
50
|
+
// @ts-expect-error devnet Asset Hub carries neither pallet
|
|
51
|
+
type DevnetLacksPallets = Assert<DevnetClient extends NftsChain ? true : false>;
|
|
52
|
+
|
|
53
|
+
test("nfts chain contract holds against the paseo descriptor", () => {
|
|
54
|
+
// The assertions above are compile-time. This keeps vitest from reporting
|
|
55
|
+
// the file as having no tests, and documents that a green run means tsc
|
|
56
|
+
// accepted them.
|
|
57
|
+
expect(true).toBe(true);
|
|
58
|
+
});
|