chore: upgrade papi (#82)
This commit is contained in:
committed by
GitHub
parent
b407071e03
commit
d6bbc24f9d
25
package.json
25
package.json
@@ -14,16 +14,15 @@
|
||||
"semi": false
|
||||
},
|
||||
"dependencies": {
|
||||
"@acala-network/chopsticks-core": "^1.2.1",
|
||||
"@acala-network/chopsticks-core": "^1.2.2",
|
||||
"@noble/hashes": "^2.0.0",
|
||||
"@polkadot-api/descriptors": "file:.papi/descriptors",
|
||||
"@polkadot-api/json-rpc-provider-proxy": "^0.2.4",
|
||||
"@polkadot-api/metadata-builders": "^0.13.2",
|
||||
"@polkadot-api/observable-client": "^0.13.8",
|
||||
"@polkadot-api/react-builder": "0.3.3",
|
||||
"@polkadot-api/substrate-bindings": "^0.16.0",
|
||||
"@polkadot-api/substrate-client": "^0.4.4",
|
||||
"@polkadot-api/tx-utils": "^0.1.3",
|
||||
"@polkadot-api/metadata-builders": "^0.13.4",
|
||||
"@polkadot-api/observable-client": "^0.14.1",
|
||||
"@polkadot-api/react-builder": "0.3.5",
|
||||
"@polkadot-api/substrate-bindings": "^0.16.2",
|
||||
"@polkadot-api/tx-utils": "^0.1.5",
|
||||
"@polkadot-api/utils": "^0.2.0",
|
||||
"@radix-ui/react-accordion": "^1.2.12",
|
||||
"@radix-ui/react-dialog": "^1.1.15",
|
||||
@@ -49,7 +48,7 @@
|
||||
"cmdk": "1.1.1",
|
||||
"idb-keyval": "^6.2.2",
|
||||
"lucide-react": "^0.542.0",
|
||||
"polkadot-api": "^1.16.4",
|
||||
"polkadot-api": "^1.17.1",
|
||||
"react": "^19.1.1",
|
||||
"react-dom": "^19.1.1",
|
||||
"react-portal": "^4.3.0",
|
||||
@@ -65,8 +64,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.34.0",
|
||||
"@tailwindcss/vite": "^4.1.12",
|
||||
"@types/node": "^24.3.0",
|
||||
"@tailwindcss/vite": "^4.1.13",
|
||||
"@types/node": "^24.3.1",
|
||||
"@types/react": "^19.1.12",
|
||||
"@types/react-dom": "^19.1.9",
|
||||
"@types/react-portal": "^4.0.7",
|
||||
@@ -78,10 +77,10 @@
|
||||
"eslint-plugin-react-refresh": "^0.4.20",
|
||||
"globals": "^16.3.0",
|
||||
"prettier": "^3.6.2",
|
||||
"tailwindcss": "^4.1.12",
|
||||
"tailwindcss": "^4.1.13",
|
||||
"typescript": "^5.9.2",
|
||||
"typescript-eslint": "^8.41.0",
|
||||
"vite": "^7.1.3"
|
||||
"typescript-eslint": "^8.42.0",
|
||||
"vite": "^7.1.4"
|
||||
},
|
||||
"packageManager": "pnpm@10.15.0+sha512.486ebc259d3e999a4e8691ce03b5cac4a71cbeca39372a9b762cb500cfdf0873e2cb16abe3d951b1ee2cf012503f027b98b6584e4df22524e0c7450d9ec7aa7b",
|
||||
"pnpm": {
|
||||
|
||||
1181
pnpm-lock.yaml
generated
1181
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -4,13 +4,11 @@ import {
|
||||
} from "@/chopsticks/chopsticks"
|
||||
import { getHashParams, setHashParams } from "@/hashParams"
|
||||
import { getDynamicBuilder, getLookupFn } from "@polkadot-api/metadata-builders"
|
||||
import { getObservableClient } from "@polkadot-api/observable-client"
|
||||
import {
|
||||
decAnyMetadata,
|
||||
HexString,
|
||||
unifyMetadata,
|
||||
} from "@polkadot-api/substrate-bindings"
|
||||
import { createClient as createSubstrateClient } from "@polkadot-api/substrate-client"
|
||||
import { getExtrinsicDecoder } from "@polkadot-api/tx-utils"
|
||||
import { fromHex, toHex } from "@polkadot-api/utils"
|
||||
import { liftSuspense, sinkSuspense, state, SUSPENSE } from "@react-rxjs/core"
|
||||
@@ -49,6 +47,7 @@ import {
|
||||
getWebsocketProvider,
|
||||
WebsocketSource,
|
||||
} from "./websocket"
|
||||
import type { ChainHead$ } from "@polkadot-api/observable-client"
|
||||
|
||||
export type ChainSource = WebsocketSource | SmoldotSource
|
||||
|
||||
@@ -200,25 +199,18 @@ export const chainClient$ = state(
|
||||
map((src) => [src.id, getProvider(src)] as const),
|
||||
switchMap(([id, provider], i) => {
|
||||
const setMetadata = setMetadataFactory(id)
|
||||
const substrateClient = createSubstrateClient(provider)
|
||||
const observableClient = getObservableClient(substrateClient, {
|
||||
getMetadata,
|
||||
setMetadata,
|
||||
})
|
||||
const chainHead = observableClient.chainHead$(2)
|
||||
const client = createClient(provider, {
|
||||
getMetadata: (id) => firstValueFrom(getMetadata(id)),
|
||||
setMetadata,
|
||||
})
|
||||
const chainHead: ChainHead$ = (client as any).___INTERNAL_DO_NOT_USE
|
||||
return concat(
|
||||
i === 0 ? EMPTY : of(SUSPENSE),
|
||||
of({ id, client, substrateClient, observableClient, chainHead }),
|
||||
of({ id, client, chainHead }),
|
||||
NEVER,
|
||||
).pipe(
|
||||
finalize(() => {
|
||||
chainHead.unfollow()
|
||||
client.destroy()
|
||||
observableClient.destroy()
|
||||
}),
|
||||
)
|
||||
}),
|
||||
@@ -254,7 +246,7 @@ export const unsafeApi$ = chainClient$.pipeState(
|
||||
|
||||
const uncachedRuntimeCtx$ = chainClient$.pipeState(
|
||||
switchMap(({ chainHead }) => chainHead.runtime$),
|
||||
filter((v) => !!v),
|
||||
filter(Boolean),
|
||||
)
|
||||
|
||||
export const runtimeCtx$ = chainClient$.pipeState(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { JsonRpcProvider } from "@polkadot-api/substrate-client"
|
||||
import { getSmProvider } from "polkadot-api/sm-provider"
|
||||
import { Chain } from "polkadot-api/smoldot"
|
||||
import { startFromWorker } from "polkadot-api/smoldot/from-worker"
|
||||
import SmWorker from "polkadot-api/smoldot/worker?worker"
|
||||
import type { JsonRpcProvider } from "polkadot-api/ws-provider/web"
|
||||
|
||||
const [dotChainSpec, ksmChainSpec, paseoChainSpec, westendChainSpec] = [
|
||||
import("polkadot-api/chains/polkadot"),
|
||||
@@ -47,7 +47,7 @@ export interface SmoldotSource {
|
||||
}
|
||||
}
|
||||
|
||||
export function createSmoldotSource(
|
||||
export async function createSmoldotSource(
|
||||
id: string,
|
||||
relayChain?: string,
|
||||
): Promise<SmoldotSource> {
|
||||
@@ -58,17 +58,16 @@ export function createSmoldotSource(
|
||||
value: { chainSpec },
|
||||
}))
|
||||
}
|
||||
return import(`./chainspecs/${id}.ts`).then(({ chainSpec }) => {
|
||||
const parsed = JSON.parse(chainSpec)
|
||||
return {
|
||||
id,
|
||||
type: "chainSpec",
|
||||
value: {
|
||||
chainSpec,
|
||||
relayChain: relayChain || parsed.relayChain || parsed.relay_chain,
|
||||
},
|
||||
}
|
||||
})
|
||||
const { chainSpec } = await import(`./chainspecs/${id}.ts`)
|
||||
const parsed = JSON.parse(chainSpec)
|
||||
return {
|
||||
id,
|
||||
type: "chainSpec",
|
||||
value: {
|
||||
chainSpec,
|
||||
relayChain: relayChain || parsed.relayChain || parsed.relay_chain,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export function getSmoldotProvider(source: SmoldotSource): JsonRpcProvider {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { JsonRpcProvider } from "@polkadot-api/substrate-client"
|
||||
import { withPolkadotSdkCompat } from "polkadot-api/polkadot-sdk-compat"
|
||||
import { getWsProvider } from "polkadot-api/ws-provider/web"
|
||||
import { getWsProvider, JsonRpcProvider } from "polkadot-api/ws-provider/web"
|
||||
|
||||
export interface WebsocketSource {
|
||||
type: "websocket"
|
||||
|
||||
Reference in New Issue
Block a user