8000 feat: experimental iframe support by ahnafalfariza · Pull Request #1358 · near/wallet-selector · GitHub
[go: up one dir, main page]

Skip to content

Conversation

ahnafalfariza
Copy link
Collaborator
@ahnafalfariza ahnafalfariza commented Jun 26, 2025

Experimental

Description

This pull request introduces a new iframe-based wallet adapter system. This introduces source parameters that contain wallet implementation codes as IIFE / UMD scripts derived from the existing wallet implementation in the /packages folder.

  • Minimal wallet package modifications: Existing wallet packages are built as IIFE scripts with minimal changes
  • Backwards compatibility: Maintains the same interface during wallet initialization while supporting the new architecture

Proposed Example Usage

const selector = await setupWalletSelector({
  network: NETWORK_ID,
  debug: true,
  // Legacy support - continues to work
  modules: [
    setupMeteorWallet(),
    setupMyNearWallet(),
    setupSender(),
  ],
  // New iframe-based configuration
  modulesV2: [
    {
      id: "example-wallet",
      type: "browser",
      source: "https://cdn.example.com/wallet-iife.js", // IIFE script URL
      permissions: [],
      metadata: {
        name: "My Wallet",
        description: "Custom Wallet",
        iconUrl: "https://img.icons8.com/search",
        deprecated: false,
        available: true,
        walletUrl: "https://example.com/wallet",
        // same metadata interface
      },
    },
  ],
});

Key Points:

  • Backward Compatibility: Existing modules array continues to work unchanged
  • IIFE Script Integration: The source parameter points to IIFE scripts built from existing wallet packages with minimal modifications
  • Flexible Deployment: Wallets can be hosted separately and integrated dynamically
  • Same Interface: modulesV2 uses the same metadata interface as traditional modules
  • Enhanced Security: Iframe sandboxing provides an isolated execution environment

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Type of change.

  • FIX - a PR of this type patches a bug.
  • FEATURE - a PR of this type introduces a new feature.
  • BUILD - a PR of this type introduces build changes.
  • CI - a PR of this type introduces CI changes.
  • DOCS - a PR of this type introduces DOCS improvement.
  • STYLE - a PR of this type introduces style changes.
  • REFACTOR - a PR of this type introduces refactoring.
  • PERFORMANCE - a PR of this type introduces performance changes.
  • TEST - a PR of this type adds more tests.
  • CHORE - a PR introduces other changes than the specified above.

Copy link
changeset-bot bot commented Jul 14, 2025

🦋 Changeset detected

Latest commit: a91fcb5

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

This PR includes changesets to release 29 packages
Name Type
@near-wallet-selector/core Minor
@near-wallet-selector/arepa-wallet Minor
@near-wallet-selector/bitget-wallet Minor
@near-wallet-selector/bitte-wallet Minor
@near-wallet-selector/coin98-wallet Minor
@near-wallet-selector/ethereum-wallets Minor
@near-wallet-selector/here-wallet Minor
@near-wallet-selector/hot-wallet Minor
@near-wallet-selector/intear-wallet Minor
@near-wallet-selector/ledger Minor
@near-wallet-selector/math-wallet Minor
@near-wallet-selector/meteor-wallet-app Minor
@near-wallet-selector/meteor-wallet Minor
@near-wallet-selector/modal-ui-js Minor
@near-wallet-selector/modal-ui Minor
@near-wallet-selector/my-near-wallet Minor
@near-wallet-selector/narwallets Minor
@near-wallet-selector/near-mobile-wallet Minor
@near-wallet-selector/near-snap Minor
@near-wallet-selector/nightly Minor
@near-wallet-selector/okx-wallet Minor
@near-wallet-selector/ramper-wallet Minor
@near-wallet-selector/react-hook Minor
@near-wallet-selector/sender Minor
@near-wallet-selector/unity-wallet Minor
@near-wallet-selector/wallet-connect Minor
@near-wallet-selector/wallet-utils Minor
@near-wallet-selector/welldone-wallet Minor
@near-wallet-selector/xdefi 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

@ahnafalfariza
Copy link
Collaborator Author
ahnafalfariza commented Jul 17, 2025

Added new docs related to the iframe:


The iframe setup gives us a more secure and modular way to integrate wallets, which is a big win for security. That said, it does add some extra complexity and limitations. To move forward, here are a few things we should focus on:

  1. Gathering extensive feedback from:
    • Wallet providers on implementation feasibility
    • dApp developers on integration experience
  2. Creating comprehensive documentation and tooling
  3. Establishing best practices for common integration patterns
    With the right approach and community support, this iframe-based design could really help us build a more secure and easier-to-maintain wallet ecosystem.

@ahnafalfariza ahnafalfariza changed the title [WIP] Feat/poc iframe feat: experimental iframe support Jul 22, 2025
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.

1 participant
0