Skip to content

feat: expose openItemPurchase types to scenes - #1541

Open
juanmahidalgo wants to merge 9 commits into
mainfrom
feat/open-item-purchase-from-scenes
Open

feat: expose openItemPurchase types to scenes#1541
juanmahidalgo wants to merge 9 commits into
mainfrom
feat/open-item-purchase-from-scenes

Conversation

@juanmahidalgo

Copy link
Copy Markdown

Draft: pinned to a branch build of the protocol PR this depends on. See "Before this can merge".

Depends on decentraland/protocol#462. Client implementation: decentraland/unity-explorer#9725.

Changes

Bumps @dcl/protocol so scene authors get types for the new openItemPurchase restricted action:

import { openItemPurchase, OpenItemPurchaseResult } from '~system/RestrictedActions'

const { result } = await openItemPurchase({ urn: ITEM_URN })
if (result === OpenItemPurchaseResult.OIP_PURCHASED) dispense()

That is the whole change — four lines across two package.json files and their lockfiles. Nothing else is needed here because ~system/* types are generated from the pinned protocol at build time and are not committed, and no hand-written TypeScript wraps these calls: the entire ~system/RestrictedActions surface is generated.

Verified locally with node 24.16.0 that the generated
scripts/rpc-api-generation/src/proto/decentraland/kernel/apis/restricted_actions.gen.ts now contains
openItemPurchase and the OpenItemPurchaseResult enum, and that the enum's member names match the runtime
values the client exposes — that pairing matters, because the scene imports the type from here and the
value from the client, so a name mismatch would typecheck and then read undefined at runtime.

Two things a reviewer should know

The API report was left out on purpose. make build regenerates
packages/@dcl/playground-assets/etc/playground-assets.api.md with 68 deletions — it drops ExplorerUi,
ExplorerUiEventsResult and core::ExplorerUiEventsResult. That is not caused by this bump: no proto in
the currently pinned protocol build (commit-2c475cb) mentions ExplorerUiEventsResult at all, so the
committed report cannot have been produced from it — it was committed from a build made against the
feat/explorer-ui-events-result protocol branch. Regenerating it here would make this PR look like it
deletes public API, so the file is untouched and the drift is left for whoever owns that feature. Happy to
split it into its own PR if you would rather have it reconciled.

The lockfile diff is only the protocol entries. npm ci fails on main with npm 10 (Missing: glob@10.5.0 from lock file), but that is an artifact of the older npm — with npm 11 (node 24.16.0, what CI uses) the
install is clean and the lockfile change is 8 lines, all @dcl/protocol.

Before this can merge

The pin points at a branch build of the protocol PR (dcl-protocol-1.0.0-31508413180.commit-2faaa7a). Once
decentraland/protocol#462 merges and publishes from main, this needs a re-pin to that release. That is the
only reason it is a draft.

Test plan

  • make install and make build with node 24.16.0 — type checking clean, 38 tests passing
  • The generated restricted_actions.gen.ts exposes openItemPurchase and OpenItemPurchaseResult
  • Generated enum member names match the values the client's RestrictedActions.js exposes at runtime, one to one
  • Lockfile diff limited to @dcl/protocol
  • A scene calling openItemPurchase compiles and runs end to end against the client in feat: let scenes offer marketplace items for credits unity-explorer#9725 (purchase completed on Amoy, verdict returned, scene reacted)

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 13, 2026

Copy link
Copy Markdown

Deploying js-sdk-toolchain with  Cloudflare Pages  Cloudflare Pages

Latest commit: ad09826
Status: ✅  Deploy successful!
Preview URL: https://c5a30805.js-sdk-toolchain.pages.dev
Branch Preview URL: https://feat-open-item-purchase-from.js-sdk-toolchain.pages.dev

View logs

Signed-off-by: davidejensen <davidejensen@live.it>
Signed-off-by: davidejensen <davidejensen@live.it>
@davidejensen
davidejensen marked this pull request as ready for review August 13, 2026 13:31
davidejensen and others added 4 commits August 13, 2026 15:35
Signed-off-by: davidejensen <davidejensen@live.it>
Signed-off-by: davidejensen <davidejensen@live.it>
The lockfile integrity hash was from the old commit-2faaa7a tarball,
not the current commit-f68310e build. npm fails with EINTEGRITY
because the CDN tarball was rebuilt after the lockfile was generated.
@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Test this pull request

  • The @dcl/sdk package can be tested in scenes by running

    npm install "https://sdk-team-cdn.decentraland.org/@dcl/js-sdk-toolchain/branch/feat/open-item-purchase-from-scenes/dcl-sdk-7.26.1-31779435125.commit-d9fbe03.tgz"
  • The @dcl/js-runtime package can be tested in scenes by running

    npm install "https://sdk-team-cdn.decentraland.org/@dcl/js-sdk-toolchain/branch/feat/open-item-purchase-from-scenes/@dcl/js-runtime/dcl-js-runtime-7.26.1-31779435125.commit-d9fbe03.tgz"
  • To test with npx init

    export SDK_COMMANDS="https://sdk-team-cdn.decentraland.org/@dcl/js-sdk-toolchain/branch/feat/open-item-purchase-from-scenes/dcl-sdk-commands-7.26.1-31779435125.commit-d9fbe03.tgz"
    npx $SDK_COMMANDS init
  • The /changerealm command to test test in-world

    /changerealm https://sdk-team-cdn.decentraland.org/ipfs/feat/open-item-purchase-from-scenes-e2e
    
  • You can preview this build entering:
    https://playground.decentraland.org/?sdk-branch=feat/open-item-purchase-from-scenes

@davidejensen davidejensen self-assigned this Aug 14, 2026
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.

3 participants