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.

Copy link
Contributor

@Copilot 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.

// ---------- Event Handlers ----------------------------------------------- //

public emit: IPOSClientEngine["emit"] = (event, args) => {
console.log("emit", event, args);
Copy link
Preview

Copilot AI Sep 5, 2025

Choose a reason for hiding this comment

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

Console.log statements should be removed from production code. Consider using the logger from the signClient instead: this.signClient.logger.debug().

Suggested change
console.log("emit", event, args);
this.signClient.logger.debug("emit", event, args);

Copilot uses AI. Check for mistakes.

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.

export * from "./client";
export * from "./chains";
export * from "./client";
export * from "./rpc";
Copy link

Choose a reason for hiding this comment

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

Bug: Duplicate Export Causes Module Issues

The export * from "./client"; statement is duplicated in packages/pos-client/src/constants/index.ts. This creates a redundant export that may cause module resolution or bundling issues.

Fix in Cursor Fix in Web

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.

4 participants