Skip to content

Commit 0fbe39a

Browse files
dependabot[bot]actions-userryanleecode
authored
chore(deps): bump the polkadot-api group across 1 directory with 8 updates (#2608)
* chore(deps): bump the polkadot-api group across 1 directory with 8 updates Bumps the polkadot-api group with 8 updates in the / directory: | Package | From | To | | --- | --- | --- | | [@polkadot-api/codegen](https://github.com/polkadot-api/polkadot-api) | `0.12.11` | `0.12.12` | | [@polkadot-api/metadata-builders](https://github.com/polkadot-api/polkadot-api) | `0.9.3` | `0.10.0` | | [@polkadot-api/metadata-compatibility](https://github.com/polkadot-api/polkadot-api) | `0.1.13` | `0.1.14` | | [@polkadot-api/observable-client](https://github.com/polkadot-api/polkadot-api) | `0.6.4` | `0.7.0` | | [@polkadot-api/signer](https://github.com/polkadot-api/polkadot-api) | `0.1.12` | `0.1.13` | | [@polkadot-api/substrate-bindings](https://github.com/polkadot-api/polkadot-api) | `0.10.0` | `0.11.0` | | [@polkadot-api/view-builder](https://github.com/polkadot-api/polkadot-api) | `0.4.0` | `0.4.1` | | [polkadot-api](https://github.com/polkadot-api/polkadot-api) | `1.7.8` | `1.8.1` | Updates `@polkadot-api/codegen` from 0.12.11 to 0.12.12 - [Release notes](https://github.com/polkadot-api/polkadot-api/releases) - [Changelog](https://github.com/polkadot-api/polkadot-api/blob/main/NEWS.md) - [Commits](https://github.com/polkadot-api/polkadot-api/commits) Updates `@polkadot-api/metadata-builders` from 0.9.3 to 0.10.0 - [Release notes](https://github.com/polkadot-api/polkadot-api/releases) - [Changelog](https://github.com/polkadot-api/polkadot-api/blob/main/NEWS.md) - [Commits](https://github.com/polkadot-api/polkadot-api/commits/polkadot-api@0.10.0) Updates `@polkadot-api/metadata-compatibility` from 0.1.13 to 0.1.14 - [Release notes](https://github.com/polkadot-api/polkadot-api/releases) - [Changelog](https://github.com/polkadot-api/polkadot-api/blob/main/NEWS.md) - [Commits](https://github.com/polkadot-api/polkadot-api/commits) Updates `@polkadot-api/observable-client` from 0.6.4 to 0.7.0 - [Release notes](https://github.com/polkadot-api/polkadot-api/releases) - [Changelog](https://github.com/polkadot-api/polkadot-api/blob/main/NEWS.md) - [Commits](https://github.com/polkadot-api/polkadot-api/commits/polkadot-api@0.7.0) Updates `@polkadot-api/signer` from 0.1.12 to 0.1.13 - [Release notes](https://github.com/polkadot-api/polkadot-api/releases) - [Changelog](https://github.com/polkadot-api/polkadot-api/blob/main/NEWS.md) - [Commits](https://github.com/polkadot-api/polkadot-api/commits) Updates `@polkadot-api/substrate-bindings` from 0.10.0 to 0.11.0 - [Release notes](https://github.com/polkadot-api/polkadot-api/releases) - [Changelog](https://github.com/polkadot-api/polkadot-api/blob/main/NEWS.md) - [Commits](https://github.com/polkadot-api/polkadot-api/commits) Updates `@polkadot-api/view-builder` from 0.4.0 to 0.4.1 - [Release notes](https://github.com/polkadot-api/polkadot-api/releases) - [Changelog](https://github.com/polkadot-api/polkadot-api/blob/main/NEWS.md) - [Commits](https://github.com/polkadot-api/polkadot-api/commits) Updates `polkadot-api` from 1.7.8 to 1.8.1 - [Release notes](https://github.com/polkadot-api/polkadot-api/releases) - [Changelog](https://github.com/polkadot-api/polkadot-api/blob/main/NEWS.md) - [Commits](https://github.com/polkadot-api/polkadot-api/compare/polkadot-api@1.7.8...polkadot-api@1.8.1) --- updated-dependencies: - dependency-name: "@polkadot-api/codegen" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: polkadot-api - dependency-name: "@polkadot-api/metadata-builders" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: polkadot-api - dependency-name: "@polkadot-api/metadata-compatibility" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: polkadot-api - dependency-name: "@polkadot-api/observable-client" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: polkadot-api - dependency-name: "@polkadot-api/signer" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: polkadot-api - dependency-name: "@polkadot-api/substrate-bindings" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: polkadot-api - dependency-name: "@polkadot-api/view-builder" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: polkadot-api - dependency-name: polkadot-api dependency-type: direct:production update-type: version-update:semver-minor dependency-group: polkadot-api ... Signed-off-by: dependabot[bot] <support@github.com> * chore(deps): changeset for dependency update * chore: update tx helper --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Ryan <drdgvhbh@gmail.com>
1 parent 654165c commit 0fbe39a

File tree

17 files changed

+505
-270
lines changed

17 files changed

+505
-270
lines changed

.changeset/dependencies-GH-2608.md

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
"@substrate/light-client-extension-helpers": patch
3+
"@substrate/extension": patch
4+
"@substrate/wallet-template": patch
5+
---
6+
7+
chore(deps): bump the polkadot-api group across 1 directory with 8 updates
8+
9+
Bumps the polkadot-api group with 8 updates in the / directory:
10+
11+
| Package | From | To |
12+
| --- | --- | --- |
13+
| [@polkadot-api/codegen](https://github.com/polkadot-api/polkadot-api) | `0.12.11` | `0.12.12` |
14+
| [@polkadot-api/metadata-builders](https://github.com/polkadot-api/polkadot-api) | `0.9.3` | `0.10.0` |
15+
| [@polkadot-api/metadata-compatibility](https://github.com/polkadot-api/polkadot-api) | `0.1.13` | `0.1.14` |
16+
| [@polkadot-api/observable-client](https://github.com/polkadot-api/polkadot-api) | `0.6.4` | `0.7.0` |
17+
| [@polkadot-api/signer](https://github.com/polkadot-api/polkadot-api) | `0.1.12` | `0.1.13` |
18+
| [@polkadot-api/substrate-bindings](https://github.com/polkadot-api/polkadot-api) | `0.10.0` | `0.11.0` |
19+
| [@polkadot-api/view-builder](https://github.com/polkadot-api/polkadot-api) | `0.4.0` | `0.4.1` |
20+
| [polkadot-api](https://github.com/polkadot-api/polkadot-api) | `1.7.8` | `1.8.1` |
21+
22+
23+
24+
Updates `@polkadot-api/codegen` from 0.12.11 to 0.12.12
25+
- [Release notes](https://github.com/polkadot-api/polkadot-api/releases)
26+
- [Changelog](https://github.com/polkadot-api/polkadot-api/blob/main/NEWS.md)
27+
- [Commits](https://github.com/polkadot-api/polkadot-api/commits)
28+
29+
Updates `@polkadot-api/metadata-builders` from 0.9.3 to 0.10.0
30+
- [Release notes](https://github.com/polkadot-api/polkadot-api/releases)
31+
- [Changelog](https://github.com/polkadot-api/polkadot-api/blob/main/NEWS.md)
32+
- [Commits](https://github.com/polkadot-api/polkadot-api/commits/polkadot-api@0.10.0)
33+
34+
Updates `@polkadot-api/metadata-compatibility` from 0.1.13 to 0.1.14
35+
- [Release notes](https://github.com/polkadot-api/polkadot-api/releases)
36+
- [Changelog](https://github.com/polkadot-api/polkadot-api/blob/main/NEWS.md)
37+
- [Commits](https://github.com/polkadot-api/polkadot-api/commits)
38+
39+
Updates `@polkadot-api/observable-client` from 0.6.4 to 0.7.0
40+
- [Release notes](https://github.com/polkadot-api/polkadot-api/releases)
41+
- [Changelog](https://github.com/polkadot-api/polkadot-api/blob/main/NEWS.md)
42+
- [Commits](https://github.com/polkadot-api/polkadot-api/commits/polkadot-api@0.7.0)
43+
44+
Updates `@polkadot-api/signer` from 0.1.12 to 0.1.13
45+
- [Release notes](https://github.com/polkadot-api/polkadot-api/releases)
46+
- [Changelog](https://github.com/polkadot-api/polkadot-api/blob/main/NEWS.md)
47+
- [Commits](https://github.com/polkadot-api/polkadot-api/commits)
48+
49+
Updates `@polkadot-api/substrate-bindings` from 0.10.0 to 0.11.0
50+
- [Release notes](https://github.com/polkadot-api/polkadot-api/releases)
51+
- [Changelog](https://github.com/polkadot-api/polkadot-api/blob/main/NEWS.md)
52+
- [Commits](https://github.com/polkadot-api/polkadot-api/commits)
53+
54+
Updates `@polkadot-api/view-builder` from 0.4.0 to 0.4.1
55+
- [Release notes](https://github.com/polkadot-api/polkadot-api/releases)
56+
- [Changelog](https://github.com/polkadot-api/polkadot-api/blob/main/NEWS.md)
57+
- [Commits](https://github.com/polkadot-api/polkadot-api/commits)
58+
59+
Updates `polkadot-api` from 1.7.8 to 1.8.1
60+
- [Release notes](https://github.com/polkadot-api/polkadot-api/releases)
61+
- [Changelog](https://github.com/polkadot-api/polkadot-api/blob/main/NEWS.md)
62+
- [Commits](https://github.com/polkadot-api/polkadot-api/compare/polkadot-api@1.7.8...polkadot-api@1.8.1)
63+
64+
---
65+
updated-dependencies:
66+
- dependency-name: "@polkadot-api/codegen"
67+
dependency-type: direct:production
68+
update-type: version-update:semver-patch
69+
dependency-group: polkadot-api
70+
- dependency-name: "@polkadot-api/metadata-builders"
71+
dependency-type: direct:production
72+
update-type: version-update:semver-minor
73+
dependency-group: polkadot-api
74+
- dependency-name: "@polkadot-api/metadata-compatibility"
75+
dependency-type: direct:production
76+
update-type: version-update:semver-patch
77+
dependency-group: polkadot-api
78+
- dependency-name: "@polkadot-api/observable-client"
79+
dependency-type: direct:production
80+
update-type: version-update:semver-minor
81+
dependency-group: polkadot-api
82+
- dependency-name: "@polkadot-api/signer"
83+
dependency-type: direct:production
84+
update-type: version-update:semver-patch
85+
dependency-group: polkadot-api
86+
- dependency-name: "@polkadot-api/substrate-bindings"
87+
dependency-type: direct:production
88+
update-type: version-update:semver-minor
89+
dependency-group: polkadot-api
90+
- dependency-name: "@polkadot-api/view-builder"
91+
dependency-type: direct:production
92+
update-type: version-update:semver-patch
93+
dependency-group: polkadot-api
94+
- dependency-name: polkadot-api
95+
dependency-type: direct:production
96+
update-type: version-update:semver-minor
97+
dependency-group: polkadot-api
98+
...
99+
100+
Signed-off-by: dependabot[bot] <support@github.com>

examples/light-client-dapp/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
},
1212
"dependencies": {
1313
"@picocss/pico": "^2.0.6",
14-
"@polkadot-api/metadata-builders": "~0.9.3",
15-
"@polkadot-api/observable-client": "~0.6.4",
16-
"@polkadot-api/substrate-bindings": "~0.10.0",
14+
"@polkadot-api/metadata-builders": "~0.10.0",
15+
"@polkadot-api/observable-client": "~0.7.0",
16+
"@polkadot-api/substrate-bindings": "~0.11.0",
1717
"@polkadot-api/substrate-client": "~0.3.0",
1818
"@polkadot-api/utils": "~0.1.2",
1919
"@polkadot-labs/hdkd-helpers": "^0.0.10",
2020
"@substrate/connect-known-chains": "workspace:^",
2121
"@zag-js/react": "^0.48.0",
2222
"@zag-js/select": "^0.48.0",
2323
"@zag-js/toast": "^0.48.0",
24-
"polkadot-api": "^1.7.8",
24+
"polkadot-api": "^1.8.1",
2525
"react": "^18.3.1",
2626
"react-dom": "^18.2.0",
2727
"rxjs": "^7.8.1",

examples/light-client-extension-helpers-dapp/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"dependencies": {
1313
"@picocss/pico": "^2.0.6",
14-
"@polkadot-api/observable-client": "~0.6.4",
14+
"@polkadot-api/observable-client": "~0.7.0",
1515
"@polkadot-api/substrate-client": "~0.3.0",
1616
"@substrate/connect-known-chains": "workspace:*",
1717
"@substrate/light-client-extension-helpers": "workspace:*",

packages/light-client-extension-helpers/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,13 @@
209209
"dependencies": {
210210
"@polkadot-api/json-rpc-provider": "~0.0.4",
211211
"@polkadot-api/polkadot-signer": "~0.1.6",
212-
"@polkadot-api/codegen": "~0.12.11",
212+
"@polkadot-api/codegen": "~0.12.12",
213213
"@polkadot-api/json-rpc-provider-proxy": "~0.2.4",
214-
"@polkadot-api/metadata-builders": "~0.9.3",
215-
"@polkadot-api/metadata-compatibility": "~0.1.13",
216-
"@polkadot-api/observable-client": "~0.6.4",
217-
"@polkadot-api/signer": "~0.1.12",
218-
"@polkadot-api/substrate-bindings": "~0.10.0",
214+
"@polkadot-api/metadata-builders": "~0.10.0",
215+
"@polkadot-api/metadata-compatibility": "~0.1.14",
216+
"@polkadot-api/observable-client": "~0.7.0",
217+
"@polkadot-api/signer": "~0.1.13",
218+
"@polkadot-api/substrate-bindings": "~0.11.0",
219219
"@polkadot-api/substrate-client": "~0.3.0",
220220
"@polkadot-api/utils": "~0.1.2",
221221
"@substrate/connect-extension-protocol": "workspace:^",

packages/light-client-extension-helpers/src/tx-helper/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export const createTx =
6363
options.signer,
6464
options.callData,
6565
atBlock,
66+
{},
6667
options.hinted,
6768
)
6869
.pipe(filter(Boolean)),

packages/light-client-extension-helpers/src/tx-helper/polkadot-api/tx-helper/compatibility.ts

+25-13
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ import {
1010
mapLookupToTypedef,
1111
valueIsCompatibleWithDest,
1212
} from "@polkadot-api/metadata-compatibility"
13-
import {
14-
type ChainHead$,
15-
getObservableClient,
16-
type RuntimeContext,
13+
import type {
14+
ChainHead$,
15+
RuntimeContext,
1716
} from "@polkadot-api/observable-client"
1817
import { Tuple, Vector } from "@polkadot-api/substrate-bindings"
1918
import { Observable, combineLatest, filter, firstValueFrom, map } from "rxjs"
@@ -70,7 +69,7 @@ const TypesCodec = Tuple(EntryPointsCodec, TypedefsCodec)
7069

7170
export const createCompatibilityToken = <D extends ChainDefinition>(
7271
chainDefinition: D,
73-
chainHead: ReturnType<ReturnType<typeof getObservableClient>["chainHead$"]>,
72+
chainHead: ChainHead$,
7473
): Promise<CompatibilityToken<D>> => {
7574
const awaitedRuntime = new Promise<() => RuntimeContext>(async (resolve) => {
7675
const loadedRuntime$ = chainHead.runtime$.pipe(filter((v) => v != null))
@@ -90,10 +89,18 @@ export const createCompatibilityToken = <D extends ChainDefinition>(
9089
compatibilityTokenApi.set(token, {
9190
runtime,
9291
getPalletEntryPoint(opType, pallet, name) {
93-
return entryPoints[descriptors[opType][pallet][name]]
92+
const idx = descriptors[opType]?.[pallet]?.[name]
93+
if (idx == null)
94+
throw new Error(
95+
`Descriptor for ${opType} ${pallet}.${name} does not exist`,
96+
)
97+
return entryPoints[idx]
9498
},
9599
getApiEntryPoint(name, method) {
96-
return entryPoints[descriptors.apis[name][method]]
100+
const idx = descriptors.apis?.[name]?.[method]
101+
if (idx == null)
102+
throw new Error(`Descriptor for API ${name}.${method} does not exist`)
103+
return entryPoints[idx]
97104
},
98105
typedefNodes,
99106
})
@@ -105,7 +112,7 @@ export const createCompatibilityToken = <D extends ChainDefinition>(
105112
}
106113

107114
export const createRuntimeToken = <D>(
108-
chainHead: ReturnType<ReturnType<typeof getObservableClient>["chainHead$"]>,
115+
chainHead: ChainHead$,
109116
): Promise<RuntimeToken<D>> => {
110117
const awaitedRuntime = new Promise<() => RuntimeContext>(async (resolve) => {
111118
const loadedRuntime$ = chainHead.runtime$.pipe(filter((v) => v != null))
@@ -149,7 +156,7 @@ const getMetadataCache = (ctx: RuntimeContext) => {
149156
export const compatibilityHelper = (
150157
descriptors: Promise<RuntimeToken | CompatibilityToken>,
151158
getDescriptorEntryPoint: (descriptorApi: CompatibilityTokenApi) => EntryPoint,
152-
getRuntimeEntryPoint: (ctx: RuntimeContext) => EntryPoint,
159+
getRuntimeEntryPoint: (ctx: RuntimeContext) => EntryPoint | null,
153160
) => {
154161
const getRuntimeTypedef = (ctx: RuntimeContext, id: number) => {
155162
const cache = getMetadataCache(ctx)
@@ -176,6 +183,11 @@ export const compatibilityHelper = (
176183
ctx ||= compatibilityApi.runtime()
177184
const descriptorEntryPoint = getDescriptorEntryPoint(compatibilityApi)
178185
const runtimeEntryPoint = getRuntimeEntryPoint(ctx)
186+
if (runtimeEntryPoint == null)
187+
return {
188+
args: CompatibilityLevel.Incompatible,
189+
values: CompatibilityLevel.Incompatible,
190+
}
179191
const descriptorNodes = compatibilityApi.typedefNodes
180192

181193
const cache = getMetadataCache(ctx)
@@ -198,9 +210,8 @@ export const compatibilityHelper = (
198210
getCompatibilityLevel(runtime) >= threshold,
199211
)
200212

201-
const waitDescriptors = () => descriptors
202213
const compatibleRuntime$ = (chainHead: ChainHead$, hash: string | null) =>
203-
combineLatest([waitDescriptors(), chainHead.getRuntimeContext$(hash)])
214+
combineLatest([descriptors, chainHead.getRuntimeContext$(hash)])
204215

205216
const withCompatibleRuntime =
206217
<T>(chainHead: ChainHead$, mapper: (x: T) => string) =>
@@ -209,7 +220,7 @@ export const compatibilityHelper = (
209220
): Observable<[T, CompatibilityToken | RuntimeToken, RuntimeContext]> =>
210221
combineLatest([
211222
source$.pipe(chainHead.withRuntime(mapper)),
212-
waitDescriptors(),
223+
descriptors,
213224
]).pipe(map(([[x, ctx], descriptors]) => [x, descriptors, ctx]))
214225

215226
const argsAreCompatible = (
@@ -225,6 +236,7 @@ export const compatibilityHelper = (
225236
if (levels.values === CompatibilityLevel.Incompatible) return false
226237

227238
const entryPoint = getRuntimeEntryPoint(ctx)
239+
if (entryPoint == null) return false
228240

229241
return valueIsCompatibleWithDest(
230242
entryPoint.args,
@@ -257,7 +269,7 @@ export const compatibilityHelper = (
257269
isCompatible,
258270
getCompatibilityLevel,
259271
getCompatibilityLevels,
260-
waitDescriptors,
272+
descriptors,
261273
withCompatibleRuntime,
262274
compatibleRuntime$,
263275
argsAreCompatible,

0 commit comments

Comments
 (0)