Skip to content

Conversation

mfbz
Copy link
Contributor

@mfbz mfbz commented Oct 1, 2025

Added hook with core scheduled transactions functionalities as in flow cli.

@mfbz mfbz requested a review from a team as a code owner October 1, 2025 17:17
Copy link

changeset-bot bot commented Oct 1, 2025

🦋 Changeset detected

Latest commit: ee91c3f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@onflow/react-sdk Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Oct 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
react-sdk-demo Ready Ready Preview Comment Oct 17, 2025 7:06pm

💡 Enable Vercel Agent with $100 free credit for automated AI reviews

"@onflow/react-sdk": minor
---

Added useFlowSchedule hook
Copy link
Member

Choose a reason for hiding this comment

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

Can we make this more descriptive?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Improved 👍

High = 2,
}

export enum TransactionStatus {
Copy link
Member

@chasefleming chasefleming Oct 1, 2025

Choose a reason for hiding this comment

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

Is this already exported from FCL? If so, should we use that type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this type is specific for Scheduled Transactions

import {CONTRACT_ADDRESSES, CADENCE_UFIX64_PRECISION} from "../constants"
import {parseUnits} from "viem/utils"

export enum TransactionPriority {
Copy link
Member

Choose a reason for hiding this comment

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

Should we export this from FCL?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this type is specific for Scheduled Transactions

Cancelled = 4,
}

export interface TransactionInfo {
Copy link
Member

Choose a reason for hiding this comment

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

same q

Copy link
Contributor Author

@mfbz mfbz Oct 2, 2025

Choose a reason for hiding this comment

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

This type is specific to the scripts used to retrieve data from the manager, so it's specific for the implementation

// Gets a transaction by ID
// Equivalent to: flow schedule get <transaction-id> [--include-handler-data]
get: (
transactionId: bigint,
Copy link
Member

Choose a reason for hiding this comment

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

I think we have mixed txId and transactionId across the React SDK. We should probably be consistent. I'm for transactionId for clarity, so this is fine, but curious what everyone else thinks. cc @jribbink

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes you are right, we are using txId in react-sdk. i just updated it to have txId instead of transactionId for consistency 👍

Copy link
Contributor

@jribbink jribbink Oct 2, 2025

Choose a reason for hiding this comment

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

Same discussion goes for the numeric values. FCL traditionally uses string to represent numbers. We don't use/support bigint elsewhere so I'm hesitant to introduce this inconsistency

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, just updated to string for consistency

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 adds comprehensive support for Flow blockchain scheduled transactions through new React hooks. The implementation provides setup, listing, fetching, and canceling capabilities for scheduled transactions, following patterns similar to the Flow CLI's scheduled transaction functionality.

Key changes:

  • Added four new hooks for scheduled transaction management
  • Implemented type-safe transaction status and priority enums
  • Integrated contract addresses for scheduler utilities across networks
  • Created demo UI for testing the new functionality

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/react-sdk/src/hooks/useFlowScheduledTransactionSetup.ts Hook for one-time scheduler manager setup in user accounts
packages/react-sdk/src/hooks/useFlowScheduledTransactionList.ts Hook for listing all scheduled transactions for an account
packages/react-sdk/src/hooks/useFlowScheduledTransactionCancel.ts Hook for canceling scheduled transactions with fee refunds
packages/react-sdk/src/hooks/useFlowScheduledTransaction.ts Hook for fetching individual scheduled transaction details
packages/react-sdk/src/hooks/index.ts Exports the new hooks and types
packages/react-sdk/src/constants.ts Added scheduler contract addresses for all networks
packages/demo/src/components/hook-cards/use-flow-scheduled-transaction-card.tsx Interactive demo component showcasing all scheduler hooks
packages/demo/src/components/content-sidebar.tsx Added sidebar navigation for the demo
packages/demo/src/components/content-section.tsx Integrated demo card into main content
.changeset/upset-cities-start.md Changeset documenting the new feature
Test files Comprehensive unit tests for all new hooks

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

Comment on lines +30 to +31
FlowTransactionScheduler: "0x0000000000000000",
FlowTransactionSchedulerUtils: "0x0000000000000000",
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

The placeholder addresses for mainnet (0x0000000000000000) could cause runtime errors if used before being updated. Consider adding runtime validation to throw a descriptive error when these placeholder addresses are detected, helping developers identify the issue quickly.

Copilot uses AI. Check for mistakes.

Copy link
Member

@chasefleming chasefleming left a comment

Choose a reason for hiding this comment

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

Screenshot 2025-10-15 at 10 33 19 AM

Can we capitalize "Scheduled Transactions" here?

Can we also add more context on what they are please?

mfbz and others added 2 commits October 15, 2025 21:42
Co-authored-by: Chase Fleming <chasefleming@users.noreply.github.com>
Co-authored-by: Chase Fleming <chasefleming@users.noreply.github.com>
@mfbz
Copy link
Contributor Author

mfbz commented Oct 15, 2025

Screenshot 2025-10-15 at 10 33 19 AM Can we capitalize "Scheduled Transactions" here?

Can we also add more context on what they are please?

@chasefleming Improved playground card with full description of scheduled transactions and description of each feature in each tab (list, setup, cancel, get) 🚀

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.

3 participants