From 48c9d2833dec60a9f52a51dbd4aa96a92a2d199e Mon Sep 17 00:00:00 2001 From: Victor Oliva Date: Thu, 2 Jan 2025 14:00:21 +0100 Subject: [PATCH 01/13] feat: referenda sdk --- package.json | 3 +- packages/sdk-governance/CHANGELOG.md | 5 + packages/sdk-governance/README.md | 1 + packages/sdk-governance/package.json | 56 ++ packages/sdk-governance/src/index.ts | 8 + packages/sdk-governance/src/keyBy.ts | 5 + packages/sdk-governance/src/preimages.ts | 71 ++ .../src/referenda-chainConfig.ts | 39 ++ .../src/referenda-descriptors.ts | 205 ++++++ .../sdk-governance/src/referenda-sdk-types.ts | 56 ++ packages/sdk-governance/src/referenda-sdk.ts | 186 +++++ packages/sdk-governance/tsconfig.json | 11 + packages/sdk-ink/README.md | 2 +- packages/sdk-ink/package.json | 8 +- pnpm-lock.yaml | 635 +++++++++++++++++- 15 files changed, 1275 insertions(+), 16 deletions(-) create mode 100644 packages/sdk-governance/CHANGELOG.md create mode 100644 packages/sdk-governance/README.md create mode 100644 packages/sdk-governance/package.json create mode 100644 packages/sdk-governance/src/index.ts create mode 100644 packages/sdk-governance/src/keyBy.ts create mode 100644 packages/sdk-governance/src/preimages.ts create mode 100644 packages/sdk-governance/src/referenda-chainConfig.ts create mode 100644 packages/sdk-governance/src/referenda-descriptors.ts create mode 100644 packages/sdk-governance/src/referenda-sdk-types.ts create mode 100644 packages/sdk-governance/src/referenda-sdk.ts create mode 100644 packages/sdk-governance/tsconfig.json diff --git a/package.json b/package.json index aa6ca73..dbc9eee 100644 --- a/package.json +++ b/package.json @@ -23,5 +23,6 @@ "rollup-plugin-esbuild": "^6.1.1", "typescript": "^5.6.3", "vitest": "^2.1.4" - } + }, + "packageManager": "pnpm@8.15.4+sha1.c85a4305534f76d461407b59277b954bac97b5c4" } diff --git a/packages/sdk-governance/CHANGELOG.md b/packages/sdk-governance/CHANGELOG.md new file mode 100644 index 0000000..f6efa27 --- /dev/null +++ b/packages/sdk-governance/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +## Unreleased + +Initial release diff --git a/packages/sdk-governance/README.md b/packages/sdk-governance/README.md new file mode 100644 index 0000000..87d2c2e --- /dev/null +++ b/packages/sdk-governance/README.md @@ -0,0 +1 @@ +# @polkadot-api/ink-sdk diff --git a/packages/sdk-governance/package.json b/packages/sdk-governance/package.json new file mode 100644 index 0000000..ca3ee24 --- /dev/null +++ b/packages/sdk-governance/package.json @@ -0,0 +1,56 @@ +{ + "name": "@polkadot-api/sdk-governance", + "version": "0.0.1", + "sideEffects": false, + "author": "Victor Oliva (https://github.com/voliva)", + "repository": { + "type": "git", + "url": "git+https://github.com/polkadot-api/papi-sdks.git" + }, + "exports": { + ".": { + "node": { + "production": { + "import": "./dist/esm/index.mjs", + "require": "./dist/min/index.js", + "default": "./dist/index.js" + }, + "import": "./dist/esm/index.mjs", + "require": "./dist/index.js", + "default": "./dist/index.js" + }, + "module": "./dist/esm/index.mjs", + "import": "./dist/esm/index.mjs", + "require": "./dist/index.js", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "main": "./dist/index.js", + "module": "./dist/esm/index.mjs", + "browser": "./dist/esm/index.mjs", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], + "scripts": { + "build": "tsc --noEmit && rollup -c ../../rollup.config.js", + "lint": "prettier --check README.md \"src/**/*.{js,jsx,ts,tsx,json,md}\"", + "format": "prettier --write README.md \"src/**/*.{js,jsx,ts,tsx,json,md}\"", + "prepack": "pnpm run build" + }, + "license": "MIT", + "dependencies": { + "@polkadot-api/common-sdk-utils": "workspace:*" + }, + "peerDependencies": { + "@noble/hashes": ">=1.6.1", + "polkadot-api": ">=1.8.1", + "rxjs": ">=7.8.0" + }, + "devDependencies": { + "@noble/hashes": "^1.6.1", + "polkadot-api": "^1.8.1", + "rxjs": "^7.8.1" + } +} diff --git a/packages/sdk-governance/src/index.ts b/packages/sdk-governance/src/index.ts new file mode 100644 index 0000000..cfe482b --- /dev/null +++ b/packages/sdk-governance/src/index.ts @@ -0,0 +1,8 @@ +export { createReferendaSdk } from "./referenda-sdk" +export type * from "./referenda-descriptors" +export type * from "./referenda-sdk-types" +export { + type Origin, + polkadotSpenderOrigin, + kusamaSpenderOrigin, +} from "./referenda-chainConfig" diff --git a/packages/sdk-governance/src/keyBy.ts b/packages/sdk-governance/src/keyBy.ts new file mode 100644 index 0000000..85c3eef --- /dev/null +++ b/packages/sdk-governance/src/keyBy.ts @@ -0,0 +1,5 @@ +export const keyBy = ( + arr: Iterable, + mapFn: (v: T) => K, +): Record => + Object.fromEntries(Array.from(arr).map((v) => [mapFn(v), v])) as any diff --git a/packages/sdk-governance/src/preimages.ts b/packages/sdk-governance/src/preimages.ts new file mode 100644 index 0000000..c8e78fe --- /dev/null +++ b/packages/sdk-governance/src/preimages.ts @@ -0,0 +1,71 @@ +import { Binary } from "polkadot-api" +import { PreimagesBounded } from "./referenda-descriptors" + +const preimageCache = new Map>() + +export const getPreimageResolver = ( + getPreimageValues: ( + keys: [[Binary, number]][], + ) => Promise<(Binary | undefined)[]>, +) => { + const batched = batch((preimages: [Binary, number][]) => + getPreimageValues(preimages.map((v) => [v])), + ) + + return async (proposal: PreimagesBounded) => { + if (proposal.type === "Legacy") + throw new Error("Legacy proposals can't be resolved") + if (proposal.type === "Inline") return proposal.value + + const cached = preimageCache.get(proposal.value.hash.asHex()) + if (cached) return cached + const promise = (async () => { + const result = await batched([proposal.value.hash, proposal.value.len]) + if (!result) + throw new Error(`Preimage ${proposal.value.hash.asHex()} not found`) + return result + })() + preimageCache.set(proposal.value.hash.asHex(), promise) + return promise + } +} + +const batch = (fn: (values: T[]) => Promise) => { + let batched: Array<{ + value: T + resolve: (res: R) => void + reject: (err: any) => void + }> | null = null + + async function execute() { + if (!batched) return + try { + const result = await fn(batched.map((v) => v.value)) + batched.forEach(({ resolve }, i) => resolve(result[i])) + } catch (ex) { + console.error(ex) + batched.forEach(({ reject }) => reject(ex)) + } + batched = null + } + + return (value: T): Promise => + new Promise((resolve, reject) => { + if (!batched) { + batched = [ + { + value, + resolve, + reject, + }, + ] + setTimeout(execute) + } else { + batched.push({ + value, + resolve, + reject, + }) + } + }) +} diff --git a/packages/sdk-governance/src/referenda-chainConfig.ts b/packages/sdk-governance/src/referenda-chainConfig.ts new file mode 100644 index 0000000..742b6eb --- /dev/null +++ b/packages/sdk-governance/src/referenda-chainConfig.ts @@ -0,0 +1,39 @@ +const SpenderOrigin = { + Treasurer: "Treasurer", + SmallTipper: "SmallTipper", + BigTipper: "BigTipper", + SmallSpender: "SmallSpender", + MediumSpender: "MediumSpender", + BigSpender: "BigSpender", +} as const; +export type Origin = (typeof SpenderOrigin)[keyof typeof SpenderOrigin]; + +export const originToTrack: Record = { + Treasurer: "treasurer", + SmallTipper: "small_tipper", + BigTipper: "big_tipper", + SmallSpender: "small_spender", + MediumSpender: "medium_spender", + BigSpender: "big_spender", +}; + +const DOT_UNIT = 10_000_000_000n; +export const polkadotSpenderOrigin = (value: bigint): Origin | null => { + if (value <= 250n * DOT_UNIT) return SpenderOrigin.SmallTipper; + if (value <= 1_000n * DOT_UNIT) return SpenderOrigin.BigTipper; + if (value <= 10_000n * DOT_UNIT) return SpenderOrigin.SmallSpender; + if (value <= 100_000n * DOT_UNIT) return SpenderOrigin.MediumSpender; + if (value <= 1_000_000n * DOT_UNIT) return SpenderOrigin.BigSpender; + if (value <= 10_000_000n * DOT_UNIT) return SpenderOrigin.Treasurer; + return null; +}; + +const KSM_UNIT = 1_000_000_000_000n; +export const kusamaSpenderOrigin = (value: bigint): Origin | null => { + if (value <= 1n * KSM_UNIT) return SpenderOrigin.SmallTipper; + if (value <= 5n * KSM_UNIT) return SpenderOrigin.BigTipper; + if (value <= 333n * KSM_UNIT) return SpenderOrigin.SmallSpender; + if (value <= 3_333n * KSM_UNIT) return SpenderOrigin.MediumSpender; + if (value <= 33_333n * KSM_UNIT) return SpenderOrigin.BigSpender; + return SpenderOrigin.Treasurer; +}; diff --git a/packages/sdk-governance/src/referenda-descriptors.ts b/packages/sdk-governance/src/referenda-descriptors.ts new file mode 100644 index 0000000..d18412f --- /dev/null +++ b/packages/sdk-governance/src/referenda-descriptors.ts @@ -0,0 +1,205 @@ +import { + ApisTypedef, + Binary, + Enum, + FixedSizeArray, + PalletsTypedef, + PlainDescriptor, + SS58String, + StorageDescriptor, + TxCallData, + TxDescriptor, + TypedApi, +} from "polkadot-api" + +type WhoAmount = { + who: SS58String + amount: bigint +} +type BasicReferndumInfo = [number, WhoAmount | undefined, WhoAmount | undefined] + +export type PolkadotRuntimeOriginCaller = Enum<{ + system: Enum<{ + Root: undefined + Signed: SS58String + None: undefined + }> + Origins: Enum<{ + StakingAdmin: undefined + Treasurer: undefined + FellowshipAdmin: undefined + GeneralAdmin: undefined + AuctionAdmin: undefined + LeaseAdmin: undefined + ReferendumCanceller: undefined + ReferendumKiller: undefined + SmallTipper: undefined + BigTipper: undefined + SmallSpender: undefined + MediumSpender: undefined + BigSpender: undefined + WhitelistedCaller: undefined + WishForChange: undefined + }> + ParachainsOrigin: Enum<{ + Parachain: number + }> + XcmPallet: any + Void: undefined +}> + +export type PreimagesBounded = Enum<{ + Legacy: { + hash: Binary + } + Inline: Binary + Lookup: { + hash: Binary + len: number + } +}> +export type TraitsScheduleDispatchTime = Enum<{ + At: number + After: number +}> + +export type ReferendumInfo = Enum<{ + Ongoing: { + track: number + origin: PolkadotRuntimeOriginCaller + proposal: PreimagesBounded + enactment: Enum<{ + At: number + After: number + }> + submitted: number + submission_deposit: WhoAmount + decision_deposit?: WhoAmount | undefined + deciding?: + | { + since: number + confirming?: number | undefined + } + | undefined + tally: { + ayes: bigint + nays: bigint + support: bigint + } + in_queue: boolean + alarm?: [number, FixedSizeArray<2, number>] | undefined + } + Approved: BasicReferndumInfo + Rejected: BasicReferndumInfo + Cancelled: BasicReferndumInfo + TimedOut: BasicReferndumInfo + Killed: number +}> + +export type ReferendaTypesCurve = Enum<{ + LinearDecreasing: { + length: number + floor: number + ceil: number + } + SteppedDecreasing: { + begin: number + end: number + step: number + period: number + } + Reciprocal: { + factor: bigint + x_offset: bigint + y_offset: bigint + } +}> + +type ReferendaSdkPallets = PalletsTypedef< + { + Preimage: { + PreimageFor: StorageDescriptor< + [Key: [Binary, number]], + Binary, + true, + never + > + } + Referenda: { + /** + * Information concerning any given referendum. + */ + ReferendumInfoFor: StorageDescriptor< + [Key: number], + ReferendumInfo, + true, + never + > + } + }, + { + Referenda: { + submit: TxDescriptor<{ + proposal_origin: PolkadotRuntimeOriginCaller + proposal: PreimagesBounded + enactment_moment: TraitsScheduleDispatchTime + }> + } + Utility: { + batch_all: TxDescriptor<{ + calls: Array + }> + } + Preimage: { + note_preimage: TxDescriptor<{ + bytes: Binary + }> + } + }, + { + Referenda: { + Submitted: PlainDescriptor<{ + index: number + track: number + proposal: PreimagesBounded + }> + } + }, + {}, + { + Referenda: { + Tracks: PlainDescriptor< + Array< + [ + number, + { + name: string + max_deciding: number + decision_deposit: bigint + prepare_period: number + decision_period: number + confirm_period: number + min_enactment_period: number + min_approval: ReferendaTypesCurve + min_support: ReferendaTypesCurve + }, + ] + > + > + } + } +> +type ReferendaSdkDefinition = SdkDefinition< + ReferendaSdkPallets, + ApisTypedef<{}> +> +export type ReferendaSdkTypedApi = TypedApi + +type SdkDefinition = { + descriptors: Promise & { + pallets: P + apis: R + } + asset: any + metadataTypes: any +} diff --git a/packages/sdk-governance/src/referenda-sdk-types.ts b/packages/sdk-governance/src/referenda-sdk-types.ts new file mode 100644 index 0000000..9103d42 --- /dev/null +++ b/packages/sdk-governance/src/referenda-sdk-types.ts @@ -0,0 +1,56 @@ +import { Binary, Transaction, TxEvent } from "polkadot-api" +import { Origin } from "./referenda-chainConfig" +import { + PolkadotRuntimeOriginCaller, + PreimagesBounded, + ReferendumInfo, + TraitsScheduleDispatchTime, +} from "./referenda-descriptors" + +type RawOngoingReferendum = (ReferendumInfo & { type: "Ongoing" })["value"] + +export interface ReferendumDetails { + title?: string +} + +export type OngoingReferendum = Omit & { + id: number + proposal: { + rawValue: PreimagesBounded + resolve: () => Promise + decodedCall: () => Promise<{ + type: string + value: { + type: string + value: any + } + }> + } + getDetails: (apiKey: string) => Promise +} + +export interface ReferendaSdkConfig { + spenderOrigin: (value: bigint) => Origin | null +} + +export interface ReferendaSdk { + getOngoingReferenda(): Promise + getSpenderTrack(value: bigint): { + origin: PolkadotRuntimeOriginCaller + enactment: () => Promise + } + createReferenda( + origin: PolkadotRuntimeOriginCaller, + enactment: TraitsScheduleDispatchTime, + proposal: Binary, + ): Transaction + createSpenderReferenda( + callData: Binary, + value: bigint, + ): Transaction + getSubmittedReferendum(txEvent: TxEvent): { + index: number + track: number + proposal: PreimagesBounded + } | null +} diff --git a/packages/sdk-governance/src/referenda-sdk.ts b/packages/sdk-governance/src/referenda-sdk.ts new file mode 100644 index 0000000..a392da9 --- /dev/null +++ b/packages/sdk-governance/src/referenda-sdk.ts @@ -0,0 +1,186 @@ +import { blake2b } from "@noble/hashes/blake2b" +import { Binary, TxEvent } from "polkadot-api" +import { keyBy } from "./keyBy" +import { getPreimageResolver } from "./preimages" +import { originToTrack, polkadotSpenderOrigin } from "./referenda-chainConfig" +import { + PolkadotRuntimeOriginCaller, + ReferendaSdkTypedApi, + ReferendumInfo, +} from "./referenda-descriptors" +import { + OngoingReferendum, + ReferendaSdk, + ReferendaSdkConfig, +} from "./referenda-sdk-types" + +const MAX_INLINE_SIZE = 128 +type RawOngoingReferendum = (ReferendumInfo & { type: "Ongoing" })["value"] + +const defaultConfig: ReferendaSdkConfig = { + spenderOrigin: polkadotSpenderOrigin, +} +export function createReferendaSdk( + typedApi: ReferendaSdkTypedApi, + config?: Partial, +): ReferendaSdk { + const { spenderOrigin } = { ...defaultConfig, ...config } + const resolvePreimage = getPreimageResolver( + typedApi.query.Preimage.PreimageFor.getValues, + ) + + function enhanceOngoingReferendum( + id: number, + referendum: RawOngoingReferendum, + ): OngoingReferendum { + const resolveProposal = () => resolvePreimage(referendum.proposal) + + return { + ...referendum, + id, + proposal: { + rawValue: referendum.proposal, + resolve: resolveProposal, + decodedCall: async () => { + const proposal = await resolveProposal() + const token = await typedApi.compatibilityToken + + return typedApi.txFromCallData(proposal, token).decodedCall + }, + }, + async getDetails(subscanApiKey: string) { + const result = await fetch( + "https://polkadot.api.subscan.io/api/scan/referenda/referendum", + { + method: "POST", + body: JSON.stringify({ + referendum_index: id, + }), + headers: { + "x-api-key": subscanApiKey, + }, + }, + ).then((r) => r.json()) + // status = "Confirm" => Confirming + + return { + title: result.data.title, + } + }, + } + } + + async function getOngoingReferenda() { + const entries = + await typedApi.query.Referenda.ReferendumInfoFor.getEntries() + + return entries + .map(({ keyArgs: [id], value: info }): OngoingReferendum | null => { + if (info.type !== "Ongoing") return null + + return enhanceOngoingReferendum(id, info.value) + }) + .filter((v) => !!v) + } + + const getSpenderTrack: ReferendaSdk["getSpenderTrack"] = (value) => { + const spenderOriginType = spenderOrigin(value) + const origin: PolkadotRuntimeOriginCaller = spenderOriginType + ? { + type: "Origins", + value: { + type: spenderOriginType, + value: undefined, + }, + } + : { + type: "system", + value: { type: "Root", value: undefined }, + } + + return { + origin, + enactment: async () => { + const referendaTracks = await typedApi.constants.Referenda.Tracks() + const tracks = keyBy( + referendaTracks.map(([_, track]) => track), + (track) => track.name, + ) + const rootEnactment = tracks["root"].min_enactment_period + if (!spenderOriginType) return rootEnactment + + const track = originToTrack[spenderOriginType] ?? "" + return tracks[track]?.min_enactment_period ?? rootEnactment + }, + } + } + + const createReferenda: ReferendaSdk["createReferenda"] = ( + origin, + enactment, + proposal, + ) => { + if (proposal.asBytes().length <= MAX_INLINE_SIZE) { + return typedApi.tx.Referenda.submit({ + enactment_moment: enactment, + proposal: { + type: "Inline", + value: proposal, + }, + proposal_origin: origin, + }) + } + + const hash = blake2b(proposal.asBytes()) + + return typedApi.tx.Utility.batch_all({ + calls: [ + // Expose the deposit required for the preimage + // maybe as part of fee + deposit + typedApi.tx.Preimage.note_preimage({ + bytes: proposal, + }).decodedCall, + typedApi.tx.Referenda.submit({ + enactment_moment: enactment, + proposal: { + type: "Lookup", + value: { + hash: Binary.fromBytes(hash), + len: proposal.asBytes().length, + }, + }, + proposal_origin: origin, + }).decodedCall, + ], + }) + } + + const createSpenderReferenda: ReferendaSdk["createSpenderReferenda"] = ( + callData, + value, + ) => { + const spenderTrack = getSpenderTrack(value) + + return createReferenda( + spenderTrack.origin, + { + type: "After", + value: 0, + }, + callData, + ) + } + + const getSubmittedReferendum = (txEvent: TxEvent) => + "events" in txEvent + ? (typedApi.event.Referenda.Submitted.filter(txEvent.events)[0] ?? null) + : null + + return { + getOngoingReferenda, + getSpenderTrack, + createReferenda, + createSpenderReferenda, + getSubmittedReferendum, + } +} diff --git a/packages/sdk-governance/tsconfig.json b/packages/sdk-governance/tsconfig.json new file mode 100644 index 0000000..01dfe9d --- /dev/null +++ b/packages/sdk-governance/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.base", + "include": ["src", "tests"], + "compilerOptions": { + "baseUrl": "src", + "resolveJsonModule": true, + "paths": { + "@/*": ["*"] + } + } +} diff --git a/packages/sdk-ink/README.md b/packages/sdk-ink/README.md index 87d2c2e..b22026a 100644 --- a/packages/sdk-ink/README.md +++ b/packages/sdk-ink/README.md @@ -1 +1 @@ -# @polkadot-api/ink-sdk +# @polkadot-api/sdk-ink diff --git a/packages/sdk-ink/package.json b/packages/sdk-ink/package.json index 1aa7d67..731cd97 100644 --- a/packages/sdk-ink/package.json +++ b/packages/sdk-ink/package.json @@ -44,13 +44,13 @@ "@polkadot-api/common-sdk-utils": "workspace:*" }, "peerDependencies": { - "@polkadot-api/ink-contracts": ">=0.2.1", - "polkadot-api": ">=1.7.4", + "@polkadot-api/ink-contracts": ">=0.2.4", + "polkadot-api": ">=1.8.1", "rxjs": ">=7.8.0" }, "devDependencies": { - "@polkadot-api/ink-contracts": "^0.2.1", - "polkadot-api": "^1.7.4", + "@polkadot-api/ink-contracts": "^0.2.4", + "polkadot-api": "^1.8.1", "rxjs": "^7.8.1" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8793429..3af1ea4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -25,7 +25,7 @@ importers: version: 6.1.1(rollup@4.25.0)(typescript@5.6.3) rollup-plugin-esbuild: specifier: ^6.1.1 - version: 6.1.1(esbuild@0.24.0)(rollup@4.25.0) + version: 6.1.1(esbuild@0.24.2)(rollup@4.25.0) typescript: specifier: ^5.6.3 version: 5.6.3 @@ -70,6 +70,22 @@ importers: specifier: ^7.8.1 version: 7.8.1 + packages/sdk-governance: + dependencies: + '@polkadot-api/common-sdk-utils': + specifier: workspace:* + version: link:../common-utils + devDependencies: + '@noble/hashes': + specifier: ^1.6.1 + version: 1.6.1 + polkadot-api: + specifier: ^1.8.1 + version: 1.8.1(rxjs@7.8.1) + rxjs: + specifier: ^7.8.1 + version: 7.8.1 + packages/sdk-ink: dependencies: '@polkadot-api/common-sdk-utils': @@ -77,11 +93,11 @@ importers: version: link:../common-utils devDependencies: '@polkadot-api/ink-contracts': - specifier: ^0.2.1 - version: 0.2.1 + specifier: ^0.2.4 + version: 0.2.4 polkadot-api: - specifier: ^1.7.4 - version: 1.7.4(rxjs@7.8.1) + specifier: ^1.8.1 + version: 1.8.1(rxjs@7.8.1) rxjs: specifier: ^7.8.1 version: 7.8.1 @@ -126,6 +142,15 @@ packages: requiresBuild: true optional: true + /@esbuild/aix-ppc64@0.24.2: + resolution: {integrity: sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-arm64@0.21.5: resolution: {integrity: sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==} engines: {node: '>=12'} @@ -143,6 +168,15 @@ packages: requiresBuild: true optional: true + /@esbuild/android-arm64@0.24.2: + resolution: {integrity: sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-arm@0.21.5: resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==} engines: {node: '>=12'} @@ -160,6 +194,15 @@ packages: requiresBuild: true optional: true + /@esbuild/android-arm@0.24.2: + resolution: {integrity: sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-x64@0.21.5: resolution: {integrity: sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==} engines: {node: '>=12'} @@ -177,6 +220,15 @@ packages: requiresBuild: true optional: true + /@esbuild/android-x64@0.24.2: + resolution: {integrity: sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/darwin-arm64@0.21.5: resolution: {integrity: sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==} engines: {node: '>=12'} @@ -194,6 +246,15 @@ packages: requiresBuild: true optional: true + /@esbuild/darwin-arm64@0.24.2: + resolution: {integrity: sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@esbuild/darwin-x64@0.21.5: resolution: {integrity: sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==} engines: {node: '>=12'} @@ -211,6 +272,15 @@ packages: requiresBuild: true optional: true + /@esbuild/darwin-x64@0.24.2: + resolution: {integrity: sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@esbuild/freebsd-arm64@0.21.5: resolution: {integrity: sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==} engines: {node: '>=12'} @@ -228,6 +298,15 @@ packages: requiresBuild: true optional: true + /@esbuild/freebsd-arm64@0.24.2: + resolution: {integrity: sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/freebsd-x64@0.21.5: resolution: {integrity: sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==} engines: {node: '>=12'} @@ -245,6 +324,15 @@ packages: requiresBuild: true optional: true + /@esbuild/freebsd-x64@0.24.2: + resolution: {integrity: sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-arm64@0.21.5: resolution: {integrity: sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==} engines: {node: '>=12'} @@ -262,6 +350,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-arm64@0.24.2: + resolution: {integrity: sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-arm@0.21.5: resolution: {integrity: sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==} engines: {node: '>=12'} @@ -279,6 +376,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-arm@0.24.2: + resolution: {integrity: sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-ia32@0.21.5: resolution: {integrity: sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==} engines: {node: '>=12'} @@ -296,6 +402,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-ia32@0.24.2: + resolution: {integrity: sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-loong64@0.21.5: resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==} engines: {node: '>=12'} @@ -313,6 +428,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-loong64@0.24.2: + resolution: {integrity: sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-mips64el@0.21.5: resolution: {integrity: sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==} engines: {node: '>=12'} @@ -330,6 +454,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-mips64el@0.24.2: + resolution: {integrity: sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-ppc64@0.21.5: resolution: {integrity: sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==} engines: {node: '>=12'} @@ -347,6 +480,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-ppc64@0.24.2: + resolution: {integrity: sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-riscv64@0.21.5: resolution: {integrity: sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==} engines: {node: '>=12'} @@ -364,6 +506,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-riscv64@0.24.2: + resolution: {integrity: sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-s390x@0.21.5: resolution: {integrity: sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==} engines: {node: '>=12'} @@ -381,6 +532,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-s390x@0.24.2: + resolution: {integrity: sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-x64@0.21.5: resolution: {integrity: sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==} engines: {node: '>=12'} @@ -398,6 +558,24 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-x64@0.24.2: + resolution: {integrity: sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/netbsd-arm64@0.24.2: + resolution: {integrity: sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/netbsd-x64@0.21.5: resolution: {integrity: sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==} engines: {node: '>=12'} @@ -415,6 +593,15 @@ packages: requiresBuild: true optional: true + /@esbuild/netbsd-x64@0.24.2: + resolution: {integrity: sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/openbsd-arm64@0.24.0: resolution: {integrity: sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg==} engines: {node: '>=18'} @@ -423,6 +610,15 @@ packages: requiresBuild: true optional: true + /@esbuild/openbsd-arm64@0.24.2: + resolution: {integrity: sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/openbsd-x64@0.21.5: resolution: {integrity: sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==} engines: {node: '>=12'} @@ -440,6 +636,15 @@ packages: requiresBuild: true optional: true + /@esbuild/openbsd-x64@0.24.2: + resolution: {integrity: sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/sunos-x64@0.21.5: resolution: {integrity: sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==} engines: {node: '>=12'} @@ -457,6 +662,15 @@ packages: requiresBuild: true optional: true + /@esbuild/sunos-x64@0.24.2: + resolution: {integrity: sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-arm64@0.21.5: resolution: {integrity: sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==} engines: {node: '>=12'} @@ -474,6 +688,15 @@ packages: requiresBuild: true optional: true + /@esbuild/win32-arm64@0.24.2: + resolution: {integrity: sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-ia32@0.21.5: resolution: {integrity: sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==} engines: {node: '>=12'} @@ -491,6 +714,15 @@ packages: requiresBuild: true optional: true + /@esbuild/win32-ia32@0.24.2: + resolution: {integrity: sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-x64@0.21.5: resolution: {integrity: sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==} engines: {node: '>=12'} @@ -508,6 +740,15 @@ packages: requiresBuild: true optional: true + /@esbuild/win32-x64@0.24.2: + resolution: {integrity: sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@isaacs/cliui@8.0.2: resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} @@ -554,6 +795,11 @@ packages: /@noble/hashes@1.5.0: resolution: {integrity: sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==} engines: {node: ^14.21.3 || >=16} + dev: false + + /@noble/hashes@1.6.1: + resolution: {integrity: sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w==} + engines: {node: ^14.21.3 || >=16} /@pkgjs/parseargs@0.11.0: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} @@ -561,6 +807,48 @@ packages: requiresBuild: true optional: true + /@polkadot-api/cli@0.10.0: + resolution: {integrity: sha512-ItuM4l3ZPJYy1dx4X50X3rZK7TpWT0unBGRe+mMRcY4TyRkWK2nIMwcA+ggqBiEaM22SpFh9DCixZtRt43OKkg==} + hasBin: true + dependencies: + '@commander-js/extra-typings': 12.1.0(commander@12.1.0) + '@polkadot-api/codegen': 0.12.12 + '@polkadot-api/ink-contracts': 0.2.4 + '@polkadot-api/json-rpc-provider': 0.0.4 + '@polkadot-api/known-chains': 0.6.0 + '@polkadot-api/metadata-compatibility': 0.1.14 + '@polkadot-api/observable-client': 0.7.0(@polkadot-api/substrate-client@0.3.0)(rxjs@7.8.1) + '@polkadot-api/polkadot-sdk-compat': 2.3.1 + '@polkadot-api/sm-provider': 0.1.7(@polkadot-api/smoldot@0.3.8) + '@polkadot-api/smoldot': 0.3.8 + '@polkadot-api/substrate-bindings': 0.11.0 + '@polkadot-api/substrate-client': 0.3.0 + '@polkadot-api/utils': 0.1.2 + '@polkadot-api/wasm-executor': 0.1.2 + '@polkadot-api/ws-provider': 0.3.6 + '@types/node': 22.10.3 + commander: 12.1.0 + execa: 9.5.2 + fs.promises.exists: 1.1.4 + ora: 8.1.1 + read-pkg: 9.0.1 + rxjs: 7.8.1 + tsc-prog: 2.3.0(typescript@5.7.2) + tsup: 8.3.5(typescript@5.7.2) + typescript: 5.7.2 + write-package: 7.1.0 + transitivePeerDependencies: + - '@microsoft/api-extractor' + - '@swc/core' + - bufferutil + - jiti + - postcss + - supports-color + - tsx + - utf-8-validate + - yaml + dev: true + /@polkadot-api/cli@0.9.18: resolution: {integrity: sha512-biax8MLK8GO6/YTy0NfkCYB1HT5OEAeHr+9ITyv4klNvF/4uqj3gb0XODjCpFX0aCUp6q8aIFMDhUc7rN47AYg==} hasBin: true @@ -602,6 +890,16 @@ packages: - utf-8-validate - yaml + /@polkadot-api/codegen@0.12.12: + resolution: {integrity: sha512-0jurC0ziMs0CEmHCZ8o2b4kE2pJz0rb/7LzeX/r0ngx60IJV14KSAFoAfipEMgmui3uTsP9goT/q4RmgnZ/2CQ==} + dependencies: + '@polkadot-api/ink-contracts': 0.2.4 + '@polkadot-api/metadata-builders': 0.10.0 + '@polkadot-api/metadata-compatibility': 0.1.14 + '@polkadot-api/substrate-bindings': 0.11.0 + '@polkadot-api/utils': 0.1.2 + dev: true + /@polkadot-api/codegen@0.12.8: resolution: {integrity: sha512-uFDi6EYUVyqccTbu8vUsLHMrMTSPh/0D5CwoHuz5rhNH559cdR1kBf/EInhI6AVlnzzUBMAatOc4y5c2bkR+QA==} dependencies: @@ -619,20 +917,44 @@ packages: '@polkadot-api/utils': 0.1.2 scale-ts: 1.6.1 + /@polkadot-api/ink-contracts@0.2.4: + resolution: {integrity: sha512-peBYPJ0UNMpfTk6iNnDv9293miuOyc8L29UbdtcnEBUKgEnhX4U0ke4oFmbuknYMATHU9nyMY3ftXPcYDpTmwQ==} + dependencies: + '@polkadot-api/metadata-builders': 0.10.0 + '@polkadot-api/substrate-bindings': 0.11.0 + '@polkadot-api/utils': 0.1.2 + scale-ts: 1.6.1 + dev: true + /@polkadot-api/json-rpc-provider-proxy@0.2.3: resolution: {integrity: sha512-dukH94xmV2MUYNZZFhGhnaE1WIjVOPlNpcuzYQRdKYLj3zZJnkA6PHPNHiHd4N8XaCTjaDF3GcBTi6MZ0wtbhg==} + /@polkadot-api/json-rpc-provider-proxy@0.2.4: + resolution: {integrity: sha512-nuGoY9QpBAiRU7xmXN3nugFvPcnSu3IxTLm1OWcNTGlZ1LW5bvdQHz3JLk56+Jlyb3GJ971hqdg2DJsMXkKCOg==} + dev: true + /@polkadot-api/json-rpc-provider@0.0.4: resolution: {integrity: sha512-9cDijLIxzHOBuq6yHqpqjJ9jBmXrctjc1OFqU+tQrS96adQze3mTIH6DTgfb/0LMrqxzxffz1HQGrIlEH00WrA==} /@polkadot-api/known-chains@0.5.6: resolution: {integrity: sha512-DYxpIfhIvWpjjZ3Y7X6Aomfs1/IbDyU+8R2ijDd6e4OBJzGrSjoU1wq4MZktbCivDXVCSF+NfIQpaHB8roBmOQ==} + /@polkadot-api/known-chains@0.6.0: + resolution: {integrity: sha512-qVNJhqqtjPYgpyEb70KyZPIKunhgR4D3AcZwx5D7QCOumSigEi3vB95pfHHsqER+44jYrlFqzGWauaMMZqQl2Q==} + dev: true + /@polkadot-api/logs-provider@0.0.6: resolution: {integrity: sha512-4WgHlvy+xee1ADaaVf6+MlK/+jGMtsMgAzvbQOJZnP4PfQuagoTqaeayk8HYKxXGphogLlPbD06tANxcb+nvAg==} dependencies: '@polkadot-api/json-rpc-provider': 0.0.4 + /@polkadot-api/metadata-builders@0.10.0: + resolution: {integrity: sha512-IQ9WHnyo0nuWudC39wW1wpRl2QZLL8O8WizwB2JjMv+UODJPsSouZpnGLfQo6mX2umGI1IDsTklb2frQOgVuWg==} + dependencies: + '@polkadot-api/substrate-bindings': 0.11.0 + '@polkadot-api/utils': 0.1.2 + dev: true + /@polkadot-api/metadata-builders@0.9.1: resolution: {integrity: sha512-yZPm9KKn7QydbjMQMzhKHekDuQSdSZXYdCyqGt74HSNz9DdJSdpFNwHv0p+vmp+9QDlVsKK7nbUTjYxLZT4vCA==} dependencies: @@ -645,6 +967,13 @@ packages: '@polkadot-api/metadata-builders': 0.9.1 '@polkadot-api/substrate-bindings': 0.9.3 + /@polkadot-api/metadata-compatibility@0.1.14: + resolution: {integrity: sha512-O7b2+d1uMYFWpe6yW6kY84PGwzdEPBeLopAX9vJl3WTBavF4GYjztM/BD9GjnZ6n2ehmSRjowqZu7EVxYvQYvQ==} + dependencies: + '@polkadot-api/metadata-builders': 0.10.0 + '@polkadot-api/substrate-bindings': 0.11.0 + dev: true + /@polkadot-api/observable-client@0.6.2(@polkadot-api/substrate-client@0.3.0)(rxjs@7.8.1): resolution: {integrity: sha512-0GsJDg95FA8idC+epQTrwkLmWdDl6JdSGuAVmy70TE1dVXC8l6lmVWpSX2ltF8ENqA7oXy7DlDEP7FrbvjvHfg==} peerDependencies: @@ -657,6 +986,19 @@ packages: '@polkadot-api/utils': 0.1.2 rxjs: 7.8.1 + /@polkadot-api/observable-client@0.7.0(@polkadot-api/substrate-client@0.3.0)(rxjs@7.8.1): + resolution: {integrity: sha512-ssDilIFNR+tEMbb9GE/fRXjhKvuFV32DANn5BuQWKOyDbE/d/G206SxLIgBPEQ4HbEzASxFSXJ5L1goDNkJdUA==} + peerDependencies: + '@polkadot-api/substrate-client': 0.3.0 + rxjs: '>=7.8.0' + dependencies: + '@polkadot-api/metadata-builders': 0.10.0 + '@polkadot-api/substrate-bindings': 0.11.0 + '@polkadot-api/substrate-client': 0.3.0 + '@polkadot-api/utils': 0.1.2 + rxjs: 7.8.1 + dev: true + /@polkadot-api/pjs-signer@0.6.0: resolution: {integrity: sha512-Dfji5Xbq820iKv5HTCWE1iDlXI/DtNYXTZOFLiL8banrSrcF5wvTq3QFknUv+q1TfwNYEZazT4eG3Dx/XAsosw==} dependencies: @@ -666,6 +1008,16 @@ packages: '@polkadot-api/substrate-bindings': 0.9.3 '@polkadot-api/utils': 0.1.2 + /@polkadot-api/pjs-signer@0.6.3: + resolution: {integrity: sha512-xXLwtDACcFRi5gyze1sfS/GBTjvs1E12R4zvB6TiIzUskFoc26+5xEqjpgo6VRnuIMVv5kWkCEQt+b5F7t76sw==} + dependencies: + '@polkadot-api/metadata-builders': 0.10.0 + '@polkadot-api/polkadot-signer': 0.1.6 + '@polkadot-api/signers-common': 0.1.4 + '@polkadot-api/substrate-bindings': 0.11.0 + '@polkadot-api/utils': 0.1.2 + dev: true + /@polkadot-api/polkadot-sdk-compat@2.3.1: resolution: {integrity: sha512-rb8IWmPRhKWD9NG4zh2n4q0HlEAvq+Cv1CbD+8YxH0XAqIIiFA+ch5JeDCIxQYngkn/43B0Gs7Gtzh18yv2yoA==} dependencies: @@ -677,12 +1029,22 @@ packages: /@polkadot-api/signer@0.1.10: resolution: {integrity: sha512-SW4aqfM0hxsZqjX/pHdCZmVdS9bAXKwRSKzcb8vT9AA5YAq3si/Rue5eGGw8gRVcHOr5TdTicMjjaFDfebDyfQ==} dependencies: - '@noble/hashes': 1.5.0 + '@noble/hashes': 1.6.1 '@polkadot-api/polkadot-signer': 0.1.6 '@polkadot-api/signers-common': 0.1.1 '@polkadot-api/substrate-bindings': 0.9.3 '@polkadot-api/utils': 0.1.2 + /@polkadot-api/signer@0.1.13: + resolution: {integrity: sha512-QFBeupXDoK/XVno9RdnUoh5HiPC8YC+HtbL0Jz61WrfnBRo77Trv5b0w7pUngpqjQzRY1w68TbETNTqRPtZOFA==} + dependencies: + '@noble/hashes': 1.6.1 + '@polkadot-api/polkadot-signer': 0.1.6 + '@polkadot-api/signers-common': 0.1.4 + '@polkadot-api/substrate-bindings': 0.11.0 + '@polkadot-api/utils': 0.1.2 + dev: true + /@polkadot-api/signers-common@0.1.1: resolution: {integrity: sha512-327dpMXr1lccrmG94MJqprkGGF5yZFYDBwl+YXl1ATeTDcaW1vzffCAPqx0vWytb2x3AWilJWyc3Q6xFUWzy4A==} dependencies: @@ -691,6 +1053,15 @@ packages: '@polkadot-api/substrate-bindings': 0.9.3 '@polkadot-api/utils': 0.1.2 + /@polkadot-api/signers-common@0.1.4: + resolution: {integrity: sha512-KMJuu6IMB0K17ppCZM6TSwshTQ8Zgx59+BPVouqnU8pxr+h7EqWf7wv72WyytEAbThWIqFr1VHIdaCj54eeVlg==} + dependencies: + '@polkadot-api/metadata-builders': 0.10.0 + '@polkadot-api/polkadot-signer': 0.1.6 + '@polkadot-api/substrate-bindings': 0.11.0 + '@polkadot-api/utils': 0.1.2 + dev: true + /@polkadot-api/sm-provider@0.1.6(@polkadot-api/smoldot@0.3.5): resolution: {integrity: sha512-+1lRIH6srYFpeFCN35GtFiw+H4Cs+6NmoJMDRdv9EOYg7I2LKmt97N8JNQ/3UVmnH5Rud0U+iaqnat5cJsv1wg==} peerDependencies: @@ -700,6 +1071,16 @@ packages: '@polkadot-api/json-rpc-provider-proxy': 0.2.3 '@polkadot-api/smoldot': 0.3.5 + /@polkadot-api/sm-provider@0.1.7(@polkadot-api/smoldot@0.3.8): + resolution: {integrity: sha512-BhNKVeIFZdawpPVadXszLl8IP4EDjcLHe/GchfRRFkvoNFuwS2nNv/npYIqCviXV+dd2R8VnEELxwScsf380Og==} + peerDependencies: + '@polkadot-api/smoldot': '>=0.3' + dependencies: + '@polkadot-api/json-rpc-provider': 0.0.4 + '@polkadot-api/json-rpc-provider-proxy': 0.2.4 + '@polkadot-api/smoldot': 0.3.8 + dev: true + /@polkadot-api/smoldot@0.3.5: resolution: {integrity: sha512-QiCkI3Z2bSc8yMXChi6dsN7bGB5q8i/a/LGuNEDmMECoLdyEmz7pRBMmi4fnvfbthb+5/c5w5kl/7VOBEJ83tA==} dependencies: @@ -709,10 +1090,29 @@ packages: - bufferutil - utf-8-validate + /@polkadot-api/smoldot@0.3.8: + resolution: {integrity: sha512-dbJSMRFtELDW+rZIWRwKE/K8oy7+gYaGl+DvaOjARoBW2n80rJ7RAMOCCu+b5h2zgl3elftFBwMNAuAWgHT/Zg==} + dependencies: + '@types/node': 22.10.3 + smoldot: 2.0.34 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: true + + /@polkadot-api/substrate-bindings@0.11.0: + resolution: {integrity: sha512-UGCa0xYtfcS/5LJAcro1vhIwxF31fsF5f42mzro9G85T854cbXPzqABDICYmJqdF72tBRMrnJlx6okGtLx9TKA==} + dependencies: + '@noble/hashes': 1.6.1 + '@polkadot-api/utils': 0.1.2 + '@scure/base': 1.2.1 + scale-ts: 1.6.1 + dev: true + /@polkadot-api/substrate-bindings@0.9.3: resolution: {integrity: sha512-ygaZo8+xssTdb6lj9mA8RTlanDfyd0iMex3aBFC1IzOSm08XUWdRpuSLRuerFCimLzKuz/oBOTKdqBFGb7ybUQ==} dependencies: - '@noble/hashes': 1.5.0 + '@noble/hashes': 1.6.1 '@polkadot-api/utils': 0.1.2 '@scure/base': 1.1.9 scale-ts: 1.6.1 @@ -739,11 +1139,22 @@ packages: - bufferutil - utf-8-validate + /@polkadot-api/ws-provider@0.3.6: + resolution: {integrity: sha512-D2+rvcDc9smt24qUKqFoCuKKNhyBVDQEtnsqHiUN/Ym8UGP+Acegac3b9VOig70EpCcRBoYeXY2gEog2ybx1Kg==} + dependencies: + '@polkadot-api/json-rpc-provider': 0.0.4 + '@polkadot-api/json-rpc-provider-proxy': 0.2.4 + ws: 8.18.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: true + /@polkadot-labs/hdkd-helpers@0.0.8: resolution: {integrity: sha512-nTJOinTKuINHwKsUXR+Q1Hld0DU+EYVxcfQqiJz9PH8L+48K3gPfpAHDApIuOW6Uq6yVb5/pgcDPNCaJS5nYsg==} dependencies: '@noble/curves': 1.6.0 - '@noble/hashes': 1.5.0 + '@noble/hashes': 1.6.1 '@polkadot-labs/schnorrkel-wasm': 0.0.5 '@scure/base': 1.1.9 scale-ts: 1.6.1 @@ -1074,9 +1485,21 @@ packages: requiresBuild: true optional: true + /@rx-state/core@0.1.4(rxjs@7.8.1): + resolution: {integrity: sha512-Z+3hjU2xh1HisLxt+W5hlYX/eGSDaXXP+ns82gq/PLZpkXLu0uwcNUh9RLY3Clq4zT+hSsA3vcpIGt6+UAb8rQ==} + peerDependencies: + rxjs: '>=7' + dependencies: + rxjs: 7.8.1 + dev: true + /@scure/base@1.1.9: resolution: {integrity: sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==} + /@scure/base@1.2.1: + resolution: {integrity: sha512-DGmGtC8Tt63J5GfHgfl5CuAXh96VF/LD8K9Hr/Gv0J2lAoRGlPOMpqMpMbCTOoOJMZCk2Xt+DskdDyn6dEFdzQ==} + dev: true + /@sec-ant/readable-stream@0.4.1: resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==} @@ -1099,6 +1522,12 @@ packages: undici-types: 5.26.5 dev: true + /@types/node@22.10.3: + resolution: {integrity: sha512-DifAyw4BkrufCILvD3ucnuN8eydUfc/C1GlyrnI+LK6543w5/L3VeVgf05o3B4fqSXP1dKYLOZsKfutpxPzZrw==} + dependencies: + undici-types: 6.20.0 + dev: true + /@types/node@22.9.0: resolution: {integrity: sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==} dependencies: @@ -1228,6 +1657,16 @@ packages: esbuild: 0.24.0 load-tsconfig: 0.2.5 + /bundle-require@5.0.0(esbuild@0.24.2): + resolution: {integrity: sha512-GuziW3fSSmopcx4KRymQEJVbZUfqlCqcq7dvs6TYwKRZiegK/2buMxQTPs6MGlNv50wms1699qYO54R8XfRX4w==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + peerDependencies: + esbuild: '>=0.18' + dependencies: + esbuild: 0.24.2 + load-tsconfig: 0.2.5 + dev: true + /cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} @@ -1297,6 +1736,15 @@ packages: shebang-command: 2.0.0 which: 2.0.2 + /cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} + engines: {node: '>= 8'} + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + dev: true + /debug@4.3.7: resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==} engines: {node: '>=6.0'} @@ -1404,6 +1852,39 @@ packages: '@esbuild/win32-ia32': 0.24.0 '@esbuild/win32-x64': 0.24.0 + /esbuild@0.24.2: + resolution: {integrity: sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==} + engines: {node: '>=18'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/aix-ppc64': 0.24.2 + '@esbuild/android-arm': 0.24.2 + '@esbuild/android-arm64': 0.24.2 + '@esbuild/android-x64': 0.24.2 + '@esbuild/darwin-arm64': 0.24.2 + '@esbuild/darwin-x64': 0.24.2 + '@esbuild/freebsd-arm64': 0.24.2 + '@esbuild/freebsd-x64': 0.24.2 + '@esbuild/linux-arm': 0.24.2 + '@esbuild/linux-arm64': 0.24.2 + '@esbuild/linux-ia32': 0.24.2 + '@esbuild/linux-loong64': 0.24.2 + '@esbuild/linux-mips64el': 0.24.2 + '@esbuild/linux-ppc64': 0.24.2 + '@esbuild/linux-riscv64': 0.24.2 + '@esbuild/linux-s390x': 0.24.2 + '@esbuild/linux-x64': 0.24.2 + '@esbuild/netbsd-arm64': 0.24.2 + '@esbuild/netbsd-x64': 0.24.2 + '@esbuild/openbsd-arm64': 0.24.2 + '@esbuild/openbsd-x64': 0.24.2 + '@esbuild/sunos-x64': 0.24.2 + '@esbuild/win32-arm64': 0.24.2 + '@esbuild/win32-ia32': 0.24.2 + '@esbuild/win32-x64': 0.24.2 + dev: true + /estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} dev: true @@ -1431,6 +1912,24 @@ packages: strip-final-newline: 4.0.0 yoctocolors: 2.1.1 + /execa@9.5.2: + resolution: {integrity: sha512-EHlpxMCpHWSAh1dgS6bVeoLAXGnJNdR93aabr4QCGbzOM73o5XmRfM/e5FUqsw3aagP8S8XEWUWFAxnRBnAF0Q==} + engines: {node: ^18.19.0 || >=20.5.0} + dependencies: + '@sindresorhus/merge-streams': 4.0.0 + cross-spawn: 7.0.6 + figures: 6.1.0 + get-stream: 9.0.1 + human-signals: 8.0.0 + is-plain-obj: 4.1.0 + is-stream: 4.0.1 + npm-run-path: 6.0.0 + pretty-ms: 9.2.0 + signal-exit: 4.1.0 + strip-final-newline: 4.0.0 + yoctocolors: 2.1.1 + dev: true + /expect-type@1.1.0: resolution: {integrity: sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==} engines: {node: '>=12.0.0'} @@ -1772,6 +2271,44 @@ packages: - utf-8-validate - yaml + /polkadot-api@1.8.1(rxjs@7.8.1): + resolution: {integrity: sha512-E2Jh9tiO6eB/fjnwr68mnZAZ/UuoZPBZQKjplHSMjVgNNQEkNZSqDcFvH18Rag5x4z7oJzuEk9+Hj62u/+D1PQ==} + hasBin: true + peerDependencies: + rxjs: '>=7.8.0' + dependencies: + '@polkadot-api/cli': 0.10.0 + '@polkadot-api/ink-contracts': 0.2.4 + '@polkadot-api/json-rpc-provider': 0.0.4 + '@polkadot-api/known-chains': 0.6.0 + '@polkadot-api/logs-provider': 0.0.6 + '@polkadot-api/metadata-builders': 0.10.0 + '@polkadot-api/metadata-compatibility': 0.1.14 + '@polkadot-api/observable-client': 0.7.0(@polkadot-api/substrate-client@0.3.0)(rxjs@7.8.1) + '@polkadot-api/pjs-signer': 0.6.3 + '@polkadot-api/polkadot-sdk-compat': 2.3.1 + '@polkadot-api/polkadot-signer': 0.1.6 + '@polkadot-api/signer': 0.1.13 + '@polkadot-api/sm-provider': 0.1.7(@polkadot-api/smoldot@0.3.8) + '@polkadot-api/smoldot': 0.3.8 + '@polkadot-api/substrate-bindings': 0.11.0 + '@polkadot-api/substrate-client': 0.3.0 + '@polkadot-api/utils': 0.1.2 + '@polkadot-api/ws-provider': 0.3.6 + '@rx-state/core': 0.1.4(rxjs@7.8.1) + rxjs: 7.8.1 + transitivePeerDependencies: + - '@microsoft/api-extractor' + - '@swc/core' + - bufferutil + - jiti + - postcss + - supports-color + - tsx + - utf-8-validate + - yaml + dev: true + /postcss-load-config@6.0.1: resolution: {integrity: sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==} engines: {node: '>= 18'} @@ -1813,6 +2350,13 @@ packages: dependencies: parse-ms: 4.0.0 + /pretty-ms@9.2.0: + resolution: {integrity: sha512-4yf0QO/sllf/1zbZWYnvWw3NxCQwLXKzIj0G849LSufP15BXKM0rbD2Z3wVnkMfjdn/CB0Dpp444gYAACdsplg==} + engines: {node: '>=18'} + dependencies: + parse-ms: 4.0.0 + dev: true + /punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} @@ -1869,7 +2413,7 @@ packages: '@babel/code-frame': 7.26.2 dev: true - /rollup-plugin-esbuild@6.1.1(esbuild@0.24.0)(rollup@4.25.0): + /rollup-plugin-esbuild@6.1.1(esbuild@0.24.2)(rollup@4.25.0): resolution: {integrity: sha512-CehMY9FAqJD5OUaE/Mi1r5z0kNeYxItmRO2zG4Qnv2qWKF09J2lTy5GUzjJR354ZPrLkCj4fiBN41lo8PzBUhw==} engines: {node: '>=14.18.0'} peerDependencies: @@ -1879,7 +2423,7 @@ packages: '@rollup/pluginutils': 5.1.3(rollup@4.25.0) debug: 4.3.7 es-module-lexer: 1.5.4 - esbuild: 0.24.0 + esbuild: 0.24.2 get-tsconfig: 4.8.1 rollup: 4.25.0 transitivePeerDependencies: @@ -1980,6 +2524,15 @@ packages: - bufferutil - utf-8-validate + /smoldot@2.0.34: + resolution: {integrity: sha512-mw9tCbGEhEp0koMqLL0jBEixVY1MIN/xI3pE6ZY1TuOPU+LnYy8FloODVyzkvzQPaBYrETXJdRlmA/+k6g3gow==} + dependencies: + ws: 8.18.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: true + /sort-keys@5.1.0: resolution: {integrity: sha512-aSbHV0DaBcr7u0PVHXzM6NbZNAtrr9sF6+Qfs9UUVG7Ll3jQ6hHi8F/xqIIcn2rvIVbr0v/2zyjSdwSV47AgLQ==} engines: {node: '>=12'} @@ -2145,6 +2698,15 @@ packages: dependencies: typescript: 5.6.3 + /tsc-prog@2.3.0(typescript@5.7.2): + resolution: {integrity: sha512-ycET2d75EgcX7y8EmG4KiZkLAwUzbY4xRhA6NU0uVbHkY4ZjrAAuzTMxXI85kOwATqPnBI5C/7y7rlpY0xdqHA==} + engines: {node: '>=12'} + peerDependencies: + typescript: '>=4' + dependencies: + typescript: 5.7.2 + dev: true + /tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} @@ -2190,6 +2752,49 @@ packages: - tsx - yaml + /tsup@8.3.5(typescript@5.7.2): + resolution: {integrity: sha512-Tunf6r6m6tnZsG9GYWndg0z8dEV7fD733VBFzFJ5Vcm1FtlXB8xBD/rtrBi2a3YKEV7hHtxiZtW5EAVADoe1pA==} + engines: {node: '>=18'} + hasBin: true + peerDependencies: + '@microsoft/api-extractor': ^7.36.0 + '@swc/core': ^1 + postcss: ^8.4.12 + typescript: '>=4.5.0' + peerDependenciesMeta: + '@microsoft/api-extractor': + optional: true + '@swc/core': + optional: true + postcss: + optional: true + typescript: + optional: true + dependencies: + bundle-require: 5.0.0(esbuild@0.24.2) + cac: 6.7.14 + chokidar: 4.0.1 + consola: 3.2.3 + debug: 4.3.7 + esbuild: 0.24.2 + joycon: 3.1.1 + picocolors: 1.1.1 + postcss-load-config: 6.0.1 + resolve-from: 5.0.0 + rollup: 4.26.0 + source-map: 0.8.0-beta.0 + sucrase: 3.35.0 + tinyexec: 0.3.1 + tinyglobby: 0.2.10 + tree-kill: 1.2.2 + typescript: 5.7.2 + transitivePeerDependencies: + - jiti + - supports-color + - tsx + - yaml + dev: true + /type-fest@4.26.1: resolution: {integrity: sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg==} engines: {node: '>=16'} @@ -2199,6 +2804,12 @@ packages: engines: {node: '>=14.17'} hasBin: true + /typescript@5.7.2: + resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} + engines: {node: '>=14.17'} + hasBin: true + dev: true + /undici-types@5.26.5: resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} dev: true @@ -2206,6 +2817,10 @@ packages: /undici-types@6.19.8: resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} + /undici-types@6.20.0: + resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} + dev: true + /unicorn-magic@0.1.0: resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==} engines: {node: '>=18'} From 3000fddf3f147c6bd8b133bd38bd497ae1bdc46b Mon Sep 17 00:00:00 2001 From: Victor Oliva Date: Thu, 2 Jan 2025 14:09:32 +0100 Subject: [PATCH 02/13] feat: bounties sdk --- packages/sdk-governance/package.json | 3 +- .../src/bounties-descriptors.ts | 116 ++++++++ .../sdk-governance/src/bounties-sdk-types.ts | 44 +++ packages/sdk-governance/src/bounties-sdk.ts | 257 ++++++++++++++++++ packages/sdk-governance/src/index.ts | 8 +- pnpm-lock.yaml | 41 ++- 6 files changed, 465 insertions(+), 4 deletions(-) create mode 100644 packages/sdk-governance/src/bounties-descriptors.ts create mode 100644 packages/sdk-governance/src/bounties-sdk-types.ts create mode 100644 packages/sdk-governance/src/bounties-sdk.ts diff --git a/packages/sdk-governance/package.json b/packages/sdk-governance/package.json index ca3ee24..df62b12 100644 --- a/packages/sdk-governance/package.json +++ b/packages/sdk-governance/package.json @@ -41,7 +41,8 @@ }, "license": "MIT", "dependencies": { - "@polkadot-api/common-sdk-utils": "workspace:*" + "@polkadot-api/common-sdk-utils": "workspace:*", + "@react-rxjs/utils": "^0.9.7" }, "peerDependencies": { "@noble/hashes": ">=1.6.1", diff --git a/packages/sdk-governance/src/bounties-descriptors.ts b/packages/sdk-governance/src/bounties-descriptors.ts new file mode 100644 index 0000000..d63228a --- /dev/null +++ b/packages/sdk-governance/src/bounties-descriptors.ts @@ -0,0 +1,116 @@ +import { + ApisTypedef, + Binary, + Enum, + FixedSizeArray, + FixedSizeBinary, + PalletsTypedef, + SS58String, + StorageDescriptor, + TypedApi, +} from "polkadot-api" +import { + PolkadotRuntimeOriginCaller, + PreimagesBounded, +} from "./referenda-descriptors" + +export type BountiesBountyStatus = Enum<{ + Proposed: undefined + Approved: undefined + Funded: undefined + CuratorProposed: { + curator: SS58String + } + Active: { + curator: SS58String + update_due: number + } + PendingPayout: { + curator: SS58String + beneficiary: SS58String + unlock_at: number + } +}> +export interface BountyWithoutDescription { + proposer: SS58String + value: bigint + fee: bigint + curator_deposit: bigint + bond: bigint + status: BountiesBountyStatus +} + +type BountiesSdkPallets = PalletsTypedef< + { + Preimage: { + PreimageFor: StorageDescriptor< + [Key: [Binary, number]], + Binary, + true, + never + > + } + Bounties: { + /** + * Number of bounty proposals that have been made. + */ + BountyCount: StorageDescriptor<[], number, false, never> + /** + * Bounties that have been made. + */ + Bounties: StorageDescriptor< + [Key: number], + BountyWithoutDescription, + true, + never + > + /** + * The description of each bounty. + */ + BountyDescriptions: StorageDescriptor<[Key: number], Binary, true, never> + } + Scheduler: { + /** + * Items to be executed, indexed by the block number that they should be executed on. + */ + Agenda: StorageDescriptor< + [Key: number], + Array< + | { + maybe_id?: FixedSizeBinary<32> | undefined + priority: number + call: PreimagesBounded + maybe_periodic?: FixedSizeArray<2, number> | undefined + origin: PolkadotRuntimeOriginCaller + } + | undefined + >, + false, + never + > + } + }, + {}, + {}, + {}, + {} +> +type BountiesSdkDefinition = SdkDefinition> +export type BountiesSdkTypedApi = TypedApi + +type SdkDefinition = { + descriptors: Promise & { + pallets: P + apis: R + } + asset: any + metadataTypes: any +} + +export type MultiAddress = Enum<{ + Id: SS58String + Index: undefined + Raw: Binary + Address32: FixedSizeBinary<32> + Address20: FixedSizeBinary<20> +}> diff --git a/packages/sdk-governance/src/bounties-sdk-types.ts b/packages/sdk-governance/src/bounties-sdk-types.ts new file mode 100644 index 0000000..e506553 --- /dev/null +++ b/packages/sdk-governance/src/bounties-sdk-types.ts @@ -0,0 +1,44 @@ +import { Binary } from "polkadot-api" +import { GroupedObservable, Observable } from "rxjs" +import { BountyWithoutDescription, MultiAddress } from "./bounties-descriptors" +import { OngoingReferendum } from "./referenda-sdk-types" + +export interface Bounty extends BountyWithoutDescription { + id: number + description: Binary | null +} + +export interface BountiesSdk { + bountyIds$: Observable + getBountyById$: (key: number) => GroupedObservable + referendaFilter: { + approving: ( + ongoingReferenda: OngoingReferendum[], + bountyId: number, + ) => Promise + proposingCurator: ( + ongoingReferenda: OngoingReferendum[], + bountyId: number, + ) => Promise< + { + referendum: OngoingReferendum + proposeCuratorCalls: { + curator: MultiAddress + fee: bigint + }[] + }[] + > + } + scheduledChanges: { + approved: (bountyId: number) => Promise + curatorProposed: (bountyId: number) => Promise< + { + height: number + proposeCuratorCalls: { + curator: MultiAddress + fee: bigint + }[] + }[] + > + } +} diff --git a/packages/sdk-governance/src/bounties-sdk.ts b/packages/sdk-governance/src/bounties-sdk.ts new file mode 100644 index 0000000..c87c664 --- /dev/null +++ b/packages/sdk-governance/src/bounties-sdk.ts @@ -0,0 +1,257 @@ +import { partitionByKey, toKeySet } from "@react-rxjs/utils" +import { + combineLatest, + from, + map, + mergeMap, + skip, + startWith, + switchMap, +} from "rxjs" +import { BountiesSdkTypedApi, MultiAddress } from "./bounties-descriptors" +import { BountiesSdk, Bounty } from "./bounties-sdk-types" +import { getPreimageResolver } from "./preimages" +import { OngoingReferendum } from "./referenda-sdk-types" + +export function createBountiesSdk(typedApi: BountiesSdkTypedApi): BountiesSdk { + const resolvePreimage = getPreimageResolver( + typedApi.query.Preimage.PreimageFor.getValues, + ) + + const [getBountyById$, bountyKeyChanges$] = partitionByKey( + // TODO watchEntries + typedApi.query.Bounties.BountyCount.watchValue().pipe( + skip(1), + startWith(null), + switchMap(() => typedApi.query.Bounties.Bounties.getEntries()), + mergeMap((v) => v.sort((a, b) => a.keyArgs[0] - b.keyArgs[0])), + ), + (res) => res.keyArgs[0], + (group$, id) => + combineLatest([ + group$, + from(typedApi.query.Bounties.BountyDescriptions.getValue(id)).pipe( + startWith(null), + ), + ]).pipe( + map( + ([bounty, description]): Bounty => ({ + ...bounty.value, + id, + description: description ?? null, + }), + ), + ), + ) + + const bountyIds$ = bountyKeyChanges$.pipe( + toKeySet(), + map((set) => [...set]), + ) + + const getDecodedSpenderReferenda = weakMemo( + async (ongoingReferenda: OngoingReferendum[]) => { + const spenderReferenda = ongoingReferenda.filter( + (ref) => + (ref.origin.type === "Origins" && + spenderOrigins.includes(ref.origin.value.type)) || + (ref.origin.type === "system" && ref.origin.value.type === "Root"), + ) + const response = await Promise.all( + spenderReferenda.map((referendum) => + referendum.proposal + .decodedCall() + .then((call) => ({ + referendum, + call, + })) + .catch((ex) => { + console.error(ex) + return null + }), + ), + ) + return response.filter((v) => !!v) + }, + ) + + async function findApprovingReferenda( + ongoingReferenda: OngoingReferendum[], + bountyId: number, + ) { + const spenderReferenda = await getDecodedSpenderReferenda(ongoingReferenda) + + return spenderReferenda + .filter(({ call }) => + findCalls( + { + pallet: "Bounties", + name: "approve_bounty", + }, + call, + ).some((v) => v?.bounty_id === bountyId), + ) + .map(({ referendum }) => referendum) + } + + async function findProposingCuratorReferenda( + ongoingReferenda: OngoingReferendum[], + bountyId: number, + ) { + const spenderReferenda = await getDecodedSpenderReferenda(ongoingReferenda) + + return spenderReferenda + .map(({ call, referendum }) => { + const proposeCuratorCalls = findCalls( + { + pallet: "Bounties", + name: "propose_curator", + }, + call, + ) + .filter( + (v) => + v?.bounty_id === bountyId && + typeof v.curator === "object" && + typeof v.fee === "bigint", + ) + .map((v) => ({ + curator: v.curator as MultiAddress, + fee: v.fee as bigint, + })) + if (!proposeCuratorCalls.length) return null + return { referendum, proposeCuratorCalls } + }) + .filter((v) => v !== null) + } + + const getScheduledCalls = memo(async () => { + const agenda = await typedApi.query.Scheduler.Agenda.getEntries() + const token = await typedApi.compatibilityToken + + const scheduled = agenda.flatMap( + ({ keyArgs: [height], value: values }) => + values + ?.filter((v) => !!v) + .map((value) => ({ + height, + call: value.call, + })) ?? [], + ) + + const resolvedCalls = await Promise.all( + scheduled.map(({ height, call }) => + resolvePreimage(call) + .then( + (callData) => typedApi.txFromCallData(callData, token).decodedCall, + ) + .then((decodedCall) => ({ height, call: decodedCall })) + .catch((ex) => { + console.error(ex) + return null + }), + ), + ) + return resolvedCalls.filter((v) => !!v) + }) + async function findScheduledApproved(bountyId: number) { + const calls = await getScheduledCalls() + + return calls + .filter(({ call }) => + findCalls({ pallet: "Bounties", name: "approve_bounty" }, call).some( + (v) => v?.bounty_id === bountyId, + ), + ) + .map(({ height }) => height) + } + + async function findScheduledCuratorProposed(bountyId: number) { + const calls = await getScheduledCalls() + + return calls + .map(({ call, height }) => { + const proposeCuratorCalls = findCalls( + { + pallet: "Bounties", + name: "propose_curator", + }, + call, + ) + .filter( + (v) => + v?.bounty_id === bountyId && + typeof v.curator === "object" && + typeof v.fee === "bigint", + ) + .map((v) => ({ + curator: v.curator as MultiAddress, + fee: v.fee as bigint, + })) + if (!proposeCuratorCalls.length) return null + return { height, proposeCuratorCalls } + }) + .filter((v) => v !== null) + } + + return { + bountyIds$, + getBountyById$, + referendaFilter: { + approving: findApprovingReferenda, + proposingCurator: findProposingCuratorReferenda, + }, + scheduledChanges: { + approved: findScheduledApproved, + curatorProposed: findScheduledCuratorProposed, + }, + } +} + +const spenderOrigins = [ + "Treasurer", + "SmallSpender", + "MediumSpender", + "BigSpender", + "SmallTipper", + "BigTipper", +] + +const findCalls = (call: { pallet: string; name: string }, obj: any): any[] => { + if (typeof obj !== "object") return [] + if (Array.isArray(obj)) { + const approves = [] + for (const item of obj) approves.push(...findCalls(call, item)) + return approves + } + if (obj?.type === call.pallet && obj?.value?.type === call.name) { + return [obj.value.value] + } + const approves = [] + for (const key of Object.keys(obj)) + approves.push(...findCalls(call, obj[key])) + return approves +} + +const weakMemo = (fn: (...arg: Arg) => R) => { + const cache = new WeakMap() + return (...arg: Arg) => { + if (cache.has(arg[0])) return cache.get(arg[0])! + const result = fn(...arg) + cache.set(arg[0], result) + return result + } +} + +const memo = , R>(fn: (...arg: Arg) => R) => { + let cachedKey: Arg | null = null + let cachedValue: R = null as any + return (...arg: Arg) => { + if (cachedKey && cachedKey.every((k, i) => k === arg[i])) { + return cachedValue + } + cachedKey = arg + cachedValue = fn(...arg) + return cachedValue + } +} diff --git a/packages/sdk-governance/src/index.ts b/packages/sdk-governance/src/index.ts index cfe482b..3574dd6 100644 --- a/packages/sdk-governance/src/index.ts +++ b/packages/sdk-governance/src/index.ts @@ -1,8 +1,12 @@ export { createReferendaSdk } from "./referenda-sdk" -export type * from "./referenda-descriptors" -export type * from "./referenda-sdk-types" export { type Origin, polkadotSpenderOrigin, kusamaSpenderOrigin, } from "./referenda-chainConfig" +export type * from "./referenda-descriptors" +export type * from "./referenda-sdk-types" + +export { createBountiesSdk } from "./bounties-sdk" +export type * from "./bounties-descriptors" +export type * from "./bounties-sdk-types" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3af1ea4..981c1bc 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -75,6 +75,9 @@ importers: '@polkadot-api/common-sdk-utils': specifier: workspace:* version: link:../common-utils + '@react-rxjs/utils': + specifier: ^0.9.7 + version: 0.9.7(@react-rxjs/core@0.10.7)(react@19.0.0)(rxjs@7.8.1) devDependencies: '@noble/hashes': specifier: ^1.6.1 @@ -1171,6 +1174,30 @@ packages: resolution: {integrity: sha512-oUKF4Qu+V1bPxEjq3kmzI3FZrMIr1kK/4cxntoHSBDTZn/Ymab9LXVhRNrbVend5JrwDANePcYqbK5Fdn9NGhQ==} dev: false + /@react-rxjs/core@0.10.7(react@19.0.0)(rxjs@7.8.1): + resolution: {integrity: sha512-dornp8pUs9OcdqFKKRh9+I2FVe21gWufNun6RYU1ddts7kUy9i4Thvl0iqcPFbGY61cJQMAJF7dxixWMSD/A/A==} + peerDependencies: + react: '>=16.8.0' + rxjs: '>=7' + dependencies: + '@rx-state/core': 0.1.4(rxjs@7.8.1) + react: 19.0.0 + rxjs: 7.8.1 + use-sync-external-store: 1.4.0(react@19.0.0) + dev: false + + /@react-rxjs/utils@0.9.7(@react-rxjs/core@0.10.7)(react@19.0.0)(rxjs@7.8.1): + resolution: {integrity: sha512-m9CUTdRsglObvUAlYfB24QvN+QH4XqCGEKnCdSILIeOx7mMqSi9TTFp2zrj5XqtMiLnj4ReAdDxrXegLPB73bQ==} + peerDependencies: + '@react-rxjs/core': '>=0.1.0' + react: '>=16.8.0' + rxjs: '>=6' + dependencies: + '@react-rxjs/core': 0.10.7(react@19.0.0)(rxjs@7.8.1) + react: 19.0.0 + rxjs: 7.8.1 + dev: false + /@rollup/plugin-alias@5.1.1(rollup@4.25.0): resolution: {integrity: sha512-PR9zDb+rOzkRb2VD+EuKB7UC41vU5DIwZ5qqCpk0KJudcWAyi8rvYOhS7+L5aZCspw1stTViLgN5v6FF1p5cgQ==} engines: {node: '>=14.0.0'} @@ -1491,7 +1518,6 @@ packages: rxjs: '>=7' dependencies: rxjs: 7.8.1 - dev: true /@scure/base@1.1.9: resolution: {integrity: sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==} @@ -2361,6 +2387,11 @@ packages: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} + /react@19.0.0: + resolution: {integrity: sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==} + engines: {node: '>=0.10.0'} + dev: false + /read-pkg@9.0.1: resolution: {integrity: sha512-9viLL4/n1BJUCT1NXVTdS1jtm80yDEgR5T4yCelII49Mbj0v1rZdKqj7zCiYdbB0CuCgdrvHcNogAKTFPBocFA==} engines: {node: '>=18'} @@ -2829,6 +2860,14 @@ packages: resolution: {integrity: sha512-+QBBXBCvifc56fsbuxZQ6Sic3wqqc3WWaqxs58gvJrcOuN83HGTCwz3oS5phzU9LthRNE9VrJCFCLUgHeeFnfA==} engines: {node: '>=18'} + /use-sync-external-store@1.4.0(react@19.0.0): + resolution: {integrity: sha512-9WXSPC5fMv61vaupRkCKCxsPxBocVnwakBEkMIHHpkTTg6icbJtg6jzgtLDm4bl3cSHAca52rYWih0k4K3PfHw==} + peerDependencies: + react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 + dependencies: + react: 19.0.0 + dev: false + /validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} dependencies: From a0535fc76631df0c655c954a586cde7b1270d5b4 Mon Sep 17 00:00:00 2001 From: Victor Oliva Date: Thu, 2 Jan 2025 14:44:35 +0100 Subject: [PATCH 03/13] feat(bounties): separate watchBounties from getBounties --- .../sdk-governance/src/bounties-sdk-types.ts | 8 +- packages/sdk-governance/src/bounties-sdk.ts | 98 +++++++++++++------ 2 files changed, 72 insertions(+), 34 deletions(-) diff --git a/packages/sdk-governance/src/bounties-sdk-types.ts b/packages/sdk-governance/src/bounties-sdk-types.ts index e506553..d7ece14 100644 --- a/packages/sdk-governance/src/bounties-sdk-types.ts +++ b/packages/sdk-governance/src/bounties-sdk-types.ts @@ -9,8 +9,12 @@ export interface Bounty extends BountyWithoutDescription { } export interface BountiesSdk { - bountyIds$: Observable - getBountyById$: (key: number) => GroupedObservable + watchBounties(): { + bounties$: Observable> + bountyIds$: Observable + getBountyById$: (key: number) => GroupedObservable + } + getBounties(): Observable referendaFilter: { approving: ( ongoingReferenda: OngoingReferendum[], diff --git a/packages/sdk-governance/src/bounties-sdk.ts b/packages/sdk-governance/src/bounties-sdk.ts index c87c664..fd1aa33 100644 --- a/packages/sdk-governance/src/bounties-sdk.ts +++ b/packages/sdk-governance/src/bounties-sdk.ts @@ -1,14 +1,21 @@ -import { partitionByKey, toKeySet } from "@react-rxjs/utils" +import { combineKeys, partitionByKey, toKeySet } from "@react-rxjs/utils" import { combineLatest, from, map, mergeMap, + Observable, + of, + shareReplay, skip, startWith, switchMap, } from "rxjs" -import { BountiesSdkTypedApi, MultiAddress } from "./bounties-descriptors" +import { + BountiesSdkTypedApi, + BountyWithoutDescription, + MultiAddress, +} from "./bounties-descriptors" import { BountiesSdk, Bounty } from "./bounties-sdk-types" import { getPreimageResolver } from "./preimages" import { OngoingReferendum } from "./referenda-sdk-types" @@ -18,36 +25,63 @@ export function createBountiesSdk(typedApi: BountiesSdkTypedApi): BountiesSdk { typedApi.query.Preimage.PreimageFor.getValues, ) - const [getBountyById$, bountyKeyChanges$] = partitionByKey( - // TODO watchEntries - typedApi.query.Bounties.BountyCount.watchValue().pipe( - skip(1), - startWith(null), - switchMap(() => typedApi.query.Bounties.Bounties.getEntries()), - mergeMap((v) => v.sort((a, b) => a.keyArgs[0] - b.keyArgs[0])), - ), - (res) => res.keyArgs[0], - (group$, id) => - combineLatest([ - group$, - from(typedApi.query.Bounties.BountyDescriptions.getValue(id)).pipe( - startWith(null), - ), - ]).pipe( - map( - ([bounty, description]): Bounty => ({ - ...bounty.value, - id, - description: description ?? null, - }), - ), + const enhanceBounty$ = ( + bounty$: Observable, + id: number, + ): Observable => + combineLatest([ + bounty$, + from(typedApi.query.Bounties.BountyDescriptions.getValue(id)).pipe( + startWith(null), ), - ) + ]).pipe( + map( + ([bounty, description]): Bounty => ({ + ...bounty, + id, + description: description ?? null, + }), + ), + ) - const bountyIds$ = bountyKeyChanges$.pipe( - toKeySet(), - map((set) => [...set]), - ) + function watchBounties() { + const [getBountyById$, bountyKeyChanges$] = partitionByKey( + // TODO watchEntries + typedApi.query.Bounties.BountyCount.watchValue().pipe( + skip(1), + startWith(null), + switchMap(() => typedApi.query.Bounties.Bounties.getEntries()), + mergeMap((v) => v.sort((a, b) => a.keyArgs[0] - b.keyArgs[0])), + ), + (res) => res.keyArgs[0], + (group$, id) => enhanceBounty$(group$.pipe(map((v) => v.value)), id), + ) + + const bountyIds$ = bountyKeyChanges$.pipe( + toKeySet(), + map((set) => [...set]), + ) + + return { + bounties$: combineKeys(bountyIds$, getBountyById$), + getBountyById$, + bountyIds$, + } + } + + function getBounties() { + return from(typedApi.query.Bounties.Bounties.getEntries()).pipe( + mergeMap((entries) => + combineLatest( + entries + .map(({ keyArgs: [id], value }) => ({ bounty: value, id })) + .sort((a, b) => a.id - b.id) + .map(({ bounty, id }) => enhanceBounty$(of(bounty), id)), + ), + ), + shareReplay(1), + ) + } const getDecodedSpenderReferenda = weakMemo( async (ongoingReferenda: OngoingReferendum[]) => { @@ -195,8 +229,8 @@ export function createBountiesSdk(typedApi: BountiesSdkTypedApi): BountiesSdk { } return { - bountyIds$, - getBountyById$, + watchBounties, + getBounties, referendaFilter: { approving: findApprovingReferenda, proposingCurator: findProposingCuratorReferenda, From 1a6f8078f8f0fe4d04a67c9fefccda894450325e Mon Sep 17 00:00:00 2001 From: Victor Oliva Date: Thu, 2 Jan 2025 17:08:11 +0100 Subject: [PATCH 04/13] feat: add transactions to each type of bounty --- .../src/bounties-descriptors.ts | 46 ++- .../sdk-governance/src/bounties-sdk-types.ts | 123 ++++++-- packages/sdk-governance/src/bounties-sdk.ts | 291 ++++++++++++------ packages/sdk-governance/src/memo.ts | 22 ++ 4 files changed, 357 insertions(+), 125 deletions(-) create mode 100644 packages/sdk-governance/src/memo.ts diff --git a/packages/sdk-governance/src/bounties-descriptors.ts b/packages/sdk-governance/src/bounties-descriptors.ts index d63228a..dba9f2b 100644 --- a/packages/sdk-governance/src/bounties-descriptors.ts +++ b/packages/sdk-governance/src/bounties-descriptors.ts @@ -5,8 +5,10 @@ import { FixedSizeArray, FixedSizeBinary, PalletsTypedef, + PlainDescriptor, SS58String, StorageDescriptor, + TxDescriptor, TypedApi, } from "polkadot-api" import { @@ -90,8 +92,48 @@ type BountiesSdkPallets = PalletsTypedef< > } }, - {}, - {}, + { + Bounties: { + approve_bounty: TxDescriptor<{ + bounty_id: number + }> + propose_curator: TxDescriptor<{ + bounty_id: number + curator: MultiAddress + fee: bigint + }> + unassign_curator: TxDescriptor<{ + bounty_id: number + }> + accept_curator: TxDescriptor<{ + bounty_id: number + }> + award_bounty: TxDescriptor<{ + bounty_id: number + beneficiary: MultiAddress + }> + claim_bounty: TxDescriptor<{ + bounty_id: number + }> + close_bounty: TxDescriptor<{ + bounty_id: number + }> + extend_bounty_expiry: TxDescriptor<{ + bounty_id: number + remark: Binary + }> + } + }, + { + Bounties: { + /** + *New bounty proposal. + */ + BountyProposed: PlainDescriptor<{ + index: number + }> + } + }, {}, {} > diff --git a/packages/sdk-governance/src/bounties-sdk-types.ts b/packages/sdk-governance/src/bounties-sdk-types.ts index d7ece14..4abc28f 100644 --- a/packages/sdk-governance/src/bounties-sdk-types.ts +++ b/packages/sdk-governance/src/bounties-sdk-types.ts @@ -1,48 +1,105 @@ -import { Binary } from "polkadot-api" +import { Binary, SS58String, Transaction, TxEvent } from "polkadot-api" import { GroupedObservable, Observable } from "rxjs" -import { BountyWithoutDescription, MultiAddress } from "./bounties-descriptors" +import { + BountiesBountyStatus, + BountyWithoutDescription, + MultiAddress, +} from "./bounties-descriptors" import { OngoingReferendum } from "./referenda-sdk-types" -export interface Bounty extends BountyWithoutDescription { +export interface GenericBounty extends BountyWithoutDescription { + type: BountiesBountyStatus["type"] id: number description: Binary | null } +interface ClosableBounty { + close(): Transaction +} +export interface ProposedBounty extends GenericBounty, ClosableBounty { + type: "Proposed" + approve(): Transaction + filterApprovingReferenda( + referenda: OngoingReferendum[], + ): Promise + getScheduledApprovals(): Promise + // TODO incoming approveWithCurator() +} +export interface ApprovedBounty extends GenericBounty { + type: "Approved" +} +export interface FundedBounty extends GenericBounty, ClosableBounty { + type: "Funded" + proposeCurator( + curator: MultiAddress, + fee: bigint, + ): Transaction + filterProposingReferenda(referenda: OngoingReferendum[]): Promise< + Array<{ + referendum: OngoingReferendum + proposeCuratorCalls: { + curator: MultiAddress + fee: bigint + }[] + }> + > + getScheduledProposals(): Promise< + Array<{ + height: number + proposeCuratorCalls: { + curator: MultiAddress + fee: bigint + }[] + }> + > +} + +interface CuratorUnassignable { + unassignCurator(): Transaction +} +export interface CuratorProposedBounty + extends GenericBounty, + CuratorUnassignable, + ClosableBounty { + type: "CuratorProposed" + curator: SS58String + acceptCuratorRole(): Transaction +} +export interface ActiveBounty + extends GenericBounty, + CuratorUnassignable, + ClosableBounty { + type: "Active" + curator: SS58String + updateDue: number + extendExpiry(remark?: string): Transaction + award(beneficiary: SS58String): Transaction +} +export interface PendingPayoutBounty + extends GenericBounty, + CuratorUnassignable { + type: "PendingPayout" + curator: SS58String + beneficiary: SS58String + unlockAt: number + claim(): Transaction +} + +export type Bounty = + | ProposedBounty + | ApprovedBounty + | FundedBounty + | CuratorProposedBounty + | ActiveBounty + | PendingPayoutBounty + export interface BountiesSdk { watchBounties(): { bounties$: Observable> bountyIds$: Observable getBountyById$: (key: number) => GroupedObservable } + getBounty(id: number): Observable getBounties(): Observable - referendaFilter: { - approving: ( - ongoingReferenda: OngoingReferendum[], - bountyId: number, - ) => Promise - proposingCurator: ( - ongoingReferenda: OngoingReferendum[], - bountyId: number, - ) => Promise< - { - referendum: OngoingReferendum - proposeCuratorCalls: { - curator: MultiAddress - fee: bigint - }[] - }[] - > - } - scheduledChanges: { - approved: (bountyId: number) => Promise - curatorProposed: (bountyId: number) => Promise< - { - height: number - proposeCuratorCalls: { - curator: MultiAddress - fee: bigint - }[] - }[] - > - } + getProposedBounty(txEvent: TxEvent): Observable } diff --git a/packages/sdk-governance/src/bounties-sdk.ts b/packages/sdk-governance/src/bounties-sdk.ts index fd1aa33..fd8e889 100644 --- a/packages/sdk-governance/src/bounties-sdk.ts +++ b/packages/sdk-governance/src/bounties-sdk.ts @@ -1,4 +1,5 @@ import { combineKeys, partitionByKey, toKeySet } from "@react-rxjs/utils" +import { Binary, TxEvent } from "polkadot-api" import { combineLatest, from, @@ -16,7 +17,13 @@ import { BountyWithoutDescription, MultiAddress, } from "./bounties-descriptors" -import { BountiesSdk, Bounty } from "./bounties-sdk-types" +import { + BountiesSdk, + Bounty, + GenericBounty, + ProposedBounty, +} from "./bounties-sdk-types" +import { memo, weakMemo } from "./memo" import { getPreimageResolver } from "./preimages" import { OngoingReferendum } from "./referenda-sdk-types" @@ -25,64 +32,6 @@ export function createBountiesSdk(typedApi: BountiesSdkTypedApi): BountiesSdk { typedApi.query.Preimage.PreimageFor.getValues, ) - const enhanceBounty$ = ( - bounty$: Observable, - id: number, - ): Observable => - combineLatest([ - bounty$, - from(typedApi.query.Bounties.BountyDescriptions.getValue(id)).pipe( - startWith(null), - ), - ]).pipe( - map( - ([bounty, description]): Bounty => ({ - ...bounty, - id, - description: description ?? null, - }), - ), - ) - - function watchBounties() { - const [getBountyById$, bountyKeyChanges$] = partitionByKey( - // TODO watchEntries - typedApi.query.Bounties.BountyCount.watchValue().pipe( - skip(1), - startWith(null), - switchMap(() => typedApi.query.Bounties.Bounties.getEntries()), - mergeMap((v) => v.sort((a, b) => a.keyArgs[0] - b.keyArgs[0])), - ), - (res) => res.keyArgs[0], - (group$, id) => enhanceBounty$(group$.pipe(map((v) => v.value)), id), - ) - - const bountyIds$ = bountyKeyChanges$.pipe( - toKeySet(), - map((set) => [...set]), - ) - - return { - bounties$: combineKeys(bountyIds$, getBountyById$), - getBountyById$, - bountyIds$, - } - } - - function getBounties() { - return from(typedApi.query.Bounties.Bounties.getEntries()).pipe( - mergeMap((entries) => - combineLatest( - entries - .map(({ keyArgs: [id], value }) => ({ bounty: value, id })) - .sort((a, b) => a.id - b.id) - .map(({ bounty, id }) => enhanceBounty$(of(bounty), id)), - ), - ), - shareReplay(1), - ) - } - const getDecodedSpenderReferenda = weakMemo( async (ongoingReferenda: OngoingReferendum[]) => { const spenderReferenda = ongoingReferenda.filter( @@ -228,17 +177,202 @@ export function createBountiesSdk(typedApi: BountiesSdkTypedApi): BountiesSdk { .filter((v) => v !== null) } + const enhanceBounty$ = ( + bounty$: Observable, + id: number, + ): Observable => + combineLatest([ + bounty$, + from(typedApi.query.Bounties.BountyDescriptions.getValue(id)).pipe( + startWith(null), + ), + ]).pipe( + map( + ([bounty, description]): GenericBounty => ({ + ...bounty, + type: bounty.status.type, + id, + description: description ?? null, + }), + ), + map((bounty): Bounty => { + switch (bounty.status.type) { + case "Proposed": + return { + ...bounty, + type: "Proposed", + approve() { + return typedApi.tx.Bounties.approve_bounty({ bounty_id: id }) + }, + close() { + return typedApi.tx.Bounties.close_bounty({ bounty_id: id }) + }, + filterApprovingReferenda(referenda) { + return findApprovingReferenda(referenda, id) + }, + getScheduledApprovals() { + return findScheduledApproved(id) + }, + } + case "Approved": + return { ...bounty, type: "Approved" } + case "Funded": + return { + ...bounty, + type: "Funded", + proposeCurator(curator, fee) { + return typedApi.tx.Bounties.propose_curator({ + bounty_id: id, + curator, + fee, + }) + }, + close() { + return typedApi.tx.Bounties.close_bounty({ bounty_id: id }) + }, + filterProposingReferenda(referenda) { + return findProposingCuratorReferenda(referenda, id) + }, + getScheduledProposals() { + return findScheduledCuratorProposed(id) + }, + } + case "CuratorProposed": + return { + ...bounty, + ...bounty.status.value, + type: "CuratorProposed", + acceptCuratorRole() { + return typedApi.tx.Bounties.accept_curator({ bounty_id: id }) + }, + unassignCurator() { + return typedApi.tx.Bounties.unassign_curator({ bounty_id: id }) + }, + close() { + return typedApi.tx.Bounties.close_bounty({ bounty_id: id }) + }, + } + case "Active": + return { + ...bounty, + type: "Active", + curator: bounty.status.value.curator, + updateDue: bounty.status.value.update_due, + extendExpiry(remark) { + return typedApi.tx.Bounties.extend_bounty_expiry({ + bounty_id: id, + remark: Binary.fromText(remark ?? ""), + }) + }, + award(beneficiary) { + return typedApi.tx.Bounties.award_bounty({ + bounty_id: id, + beneficiary: { + type: "Id", + value: beneficiary, + }, + }) + }, + unassignCurator() { + return typedApi.tx.Bounties.unassign_curator({ bounty_id: id }) + }, + close() { + return typedApi.tx.Bounties.close_bounty({ bounty_id: id }) + }, + } + case "PendingPayout": + return { + ...bounty, + type: "PendingPayout", + curator: bounty.status.value.curator, + unlockAt: bounty.status.value.unlock_at, + beneficiary: bounty.status.value.beneficiary, + claim() { + return typedApi.tx.Bounties.claim_bounty({ bounty_id: id }) + }, + unassignCurator() { + return typedApi.tx.Bounties.unassign_curator({ bounty_id: id }) + }, + } + } + }), + ) + + function watchBounties() { + const [getBountyById$, bountyKeyChanges$] = partitionByKey( + // TODO watchEntries + typedApi.query.Bounties.BountyCount.watchValue().pipe( + skip(1), + startWith(null), + switchMap(() => typedApi.query.Bounties.Bounties.getEntries()), + mergeMap((v) => v.sort((a, b) => a.keyArgs[0] - b.keyArgs[0])), + ), + (res) => res.keyArgs[0], + (group$, id) => enhanceBounty$(group$.pipe(map((v) => v.value)), id), + ) + + const bountyIds$ = bountyKeyChanges$.pipe( + toKeySet(), + map((set) => [...set]), + ) + + return { + bounties$: combineKeys(bountyIds$, getBountyById$), + getBountyById$, + bountyIds$, + } + } + + function getBounty(id: number) { + return from(typedApi.query.Bounties.Bounties.getValue(id)).pipe( + mergeMap((bounty) => + bounty ? enhanceBounty$(of(bounty), id) : of(null), + ), + ) + } + + function getProposedBounty( + txEvent: TxEvent, + ): Observable { + if (!("events" in txEvent)) { + return of(null) + } + const proposedBountyEvt = typedApi.event.Bounties.BountyProposed.filter( + txEvent.events, + )[0] + if (!proposedBountyEvt) { + return of(null) + } + const id = proposedBountyEvt.index + const at = txEvent.type === "finalized" ? undefined : txEvent.block.hash + + return from(typedApi.query.Bounties.Bounties.getValue(id, { at })).pipe( + mergeMap((bounty) => + bounty ? enhanceBounty$(of(bounty), id) : of(null), + ), + map((v) => (v?.type === "Proposed" ? v : null)), + ) + } + + function getBounties() { + return from(typedApi.query.Bounties.Bounties.getEntries()).pipe( + mergeMap((entries) => + combineLatest( + entries + .map(({ keyArgs: [id], value }) => ({ bounty: value, id })) + .sort((a, b) => a.id - b.id) + .map(({ bounty, id }) => enhanceBounty$(of(bounty), id)), + ), + ), + shareReplay(1), + ) + } + return { watchBounties, getBounties, - referendaFilter: { - approving: findApprovingReferenda, - proposingCurator: findProposingCuratorReferenda, - }, - scheduledChanges: { - approved: findScheduledApproved, - curatorProposed: findScheduledCuratorProposed, - }, + getBounty, + getProposedBounty, } } @@ -266,26 +400,3 @@ const findCalls = (call: { pallet: string; name: string }, obj: any): any[] => { approves.push(...findCalls(call, obj[key])) return approves } - -const weakMemo = (fn: (...arg: Arg) => R) => { - const cache = new WeakMap() - return (...arg: Arg) => { - if (cache.has(arg[0])) return cache.get(arg[0])! - const result = fn(...arg) - cache.set(arg[0], result) - return result - } -} - -const memo = , R>(fn: (...arg: Arg) => R) => { - let cachedKey: Arg | null = null - let cachedValue: R = null as any - return (...arg: Arg) => { - if (cachedKey && cachedKey.every((k, i) => k === arg[i])) { - return cachedValue - } - cachedKey = arg - cachedValue = fn(...arg) - return cachedValue - } -} diff --git a/packages/sdk-governance/src/memo.ts b/packages/sdk-governance/src/memo.ts new file mode 100644 index 0000000..2332163 --- /dev/null +++ b/packages/sdk-governance/src/memo.ts @@ -0,0 +1,22 @@ +export const weakMemo = (fn: (...arg: Arg) => R) => { + const cache = new WeakMap() + return (...arg: Arg) => { + if (cache.has(arg[0])) return cache.get(arg[0])! + const result = fn(...arg) + cache.set(arg[0], result) + return result + } +} + +export const memo = , R>(fn: (...arg: Arg) => R) => { + let cachedKey: Arg | null = null + let cachedValue: R = null as any + return (...arg: Arg) => { + if (cachedKey && cachedKey.every((k, i) => k === arg[i])) { + return cachedValue + } + cachedKey = arg + cachedValue = fn(...arg) + return cachedValue + } +} From 6b59468e165d0f43a8d9cdbdc56ee608745d7df0 Mon Sep 17 00:00:00 2001 From: Victor Oliva Date: Thu, 2 Jan 2025 17:17:21 +0100 Subject: [PATCH 05/13] feat: simplify bounty API, remove observables --- .../sdk-governance/src/bounties-sdk-types.ts | 10 +- packages/sdk-governance/src/bounties-sdk.ts | 283 ++++++++---------- 2 files changed, 134 insertions(+), 159 deletions(-) diff --git a/packages/sdk-governance/src/bounties-sdk-types.ts b/packages/sdk-governance/src/bounties-sdk-types.ts index 4abc28f..b6add7e 100644 --- a/packages/sdk-governance/src/bounties-sdk-types.ts +++ b/packages/sdk-governance/src/bounties-sdk-types.ts @@ -1,4 +1,4 @@ -import { Binary, SS58String, Transaction, TxEvent } from "polkadot-api" +import { SS58String, Transaction, TxEvent } from "polkadot-api" import { GroupedObservable, Observable } from "rxjs" import { BountiesBountyStatus, @@ -10,7 +10,7 @@ import { OngoingReferendum } from "./referenda-sdk-types" export interface GenericBounty extends BountyWithoutDescription { type: BountiesBountyStatus["type"] id: number - description: Binary | null + description: () => Promise } interface ClosableBounty { @@ -99,7 +99,7 @@ export interface BountiesSdk { bountyIds$: Observable getBountyById$: (key: number) => GroupedObservable } - getBounty(id: number): Observable - getBounties(): Observable - getProposedBounty(txEvent: TxEvent): Observable + getBounty(id: number): Promise + getBounties(): Promise + getProposedBounty(txEvent: TxEvent): Promise } diff --git a/packages/sdk-governance/src/bounties-sdk.ts b/packages/sdk-governance/src/bounties-sdk.ts index fd8e889..7e2808f 100644 --- a/packages/sdk-governance/src/bounties-sdk.ts +++ b/packages/sdk-governance/src/bounties-sdk.ts @@ -1,17 +1,6 @@ import { combineKeys, partitionByKey, toKeySet } from "@react-rxjs/utils" import { Binary, TxEvent } from "polkadot-api" -import { - combineLatest, - from, - map, - mergeMap, - Observable, - of, - shareReplay, - skip, - startWith, - switchMap, -} from "rxjs" +import { map, mergeMap, skip, startWith, switchMap } from "rxjs" import { BountiesSdkTypedApi, BountyWithoutDescription, @@ -177,126 +166,120 @@ export function createBountiesSdk(typedApi: BountiesSdkTypedApi): BountiesSdk { .filter((v) => v !== null) } - const enhanceBounty$ = ( - bounty$: Observable, + const enhanceBounty = ( + bounty: BountyWithoutDescription, id: number, - ): Observable => - combineLatest([ - bounty$, - from(typedApi.query.Bounties.BountyDescriptions.getValue(id)).pipe( - startWith(null), - ), - ]).pipe( - map( - ([bounty, description]): GenericBounty => ({ - ...bounty, - type: bounty.status.type, - id, - description: description ?? null, - }), - ), - map((bounty): Bounty => { - switch (bounty.status.type) { - case "Proposed": - return { - ...bounty, - type: "Proposed", - approve() { - return typedApi.tx.Bounties.approve_bounty({ bounty_id: id }) - }, - close() { - return typedApi.tx.Bounties.close_bounty({ bounty_id: id }) - }, - filterApprovingReferenda(referenda) { - return findApprovingReferenda(referenda, id) - }, - getScheduledApprovals() { - return findScheduledApproved(id) - }, - } - case "Approved": - return { ...bounty, type: "Approved" } - case "Funded": - return { - ...bounty, - type: "Funded", - proposeCurator(curator, fee) { - return typedApi.tx.Bounties.propose_curator({ - bounty_id: id, - curator, - fee, - }) - }, - close() { - return typedApi.tx.Bounties.close_bounty({ bounty_id: id }) - }, - filterProposingReferenda(referenda) { - return findProposingCuratorReferenda(referenda, id) - }, - getScheduledProposals() { - return findScheduledCuratorProposed(id) - }, - } - case "CuratorProposed": - return { - ...bounty, - ...bounty.status.value, - type: "CuratorProposed", - acceptCuratorRole() { - return typedApi.tx.Bounties.accept_curator({ bounty_id: id }) - }, - unassignCurator() { - return typedApi.tx.Bounties.unassign_curator({ bounty_id: id }) - }, - close() { - return typedApi.tx.Bounties.close_bounty({ bounty_id: id }) - }, - } - case "Active": - return { - ...bounty, - type: "Active", - curator: bounty.status.value.curator, - updateDue: bounty.status.value.update_due, - extendExpiry(remark) { - return typedApi.tx.Bounties.extend_bounty_expiry({ - bounty_id: id, - remark: Binary.fromText(remark ?? ""), - }) - }, - award(beneficiary) { - return typedApi.tx.Bounties.award_bounty({ - bounty_id: id, - beneficiary: { - type: "Id", - value: beneficiary, - }, - }) - }, - unassignCurator() { - return typedApi.tx.Bounties.unassign_curator({ bounty_id: id }) - }, - close() { - return typedApi.tx.Bounties.close_bounty({ bounty_id: id }) - }, - } - case "PendingPayout": - return { - ...bounty, - type: "PendingPayout", - curator: bounty.status.value.curator, - unlockAt: bounty.status.value.unlock_at, - beneficiary: bounty.status.value.beneficiary, - claim() { - return typedApi.tx.Bounties.claim_bounty({ bounty_id: id }) - }, - unassignCurator() { - return typedApi.tx.Bounties.unassign_curator({ bounty_id: id }) + ): Bounty => { + const generic: GenericBounty = { + ...bounty, + type: bounty.status.type, + id, + description: () => + typedApi.query.Bounties.BountyDescriptions.getValue(id).then((r) => + r ? r.asText() : null, + ), + } + + switch (generic.status.type) { + case "Proposed": + return { + ...generic, + type: "Proposed", + approve() { + return typedApi.tx.Bounties.approve_bounty({ bounty_id: id }) + }, + close() { + return typedApi.tx.Bounties.close_bounty({ bounty_id: id }) + }, + filterApprovingReferenda(referenda) { + return findApprovingReferenda(referenda, id) + }, + getScheduledApprovals() { + return findScheduledApproved(id) + }, + } + case "Approved": + return { ...generic, type: "Approved" } + case "Funded": + return { + ...generic, + type: "Funded", + proposeCurator(curator, fee) { + return typedApi.tx.Bounties.propose_curator({ + bounty_id: id, + curator, + fee, + }) + }, + close() { + return typedApi.tx.Bounties.close_bounty({ bounty_id: id }) + }, + filterProposingReferenda(referenda) { + return findProposingCuratorReferenda(referenda, id) + }, + getScheduledProposals() { + return findScheduledCuratorProposed(id) + }, + } + case "CuratorProposed": + return { + ...generic, + ...generic.status.value, + type: "CuratorProposed", + acceptCuratorRole() { + return typedApi.tx.Bounties.accept_curator({ bounty_id: id }) + }, + unassignCurator() { + return typedApi.tx.Bounties.unassign_curator({ bounty_id: id }) + }, + close() { + return typedApi.tx.Bounties.close_bounty({ bounty_id: id }) + }, + } + case "Active": + return { + ...generic, + type: "Active", + curator: generic.status.value.curator, + updateDue: generic.status.value.update_due, + extendExpiry(remark) { + return typedApi.tx.Bounties.extend_bounty_expiry({ + bounty_id: id, + remark: Binary.fromText(remark ?? ""), + }) + }, + award(beneficiary) { + return typedApi.tx.Bounties.award_bounty({ + bounty_id: id, + beneficiary: { + type: "Id", + value: beneficiary, }, - } + }) + }, + unassignCurator() { + return typedApi.tx.Bounties.unassign_curator({ bounty_id: id }) + }, + close() { + return typedApi.tx.Bounties.close_bounty({ bounty_id: id }) + }, } - }), - ) + case "PendingPayout": + return { + ...generic, + type: "PendingPayout", + curator: generic.status.value.curator, + unlockAt: generic.status.value.unlock_at, + beneficiary: generic.status.value.beneficiary, + claim() { + return typedApi.tx.Bounties.claim_bounty({ bounty_id: id }) + }, + unassignCurator() { + return typedApi.tx.Bounties.unassign_curator({ bounty_id: id }) + }, + } + } + } function watchBounties() { const [getBountyById$, bountyKeyChanges$] = partitionByKey( @@ -308,7 +291,7 @@ export function createBountiesSdk(typedApi: BountiesSdkTypedApi): BountiesSdk { mergeMap((v) => v.sort((a, b) => a.keyArgs[0] - b.keyArgs[0])), ), (res) => res.keyArgs[0], - (group$, id) => enhanceBounty$(group$.pipe(map((v) => v.value)), id), + (group$, id) => group$.pipe(map((v) => enhanceBounty(v.value, id))), ) const bountyIds$ = bountyKeyChanges$.pipe( @@ -324,47 +307,39 @@ export function createBountiesSdk(typedApi: BountiesSdkTypedApi): BountiesSdk { } function getBounty(id: number) { - return from(typedApi.query.Bounties.Bounties.getValue(id)).pipe( - mergeMap((bounty) => - bounty ? enhanceBounty$(of(bounty), id) : of(null), - ), + return typedApi.query.Bounties.Bounties.getValue(id).then((bounty) => + bounty ? enhanceBounty(bounty, id) : null, ) } - function getProposedBounty( + async function getProposedBounty( txEvent: TxEvent, - ): Observable { + ): Promise { if (!("events" in txEvent)) { - return of(null) + return null } const proposedBountyEvt = typedApi.event.Bounties.BountyProposed.filter( txEvent.events, )[0] if (!proposedBountyEvt) { - return of(null) + return null } const id = proposedBountyEvt.index const at = txEvent.type === "finalized" ? undefined : txEvent.block.hash - return from(typedApi.query.Bounties.Bounties.getValue(id, { at })).pipe( - mergeMap((bounty) => - bounty ? enhanceBounty$(of(bounty), id) : of(null), - ), - map((v) => (v?.type === "Proposed" ? v : null)), - ) + const bounty = await typedApi.query.Bounties.Bounties.getValue(id, { at }) + if (!bounty) return null + + const enhanced = enhanceBounty(bounty, id) + return enhanced.type === "Proposed" ? enhanced : null } function getBounties() { - return from(typedApi.query.Bounties.Bounties.getEntries()).pipe( - mergeMap((entries) => - combineLatest( - entries - .map(({ keyArgs: [id], value }) => ({ bounty: value, id })) - .sort((a, b) => a.id - b.id) - .map(({ bounty, id }) => enhanceBounty$(of(bounty), id)), - ), - ), - shareReplay(1), + return typedApi.query.Bounties.Bounties.getEntries().then((entries) => + entries + .map(({ keyArgs: [id], value }) => ({ bounty: value, id })) + .sort((a, b) => a.id - b.id) + .map(({ bounty, id }) => enhanceBounty(bounty, id)), ) } From 6e669c4e1850e966b8db9e524867b320c0c8d9c1 Mon Sep 17 00:00:00 2001 From: Victor Oliva Date: Fri, 3 Jan 2025 10:15:39 +0100 Subject: [PATCH 06/13] refactor(governance): break down into smaller files --- .../src/{ => bounties}/bounties-sdk.ts | 194 +----------------- .../descriptors.ts} | 2 +- .../src/bounties/find-referenda.ts | 107 ++++++++++ .../src/bounties/find-scheduled.ts | 81 ++++++++ .../sdk-types.ts} | 4 +- packages/sdk-governance/src/index.ts | 14 +- packages/sdk-governance/src/preimages.ts | 2 +- .../chainConfig.ts} | 0 .../descriptors.ts} | 0 .../src/{ => referenda}/referenda-sdk.ts | 10 +- .../sdk-types.ts} | 4 +- .../sdk-governance/src/{ => util}/keyBy.ts | 0 .../sdk-governance/src/{ => util}/memo.ts | 0 13 files changed, 214 insertions(+), 204 deletions(-) rename packages/sdk-governance/src/{ => bounties}/bounties-sdk.ts (52%) rename packages/sdk-governance/src/{bounties-descriptors.ts => bounties/descriptors.ts} (98%) create mode 100644 packages/sdk-governance/src/bounties/find-referenda.ts create mode 100644 packages/sdk-governance/src/bounties/find-scheduled.ts rename packages/sdk-governance/src/{bounties-sdk-types.ts => bounties/sdk-types.ts} (96%) rename packages/sdk-governance/src/{referenda-chainConfig.ts => referenda/chainConfig.ts} (100%) rename packages/sdk-governance/src/{referenda-descriptors.ts => referenda/descriptors.ts} (100%) rename packages/sdk-governance/src/{ => referenda}/referenda-sdk.ts (95%) rename packages/sdk-governance/src/{referenda-sdk-types.ts => referenda/sdk-types.ts} (94%) rename packages/sdk-governance/src/{ => util}/keyBy.ts (100%) rename packages/sdk-governance/src/{ => util}/memo.ts (100%) diff --git a/packages/sdk-governance/src/bounties-sdk.ts b/packages/sdk-governance/src/bounties/bounties-sdk.ts similarity index 52% rename from packages/sdk-governance/src/bounties-sdk.ts rename to packages/sdk-governance/src/bounties/bounties-sdk.ts index 7e2808f..19f342e 100644 --- a/packages/sdk-governance/src/bounties-sdk.ts +++ b/packages/sdk-governance/src/bounties/bounties-sdk.ts @@ -1,170 +1,17 @@ import { combineKeys, partitionByKey, toKeySet } from "@react-rxjs/utils" import { Binary, TxEvent } from "polkadot-api" import { map, mergeMap, skip, startWith, switchMap } from "rxjs" +import { BountiesSdkTypedApi, BountyWithoutDescription } from "./descriptors" import { - BountiesSdkTypedApi, - BountyWithoutDescription, - MultiAddress, -} from "./bounties-descriptors" -import { - BountiesSdk, - Bounty, - GenericBounty, - ProposedBounty, -} from "./bounties-sdk-types" -import { memo, weakMemo } from "./memo" -import { getPreimageResolver } from "./preimages" -import { OngoingReferendum } from "./referenda-sdk-types" + findApprovingReferenda, + findProposingCuratorReferenda, +} from "./find-referenda" +import { scheduledFinder } from "./find-scheduled" +import { BountiesSdk, Bounty, GenericBounty, ProposedBounty } from "./sdk-types" export function createBountiesSdk(typedApi: BountiesSdkTypedApi): BountiesSdk { - const resolvePreimage = getPreimageResolver( - typedApi.query.Preimage.PreimageFor.getValues, - ) - - const getDecodedSpenderReferenda = weakMemo( - async (ongoingReferenda: OngoingReferendum[]) => { - const spenderReferenda = ongoingReferenda.filter( - (ref) => - (ref.origin.type === "Origins" && - spenderOrigins.includes(ref.origin.value.type)) || - (ref.origin.type === "system" && ref.origin.value.type === "Root"), - ) - const response = await Promise.all( - spenderReferenda.map((referendum) => - referendum.proposal - .decodedCall() - .then((call) => ({ - referendum, - call, - })) - .catch((ex) => { - console.error(ex) - return null - }), - ), - ) - return response.filter((v) => !!v) - }, - ) - - async function findApprovingReferenda( - ongoingReferenda: OngoingReferendum[], - bountyId: number, - ) { - const spenderReferenda = await getDecodedSpenderReferenda(ongoingReferenda) - - return spenderReferenda - .filter(({ call }) => - findCalls( - { - pallet: "Bounties", - name: "approve_bounty", - }, - call, - ).some((v) => v?.bounty_id === bountyId), - ) - .map(({ referendum }) => referendum) - } - - async function findProposingCuratorReferenda( - ongoingReferenda: OngoingReferendum[], - bountyId: number, - ) { - const spenderReferenda = await getDecodedSpenderReferenda(ongoingReferenda) - - return spenderReferenda - .map(({ call, referendum }) => { - const proposeCuratorCalls = findCalls( - { - pallet: "Bounties", - name: "propose_curator", - }, - call, - ) - .filter( - (v) => - v?.bounty_id === bountyId && - typeof v.curator === "object" && - typeof v.fee === "bigint", - ) - .map((v) => ({ - curator: v.curator as MultiAddress, - fee: v.fee as bigint, - })) - if (!proposeCuratorCalls.length) return null - return { referendum, proposeCuratorCalls } - }) - .filter((v) => v !== null) - } - - const getScheduledCalls = memo(async () => { - const agenda = await typedApi.query.Scheduler.Agenda.getEntries() - const token = await typedApi.compatibilityToken - - const scheduled = agenda.flatMap( - ({ keyArgs: [height], value: values }) => - values - ?.filter((v) => !!v) - .map((value) => ({ - height, - call: value.call, - })) ?? [], - ) - - const resolvedCalls = await Promise.all( - scheduled.map(({ height, call }) => - resolvePreimage(call) - .then( - (callData) => typedApi.txFromCallData(callData, token).decodedCall, - ) - .then((decodedCall) => ({ height, call: decodedCall })) - .catch((ex) => { - console.error(ex) - return null - }), - ), - ) - return resolvedCalls.filter((v) => !!v) - }) - async function findScheduledApproved(bountyId: number) { - const calls = await getScheduledCalls() - - return calls - .filter(({ call }) => - findCalls({ pallet: "Bounties", name: "approve_bounty" }, call).some( - (v) => v?.bounty_id === bountyId, - ), - ) - .map(({ height }) => height) - } - - async function findScheduledCuratorProposed(bountyId: number) { - const calls = await getScheduledCalls() - - return calls - .map(({ call, height }) => { - const proposeCuratorCalls = findCalls( - { - pallet: "Bounties", - name: "propose_curator", - }, - call, - ) - .filter( - (v) => - v?.bounty_id === bountyId && - typeof v.curator === "object" && - typeof v.fee === "bigint", - ) - .map((v) => ({ - curator: v.curator as MultiAddress, - fee: v.fee as bigint, - })) - if (!proposeCuratorCalls.length) return null - return { height, proposeCuratorCalls } - }) - .filter((v) => v !== null) - } + const { findScheduledApproved, findScheduledCuratorProposed } = + scheduledFinder(typedApi) const enhanceBounty = ( bounty: BountyWithoutDescription, @@ -350,28 +197,3 @@ export function createBountiesSdk(typedApi: BountiesSdkTypedApi): BountiesSdk { getProposedBounty, } } - -const spenderOrigins = [ - "Treasurer", - "SmallSpender", - "MediumSpender", - "BigSpender", - "SmallTipper", - "BigTipper", -] - -const findCalls = (call: { pallet: string; name: string }, obj: any): any[] => { - if (typeof obj !== "object") return [] - if (Array.isArray(obj)) { - const approves = [] - for (const item of obj) approves.push(...findCalls(call, item)) - return approves - } - if (obj?.type === call.pallet && obj?.value?.type === call.name) { - return [obj.value.value] - } - const approves = [] - for (const key of Object.keys(obj)) - approves.push(...findCalls(call, obj[key])) - return approves -} diff --git a/packages/sdk-governance/src/bounties-descriptors.ts b/packages/sdk-governance/src/bounties/descriptors.ts similarity index 98% rename from packages/sdk-governance/src/bounties-descriptors.ts rename to packages/sdk-governance/src/bounties/descriptors.ts index dba9f2b..3d22967 100644 --- a/packages/sdk-governance/src/bounties-descriptors.ts +++ b/packages/sdk-governance/src/bounties/descriptors.ts @@ -14,7 +14,7 @@ import { import { PolkadotRuntimeOriginCaller, PreimagesBounded, -} from "./referenda-descriptors" +} from "../referenda/descriptors" export type BountiesBountyStatus = Enum<{ Proposed: undefined diff --git a/packages/sdk-governance/src/bounties/find-referenda.ts b/packages/sdk-governance/src/bounties/find-referenda.ts new file mode 100644 index 0000000..231cb15 --- /dev/null +++ b/packages/sdk-governance/src/bounties/find-referenda.ts @@ -0,0 +1,107 @@ +import { OngoingReferendum } from "@/referenda/sdk-types" +import { weakMemo } from "@/util/memo" +import { MultiAddress } from "./descriptors" + +const spenderOrigins = [ + "Treasurer", + "SmallSpender", + "MediumSpender", + "BigSpender", + "SmallTipper", + "BigTipper", +] + +const getDecodedSpenderReferenda = weakMemo( + async (ongoingReferenda: OngoingReferendum[]) => { + const spenderReferenda = ongoingReferenda.filter( + (ref) => + (ref.origin.type === "Origins" && + spenderOrigins.includes(ref.origin.value.type)) || + (ref.origin.type === "system" && ref.origin.value.type === "Root"), + ) + const response = await Promise.all( + spenderReferenda.map((referendum) => + referendum.proposal + .decodedCall() + .then((call) => ({ + referendum, + call, + })) + .catch((ex) => { + console.error(ex) + return null + }), + ), + ) + return response.filter((v) => !!v) + }, +) + +export async function findApprovingReferenda( + ongoingReferenda: OngoingReferendum[], + bountyId: number, +) { + const spenderReferenda = await getDecodedSpenderReferenda(ongoingReferenda) + + return spenderReferenda + .filter(({ call }) => + findCalls( + { + pallet: "Bounties", + name: "approve_bounty", + }, + call, + ).some((v) => v?.bounty_id === bountyId), + ) + .map(({ referendum }) => referendum) +} + +export async function findProposingCuratorReferenda( + ongoingReferenda: OngoingReferendum[], + bountyId: number, +) { + const spenderReferenda = await getDecodedSpenderReferenda(ongoingReferenda) + + return spenderReferenda + .map(({ call, referendum }) => { + const proposeCuratorCalls = findCalls( + { + pallet: "Bounties", + name: "propose_curator", + }, + call, + ) + .filter( + (v) => + v?.bounty_id === bountyId && + typeof v.curator === "object" && + typeof v.fee === "bigint", + ) + .map((v) => ({ + curator: v.curator as MultiAddress, + fee: v.fee as bigint, + })) + if (!proposeCuratorCalls.length) return null + return { referendum, proposeCuratorCalls } + }) + .filter((v) => v !== null) +} + +export const findCalls = ( + call: { pallet: string; name: string }, + obj: any, +): any[] => { + if (typeof obj !== "object") return [] + if (Array.isArray(obj)) { + const approves = [] + for (const item of obj) approves.push(...findCalls(call, item)) + return approves + } + if (obj?.type === call.pallet && obj?.value?.type === call.name) { + return [obj.value.value] + } + const approves = [] + for (const key of Object.keys(obj)) + approves.push(...findCalls(call, obj[key])) + return approves +} diff --git a/packages/sdk-governance/src/bounties/find-scheduled.ts b/packages/sdk-governance/src/bounties/find-scheduled.ts new file mode 100644 index 0000000..1050d6e --- /dev/null +++ b/packages/sdk-governance/src/bounties/find-scheduled.ts @@ -0,0 +1,81 @@ +import { getPreimageResolver } from "@/preimages" +import { memo } from "@/util/memo" +import { BountiesSdkTypedApi, MultiAddress } from "./descriptors" +import { findCalls } from "./find-referenda" + +export const scheduledFinder = (typedApi: BountiesSdkTypedApi) => { + const resolvePreimage = getPreimageResolver( + typedApi.query.Preimage.PreimageFor.getValues, + ) + + const getScheduledCalls = memo(async () => { + const agenda = await typedApi.query.Scheduler.Agenda.getEntries() + const token = await typedApi.compatibilityToken + + const scheduled = agenda.flatMap( + ({ keyArgs: [height], value: values }) => + values + ?.filter((v) => !!v) + .map((value) => ({ + height, + call: value.call, + })) ?? [], + ) + + const resolvedCalls = await Promise.all( + scheduled.map(({ height, call }) => + resolvePreimage(call) + .then( + (callData) => typedApi.txFromCallData(callData, token).decodedCall, + ) + .then((decodedCall) => ({ height, call: decodedCall })) + .catch((ex) => { + console.error(ex) + return null + }), + ), + ) + return resolvedCalls.filter((v) => !!v) + }) + async function findScheduledApproved(bountyId: number) { + const calls = await getScheduledCalls() + + return calls + .filter(({ call }) => + findCalls({ pallet: "Bounties", name: "approve_bounty" }, call).some( + (v) => v?.bounty_id === bountyId, + ), + ) + .map(({ height }) => height) + } + + async function findScheduledCuratorProposed(bountyId: number) { + const calls = await getScheduledCalls() + + return calls + .map(({ call, height }) => { + const proposeCuratorCalls = findCalls( + { + pallet: "Bounties", + name: "propose_curator", + }, + call, + ) + .filter( + (v) => + v?.bounty_id === bountyId && + typeof v.curator === "object" && + typeof v.fee === "bigint", + ) + .map((v) => ({ + curator: v.curator as MultiAddress, + fee: v.fee as bigint, + })) + if (!proposeCuratorCalls.length) return null + return { height, proposeCuratorCalls } + }) + .filter((v) => v !== null) + } + + return { findScheduledApproved, findScheduledCuratorProposed } +} diff --git a/packages/sdk-governance/src/bounties-sdk-types.ts b/packages/sdk-governance/src/bounties/sdk-types.ts similarity index 96% rename from packages/sdk-governance/src/bounties-sdk-types.ts rename to packages/sdk-governance/src/bounties/sdk-types.ts index b6add7e..fe8fa0d 100644 --- a/packages/sdk-governance/src/bounties-sdk-types.ts +++ b/packages/sdk-governance/src/bounties/sdk-types.ts @@ -1,11 +1,11 @@ import { SS58String, Transaction, TxEvent } from "polkadot-api" import { GroupedObservable, Observable } from "rxjs" +import { OngoingReferendum } from "../referenda/sdk-types" import { BountiesBountyStatus, BountyWithoutDescription, MultiAddress, -} from "./bounties-descriptors" -import { OngoingReferendum } from "./referenda-sdk-types" +} from "./descriptors" export interface GenericBounty extends BountyWithoutDescription { type: BountiesBountyStatus["type"] diff --git a/packages/sdk-governance/src/index.ts b/packages/sdk-governance/src/index.ts index 3574dd6..a44f81c 100644 --- a/packages/sdk-governance/src/index.ts +++ b/packages/sdk-governance/src/index.ts @@ -1,12 +1,12 @@ -export { createReferendaSdk } from "./referenda-sdk" +export { createReferendaSdk } from "./referenda/referenda-sdk" export { type Origin, polkadotSpenderOrigin, kusamaSpenderOrigin, -} from "./referenda-chainConfig" -export type * from "./referenda-descriptors" -export type * from "./referenda-sdk-types" +} from "./referenda/chainConfig" +export type * from "./referenda/descriptors" +export type * from "./referenda/sdk-types" -export { createBountiesSdk } from "./bounties-sdk" -export type * from "./bounties-descriptors" -export type * from "./bounties-sdk-types" +export { createBountiesSdk } from "./bounties/bounties-sdk" +export type * from "./bounties/descriptors" +export type * from "./bounties/sdk-types" diff --git a/packages/sdk-governance/src/preimages.ts b/packages/sdk-governance/src/preimages.ts index c8e78fe..9dc0cca 100644 --- a/packages/sdk-governance/src/preimages.ts +++ b/packages/sdk-governance/src/preimages.ts @@ -1,5 +1,5 @@ import { Binary } from "polkadot-api" -import { PreimagesBounded } from "./referenda-descriptors" +import { PreimagesBounded } from "./referenda/descriptors" const preimageCache = new Map>() diff --git a/packages/sdk-governance/src/referenda-chainConfig.ts b/packages/sdk-governance/src/referenda/chainConfig.ts similarity index 100% rename from packages/sdk-governance/src/referenda-chainConfig.ts rename to packages/sdk-governance/src/referenda/chainConfig.ts diff --git a/packages/sdk-governance/src/referenda-descriptors.ts b/packages/sdk-governance/src/referenda/descriptors.ts similarity index 100% rename from packages/sdk-governance/src/referenda-descriptors.ts rename to packages/sdk-governance/src/referenda/descriptors.ts diff --git a/packages/sdk-governance/src/referenda-sdk.ts b/packages/sdk-governance/src/referenda/referenda-sdk.ts similarity index 95% rename from packages/sdk-governance/src/referenda-sdk.ts rename to packages/sdk-governance/src/referenda/referenda-sdk.ts index a392da9..3311701 100644 --- a/packages/sdk-governance/src/referenda-sdk.ts +++ b/packages/sdk-governance/src/referenda/referenda-sdk.ts @@ -1,18 +1,18 @@ import { blake2b } from "@noble/hashes/blake2b" import { Binary, TxEvent } from "polkadot-api" -import { keyBy } from "./keyBy" -import { getPreimageResolver } from "./preimages" -import { originToTrack, polkadotSpenderOrigin } from "./referenda-chainConfig" +import { getPreimageResolver } from "../preimages" +import { keyBy } from "../util/keyBy" +import { originToTrack, polkadotSpenderOrigin } from "./chainConfig" import { PolkadotRuntimeOriginCaller, ReferendaSdkTypedApi, ReferendumInfo, -} from "./referenda-descriptors" +} from "./descriptors" import { OngoingReferendum, ReferendaSdk, ReferendaSdkConfig, -} from "./referenda-sdk-types" +} from "./sdk-types" const MAX_INLINE_SIZE = 128 type RawOngoingReferendum = (ReferendumInfo & { type: "Ongoing" })["value"] diff --git a/packages/sdk-governance/src/referenda-sdk-types.ts b/packages/sdk-governance/src/referenda/sdk-types.ts similarity index 94% rename from packages/sdk-governance/src/referenda-sdk-types.ts rename to packages/sdk-governance/src/referenda/sdk-types.ts index 9103d42..d599cba 100644 --- a/packages/sdk-governance/src/referenda-sdk-types.ts +++ b/packages/sdk-governance/src/referenda/sdk-types.ts @@ -1,11 +1,11 @@ import { Binary, Transaction, TxEvent } from "polkadot-api" -import { Origin } from "./referenda-chainConfig" +import { Origin } from "./chainConfig" import { PolkadotRuntimeOriginCaller, PreimagesBounded, ReferendumInfo, TraitsScheduleDispatchTime, -} from "./referenda-descriptors" +} from "./descriptors" type RawOngoingReferendum = (ReferendumInfo & { type: "Ongoing" })["value"] diff --git a/packages/sdk-governance/src/keyBy.ts b/packages/sdk-governance/src/util/keyBy.ts similarity index 100% rename from packages/sdk-governance/src/keyBy.ts rename to packages/sdk-governance/src/util/keyBy.ts diff --git a/packages/sdk-governance/src/memo.ts b/packages/sdk-governance/src/util/memo.ts similarity index 100% rename from packages/sdk-governance/src/memo.ts rename to packages/sdk-governance/src/util/memo.ts From 6f53093059f5a9466faacaa114241472a2a8cce4 Mon Sep 17 00:00:00 2001 From: Victor Oliva Date: Tue, 7 Jan 2025 17:01:43 +0100 Subject: [PATCH 07/13] feat: child-bounties sdk --- .../src/bounties/child-bounties-sdk.ts | 143 ++++++++++++++++++ .../src/bounties/child-descriptors.ts | 132 ++++++++++++++++ .../src/bounties/child-sdk-types.ts | 68 +++++++++ .../src/bounties/descriptors.ts | 10 +- packages/sdk-governance/src/index.ts | 3 + 5 files changed, 347 insertions(+), 9 deletions(-) create mode 100644 packages/sdk-governance/src/bounties/child-bounties-sdk.ts create mode 100644 packages/sdk-governance/src/bounties/child-descriptors.ts create mode 100644 packages/sdk-governance/src/bounties/child-sdk-types.ts diff --git a/packages/sdk-governance/src/bounties/child-bounties-sdk.ts b/packages/sdk-governance/src/bounties/child-bounties-sdk.ts new file mode 100644 index 0000000..0686c16 --- /dev/null +++ b/packages/sdk-governance/src/bounties/child-bounties-sdk.ts @@ -0,0 +1,143 @@ +import { combineKeys, partitionByKey, toKeySet } from "@react-rxjs/utils" +import { map, mergeMap, skip, startWith, switchMap } from "rxjs" +import { + ChildBountiesSdkTypedApi, + ChildBountyWithoutDescription, +} from "./child-descriptors" +import { + ChildBountiesSdk, + ChildBounty, + GenericChildBounty, +} from "./child-sdk-types" + +export function createChildBountiesSdk( + typedApi: ChildBountiesSdkTypedApi, +): ChildBountiesSdk { + const enhanceBounty = ( + bounty: ChildBountyWithoutDescription, + id: number, + ): ChildBounty => { + const generic: GenericChildBounty = { + ...bounty, + type: bounty.status.type, + id, + description: () => + typedApi.query.ChildBounties.ChildBountyDescriptions.getValue(id).then( + (r) => (r ? r.asText() : null), + ), + } + + const idObj = { + parent_bounty_id: bounty.parent_bounty, + child_bounty_id: id, + } + switch (generic.status.type) { + case "Added": + return { + ...generic, + type: "Added", + proposeCurator(curator, fee) { + return typedApi.tx.ChildBounties.propose_curator({ + ...idObj, + curator, + fee, + }) + }, + close() { + return typedApi.tx.ChildBounties.close_child_bounty(idObj) + }, + } + case "CuratorProposed": + return { + ...generic, + ...generic.status.value, + type: "CuratorProposed", + acceptCuratorRole() { + return typedApi.tx.ChildBounties.accept_curator(idObj) + }, + unassignCurator() { + return typedApi.tx.ChildBounties.unassign_curator(idObj) + }, + close() { + return typedApi.tx.ChildBounties.close_child_bounty(idObj) + }, + } + case "Active": + return { + ...generic, + type: "Active", + curator: generic.status.value.curator, + award(beneficiary) { + return typedApi.tx.ChildBounties.award_child_bounty({ + ...idObj, + beneficiary: { + type: "Id", + value: beneficiary, + }, + }) + }, + unassignCurator() { + return typedApi.tx.ChildBounties.unassign_curator(idObj) + }, + close() { + return typedApi.tx.ChildBounties.close_child_bounty(idObj) + }, + } + case "PendingPayout": + return { + ...generic, + type: "PendingPayout", + curator: generic.status.value.curator, + unlockAt: generic.status.value.unlock_at, + beneficiary: generic.status.value.beneficiary, + claim() { + return typedApi.tx.ChildBounties.claim_child_bounty(idObj) + }, + unassignCurator() { + return typedApi.tx.ChildBounties.unassign_curator(idObj) + }, + } + } + } + + function watchChildBounties(parentId: number) { + const [getBountyById$, bountyKeyChanges$] = partitionByKey( + // TODO watchEntries + typedApi.query.ChildBounties.ParentChildBounties.watchValue( + parentId, + ).pipe( + skip(1), + startWith(null), + switchMap(() => + typedApi.query.ChildBounties.ChildBounties.getEntries(parentId), + ), + mergeMap((v) => v.sort((a, b) => a.keyArgs[1] - b.keyArgs[1])), + ), + (res) => res.keyArgs[1], + (group$, id) => group$.pipe(map((v) => enhanceBounty(v.value, id))), + ) + + const bountyIds$ = bountyKeyChanges$.pipe( + toKeySet(), + map((set) => [...set]), + ) + + return { + bounties$: combineKeys(bountyIds$, getBountyById$), + getBountyById$, + bountyIds$, + } + } + + function getChildBounty(parentId: number, id: number) { + return typedApi.query.ChildBounties.ChildBounties.getValue( + parentId, + id, + ).then((bounty) => (bounty ? enhanceBounty(bounty, id) : null)) + } + + return { + watchChildBounties, + getChildBounty, + } +} diff --git a/packages/sdk-governance/src/bounties/child-descriptors.ts b/packages/sdk-governance/src/bounties/child-descriptors.ts new file mode 100644 index 0000000..f14b1eb --- /dev/null +++ b/packages/sdk-governance/src/bounties/child-descriptors.ts @@ -0,0 +1,132 @@ +import { SdkDefinition } from "@polkadot-api/common-sdk-utils" +import { + ApisTypedef, + Binary, + Enum, + PalletsTypedef, + SS58String, + StorageDescriptor, + TxDescriptor, + TypedApi, +} from "polkadot-api" +import { MultiAddress } from "./descriptors" + +export type BountiesChildBountyStatus = Enum<{ + Added: undefined + CuratorProposed: { + curator: SS58String + } + Active: { + curator: SS58String + } + PendingPayout: { + curator: SS58String + beneficiary: SS58String + unlock_at: number + } +}> +export interface ChildBountyWithoutDescription { + parent_bounty: number + value: bigint + fee: bigint + curator_deposit: bigint + status: BountiesChildBountyStatus +} + +type ChildBountiesSdkPallets = PalletsTypedef< + { + ChildBounties: { + /** + * Number of child bounties per parent bounty. + * Map of parent bounty index to number of child bounties. + */ + ParentChildBounties: StorageDescriptor< + [Key: number], + number, + false, + never + > + /** + * Child bounties that have been added. + */ + ChildBounties: StorageDescriptor< + [number, number], + ChildBountyWithoutDescription, + true, + never + > + /** + * The description of each child-bounty. + */ + ChildBountyDescriptions: StorageDescriptor< + [Key: number], + Binary, + true, + never + > + } + }, + { + ChildBounties: { + add_child_bounty: TxDescriptor<{ + parent_bounty_id: number + value: bigint + description: Binary + }> + propose_curator: TxDescriptor<{ + parent_bounty_id: number + child_bounty_id: number + curator: MultiAddress + fee: bigint + }> + accept_curator: TxDescriptor<{ + parent_bounty_id: number + child_bounty_id: number + }> + unassign_curator: TxDescriptor<{ + parent_bounty_id: number + child_bounty_id: number + }> + award_child_bounty: TxDescriptor<{ + parent_bounty_id: number + child_bounty_id: number + beneficiary: MultiAddress + }> + claim_child_bounty: TxDescriptor<{ + parent_bounty_id: number + child_bounty_id: number + }> + close_child_bounty: TxDescriptor<{ + parent_bounty_id: number + child_bounty_id: number + }> + } + }, + { + // ChildBounties: { + // /** + // *A child-bounty is added. + // */ + // Added: PlainDescriptor> + // /** + // *A child-bounty is awarded to a beneficiary. + // */ + // Awarded: PlainDescriptor> + // /** + // *A child-bounty is claimed by beneficiary. + // */ + // Claimed: PlainDescriptor> + // /** + // *A child-bounty is cancelled. + // */ + // Canceled: PlainDescriptor> + // } + }, + {}, + {} +> +type ChildBountiesSdkDefinition = SdkDefinition< + ChildBountiesSdkPallets, + ApisTypedef<{}> +> +export type ChildBountiesSdkTypedApi = TypedApi diff --git a/packages/sdk-governance/src/bounties/child-sdk-types.ts b/packages/sdk-governance/src/bounties/child-sdk-types.ts new file mode 100644 index 0000000..3824b16 --- /dev/null +++ b/packages/sdk-governance/src/bounties/child-sdk-types.ts @@ -0,0 +1,68 @@ +import { SS58String, Transaction } from "polkadot-api" +import { GroupedObservable, Observable } from "rxjs" +import { + BountiesChildBountyStatus, + ChildBountyWithoutDescription, +} from "./child-descriptors" +import { MultiAddress } from "./descriptors" + +export interface GenericChildBounty extends ChildBountyWithoutDescription { + type: BountiesChildBountyStatus["type"] + id: number + description: () => Promise +} + +interface ClosableBounty { + close(): Transaction +} +export interface AddedChildBounty extends GenericChildBounty, ClosableBounty { + type: "Added" + proposeCurator( + curator: MultiAddress, + fee: bigint, + ): Transaction +} + +interface CuratorUnassignable { + unassignCurator(): Transaction +} +export interface CuratorProposedChildBounty + extends GenericChildBounty, + CuratorUnassignable, + ClosableBounty { + type: "CuratorProposed" + curator: SS58String + acceptCuratorRole(): Transaction +} +export interface ActiveChildBounty + extends GenericChildBounty, + CuratorUnassignable, + ClosableBounty { + type: "Active" + curator: SS58String + award(beneficiary: SS58String): Transaction +} +export interface PendingPayoutChildBounty + extends GenericChildBounty, + CuratorUnassignable { + type: "PendingPayout" + curator: SS58String + beneficiary: SS58String + unlockAt: number + claim(): Transaction +} + +export type ChildBounty = + | AddedChildBounty + | CuratorProposedChildBounty + | ActiveChildBounty + | PendingPayoutChildBounty + +export interface ChildBountiesSdk { + watchChildBounties(parentId: number): { + bounties$: Observable> + bountyIds$: Observable + getBountyById$: (key: number) => GroupedObservable + } + getChildBounty(parentId: number, id: number): Promise +} diff --git a/packages/sdk-governance/src/bounties/descriptors.ts b/packages/sdk-governance/src/bounties/descriptors.ts index 3d22967..846164f 100644 --- a/packages/sdk-governance/src/bounties/descriptors.ts +++ b/packages/sdk-governance/src/bounties/descriptors.ts @@ -1,3 +1,4 @@ +import { SdkDefinition } from "@polkadot-api/common-sdk-utils" import { ApisTypedef, Binary, @@ -140,15 +141,6 @@ type BountiesSdkPallets = PalletsTypedef< type BountiesSdkDefinition = SdkDefinition> export type BountiesSdkTypedApi = TypedApi -type SdkDefinition = { - descriptors: Promise & { - pallets: P - apis: R - } - asset: any - metadataTypes: any -} - export type MultiAddress = Enum<{ Id: SS58String Index: undefined diff --git a/packages/sdk-governance/src/index.ts b/packages/sdk-governance/src/index.ts index a44f81c..7be5ed0 100644 --- a/packages/sdk-governance/src/index.ts +++ b/packages/sdk-governance/src/index.ts @@ -10,3 +10,6 @@ export type * from "./referenda/sdk-types" export { createBountiesSdk } from "./bounties/bounties-sdk" export type * from "./bounties/descriptors" export type * from "./bounties/sdk-types" +export { createChildBountiesSdk } from "./bounties/child-bounties-sdk" +export type * from "./bounties/child-descriptors" +export type * from "./bounties/child-sdk-types" From 20d6ba20f6e1de21c58e4d29b0f62facb712e6ba Mon Sep 17 00:00:00 2001 From: Victor Oliva Date: Thu, 9 Jan 2025 11:26:10 +0100 Subject: [PATCH 08/13] feat: use watchEntries for bounties --- .../src/bounties/bounties-sdk.ts | 31 ++++++++++++----- .../src/bounties/child-bounties-sdk.ts | 33 ++++++++++++------- 2 files changed, 43 insertions(+), 21 deletions(-) diff --git a/packages/sdk-governance/src/bounties/bounties-sdk.ts b/packages/sdk-governance/src/bounties/bounties-sdk.ts index 19f342e..116a9ed 100644 --- a/packages/sdk-governance/src/bounties/bounties-sdk.ts +++ b/packages/sdk-governance/src/bounties/bounties-sdk.ts @@ -1,6 +1,6 @@ import { combineKeys, partitionByKey, toKeySet } from "@react-rxjs/utils" import { Binary, TxEvent } from "polkadot-api" -import { map, mergeMap, skip, startWith, switchMap } from "rxjs" +import { map, mergeMap, takeWhile } from "rxjs" import { BountiesSdkTypedApi, BountyWithoutDescription } from "./descriptors" import { findApprovingReferenda, @@ -130,15 +130,28 @@ export function createBountiesSdk(typedApi: BountiesSdkTypedApi): BountiesSdk { function watchBounties() { const [getBountyById$, bountyKeyChanges$] = partitionByKey( - // TODO watchEntries - typedApi.query.Bounties.BountyCount.watchValue().pipe( - skip(1), - startWith(null), - switchMap(() => typedApi.query.Bounties.Bounties.getEntries()), - mergeMap((v) => v.sort((a, b) => a.keyArgs[0] - b.keyArgs[0])), + typedApi.query.Bounties.Bounties.watchEntries().pipe( + mergeMap((v) => + v.deltas + ? [ + ...v.deltas.deleted.map((d) => ({ + id: d.args[0], + value: undefined, + })), + ...v.deltas.upserted.map((d) => ({ + id: d.args[0], + value: d.value, + })), + ].sort((a, b) => a.id - b.id) + : [], + ), ), - (res) => res.keyArgs[0], - (group$, id) => group$.pipe(map((v) => enhanceBounty(v.value, id))), + (res) => res.id, + (group$, id) => + group$.pipe( + takeWhile(({ value }) => Boolean(value), false), + map((v) => enhanceBounty(v.value!, id)), + ), ) const bountyIds$ = bountyKeyChanges$.pipe( diff --git a/packages/sdk-governance/src/bounties/child-bounties-sdk.ts b/packages/sdk-governance/src/bounties/child-bounties-sdk.ts index 0686c16..92fc3fb 100644 --- a/packages/sdk-governance/src/bounties/child-bounties-sdk.ts +++ b/packages/sdk-governance/src/bounties/child-bounties-sdk.ts @@ -1,5 +1,5 @@ import { combineKeys, partitionByKey, toKeySet } from "@react-rxjs/utils" -import { map, mergeMap, skip, startWith, switchMap } from "rxjs" +import { map, mergeMap, takeWhile } from "rxjs" import { ChildBountiesSdkTypedApi, ChildBountyWithoutDescription, @@ -102,19 +102,28 @@ export function createChildBountiesSdk( function watchChildBounties(parentId: number) { const [getBountyById$, bountyKeyChanges$] = partitionByKey( - // TODO watchEntries - typedApi.query.ChildBounties.ParentChildBounties.watchValue( - parentId, - ).pipe( - skip(1), - startWith(null), - switchMap(() => - typedApi.query.ChildBounties.ChildBounties.getEntries(parentId), + typedApi.query.ChildBounties.ChildBounties.watchEntries(parentId).pipe( + mergeMap((v) => + v.deltas + ? [ + ...v.deltas.deleted.map((d) => ({ + id: d.args[1], + value: undefined, + })), + ...v.deltas.upserted.map((d) => ({ + id: d.args[1], + value: d.value, + })), + ].sort((a, b) => a.id - b.id) + : [], ), - mergeMap((v) => v.sort((a, b) => a.keyArgs[1] - b.keyArgs[1])), ), - (res) => res.keyArgs[1], - (group$, id) => group$.pipe(map((v) => enhanceBounty(v.value, id))), + (res) => res.id, + (group$, id) => + group$.pipe( + takeWhile(({ value }) => Boolean(value), false), + map((v) => enhanceBounty(v.value!, id)), + ), ) const bountyIds$ = bountyKeyChanges$.pipe( From f074995e2e58afc767cd99fe7eddb9ef2ca3ffd6 Mon Sep 17 00:00:00 2001 From: Victor Oliva Date: Thu, 9 Jan 2025 12:45:46 +0100 Subject: [PATCH 09/13] feat: fetch bounty descriptions --- package.json | 2 +- .../src/bounties/bounties-sdk.ts | 76 ++++++++++++++----- .../src/bounties/bounty-descriptions.ts | 43 +++++++++++ .../src/bounties/child-bounties-sdk.ts | 55 +++++++++++--- .../src/bounties/child-sdk-types.ts | 6 +- .../sdk-governance/src/bounties/sdk-types.ts | 6 +- packages/sdk-governance/tsconfig.json | 1 + pnpm-lock.yaml | 28 +++---- 8 files changed, 166 insertions(+), 51 deletions(-) create mode 100644 packages/sdk-governance/src/bounties/bounty-descriptions.ts diff --git a/package.json b/package.json index dbc9eee..2189cdb 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "rollup": "^4.25.0", "rollup-plugin-dts": "^6.1.1", "rollup-plugin-esbuild": "^6.1.1", - "typescript": "^5.6.3", + "typescript": "^5.7.3", "vitest": "^2.1.4" }, "packageManager": "pnpm@8.15.4+sha1.c85a4305534f76d461407b59277b954bac97b5c4" diff --git a/packages/sdk-governance/src/bounties/bounties-sdk.ts b/packages/sdk-governance/src/bounties/bounties-sdk.ts index 116a9ed..68e37bc 100644 --- a/packages/sdk-governance/src/bounties/bounties-sdk.ts +++ b/packages/sdk-governance/src/bounties/bounties-sdk.ts @@ -1,6 +1,13 @@ import { combineKeys, partitionByKey, toKeySet } from "@react-rxjs/utils" import { Binary, TxEvent } from "polkadot-api" -import { map, mergeMap, takeWhile } from "rxjs" +import { + combineLatest, + distinctUntilChanged, + map, + mergeMap, + takeWhile, +} from "rxjs" +import { getBountyDescriptions$ } from "./bounty-descriptions" import { BountiesSdkTypedApi, BountyWithoutDescription } from "./descriptors" import { findApprovingReferenda, @@ -15,16 +22,14 @@ export function createBountiesSdk(typedApi: BountiesSdkTypedApi): BountiesSdk { const enhanceBounty = ( bounty: BountyWithoutDescription, + description: string | null, id: number, ): Bounty => { const generic: GenericBounty = { ...bounty, type: bounty.status.type, id, - description: () => - typedApi.query.Bounties.BountyDescriptions.getValue(id).then((r) => - r ? r.asText() : null, - ), + description, } switch (generic.status.type) { @@ -126,6 +131,7 @@ export function createBountiesSdk(typedApi: BountiesSdkTypedApi): BountiesSdk { }, } } + throw new Error("Unreachable") } function watchBounties() { @@ -150,25 +156,51 @@ export function createBountiesSdk(typedApi: BountiesSdkTypedApi): BountiesSdk { (group$, id) => group$.pipe( takeWhile(({ value }) => Boolean(value), false), - map((v) => enhanceBounty(v.value!, id)), + map((bounty) => ({ + id, + bounty: bounty.value!, + })), ), ) + const descriptions$ = getBountyDescriptions$( + typedApi.query.Bounties.BountyDescriptions.getEntries, + typedApi.query.Bounties.BountyDescriptions.getValues, + bountyKeyChanges$, + ) const bountyIds$ = bountyKeyChanges$.pipe( toKeySet(), map((set) => [...set]), ) + const getEnhancedBountyById$ = (id: number) => + combineLatest([ + getBountyById$(id), + descriptions$.pipe( + map((r): string | null => r[id] ?? null), + distinctUntilChanged(), + ), + ]).pipe( + map(([{ id, bounty }, description]) => + enhanceBounty(bounty, description, id), + ), + ) + return { - bounties$: combineKeys(bountyIds$, getBountyById$), - getBountyById$, + bounties$: combineKeys(bountyIds$, getEnhancedBountyById$), + getBountyById$: getEnhancedBountyById$, bountyIds$, } } - function getBounty(id: number) { - return typedApi.query.Bounties.Bounties.getValue(id).then((bounty) => - bounty ? enhanceBounty(bounty, id) : null, + function getBounty(id: number, at?: string) { + return Promise.all([ + typedApi.query.Bounties.Bounties.getValue(id, { at }), + typedApi.query.Bounties.BountyDescriptions.getValue(id, { at }), + ]).then(([bounty, description]) => + bounty + ? enhanceBounty(bounty, description ? description.asText() : null, id) + : null, ) } @@ -187,20 +219,28 @@ export function createBountiesSdk(typedApi: BountiesSdkTypedApi): BountiesSdk { const id = proposedBountyEvt.index const at = txEvent.type === "finalized" ? undefined : txEvent.block.hash - const bounty = await typedApi.query.Bounties.Bounties.getValue(id, { at }) + const bounty = await getBounty(id, at) if (!bounty) return null - const enhanced = enhanceBounty(bounty, id) - return enhanced.type === "Proposed" ? enhanced : null + return bounty.type === "Proposed" ? bounty : null } function getBounties() { - return typedApi.query.Bounties.Bounties.getEntries().then((entries) => - entries + return Promise.all([ + typedApi.query.Bounties.Bounties.getEntries(), + typedApi.query.Bounties.BountyDescriptions.getEntries(), + ]).then(([entries, descriptions]) => { + const descriptionMap = Object.fromEntries( + descriptions.map(({ keyArgs, value }) => [keyArgs[0], value.asText()]), + ) + + return entries .map(({ keyArgs: [id], value }) => ({ bounty: value, id })) .sort((a, b) => a.id - b.id) - .map(({ bounty, id }) => enhanceBounty(bounty, id)), - ) + .map(({ bounty, id }) => + enhanceBounty(bounty, descriptionMap[id] ?? null, id), + ) + }) } return { diff --git a/packages/sdk-governance/src/bounties/bounty-descriptions.ts b/packages/sdk-governance/src/bounties/bounty-descriptions.ts new file mode 100644 index 0000000..f461f3b --- /dev/null +++ b/packages/sdk-governance/src/bounties/bounty-descriptions.ts @@ -0,0 +1,43 @@ +import { KeyChanges } from "@react-rxjs/utils" +import { Binary } from "polkadot-api" +import { merge, mergeMap, Observable, scan, skip, startWith } from "rxjs" + +export const getBountyDescriptions$ = ( + getEntries: () => Promise< + { + keyArgs: [Key: number] + value: Binary + }[] + >, + getValues: (keys: [number][]) => Promise<(Binary | undefined)[]>, + keyChanges$: Observable>, +) => + merge( + getEntries(), + keyChanges$.pipe( + skip(1), + mergeMap((changes) => { + if (changes.type === "remove") return [] + const keys = Array.from(changes.keys) + return getValues(keys.map((key) => [key])).then((result) => + result + .map((value, i) => ({ + keyArgs: [keys[i]] as [Key: number], + value: value!, + })) + .filter(({ value }) => value != null), + ) + }), + ), + ).pipe( + scan( + (acc, v) => ({ + ...acc, + ...Object.fromEntries( + v.map(({ keyArgs, value }) => [keyArgs[0], value.asText()]), + ), + }), + {} as Record, + ), + startWith({} as Record), + ) diff --git a/packages/sdk-governance/src/bounties/child-bounties-sdk.ts b/packages/sdk-governance/src/bounties/child-bounties-sdk.ts index 92fc3fb..964b445 100644 --- a/packages/sdk-governance/src/bounties/child-bounties-sdk.ts +++ b/packages/sdk-governance/src/bounties/child-bounties-sdk.ts @@ -1,5 +1,12 @@ import { combineKeys, partitionByKey, toKeySet } from "@react-rxjs/utils" -import { map, mergeMap, takeWhile } from "rxjs" +import { + combineLatest, + distinctUntilChanged, + map, + mergeMap, + takeWhile, +} from "rxjs" +import { getBountyDescriptions$ } from "./bounty-descriptions" import { ChildBountiesSdkTypedApi, ChildBountyWithoutDescription, @@ -15,16 +22,14 @@ export function createChildBountiesSdk( ): ChildBountiesSdk { const enhanceBounty = ( bounty: ChildBountyWithoutDescription, + description: string | null, id: number, ): ChildBounty => { const generic: GenericChildBounty = { ...bounty, type: bounty.status.type, id, - description: () => - typedApi.query.ChildBounties.ChildBountyDescriptions.getValue(id).then( - (r) => (r ? r.asText() : null), - ), + description, } const idObj = { @@ -98,6 +103,7 @@ export function createChildBountiesSdk( }, } } + throw new Error("Unreachable") } function watchChildBounties(parentId: number) { @@ -122,27 +128,52 @@ export function createChildBountiesSdk( (group$, id) => group$.pipe( takeWhile(({ value }) => Boolean(value), false), - map((v) => enhanceBounty(v.value!, id)), + map((bounty) => ({ + id, + bounty: bounty.value!, + })), ), ) + const descriptions$ = getBountyDescriptions$( + typedApi.query.ChildBounties.ChildBountyDescriptions.getEntries, + typedApi.query.ChildBounties.ChildBountyDescriptions.getValues, + bountyKeyChanges$, + ) const bountyIds$ = bountyKeyChanges$.pipe( toKeySet(), map((set) => [...set]), ) + const getEnhancedBountyById$ = (id: number) => + combineLatest([ + getBountyById$(id), + descriptions$.pipe( + map((r): string | null => r[id] ?? null), + distinctUntilChanged(), + ), + ]).pipe( + map(([{ id, bounty }, description]) => + enhanceBounty(bounty, description, id), + ), + ) + return { - bounties$: combineKeys(bountyIds$, getBountyById$), - getBountyById$, + bounties$: combineKeys(bountyIds$, getEnhancedBountyById$), + getBountyById$: getEnhancedBountyById$, bountyIds$, } } function getChildBounty(parentId: number, id: number) { - return typedApi.query.ChildBounties.ChildBounties.getValue( - parentId, - id, - ).then((bounty) => (bounty ? enhanceBounty(bounty, id) : null)) + return Promise.all([ + typedApi.query.ChildBounties.ChildBounties.getValue(parentId, id), + typedApi.query.ChildBounties.ChildBountyDescriptions.getValue(id).then( + (r) => (r ? r.asText() : null), + ), + ]).then(([bounty, description]) => + bounty ? enhanceBounty(bounty, description, id) : null, + ) } return { diff --git a/packages/sdk-governance/src/bounties/child-sdk-types.ts b/packages/sdk-governance/src/bounties/child-sdk-types.ts index 3824b16..398a989 100644 --- a/packages/sdk-governance/src/bounties/child-sdk-types.ts +++ b/packages/sdk-governance/src/bounties/child-sdk-types.ts @@ -1,5 +1,5 @@ import { SS58String, Transaction } from "polkadot-api" -import { GroupedObservable, Observable } from "rxjs" +import { Observable } from "rxjs" import { BountiesChildBountyStatus, ChildBountyWithoutDescription, @@ -9,7 +9,7 @@ import { MultiAddress } from "./descriptors" export interface GenericChildBounty extends ChildBountyWithoutDescription { type: BountiesChildBountyStatus["type"] id: number - description: () => Promise + description: string | null } interface ClosableBounty { @@ -62,7 +62,7 @@ export interface ChildBountiesSdk { watchChildBounties(parentId: number): { bounties$: Observable> bountyIds$: Observable - getBountyById$: (key: number) => GroupedObservable + getBountyById$: (key: number) => Observable } getChildBounty(parentId: number, id: number): Promise } diff --git a/packages/sdk-governance/src/bounties/sdk-types.ts b/packages/sdk-governance/src/bounties/sdk-types.ts index fe8fa0d..5993a77 100644 --- a/packages/sdk-governance/src/bounties/sdk-types.ts +++ b/packages/sdk-governance/src/bounties/sdk-types.ts @@ -1,5 +1,5 @@ import { SS58String, Transaction, TxEvent } from "polkadot-api" -import { GroupedObservable, Observable } from "rxjs" +import { Observable } from "rxjs" import { OngoingReferendum } from "../referenda/sdk-types" import { BountiesBountyStatus, @@ -10,7 +10,7 @@ import { export interface GenericBounty extends BountyWithoutDescription { type: BountiesBountyStatus["type"] id: number - description: () => Promise + description: string | null } interface ClosableBounty { @@ -97,7 +97,7 @@ export interface BountiesSdk { watchBounties(): { bounties$: Observable> bountyIds$: Observable - getBountyById$: (key: number) => GroupedObservable + getBountyById$: (key: number) => Observable } getBounty(id: number): Promise getBounties(): Promise diff --git a/packages/sdk-governance/tsconfig.json b/packages/sdk-governance/tsconfig.json index 01dfe9d..73f9f03 100644 --- a/packages/sdk-governance/tsconfig.json +++ b/packages/sdk-governance/tsconfig.json @@ -4,6 +4,7 @@ "compilerOptions": { "baseUrl": "src", "resolveJsonModule": true, + "skipLibCheck": true, "paths": { "@/*": ["*"] } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 981c1bc..2eb585b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,13 +22,13 @@ importers: version: 4.25.0 rollup-plugin-dts: specifier: ^6.1.1 - version: 6.1.1(rollup@4.25.0)(typescript@5.6.3) + version: 6.1.1(rollup@4.25.0)(typescript@5.7.3) rollup-plugin-esbuild: specifier: ^6.1.1 version: 6.1.1(esbuild@0.24.2)(rollup@4.25.0) typescript: - specifier: ^5.6.3 - version: 5.6.3 + specifier: ^5.7.3 + version: 5.7.3 vitest: specifier: ^2.1.4 version: 2.1.4 @@ -836,9 +836,9 @@ packages: ora: 8.1.1 read-pkg: 9.0.1 rxjs: 7.8.1 - tsc-prog: 2.3.0(typescript@5.7.2) - tsup: 8.3.5(typescript@5.7.2) - typescript: 5.7.2 + tsc-prog: 2.3.0(typescript@5.7.3) + tsup: 8.3.5(typescript@5.7.3) + typescript: 5.7.3 write-package: 7.1.0 transitivePeerDependencies: - '@microsoft/api-extractor' @@ -2430,7 +2430,7 @@ packages: onetime: 7.0.0 signal-exit: 4.1.0 - /rollup-plugin-dts@6.1.1(rollup@4.25.0)(typescript@5.6.3): + /rollup-plugin-dts@6.1.1(rollup@4.25.0)(typescript@5.7.3): resolution: {integrity: sha512-aSHRcJ6KG2IHIioYlvAOcEq6U99sVtqDDKVhnwt70rW6tsz3tv5OSjEiWcgzfsHdLyGXZ/3b/7b/+Za3Y6r1XA==} engines: {node: '>=16'} peerDependencies: @@ -2439,7 +2439,7 @@ packages: dependencies: magic-string: 0.30.12 rollup: 4.25.0 - typescript: 5.6.3 + typescript: 5.7.3 optionalDependencies: '@babel/code-frame': 7.26.2 dev: true @@ -2729,13 +2729,13 @@ packages: dependencies: typescript: 5.6.3 - /tsc-prog@2.3.0(typescript@5.7.2): + /tsc-prog@2.3.0(typescript@5.7.3): resolution: {integrity: sha512-ycET2d75EgcX7y8EmG4KiZkLAwUzbY4xRhA6NU0uVbHkY4ZjrAAuzTMxXI85kOwATqPnBI5C/7y7rlpY0xdqHA==} engines: {node: '>=12'} peerDependencies: typescript: '>=4' dependencies: - typescript: 5.7.2 + typescript: 5.7.3 dev: true /tslib@2.8.1: @@ -2783,7 +2783,7 @@ packages: - tsx - yaml - /tsup@8.3.5(typescript@5.7.2): + /tsup@8.3.5(typescript@5.7.3): resolution: {integrity: sha512-Tunf6r6m6tnZsG9GYWndg0z8dEV7fD733VBFzFJ5Vcm1FtlXB8xBD/rtrBi2a3YKEV7hHtxiZtW5EAVADoe1pA==} engines: {node: '>=18'} hasBin: true @@ -2818,7 +2818,7 @@ packages: tinyexec: 0.3.1 tinyglobby: 0.2.10 tree-kill: 1.2.2 - typescript: 5.7.2 + typescript: 5.7.3 transitivePeerDependencies: - jiti - supports-color @@ -2835,8 +2835,8 @@ packages: engines: {node: '>=14.17'} hasBin: true - /typescript@5.7.2: - resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} + /typescript@5.7.3: + resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==} engines: {node: '>=14.17'} hasBin: true dev: true From 44baff155dbffbb7bc105e52f5f76193cad6010d Mon Sep 17 00:00:00 2001 From: Victor Oliva Date: Thu, 9 Jan 2025 16:23:57 +0100 Subject: [PATCH 10/13] fix: descriptions not updating on reload --- .../src/bounties/bounty-descriptions.ts | 14 ++++++++++++-- .../src/bounties/child-descriptors.ts | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/sdk-governance/src/bounties/bounty-descriptions.ts b/packages/sdk-governance/src/bounties/bounty-descriptions.ts index f461f3b..97fbd6c 100644 --- a/packages/sdk-governance/src/bounties/bounty-descriptions.ts +++ b/packages/sdk-governance/src/bounties/bounty-descriptions.ts @@ -1,6 +1,15 @@ import { KeyChanges } from "@react-rxjs/utils" import { Binary } from "polkadot-api" -import { merge, mergeMap, Observable, scan, skip, startWith } from "rxjs" +import { + defer, + merge, + mergeMap, + Observable, + scan, + shareReplay, + skip, + startWith, +} from "rxjs" export const getBountyDescriptions$ = ( getEntries: () => Promise< @@ -13,7 +22,7 @@ export const getBountyDescriptions$ = ( keyChanges$: Observable>, ) => merge( - getEntries(), + defer(getEntries), keyChanges$.pipe( skip(1), mergeMap((changes) => { @@ -40,4 +49,5 @@ export const getBountyDescriptions$ = ( {} as Record, ), startWith({} as Record), + shareReplay({ bufferSize: 1, refCount: true }), ) diff --git a/packages/sdk-governance/src/bounties/child-descriptors.ts b/packages/sdk-governance/src/bounties/child-descriptors.ts index f14b1eb..ede6904 100644 --- a/packages/sdk-governance/src/bounties/child-descriptors.ts +++ b/packages/sdk-governance/src/bounties/child-descriptors.ts @@ -3,6 +3,7 @@ import { ApisTypedef, Binary, Enum, + FixedSizeArray, PalletsTypedef, SS58String, StorageDescriptor, @@ -50,7 +51,7 @@ type ChildBountiesSdkPallets = PalletsTypedef< * Child bounties that have been added. */ ChildBounties: StorageDescriptor< - [number, number], + FixedSizeArray<2, number>, ChildBountyWithoutDescription, true, never From a093af88f35773b759bf35850a6bb16eb1a9e1f0 Mon Sep 17 00:00:00 2001 From: Victor Oliva Date: Fri, 10 Jan 2025 10:48:01 +0100 Subject: [PATCH 11/13] standardize account input format --- packages/sdk-governance/src/bounties/bounties-sdk.ts | 5 ++++- packages/sdk-governance/src/bounties/child-bounties-sdk.ts | 5 ++++- packages/sdk-governance/src/bounties/child-sdk-types.ts | 3 +-- packages/sdk-governance/src/bounties/sdk-types.ts | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/sdk-governance/src/bounties/bounties-sdk.ts b/packages/sdk-governance/src/bounties/bounties-sdk.ts index 68e37bc..c297a9d 100644 --- a/packages/sdk-governance/src/bounties/bounties-sdk.ts +++ b/packages/sdk-governance/src/bounties/bounties-sdk.ts @@ -59,7 +59,10 @@ export function createBountiesSdk(typedApi: BountiesSdkTypedApi): BountiesSdk { proposeCurator(curator, fee) { return typedApi.tx.Bounties.propose_curator({ bounty_id: id, - curator, + curator: { + type: "Id", + value: curator, + }, fee, }) }, diff --git a/packages/sdk-governance/src/bounties/child-bounties-sdk.ts b/packages/sdk-governance/src/bounties/child-bounties-sdk.ts index 964b445..f0154d6 100644 --- a/packages/sdk-governance/src/bounties/child-bounties-sdk.ts +++ b/packages/sdk-governance/src/bounties/child-bounties-sdk.ts @@ -44,7 +44,10 @@ export function createChildBountiesSdk( proposeCurator(curator, fee) { return typedApi.tx.ChildBounties.propose_curator({ ...idObj, - curator, + curator: { + type: "Id", + value: curator, + }, fee, }) }, diff --git a/packages/sdk-governance/src/bounties/child-sdk-types.ts b/packages/sdk-governance/src/bounties/child-sdk-types.ts index 398a989..e9d3a6e 100644 --- a/packages/sdk-governance/src/bounties/child-sdk-types.ts +++ b/packages/sdk-governance/src/bounties/child-sdk-types.ts @@ -4,7 +4,6 @@ import { BountiesChildBountyStatus, ChildBountyWithoutDescription, } from "./child-descriptors" -import { MultiAddress } from "./descriptors" export interface GenericChildBounty extends ChildBountyWithoutDescription { type: BountiesChildBountyStatus["type"] @@ -18,7 +17,7 @@ interface ClosableBounty { export interface AddedChildBounty extends GenericChildBounty, ClosableBounty { type: "Added" proposeCurator( - curator: MultiAddress, + curator: SS58String, fee: bigint, ): Transaction } diff --git a/packages/sdk-governance/src/bounties/sdk-types.ts b/packages/sdk-governance/src/bounties/sdk-types.ts index 5993a77..eaa81c1 100644 --- a/packages/sdk-governance/src/bounties/sdk-types.ts +++ b/packages/sdk-governance/src/bounties/sdk-types.ts @@ -31,7 +31,7 @@ export interface ApprovedBounty extends GenericBounty { export interface FundedBounty extends GenericBounty, ClosableBounty { type: "Funded" proposeCurator( - curator: MultiAddress, + curator: SS58String, fee: bigint, ): Transaction filterProposingReferenda(referenda: OngoingReferendum[]): Promise< From 4964c3db6a31759319ee569a0ce0c952ee1afec9 Mon Sep 17 00:00:00 2001 From: Victor Oliva Date: Fri, 10 Jan 2025 16:03:09 +0100 Subject: [PATCH 12/13] feat(referenda-sdk): tally utilities --- .../src/referenda/descriptors.ts | 34 ++- .../src/referenda/referenda-sdk.ts | 66 ++++-- .../sdk-governance/src/referenda/sdk-types.ts | 29 ++- .../sdk-governance/src/referenda/track.ts | 208 ++++++++++++++++++ 4 files changed, 305 insertions(+), 32 deletions(-) create mode 100644 packages/sdk-governance/src/referenda/track.ts diff --git a/packages/sdk-governance/src/referenda/descriptors.ts b/packages/sdk-governance/src/referenda/descriptors.ts index d18412f..c7ec03e 100644 --- a/packages/sdk-governance/src/referenda/descriptors.ts +++ b/packages/sdk-governance/src/referenda/descriptors.ts @@ -115,6 +115,18 @@ export type ReferendaTypesCurve = Enum<{ } }> +export type ReferendaTrack = { + name: string + max_deciding: number + decision_deposit: bigint + prepare_period: number + decision_period: number + confirm_period: number + min_enactment_period: number + min_approval: ReferendaTypesCurve + min_support: ReferendaTypesCurve +} + type ReferendaSdkPallets = PalletsTypedef< { Preimage: { @@ -136,6 +148,9 @@ type ReferendaSdkPallets = PalletsTypedef< never > } + Balances: { + TotalIssuance: StorageDescriptor<[], bigint, false, never> + } }, { Referenda: { @@ -168,24 +183,7 @@ type ReferendaSdkPallets = PalletsTypedef< {}, { Referenda: { - Tracks: PlainDescriptor< - Array< - [ - number, - { - name: string - max_deciding: number - decision_deposit: bigint - prepare_period: number - decision_period: number - confirm_period: number - min_enactment_period: number - min_approval: ReferendaTypesCurve - min_support: ReferendaTypesCurve - }, - ] - > - > + Tracks: PlainDescriptor> } } > diff --git a/packages/sdk-governance/src/referenda/referenda-sdk.ts b/packages/sdk-governance/src/referenda/referenda-sdk.ts index 3311701..45e46e3 100644 --- a/packages/sdk-governance/src/referenda/referenda-sdk.ts +++ b/packages/sdk-governance/src/referenda/referenda-sdk.ts @@ -1,7 +1,6 @@ import { blake2b } from "@noble/hashes/blake2b" import { Binary, TxEvent } from "polkadot-api" import { getPreimageResolver } from "../preimages" -import { keyBy } from "../util/keyBy" import { originToTrack, polkadotSpenderOrigin } from "./chainConfig" import { PolkadotRuntimeOriginCaller, @@ -13,6 +12,7 @@ import { ReferendaSdk, ReferendaSdkConfig, } from "./sdk-types" +import { trackFetcher } from "./track" const MAX_INLINE_SIZE = 128 type RawOngoingReferendum = (ReferendumInfo & { type: "Ongoing" })["value"] @@ -28,6 +28,7 @@ export function createReferendaSdk( const resolvePreimage = getPreimageResolver( typedApi.query.Preimage.PreimageFor.getValues, ) + const getTrack = trackFetcher(typedApi) function enhanceOngoingReferendum( id: number, @@ -35,6 +36,35 @@ export function createReferendaSdk( ): OngoingReferendum { const resolveProposal = () => resolvePreimage(referendum.proposal) + async function getConfirmationStart() { + const totalVotes = referendum.tally.ayes + referendum.tally.nays + if (totalVotes == 0n || !referendum.deciding) { + return null + } + if (referendum.deciding.confirming) { + return referendum.deciding.confirming + } + + const approvals = Number(referendum.tally.ayes) / Number(totalVotes) + + const [track, totalIssuance] = await Promise.all([ + getTrack(referendum.track), + typedApi.query.Balances.TotalIssuance.getValue(), + ]) + if (!track) return null + const approvalBlock = Math.max(0, track.minApproval.getBlock(approvals)) + const supportBlock = Math.max( + 0, + track.minSupport.getBlock( + Number(referendum.tally.support) / Number(totalIssuance), + ), + ) + const block = Math.max(approvalBlock, supportBlock) + if (block === Number.POSITIVE_INFINITY) return null + + return referendum.deciding.since + block + } + return { ...referendum, id, @@ -67,6 +97,19 @@ export function createReferendaSdk( title: result.data.title, } }, + getConfirmationStart, + async getConfirmationEnd() { + if (!referendum.deciding) return null + + const track = await getTrack(referendum.track) + if (!track) return null + + const confirmationStart = + referendum.deciding.confirming ?? (await getConfirmationStart()) + if (!confirmationStart) return null + + return confirmationStart + track.confirm_period + }, } } @@ -100,18 +143,14 @@ export function createReferendaSdk( return { origin, - enactment: async () => { - const referendaTracks = await typedApi.constants.Referenda.Tracks() - const tracks = keyBy( - referendaTracks.map(([_, track]) => track), - (track) => track.name, - ) - const rootEnactment = tracks["root"].min_enactment_period - if (!spenderOriginType) return rootEnactment - - const track = originToTrack[spenderOriginType] ?? "" - return tracks[track]?.min_enactment_period ?? rootEnactment - }, + track: getTrack( + spenderOriginType ? originToTrack[spenderOriginType] : "root", + ).then((r) => { + if (!r) { + throw new Error(`Track ${spenderOriginType ?? "root"} not found`) + } + return r + }), } } @@ -179,6 +218,7 @@ export function createReferendaSdk( return { getOngoingReferenda, getSpenderTrack, + getTrack, createReferenda, createSpenderReferenda, getSubmittedReferendum, diff --git a/packages/sdk-governance/src/referenda/sdk-types.ts b/packages/sdk-governance/src/referenda/sdk-types.ts index d599cba..83ef9c1 100644 --- a/packages/sdk-governance/src/referenda/sdk-types.ts +++ b/packages/sdk-governance/src/referenda/sdk-types.ts @@ -3,6 +3,8 @@ import { Origin } from "./chainConfig" import { PolkadotRuntimeOriginCaller, PreimagesBounded, + ReferendaTrack as ReferendaTrackDescriptor, + ReferendaTypesCurve, ReferendumInfo, TraitsScheduleDispatchTime, } from "./descriptors" @@ -27,18 +29,43 @@ export type OngoingReferendum = Omit & { }> } getDetails: (apiKey: string) => Promise + getConfirmationStart: () => Promise + getConfirmationEnd: () => Promise } export interface ReferendaSdkConfig { spenderOrigin: (value: bigint) => Origin | null } +/** + * threshold are in percentage [0-1] + */ +export interface TrackFunctionDetails { + curve: ReferendaTypesCurve + getThreshold(block: number): number + getBlock(threshold: number): number + getData(step?: number): Array<{ + block: number + threshold: number + }> +} +export type ReferendaTrack = Omit< + ReferendaTrackDescriptor, + "min_approval" | "min_support" +> & { + minApproval: TrackFunctionDetails + minSupport: TrackFunctionDetails +} + export interface ReferendaSdk { getOngoingReferenda(): Promise getSpenderTrack(value: bigint): { origin: PolkadotRuntimeOriginCaller - enactment: () => Promise + track: Promise } + + getTrack(id: number | string): Promise + createReferenda( origin: PolkadotRuntimeOriginCaller, enactment: TraitsScheduleDispatchTime, diff --git a/packages/sdk-governance/src/referenda/track.ts b/packages/sdk-governance/src/referenda/track.ts new file mode 100644 index 0000000..4a3ac12 --- /dev/null +++ b/packages/sdk-governance/src/referenda/track.ts @@ -0,0 +1,208 @@ +import { keyBy } from "@/util/keyBy" +import { + ReferendaSdkTypedApi, + ReferendaTrack as ReferendaTrackDescriptor, + ReferendaTypesCurve, +} from "./descriptors" +import { ReferendaTrack, TrackFunctionDetails } from "./sdk-types" + +export function enhanceTrack(track: ReferendaTrackDescriptor): ReferendaTrack { + return { + ...track, + minApproval: curveToFunctionDetails( + track.decision_period, + track.min_approval, + ), + minSupport: curveToFunctionDetails( + track.decision_period, + track.min_support, + ), + } +} + +export function trackFetcher(typedApi: ReferendaSdkTypedApi) { + const referendaTracksPromise = typedApi.constants.Referenda.Tracks().then( + (tracks) => { + const byId = Object.fromEntries(tracks) + const byName = keyBy(Object.values(byId), (v) => v.name) + return { byId, byName } + }, + ) + return async (id: number | string) => { + const referendaTracks = await referendaTracksPromise + const track = + typeof id === "number" + ? referendaTracks.byId[id] + : referendaTracks.byName[id] + if (!track) return null + + return enhanceTrack(track) + } +} + +const BILLION = 1_000_000_000_000 +const blockToPerBill = (block: number, period: number) => + (block * BILLION) / period +const perBillToBlock = (perBillion: number, period: number) => + Math.ceil((perBillion * period) / BILLION) + +function curveToFunctionDetails( + period: number, + curve: ReferendaTypesCurve, +): TrackFunctionDetails { + const curveFn = + curve.type === "LinearDecreasing" + ? linearDecreasing(curve.value) + : curve.type === "SteppedDecreasing" + ? steppedDecreasing(curve.value) + : reciprocal(curve.value) + + return { + curve, + getThreshold(at) { + return curveFn.getValue(blockToPerBill(at, period)) / BILLION + }, + getBlock(pct) { + return perBillToBlock(curveFn.getTime(pct * BILLION), period) + }, + getData(step = 1) { + return curveFn + .getData(blockToPerBill(Math.max(step, 1), period)) + .map(({ time, value }) => ({ + block: perBillToBlock(time, period), + threshold: value / BILLION, + })) + }, + } +} + +function linearDecreasing({ + length, + floor, + ceil, +}: { + length: number + floor: number + ceil: number +}) { + // v(x) = ceil + (x * (floor - ceil)) / length + const getValue = (at: number) => + Math.max( + floor, + Math.min(ceil, Math.round(ceil + (at * (floor - ceil)) / length)), + ) + + const getTime = (value: number) => { + if (value > ceil) return Number.NEGATIVE_INFINITY + if (value < floor) return Number.POSITIVE_INFINITY + return ((value - ceil) * length) / (floor - ceil) + } + const getData = () => [ + { + time: 0, + value: ceil, + }, + { + time: length, + value: floor, + }, + ...(BILLION > length + ? [ + { + time: BILLION, + value: floor, + }, + ] + : []), + ] + return { getValue, getTime, getData } +} +function steppedDecreasing({ + begin, + end, + step, + period, +}: { + begin: number + end: number + step: number + period: number +}) { + const getValue = (at: number) => + Math.max(end, Math.min(begin, begin - (at % period) * step)) + const getTime = (value: number) => { + if (value > begin) return Number.NEGATIVE_INFINITY + if (value < end) return Number.POSITIVE_INFINITY + return Math.ceil((begin - value) / step) + } + const getData = () => { + const result: Array<{ + time: number + value: number + }> = [] + + for (let k = 0, value = begin; value > end; value -= step) { + result.push({ + time: k * period, + value, + }) + } + if ((begin - end) % step != 0) { + result.push({ + time: Math.ceil((begin - end) / step), + value: end, + }) + } + if (result.at(-1)?.time! < BILLION) { + result.push({ + time: BILLION, + value: end, + }) + } + + return result + } + return { getValue, getTime, getData } +} +function reciprocal({ + factor, + x_offset, + y_offset, +}: { + factor: bigint + x_offset: bigint + y_offset: bigint +}) { + // v(x) = factor/(x+x_offset)-y_offset + const getValue = (at: number) => + Number(factor / (BigInt(Math.round(at)) + x_offset) - y_offset) + const getTime = (value: number) => { + const bigValue = BigInt(Math.round(value)) + // Below horizontal asymptote => +Infinity + if (bigValue <= -y_offset) return Number.POSITIVE_INFINITY + // Above y-axis cut => -Infinity + if (x_offset != 0n && bigValue > factor / x_offset - y_offset) + return Number.NEGATIVE_INFINITY + + return Number(factor / (bigValue + y_offset) - x_offset) + } + const getData = (step: number) => { + const result: Array<{ + time: number + value: number + }> = [] + + for (let time = 0; time <= BILLION; time += step) { + result.push({ time, value: getValue(time) }) + } + if (result.at(-1)?.time! < BILLION) { + result.push({ + time: BILLION, + value: getValue(BILLION), + }) + } + + return result + } + return { getValue, getTime, getData } +} From d0994801bf055501aea0552bb9bb6dd5529059c1 Mon Sep 17 00:00:00 2001 From: Victor Oliva Date: Mon, 13 Jan 2025 10:39:00 +0100 Subject: [PATCH 13/13] chore(ci): Add ci for PRs and publish steps --- .github/workflows/ci.yml | 30 + .github/workflows/publish.yml | 72 ++ packages/common-utils/package.json | 4 +- .../src/referenda/chainConfig.ts | 40 +- .../src/referenda/descriptors.ts | 4 +- .../sdk-governance/src/referenda/sdk-types.ts | 4 +- .../sdk-governance/src/referenda/track.ts | 2 +- packages/sdk-ink/src/descriptor-types.ts | 3 +- pnpm-lock.yaml | 822 +----------------- 9 files changed, 168 insertions(+), 813 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..282e78b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: CI + +on: + pull_request: + merge_group: + workflow_dispatch: + +jobs: + build: + timeout-minutes: 10 + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20.x] + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v3 + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: pnpm + - name: Install deps + run: pnpm install + - name: Build + run: pnpm build + - name: Lint + run: pnpm lint + - name: Test + run: pnpm test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..eef6d0e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,72 @@ +name: Publish + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + timeout-minutes: 10 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v3 + - name: Setup Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: pnpm + registry-url: https://registry.npmjs.org + - name: Install deps + run: pnpm install + - name: Build + run: pnpm build + - name: Lint + run: pnpm lint + - name: Test + run: pnpm test + publish: + needs: [build] + runs-on: ubuntu-latest + strategy: + matrix: + value: [sdk-governance, sdk-ink] + steps: + - uses: actions/checkout@v4 + - name: Check if version has been updated + id: check + uses: EndBug/version-check@v2 + with: + diff-search: true + file-name: ./packages/${{ matrix.value }}/package.json + - uses: actions/cache@v3 + if: steps.check.outputs.changed == 'true' + with: + path: .turbo + key: ${{ runner.os }}-20.x-turbo-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-20.x-turbo- + - uses: pnpm/action-setup@v3 + if: steps.check.outputs.changed == 'true' + - name: Setup Node.js 20.x + if: steps.check.outputs.changed == 'true' + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: pnpm + registry-url: https://registry.npmjs.org + - name: Install deps + if: steps.check.outputs.changed == 'true' + run: pnpm install + - name: Build + if: steps.check.outputs.changed == 'true' + run: pnpm build + - name: Publish + if: steps.check.outputs.changed == 'true' + working-directory: packages/${{ matrix.value }} + run: | + pnpm publish --no-git-checks --access=public --tag latest + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_AUTOMATION_TOKEN }} diff --git a/packages/common-utils/package.json b/packages/common-utils/package.json index 06e2624..6e2e8cc 100644 --- a/packages/common-utils/package.json +++ b/packages/common-utils/package.json @@ -41,11 +41,11 @@ }, "license": "MIT", "peerDependencies": { - "polkadot-api": ">=1.7.4", + "polkadot-api": "^1.8.1", "rxjs": ">=7.8.1" }, "devDependencies": { - "polkadot-api": "^1.7.4", + "polkadot-api": "^1.8.1", "rxjs": "^7.8.1" } } diff --git a/packages/sdk-governance/src/referenda/chainConfig.ts b/packages/sdk-governance/src/referenda/chainConfig.ts index 742b6eb..a3a017e 100644 --- a/packages/sdk-governance/src/referenda/chainConfig.ts +++ b/packages/sdk-governance/src/referenda/chainConfig.ts @@ -5,8 +5,8 @@ const SpenderOrigin = { SmallSpender: "SmallSpender", MediumSpender: "MediumSpender", BigSpender: "BigSpender", -} as const; -export type Origin = (typeof SpenderOrigin)[keyof typeof SpenderOrigin]; +} as const +export type Origin = (typeof SpenderOrigin)[keyof typeof SpenderOrigin] export const originToTrack: Record = { Treasurer: "treasurer", @@ -15,25 +15,25 @@ export const originToTrack: Record = { SmallSpender: "small_spender", MediumSpender: "medium_spender", BigSpender: "big_spender", -}; +} -const DOT_UNIT = 10_000_000_000n; +const DOT_UNIT = 10_000_000_000n export const polkadotSpenderOrigin = (value: bigint): Origin | null => { - if (value <= 250n * DOT_UNIT) return SpenderOrigin.SmallTipper; - if (value <= 1_000n * DOT_UNIT) return SpenderOrigin.BigTipper; - if (value <= 10_000n * DOT_UNIT) return SpenderOrigin.SmallSpender; - if (value <= 100_000n * DOT_UNIT) return SpenderOrigin.MediumSpender; - if (value <= 1_000_000n * DOT_UNIT) return SpenderOrigin.BigSpender; - if (value <= 10_000_000n * DOT_UNIT) return SpenderOrigin.Treasurer; - return null; -}; + if (value <= 250n * DOT_UNIT) return SpenderOrigin.SmallTipper + if (value <= 1_000n * DOT_UNIT) return SpenderOrigin.BigTipper + if (value <= 10_000n * DOT_UNIT) return SpenderOrigin.SmallSpender + if (value <= 100_000n * DOT_UNIT) return SpenderOrigin.MediumSpender + if (value <= 1_000_000n * DOT_UNIT) return SpenderOrigin.BigSpender + if (value <= 10_000_000n * DOT_UNIT) return SpenderOrigin.Treasurer + return null +} -const KSM_UNIT = 1_000_000_000_000n; +const KSM_UNIT = 1_000_000_000_000n export const kusamaSpenderOrigin = (value: bigint): Origin | null => { - if (value <= 1n * KSM_UNIT) return SpenderOrigin.SmallTipper; - if (value <= 5n * KSM_UNIT) return SpenderOrigin.BigTipper; - if (value <= 333n * KSM_UNIT) return SpenderOrigin.SmallSpender; - if (value <= 3_333n * KSM_UNIT) return SpenderOrigin.MediumSpender; - if (value <= 33_333n * KSM_UNIT) return SpenderOrigin.BigSpender; - return SpenderOrigin.Treasurer; -}; + if (value <= 1n * KSM_UNIT) return SpenderOrigin.SmallTipper + if (value <= 5n * KSM_UNIT) return SpenderOrigin.BigTipper + if (value <= 333n * KSM_UNIT) return SpenderOrigin.SmallSpender + if (value <= 3_333n * KSM_UNIT) return SpenderOrigin.MediumSpender + if (value <= 33_333n * KSM_UNIT) return SpenderOrigin.BigSpender + return SpenderOrigin.Treasurer +} diff --git a/packages/sdk-governance/src/referenda/descriptors.ts b/packages/sdk-governance/src/referenda/descriptors.ts index c7ec03e..9ae0494 100644 --- a/packages/sdk-governance/src/referenda/descriptors.ts +++ b/packages/sdk-governance/src/referenda/descriptors.ts @@ -115,7 +115,7 @@ export type ReferendaTypesCurve = Enum<{ } }> -export type ReferendaTrack = { +export type ReferendaTrackData = { name: string max_deciding: number decision_deposit: bigint @@ -183,7 +183,7 @@ type ReferendaSdkPallets = PalletsTypedef< {}, { Referenda: { - Tracks: PlainDescriptor> + Tracks: PlainDescriptor> } } > diff --git a/packages/sdk-governance/src/referenda/sdk-types.ts b/packages/sdk-governance/src/referenda/sdk-types.ts index 83ef9c1..e98dbd7 100644 --- a/packages/sdk-governance/src/referenda/sdk-types.ts +++ b/packages/sdk-governance/src/referenda/sdk-types.ts @@ -3,7 +3,7 @@ import { Origin } from "./chainConfig" import { PolkadotRuntimeOriginCaller, PreimagesBounded, - ReferendaTrack as ReferendaTrackDescriptor, + ReferendaTrackData, ReferendaTypesCurve, ReferendumInfo, TraitsScheduleDispatchTime, @@ -50,7 +50,7 @@ export interface TrackFunctionDetails { }> } export type ReferendaTrack = Omit< - ReferendaTrackDescriptor, + ReferendaTrackData, "min_approval" | "min_support" > & { minApproval: TrackFunctionDetails diff --git a/packages/sdk-governance/src/referenda/track.ts b/packages/sdk-governance/src/referenda/track.ts index 4a3ac12..83eda2e 100644 --- a/packages/sdk-governance/src/referenda/track.ts +++ b/packages/sdk-governance/src/referenda/track.ts @@ -1,7 +1,7 @@ import { keyBy } from "@/util/keyBy" import { ReferendaSdkTypedApi, - ReferendaTrack as ReferendaTrackDescriptor, + ReferendaTrackData as ReferendaTrackDescriptor, ReferendaTypesCurve, } from "./descriptors" import { ReferendaTrack, TrackFunctionDetails } from "./sdk-types" diff --git a/packages/sdk-ink/src/descriptor-types.ts b/packages/sdk-ink/src/descriptor-types.ts index 79e6e83..af88bbd 100644 --- a/packages/sdk-ink/src/descriptor-types.ts +++ b/packages/sdk-ink/src/descriptor-types.ts @@ -114,7 +114,8 @@ export type InkSdkPallets = PalletsTypedef< { code_hash: FixedSizeBinary<32> }, - true + true, + never > } }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2eb585b..39de144 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,22 +10,22 @@ importers: devDependencies: '@rollup/plugin-alias': specifier: ^5.1.1 - version: 5.1.1(rollup@4.25.0) + version: 5.1.1(rollup@4.26.0) '@rollup/plugin-node-resolve': specifier: ^15.3.0 - version: 15.3.0(rollup@4.25.0) + version: 15.3.0(rollup@4.26.0) prettier: specifier: ^3.3.3 version: 3.3.3 rollup: specifier: ^4.25.0 - version: 4.25.0 + version: 4.26.0 rollup-plugin-dts: specifier: ^6.1.1 - version: 6.1.1(rollup@4.25.0)(typescript@5.7.3) + version: 6.1.1(rollup@4.26.0)(typescript@5.7.3) rollup-plugin-esbuild: specifier: ^6.1.1 - version: 6.1.1(esbuild@0.24.2)(rollup@4.25.0) + version: 6.1.1(esbuild@0.24.2)(rollup@4.26.0) typescript: specifier: ^5.7.3 version: 5.7.3 @@ -37,7 +37,7 @@ importers: dependencies: '@polkadot-api/descriptors': specifier: file:.papi/descriptors - version: file:examples/ink-playground/.papi/descriptors(polkadot-api@1.7.4) + version: file:examples/ink-playground/.papi/descriptors(polkadot-api@1.8.1) '@polkadot-api/sdk-ink': specifier: workspace:* version: link:../../packages/sdk-ink @@ -49,23 +49,23 @@ importers: version: 0.0.8 polkadot-api: specifier: ^1.7.4 - version: 1.7.4(rxjs@7.8.1) + version: 1.8.1(rxjs@7.8.1) rxjs: specifier: 7.8.1 version: 7.8.1 typescript: specifier: ^5.0.0 - version: 5.6.3 + version: 5.7.3 devDependencies: '@types/bun': specifier: latest - version: 1.1.13 + version: 1.1.16 packages/common-utils: devDependencies: polkadot-api: - specifier: ^1.7.4 - version: 1.7.4(rxjs@7.8.1) + specifier: ^1.8.1 + version: 1.8.1(rxjs@7.8.1) rxjs: specifier: ^7.8.1 version: 7.8.1 @@ -137,21 +137,12 @@ packages: dev: true optional: true - /@esbuild/aix-ppc64@0.24.0: - resolution: {integrity: sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw==} - engines: {node: '>=18'} - cpu: [ppc64] - os: [aix] - requiresBuild: true - optional: true - /@esbuild/aix-ppc64@0.24.2: resolution: {integrity: sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==} engines: {node: '>=18'} cpu: [ppc64] os: [aix] requiresBuild: true - dev: true optional: true /@esbuild/android-arm64@0.21.5: @@ -163,21 +154,12 @@ packages: dev: true optional: true - /@esbuild/android-arm64@0.24.0: - resolution: {integrity: sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w==} - engines: {node: '>=18'} - cpu: [arm64] - os: [android] - requiresBuild: true - optional: true - /@esbuild/android-arm64@0.24.2: resolution: {integrity: sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==} engines: {node: '>=18'} cpu: [arm64] os: [android] requiresBuild: true - dev: true optional: true /@esbuild/android-arm@0.21.5: @@ -189,21 +171,12 @@ packages: dev: true optional: true - /@esbuild/android-arm@0.24.0: - resolution: {integrity: sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew==} - engines: {node: '>=18'} - cpu: [arm] - os: [android] - requiresBuild: true - optional: true - /@esbuild/android-arm@0.24.2: resolution: {integrity: sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==} engines: {node: '>=18'} cpu: [arm] os: [android] requiresBuild: true - dev: true optional: true /@esbuild/android-x64@0.21.5: @@ -215,21 +188,12 @@ packages: dev: true optional: true - /@esbuild/android-x64@0.24.0: - resolution: {integrity: sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ==} - engines: {node: '>=18'} - cpu: [x64] - os: [android] - requiresBuild: true - optional: true - /@esbuild/android-x64@0.24.2: resolution: {integrity: sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==} engines: {node: '>=18'} cpu: [x64] os: [android] requiresBuild: true - dev: true optional: true /@esbuild/darwin-arm64@0.21.5: @@ -241,21 +205,12 @@ packages: dev: true optional: true - /@esbuild/darwin-arm64@0.24.0: - resolution: {integrity: sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw==} - engines: {node: '>=18'} - cpu: [arm64] - os: [darwin] - requiresBuild: true - optional: true - /@esbuild/darwin-arm64@0.24.2: resolution: {integrity: sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==} engines: {node: '>=18'} cpu: [arm64] os: [darwin] requiresBuild: true - dev: true optional: true /@esbuild/darwin-x64@0.21.5: @@ -267,21 +222,12 @@ packages: dev: true optional: true - /@esbuild/darwin-x64@0.24.0: - resolution: {integrity: sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA==} - engines: {node: '>=18'} - cpu: [x64] - os: [darwin] - requiresBuild: true - optional: true - /@esbuild/darwin-x64@0.24.2: resolution: {integrity: sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==} engines: {node: '>=18'} cpu: [x64] os: [darwin] requiresBuild: true - dev: true optional: true /@esbuild/freebsd-arm64@0.21.5: @@ -293,21 +239,12 @@ packages: dev: true optional: true - /@esbuild/freebsd-arm64@0.24.0: - resolution: {integrity: sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA==} - engines: {node: '>=18'} - cpu: [arm64] - os: [freebsd] - requiresBuild: true - optional: true - /@esbuild/freebsd-arm64@0.24.2: resolution: {integrity: sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==} engines: {node: '>=18'} cpu: [arm64] os: [freebsd] requiresBuild: true - dev: true optional: true /@esbuild/freebsd-x64@0.21.5: @@ -319,21 +256,12 @@ packages: dev: true optional: true - /@esbuild/freebsd-x64@0.24.0: - resolution: {integrity: sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ==} - engines: {node: '>=18'} - cpu: [x64] - os: [freebsd] - requiresBuild: true - optional: true - /@esbuild/freebsd-x64@0.24.2: resolution: {integrity: sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==} engines: {node: '>=18'} cpu: [x64] os: [freebsd] requiresBuild: true - dev: true optional: true /@esbuild/linux-arm64@0.21.5: @@ -345,21 +273,12 @@ packages: dev: true optional: true - /@esbuild/linux-arm64@0.24.0: - resolution: {integrity: sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g==} - engines: {node: '>=18'} - cpu: [arm64] - os: [linux] - requiresBuild: true - optional: true - /@esbuild/linux-arm64@0.24.2: resolution: {integrity: sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==} engines: {node: '>=18'} cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-arm@0.21.5: @@ -371,21 +290,12 @@ packages: dev: true optional: true - /@esbuild/linux-arm@0.24.0: - resolution: {integrity: sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw==} - engines: {node: '>=18'} - cpu: [arm] - os: [linux] - requiresBuild: true - optional: true - /@esbuild/linux-arm@0.24.2: resolution: {integrity: sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==} engines: {node: '>=18'} cpu: [arm] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-ia32@0.21.5: @@ -397,21 +307,12 @@ packages: dev: true optional: true - /@esbuild/linux-ia32@0.24.0: - resolution: {integrity: sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA==} - engines: {node: '>=18'} - cpu: [ia32] - os: [linux] - requiresBuild: true - optional: true - /@esbuild/linux-ia32@0.24.2: resolution: {integrity: sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==} engines: {node: '>=18'} cpu: [ia32] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-loong64@0.21.5: @@ -423,21 +324,12 @@ packages: dev: true optional: true - /@esbuild/linux-loong64@0.24.0: - resolution: {integrity: sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g==} - engines: {node: '>=18'} - cpu: [loong64] - os: [linux] - requiresBuild: true - optional: true - /@esbuild/linux-loong64@0.24.2: resolution: {integrity: sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==} engines: {node: '>=18'} cpu: [loong64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-mips64el@0.21.5: @@ -449,21 +341,12 @@ packages: dev: true optional: true - /@esbuild/linux-mips64el@0.24.0: - resolution: {integrity: sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA==} - engines: {node: '>=18'} - cpu: [mips64el] - os: [linux] - requiresBuild: true - optional: true - /@esbuild/linux-mips64el@0.24.2: resolution: {integrity: sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==} engines: {node: '>=18'} cpu: [mips64el] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-ppc64@0.21.5: @@ -475,21 +358,12 @@ packages: dev: true optional: true - /@esbuild/linux-ppc64@0.24.0: - resolution: {integrity: sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ==} - engines: {node: '>=18'} - cpu: [ppc64] - os: [linux] - requiresBuild: true - optional: true - /@esbuild/linux-ppc64@0.24.2: resolution: {integrity: sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==} engines: {node: '>=18'} cpu: [ppc64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-riscv64@0.21.5: @@ -501,21 +375,12 @@ packages: dev: true optional: true - /@esbuild/linux-riscv64@0.24.0: - resolution: {integrity: sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw==} - engines: {node: '>=18'} - cpu: [riscv64] - os: [linux] - requiresBuild: true - optional: true - /@esbuild/linux-riscv64@0.24.2: resolution: {integrity: sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==} engines: {node: '>=18'} cpu: [riscv64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-s390x@0.21.5: @@ -527,21 +392,12 @@ packages: dev: true optional: true - /@esbuild/linux-s390x@0.24.0: - resolution: {integrity: sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g==} - engines: {node: '>=18'} - cpu: [s390x] - os: [linux] - requiresBuild: true - optional: true - /@esbuild/linux-s390x@0.24.2: resolution: {integrity: sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==} engines: {node: '>=18'} cpu: [s390x] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-x64@0.21.5: @@ -553,21 +409,12 @@ packages: dev: true optional: true - /@esbuild/linux-x64@0.24.0: - resolution: {integrity: sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA==} - engines: {node: '>=18'} - cpu: [x64] - os: [linux] - requiresBuild: true - optional: true - /@esbuild/linux-x64@0.24.2: resolution: {integrity: sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==} engines: {node: '>=18'} cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/netbsd-arm64@0.24.2: @@ -576,7 +423,6 @@ packages: cpu: [arm64] os: [netbsd] requiresBuild: true - dev: true optional: true /@esbuild/netbsd-x64@0.21.5: @@ -588,29 +434,12 @@ packages: dev: true optional: true - /@esbuild/netbsd-x64@0.24.0: - resolution: {integrity: sha512-hjQ0R/ulkO8fCYFsG0FZoH+pWgTTDreqpqY7UnQntnaKv95uP5iW3+dChxnx7C3trQQU40S+OgWhUVwCjVFLvg==} - engines: {node: '>=18'} - cpu: [x64] - os: [netbsd] - requiresBuild: true - optional: true - /@esbuild/netbsd-x64@0.24.2: resolution: {integrity: sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==} engines: {node: '>=18'} cpu: [x64] os: [netbsd] requiresBuild: true - dev: true - optional: true - - /@esbuild/openbsd-arm64@0.24.0: - resolution: {integrity: sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [openbsd] - requiresBuild: true optional: true /@esbuild/openbsd-arm64@0.24.2: @@ -619,7 +448,6 @@ packages: cpu: [arm64] os: [openbsd] requiresBuild: true - dev: true optional: true /@esbuild/openbsd-x64@0.21.5: @@ -631,21 +459,12 @@ packages: dev: true optional: true - /@esbuild/openbsd-x64@0.24.0: - resolution: {integrity: sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q==} - engines: {node: '>=18'} - cpu: [x64] - os: [openbsd] - requiresBuild: true - optional: true - /@esbuild/openbsd-x64@0.24.2: resolution: {integrity: sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==} engines: {node: '>=18'} cpu: [x64] os: [openbsd] requiresBuild: true - dev: true optional: true /@esbuild/sunos-x64@0.21.5: @@ -657,21 +476,12 @@ packages: dev: true optional: true - /@esbuild/sunos-x64@0.24.0: - resolution: {integrity: sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA==} - engines: {node: '>=18'} - cpu: [x64] - os: [sunos] - requiresBuild: true - optional: true - /@esbuild/sunos-x64@0.24.2: resolution: {integrity: sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==} engines: {node: '>=18'} cpu: [x64] os: [sunos] requiresBuild: true - dev: true optional: true /@esbuild/win32-arm64@0.21.5: @@ -683,21 +493,12 @@ packages: dev: true optional: true - /@esbuild/win32-arm64@0.24.0: - resolution: {integrity: sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA==} - engines: {node: '>=18'} - cpu: [arm64] - os: [win32] - requiresBuild: true - optional: true - /@esbuild/win32-arm64@0.24.2: resolution: {integrity: sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==} engines: {node: '>=18'} cpu: [arm64] os: [win32] requiresBuild: true - dev: true optional: true /@esbuild/win32-ia32@0.21.5: @@ -709,21 +510,12 @@ packages: dev: true optional: true - /@esbuild/win32-ia32@0.24.0: - resolution: {integrity: sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw==} - engines: {node: '>=18'} - cpu: [ia32] - os: [win32] - requiresBuild: true - optional: true - /@esbuild/win32-ia32@0.24.2: resolution: {integrity: sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==} engines: {node: '>=18'} cpu: [ia32] os: [win32] requiresBuild: true - dev: true optional: true /@esbuild/win32-x64@0.21.5: @@ -735,21 +527,12 @@ packages: dev: true optional: true - /@esbuild/win32-x64@0.24.0: - resolution: {integrity: sha512-7IAFPrjSQIJrGsK6flwg7NFmwBoSTyF3rl7If0hNUFQU4ilTsEPL6GuMuU9BfIWVVGuRnuIidkSMC+c0Otu8IA==} - engines: {node: '>=18'} - cpu: [x64] - os: [win32] - requiresBuild: true - optional: true - /@esbuild/win32-x64@0.24.2: resolution: {integrity: sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==} engines: {node: '>=18'} cpu: [x64] os: [win32] requiresBuild: true - dev: true optional: true /@isaacs/cliui@8.0.2: @@ -850,48 +633,6 @@ packages: - tsx - utf-8-validate - yaml - dev: true - - /@polkadot-api/cli@0.9.18: - resolution: {integrity: sha512-biax8MLK8GO6/YTy0NfkCYB1HT5OEAeHr+9ITyv4klNvF/4uqj3gb0XODjCpFX0aCUp6q8aIFMDhUc7rN47AYg==} - hasBin: true - dependencies: - '@commander-js/extra-typings': 12.1.0(commander@12.1.0) - '@polkadot-api/codegen': 0.12.8 - '@polkadot-api/ink-contracts': 0.2.1 - '@polkadot-api/json-rpc-provider': 0.0.4 - '@polkadot-api/known-chains': 0.5.6 - '@polkadot-api/metadata-compatibility': 0.1.11 - '@polkadot-api/observable-client': 0.6.2(@polkadot-api/substrate-client@0.3.0)(rxjs@7.8.1) - '@polkadot-api/polkadot-sdk-compat': 2.3.1 - '@polkadot-api/sm-provider': 0.1.6(@polkadot-api/smoldot@0.3.5) - '@polkadot-api/smoldot': 0.3.5 - '@polkadot-api/substrate-bindings': 0.9.3 - '@polkadot-api/substrate-client': 0.3.0 - '@polkadot-api/utils': 0.1.2 - '@polkadot-api/wasm-executor': 0.1.2 - '@polkadot-api/ws-provider': 0.3.5 - '@types/node': 22.9.0 - commander: 12.1.0 - execa: 9.5.1 - fs.promises.exists: 1.1.4 - ora: 8.1.1 - read-pkg: 9.0.1 - rxjs: 7.8.1 - tsc-prog: 2.3.0(typescript@5.6.3) - tsup: 8.3.5(typescript@5.6.3) - typescript: 5.6.3 - write-package: 7.1.0 - transitivePeerDependencies: - - '@microsoft/api-extractor' - - '@swc/core' - - bufferutil - - jiti - - postcss - - supports-color - - tsx - - utf-8-validate - - yaml /@polkadot-api/codegen@0.12.12: resolution: {integrity: sha512-0jurC0ziMs0CEmHCZ8o2b4kE2pJz0rb/7LzeX/r0ngx60IJV14KSAFoAfipEMgmui3uTsP9goT/q4RmgnZ/2CQ==} @@ -901,24 +642,6 @@ packages: '@polkadot-api/metadata-compatibility': 0.1.14 '@polkadot-api/substrate-bindings': 0.11.0 '@polkadot-api/utils': 0.1.2 - dev: true - - /@polkadot-api/codegen@0.12.8: - resolution: {integrity: sha512-uFDi6EYUVyqccTbu8vUsLHMrMTSPh/0D5CwoHuz5rhNH559cdR1kBf/EInhI6AVlnzzUBMAatOc4y5c2bkR+QA==} - dependencies: - '@polkadot-api/ink-contracts': 0.2.1 - '@polkadot-api/metadata-builders': 0.9.1 - '@polkadot-api/metadata-compatibility': 0.1.11 - '@polkadot-api/substrate-bindings': 0.9.3 - '@polkadot-api/utils': 0.1.2 - - /@polkadot-api/ink-contracts@0.2.1: - resolution: {integrity: sha512-K7iJv6lE2Z3npXdk12CGHKfQZ0CGN90mXqTNZd3wDli5BX7hGTzBDdZ34hpe537G7rG88SBYeLz7JJ3n+16CDg==} - dependencies: - '@polkadot-api/metadata-builders': 0.9.1 - '@polkadot-api/substrate-bindings': 0.9.3 - '@polkadot-api/utils': 0.1.2 - scale-ts: 1.6.1 /@polkadot-api/ink-contracts@0.2.4: resolution: {integrity: sha512-peBYPJ0UNMpfTk6iNnDv9293miuOyc8L29UbdtcnEBUKgEnhX4U0ke4oFmbuknYMATHU9nyMY3ftXPcYDpTmwQ==} @@ -927,24 +650,15 @@ packages: '@polkadot-api/substrate-bindings': 0.11.0 '@polkadot-api/utils': 0.1.2 scale-ts: 1.6.1 - dev: true - - /@polkadot-api/json-rpc-provider-proxy@0.2.3: - resolution: {integrity: sha512-dukH94xmV2MUYNZZFhGhnaE1WIjVOPlNpcuzYQRdKYLj3zZJnkA6PHPNHiHd4N8XaCTjaDF3GcBTi6MZ0wtbhg==} /@polkadot-api/json-rpc-provider-proxy@0.2.4: resolution: {integrity: sha512-nuGoY9QpBAiRU7xmXN3nugFvPcnSu3IxTLm1OWcNTGlZ1LW5bvdQHz3JLk56+Jlyb3GJ971hqdg2DJsMXkKCOg==} - dev: true /@polkadot-api/json-rpc-provider@0.0.4: resolution: {integrity: sha512-9cDijLIxzHOBuq6yHqpqjJ9jBmXrctjc1OFqU+tQrS96adQze3mTIH6DTgfb/0LMrqxzxffz1HQGrIlEH00WrA==} - /@polkadot-api/known-chains@0.5.6: - resolution: {integrity: sha512-DYxpIfhIvWpjjZ3Y7X6Aomfs1/IbDyU+8R2ijDd6e4OBJzGrSjoU1wq4MZktbCivDXVCSF+NfIQpaHB8roBmOQ==} - /@polkadot-api/known-chains@0.6.0: resolution: {integrity: sha512-qVNJhqqtjPYgpyEb70KyZPIKunhgR4D3AcZwx5D7QCOumSigEi3vB95pfHHsqER+44jYrlFqzGWauaMMZqQl2Q==} - dev: true /@polkadot-api/logs-provider@0.0.6: resolution: {integrity: sha512-4WgHlvy+xee1ADaaVf6+MlK/+jGMtsMgAzvbQOJZnP4PfQuagoTqaeayk8HYKxXGphogLlPbD06tANxcb+nvAg==} @@ -956,38 +670,12 @@ packages: dependencies: '@polkadot-api/substrate-bindings': 0.11.0 '@polkadot-api/utils': 0.1.2 - dev: true - - /@polkadot-api/metadata-builders@0.9.1: - resolution: {integrity: sha512-yZPm9KKn7QydbjMQMzhKHekDuQSdSZXYdCyqGt74HSNz9DdJSdpFNwHv0p+vmp+9QDlVsKK7nbUTjYxLZT4vCA==} - dependencies: - '@polkadot-api/substrate-bindings': 0.9.3 - '@polkadot-api/utils': 0.1.2 - - /@polkadot-api/metadata-compatibility@0.1.11: - resolution: {integrity: sha512-XHl3McfuPSKDAIviGbiuK0epwzcspmvsWSoBywv0l6+adCPw1IpNKKkoj7Wwx4836duD/y/47hQEmkgIbtNQ3A==} - dependencies: - '@polkadot-api/metadata-builders': 0.9.1 - '@polkadot-api/substrate-bindings': 0.9.3 /@polkadot-api/metadata-compatibility@0.1.14: resolution: {integrity: sha512-O7b2+d1uMYFWpe6yW6kY84PGwzdEPBeLopAX9vJl3WTBavF4GYjztM/BD9GjnZ6n2ehmSRjowqZu7EVxYvQYvQ==} dependencies: '@polkadot-api/metadata-builders': 0.10.0 '@polkadot-api/substrate-bindings': 0.11.0 - dev: true - - /@polkadot-api/observable-client@0.6.2(@polkadot-api/substrate-client@0.3.0)(rxjs@7.8.1): - resolution: {integrity: sha512-0GsJDg95FA8idC+epQTrwkLmWdDl6JdSGuAVmy70TE1dVXC8l6lmVWpSX2ltF8ENqA7oXy7DlDEP7FrbvjvHfg==} - peerDependencies: - '@polkadot-api/substrate-client': 0.3.0 - rxjs: '>=7.8.0' - dependencies: - '@polkadot-api/metadata-builders': 0.9.1 - '@polkadot-api/substrate-bindings': 0.9.3 - '@polkadot-api/substrate-client': 0.3.0 - '@polkadot-api/utils': 0.1.2 - rxjs: 7.8.1 /@polkadot-api/observable-client@0.7.0(@polkadot-api/substrate-client@0.3.0)(rxjs@7.8.1): resolution: {integrity: sha512-ssDilIFNR+tEMbb9GE/fRXjhKvuFV32DANn5BuQWKOyDbE/d/G206SxLIgBPEQ4HbEzASxFSXJ5L1goDNkJdUA==} @@ -1000,16 +688,6 @@ packages: '@polkadot-api/substrate-client': 0.3.0 '@polkadot-api/utils': 0.1.2 rxjs: 7.8.1 - dev: true - - /@polkadot-api/pjs-signer@0.6.0: - resolution: {integrity: sha512-Dfji5Xbq820iKv5HTCWE1iDlXI/DtNYXTZOFLiL8banrSrcF5wvTq3QFknUv+q1TfwNYEZazT4eG3Dx/XAsosw==} - dependencies: - '@polkadot-api/metadata-builders': 0.9.1 - '@polkadot-api/polkadot-signer': 0.1.6 - '@polkadot-api/signers-common': 0.1.1 - '@polkadot-api/substrate-bindings': 0.9.3 - '@polkadot-api/utils': 0.1.2 /@polkadot-api/pjs-signer@0.6.3: resolution: {integrity: sha512-xXLwtDACcFRi5gyze1sfS/GBTjvs1E12R4zvB6TiIzUskFoc26+5xEqjpgo6VRnuIMVv5kWkCEQt+b5F7t76sw==} @@ -1019,7 +697,6 @@ packages: '@polkadot-api/signers-common': 0.1.4 '@polkadot-api/substrate-bindings': 0.11.0 '@polkadot-api/utils': 0.1.2 - dev: true /@polkadot-api/polkadot-sdk-compat@2.3.1: resolution: {integrity: sha512-rb8IWmPRhKWD9NG4zh2n4q0HlEAvq+Cv1CbD+8YxH0XAqIIiFA+ch5JeDCIxQYngkn/43B0Gs7Gtzh18yv2yoA==} @@ -1029,15 +706,6 @@ packages: /@polkadot-api/polkadot-signer@0.1.6: resolution: {integrity: sha512-X7ghAa4r7doETtjAPTb50IpfGtrBmy3BJM5WCfNKa1saK04VFY9w+vDn+hwEcM4p0PcDHt66Ts74hzvHq54d9A==} - /@polkadot-api/signer@0.1.10: - resolution: {integrity: sha512-SW4aqfM0hxsZqjX/pHdCZmVdS9bAXKwRSKzcb8vT9AA5YAq3si/Rue5eGGw8gRVcHOr5TdTicMjjaFDfebDyfQ==} - dependencies: - '@noble/hashes': 1.6.1 - '@polkadot-api/polkadot-signer': 0.1.6 - '@polkadot-api/signers-common': 0.1.1 - '@polkadot-api/substrate-bindings': 0.9.3 - '@polkadot-api/utils': 0.1.2 - /@polkadot-api/signer@0.1.13: resolution: {integrity: sha512-QFBeupXDoK/XVno9RdnUoh5HiPC8YC+HtbL0Jz61WrfnBRo77Trv5b0w7pUngpqjQzRY1w68TbETNTqRPtZOFA==} dependencies: @@ -1046,15 +714,6 @@ packages: '@polkadot-api/signers-common': 0.1.4 '@polkadot-api/substrate-bindings': 0.11.0 '@polkadot-api/utils': 0.1.2 - dev: true - - /@polkadot-api/signers-common@0.1.1: - resolution: {integrity: sha512-327dpMXr1lccrmG94MJqprkGGF5yZFYDBwl+YXl1ATeTDcaW1vzffCAPqx0vWytb2x3AWilJWyc3Q6xFUWzy4A==} - dependencies: - '@polkadot-api/metadata-builders': 0.9.1 - '@polkadot-api/polkadot-signer': 0.1.6 - '@polkadot-api/substrate-bindings': 0.9.3 - '@polkadot-api/utils': 0.1.2 /@polkadot-api/signers-common@0.1.4: resolution: {integrity: sha512-KMJuu6IMB0K17ppCZM6TSwshTQ8Zgx59+BPVouqnU8pxr+h7EqWf7wv72WyytEAbThWIqFr1VHIdaCj54eeVlg==} @@ -1063,16 +722,6 @@ packages: '@polkadot-api/polkadot-signer': 0.1.6 '@polkadot-api/substrate-bindings': 0.11.0 '@polkadot-api/utils': 0.1.2 - dev: true - - /@polkadot-api/sm-provider@0.1.6(@polkadot-api/smoldot@0.3.5): - resolution: {integrity: sha512-+1lRIH6srYFpeFCN35GtFiw+H4Cs+6NmoJMDRdv9EOYg7I2LKmt97N8JNQ/3UVmnH5Rud0U+iaqnat5cJsv1wg==} - peerDependencies: - '@polkadot-api/smoldot': '>=0.3' - dependencies: - '@polkadot-api/json-rpc-provider': 0.0.4 - '@polkadot-api/json-rpc-provider-proxy': 0.2.3 - '@polkadot-api/smoldot': 0.3.5 /@polkadot-api/sm-provider@0.1.7(@polkadot-api/smoldot@0.3.8): resolution: {integrity: sha512-BhNKVeIFZdawpPVadXszLl8IP4EDjcLHe/GchfRRFkvoNFuwS2nNv/npYIqCviXV+dd2R8VnEELxwScsf380Og==} @@ -1082,16 +731,6 @@ packages: '@polkadot-api/json-rpc-provider': 0.0.4 '@polkadot-api/json-rpc-provider-proxy': 0.2.4 '@polkadot-api/smoldot': 0.3.8 - dev: true - - /@polkadot-api/smoldot@0.3.5: - resolution: {integrity: sha512-QiCkI3Z2bSc8yMXChi6dsN7bGB5q8i/a/LGuNEDmMECoLdyEmz7pRBMmi4fnvfbthb+5/c5w5kl/7VOBEJ83tA==} - dependencies: - '@types/node': 22.9.0 - smoldot: 2.0.31 - transitivePeerDependencies: - - bufferutil - - utf-8-validate /@polkadot-api/smoldot@0.3.8: resolution: {integrity: sha512-dbJSMRFtELDW+rZIWRwKE/K8oy7+gYaGl+DvaOjARoBW2n80rJ7RAMOCCu+b5h2zgl3elftFBwMNAuAWgHT/Zg==} @@ -1101,7 +740,6 @@ packages: transitivePeerDependencies: - bufferutil - utf-8-validate - dev: true /@polkadot-api/substrate-bindings@0.11.0: resolution: {integrity: sha512-UGCa0xYtfcS/5LJAcro1vhIwxF31fsF5f42mzro9G85T854cbXPzqABDICYmJqdF72tBRMrnJlx6okGtLx9TKA==} @@ -1110,15 +748,6 @@ packages: '@polkadot-api/utils': 0.1.2 '@scure/base': 1.2.1 scale-ts: 1.6.1 - dev: true - - /@polkadot-api/substrate-bindings@0.9.3: - resolution: {integrity: sha512-ygaZo8+xssTdb6lj9mA8RTlanDfyd0iMex3aBFC1IzOSm08XUWdRpuSLRuerFCimLzKuz/oBOTKdqBFGb7ybUQ==} - dependencies: - '@noble/hashes': 1.6.1 - '@polkadot-api/utils': 0.1.2 - '@scure/base': 1.1.9 - scale-ts: 1.6.1 /@polkadot-api/substrate-client@0.3.0: resolution: {integrity: sha512-0hEvQLKH2zhaFzE8DPkWehvJilec8u2O2wbIEUStm0OJ8jIFtJ40MFjXQfB01dXBWUz1KaVBqS6xd3sZA90Dpw==} @@ -1129,19 +758,9 @@ packages: /@polkadot-api/utils@0.1.2: resolution: {integrity: sha512-yhs5k2a8N1SBJcz7EthZoazzLQUkZxbf+0271Xzu42C5AEM9K9uFLbsB+ojzHEM72O5X8lPtSwGKNmS7WQyDyg==} - /@polkadot-api/wasm-executor@0.1.2: - resolution: {integrity: sha512-a5wGenltB3EFPdf72u8ewi6HsUg2qubUAf3ekJprZf24lTK3+w8a/GUF/y6r08LJF35MALZ32SAtLqtVTIOGnQ==} - - /@polkadot-api/ws-provider@0.3.5: - resolution: {integrity: sha512-YZJpWhgCuBH9F5VMG85Em212iEHVz/SiyM0ruqxRvXl/L+LVeh0kJ3RHUHi4xgnb24OfBvfCUG4X2PtvfuCbwA==} - dependencies: - '@polkadot-api/json-rpc-provider': 0.0.4 - '@polkadot-api/json-rpc-provider-proxy': 0.2.3 - ws: 8.18.0 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - + /@polkadot-api/wasm-executor@0.1.2: + resolution: {integrity: sha512-a5wGenltB3EFPdf72u8ewi6HsUg2qubUAf3ekJprZf24lTK3+w8a/GUF/y6r08LJF35MALZ32SAtLqtVTIOGnQ==} + /@polkadot-api/ws-provider@0.3.6: resolution: {integrity: sha512-D2+rvcDc9smt24qUKqFoCuKKNhyBVDQEtnsqHiUN/Ym8UGP+Acegac3b9VOig70EpCcRBoYeXY2gEog2ybx1Kg==} dependencies: @@ -1151,7 +770,6 @@ packages: transitivePeerDependencies: - bufferutil - utf-8-validate - dev: true /@polkadot-labs/hdkd-helpers@0.0.8: resolution: {integrity: sha512-nTJOinTKuINHwKsUXR+Q1Hld0DU+EYVxcfQqiJz9PH8L+48K3gPfpAHDApIuOW6Uq6yVb5/pgcDPNCaJS5nYsg==} @@ -1159,7 +777,7 @@ packages: '@noble/curves': 1.6.0 '@noble/hashes': 1.6.1 '@polkadot-labs/schnorrkel-wasm': 0.0.5 - '@scure/base': 1.1.9 + '@scure/base': 1.2.1 scale-ts: 1.6.1 dev: false @@ -1198,7 +816,7 @@ packages: rxjs: 7.8.1 dev: false - /@rollup/plugin-alias@5.1.1(rollup@4.25.0): + /@rollup/plugin-alias@5.1.1(rollup@4.26.0): resolution: {integrity: sha512-PR9zDb+rOzkRb2VD+EuKB7UC41vU5DIwZ5qqCpk0KJudcWAyi8rvYOhS7+L5aZCspw1stTViLgN5v6FF1p5cgQ==} engines: {node: '>=14.0.0'} peerDependencies: @@ -1207,10 +825,10 @@ packages: rollup: optional: true dependencies: - rollup: 4.25.0 + rollup: 4.26.0 dev: true - /@rollup/plugin-node-resolve@15.3.0(rollup@4.25.0): + /@rollup/plugin-node-resolve@15.3.0(rollup@4.26.0): resolution: {integrity: sha512-9eO5McEICxMzJpDW9OnMYSv4Sta3hmt7VtBFz5zR9273suNOydOyq/FrGeGy+KsTRFm8w0SLVhzig2ILFT63Ag==} engines: {node: '>=14.0.0'} peerDependencies: @@ -1219,15 +837,15 @@ packages: rollup: optional: true dependencies: - '@rollup/pluginutils': 5.1.3(rollup@4.25.0) + '@rollup/pluginutils': 5.1.3(rollup@4.26.0) '@types/resolve': 1.20.2 deepmerge: 4.3.1 is-module: 1.0.0 resolve: 1.22.8 - rollup: 4.25.0 + rollup: 4.26.0 dev: true - /@rollup/pluginutils@5.1.3(rollup@4.25.0): + /@rollup/pluginutils@5.1.3(rollup@4.26.0): resolution: {integrity: sha512-Pnsb6f32CD2W3uCaLZIzDmeFyQ2b8UWMFI7xtwUezpcGBDVDW6y9XgAWIlARiGAo6eNF5FK5aQTr0LFyNyqq5A==} engines: {node: '>=14.0.0'} peerDependencies: @@ -1239,16 +857,8 @@ packages: '@types/estree': 1.0.6 estree-walker: 2.0.2 picomatch: 4.0.2 - rollup: 4.25.0 - dev: true - - /@rollup/rollup-android-arm-eabi@4.25.0: - resolution: {integrity: sha512-CC/ZqFZwlAIbU1wUPisHyV/XRc5RydFrNLtgl3dGYskdwPZdt4HERtKm50a/+DtTlKeCq9IXFEWR+P6blwjqBA==} - cpu: [arm] - os: [android] - requiresBuild: true + rollup: 4.26.0 dev: true - optional: true /@rollup/rollup-android-arm-eabi@4.26.0: resolution: {integrity: sha512-gJNwtPDGEaOEgejbaseY6xMFu+CPltsc8/T+diUTTbOQLqD+bnrJq9ulH6WD69TqwqWmrfRAtUv30cCFZlbGTQ==} @@ -1257,14 +867,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-android-arm64@4.25.0: - resolution: {integrity: sha512-/Y76tmLGUJqVBXXCfVS8Q8FJqYGhgH4wl4qTA24E9v/IJM0XvJCGQVSW1QZ4J+VURO9h8YCa28sTFacZXwK7Rg==} - cpu: [arm64] - os: [android] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-android-arm64@4.26.0: resolution: {integrity: sha512-YJa5Gy8mEZgz5JquFruhJODMq3lTHWLm1fOy+HIANquLzfIOzE9RA5ie3JjCdVb9r46qfAQY/l947V0zfGJ0OQ==} cpu: [arm64] @@ -1272,14 +874,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-darwin-arm64@4.25.0: - resolution: {integrity: sha512-YVT6L3UrKTlC0FpCZd0MGA7NVdp7YNaEqkENbWQ7AOVOqd/7VzyHpgIpc1mIaxRAo1ZsJRH45fq8j4N63I/vvg==} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-darwin-arm64@4.26.0: resolution: {integrity: sha512-ErTASs8YKbqTBoPLp/kA1B1Um5YSom8QAc4rKhg7b9tyyVqDBlQxy7Bf2wW7yIlPGPg2UODDQcbkTlruPzDosw==} cpu: [arm64] @@ -1287,14 +881,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-darwin-x64@4.25.0: - resolution: {integrity: sha512-ZRL+gexs3+ZmmWmGKEU43Bdn67kWnMeWXLFhcVv5Un8FQcx38yulHBA7XR2+KQdYIOtD0yZDWBCudmfj6lQJoA==} - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-darwin-x64@4.26.0: resolution: {integrity: sha512-wbgkYDHcdWW+NqP2mnf2NOuEbOLzDblalrOWcPyY6+BRbVhliavon15UploG7PpBRQ2bZJnbmh8o3yLoBvDIHA==} cpu: [x64] @@ -1302,14 +888,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-freebsd-arm64@4.25.0: - resolution: {integrity: sha512-xpEIXhiP27EAylEpreCozozsxWQ2TJbOLSivGfXhU4G1TBVEYtUPi2pOZBnvGXHyOdLAUUhPnJzH3ah5cqF01g==} - cpu: [arm64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-freebsd-arm64@4.26.0: resolution: {integrity: sha512-Y9vpjfp9CDkAG4q/uwuhZk96LP11fBz/bYdyg9oaHYhtGZp7NrbkQrj/66DYMMP2Yo/QPAsVHkV891KyO52fhg==} cpu: [arm64] @@ -1317,14 +895,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-freebsd-x64@4.25.0: - resolution: {integrity: sha512-sC5FsmZGlJv5dOcURrsnIK7ngc3Kirnx3as2XU9uER+zjfyqIjdcMVgzy4cOawhsssqzoAX19qmxgJ8a14Qrqw==} - cpu: [x64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-freebsd-x64@4.26.0: resolution: {integrity: sha512-A/jvfCZ55EYPsqeaAt/yDAG4q5tt1ZboWMHEvKAH9Zl92DWvMIbnZe/f/eOXze65aJaaKbL+YeM0Hz4kLQvdwg==} cpu: [x64] @@ -1332,14 +902,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-linux-arm-gnueabihf@4.25.0: - resolution: {integrity: sha512-uD/dbLSs1BEPzg564TpRAQ/YvTnCds2XxyOndAO8nJhaQcqQGFgv/DAVko/ZHap3boCvxnzYMa3mTkV/B/3SWA==} - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-arm-gnueabihf@4.26.0: resolution: {integrity: sha512-paHF1bMXKDuizaMODm2bBTjRiHxESWiIyIdMugKeLnjuS1TCS54MF5+Y5Dx8Ui/1RBPVRE09i5OUlaLnv8OGnA==} cpu: [arm] @@ -1347,14 +909,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-linux-arm-musleabihf@4.25.0: - resolution: {integrity: sha512-ZVt/XkrDlQWegDWrwyC3l0OfAF7yeJUF4fq5RMS07YM72BlSfn2fQQ6lPyBNjt+YbczMguPiJoCfaQC2dnflpQ==} - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-arm-musleabihf@4.26.0: resolution: {integrity: sha512-cwxiHZU1GAs+TMxvgPfUDtVZjdBdTsQwVnNlzRXC5QzIJ6nhfB4I1ahKoe9yPmoaA/Vhf7m9dB1chGPpDRdGXg==} cpu: [arm] @@ -1362,14 +916,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-linux-arm64-gnu@4.25.0: - resolution: {integrity: sha512-qboZ+T0gHAW2kkSDPHxu7quaFaaBlynODXpBVnPxUgvWYaE84xgCKAPEYE+fSMd3Zv5PyFZR+L0tCdYCMAtG0A==} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-arm64-gnu@4.26.0: resolution: {integrity: sha512-4daeEUQutGRCW/9zEo8JtdAgtJ1q2g5oHaoQaZbMSKaIWKDQwQ3Yx0/3jJNmpzrsScIPtx/V+1AfibLisb3AMQ==} cpu: [arm64] @@ -1377,14 +923,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-linux-arm64-musl@4.25.0: - resolution: {integrity: sha512-ndWTSEmAaKr88dBuogGH2NZaxe7u2rDoArsejNslugHZ+r44NfWiwjzizVS1nUOHo+n1Z6qV3X60rqE/HlISgw==} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-arm64-musl@4.26.0: resolution: {integrity: sha512-eGkX7zzkNxvvS05ROzJ/cO/AKqNvR/7t1jA3VZDi2vRniLKwAWxUr85fH3NsvtxU5vnUUKFHKh8flIBdlo2b3Q==} cpu: [arm64] @@ -1392,14 +930,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-linux-powerpc64le-gnu@4.25.0: - resolution: {integrity: sha512-BVSQvVa2v5hKwJSy6X7W1fjDex6yZnNKy3Kx1JGimccHft6HV0THTwNtC2zawtNXKUu+S5CjXslilYdKBAadzA==} - cpu: [ppc64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-powerpc64le-gnu@4.26.0: resolution: {integrity: sha512-Odp/lgHbW/mAqw/pU21goo5ruWsytP7/HCC/liOt0zcGG0llYWKrd10k9Fj0pdj3prQ63N5yQLCLiE7HTX+MYw==} cpu: [ppc64] @@ -1407,14 +937,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-linux-riscv64-gnu@4.25.0: - resolution: {integrity: sha512-G4hTREQrIdeV0PE2JruzI+vXdRnaK1pg64hemHq2v5fhv8C7WjVaeXc9P5i4Q5UC06d/L+zA0mszYIKl+wY8oA==} - cpu: [riscv64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-riscv64-gnu@4.26.0: resolution: {integrity: sha512-MBR2ZhCTzUgVD0OJdTzNeF4+zsVogIR1U/FsyuFerwcqjZGvg2nYe24SAHp8O5sN8ZkRVbHwlYeHqcSQ8tcYew==} cpu: [riscv64] @@ -1422,14 +944,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-linux-s390x-gnu@4.25.0: - resolution: {integrity: sha512-9T/w0kQ+upxdkFL9zPVB6zy9vWW1deA3g8IauJxojN4bnz5FwSsUAD034KpXIVX5j5p/rn6XqumBMxfRkcHapQ==} - cpu: [s390x] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-s390x-gnu@4.26.0: resolution: {integrity: sha512-YYcg8MkbN17fMbRMZuxwmxWqsmQufh3ZJFxFGoHjrE7bv0X+T6l3glcdzd7IKLiwhT+PZOJCblpnNlz1/C3kGQ==} cpu: [s390x] @@ -1437,14 +951,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-linux-x64-gnu@4.25.0: - resolution: {integrity: sha512-ThcnU0EcMDn+J4B9LD++OgBYxZusuA7iemIIiz5yzEcFg04VZFzdFjuwPdlURmYPZw+fgVrFzj4CA64jSTG4Ig==} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-x64-gnu@4.26.0: resolution: {integrity: sha512-ZuwpfjCwjPkAOxpjAEjabg6LRSfL7cAJb6gSQGZYjGhadlzKKywDkCUnJ+KEfrNY1jH5EEoSIKLCb572jSiglA==} cpu: [x64] @@ -1452,14 +958,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-linux-x64-musl@4.25.0: - resolution: {integrity: sha512-zx71aY2oQxGxAT1JShfhNG79PnjYhMC6voAjzpu/xmMjDnKNf6Nl/xv7YaB/9SIa9jDYf8RBPWEnjcdlhlv1rQ==} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-linux-x64-musl@4.26.0: resolution: {integrity: sha512-+HJD2lFS86qkeF8kNu0kALtifMpPCZU80HvwztIKnYwym3KnA1os6nsX4BGSTLtS2QVAGG1P3guRgsYyMA0Yhg==} cpu: [x64] @@ -1467,14 +965,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-win32-arm64-msvc@4.25.0: - resolution: {integrity: sha512-JT8tcjNocMs4CylWY/CxVLnv8e1lE7ff1fi6kbGocWwxDq9pj30IJ28Peb+Y8yiPNSF28oad42ApJB8oUkwGww==} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-win32-arm64-msvc@4.26.0: resolution: {integrity: sha512-WUQzVFWPSw2uJzX4j6YEbMAiLbs0BUysgysh8s817doAYhR5ybqTI1wtKARQKo6cGop3pHnrUJPFCsXdoFaimQ==} cpu: [arm64] @@ -1482,14 +972,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-win32-ia32-msvc@4.25.0: - resolution: {integrity: sha512-dRLjLsO3dNOfSN6tjyVlG+Msm4IiZnGkuZ7G5NmpzwF9oOc582FZG05+UdfTbz5Jd4buK/wMb6UeHFhG18+OEg==} - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-win32-ia32-msvc@4.26.0: resolution: {integrity: sha512-D4CxkazFKBfN1akAIY6ieyOqzoOoBV1OICxgUblWxff/pSjCA2khXlASUx7mK6W1oP4McqhgcCsu6QaLj3WMWg==} cpu: [ia32] @@ -1497,14 +979,6 @@ packages: requiresBuild: true optional: true - /@rollup/rollup-win32-x64-msvc@4.25.0: - resolution: {integrity: sha512-/RqrIFtLB926frMhZD0a5oDa4eFIbyNEwLLloMTEjmqfwZWXywwVVOVmwTsuyhC9HKkVEZcOOi+KV4U9wmOdlg==} - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true - optional: true - /@rollup/rollup-win32-x64-msvc@4.26.0: resolution: {integrity: sha512-2x8MO1rm4PGEP0xWbubJW5RtbNLk3puzAMaLQd3B3JHVw4KcHlmXcO+Wewx9zCoo7EUFiMlu/aZbCJ7VjMzAag==} cpu: [x64] @@ -1519,12 +993,8 @@ packages: dependencies: rxjs: 7.8.1 - /@scure/base@1.1.9: - resolution: {integrity: sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==} - /@scure/base@1.2.1: resolution: {integrity: sha512-DGmGtC8Tt63J5GfHgfl5CuAXh96VF/LD8K9Hr/Gv0J2lAoRGlPOMpqMpMbCTOoOJMZCk2Xt+DskdDyn6dEFdzQ==} - dev: true /@sec-ant/readable-stream@0.4.1: resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==} @@ -1533,10 +1003,10 @@ packages: resolution: {integrity: sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==} engines: {node: '>=18'} - /@types/bun@1.1.13: - resolution: {integrity: sha512-KmQxSBgVWCl6RSuerlLGZlIWfdxkKqat0nxN61+qu4y1KDn0Ll3j7v1Pl8GnaL3a/U6GGWVTJh75ap62kR1E8Q==} + /@types/bun@1.1.16: + resolution: {integrity: sha512-E+ue6NMcn4FXC5bDRE1W/BXUVs01h5Mt02qH8/8HGCox9akuh8KNOFdwvaQS9TDgT2RmUyJYFRRqA60WtTnm2g==} dependencies: - bun-types: 1.1.34 + bun-types: 1.1.43 dev: true /@types/estree@1.0.6: @@ -1552,12 +1022,6 @@ packages: resolution: {integrity: sha512-DifAyw4BkrufCILvD3ucnuN8eydUfc/C1GlyrnI+LK6543w5/L3VeVgf05o3B4fqSXP1dKYLOZsKfutpxPzZrw==} dependencies: undici-types: 6.20.0 - dev: true - - /@types/node@22.9.0: - resolution: {integrity: sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==} - dependencies: - undici-types: 6.19.8 /@types/normalize-package-data@2.4.4: resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} @@ -1569,7 +1033,7 @@ packages: /@types/ws@8.5.13: resolution: {integrity: sha512-osM/gWBTPKgHV8XkTunnegTRIsvF6owmf5w+JtAfOw472dptdm0dlGv4xCt6GwQRcC2XVOvvRE/0bAoQcL2QkA==} dependencies: - '@types/node': 22.9.0 + '@types/node': 22.10.3 dev: true /@vitest/expect@2.1.4: @@ -1667,22 +1131,13 @@ packages: dependencies: balanced-match: 1.0.2 - /bun-types@1.1.34: - resolution: {integrity: sha512-br5QygTEL/TwB4uQOb96Ky22j4Gq2WxWH/8Oqv20fk5HagwKXo/akB+LiYgSfzexCt6kkcUaVm+bKiPl71xPvw==} + /bun-types@1.1.43: + resolution: {integrity: sha512-W0wCtVH+bwFp7p3Zgs03CqxEDmXxEvmmUM/FBKgWIv9T8gyeotvIjIbHzuDScc2DphhRNtr7hJLCR5PspYL5qw==} dependencies: '@types/node': 20.12.14 '@types/ws': 8.5.13 dev: true - /bundle-require@5.0.0(esbuild@0.24.0): - resolution: {integrity: sha512-GuziW3fSSmopcx4KRymQEJVbZUfqlCqcq7dvs6TYwKRZiegK/2buMxQTPs6MGlNv50wms1699qYO54R8XfRX4w==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - peerDependencies: - esbuild: '>=0.18' - dependencies: - esbuild: 0.24.0 - load-tsconfig: 0.2.5 - /bundle-require@5.0.0(esbuild@0.24.2): resolution: {integrity: sha512-GuziW3fSSmopcx4KRymQEJVbZUfqlCqcq7dvs6TYwKRZiegK/2buMxQTPs6MGlNv50wms1699qYO54R8XfRX4w==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -1691,7 +1146,6 @@ packages: dependencies: esbuild: 0.24.2 load-tsconfig: 0.2.5 - dev: true /cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} @@ -1754,14 +1208,6 @@ packages: resolution: {integrity: sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==} engines: {node: ^14.18.0 || >=16.10.0} - /cross-spawn@7.0.5: - resolution: {integrity: sha512-ZVJrKKYunU38/76t0RMOulHOnUcbU9GbpWKAOZ0mhjr7CX6FVrH+4FrAapSOekrgFQ3f/8gwMEuIft0aKq6Hug==} - engines: {node: '>= 8'} - dependencies: - path-key: 3.1.1 - shebang-command: 2.0.0 - which: 2.0.2 - /cross-spawn@7.0.6: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} @@ -1769,7 +1215,6 @@ packages: path-key: 3.1.1 shebang-command: 2.0.0 which: 2.0.2 - dev: true /debug@4.3.7: resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==} @@ -1847,37 +1292,6 @@ packages: '@esbuild/win32-x64': 0.21.5 dev: true - /esbuild@0.24.0: - resolution: {integrity: sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ==} - engines: {node: '>=18'} - hasBin: true - requiresBuild: true - optionalDependencies: - '@esbuild/aix-ppc64': 0.24.0 - '@esbuild/android-arm': 0.24.0 - '@esbuild/android-arm64': 0.24.0 - '@esbuild/android-x64': 0.24.0 - '@esbuild/darwin-arm64': 0.24.0 - '@esbuild/darwin-x64': 0.24.0 - '@esbuild/freebsd-arm64': 0.24.0 - '@esbuild/freebsd-x64': 0.24.0 - '@esbuild/linux-arm': 0.24.0 - '@esbuild/linux-arm64': 0.24.0 - '@esbuild/linux-ia32': 0.24.0 - '@esbuild/linux-loong64': 0.24.0 - '@esbuild/linux-mips64el': 0.24.0 - '@esbuild/linux-ppc64': 0.24.0 - '@esbuild/linux-riscv64': 0.24.0 - '@esbuild/linux-s390x': 0.24.0 - '@esbuild/linux-x64': 0.24.0 - '@esbuild/netbsd-x64': 0.24.0 - '@esbuild/openbsd-arm64': 0.24.0 - '@esbuild/openbsd-x64': 0.24.0 - '@esbuild/sunos-x64': 0.24.0 - '@esbuild/win32-arm64': 0.24.0 - '@esbuild/win32-ia32': 0.24.0 - '@esbuild/win32-x64': 0.24.0 - /esbuild@0.24.2: resolution: {integrity: sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==} engines: {node: '>=18'} @@ -1909,7 +1323,6 @@ packages: '@esbuild/win32-arm64': 0.24.2 '@esbuild/win32-ia32': 0.24.2 '@esbuild/win32-x64': 0.24.2 - dev: true /estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} @@ -1921,23 +1334,6 @@ packages: '@types/estree': 1.0.6 dev: true - /execa@9.5.1: - resolution: {integrity: sha512-QY5PPtSonnGwhhHDNI7+3RvY285c7iuJFFB+lU+oEzMY/gEGJ808owqJsrr8Otd1E/x07po1LkUBmdAc5duPAg==} - engines: {node: ^18.19.0 || >=20.5.0} - dependencies: - '@sindresorhus/merge-streams': 4.0.0 - cross-spawn: 7.0.5 - figures: 6.1.0 - get-stream: 9.0.1 - human-signals: 8.0.0 - is-plain-obj: 4.1.0 - is-stream: 4.0.1 - npm-run-path: 6.0.0 - pretty-ms: 9.1.0 - signal-exit: 4.1.0 - strip-final-newline: 4.0.0 - yoctocolors: 2.1.1 - /execa@9.5.2: resolution: {integrity: sha512-EHlpxMCpHWSAh1dgS6bVeoLAXGnJNdR93aabr4QCGbzOM73o5XmRfM/e5FUqsw3aagP8S8XEWUWFAxnRBnAF0Q==} engines: {node: ^18.19.0 || >=20.5.0} @@ -1954,7 +1350,6 @@ packages: signal-exit: 4.1.0 strip-final-newline: 4.0.0 yoctocolors: 2.1.1 - dev: true /expect-type@1.1.0: resolution: {integrity: sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==} @@ -1981,7 +1376,7 @@ packages: resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} engines: {node: '>=14'} dependencies: - cross-spawn: 7.0.5 + cross-spawn: 7.0.6 signal-exit: 4.1.0 /fs.promises.exists@1.1.4: @@ -2261,42 +1656,6 @@ packages: resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==} engines: {node: '>= 6'} - /polkadot-api@1.7.4(rxjs@7.8.1): - resolution: {integrity: sha512-4O9ThkdrW0HGTSfhSyj8HXyC70OKZ6rgfLFkpS9hqV8PfzUShnYy2GqU7YJJ14MGqRTAF6EdKftKzV2g+j09Ow==} - hasBin: true - peerDependencies: - rxjs: '>=7.8.0' - dependencies: - '@polkadot-api/cli': 0.9.18 - '@polkadot-api/ink-contracts': 0.2.1 - '@polkadot-api/json-rpc-provider': 0.0.4 - '@polkadot-api/known-chains': 0.5.6 - '@polkadot-api/logs-provider': 0.0.6 - '@polkadot-api/metadata-builders': 0.9.1 - '@polkadot-api/metadata-compatibility': 0.1.11 - '@polkadot-api/observable-client': 0.6.2(@polkadot-api/substrate-client@0.3.0)(rxjs@7.8.1) - '@polkadot-api/pjs-signer': 0.6.0 - '@polkadot-api/polkadot-sdk-compat': 2.3.1 - '@polkadot-api/polkadot-signer': 0.1.6 - '@polkadot-api/signer': 0.1.10 - '@polkadot-api/sm-provider': 0.1.6(@polkadot-api/smoldot@0.3.5) - '@polkadot-api/smoldot': 0.3.5 - '@polkadot-api/substrate-bindings': 0.9.3 - '@polkadot-api/substrate-client': 0.3.0 - '@polkadot-api/utils': 0.1.2 - '@polkadot-api/ws-provider': 0.3.5 - rxjs: 7.8.1 - transitivePeerDependencies: - - '@microsoft/api-extractor' - - '@swc/core' - - bufferutil - - jiti - - postcss - - supports-color - - tsx - - utf-8-validate - - yaml - /polkadot-api@1.8.1(rxjs@7.8.1): resolution: {integrity: sha512-E2Jh9tiO6eB/fjnwr68mnZAZ/UuoZPBZQKjplHSMjVgNNQEkNZSqDcFvH18Rag5x4z7oJzuEk9+Hj62u/+D1PQ==} hasBin: true @@ -2333,7 +1692,6 @@ packages: - tsx - utf-8-validate - yaml - dev: true /postcss-load-config@6.0.1: resolution: {integrity: sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==} @@ -2370,18 +1728,11 @@ packages: hasBin: true dev: true - /pretty-ms@9.1.0: - resolution: {integrity: sha512-o1piW0n3tgKIKCwk2vpM/vOV13zjJzvP37Ioze54YlTHE06m4tjEbzg9WsKkvTuyYln2DHjo5pY4qrZGI0otpw==} - engines: {node: '>=18'} - dependencies: - parse-ms: 4.0.0 - /pretty-ms@9.2.0: resolution: {integrity: sha512-4yf0QO/sllf/1zbZWYnvWw3NxCQwLXKzIj0G849LSufP15BXKM0rbD2Z3wVnkMfjdn/CB0Dpp444gYAACdsplg==} engines: {node: '>=18'} dependencies: parse-ms: 4.0.0 - dev: true /punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} @@ -2430,7 +1781,7 @@ packages: onetime: 7.0.0 signal-exit: 4.1.0 - /rollup-plugin-dts@6.1.1(rollup@4.25.0)(typescript@5.7.3): + /rollup-plugin-dts@6.1.1(rollup@4.26.0)(typescript@5.7.3): resolution: {integrity: sha512-aSHRcJ6KG2IHIioYlvAOcEq6U99sVtqDDKVhnwt70rW6tsz3tv5OSjEiWcgzfsHdLyGXZ/3b/7b/+Za3Y6r1XA==} engines: {node: '>=16'} peerDependencies: @@ -2438,57 +1789,29 @@ packages: typescript: ^4.5 || ^5.0 dependencies: magic-string: 0.30.12 - rollup: 4.25.0 + rollup: 4.26.0 typescript: 5.7.3 optionalDependencies: '@babel/code-frame': 7.26.2 dev: true - /rollup-plugin-esbuild@6.1.1(esbuild@0.24.2)(rollup@4.25.0): + /rollup-plugin-esbuild@6.1.1(esbuild@0.24.2)(rollup@4.26.0): resolution: {integrity: sha512-CehMY9FAqJD5OUaE/Mi1r5z0kNeYxItmRO2zG4Qnv2qWKF09J2lTy5GUzjJR354ZPrLkCj4fiBN41lo8PzBUhw==} engines: {node: '>=14.18.0'} peerDependencies: esbuild: '>=0.18.0' rollup: ^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 dependencies: - '@rollup/pluginutils': 5.1.3(rollup@4.25.0) + '@rollup/pluginutils': 5.1.3(rollup@4.26.0) debug: 4.3.7 es-module-lexer: 1.5.4 esbuild: 0.24.2 get-tsconfig: 4.8.1 - rollup: 4.25.0 + rollup: 4.26.0 transitivePeerDependencies: - supports-color dev: true - /rollup@4.25.0: - resolution: {integrity: sha512-uVbClXmR6wvx5R1M3Od4utyLUxrmOcEm3pAtMphn73Apq19PDtHpgZoEvqH2YnnaNUuvKmg2DgRd2Sqv+odyqg==} - engines: {node: '>=18.0.0', npm: '>=8.0.0'} - hasBin: true - dependencies: - '@types/estree': 1.0.6 - optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.25.0 - '@rollup/rollup-android-arm64': 4.25.0 - '@rollup/rollup-darwin-arm64': 4.25.0 - '@rollup/rollup-darwin-x64': 4.25.0 - '@rollup/rollup-freebsd-arm64': 4.25.0 - '@rollup/rollup-freebsd-x64': 4.25.0 - '@rollup/rollup-linux-arm-gnueabihf': 4.25.0 - '@rollup/rollup-linux-arm-musleabihf': 4.25.0 - '@rollup/rollup-linux-arm64-gnu': 4.25.0 - '@rollup/rollup-linux-arm64-musl': 4.25.0 - '@rollup/rollup-linux-powerpc64le-gnu': 4.25.0 - '@rollup/rollup-linux-riscv64-gnu': 4.25.0 - '@rollup/rollup-linux-s390x-gnu': 4.25.0 - '@rollup/rollup-linux-x64-gnu': 4.25.0 - '@rollup/rollup-linux-x64-musl': 4.25.0 - '@rollup/rollup-win32-arm64-msvc': 4.25.0 - '@rollup/rollup-win32-ia32-msvc': 4.25.0 - '@rollup/rollup-win32-x64-msvc': 4.25.0 - fsevents: 2.3.3 - dev: true - /rollup@4.26.0: resolution: {integrity: sha512-ilcl12hnWonG8f+NxU6BlgysVA0gvY2l8N0R84S1HcINbW20bvwuCngJkkInV6LXhwRpucsW5k1ovDwEdBVrNg==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} @@ -2547,14 +1870,6 @@ packages: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} - /smoldot@2.0.31: - resolution: {integrity: sha512-nkPbjTb1G0hGji0/GwJELIehkXGIDh/X8PK/p3RjnklvUj4NrbdNuKx3K+PFATgbL7dfhSSYoFFdJ7Ql0T7zWQ==} - dependencies: - ws: 8.18.0 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - /smoldot@2.0.34: resolution: {integrity: sha512-mw9tCbGEhEp0koMqLL0jBEixVY1MIN/xI3pE6ZY1TuOPU+LnYy8FloODVyzkvzQPaBYrETXJdRlmA/+k6g3gow==} dependencies: @@ -2562,7 +1877,6 @@ packages: transitivePeerDependencies: - bufferutil - utf-8-validate - dev: true /sort-keys@5.1.0: resolution: {integrity: sha512-aSbHV0DaBcr7u0PVHXzM6NbZNAtrr9sF6+Qfs9UUVG7Ll3jQ6hHi8F/xqIIcn2rvIVbr0v/2zyjSdwSV47AgLQ==} @@ -2721,14 +2035,6 @@ packages: /ts-interface-checker@0.1.13: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} - /tsc-prog@2.3.0(typescript@5.6.3): - resolution: {integrity: sha512-ycET2d75EgcX7y8EmG4KiZkLAwUzbY4xRhA6NU0uVbHkY4ZjrAAuzTMxXI85kOwATqPnBI5C/7y7rlpY0xdqHA==} - engines: {node: '>=12'} - peerDependencies: - typescript: '>=4' - dependencies: - typescript: 5.6.3 - /tsc-prog@2.3.0(typescript@5.7.3): resolution: {integrity: sha512-ycET2d75EgcX7y8EmG4KiZkLAwUzbY4xRhA6NU0uVbHkY4ZjrAAuzTMxXI85kOwATqPnBI5C/7y7rlpY0xdqHA==} engines: {node: '>=12'} @@ -2736,53 +2042,10 @@ packages: typescript: '>=4' dependencies: typescript: 5.7.3 - dev: true /tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} - /tsup@8.3.5(typescript@5.6.3): - resolution: {integrity: sha512-Tunf6r6m6tnZsG9GYWndg0z8dEV7fD733VBFzFJ5Vcm1FtlXB8xBD/rtrBi2a3YKEV7hHtxiZtW5EAVADoe1pA==} - engines: {node: '>=18'} - hasBin: true - peerDependencies: - '@microsoft/api-extractor': ^7.36.0 - '@swc/core': ^1 - postcss: ^8.4.12 - typescript: '>=4.5.0' - peerDependenciesMeta: - '@microsoft/api-extractor': - optional: true - '@swc/core': - optional: true - postcss: - optional: true - typescript: - optional: true - dependencies: - bundle-require: 5.0.0(esbuild@0.24.0) - cac: 6.7.14 - chokidar: 4.0.1 - consola: 3.2.3 - debug: 4.3.7 - esbuild: 0.24.0 - joycon: 3.1.1 - picocolors: 1.1.1 - postcss-load-config: 6.0.1 - resolve-from: 5.0.0 - rollup: 4.26.0 - source-map: 0.8.0-beta.0 - sucrase: 3.35.0 - tinyexec: 0.3.1 - tinyglobby: 0.2.10 - tree-kill: 1.2.2 - typescript: 5.6.3 - transitivePeerDependencies: - - jiti - - supports-color - - tsx - - yaml - /tsup@8.3.5(typescript@5.7.3): resolution: {integrity: sha512-Tunf6r6m6tnZsG9GYWndg0z8dEV7fD733VBFzFJ5Vcm1FtlXB8xBD/rtrBi2a3YKEV7hHtxiZtW5EAVADoe1pA==} engines: {node: '>=18'} @@ -2824,33 +2087,22 @@ packages: - supports-color - tsx - yaml - dev: true /type-fest@4.26.1: resolution: {integrity: sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg==} engines: {node: '>=16'} - /typescript@5.6.3: - resolution: {integrity: sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==} - engines: {node: '>=14.17'} - hasBin: true - /typescript@5.7.3: resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==} engines: {node: '>=14.17'} hasBin: true - dev: true /undici-types@5.26.5: resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} dev: true - /undici-types@6.19.8: - resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} - /undici-types@6.20.0: resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} - dev: true /unicorn-magic@0.1.0: resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==} @@ -2928,7 +2180,7 @@ packages: dependencies: esbuild: 0.21.5 postcss: 8.4.48 - rollup: 4.25.0 + rollup: 4.26.0 optionalDependencies: fsevents: 2.3.3 dev: true @@ -3074,12 +2326,12 @@ packages: resolution: {integrity: sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==} engines: {node: '>=18'} - file:examples/ink-playground/.papi/descriptors(polkadot-api@1.7.4): + file:examples/ink-playground/.papi/descriptors(polkadot-api@1.8.1): resolution: {directory: examples/ink-playground/.papi/descriptors, type: directory} id: file:examples/ink-playground/.papi/descriptors name: '@polkadot-api/descriptors' peerDependencies: polkadot-api: '*' dependencies: - polkadot-api: 1.7.4(rxjs@7.8.1) + polkadot-api: 1.8.1(rxjs@7.8.1) dev: false