@dotdm/env 1.0.6 → 2.0.0-dev.1779912670

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,12 @@
1
+ // src/registry.ts
2
+ var PASEO_V2_REGISTRY_ADDRESS = "0xf62c2ece29cd8df2e10040ecfa5a894a5c5d9cb0";
3
+ function getRegistryAddress(name = "paseo") {
4
+ if (name === "paseo" || name === "paseo-next-v2" || name === "paseo-v2") {
5
+ return PASEO_V2_REGISTRY_ADDRESS;
6
+ }
7
+ return PASEO_V2_REGISTRY_ADDRESS;
8
+ }
9
+
10
+ export {
11
+ getRegistryAddress
12
+ };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,11 @@
1
1
  import { ProductSdkEnvironment } from './registry.js';
2
2
  export { getRegistryAddress } from './registry.js';
3
- export { DEFAULT_NODE_URL, REGISTRY_ADDRESS } from '@dotdm/utils';
3
+ export { DEFAULT_NODE_URL } from '@dotdm/utils';
4
4
  import * as polkadot_api from 'polkadot-api';
5
5
  import { PolkadotClient, TypedApi } from 'polkadot-api';
6
6
  import { polkadot_asset_hub } from '@parity/product-sdk-descriptors/polkadot-asset-hub';
7
7
  import { paseo_asset_hub } from '@parity/product-sdk-descriptors/paseo-asset-hub';
8
- import { previewnet_asset_hub } from '@parity/product-sdk-descriptors/previewnet-asset-hub';
9
8
  import { paseo_bulletin } from '@parity/product-sdk-descriptors/paseo-bulletin';
10
- import { previewnet_bulletin } from '@parity/product-sdk-descriptors/previewnet-bulletin';
11
9
  export { ss58Address } from '@polkadot-labs/hdkd-helpers';
12
10
 
13
11
  interface ChainFaucet {
@@ -28,43 +26,36 @@ declare const KNOWN_CHAINS: {
28
26
  readonly assethubUrl: "wss://polkadot-asset-hub-rpc.polkadot.io";
29
27
  readonly bulletinUrl: "wss://polkadot-bulletin-rpc.polkadot.io";
30
28
  readonly ipfsGatewayUrl: "https://polkadot-bulletin-rpc.polkadot.io/ipfs";
31
- readonly registryAddress: "0xae344f7f0f91d3a2176032af2990abcc7606c7d4";
29
+ readonly registryAddress: string;
32
30
  };
33
31
  readonly paseo: {
34
32
  readonly assethubUrl: "wss://paseo-asset-hub-next-rpc.polkadot.io";
35
33
  readonly bulletinUrl: "wss://paseo-bulletin-next-rpc.polkadot.io";
36
34
  readonly ipfsGatewayUrl: "https://paseo-bulletin-next-ipfs.polkadot.io/ipfs";
37
- readonly registryAddress: string | undefined;
35
+ readonly registryAddress: string;
38
36
  readonly productSdkEnvironment: "paseo";
39
37
  readonly faucets: readonly [{
40
38
  readonly label: "Asset Hub";
41
- readonly url: "https://faucet.polkadot.io/";
39
+ readonly url: "https://faucet.polkadot.io/?parachain=1500";
42
40
  }, {
43
41
  readonly label: "Bulletin";
44
42
  readonly url: "https://paritytech.github.io/polkadot-bulletin-chain/authorizations?tab=faucet";
45
43
  }];
46
44
  };
47
- readonly "preview-net": {
48
- readonly assethubUrl: "wss://previewnet.substrate.dev/asset-hub";
49
- readonly bulletinUrl: "wss://paseo-bulletin-next-rpc.polkadot.io";
50
- readonly ipfsGatewayUrl: "https://paseo-bulletin-next-ipfs.polkadot.io/ipfs";
51
- readonly registryAddress: string | undefined;
52
- readonly productSdkEnvironment: "previewnet";
53
- };
54
45
  readonly local: {
55
46
  readonly assethubUrl: "ws://127.0.0.1:10020";
56
47
  readonly bulletinUrl: "ws://127.0.0.1:10030";
57
48
  readonly ipfsGatewayUrl: "http://127.0.0.1:8283/ipfs";
58
- readonly registryAddress: "0xae344f7f0f91d3a2176032af2990abcc7606c7d4";
49
+ readonly registryAddress: string;
59
50
  };
60
51
  };
