Verxio Protocol

Create Voucher Collection

Create a collection to organize vouchers by merchant and type. You can either provide a pre-uploaded metadata URI or provide an image buffer and filename to auto-upload the image and generate metadata.

1. Using a Pre-uploaded Metadata URI

import { createVoucherCollection } from '@verxioprotocol/core'
import { generateSigner } from '@metaplex-foundation/umi'

const result = await createVoucherCollection(context, {
  collectionName: 'Summer Sale Vouchers',
  collectionMetadataUri: 'https://arweave.net/...', // Already uploaded metadata
  updateAuthority: generateSigner(context.umi),
  metadata: {
    merchantName: 'Coffee Brew',
    description: 'Summer sale vouchers for loyal customers',
    terms: 'Valid until August 31st, 2024',
  },
})

2. Uploading an Image and Generating Metadata

import { createVoucherCollection } from '@verxioprotocol/core'
import { generateSigner } from '@metaplex-foundation/umi'
import fs from 'fs'

const imageBuffer = fs.readFileSync('voucher-collection.png')
const result = await createVoucherCollection(context, {
  collectionName: 'Summer Sale Vouchers',
  imageBuffer, // Buffer of your image
  imageFilename: 'voucher-collection.png',
  updateAuthority: generateSigner(context.umi),
  metadata: {
    merchantName: 'Coffee Brew',
    description: 'Summer sale vouchers for loyal customers',
    terms: 'Valid until August 31st, 2024',
  },
})
// The protocol will upload the image, generate metadata, and use the resulting URI

Return Value

{
  collection: KeypairSigner,  // Collection signer
  signature: string,         // Transaction signature
  updateAuthority: KeypairSigner // Update authority for the collection
}

Merchant Identification

In the voucher system, merchants are identified using a merchantId string rather than a blockchain address. This provides flexibility for:

  • Off-chain Integration: Merchants can use their existing business identifiers
  • Multi-chain Support: Same merchant can operate across different networks
  • Privacy: Merchant identity can be managed separately from blockchain addresses
  • Scalability: No need to manage multiple wallet addresses per merchant

Example Merchant IDs

coffee_brew_merchant_001 - Coffee shop chain
retail_store_main_street - Local retail store
online_shop_electronics - Online electronics store
restaurant_franchise_west - Restaurant franchise location