Skip to content

Grapevine SDK

Easy-to-use SDK for the Grapevine API. Create and manage content feeds with built-in authentication and x402 micropayment handling.

Features

Simple API - Clean, intuitive interface for all operations
🔐 Flexible Authentication - Private keys or wagmi wallet integration
💰 Transparent Payments - x402 micropayments handled automatically
🎯 Smart Defaults - Auto-detect network, MIME types, and more
📦 Batch Operations - Efficiently handle multiple entries
⚛️ React Integration - Built-in hooks for React apps with wagmi

📝 Full TypeScript Support - Complete type definitions included
🌐 Browser Compatible - Works in Node.js and browser environments

Installation

Bun
bun add @pinata/grapevine-sdk

Quick Start

import { GrapevineClient } from '@pinata/grapevine-sdk';
 
// Initialize the SDK
const grapevine = new GrapevineClient({
  network: 'testnet',  // or 'mainnet'
  privateKey: process.env.PRIVATE_KEY
});
 
// Create a feed (one line!)
const feed = await grapevine.feeds.create({
  name: 'My Content Feed',
  description: 'Created with Grapevine SDK',
  tags: ['content', 'marketplace']
});
 
// Add an entry (auto-detects MIME type)
const entry = await grapevine.entries.create(feed.id, {
  content: 'Hello World!',
  title: 'First Entry',
  is_free: true
});
 
console.log(`Feed created: ${feed.id}`);
console.log(`Entry created: ${entry.id}`);

SDK Resources

Client Setup

Feeds

Entries

Wallets

Transactions

Leaderboards

Categories

Client Utilities

Client Utility Methods

The GrapevineClient provides utility methods to inspect the current configuration:

const grapevine = new GrapevineClient({
  network: 'testnet',
  privateKey: process.env.PRIVATE_KEY
});
 
// Get wallet address
const address = grapevine.getWalletAddress();
console.log('Wallet:', address); // "0x742d35..."
 
// Get network 
const network = grapevine.getNetwork();
console.log('Network:', network); // "base-sepolia"
 
// Check if testnet
const isTestnet = grapevine.isTestNetwork();
console.log('Is testnet:', isTestnet); // true

getWalletAddress(): string

Returns the wallet address for the authenticated client.

const address = grapevine.getWalletAddress();
// Returns: "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"

Returns: The wallet address as a hex string, or throws if not authenticated.

getNetwork(): string

Returns the blockchain network name the client is configured for.

const network = grapevine.getNetwork();
// Returns: "base-sepolia" (testnet) or "base" (mainnet)

Returns: Network identifier string.

isTestNetwork(): boolean

Checks if the client is configured for a test network.

const isTest = grapevine.isTestNetwork();
// Returns: true for testnet, false for mainnet

Returns: true if using testnet, false if using mainnet.

Additional Utility Methods

The GrapevineClient provides several utility methods for common operations:

categories.getAll(): Promise<Category[]>

Retrieve all available content categories.

const categories = await grapevine.categories.getAll();
categories.forEach(category => {
  console.log(`${category.name}: ${category.description || 'No description'}`);
});

Returns: Array of Category objects with id, name, and optional description.

See: Complete categories documentation for detailed usage examples.

Examples

See complete working examples in the Examples section.

Resources