Profile Offers
How to retrieve a user's NFT offers from the Wayup Marketplace
Introduction
This guide demonstrates how to retrieve all active offers made by a specific wallet address on the Wayup Marketplace. This endpoint is useful for building user profiles, dashboards, or portfolio trackers that show what offers a user currently has placed on NFTs.
Requirements
A valid Cardano wallet address
API Request Structure
Configuration
// API endpoint for Wayup Marketplace
const BASE_URL = "https://prod.api.ada-anvil.app/marketplace/api";
// Wallet address to query offers for
const WALLET_ADDRESS = "addr1qx33ycd2ymg02dxh6vnnf8dsk54l8ranr9cfjk9qrlj3309c69jc4n8h3uvnczncaqu2sm03pl99h99n75uvtl3mhv0q3z8s8m";Type Definitions
interface ProfileOffersRequest {
address: string;
limit?: number;
cursor?: string;
}
interface AssetWithUnit {
policyId: string;
name: string;
assetName: string;
onChainAssetName: string;
image: string;
media?: string;
unit: string;
}
interface Offer {
policyId: string;
assetName: string;
offerAmount: string;
txHash: string;
outputIndex: number;
ownerAddress: string;
ownerStakeKeyhash: string;
createdAt: string;
asset?: AssetWithUnit | null;
}
interface ProfileOffersResponse {
results: Offer[];
pageState: string | null;
}Implementation
Step 1: Prepare the Request Parameters
First, prepare the parameters for your API request:
Available Parameters
address
string
Yes
Wallet address to query offers for
limit
number
No
Max items per page. Default 10.
cursor
string
No
Pagination cursor from a previous response. Use it only when requesting additional pages; omit it for the first page or if you only need one page.
Step 1: Build the Request URL
First, build the URL with the required parameters:
Step 2: Execute the Request
Send the request to the API:
Step 3: Process the Response
Parse the API response:
Step 4: Display the Results
Process and display the offers data:
Step 5: Handle Pagination
Handle pagination for large result sets:
Running the Example
Example Output
The Complete File
Best Practices
Input Validation: Always validate the wallet address before making the API call.
Error Handling: Implement proper error handling for network issues or invalid responses.
Pagination: Always handle pagination for users with many offers.
Asset Details: Be prepared to handle cases where asset details might not be available.
Offer Status: Remember that these are only active offers; expired or accepted offers will not appear.
End-to-End Flow
Obtain a wallet address from your user
Query the
/get-profile-offersendpoint with the wallet addressDisplay the offer results (policy ID, asset name, offer amount, etc.)
Display asset details when available (name, media)
Implement pagination using the returned pageState if there are more results
Provide options to cancel offers or view the NFTs being offered for
Last updated
Was this helpful?

