Dargon789/sequence.js

# Sequence diagram for wallet connection flow in wagmi demo app

Open

#137 opened on Dec 22, 2025

View on GitHub
 (0 comments) (0 reactions) (1 assignee)TypeScript (2 forks)auto 404
dependenciesdocumentationduplicateenhancementgood first issuehelp wantedinvalidjavascriptquestion

Repository metrics

Stars
 (1 star)
PR merge metrics
 (PR metrics pending)

Description

Reviewer's Guide

Introduces a new secure ID generation strategy for the dapp client, adds a wagmi-based demo app scaffold, and configures multiple CI/security workflows and project metadata files (issue templates, security policy, pipelines, and funding).

Sequence diagram for wallet connection flow in wagmi demo app

sequenceDiagram
  actor User
  participant Browser
  participant App
  participant WagmiProvider
  participant ConnectHook
  participant Connector
  participant Blockchain

  User->>Browser: Load page
  Browser->>App: Render App component
  App->>WagmiProvider: Initialize with config
  App->>ConnectHook: useConnect()
  ConnectHook-->>App: connectors, connect, status, error

  User->>App: Click connect button for connector
  App->>ConnectHook: connect(connector)
  ConnectHook->>Connector: initiate connection
  Connector->>Blockchain: wallet RPC / authorization
  Blockchain-->>Connector: connection approved
  Connector-->>ConnectHook: connection result (account, chainId)
  ConnectHook-->>App: status updated to connected
  App-->>User: Render connected state and Disconnect button

  User->>App: Click Disconnect
  App->>Connector: disconnect()
  Connector->>Blockchain: terminate session
  Blockchain-->>Connector: disconnected
  Connector-->>App: status updated to disconnected
  App-->>User: Render disconnected state

Class diagram for updated DappTransport ID generation

classDiagram
  class DappTransport {
    -someInternalState
    +sendMessage(message)
    +receiveMessage(message)
    -generateId() string
  }

  class WindowCrypto {
    +getRandomValues(array Uint32Array) Uint32Array
  }

  class MathRandomLegacy {
    +random() number
  }

  DappTransport ..> WindowCrypto : uses
  DappTransport ..> MathRandomLegacy : replaces

Class diagram for wagmi React demo app structure

classDiagram
  class App {
    +App() JSXElement
  }

  class MainEntrypoint {
    +main() void
  }

  class WagmiProvider {
    +WagmiProvider(config Config, children ReactNode)
  }

  class QueryClientProvider {
    +QueryClientProvider(client QueryClient, children ReactNode)
  }

  class QueryClient {
    +QueryClient()
  }

  class Config {
    +chains Chain[]
    +connectors Connector[]
    +transports Map<int, Transport>
  }

  class Chain {
    +id int
    +name string
  }

  class Connector {
    +uid string
    +name string
    +connect() Promise<Account>
    +disconnect() Promise<void>
  }

  class AccountHookResult {
    +status string
    +addresses string[]
    +chainId int
  }

  class ConnectHookResult {
    +connect(connector Connector) void
    +connectors Connector[]
    +status string
    +error Error
  }

  class DisconnectHookResult {
    +disconnect() void
  }

  MainEntrypoint --> WagmiProvider : wraps
  WagmiProvider --> QueryClientProvider : wraps
  QueryClientProvider --> App : renders

  MainEntrypoint --> QueryClient : creates
  WagmiProvider --> Config : uses

  App --> AccountHookResult : useAccount
  App --> ConnectHookResult : useConnect
  App --> DisconnectHookResult : useDisconnect

  Config --> Chain : contains
  Config --> Connector : contains

File-Level Changes

Change Details Files
Use cryptographically secure randomness for DappTransport ID generation. Replace Math.random-based ID suffix with crypto.getRandomValues using a Uint32Array.Generate a base-36 random string from two 32-bit values and slice to 9 characters.Preserve existing timestamp-based prefix while improving randomness quality. packages/wallet/dapp-client/src/DappTransport.ts
Add wagmi-based React demo application scaffolded with Vite. Create a new wagmi-project package with Vite/React/TypeScript tooling and dependencies.Set up WagmiProvider, QueryClientProvider, and Buffer global in main entrypoint.Implement a simple App component showing account status and allowing wallet connection/disconnection.Configure wagmi client with mainnet and sepolia chains and common connectors.Add Vite, TypeScript, Biome, and CSS configuration and boilerplate files for the new project. wagmi-project/package.jsonwagmi-project/tsconfig.jsonwagmi-project/tsconfig.node.jsonwagmi-project/vite.config.tswagmi-project/index.htmlwagmi-project/src/main.tsxwagmi-project/src/App.tsxwagmi-project/src/wagmi.tswagmi-project/src/index.csswagmi-project/src/vite-env.d.tswagmi-project/.gitignorewagmi-project/.npmrcwagmi-project/biome.jsonwagmi-project/README.md
Introduce security scanning and CI pipeline configurations across multiple platforms. Add GitHub Actions workflow to run Fortify AST SAST scans on master branch and PRs.Configure CircleCI with a basic executor and placeholder job using a Docker image.Add Azure Pipelines YAML for basic Node.js build on master branch. .github/workflows/fortify.yml.circleci/config.ymlazure-pipelines.yml
Add repository templates and security policy documentation. Add GitHub issue templates for bug reports, feature requests, and a custom template.Create SECURITY.md outlining supported versions and vulnerability reporting process.Add FUNDING.json and CNAME placeholders for project funding and custom domain configuration. .github/ISSUE_TEMPLATE/bug_report.md.github/ISSUE_TEMPLATE/feature_request.md.github/ISSUE_TEMPLATE/custom.mdSECURITY.mdFUNDING.jsonCNAME
Add auxiliary project and cache-related files. Introduce an empty .codesandbox/tasks.json file for CodeSandbox integration.Add V8 compile cache map artifacts under v8-compile-cache-0/.Add various wagmi-project root config files such as .gitignore, .npmrc, and Biome configuration. .codesandbox/tasks.jsonv8-compile-cache-0/x64/11.3.244.8-node.19/zSprojectzSsequence.jszSnode_moduleszS.pnpmzS@preconstruct+cli@2.8.7zSnode_moduleszS@preconstructzSclizSbin.js.MAPv8-compile-cache-0/x64/11.3.244.8-node.19/zSprojectzSworkspacezSnode_moduleszS.pnpmzS@preconstruct+cli@2.8.7zSnode_moduleszS@preconstructzSclizSbin.js.MAPwagmi-project/.gitignorewagmi-project/.npmrcwagmi-project/biome.json

Possibly linked issues

  • #86: They match: this PR implements the wagmi app, Fortify workflow, CI, and templates requested in the issue.
  • #17: They both describe adding the wagmi React app plus SECURITY.md, Azure pipeline, and related scaffolding files.
  • #79: PR implements the Fortify workflow, CircleCI config, issue templates, and React Query upgrade described in the issue.

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it. You can also reply to a review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment @sourcery-ai summary on the pull request to (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Originally posted by @sourcery-ai[bot] in https://github.com/Dargon789/sequence.js/issues/136#issuecomment-3682562759

Contributor guide