61
52
  type KnownChainName = keyof typeof KNOWN_CHAINS;
62
53
  declare function isKnownChainPreset(name: string): boolean;
63
54
  declare function getChainPreset(name: string): ChainPreset;
64
55
 
65
- type CdmDeployAssetHubDescriptor = typeof paseo_asset_hub | typeof previewnet_asset_hub;
56
+ type CdmDeployAssetHubDescriptor = typeof paseo_asset_hub;
66
57
  type CdmAssetHubDescriptor = CdmDeployAssetHubDescriptor | typeof polkadot_asset_hub;
67
- type CdmBulletinDescriptor = typeof paseo_bulletin | typeof previewnet_bulletin;
58
+ type CdmBulletinDescriptor = typeof paseo_bulletin;
68
59
  type CdmDeployAssetHubApi = TypedApi<CdmDeployAssetHubDescriptor>;
69
60
  type CdmAssetHubApi = TypedApi<CdmAssetHubDescriptor>;
70
61
  type CdmBulletinApi = TypedApi<CdmBulletinDescriptor>;
@@ -74,9 +65,7 @@ type CdmBulletinApi = TypedApi<CdmBulletinDescriptor>;
74
65
  *
75
66
  * Uses `@parity/product-sdk-descriptors` for the chain descriptors so the
76
67
  * resulting `TypedApi` types line up natively with `ContractDeployer`,
77
- * `MetadataPublisher`, and the product-sdk batch/bulletin helpers. TEMPORARY_PATCH! Preview-net
78
- * currently uses its own Asset Hub descriptor and Paseo's Bulletin descriptor
79
- * because CDM stores preview-net metadata on Paseo Bulletin.
68
+ * `MetadataPublisher`, and the product-sdk batch/bulletin helpers.
80
69
  */
