Skip to content

Commit

Permalink
chore(deps): bump the polkadot-api group across 1 directory with 8 up…
Browse files Browse the repository at this point in the history
…dates (#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/[email protected])

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/[email protected])

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/[email protected]@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] <[email protected]>

* chore(deps): changeset for dependency update

* chore: update tx helper

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: Ryan <[email protected]>
  • Loading branch information
3 people authored Jan 6, 2025
1 parent 654165c commit 0fbe39a
Show file tree
Hide file tree
Showing 17 changed files with 505 additions and 270 deletions.
100 changes: 100 additions & 0 deletions .changeset/dependencies-GH-2608.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
"@substrate/light-client-extension-helpers": patch
"@substrate/extension": patch
"@substrate/wallet-template": patch
---

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/[email protected])

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/[email protected])

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/[email protected]@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] <[email protected]>
8 changes: 4 additions & 4 deletions examples/light-client-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
},
"dependencies": {
"@picocss/pico": "^2.0.6",
"@polkadot-api/metadata-builders": "~0.9.3",
"@polkadot-api/observable-client": "~0.6.4",
"@polkadot-api/substrate-bindings": "~0.10.0",
"@polkadot-api/metadata-builders": "~0.10.0",
"@polkadot-api/observable-client": "~0.7.0",
"@polkadot-api/substrate-bindings": "~0.11.0",
"@polkadot-api/substrate-client": "~0.3.0",
"@polkadot-api/utils": "~0.1.2",
"@polkadot-labs/hdkd-helpers": "^0.0.10",
"@substrate/connect-known-chains": "workspace:^",
"@zag-js/react": "^0.48.0",
"@zag-js/select": "^0.48.0",
"@zag-js/toast": "^0.48.0",
"polkadot-api": "^1.7.8",
"polkadot-api": "^1.8.1",
"react": "^18.3.1",
"react-dom": "^18.2.0",
"rxjs": "^7.8.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/light-client-extension-helpers-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@picocss/pico": "^2.0.6",
"@polkadot-api/observable-client": "~0.6.4",
"@polkadot-api/observable-client": "~0.7.0",
"@polkadot-api/substrate-client": "~0.3.0",
"@substrate/connect-known-chains": "workspace:*",
"@substrate/light-client-extension-helpers": "workspace:*",
Expand Down
12 changes: 6 additions & 6 deletions packages/light-client-extension-helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@
"dependencies": {
"@polkadot-api/json-rpc-provider": "~0.0.4",
"@polkadot-api/polkadot-signer": "~0.1.6",
"@polkadot-api/codegen": "~0.12.11",
"@polkadot-api/codegen": "~0.12.12",
"@polkadot-api/json-rpc-provider-proxy": "~0.2.4",
"@polkadot-api/metadata-builders": "~0.9.3",
"@polkadot-api/metadata-compatibility": "~0.1.13",
"@polkadot-api/observable-client": "~0.6.4",
"@polkadot-api/signer": "~0.1.12",
"@polkadot-api/substrate-bindings": "~0.10.0",
"@polkadot-api/metadata-builders": "~0.10.0",
"@polkadot-api/metadata-compatibility": "~0.1.14",
"@polkadot-api/observable-client": "~0.7.0",
"@polkadot-api/signer": "~0.1.13",
"@polkadot-api/substrate-bindings": "~0.11.0",
"@polkadot-api/substrate-client": "~0.3.0",
"@polkadot-api/utils": "~0.1.2",
"@substrate/connect-extension-protocol": "workspace:^",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const createTx =
options.signer,
options.callData,
atBlock,
{},
options.hinted,
)
.pipe(filter(Boolean)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import {
mapLookupToTypedef,
valueIsCompatibleWithDest,
} from "@polkadot-api/metadata-compatibility"
import {
type ChainHead$,
getObservableClient,
type RuntimeContext,
import type {
ChainHead$,
RuntimeContext,
} from "@polkadot-api/observable-client"
import { Tuple, Vector } from "@polkadot-api/substrate-bindings"
import { Observable, combineLatest, filter, firstValueFrom, map } from "rxjs"
Expand Down Expand Up @@ -70,7 +69,7 @@ const TypesCodec = Tuple(EntryPointsCodec, TypedefsCodec)

export const createCompatibilityToken = <D extends ChainDefinition>(
chainDefinition: D,
chainHead: ReturnType<ReturnType<typeof getObservableClient>["chainHead$"]>,
chainHead: ChainHead$,
): Promise<CompatibilityToken<D>> => {
const awaitedRuntime = new Promise<() => RuntimeContext>(async (resolve) => {
const loadedRuntime$ = chainHead.runtime$.pipe(filter((v) => v != null))
Expand All @@ -90,10 +89,18 @@ export const createCompatibilityToken = <D extends ChainDefinition>(
compatibilityTokenApi.set(token, {
runtime,
getPalletEntryPoint(opType, pallet, name) {
return entryPoints[descriptors[opType][pallet][name]]
const idx = descriptors[opType]?.[pallet]?.[name]
if (idx == null)
throw new Error(
`Descriptor for ${opType} ${pallet}.${name} does not exist`,
)
return entryPoints[idx]
},
getApiEntryPoint(name, method) {
return entryPoints[descriptors.apis[name][method]]
const idx = descriptors.apis?.[name]?.[method]
if (idx == null)
throw new Error(`Descriptor for API ${name}.${method} does not exist`)
return entryPoints[idx]
},
typedefNodes,
})
Expand All @@ -105,7 +112,7 @@ export const createCompatibilityToken = <D extends ChainDefinition>(
}

export const createRuntimeToken = <D>(
chainHead: ReturnType<ReturnType<typeof getObservableClient>["chainHead$"]>,
chainHead: ChainHead$,
): Promise<RuntimeToken<D>> => {
const awaitedRuntime = new Promise<() => RuntimeContext>(async (resolve) => {
const loadedRuntime$ = chainHead.runtime$.pipe(filter((v) => v != null))
Expand Down Expand Up @@ -149,7 +156,7 @@ const getMetadataCache = (ctx: RuntimeContext) => {
export const compatibilityHelper = (
descriptors: Promise<RuntimeToken | CompatibilityToken>,
getDescriptorEntryPoint: (descriptorApi: CompatibilityTokenApi) => EntryPoint,
getRuntimeEntryPoint: (ctx: RuntimeContext) => EntryPoint,
getRuntimeEntryPoint: (ctx: RuntimeContext) => EntryPoint | null,
) => {
const getRuntimeTypedef = (ctx: RuntimeContext, id: number) => {
const cache = getMetadataCache(ctx)
Expand All @@ -176,6 +183,11 @@ export const compatibilityHelper = (
ctx ||= compatibilityApi.runtime()
const descriptorEntryPoint = getDescriptorEntryPoint(compatibilityApi)
const runtimeEntryPoint = getRuntimeEntryPoint(ctx)
if (runtimeEntryPoint == null)
return {
args: CompatibilityLevel.Incompatible,
values: CompatibilityLevel.Incompatible,
}
const descriptorNodes = compatibilityApi.typedefNodes

const cache = getMetadataCache(ctx)
Expand All @@ -198,9 +210,8 @@ export const compatibilityHelper = (
getCompatibilityLevel(runtime) >= threshold,
)

const waitDescriptors = () => descriptors
const compatibleRuntime$ = (chainHead: ChainHead$, hash: string | null) =>
combineLatest([waitDescriptors(), chainHead.getRuntimeContext$(hash)])
combineLatest([descriptors, chainHead.getRuntimeContext$(hash)])

const withCompatibleRuntime =
<T>(chainHead: ChainHead$, mapper: (x: T) => string) =>
Expand All @@ -209,7 +220,7 @@ export const compatibilityHelper = (
): Observable<[T, CompatibilityToken | RuntimeToken, RuntimeContext]> =>
combineLatest([
source$.pipe(chainHead.withRuntime(mapper)),
waitDescriptors(),
descriptors,
]).pipe(map(([[x, ctx], descriptors]) => [x, descriptors, ctx]))

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

const entryPoint = getRuntimeEntryPoint(ctx)
if (entryPoint == null) return false

return valueIsCompatibleWithDest(
entryPoint.args,
Expand Down Expand Up @@ -257,7 +269,7 @@ export const compatibilityHelper = (
isCompatible,
getCompatibilityLevel,
getCompatibilityLevels,
waitDescriptors,
descriptors,
withCompatibleRuntime,
compatibleRuntime$,
argsAreCompatible,
Expand Down
Loading

0 comments on commit 0fbe39a

Please sign in to comment.