Skip to content

Polkadot api v2 migration #311

Open
Divljo31 wants to merge 10 commits intomasterfrom
feat/papi-v2
Open

Polkadot api v2 migration #311
Divljo31 wants to merge 10 commits intomasterfrom
feat/papi-v2

Conversation

@Divljo31
Copy link
Copy Markdown
Member

@Divljo31 Divljo31 commented Apr 17, 2026

  • descriptors bumped to 2.0.0, ESM-only, whitelist moved to .papi/whitelist.ts; metadata refreshed via papi update.
  • Binary class → utility namespace (Binary.toHex / toText); FixedSizeBinary → type-only SizedHex.
  • Transaction generic collapsed 4→2 params; UnsafeTransaction and SafeTx/UnsafeTx unions removed.
  • compatibilityToken → await api.getStaticApis() + compat.query.*.isCompatible(level) in all pool clients.
  • watchValue(..., 'best') → watchValue(..., { at: 'best' }) with new { value, block } emission — all 8 subscribers migrated (incl. a runtime-crash fix in SubstratePlatform).
  • Events watch() now per-block → mergeMap(({ events }) => events) where needed.
  • polkadot-api/ws-provider → polkadot-api/ws; getSmProvider(chain) → getSmProvider(() => chain); WsEvent.type numeric→string case fix in sdk-next-esm example.
  • Dropped @polkadot-api/legacy-provider + usesLegacyEnhancer flag (Parachain, crust/energywebx/interlay/pendulum cfgs) — now relies on v2 getWsProvider's built-in SDK compat.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 17, 2026

🦋 Changeset detected

Latest commit: 9abf016

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@galacticcouncil/descriptors Minor
@galacticcouncil/sdk-next Minor
@galacticcouncil/xc-core Minor
@galacticcouncil/common Minor
@galacticcouncil/xc-cfg Minor
@galacticcouncil/xc-sdk Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Divljo31 Divljo31 temporarily deployed to upgrade-ui-master April 17, 2026 11:07 — with GitHub Actions Inactive
@github-actions
Copy link
Copy Markdown

🧚 Live preview: galacticcouncil/hydration-ui#3751

@Divljo31 Divljo31 temporarily deployed to upgrade-ui-next April 20, 2026 09:39 — with GitHub Actions Inactive
@Divljo31 Divljo31 temporarily deployed to upgrade-ui-master April 20, 2026 09:39 — with GitHub Actions Inactive
@github-actions
Copy link
Copy Markdown

🧚 Live preview: galacticcouncil/hydration-ui#3755

const result = await this.api().apis.XcmPaymentApi.query_delivery_fees(
destination,
{ type: 'V5', value: xcm },
XcmVersionedXcm.V4(xcm),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why removing newer V5 in favor of v4 ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are sending a v4 instructions so we can be generic, and the new papi is throwing error on that because it won't allow wrapping v5 with v4 instructions type

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see roger ;)

@@ -1,5 +1,5 @@
import { createClient, PolkadotClient } from 'polkadot-api';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as provider api is now exposed via client we don't have to cache client/provider pair .. Don't see new impl here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed this, will update

Comment thread packages/sdk-next/src/tx/utils.ts Outdated
@@ -1,12 +1,18 @@
type NestedEnum = { type: string; value?: NestedEnum } | undefined;
type NestedEnum = { type: string; value?: unknown };
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why unknown ? NestedEnum can have only NestedEnums as childs no ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure so i widened it a bit. I'll check more and return it if i don't find any example that fails

Copy link
Copy Markdown
Member

@nohaapav nohaapav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@Divljo31 Divljo31 deployed to upgrade-ui-next April 20, 2026 11:31 — with GitHub Actions Active
@Divljo31 Divljo31 deployed to upgrade-ui-master April 20, 2026 11:31 — with GitHub Actions Active
@github-actions
Copy link
Copy Markdown

🧚 Live preview: galacticcouncil/hydration-ui#3757

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants