@vibeiao/sdk 0.1.5 → 0.1.7

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.
package/dist/index.d.ts CHANGED
@@ -850,7 +850,7 @@ declare class ReviewGate {
850
850
  assertClear(listingId: string, wallet: string): void;
851
851
  }
852
852
 
853
- declare const compareVersions: (currentVersion: string, latestVersion: string) => 1 | 0 | -1;
853
+ declare const compareVersions: (currentVersion: string, latestVersion: string) => 0 | 1 | -1;
854
854
  declare const buildSdkUpdateCommand: (packageName?: string) => string;
855
855
  declare const checkForSdkUpdate: (options?: SdkUpdateCheckOptions) => Promise<SdkUpdateStatus>;
856
856
  declare const checkForSdkUpdatePolicy: (options: SdkUpdatePolicyCheckOptions) => Promise<SdkUpdateStatus>;
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ var buildOwnerTransferMessage = (listingId, newOwnerWallet, nonce) => `VIBEIAO-O
36
36
  var buildMemoryPingMessage = (listingId, timestamp, nonce) => nonce ? `VIBEIAO-MEMORY-PING:${listingId}:${timestamp}:${nonce}` : `VIBEIAO-MEMORY-PING:${listingId}:${timestamp}`;
37
37
  var buildListingVersionMessage = (listingId, version, timestamp) => `VIBEIAO-LISTING-VERSION:${listingId}:${version}:${timestamp}`;
38
38
  var buildReviewResponseMessage = (reviewId, status, timestamp) => `VIBEIAO-REVIEW-RESPONSE:${reviewId}:${status}:${timestamp}`;
39
- var buildReviewPrompt = () => "After using this tool once, provide a 1-5 star rating and a short comment (what worked, what failed, what to improve).";
39
+ var buildReviewPrompt = () => "After each paid use, submit a 1-5 star rating and a short comment (what worked, what failed, what to improve). Reviews improve discoverability, trust, and repeat demand.";
40
40
  var buildReviewRequired = (listingId, redeemSignature, appVersion, options = {}) => {
41
41
  const base = withTrailingSlash(options.baseUrl || DEFAULT_API_BASE);
42
42
  return {
@@ -70,7 +70,7 @@ var ReviewGate = class {
70
70
  var DEFAULT_API_BASE = "https://api.vibeiao.com";
71
71
  var DEFAULT_WEB_BASE = "https://vibeiao.com";
72
72
  var DEFAULT_SDK_PACKAGE = "@vibeiao/sdk";
73
- var DEFAULT_SDK_VERSION = "0.1.4" ? "0.1.4" : "0.1.4";
73
+ var DEFAULT_SDK_VERSION = "0.1.5" ? "0.1.5" : "0.1.4";
74
74
  var DEFAULT_SDK_REGISTRY = "https://registry.npmjs.org";
75
75
  var DEFAULT_SDK_POLICY_PATH = "/v1/sdk/policy";
76
76
  var DEFAULT_SDK_CHECK_INTERVAL_MS = 1e3 * 60 * 30;
@@ -0,0 +1,188 @@
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
+ ticketPrice: number;
33
+ targetRevenue: number;
34
+ }
35
+ interface ListingRecord {
36
+ id: string;
37
+ listing_type: ListingType;
38
+ status: ListingStatus;
39
+ name: string;
40
+ tagline: string;
41
+ description: string;
42
+ category: string;
43
+ app_version?: string | null;
44
+ rating_avg?: number | null;
45
+ rating_count?: number | null;
46
+ image_url?: string | null;
47
+ product_url: string;
48
+ endpoint_url?: string | null;
49
+ manifest_url?: string | null;
50
+ memory_root?: string | null;
51
+ memory_last_seen_at?: string | null;
52
+ memory_status?: 'fresh' | 'stale' | 'unknown' | null;
53
+ price_usdc?: number | null;
54
+ price_updated_at?: string | null;
55
+ creator_wallet_id?: string | null;
56
+ creator_wallet_address?: string | null;
57
+ revenue_wallet_id?: string | null;
58
+ revenue_wallet_address?: string | null;
59
+ llm_required?: boolean | null;
60
+ llm_billing_enabled?: boolean | null;
61
+ llm_provider?: string | null;
62
+ runtime?: string | null;
63
+ runtime_config?: Record<string, unknown> | null;
64
+ buyback_bps?: number | null;
65
+ ticket_price: number;
66
+ target_revenue: number;
67
+ revenue: number;
68
+ tickets_sold: number;
69
+ token_address?: string | null;
70
+ token_symbol?: string | null;
71
+ buyback_total: number;
72
+ platform_buyback_total?: number | null;
73
+ listing_seed?: string | null;
74
+ chain_listing_account?: string | null;
75
+ created_at: string;
76
+ updated_at: string;
77
+ }
78
+ interface ListingReviewRecord {
79
+ id: string;
80
+ listing_id: string;
81
+ reviewer_wallet_id: string;
82
+ reviewer_wallet_address?: string | null;
83
+ rating: number;
84
+ comment: string;
85
+ app_version: string;
86
+ redeem_signature?: string | null;
87
+ redeem_block_time?: number | null;
88
+ agent_response_status?: string | null;
89
+ agent_response_comment?: string | null;
90
+ agent_response_wallet_address?: string | null;
91
+ agent_responded_at?: string | null;
92
+ created_at: string;
93
+ }
94
+ interface ClaimResponse {
95
+ id: string;
96
+ nonce: string;
97
+ purpose: ClaimPurpose;
98
+ status: string;
99
+ expires_at: string;
100
+ message: string;
101
+ }
102
+ interface VerifiedClaimResponse {
103
+ id: string;
104
+ nonce: string;
105
+ purpose: ClaimPurpose;
106
+ status: string;
107
+ verified_at: string;
108
+ }
109
+ interface TicketVerifyResponse {
110
+ isValid: boolean;
111
+ listingId?: string;
112
+ listingAccount?: string;
113
+ wallet?: string;
114
+ receipt?: string;
115
+ count?: string;
116
+ lastPurchasedAt?: string;
117
+ lastRedeemedAt?: string;
118
+ source?: 'receipt' | 'redeem' | 'ticket';
119
+ reason?: string;
120
+ minCount?: number;
121
+ maxAgeSec?: number | null;
122
+ blockTime?: number | null;
123
+ reviewRequired?: boolean;
124
+ reviewListingId?: string;
125
+ reviewSignature?: string;
126
+ reviewAppVersion?: string;
127
+ reviewUrl?: string;
128
+ error?: string;
129
+ }
130
+
131
+ type WalletLike = {
132
+ publicKey: PublicKey;
133
+ signTransaction: <T>(tx: T) => Promise<T>;
134
+ signAllTransactions: <T>(txs: T[]) => Promise<T[]>;
135
+ };
136
+ type WalletAdapterLike = {
137
+ publicKey: PublicKey;
138
+ signTransaction: <T>(tx: T) => Promise<T>;
139
+ signAllTransactions?: <T>(txs: T[]) => Promise<T[]>;
140
+ };
141
+ type SignerLike = WalletAdapterLike | Keypair;
142
+ interface ProtocolConfig {
143
+ platformTreasury: string;
144
+ buybackTreasury: string;
145
+ }
146
+ interface VibePaymentsOptions {
147
+ connection: Connection;
148
+ wallet: SignerLike;
149
+ programId: string | PublicKey;
150
+ commitment?: 'processed' | 'confirmed' | 'finalized';
151
+ }
152
+ interface PurchaseTicketInput {
153
+ listingAccount: string;
154
+ creatorWallet: string;
155
+ revenueWallet: string;
156
+ platformTreasury?: string;
157
+ buybackTreasury?: string;
158
+ }
159
+ interface PurchaseListingInput {
160
+ listing: ListingRecord;
161
+ platformTreasury?: string;
162
+ buybackTreasury?: string;
163
+ }
164
+ declare const toLamports: (sol: number) => any;
165
+ declare const toSol: (lamports: number | bigint) => number;
166
+ declare const deriveListingPda: (creator: PublicKey, seed: Uint8Array, programId: PublicKey) => [PublicKey, number];
167
+ declare const deriveTicketReceiptPda: (listing: PublicKey, buyer: PublicKey, programId: PublicKey) => [PublicKey, number];
168
+ declare const deriveConfigPda: (programId: PublicKey) => [PublicKey, number];
169
+ declare const fetchSolBalance: (connection: Connection, wallet: string | PublicKey) => Promise<number>;
170
+ declare const fetchTokenBalance: (connection: Connection, wallet: string | PublicKey, mint: string | PublicKey) => Promise<number>;
171
+ declare const fetchTokenBalances: (connection: Connection, wallet: string | PublicKey, mints: Array<string | PublicKey>) => Promise<Record<string, number>>;
172
+ declare class VibePayments {
173
+ private connection;
174
+ private wallet;
175
+ private programId;
176
+ private commitment;
177
+ constructor(options: VibePaymentsOptions);
178
+ getProgramId(): string;
179
+ getProgram(): Program<Idl>;
180
+ fetchProtocolConfig(): Promise<ProtocolConfig>;
181
+ getTicketReceiptAddress(listingAccount: string, buyer?: PublicKey): string;
182
+ purchaseTicket(input: PurchaseTicketInput): Promise<string>;
183
+ purchaseTicketForListing(input: PurchaseListingInput): Promise<string>;
184
+ redeemTicket(listingAccount: string): Promise<string>;
185
+ updateTicketPrice(listingAccount: string, priceSol: number): Promise<string>;
186
+ }
187
+
188
+ 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 };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@vibeiao/sdk",
3
3
  "private": false,
4
4
  "type": "module",
5
- "version": "0.1.5",
5
+ "version": "0.1.7",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "exports": {