From 8428c611e82893e4c1a0085f76040201589d4082 Mon Sep 17 00:00:00 2001 From: Raphael Flechtner <39338561+rflechtner@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:57:54 +0200 Subject: [PATCH] chore(deps): polkadot-js as peer dependency (#896) * chore: make pjs peer dependency in sub-packages * fix: messed-up imports * chore: make some imports more direct --- packages/asset-credentials/package.json | 19 +++-- packages/chain-helpers/package.json | 21 +++-- packages/config/package.json | 9 ++- packages/credentials/package.json | 17 ++-- .../src/V1/KiltAttestationProofV1.ts | 6 +- packages/did/package.json | 20 +++-- packages/did/src/Did.rpc.ts | 3 +- packages/jsonld-suites/package.json | 2 + packages/legacy-credentials/package.json | 10 ++- packages/sdk-js/package.json | 4 +- packages/types/src/Address.ts | 2 +- packages/utils/package.json | 9 ++- packages/utils/src/Crypto.ts | 3 +- packages/utils/src/Signers.ts | 2 +- yarn.lock | 80 ++++++++++++------- 15 files changed, 132 insertions(+), 75 deletions(-) diff --git a/packages/asset-credentials/package.json b/packages/asset-credentials/package.json index ac4456508..9de4ed46d 100644 --- a/packages/asset-credentials/package.json +++ b/packages/asset-credentials/package.json @@ -35,7 +35,12 @@ }, "peerDependencies": { "@kiltprotocol/augment-api": "^1.0.0", - "@kiltprotocol/type-definitions": "^1.0.0" + "@kiltprotocol/type-definitions": "^1.0.0", + "@polkadot/api": "^12.0.0", + "@polkadot/keyring": "^13.0.0", + "@polkadot/types": "^12.0.0", + "@polkadot/util": "^13.0.0", + "@polkadot/util-crypto": "^13.0.0" }, "dependencies": { "@kiltprotocol/chain-helpers": "workspace:*", @@ -43,15 +48,17 @@ "@kiltprotocol/credentials": "workspace:*", "@kiltprotocol/did": "workspace:*", "@kiltprotocol/types": "workspace:*", - "@kiltprotocol/utils": "workspace:*", - "@polkadot/api": "^12.0.0", - "@polkadot/types": "^12.0.0", - "@polkadot/util": "^13.0.0", - "@polkadot/util-crypto": "^13.0.0" + "@kiltprotocol/utils": "workspace:*" }, "peerDependenciesMeta": { "@kiltprotocol/augment-api": { "optional": true + }, + "@polkadot/types": { + "optional": true + }, + "@polkadot/util": { + "optional": true } } } diff --git a/packages/chain-helpers/package.json b/packages/chain-helpers/package.json index 60443a6f4..e19f8575f 100644 --- a/packages/chain-helpers/package.json +++ b/packages/chain-helpers/package.json @@ -35,21 +35,28 @@ }, "peerDependencies": { "@kiltprotocol/augment-api": "^1.0.0", - "@kiltprotocol/type-definitions": "^1.0.0" + "@kiltprotocol/type-definitions": "^1.0.0", + "@polkadot/api": "^12.0.0", + "@polkadot/api-derive": "^12.0.0", + "@polkadot/keyring": "^13.0.0", + "@polkadot/types": "^12.0.0", + "@polkadot/util": "^13.0.0", + "@polkadot/util-crypto": "^13.0.0" }, "peerDependenciesMeta": { "@kiltprotocol/augment-api": { "optional": true + }, + "@polkadot/api-derive": { + "optional": true + }, + "@polkadot/types": { + "optional": true } }, "dependencies": { "@kiltprotocol/config": "workspace:*", "@kiltprotocol/types": "workspace:*", - "@kiltprotocol/utils": "workspace:*", - "@polkadot/api": "^12.0.0", - "@polkadot/api-derive": "^12.0.0", - "@polkadot/types": "^12.0.0", - "@polkadot/util": "^13.0.0", - "@polkadot/util-crypto": "^13.0.0" + "@kiltprotocol/utils": "workspace:*" } } diff --git a/packages/config/package.json b/packages/config/package.json index 32a0d0a52..434f39abc 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -35,9 +35,16 @@ "rimraf": "^3.0.2", "typescript": "^4.8.3" }, + "peerDependencies": { + "@polkadot/api": "^12.0.0" + }, + "peerDependenciesMeta": { + "@polkadot/api": { + "optional": true + } + }, "dependencies": { "@kiltprotocol/types": "workspace:*", - "@polkadot/api": "^12.0.0", "typescript-logging": "^1.0.0" } } diff --git a/packages/credentials/package.json b/packages/credentials/package.json index 4d976caf3..6dc0c1a69 100644 --- a/packages/credentials/package.json +++ b/packages/credentials/package.json @@ -34,10 +34,6 @@ "rimraf": "^3.0.2", "typescript": "^4.8.3" }, - "peerDependencies": { - "@kiltprotocol/augment-api": "^1.0.0", - "@kiltprotocol/type-definitions": "^1.0.0" - }, "dependencies": { "@kiltprotocol/chain-helpers": "workspace:*", "@kiltprotocol/config": "workspace:*", @@ -48,17 +44,24 @@ "@kiltprotocol/sr25519-jcs-2023": "0.1.0-rc.4", "@kiltprotocol/types": "workspace:*", "@kiltprotocol/utils": "workspace:*", + "@scure/base": "^1.1.0", + "json-pointer": "^0.6.2" + }, + "peerDependencies": { + "@kiltprotocol/augment-api": "^1.0.0", + "@kiltprotocol/type-definitions": "^1.0.0", "@polkadot/api": "^12.0.0", "@polkadot/keyring": "^13.0.0", "@polkadot/types": "^12.0.0", "@polkadot/util": "^13.0.0", - "@polkadot/util-crypto": "^13.0.0", - "@scure/base": "^1.1.0", - "json-pointer": "^0.6.2" + "@polkadot/util-crypto": "^13.0.0" }, "peerDependenciesMeta": { "@kiltprotocol/augment-api": { "optional": true + }, + "@polkadot/api": { + "optional": true } } } diff --git a/packages/credentials/src/V1/KiltAttestationProofV1.ts b/packages/credentials/src/V1/KiltAttestationProofV1.ts index 61e6151f8..f74423ae2 100644 --- a/packages/credentials/src/V1/KiltAttestationProofV1.ts +++ b/packages/credentials/src/V1/KiltAttestationProofV1.ts @@ -8,11 +8,7 @@ import type { ApiPromise } from '@polkadot/api' import type { QueryableStorageEntry } from '@polkadot/api/types' import type { Option, u64, Vec } from '@polkadot/types' -import type { - AccountId, - Extrinsic, - Hash, -} from '@polkadot/types/interfaces/types.js' +import type { AccountId, Extrinsic, Hash } from '@polkadot/types/interfaces' import type { IEventData } from '@polkadot/types/types' import { hexToU8a, diff --git a/packages/did/package.json b/packages/did/package.json index 94460da50..aed15ad82 100644 --- a/packages/did/package.json +++ b/packages/did/package.json @@ -34,23 +34,29 @@ "typescript": "^4.8.3" }, "peerDependencies": { - "@kiltprotocol/augment-api": "^1.0.0" + "@kiltprotocol/augment-api": "^1.0.0", + "@polkadot/api": "^12.0.0", + "@polkadot/keyring": "^13.0.0", + "@polkadot/types": "^12.0.0", + "@polkadot/util": "^13.0.0", + "@polkadot/util-crypto": "^13.0.0" }, "dependencies": { "@digitalbazaar/multikey-context": "^2.0.1", "@digitalbazaar/security-context": "^1.0.1", "@kiltprotocol/config": "workspace:*", "@kiltprotocol/types": "workspace:*", - "@kiltprotocol/utils": "workspace:*", - "@polkadot/api": "^12.0.0", - "@polkadot/keyring": "^13.0.0", - "@polkadot/types": "^12.0.0", - "@polkadot/util": "^13.0.0", - "@polkadot/util-crypto": "^13.0.0" + "@kiltprotocol/utils": "workspace:*" }, "peerDependenciesMeta": { "@kiltprotocol/augment-api": { "optional": true + }, + "@polkadot/api": { + "optional": true + }, + "@polkadot/types": { + "optional": true } } } diff --git a/packages/did/src/Did.rpc.ts b/packages/did/src/Did.rpc.ts index b3c8d6e1b..b076fe6db 100644 --- a/packages/did/src/Did.rpc.ts +++ b/packages/did/src/Did.rpc.ts @@ -5,10 +5,9 @@ * found in the LICENSE file in the root directory of this source tree. */ -import { encodeAddress } from '@polkadot/keyring' +import { encodeAddress, ethereumEncode } from '@polkadot/util-crypto' import type { Option, Vec } from '@polkadot/types' import type { Codec } from '@polkadot/types/types' -import { ethereumEncode } from '@polkadot/util-crypto' import type { DidServiceEndpointsDidEndpoint, diff --git a/packages/jsonld-suites/package.json b/packages/jsonld-suites/package.json index c5313df4f..8219c7cce 100644 --- a/packages/jsonld-suites/package.json +++ b/packages/jsonld-suites/package.json @@ -42,6 +42,8 @@ "@kiltprotocol/type-definitions": "^1.0.0", "@kiltprotocol/types": "workspace:*", "@kiltprotocol/utils": "workspace:*", + "@polkadot/keyring": "^13.0.0", + "@polkadot/types": "^12.0.0", "@polkadot/util": "^13.0.0", "@polkadot/util-crypto": "^13.0.0", "crypto-ld": "^6.0.0" diff --git a/packages/legacy-credentials/package.json b/packages/legacy-credentials/package.json index 813d24c36..389760a96 100644 --- a/packages/legacy-credentials/package.json +++ b/packages/legacy-credentials/package.json @@ -33,15 +33,17 @@ "rimraf": "^3.0.2", "typescript": "^4.8.3" }, - "peerDependencies": { - "@kiltprotocol/type-definitions": "^1.0.0" - }, "dependencies": { "@kiltprotocol/config": "workspace:*", "@kiltprotocol/credentials": "workspace:*", "@kiltprotocol/did": "workspace:*", "@kiltprotocol/types": "workspace:*", - "@kiltprotocol/utils": "workspace:*", + "@kiltprotocol/utils": "workspace:*" + }, + "peerDependencies": { + "@kiltprotocol/type-definitions": "^1.0.0", + "@polkadot/keyring": "^13.0.0", + "@polkadot/types": "^12.0.0", "@polkadot/util": "^13.0.0", "@polkadot/util-crypto": "^13.0.0" } diff --git a/packages/sdk-js/package.json b/packages/sdk-js/package.json index 8e450b2a7..e47fb8062 100644 --- a/packages/sdk-js/package.json +++ b/packages/sdk-js/package.json @@ -48,8 +48,10 @@ "@kiltprotocol/type-definitions": "rc", "@kiltprotocol/utils": "workspace:*", "@polkadot/api": "^12.0.0", + "@polkadot/keyring": "^13.0.0", "@polkadot/types": "^12.0.0", - "@polkadot/util": "^13.0.0" + "@polkadot/util": "^13.0.0", + "@polkadot/util-crypto": "^13.0.0" }, "peerDependencies": { "@kiltprotocol/augment-api": "^1.11210.0" diff --git a/packages/types/src/Address.ts b/packages/types/src/Address.ts index 50a31f085..d1891c56e 100644 --- a/packages/types/src/Address.ts +++ b/packages/types/src/Address.ts @@ -23,7 +23,7 @@ export interface KiltKeyringPair extends KeyringPair { /// A KILT-chain specific address, encoded with the KILT 38 network prefix. export type KiltAddress = KiltKeyringPair['address'] -declare module '@polkadot/keyring' { +declare module '@polkadot/util-crypto' { function encodeAddress( key: HexString | Uint8Array | string, ss58Format: 38 diff --git a/packages/utils/package.json b/packages/utils/package.json index 69f86c122..b2bfd3a42 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -40,14 +40,15 @@ "@kiltprotocol/jcs-data-integrity-proofs-common": "0.1.0-rc.4", "@kiltprotocol/sr25519-jcs-2023": "0.1.0-rc.4", "@kiltprotocol/types": "workspace:*", - "@polkadot/api": "^12.0.0", - "@polkadot/keyring": "^13.0.0", - "@polkadot/util": "^13.0.0", - "@polkadot/util-crypto": "^13.0.0", "@scure/base": "^1.1.0", "cbor-web": "^9.0.0", "tweetnacl": "^1.0.3", "uuid": "^10.0.0", "varint": "^6.0.0" + }, + "peerDependencies": { + "@polkadot/keyring": "^13.0.0", + "@polkadot/util": "^13.0.0", + "@polkadot/util-crypto": "^13.0.0" } } diff --git a/packages/utils/src/Crypto.ts b/packages/utils/src/Crypto.ts index 0bd6e6661..5bab5ecfb 100644 --- a/packages/utils/src/Crypto.ts +++ b/packages/utils/src/Crypto.ts @@ -13,7 +13,7 @@ * @packageDocumentation */ -import { decodeAddress, encodeAddress } from '@polkadot/keyring' +import Keyring, { decodeAddress, encodeAddress } from '@polkadot/keyring' import type { HexString, KeyringPair, @@ -34,7 +34,6 @@ import { randomAsU8a, signatureVerify, } from '@polkadot/util-crypto' -import { Keyring } from '@polkadot/api' import nacl from 'tweetnacl' import { v4 as uuid } from 'uuid' import jsonabc from './jsonabc.js' diff --git a/packages/utils/src/Signers.ts b/packages/utils/src/Signers.ts index 27c95f7b0..b313054fa 100644 --- a/packages/utils/src/Signers.ts +++ b/packages/utils/src/Signers.ts @@ -5,7 +5,7 @@ * found in the LICENSE file in the root directory of this source tree. */ -import type { Signer } from '@polkadot/api/types/index.js' +import type { Signer } from '@polkadot/types/types' import { decodePair } from '@polkadot/keyring/pair/decode' import { hexToU8a, diff --git a/yarn.lock b/yarn.lock index 7bc33ba64..7f077abe9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1995,18 +1995,23 @@ __metadata: "@kiltprotocol/did": "workspace:*" "@kiltprotocol/types": "workspace:*" "@kiltprotocol/utils": "workspace:*" - "@polkadot/api": "npm:^12.0.0" - "@polkadot/types": "npm:^12.0.0" - "@polkadot/util": "npm:^13.0.0" - "@polkadot/util-crypto": "npm:^13.0.0" rimraf: "npm:^3.0.2" typescript: "npm:^4.8.3" peerDependencies: "@kiltprotocol/augment-api": ^1.0.0 "@kiltprotocol/type-definitions": ^1.0.0 + "@polkadot/api": ^12.0.0 + "@polkadot/keyring": ^13.0.0 + "@polkadot/types": ^12.0.0 + "@polkadot/util": ^13.0.0 + "@polkadot/util-crypto": ^13.0.0 peerDependenciesMeta: "@kiltprotocol/augment-api": optional: true + "@polkadot/types": + optional: true + "@polkadot/util": + optional: true languageName: unknown linkType: soft @@ -2057,19 +2062,24 @@ __metadata: "@kiltprotocol/config": "workspace:*" "@kiltprotocol/types": "workspace:*" "@kiltprotocol/utils": "workspace:*" - "@polkadot/api": "npm:^12.0.0" - "@polkadot/api-derive": "npm:^12.0.0" - "@polkadot/types": "npm:^12.0.0" - "@polkadot/util": "npm:^13.0.0" - "@polkadot/util-crypto": "npm:^13.0.0" rimraf: "npm:^3.0.2" typescript: "npm:^4.8.3" peerDependencies: "@kiltprotocol/augment-api": ^1.0.0 "@kiltprotocol/type-definitions": ^1.0.0 + "@polkadot/api": ^12.0.0 + "@polkadot/api-derive": ^12.0.0 + "@polkadot/keyring": ^13.0.0 + "@polkadot/types": ^12.0.0 + "@polkadot/util": ^13.0.0 + "@polkadot/util-crypto": ^13.0.0 peerDependenciesMeta: "@kiltprotocol/augment-api": optional: true + "@polkadot/api-derive": + optional: true + "@polkadot/types": + optional: true languageName: unknown linkType: soft @@ -2078,10 +2088,14 @@ __metadata: resolution: "@kiltprotocol/config@workspace:packages/config" dependencies: "@kiltprotocol/types": "workspace:*" - "@polkadot/api": "npm:^12.0.0" rimraf: "npm:^3.0.2" typescript: "npm:^4.8.3" typescript-logging: "npm:^1.0.0" + peerDependencies: + "@polkadot/api": ^12.0.0 + peerDependenciesMeta: + "@polkadot/api": + optional: true languageName: unknown linkType: soft @@ -2098,11 +2112,6 @@ __metadata: "@kiltprotocol/sr25519-jcs-2023": "npm:0.1.0-rc.4" "@kiltprotocol/types": "workspace:*" "@kiltprotocol/utils": "workspace:*" - "@polkadot/api": "npm:^12.0.0" - "@polkadot/keyring": "npm:^13.0.0" - "@polkadot/types": "npm:^12.0.0" - "@polkadot/util": "npm:^13.0.0" - "@polkadot/util-crypto": "npm:^13.0.0" "@scure/base": "npm:^1.1.0" "@types/json-pointer": "npm:^1.0.34" json-pointer: "npm:^0.6.2" @@ -2111,9 +2120,16 @@ __metadata: peerDependencies: "@kiltprotocol/augment-api": ^1.0.0 "@kiltprotocol/type-definitions": ^1.0.0 + "@polkadot/api": ^12.0.0 + "@polkadot/keyring": ^13.0.0 + "@polkadot/types": ^12.0.0 + "@polkadot/util": ^13.0.0 + "@polkadot/util-crypto": ^13.0.0 peerDependenciesMeta: "@kiltprotocol/augment-api": optional: true + "@polkadot/api": + optional: true languageName: unknown linkType: soft @@ -2126,18 +2142,22 @@ __metadata: "@kiltprotocol/config": "workspace:*" "@kiltprotocol/types": "workspace:*" "@kiltprotocol/utils": "workspace:*" - "@polkadot/api": "npm:^12.0.0" - "@polkadot/keyring": "npm:^13.0.0" - "@polkadot/types": "npm:^12.0.0" - "@polkadot/util": "npm:^13.0.0" - "@polkadot/util-crypto": "npm:^13.0.0" rimraf: "npm:^3.0.2" typescript: "npm:^4.8.3" peerDependencies: "@kiltprotocol/augment-api": ^1.0.0 + "@polkadot/api": ^12.0.0 + "@polkadot/keyring": ^13.0.0 + "@polkadot/types": ^12.0.0 + "@polkadot/util": ^13.0.0 + "@polkadot/util-crypto": ^13.0.0 peerDependenciesMeta: "@kiltprotocol/augment-api": optional: true + "@polkadot/api": + optional: true + "@polkadot/types": + optional: true languageName: unknown linkType: soft @@ -2188,6 +2208,8 @@ __metadata: "@kiltprotocol/type-definitions": "npm:^1.0.0" "@kiltprotocol/types": "workspace:*" "@kiltprotocol/utils": "workspace:*" + "@polkadot/keyring": "npm:^13.0.0" + "@polkadot/types": "npm:^12.0.0" "@polkadot/util": "npm:^13.0.0" "@polkadot/util-crypto": "npm:^13.0.0" crypto-ld: "npm:^6.0.0" @@ -2208,12 +2230,14 @@ __metadata: "@kiltprotocol/did": "workspace:*" "@kiltprotocol/types": "workspace:*" "@kiltprotocol/utils": "workspace:*" - "@polkadot/util": "npm:^13.0.0" - "@polkadot/util-crypto": "npm:^13.0.0" rimraf: "npm:^3.0.2" typescript: "npm:^4.8.3" peerDependencies: "@kiltprotocol/type-definitions": ^1.0.0 + "@polkadot/keyring": ^13.0.0 + "@polkadot/types": ^12.0.0 + "@polkadot/util": ^13.0.0 + "@polkadot/util-crypto": ^13.0.0 languageName: unknown linkType: soft @@ -2229,9 +2253,11 @@ __metadata: "@kiltprotocol/type-definitions": "npm:rc" "@kiltprotocol/utils": "workspace:*" "@polkadot/api": "npm:^12.0.0" + "@polkadot/keyring": "npm:^13.0.0" "@polkadot/typegen": "npm:^12.0.0" "@polkadot/types": "npm:^12.0.0" "@polkadot/util": "npm:^13.0.0" + "@polkadot/util-crypto": "npm:^13.0.0" rimraf: "npm:^3.0.2" terser-webpack-plugin: "npm:^5.1.1" typescript: "npm:^4.8.3" @@ -2292,10 +2318,6 @@ __metadata: "@kiltprotocol/jcs-data-integrity-proofs-common": "npm:0.1.0-rc.4" "@kiltprotocol/sr25519-jcs-2023": "npm:0.1.0-rc.4" "@kiltprotocol/types": "workspace:*" - "@polkadot/api": "npm:^12.0.0" - "@polkadot/keyring": "npm:^13.0.0" - "@polkadot/util": "npm:^13.0.0" - "@polkadot/util-crypto": "npm:^13.0.0" "@scure/base": "npm:^1.1.0" "@types/uuid": "npm:^8.0.0" cbor-web: "npm:^9.0.0" @@ -2304,6 +2326,10 @@ __metadata: typescript: "npm:^4.8.3" uuid: "npm:^10.0.0" varint: "npm:^6.0.0" + peerDependencies: + "@polkadot/keyring": ^13.0.0 + "@polkadot/util": ^13.0.0 + "@polkadot/util-crypto": ^13.0.0 languageName: unknown linkType: soft @@ -2481,7 +2507,7 @@ __metadata: languageName: node linkType: hard -"@polkadot/api-derive@npm:12.2.1, @polkadot/api-derive@npm:^12.0.0": +"@polkadot/api-derive@npm:12.2.1": version: 12.2.1 resolution: "@polkadot/api-derive@npm:12.2.1" dependencies: