-
Notifications
You must be signed in to change notification settings - Fork 789
feat: pos client #6912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v2.0
Are you sure you want to change the base?
feat: pos client #6912
Conversation
There was a problem hiding this 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-clientpackage 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.
|
|
||
| // ---------- Engine ----------------------------------------------- // | ||
|
|
||
| public setTokens: IPOSClient["setTokens"] = async (params) => { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| export const SUPPORTED_NAMESPACES = ["eip155", "solana"]; | ||
|
|
||
| export const NAMESPACE_TO_TRANSACTION_METHOD = { | ||
| eip155: "eth_sendTransaction", | ||
| solana: "solana_sendTransaction", | ||
| }; |
There was a problem hiding this comment.
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
# Conflicts: # package-lock.json
# Conflicts: # package-lock.json
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.
Type of change
How has this been tested?
tests
Checklist
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.
packages/pos-clientadded to workspaces (@walletconnect/pos-client).src/index.ts,src/client.ts(public API),src/controllers/engine.ts(core logic).rollup.config.js,tsconfig.json,vitest.config.ts,.npmignore,package.json,README.md,LICENSE.md.setTokens,createPaymentIntent,sendPaymentsToWallet,restart.EventEmitter:qr_ready,connected,payment_requested|rejected|broadcasted|failed|successful,connection_*.@walletconnect/sign-client; optional manual control.RPC_URL,RPC_ERROR_CODES).wc_pos_supportedNetworks,wc_pos_buildTransactions,wc_pos_checkTransaction.request, polls for confirmation with max attempts.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.