Skip to content

watchRequestId

Watch the on-ramp request by ID. This method is used to await for the request outcome based on the user confirmation or rejection in the Holyheld app. There are only three possible outcomes of any request:

  1. { success: true } or { success: true, hash: '0x...' } if the request has been confirmed by the user and processed
  2. { success: false } if the request has been declined by the user
  3. An error if request was not processed, timed out, or HTTP request was not returned as OK

Call watchRequestId immediately after requestOnRamp returns. Prompt the user to open the Holyheld app; they have 3 minutes to confirm. If the promise rejects with a timeout error, the request may still be pending — retain the requestUid and consider retrying watchRequestId.

Usage

typescript
const data = await holyheldSDK.evm.onRamp.watchRequestId(
  requestUid,
  options
);

Parameters

ParameterTypeRequiredDescription
requestUidstringYesThe request ID returned by requestOnRamp.
options.timeoutnumberNoMaximum time in milliseconds to wait for user confirmation. Defaults to the SDK's internal timeout. Recommended: 180_000 (3 minutes).
options.waitForTransactionHashbooleanNoIf true, the promise waits until the on-chain transaction hash is available before resolving. Default: false.

requestUid

ID of the on-ramp request created by requestOnRamp

  • Type: String
typescript
const data = await holyheldSDK.evm.onRamp.watchRequestId(
  requestUid, 
  options // optional
);

options (optional)

  • Type: WatchOnRampRequestIdOptions
typescript
const data = await holyheldSDK.evm.onRamp.watchRequestId(
  requestUid,
  options 
);
typescript
type WatchOnRampRequestIdOptions = {
  timeout?: number;
  waitForTransactionHash?: boolean;
};

Returns

typescript
type WatchOnRampResult = {
  success: boolean;
  hash?: string;
}

success

Successful or not

  • Type: Boolean
typescript
type WatchOnRampResult = {
  success: boolean; 
  hash?: string;
}

hash (optional)

Transaction hash. Present if waitForTransactionHash is true in request options and success is true

  • Type: string
typescript
type WatchOnRampResult = {
  success: boolean;
  hash?: string; 
}