Skip to content

Adopt stellar-wallets-kit, replace freighter-api #375

Description

@grantfox-oss

Sprint: 1 — Foundations · Area: wallet · Size: 1.5 d · Depends on:
Source: docs/SPRINT-1-ISSUES.md #1

Context

Today frontend/lib/wallet-context.tsx calls @stellar/freighter-api directly and hard-codes the testnet passphrase. We need an abstraction that also supports LOBSTR (via WalletConnect). The chosen library is @creit.tech/stellar-wallets-kit.

Scope

  • Add @creit.tech/stellar-wallets-kit to p2p-safe-swap/package.json.
  • Refactor WalletProvider / useWallet to use the kit internally while keeping the exact same public API (publicKey, network, isConnecting, connect, disconnect, signTransaction). No downstream call sites should need changes.
  • Read the network from NEXT_PUBLIC_STELLAR_NETWORK (testnet | mainnet) and pass the correct passphrase to the kit.
  • Remove the direct @stellar/freighter-api import from wallet-context.tsx. Keep the dep in package.json only if the kit needs it transitively.

Acceptance

  • Existing "Connect wallet" button still works with Freighter after the refactor (regression check).
  • Signing an XDR still returns a signedTxXdr string.
  • Switching NEXT_PUBLIC_STELLAR_NETWORK between testnet and mainnet flips the passphrase used to sign.
  • No consumer file changed except wallet-context.tsx and the env example.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardThird CampaignCampaign: Third Campaign

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions