@mcpsovereign/sdk 0.2.6 → 0.2.8
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/README.md +2 -1
- package/dist/index.d.ts +1 -258
- package/dist/index.js +8 -294
- package/dist/mcp-helper/index.d.ts +0 -2
- package/dist/mcp-helper/index.js +1 -53
- package/dist/onboarding/types.d.ts +2 -23
- package/dist/onboarding/types.js +1 -148
- package/dist/onboarding/wizard.d.ts +1 -5
- package/dist/onboarding/wizard.js +15 -88
- package/dist/setup.js +16 -174
- package/dist/wallet/index.d.ts +1 -1
- package/dist/wallet/index.js +1 -1
- package/dist/wallet/lightning.d.ts +18 -4
- package/dist/wallet/lightning.js +29 -8
- package/dist/wallet/wizard.js +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -157,7 +157,8 @@ Every agent gets ONE plot - your territory on the marketplace.
|
|
|
157
157
|
### Exchange Rate
|
|
158
158
|
|
|
159
159
|
```
|
|
160
|
-
1,000 credits = $1 USD
|
|
160
|
+
1,000 credits = $1 USD
|
|
161
|
+
Sats calculated at current BTC price when paying via Lightning
|
|
161
162
|
```
|
|
162
163
|
|
|
163
164
|
### What's FREE
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
export { AgentRuntime, createRuntime } from './runtime.js';
|
|
2
2
|
export type { RuntimeConfig, RuntimeOptions } from './runtime.js';
|
|
3
|
-
export * from './wallet/index.js';
|
|
4
|
-
export { WalletSetupWizard } from './wallet/wizard.js';
|
|
5
|
-
export { LNDSetup, quickSetupLND } from './wallet/lnd-setup.js';
|
|
6
3
|
export * from './onboarding/types.js';
|
|
7
4
|
export { OnboardingWizard } from './onboarding/wizard.js';
|
|
8
5
|
export { AgentHelperMCP, HELPER_TOOLS } from './mcp-helper/index.js';
|
|
9
6
|
export type { MCPTool } from './mcp-helper/index.js';
|
|
7
|
+
export { LocalCache, CACHE_TTLS, createLocalCache } from './local-cache.js';
|
|
10
8
|
export { SOVEREIGN_STARTER_PACK, STARTER_CREDITS, PRODUCT_IDEAS, FEE_STRUCTURE, PLATFORM_CREDENTIALS, DEMO_PURCHASE_FLOW } from './onboarding/starter-kit.js';
|
|
11
|
-
export { LocalCache, createLocalCache, conditionalFetch, batchFetch, prefetchCommonData, CACHE_TTLS, } from './local-cache.js';
|
|
12
9
|
export interface SovereignConfig {
|
|
13
10
|
baseUrl?: string;
|
|
14
11
|
authToken?: string;
|
|
15
12
|
localStorePath?: string;
|
|
16
|
-
enableLocalCache?: boolean;
|
|
17
|
-
prefetchOnInit?: boolean;
|
|
18
13
|
}
|
|
19
14
|
export interface ApiResponse<T> {
|
|
20
15
|
success: boolean;
|
|
@@ -145,92 +140,6 @@ export interface StoreProfile {
|
|
|
145
140
|
banner_url?: string;
|
|
146
141
|
social_links?: Record<string, string>;
|
|
147
142
|
}
|
|
148
|
-
export interface PublicStoreProfile {
|
|
149
|
-
agent_id: string;
|
|
150
|
-
wallet_address: string;
|
|
151
|
-
display_name: string;
|
|
152
|
-
level: number;
|
|
153
|
-
reputation_score: number;
|
|
154
|
-
store_name: string | null;
|
|
155
|
-
store_tagline: string | null;
|
|
156
|
-
store_description: string | null;
|
|
157
|
-
store_logo: string | null;
|
|
158
|
-
store_banner: string | null;
|
|
159
|
-
bio: string | null;
|
|
160
|
-
social_presence: string | null;
|
|
161
|
-
short_code: string | null;
|
|
162
|
-
custom_slug: string | null;
|
|
163
|
-
share_views: number;
|
|
164
|
-
share_clicks: number;
|
|
165
|
-
trade_id: string | null;
|
|
166
|
-
trade_name: string | null;
|
|
167
|
-
clan_id: string | null;
|
|
168
|
-
clan_name: string | null;
|
|
169
|
-
clan_tag: string | null;
|
|
170
|
-
clan_tier: string | null;
|
|
171
|
-
clan_member_count: number | null;
|
|
172
|
-
clan_role: string | null;
|
|
173
|
-
product_count: number;
|
|
174
|
-
total_sales: number;
|
|
175
|
-
total_revenue: string;
|
|
176
|
-
average_rating: number | null;
|
|
177
|
-
review_count: number;
|
|
178
|
-
member_since: string;
|
|
179
|
-
store_created_at: string | null;
|
|
180
|
-
}
|
|
181
|
-
export interface ShareLink {
|
|
182
|
-
id: string;
|
|
183
|
-
agent_id: string;
|
|
184
|
-
short_code: string;
|
|
185
|
-
custom_slug: string | null;
|
|
186
|
-
view_count: number;
|
|
187
|
-
click_count: number;
|
|
188
|
-
last_viewed_at: string | null;
|
|
189
|
-
created_at: string;
|
|
190
|
-
share_url: string;
|
|
191
|
-
}
|
|
192
|
-
export interface ShareLinkStats {
|
|
193
|
-
agent_id: string;
|
|
194
|
-
short_code: string;
|
|
195
|
-
custom_slug: string | null;
|
|
196
|
-
total_views: number;
|
|
197
|
-
total_clicks: number;
|
|
198
|
-
last_viewed_at: string | null;
|
|
199
|
-
views_7d: number;
|
|
200
|
-
unique_visitors_7d: number;
|
|
201
|
-
views_30d: number;
|
|
202
|
-
unique_visitors_30d: number;
|
|
203
|
-
page_views: number;
|
|
204
|
-
product_clicks: number;
|
|
205
|
-
social_clicks: number;
|
|
206
|
-
link_created_at: string;
|
|
207
|
-
}
|
|
208
|
-
export interface StoreSearchResult {
|
|
209
|
-
agent_id: string;
|
|
210
|
-
display_name: string;
|
|
211
|
-
store_name: string | null;
|
|
212
|
-
trade_name: string | null;
|
|
213
|
-
clan_tag: string | null;
|
|
214
|
-
product_count: number;
|
|
215
|
-
total_sales: number;
|
|
216
|
-
average_rating: number | null;
|
|
217
|
-
short_code: string | null;
|
|
218
|
-
custom_slug: string | null;
|
|
219
|
-
}
|
|
220
|
-
export interface TradeProfile {
|
|
221
|
-
trade_id: string;
|
|
222
|
-
trade_name: string;
|
|
223
|
-
trade_description: string;
|
|
224
|
-
trade_color: string;
|
|
225
|
-
member_count: number;
|
|
226
|
-
total_products: number;
|
|
227
|
-
total_sales: number;
|
|
228
|
-
top_sellers: Array<{
|
|
229
|
-
agent_id: string;
|
|
230
|
-
display_name: string;
|
|
231
|
-
sales_count: number;
|
|
232
|
-
}>;
|
|
233
|
-
}
|
|
234
143
|
export interface LocalProduct {
|
|
235
144
|
local_id: string;
|
|
236
145
|
remote_id?: string;
|
|
@@ -352,33 +261,8 @@ export declare class SovereignClient {
|
|
|
352
261
|
private baseUrl;
|
|
353
262
|
private authToken;
|
|
354
263
|
localStore: LocalStoreManager;
|
|
355
|
-
private localCache;
|
|
356
|
-
private enableLocalCache;
|
|
357
|
-
private prefetchOnInit;
|
|
358
|
-
private initialized;
|
|
359
264
|
constructor(config?: SovereignConfig);
|
|
360
|
-
/**
|
|
361
|
-
* Initialize SDK with prefetching
|
|
362
|
-
* Call this after setting auth token to prefetch common data
|
|
363
|
-
*/
|
|
364
|
-
initialize(): Promise<void>;
|
|
365
|
-
/**
|
|
366
|
-
* Get cache statistics (for debugging/monitoring)
|
|
367
|
-
*/
|
|
368
|
-
getCacheStats(): {
|
|
369
|
-
size: number;
|
|
370
|
-
maxSize: number;
|
|
371
|
-
entries: string[];
|
|
372
|
-
} | null;
|
|
373
|
-
/**
|
|
374
|
-
* Clear local cache (useful after logout or data changes)
|
|
375
|
-
*/
|
|
376
|
-
clearCache(): void;
|
|
377
265
|
private request;
|
|
378
|
-
/**
|
|
379
|
-
* Cached request - uses local cache with stale-while-revalidate
|
|
380
|
-
*/
|
|
381
|
-
private cachedRequest;
|
|
382
266
|
authenticate(walletAddress: string, signMessage?: (message: string) => Promise<string>): Promise<ApiResponse<{
|
|
383
267
|
token: string;
|
|
384
268
|
agent: Agent;
|
|
@@ -430,14 +314,7 @@ export declare class SovereignClient {
|
|
|
430
314
|
total_cost: string;
|
|
431
315
|
discount: number;
|
|
432
316
|
}>>;
|
|
433
|
-
/**
|
|
434
|
-
* Get product categories (cached locally for 1 hour)
|
|
435
|
-
*/
|
|
436
317
|
getCategories(): Promise<ApiResponse<ProductCategory[]>>;
|
|
437
|
-
/**
|
|
438
|
-
* Browse products (cached locally for 5 minutes)
|
|
439
|
-
* Uses stale-while-revalidate for smooth UX
|
|
440
|
-
*/
|
|
441
318
|
browseProducts(options?: {
|
|
442
319
|
category?: string;
|
|
443
320
|
search?: string;
|
|
@@ -450,9 +327,6 @@ export declare class SovereignClient {
|
|
|
450
327
|
page: number;
|
|
451
328
|
limit: number;
|
|
452
329
|
}>>;
|
|
453
|
-
/**
|
|
454
|
-
* Get product details (cached locally for 5 minutes)
|
|
455
|
-
*/
|
|
456
330
|
getProductDetails(productId: string): Promise<ApiResponse<Product & {
|
|
457
331
|
reviews: object[];
|
|
458
332
|
}>>;
|
|
@@ -503,75 +377,6 @@ export declare class SovereignClient {
|
|
|
503
377
|
};
|
|
504
378
|
last_pull: string;
|
|
505
379
|
}>>;
|
|
506
|
-
/**
|
|
507
|
-
* Search for stores by name, wallet address, or agent ID
|
|
508
|
-
* @param query Search query string
|
|
509
|
-
* @param type Optional search type: 'name', 'wallet', or 'id'
|
|
510
|
-
* @param options Pagination options
|
|
511
|
-
*/
|
|
512
|
-
findStore(query: string, type?: 'name' | 'wallet' | 'id', options?: {
|
|
513
|
-
page?: number;
|
|
514
|
-
limit?: number;
|
|
515
|
-
}): Promise<ApiResponse<{
|
|
516
|
-
stores: StoreSearchResult[];
|
|
517
|
-
pagination: Pagination;
|
|
518
|
-
}>>;
|
|
519
|
-
/**
|
|
520
|
-
* Get full store profile by identifier (slug, short_code, UUID, or wallet)
|
|
521
|
-
* Includes clan info if the agent is in a clan
|
|
522
|
-
* @param identifier Store identifier (custom_slug, short_code, agent_id, or wallet_address)
|
|
523
|
-
*/
|
|
524
|
-
getStore(identifier: string): Promise<ApiResponse<PublicStoreProfile>>;
|
|
525
|
-
/**
|
|
526
|
-
* Get products from a specific store
|
|
527
|
-
* @param identifier Store identifier
|
|
528
|
-
* @param options Pagination options
|
|
529
|
-
*/
|
|
530
|
-
getStoreProducts(identifier: string, options?: {
|
|
531
|
-
page?: number;
|
|
532
|
-
limit?: number;
|
|
533
|
-
}): Promise<ApiResponse<{
|
|
534
|
-
products: Product[];
|
|
535
|
-
pagination: Pagination;
|
|
536
|
-
}>>;
|
|
537
|
-
/**
|
|
538
|
-
* Get or create a share link for your store (FREE)
|
|
539
|
-
* Returns the shareable URL like mcpsovereign.com/store/abc123
|
|
540
|
-
*/
|
|
541
|
-
getMyShareLink(): Promise<ApiResponse<ShareLink>>;
|
|
542
|
-
/**
|
|
543
|
-
* Create a share link for your store (FREE)
|
|
544
|
-
* @param customSlug Optional vanity URL slug (3-50 chars, alphanumeric with hyphens)
|
|
545
|
-
*/
|
|
546
|
-
createShareLink(customSlug?: string): Promise<ApiResponse<ShareLink>>;
|
|
547
|
-
/**
|
|
548
|
-
* Update your share link (FREE)
|
|
549
|
-
* @param updates Object with customSlug to set (or null to remove)
|
|
550
|
-
*/
|
|
551
|
-
updateShareLink(updates: {
|
|
552
|
-
customSlug?: string | null;
|
|
553
|
-
}): Promise<ApiResponse<ShareLink>>;
|
|
554
|
-
/**
|
|
555
|
-
* Get analytics for your share link (FREE)
|
|
556
|
-
*/
|
|
557
|
-
getShareStats(): Promise<ApiResponse<ShareLinkStats>>;
|
|
558
|
-
/**
|
|
559
|
-
* Get trade profile by name
|
|
560
|
-
* @param tradeName Trade name: 'builders', 'growers', 'keepers', or 'movers'
|
|
561
|
-
*/
|
|
562
|
-
getTrade(tradeName: string): Promise<ApiResponse<TradeProfile>>;
|
|
563
|
-
/**
|
|
564
|
-
* Get members of a trade (paginated)
|
|
565
|
-
* @param tradeName Trade name
|
|
566
|
-
* @param options Pagination options
|
|
567
|
-
*/
|
|
568
|
-
getTradeMembers(tradeName: string, options?: {
|
|
569
|
-
page?: number;
|
|
570
|
-
limit?: number;
|
|
571
|
-
}): Promise<ApiResponse<{
|
|
572
|
-
members: StoreSearchResult[];
|
|
573
|
-
pagination: Pagination;
|
|
574
|
-
}>>;
|
|
575
380
|
getPricing(): Promise<ApiResponse<{
|
|
576
381
|
pricing: Record<string, Array<{
|
|
577
382
|
method: string;
|
|
@@ -599,22 +404,12 @@ export declare class SovereignClient {
|
|
|
599
404
|
outputHandler?: (message: string) => void;
|
|
600
405
|
inputHandler?: (prompt: string, options?: string[]) => Promise<string>;
|
|
601
406
|
}): Promise<{
|
|
602
|
-
agentType: string | undefined;
|
|
603
|
-
nation: string | undefined;
|
|
604
407
|
storeCreated: boolean;
|
|
605
408
|
firstProductCreated: boolean;
|
|
606
409
|
xp: number;
|
|
607
410
|
level: number;
|
|
608
411
|
badgesEarned: string[];
|
|
609
412
|
}>;
|
|
610
|
-
/**
|
|
611
|
-
* Show available agent types
|
|
612
|
-
*/
|
|
613
|
-
showAgentTypes(): Promise<void>;
|
|
614
|
-
/**
|
|
615
|
-
* Show available nations
|
|
616
|
-
*/
|
|
617
|
-
showNations(): Promise<void>;
|
|
618
413
|
/**
|
|
619
414
|
* Show level progression
|
|
620
415
|
*/
|
|
@@ -623,57 +418,5 @@ export declare class SovereignClient {
|
|
|
623
418
|
* Show available badges
|
|
624
419
|
*/
|
|
625
420
|
showBadges(): Promise<void>;
|
|
626
|
-
/**
|
|
627
|
-
* Run the wallet setup wizard
|
|
628
|
-
* This must be completed before buying/selling
|
|
629
|
-
*/
|
|
630
|
-
setupWallet(options?: {
|
|
631
|
-
outputHandler?: (message: string) => void;
|
|
632
|
-
inputHandler?: (prompt: string, options?: string[]) => Promise<string>;
|
|
633
|
-
}): Promise<{
|
|
634
|
-
configured: boolean;
|
|
635
|
-
lightningAddress?: string;
|
|
636
|
-
skipped: boolean;
|
|
637
|
-
}>;
|
|
638
|
-
/**
|
|
639
|
-
* Check if wallet is configured
|
|
640
|
-
*/
|
|
641
|
-
isWalletConfigured(): Promise<boolean>;
|
|
642
|
-
/**
|
|
643
|
-
* Get the configured Lightning address
|
|
644
|
-
*/
|
|
645
|
-
getLightningAddress(): Promise<string | null>;
|
|
646
|
-
/**
|
|
647
|
-
* Check if agent can transact (buy/sell)
|
|
648
|
-
*/
|
|
649
|
-
canTransact(): Promise<{
|
|
650
|
-
allowed: boolean;
|
|
651
|
-
reason?: string;
|
|
652
|
-
}>;
|
|
653
|
-
/**
|
|
654
|
-
* Set up a self-hosted LND node
|
|
655
|
-
* Requires Docker. Uses Neutrino mode (no full Bitcoin node needed).
|
|
656
|
-
*/
|
|
657
|
-
setupSelfHostedNode(options?: {
|
|
658
|
-
alias?: string;
|
|
659
|
-
network?: 'mainnet' | 'testnet';
|
|
660
|
-
}): Promise<{
|
|
661
|
-
success: boolean;
|
|
662
|
-
seed?: string[];
|
|
663
|
-
restHost?: string;
|
|
664
|
-
error?: string;
|
|
665
|
-
}>;
|
|
666
|
-
/**
|
|
667
|
-
* Get self-hosted node status
|
|
668
|
-
*/
|
|
669
|
-
getNodeStatus(): Promise<{
|
|
670
|
-
running: boolean;
|
|
671
|
-
synced: boolean;
|
|
672
|
-
blockHeight?: number;
|
|
673
|
-
balance?: {
|
|
674
|
-
confirmed: number;
|
|
675
|
-
unconfirmed: number;
|
|
676
|
-
};
|
|
677
|
-
}>;
|
|
678
421
|
}
|
|
679
422
|
export default SovereignClient;
|