$CRE8 is launching on May 22nd. Beware of fake launches.
CRE8 Finance
CRE8 Finance
  • Introduction
  • Getting Started
    • The $8+ Trillion Service Economy
    • Tokenized Gigs: Turning Services into SPL Tokens
  • Smart Contract Architecture
    • Token Minting and Management
    • Escrow and Service Contract Logic
  • Gig Flow: From Listing to Escrow to Settlement
    • 1. Service Listing & Tokenization
    • 2. Buyer Purchases the Service (Escrow Initiation)
    • 3. Service Delivery Off-Chain
    • 4. Verification & Escrow Settlement
    • 5. Ratings and Reputation
    • Summary of the Flow with an Example
  • Platform Features, Applications and User Tools
    • Web App and Mobile Apps
      • Integrated Chat and Communication
      • Reviews and Ratings System
      • User Dashboard and Analytics
      • Wallet Integration (Non-Custodial)
      • Notifications and Real-Time Updates
      • Additional Features
  • $CRE8 Token
    • Utility Overview
      • Medium of Exchange
      • Platform Fee Currency
      • Staking and Rewards
      • Governance
      • Incentives and Rewards
      • Collateral / DeFi Utility
  • Fee Discounts
  • Tokenomics and Distribution
  • Staking Mechanism
  • Governance Rights
  • Summary of $CRE8 Benefits
  • APIs & SDK
    • Integrating with CRE8
    • API Overview
    • SDKs for Different Environments
    • Detailed API Endpoints (Examples)
    • Example Use Cases for APIs/SDKs
    • API/SDK Security and Rate Limiting
    • Developer Portal and Documentation
  • Developer Section
    • Examples, Formulas, and Integration Flows
    • Creating a Tokenized Service (via SDK)
    • Calculating Fees and Discounts
    • Escrow Milestone Release Calculation
    • Integration Flow: Web App Using CRE8 APIs
    • Architectural Diagram
    • Querying On-Chain Data
    • Developer Tips
  • Other Products
    • CRE8 Wallet
      • Wallet Architecture and Key Management
      • Integrated Features
      • Security Measures
      • Interaction with the Platform
      • Supported Assets
      • Non-Custodial Philosophy
  • The CRE8 Card
    • Concept Overview
    • How it works
    • Integration with Platform
    • Compliance for Card
    • Timeline and Status
    • Potential Impact of CRE8 Card
  • Community & FAQ
    • Glossary
    • FAQ
    • Legal
    • Privacy Policy
    • CRE8 Socials
Powered by GitBook

@CRE8 Technologies LLC

On this page
  1. Developer Section

Creating a Tokenized Service (via SDK)

Let’s walk through a simple code example using a hypothetical JavaScript SDK to create a new service listing and then handle a purchase. This example assumes the existence of a cre8-sdk package that abstracts the API and blockchain interactions

// Import the CRE8 SDK (assume it's installed from npm)
const Cre8SDK = require('cre8-sdk');

// Initialize SDK (could include network config, API keys, etc.)
const cre8 = new Cre8SDK({
    network: 'mainnet-beta',  // Solana network
});

// 1. Authenticate (here using a wallet private key for simplicity)
await cre8.auth.loginWithPrivateKey(process.env.SOLANA_PRIVATE_KEY);
// In a real app, you might use cre8.auth.loginWithWallet(wallet) for wallet adapter integration

// 2. Create a new service listing
let newListing = await cre8.listings.create({
    title: "Logo Design Package",
    description: "Professional logo design with 3 revisions included. Delivered in 7 days.",
    price: 50,
    currency: "USDC",         // using USDC as the currency for price
    category: "Design",
    delivery_time: 7,         // days
});
console.log("New listing created with ID:", newListing.id);
console.log("Service Token Mint Address:", newListing.tokenMint);

// 3. Query the marketplace for listings (e.g., to display or search)
let designListings = await cre8.marketplace.search({ category: "Design", sortBy: "price_asc" });
console.log(`Found ${designListings.length} design services.`);

// 4. Simulate a buyer purchasing the service
// (In a real scenario, buyer would use their own instance/auth of the SDK)
let order = await cre8.orders.buy({
    listingId: newListing.id,
    buyerWallet: buyerWalletAddress, // assuming buyerWalletAddress is known or same user for demo
    paymentToken: "USDC"
});
console.log("Purchase initiated, escrow account:", order.escrowAccount);

// 5. Seller marks the service as delivered
await cre8.orders.markDelivered({ orderId: order.id });
// 6. Buyer confirms the delivery
await cre8.orders.confirmDelivery({ orderId: order.id });

console.log("Order completed. Funds released to seller.");

In this snippet:

  • We logged in (for scripting, using a private key directly; for real apps, use secure wallet integrations).

  • Created a listing for a logo design service. The SDK call likely handled minting the SPL token for the service and registering the listing on the marketplace.

  • Searched the marketplace for demonstration (this could be used to build a listing page in a UI).

  • Simulated a purchase: The buy method would internally create the escrow transaction (transferring funds from buyer to the escrow contract and reserving the token).

  • Marked delivery and confirmation, which triggers the escrow release. In practice, the buyer’s confirmation might happen in their app, not via the seller’s SDK instance, but shown here sequentially for completeness.

PreviousExamples, Formulas, and Integration FlowsNextCalculating Fees and Discounts

Last updated 3 days ago

Page cover image