Skip to content

Submit

Submit a transfer plan with useWalletTransfer. The user confirms in the wallet. Does not require WalletsProvider — but you still need a connected walletId on the plan.

Same submit / retry as Submit (Core). If result.status === 'requires_retry', the wallet already signed and sent. Show Retry — do not submit again.

Ready to submit

Use this checklist to enable the confirm button. submit still validates the same things and will throw if something is missing — this is only for UI.

  1. Session view is active
  2. Connection status === 'connected'
  3. Token is eligible
  4. plan.flow !== 'unavailable'
  5. Amount is valid (useDualAmountInput().isValid)
  6. Quote is present when the flow needs one (swap / bridge; direct can omit)
  7. Not already in requires_retry (then show Retry instead)

Direct can omit quote. Swap and bridge need a current quote — if the amount changed, refetch and do not submit a stale one. Pass the whole quote object into submit. Do not build or edit fields.

Example

tsx
import {
  ConnectSdkError,
  ConnectSdkErrorCode,
} from '@swapped/connect-sdk'
import { useWalletTransfer } from '@swapped/connect-sdk/react'

function Confirm({
  plan,
  amount,
  quote,
}: {
  plan: WalletTransferPlan
  amount: string
  quote?: WalletTransferQuote
}) {
  const { submit, retry, result, isPending, error } = useWalletTransfer()

  return (
    <div>
      <button
        type="button"
        disabled={
          isPending ||
          plan.flow === 'unavailable' ||
          result?.status === 'requires_retry'
        }
        onClick={() =>
          void submit({
            plan,
            amount,
            quote,
            onStatus: event => {
              event.status
            },
          })
        }
      >
        {isPending ? 'Confirming…' : 'Confirm in wallet'}
      </button>

      {result?.status === 'requires_retry' ? (
        <button
          type="button"
          disabled={isPending}
          onClick={() => void retry()}
        >
          Retry
        </button>
      ) : null}

      {error instanceof ConnectSdkError &&
      error.code !== ConnectSdkErrorCode.WALLET_TRANSACTION_REJECTED ? (
        <p>
          {error.code === ConnectSdkErrorCode.WALLET_TRANSFER_INSUFFICIENT_FEE
            ? 'Not enough to cover fees'
            : 'Transfer failed'}
        </p>
      ) : null}
    </div>
  )
}

Branch on ConnectSdkError.code — see Errors. User cancel (WALLET_TRANSACTION_REJECTED) is silent here.

submit options

OptionMeaning
planTransfer plan from useWalletTransferPlan
amountSource crypto string
quote?Quote from useWalletTransferQuote. Required for swap / bridge; optional for direct
onStatus?Status events for this submit

Returns

FieldMeaning
submit(request)Returns WalletTransferResult | null (null on throw; error is on error)
retry()Returns WalletTransferResult | null
resultLast WalletTransferResult (status, hash, …)
isPendingSubmit or retry in flight
errorLast thrown error
resetClear result / error

requires_retry

The wallet already signed / sent. Registration with Swapped failed. If result.status === 'requires_retry', call retry(). Do not submit again.

submit throws WALLET_TRANSFER_REQUIRES_RETRY (and the hook sets error) if a previous submit already returned requires_retry.

Status values: Submit (Core).