Skip to content

feat: add usePayment hook for Stellar asset transfers and update dev …#197

Open
akinboyewaSamson wants to merge 1 commit into
dark-princezz:mainfrom
akinboyewaSamson:feature/antigravity-normalization
Open

feat: add usePayment hook for Stellar asset transfers and update dev …#197
akinboyewaSamson wants to merge 1 commit into
dark-princezz:mainfrom
akinboyewaSamson:feature/antigravity-normalization

Conversation

@akinboyewaSamson

Copy link
Copy Markdown

closes #126

Here is the pull request documentation template, pre-filled with the changes you just made. You can copy and paste this directly into your GitHub PR description.


🚀 Pull Request: Implement usePayment Hook

Description

Implements the core functionality for the planned usePayment hook as outlined in the project roadmap. This hook wires up the @stellar/freighter-api to build, sign, and submit classic Stellar asset transfers (both native XLM and credit assets/trustlines) in a single unified hook lifecycle.

Key Changes

  • **Added src/hooks/usePayment.ts**: Built the React hook managing lifecycle states (idle, submitting, polling, success, error), integrating signTransaction from useFreighter.
  • Exported Types & Hook: Exposed explicit types (PaymentAsset, UsePaymentOptions, UsePaymentReturn) and the hook itself via the main index barrel file.
  • Added Changeset: Generated a patch versioning note (.changeset/add-use-payment-hook.md) to automate the release process and changelog updating.

API Footprint

const { submit, status, hash, isLoading, isSuccess, isError, error, reset } = usePayment({
  destination: "GBXXX...",
  asset: { type: "native" },
  amount: "10",
  memo: "Thanks!",
  onSuccess: (hash) => console.log("Sent!", hash),
  onError:   (err)  => console.error(err),
});

Verification Checklist

  • Run local development setup (npm install)
  • Compilation & Type Checks (npm run build using tsup)
  • Core exports verified in dist/index.d.ts and dist/index.d.mts
  • Added automated release note via Changesets (npm run changeset)

@gloriaelishahabu

Copy link
Copy Markdown
Contributor

resolve conflicts

@gloriaelishahabu

Copy link
Copy Markdown
Contributor

i would reassign the issues, if you don't resolve the issues

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.

feat: implement useFeeStats() - poll current Horizon fee statistics

3 participants