Submit Transaction
How to submit signed transactions to the Wayup Marketplace
Introduction
This guide demonstrates how to submit a signed transaction to the Wayup Marketplace using the API. This step comes after you've built and signed a transaction, such as for buying an NFT, making an offer, or creating a listing.
Requirements
A transaction hex from a previous
/build-tx
callA signature from your wallet after signing the transaction (optional). See Sign Transactions
API Request Structure
Configuration
// API endpoint for Wayup Marketplace
const BASE_URL = "https://prod.api.ada-anvil.app/marketplace/api";
// Replace these with your actual signature and transaction hex
// The signature comes from your wallet after signing the transaction hex
// The transaction is the hex output from a previous build-tx call
const SIGNATURE = "SIGNATURE";
const TRANSACTION = "TRANSACTION";
Type Definitions
interface SubmitPayload {
signature: string;
transaction: string;
}
Implementation
Step 1: Prepare the Submission Payload
First, prepare the payload with your signature and transaction hex:
// Step 1: Prepare the payload with signature and transaction
console.log("Preparing submission payload...");
const payload = {
signature: SIGNATURE.trim(),
transaction: TRANSACTION.trim(),
};
Step 2: Submit the Transaction
Next, submit the transaction to the API:
// Step 2: Submit the transaction
console.log("Submitting signed transaction...");
const response = await fetch(`${BASE_URL}/submit`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});
Step 3: Process the Response
Finally, process the response from the API:
// Step 3: Process the response
const result = await response.json();
console.log("Transaction submission result:", result);
// Next step: Check the transaction status on chain explorers
console.log("Check transaction status on Cardanoscan or similar explorer");
Running the Example
deno run --allow-net submit-tx.ts
Example Output
Preparing submission payload...
Submitting signed transaction...
Transaction submission result: {
result: {
data: {
txHash: "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
}
}
}
Check transaction status on Cardanoscan or similar explorer
The Complete File
Best Practices
Transaction Verification: Always verify the transaction hex before signing
Signature Format: Ensure the signature is properly formatted from your wallet
Error Handling: Check the response for any errors before assuming success
Chain Validation: Always verify the transaction was confirmed on the blockchain
End-to-End Flow
Build a transaction using a specific endpoint (buy, create listing, make offer)
Sign the transaction with your wallet
Submit the signed transaction using this guide
Verify the transaction on a blockchain explorer
Last updated
Was this helpful?