Skip to content

feat: SorobanContractInvoker component and useContractCall hook #4

Description

@gloriaelishahabu

Overview

Soroban smart contracts are the future of Stellar dApps. This issue tracks adding a useContractCall hook and SorobanContractInvoker component that lets dApps invoke Soroban contract functions through the same wallet adapter layer already in StellarPayProvider.

What needs to be built

  • useContractCall(contractId, method, args) hook using SorobanRpc.Server
  • Handle simulation → authorization → submission lifecycle
  • SorobanContractInvoker component for no-code contract invocation UI
  • Support for reading contract state (view functions — no signing needed)
  • Export from barrel

API shape

const {
  invoke,     // (args: xdr.ScVal[]) => Promise<SorobanRpc.GetTransactionResponse>
  simulate,   // (args: xdr.ScVal[]) => Promise<SorobanRpc.SimulateTransactionResponse>
  result,     // SorobanRpc.GetTransactionResponse | null
  status,     // "idle" | "simulating" | "signing" | "submitting" | "success" | "error"
  error,      // string | null
} = useContractCall(contractId, "transfer");

Why this matters

  • StellarBridge and other Wave projects use Soroban contracts
  • No existing React library abstracts the simulate → sign → submit → poll lifecycle
  • This makes stellar-pay-ui useful beyond just payments — it becomes the standard Soroban UI toolkit

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions