/ tableland / config.ts
config.ts
 1  /**
 2   * Tableland Configuration
 3   * Centralized configuration for all Tableland operations
 4   */
 5  
 6  export const TABLELAND_CONFIG = {
 7    // Network configuration
 8    networks: {
 9      'optimism-sepolia': {
10        chainId: 11155420,
11        rpcUrl: process.env.OPTIMISM_SEPOLIA_RPC_URL || 'https://sepolia.optimism.io',
12        tablelandHost: 'https://testnets.tableland.network'
13      },
14      'base-sepolia': {
15        chainId: 84532,
16        rpcUrl: process.env.BASE_SEPOLIA_RPC_URL || 'https://sepolia.base.org',
17        tablelandHost: 'https://testnets.tableland.network'
18      },
19      'base-mainnet': {
20        chainId: 8453,
21        rpcUrl: process.env.BASE_MAINNET_RPC_URL || 'https://mainnet.base.org',
22        tablelandHost: 'https://tableland.network'
23      },
24      'optimism-mainnet': {
25        chainId: 10,
26        rpcUrl: process.env.OPTIMISM_MAINNET_RPC_URL || 'https://mainnet.optimism.io',
27        tablelandHost: 'https://tableland.network'
28      }
29    },
30    
31    // Table schemas with versioning
32    schemas: {
33      songs: {
34        version: 'v4',
35        prefix: 'karaoke_songs',
36        schema: `(
37          id INTEGER PRIMARY KEY,
38          isrc TEXT NOT NULL,
39          iswc TEXT,
40          title TEXT NOT NULL,
41          artist TEXT NOT NULL,
42          duration INTEGER,
43          stems TEXT,
44          language TEXT DEFAULT 'en',
45          genius_id INTEGER,
46          lrclib_id INTEGER,
47          genius_slug TEXT,
48          streaming_links TEXT,
49          artwork_hash TEXT,
50          translations TEXT,
51          updated_at INTEGER
52        )`
53      },
54      user_history: {
55        version: 'v1',
56        prefix: 'karaoke_history',
57        schema: `(
58          id INTEGER PRIMARY KEY,
59          user_address TEXT NOT NULL,
60          song_id INTEGER NOT NULL,
61          session_hash TEXT UNIQUE NOT NULL,
62          grade INTEGER,
63          credits_used INTEGER,
64          started_at INTEGER NOT NULL,
65          completed_at INTEGER
66        )`
67      }
68    }
69  }
70  
71  export type TableName = keyof typeof TABLELAND_CONFIG.schemas
72  export type NetworkName = keyof typeof TABLELAND_CONFIG.networks