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
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.
Last updated