-
Notifications
You must be signed in to change notification settings - Fork 779
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-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); |
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.
Console.log statements should be removed from production code. Consider using the logger from the signClient instead: this.signClient.logger.debug()
.
console.log("emit", event, args); | |
this.signClient.logger.debug("emit", event, args); |
Copilot uses AI. Check for mistakes.
|
||
// ---------- 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
export * from "./client"; | ||
export * from "./chains"; | ||
export * from "./client"; | ||
export * from "./rpc"; |
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.
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.