@vibeiao/sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,189 @@
1
+ import { Program, Idl } from '@coral-xyz/anchor';
2
+ import { Connection, PublicKey, Keypair } from '@solana/web3.js';
3
+
4
+ type ListingType = 'agent' | 'human';
5
+ type ListingStatus = 'grind' | 'ipo' | 'web2';
6
+ type ClaimPurpose = 'agent_register' | 'owner_claim' | 'mission';
7
+
8
+ interface ListingInput {
9
+ listingType: ListingType;
10
+ name: string;
11
+ tagline: string;
12
+ description: string;
13
+ category: string;
14
+ priceUsdc: number;
15
+ appVersion?: string;
16
+ imageUrl?: string;
17
+ productUrl: string;
18
+ endpointUrl?: string;
19
+ manifestUrl?: string;
20
+ listingSeed?: string;
21
+ chainListingAccount?: string;
22
+ walletMode?: 'single' | 'multisig';
23
+ agentWallet?: string;
24
+ ownerWallet?: string;
25
+ revenueWallet?: string;
26
+ ethWallet?: string;
27
+ llmRequired?: boolean;
28
+ llmBillingEnabled?: boolean;
29
+ llmProvider?: string;
30
+ runtime?: 'openrouter' | null;
31
+ runtimeConfig?: Record<string, unknown>;
32
+ buybackBps?: number;
33
+ ticketPrice: number;
34
+ targetRevenue: number;
35
+ }
36
+ interface ListingRecord {
37
+ id: string;
38
+ listing_type: ListingType;
39
+ status: ListingStatus;
40
+ name: string;
41
+ tagline: string;
42
+ description: string;
43
+ category: string;
44
+ app_version?: string | null;
45
+ rating_avg?: number | null;
46
+ rating_count?: number | null;
47
+ image_url?: string | null;
48
+ product_url: string;
49
+ endpoint_url?: string | null;
50
+ manifest_url?: string | null;
51
+ memory_root?: string | null;
52
+ memory_last_seen_at?: string | null;
53
+ memory_status?: 'fresh' | 'stale' | 'unknown' | null;
54
+ price_usdc?: number | null;
55
+ price_updated_at?: string | null;
56
+ creator_wallet_id?: string | null;
57
+ creator_wallet_address?: string | null;
58
+ revenue_wallet_id?: string | null;
59
+ revenue_wallet_address?: string | null;
60
+ llm_required?: boolean | null;
61
+ llm_billing_enabled?: boolean | null;
62
+ llm_provider?: string | null;
63
+ runtime?: string | null;
64
+ runtime_config?: Record<string, unknown> | null;
65
+ buyback_bps?: number | null;
66
+ ticket_price: number;
67
+ target_revenue: number;
68
+ revenue: number;
69
+ tickets_sold: number;
70
+ token_address?: string | null;
71
+ token_symbol?: string | null;
72
+ buyback_total: number;
73
+ platform_buyback_total?: number | null;
74
+ listing_seed?: string | null;
75
+ chain_listing_account?: string | null;
76
+ created_at: string;
77
+ updated_at: string;
78
+ }
79
+ interface ListingReviewRecord {
80
+ id: string;
81
+ listing_id: string;
82
+ reviewer_wallet_id: string;
83
+ reviewer_wallet_address?: string | null;
84
+ rating: number;
85
+ comment: string;
86
+ app_version: string;
87
+ redeem_signature?: string | null;
88
+ redeem_block_time?: number | null;
89
+ agent_response_status?: string | null;
90
+ agent_response_comment?: string | null;
91
+ agent_response_wallet_address?: string | null;
92
+ agent_responded_at?: string | null;
93
+ created_at: string;
94
+ }
95
+ interface ClaimResponse {
96
+ id: string;
97
+ nonce: string;
98
+ purpose: ClaimPurpose;
99
+ status: string;
100
+ expires_at: string;
101
+ message: string;
102
+ }
103
+ interface VerifiedClaimResponse {
104
+ id: string;
105
+ nonce: string;
106
+ purpose: ClaimPurpose;
107
+ status: string;
108
+ verified_at: string;
109
+ }
110
+ interface TicketVerifyResponse {
111
+ isValid: boolean;
112
+ listingId?: string;
113
+ listingAccount?: string;
114
+ wallet?: string;
115
+ receipt?: string;
116
+ count?: string;
117
+ lastPurchasedAt?: string;
118
+ lastRedeemedAt?: string;
119
+ source?: 'receipt' | 'redeem' | 'ticket';
120
+ reason?: string;
121
+ minCount?: number;
122
+ maxAgeSec?: number | null;
123
+ blockTime?: number | null;
124
+ reviewRequired?: boolean;
125
+ reviewListingId?: string;
126
+ reviewSignature?: string;
127
+ reviewAppVersion?: string;
128
+ reviewUrl?: string;
129
+ error?: string;
130
+ }
131
+
132
+ type WalletLike = {
133
+ publicKey: PublicKey;
134
+ signTransaction: <T>(tx: T) => Promise<T>;
135
+ signAllTransactions: <T>(txs: T[]) => Promise<T[]>;
136
+ };
137
+ type WalletAdapterLike = {
138
+ publicKey: PublicKey;
139
+ signTransaction: <T>(tx: T) => Promise<T>;
140
+ signAllTransactions?: <T>(txs: T[]) => Promise<T[]>;
141
+ };
142
+ type SignerLike = WalletAdapterLike | Keypair;
143
+ interface ProtocolConfig {
144
+ platformTreasury: string;
145
+ buybackTreasury: string;
146
+ }
147
+ interface VibePaymentsOptions {
148
+ connection: Connection;
149
+ wallet: SignerLike;
150
+ programId: string | PublicKey;
151
+ commitment?: 'processed' | 'confirmed' | 'finalized';
152
+ }
153
+ interface PurchaseTicketInput {
154
+ listingAccount: string;
155
+ creatorWallet: string;
156
+ revenueWallet: string;
157
+ platformTreasury?: string;
158
+ buybackTreasury?: string;
159
+ }
160
+ interface PurchaseListingInput {
161
+ listing: ListingRecord;
162
+ platformTreasury?: string;
163
+ buybackTreasury?: string;
164
+ }
165
+ declare const toLamports: (sol: number) => any;
166
+ declare const toSol: (lamports: number | bigint) => number;
167
+ declare const deriveListingPda: (creator: PublicKey, seed: Uint8Array, programId: PublicKey) => [PublicKey, number];
168
+ declare const deriveTicketReceiptPda: (listing: PublicKey, buyer: PublicKey, programId: PublicKey) => [PublicKey, number];
169
+ declare const deriveConfigPda: (programId: PublicKey) => [PublicKey, number];
170
+ declare const fetchSolBalance: (connection: Connection, wallet: string | PublicKey) => Promise<number>;
171
+ declare const fetchTokenBalance: (connection: Connection, wallet: string | PublicKey, mint: string | PublicKey) => Promise<number>;
172
+ declare const fetchTokenBalances: (connection: Connection, wallet: string | PublicKey, mints: Array<string | PublicKey>) => Promise<Record<string, number>>;
173
+ declare class VibePayments {
174
+ private connection;
175
+ private wallet;
176
+ private programId;
177
+ private commitment;
178
+ constructor(options: VibePaymentsOptions);
179
+ getProgramId(): string;
180
+ getProgram(): Program<Idl>;
181
+ fetchProtocolConfig(): Promise<ProtocolConfig>;
182
+ getTicketReceiptAddress(listingAccount: string, buyer?: PublicKey): string;
183
+ purchaseTicket(input: PurchaseTicketInput): Promise<string>;
184
+ purchaseTicketForListing(input: PurchaseListingInput): Promise<string>;
185
+ redeemTicket(listingAccount: string): Promise<string>;
186
+ updateTicketPrice(listingAccount: string, priceSol: number): Promise<string>;
187
+ }
188
+
189
+ export { type ClaimPurpose as C, type ListingRecord as L, type ProtocolConfig as P, type SignerLike as S, type TicketVerifyResponse as T, type VerifiedClaimResponse as V, type WalletAdapterLike as W, type ListingType as a, type ListingStatus as b, type ClaimResponse as c, type ListingInput as d, type ListingReviewRecord as e, fetchSolBalance as f, fetchTokenBalance as g, fetchTokenBalances as h, type PurchaseListingInput as i, type PurchaseTicketInput as j, VibePayments as k, type VibePaymentsOptions as l, type WalletLike as m, deriveConfigPda as n, deriveListingPda as o, deriveTicketReceiptPda as p, toSol as q, toLamports as t };
@@ -0,0 +1,3 @@
1
+ import '@coral-xyz/anchor';
2
+ import '@solana/web3.js';
3
+ export { P as ProtocolConfig, i as PurchaseListingInput, j as PurchaseTicketInput, S as SignerLike, k as VibePayments, l as VibePaymentsOptions, W as WalletAdapterLike, m as WalletLike, n as deriveConfigPda, o as deriveListingPda, p as deriveTicketReceiptPda, f as fetchSolBalance, g as fetchTokenBalance, h as fetchTokenBalances, t as toLamports, q as toSol } from './solana-3VMnBZH6.js';
package/dist/solana.js ADDED
@@ -0,0 +1,22 @@
1
+ import {
2
+ VibePayments,
3
+ deriveConfigPda,
4
+ deriveListingPda,
5
+ deriveTicketReceiptPda,
6
+ fetchSolBalance,
7
+ fetchTokenBalance,
8
+ fetchTokenBalances,
9
+ toLamports,
10
+ toSol
11
+ } from "./chunk-OUGOOS3F.js";
12
+ export {
13
+ VibePayments,
14
+ deriveConfigPda,
15
+ deriveListingPda,
16
+ deriveTicketReceiptPda,
17
+ fetchSolBalance,
18
+ fetchTokenBalance,
19
+ fetchTokenBalances,
20
+ toLamports,
21
+ toSol
22
+ };
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@vibeiao/sdk",
3
+ "private": false,
4
+ "type": "module",
5
+ "version": "0.1.0",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": "./dist/index.js",
10
+ "./solana": "./dist/solana.js",
11
+ "./self-reliance": "./dist/selfReliance.js",
12
+ "./memory": "./dist/memory.js"
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md"
17
+ ],
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "scripts": {
22
+ "build": "tsup src/index.ts src/memory.ts src/selfReliance.ts src/solana.ts --format esm --dts --tsconfig tsconfig.json --out-dir dist"
23
+ },
24
+ "dependencies": {
25
+ "@coral-xyz/anchor": "^0.30.1",
26
+ "@solana/web3.js": "^1.98.0",
27
+ "bn.js": "^5.2.1"
28
+ },
29
+ "devDependencies": {
30
+ "tsup": "^8.5.1"
31
+ }
32
+ }