81
70
  type CdmChainClient = {
82
71
  assetHub: CdmDeployAssetHubApi;
@@ -118,10 +107,10 @@ interface CdmChainEndpoints {
118
107
  /**
119
108
  * Connect to both Asset Hub and Bulletin over direct WebSocket RPC.
120
109
  *
121
- * Accepts either a supported deploy chain name (`"paseo"`, `"preview-net"`,
122
- * `"local"`) resolved through `getChainPreset`, or explicit URLs. Polkadot
123
- * remains available for Asset-Hub-only install reads, but product-sdk does
124
- * not publish a Polkadot Bulletin descriptor yet.
110
+ * Accepts either a supported deploy chain name (`"paseo"` or `"local"`)
111
+ * resolved through `getChainPreset`, or explicit URLs. Polkadot remains
112
+ * available for Asset-Hub-only install reads, but product-sdk does not publish
113
+ * a Polkadot Bulletin descriptor yet.
125
114
  *
126
115
  * The returned object matches product-sdk's `ChainClient` shape closely enough
127
116
  * for callers to pass either one into CDM APIs. CDM builds this locally because
@@ -143,8 +132,8 @@ interface IpfsGateway {
143
132
  * factory for convenience.
144
133
  *
145
134
  * Product SDK's Bulletin read helpers go through the host preimage
146
- * subscription and do not cover CDM's custom gateway URLs (local,
147
- * preview-net). Keep this thin wrapper for install flows.
135
+ * subscription and do not cover CDM's custom gateway URLs (local/custom).
136
+ * Keep this thin wrapper for install flows.
148
137
  */
149
138
  declare function connectIpfsGateway(url: string): IpfsGateway;
150
139
 
package/dist/index.js CHANGED
@@ -1,10 +1,9 @@
1
1
  import {
2
2
  getRegistryAddress
3
- } from "./chunk-SO33KTRP.js";
3
+ } from "./chunk-HTQLXSDE.js";
4
4
 
5
5
  // src/known_chains.ts
6
6
  import { BULLETIN_RPCS } from "@parity/product-sdk-host";
7
- import { REGISTRY_ADDRESS } from "@dotdm/utils";
8
7
  var PASEO_ASSET_HUB_URL = "wss://paseo-asset-hub-next-rpc.polkadot.io";
9
8
  var PASEO_IPFS_GATEWAY_URL = "https://paseo-bulletin-next-ipfs.polkadot.io/ipfs";
10
9
  var KNOWN_CHAINS = {
@@ -12,7 +11,7 @@ var KNOWN_CHAINS = {
12
11
  assethubUrl: "wss://polkadot-asset-hub-rpc.polkadot.io",
13
12
  bulletinUrl: "wss://polkadot-bulletin-rpc.polkadot.io",
14
13
  ipfsGatewayUrl: "https://polkadot-bulletin-rpc.polkadot.io/ipfs",
15
- registryAddress: REGISTRY_ADDRESS
14
+ registryAddress: getRegistryAddress("polkadot")
16
15
  },
17
16
  paseo: {
18
17
  assethubUrl: PASEO_ASSET_HUB_URL,
@@ -21,33 +20,23 @@ var KNOWN_CHAINS = {
21
20
  registryAddress: getRegistryAddress("paseo"),
22
21
  productSdkEnvironment: "paseo",
23
22
  faucets: [
24
- { label: "Asset Hub", url: "https://faucet.polkadot.io/" },
23
+ { label: "Asset Hub", url: "https://faucet.polkadot.io/?parachain=1500" },
25
24
  {
26
25
  label: "Bulletin",
27
26
  url: "https://paritytech.github.io/polkadot-bulletin-chain/authorizations?tab=faucet"
28
27
  }
29
28
  ]
30
29
  },
31
- "preview-net": {
32
- assethubUrl: "wss://previewnet.substrate.dev/asset-hub",
33
- // TEMPORARY_PATCH! Preview-net's IPFS gateway does not currently serve Bulletin CIDs,
34
- // so CDM stores preview-net metadata on Paseo Bulletin for now.
35
- bulletinUrl: BULLETIN_RPCS.paseo[0],
36
- ipfsGatewayUrl: PASEO_IPFS_GATEWAY_URL,
37
- registryAddress: getRegistryAddress("preview-net"),
38
- productSdkEnvironment: "previewnet"
39
- },
40
30
  local: {
41
31
  assethubUrl: "ws://127.0.0.1:10020",
42
32
  bulletinUrl: "ws://127.0.0.1:10030",
43
33
  ipfsGatewayUrl: "http://127.0.0.1:8283/ipfs",
44
- registryAddress: REGISTRY_ADDRESS
34
+ registryAddress: getRegistryAddress("local")
45
35
  }
46
36
  };
47
37
  function normalizeChainName(name) {
48
- if (name === "previewnet") return "preview-net";
49
38
  if (name === "paseo-next-v2" || name === "paseo-v2") return "paseo";
50
- if (name === "preview-net" || name === "paseo" || name === "polkadot" || name === "local") {
39
+ if (name === "paseo" || name === "polkadot" || name === "local") {
51
40
  return name;
52
41
  }
53
42
  if (name === "custom") return "custom";
@@ -67,7 +56,7 @@ function getChainPreset(name) {
67
56
  }
68
57
 
69
58
  // src/index.ts
70
- import { DEFAULT_NODE_URL, REGISTRY_ADDRESS as REGISTRY_ADDRESS2 } from "@dotdm/utils";
59
+ import { DEFAULT_NODE_URL } from "@dotdm/utils";
71
60
 
72
61
  // src/connection.ts
73
62
  import {
@@ -76,24 +65,21 @@ import {
76
65
  import { getWsProvider } from "polkadot-api/ws";
77
66
  import { polkadot_asset_hub } from "@parity/product-sdk-descriptors/polkadot-asset-hub";
78
67
  import { paseo_asset_hub } from "@parity/product-sdk-descriptors/paseo-asset-hub";
79
- import { previewnet_asset_hub } from "@parity/product-sdk-descriptors/previewnet-asset-hub";
80
68
  import { paseo_bulletin } from "@parity/product-sdk-descriptors/paseo-bulletin";
81
69
  var DEPLOY_CHAIN_DESCRIPTORS = {
82
70
  paseo: { assetHub: paseo_asset_hub, bulletin: paseo_bulletin },
83
- "preview-net": { assetHub: previewnet_asset_hub, bulletin: paseo_bulletin },
84
71
  local: { assetHub: paseo_asset_hub, bulletin: paseo_bulletin }
85
72
  };
86
73
  var ASSET_HUB_DESCRIPTORS = {
87
74
  polkadot: polkadot_asset_hub,
88
75
  paseo: paseo_asset_hub,
89
- "preview-net": previewnet_asset_hub,
90
76
  local: paseo_asset_hub
91
77
  };
92
78
  function resolveExplicitChainName(chainName) {
93
79
  const normalized = normalizeChainName(chainName);
94
80
  if (!normalized) {
95
81
  throw new Error(
96
- `Unknown chain "${chainName}". Valid names: polkadot, paseo, preview-net, local, custom`
82
+ `Unknown chain "${chainName}". Valid names: polkadot, paseo, local, custom`
97
83
  );
98
84
  }
99
85
  return normalized;
@@ -107,7 +93,7 @@ function resolveDeployDescriptors(chainName) {
107
93
  const descriptorChain = normalized && normalized !== "custom" ? normalized : "paseo";
108
94
  if (descriptorChain === "polkadot") {
109
95
  throw new Error(
110
- 'CDM deploy connections are only available for "paseo", "preview-net", and "local"; product-sdk does not publish a Polkadot Bulletin descriptor yet.'
96
+ 'CDM deploy connections are only available for "paseo" and "local"; product-sdk does not publish a Polkadot Bulletin descriptor yet.'
111
97
  );
112
98
  }
113
99
  return DEPLOY_CHAIN_DESCRIPTORS[descriptorChain];
@@ -159,6 +145,14 @@ function createDirectChainClient(chains, rpcs) {
159
145
  }
160
146
  };
161
147
  }
148
+ if (import.meta.vitest) {
149
+ const { test, expect } = import.meta.vitest;
150
+ test("local deploy connections use paseo descriptors", () => {
151
+ const descriptors = resolveDeployDescriptors("local");
152
+ expect(descriptors.assetHub).toBe(paseo_asset_hub);
153
+ expect(descriptors.bulletin).toBe(paseo_bulletin);
154
+ });
155
+ }
162
156
 
163
157
  // src/signer.ts
164
158
  import { getPolkadotSigner } from "polkadot-api/signer";
@@ -191,7 +185,6 @@ function prepareSignerFromSuri(suri) {
191
185
  }
192
186
  export {
193
187
  DEFAULT_NODE_URL,
194
- REGISTRY_ADDRESS2 as REGISTRY_ADDRESS,
195
188
  connectIpfsGateway,
196
189
  createCdmAssetHubClient,
197
190
  createCdmChainClient,
@@ -1,4 +1,4 @@
1
- type ProductSdkEnvironment = "paseo" | "previewnet";
2
- declare function getRegistryAddress(name: string): string | undefined;
1
+ type ProductSdkEnvironment = "paseo";
2
+ declare function getRegistryAddress(name?: string): string;
3
3
 
4
4
  export { type ProductSdkEnvironment, getRegistryAddress };
package/dist/registry.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getRegistryAddress
3
- } from "./chunk-SO33KTRP.js";
3
+ } from "./chunk-HTQLXSDE.js";
4
4
  export {
5
5
  getRegistryAddress
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotdm/env",
3
- "version": "1.0.6",
3
+ "version": "2.0.0-dev.1779912670",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -21,13 +21,13 @@
21
21
  "access": "public"
22
22
  },
23
23
  "dependencies": {
24
- "@parity/product-sdk-descriptors": "^0.4.0",
25
- "@parity/product-sdk-host": "^0.3.0",
24
+ "@parity/product-sdk-descriptors": "^0.5.0",
25
+ "@parity/product-sdk-host": "^0.5.0",
26
26
  "@polkadot-labs/hdkd": "^0.0.26",
27
27
  "@polkadot-labs/hdkd-helpers": "^0.0.27",
28
28
  "polkadot-api": "^2.1.2",
29
29
  "smoldot": "^2.0.40",
30
- "@dotdm/utils": "0.3.2"
30
+ "@dotdm/utils": "0.4.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/node": "^24.10.1",
@@ -1,16 +0,0 @@
1
- // src/registry.ts
2
- var PASEO_V2_REGISTRY_ADDRESS = "0xa7ae171c78f06c248a9b2556c793aa1df5c9173a";
3
- var PREVIEW_NET_REGISTRY_ADDRESS = "0xa7ae171c78f06c248a9b2556c793aa1df5c9173a";
4
- function getRegistryAddress(name) {
5
- if (name === "paseo" || name === "paseo-next-v2" || name === "paseo-v2") {
6
- return PASEO_V2_REGISTRY_ADDRESS;
7
- }
8
- if (name === "preview-net" || name === "previewnet") {
9
- return PREVIEW_NET_REGISTRY_ADDRESS;
10
- }
11
- return void 0;
12
- }
13
-
14
- export {
15
- getRegistryAddress
16
- };