Skip to content

Commit

Permalink
chore(deps): polkadot-js as peer dependency (#896)
Browse files Browse the repository at this point in the history
* chore: make pjs peer dependency in sub-packages
* fix: messed-up imports
* chore: make some imports more direct
  • Loading branch information
rflechtner committed Aug 7, 2024
1 parent 72d15d5 commit 8428c61
Show file tree
Hide file tree
Showing 15 changed files with 132 additions and 75 deletions.
19 changes: 13 additions & 6 deletions packages/asset-credentials/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,30 @@
},
"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:*",
"@kiltprotocol/config": "workspace:*",
"@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
}
}
}
21 changes: 14 additions & 7 deletions packages/chain-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:*"
}
}
9 changes: 8 additions & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
17 changes: 10 additions & 7 deletions packages/credentials/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:*",
Expand All @@ -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
}
}
}
6 changes: 1 addition & 5 deletions packages/credentials/src/V1/KiltAttestationProofV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 13 additions & 7 deletions packages/did/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
3 changes: 1 addition & 2 deletions packages/did/src/Did.rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions packages/jsonld-suites/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 6 additions & 4 deletions packages/legacy-credentials/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
4 changes: 3 additions & 1 deletion packages/sdk-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/Address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
3 changes: 1 addition & 2 deletions packages/utils/src/Crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @packageDocumentation
*/

import { decodeAddress, encodeAddress } from '@polkadot/keyring'
import Keyring, { decodeAddress, encodeAddress } from '@polkadot/keyring'
import type {
HexString,
KeyringPair,
Expand All @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/Signers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 8428c61

Please sign in to comment.