Skip to content

Conversation

@yosriady
Copy link
Contributor

@yosriady yosriady commented Sep 15, 2025

Wallet events not getting detected

May need wagmi support

TODOs

  • check if 6963 returns providers
  • check if EIP1193 callbacks are implemented
  • Need to debug this locally with yarn linked SDK

@yosriady yosriady requested a review from Copilot September 15, 2025 11:27
@yosriady
Copy link
Contributor Author

bugbot run

@cursor
Copy link

cursor bot commented Sep 15, 2025

Skipping Bugbot: Bugbot is disabled for this repository

@yosriady
Copy link
Contributor Author

bugbot run

Copy link

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 adds a comprehensive example application demonstrating the integration of Porto SDK (passkey-based wallet) with Formo Analytics for tracking wallet events and user interactions in a Next.js environment.

  • Created a complete Next.js Wagmi app with Porto connector integration
  • Implemented Formo Analytics SDK for comprehensive event tracking
  • Added testing interface with UI components for all wallet operations

Reviewed Changes

Copilot reviewed 10 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/wagmi.ts Wagmi configuration with Porto connector and multi-chain support
src/app/providers.tsx React providers setup for Wagmi, TanStack Query, and Formo Analytics
src/app/page.tsx Main testing interface with wallet operations and event tracking
src/app/layout.tsx Next.js app layout with SSR cookie state initialization
src/app/globals.css Global CSS styles with dark/light theme support
package.json Project dependencies including Porto SDK and Formo Analytics
README.md Comprehensive documentation and setup instructions
INTEGRATION_TEST_RESULTS.md Detailed integration test results and technical documentation
.npmrc NPM configuration for legacy peer dependencies
.env.example Environment variables template

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

src/wagmi.ts Outdated
connectors: [
injected(),
baseAccount(),
walletConnect({ projectId: process.env.NEXT_PUBLIC_WC_PROJECT_ID! }),
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

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

The non-null assertion operator (!) could cause runtime errors if the environment variable is undefined. Consider providing a fallback value or conditional logic to handle missing project ID gracefully.

Suggested change
walletConnect({ projectId: process.env.NEXT_PUBLIC_WC_PROJECT_ID! }),
walletConnect({
projectId: (() => {
const id = process.env.NEXT_PUBLIC_WC_PROJECT_ID;
if (!id) {
throw new Error("Environment variable NEXT_PUBLIC_WC_PROJECT_ID is required for WalletConnect but is not defined.");
}
return id;
})(),
}),

Copilot uses AI. Check for mistakes.
src/app/page.tsx Outdated
const handleCustomEvent = () => {
if (!customEventName) return

const eventData = customEventData ? JSON.parse(customEventData) : {}
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

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

JSON.parse could throw an error if customEventData is malformed JSON. Add try-catch error handling to prevent application crashes from invalid user input.

Suggested change
const eventData = customEventData ? JSON.parse(customEventData) : {}
let eventData = {};
if (customEventData) {
try {
eventData = JSON.parse(customEventData);
} catch (e) {
eventData = {};
// Optionally, you could log the error or notify the user here
}
}

Copilot uses AI. Check for mistakes.
"@formo/analytics": "^1.20.0",
"@tanstack/react-query": "5.45.1",
"next": "14.2.4",
"porto": "^0.2.5",
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

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

Using 'latest' for version specifications can lead to unpredictable builds. Consider pinning to specific versions for better reproducibility and stability.

Copilot uses AI. Check for mistakes.
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "latest",
"wagmi": "latest"
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

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

Using 'latest' for version specifications can lead to unpredictable builds. Consider pinning to specific versions for better reproducibility and stability.

Suggested change
"wagmi": "latest"
"wagmi": "1.7.0"

Copilot uses AI. Check for mistakes.
cursor[bot]

This comment was marked as outdated.

@yosriady yosriady requested a review from Copilot September 15, 2025 11:32
@yosriady yosriady changed the title Add Porto example (WIP) [P-1149] Add Porto example (WIP) Sep 15, 2025
@linear
Copy link

linear bot commented Sep 15, 2025

P-1149 SDK: Porto integration

https://x.com/gakonst/status/1927764579028783156

https://porto.sh/

Should just work if integrated with Wagmi? https://porto.sh/sdk

Create wagmi app with https://wagmi.sh/cli/create-wagmi

TODOs

Screenshot 2025-08-10 at 19.19.51.png

https://ithaca.xyz/

Wallet library based on passkeys

Formo should be able to detect wallet events (connect wallet, etc)

Page and track function works

Event Works? Action items
Detect
Identify
Accounts changed
Chain changed
Connect
Signature
Transaction

References

Copy link

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

Copilot reviewed 10 out of 14 changed files in this pull request and generated 4 comments.


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

src/wagmi.ts Outdated
Comment on lines 12 to 14
walletConnect({ projectId: process.env.NEXT_PUBLIC_WC_PROJECT_ID! }),
porto(),
],
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

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

The non-null assertion operator (!) will cause a runtime error if NEXT_PUBLIC_WC_PROJECT_ID is undefined. Consider adding validation or making this parameter optional with a fallback.

Suggested change
walletConnect({ projectId: process.env.NEXT_PUBLIC_WC_PROJECT_ID! }),
porto(),
],
process.env.NEXT_PUBLIC_WC_PROJECT_ID
? walletConnect({ projectId: process.env.NEXT_PUBLIC_WC_PROJECT_ID })
: undefined,
porto(),
].filter(Boolean),

Copilot uses AI. Check for mistakes.
to_chain_id: targetChainId,
address: account.address
})
switchChain({ chainId: targetChainId as any })
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

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

Using 'as any' type assertion bypasses type safety. The chainId should be properly typed as the expected chain ID type from Wagmi.

Suggested change
switchChain({ chainId: targetChainId as any })
switchChain({ chainId: targetChainId })

Copilot uses AI. Check for mistakes.
Comment on lines +96 to +98
} catch (error) {
console.error('Invalid JSON in custom event data:', error)
alert('Invalid JSON format in event data. Please check your input.')
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

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

Using 'alert()' for error messages provides poor user experience. Consider using a more user-friendly notification system or inline error display.

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +25
"porto": "^0.2.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "latest",
"wagmi": "latest"
},
"devDependencies": {
"@types/node": "^20.12.10",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"@wagmi/cli": "latest",
Copy link

Copilot AI Sep 15, 2025

Choose a reason for hiding this comment

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

Using 'latest' for dependencies can lead to unexpected breaking changes. Consider pinning to specific versions for better stability, especially for production applications.

Suggested change
"porto": "^0.2.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "latest",
"wagmi": "latest"
},
"devDependencies": {
"@types/node": "^20.12.10",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"@wagmi/cli": "latest",
"porto": "0.2.5",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"viem": "2.8.0",
"wagmi": "2.8.0"
},
"devDependencies": {
"@types/node": "^20.12.10",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"@wagmi/cli": "2.8.0",

Copilot uses AI. Check for mistakes.
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.

2 participants