Skip to content

Conversation

@ganchoradkov
Copy link
Member

@ganchoradkov ganchoradkov commented Sep 5, 2025

Description

This PR introduces a new POS (Point-of-Sale) client package to the WalletConnect ecosystem, enabling merchants to create payment intents for cryptocurrency transactions through WalletConnect.

  • Implements a new @walletconnect/pos-client package with core POS functionality
  • Provides APIs for token configuration and payment intent creation
  • Includes comprehensive validation for tokens, payment amounts, and chain compatibility

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Draft PR (breaking/non-breaking change which needs more work for having a proper functionality [Mark this PR as ready to review only when completely ready])
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How has this been tested?

tests

Checklist

  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Additional Information (Optional)

Please include any additional information that may be useful for the reviewer.


Note

Introduces the @walletconnect/pos-client workspace with APIs and engine to create payment intents, manage sessions, build/send transactions, and emit payment lifecycle events, plus tests and build config.

  • New Package: packages/pos-client added to workspaces (@walletconnect/pos-client).
    • Entry points: src/index.ts, src/client.ts (public API), src/controllers/engine.ts (core logic).
    • Build/test config: rollup.config.js, tsconfig.json, vitest.config.ts, .npmignore, package.json, README.md, LICENSE.md.
  • Core Functionality:
    • APIs: setTokens, createPaymentIntent, sendPaymentsToWallet, restart.
    • Event-driven flow via EventEmitter: qr_ready, connected, payment_requested|rejected|broadcasted|failed|successful, connection_*.
    • Session management with @walletconnect/sign-client; optional manual control.
    • Validation utilities for tokens/payment intents; supported namespaces defaults and dynamic fetch.
  • RPC/Transactions:
    • RPC helpers and error mapping (RPC_URL, RPC_ERROR_CODES).
    • RPC methods: wc_pos_supportedNetworks, wc_pos_buildTransactions, wc_pos_checkTransaction.
    • Builds transactions per intent, sends via session request, polls for confirmation with max attempts.
  • Tests:
    • Integration tests (test/pos.spec.ts) covering setup, validation errors, multi-chain intents, manual control, and event emissions.

Written by Cursor Bugbot for commit 557c05a. This will update automatically on new commits. Configure here.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new POS (Point-of-Sale) client package to the WalletConnect ecosystem, enabling merchants to create payment intents for cryptocurrency transactions through WalletConnect.

  • Implements a new @walletconnect/pos-client package with core POS functionality
  • Provides APIs for token configuration and payment intent creation
  • Includes comprehensive validation for tokens, payment amounts, and chain compatibility

Reviewed Changes

Copilot reviewed 24 out of 25 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/pos-client/src/client.ts Main POS client implementation with initialization and method delegation
packages/pos-client/src/controllers/engine.ts Core engine handling payment flows, wallet communication, and transaction processing
packages/pos-client/src/types/ Type definitions for client options, payment intents, and engine interfaces
packages/pos-client/src/utils/validator.ts Validation logic for tokens and payment intents
packages/pos-client/src/constants/ Configuration constants for supported chains and client settings
packages/pos-client/test/pos.spec.ts Comprehensive test suite covering client initialization and payment flows
packages/pos-client/package.json Package configuration with dependencies and build scripts
package.json Workspace configuration update to include the new package

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.


// ---------- Engine ----------------------------------------------- //

public setTokens: IPOSClient["setTokens"] = async (params) => {
Copy link

Choose a reason for hiding this comment

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

In Kotlin I decided to not have setTokens as it's kinda verbose
Instead I pass chains in the init functions to build the namespaces based on the chains
Token are passed only in the createPaymentIntent method

I find it cleaner but up to you

Copy link

Choose a reason for hiding this comment

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

I think its good that we agree on one approach that we can maintain across all sdks!

Copy link

@jakubuid jakubuid left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 1 to 6
export const SUPPORTED_NAMESPACES = ["eip155", "solana"];

export const NAMESPACE_TO_TRANSACTION_METHOD = {
eip155: "eth_sendTransaction",
solana: "solana_sendTransaction",
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be hardcoded? If yes we need a new release for a new namespace

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

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.

6 participants