@mirra-messenger/sdk 0.7.0 → 0.8.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.
@@ -784,6 +784,21 @@ export interface JupiterRefreshSwapArgs {
784
784
  inputDecimals: number;
785
785
  slippageBps?: number;
786
786
  }
787
+ export interface JupiterLaunchTokenArgs {
788
+ tokenName: string;
789
+ tokenSymbol: string;
790
+ tokenDescription?: string;
791
+ tokenImageUrl: string;
792
+ quoteMint?: string;
793
+ initialMarketCap?: number;
794
+ migrationMarketCap?: number;
795
+ antiSniping?: boolean;
796
+ feeBps?: number;
797
+ isLpLocked?: boolean;
798
+ website?: string;
799
+ twitter?: string;
800
+ telegram?: string;
801
+ }
787
802
  export interface CryptoGetPriceArgs {
788
803
  tokenAddress: string;
789
804
  chainName?: string;
@@ -1065,6 +1080,84 @@ export interface TunnelCallArgs {
1065
1080
  export interface TunnelStatusArgs {
1066
1081
  tunnel?: string;
1067
1082
  }
1083
+ export interface PolymarketGetMarketsArgs {
1084
+ query?: string;
1085
+ tag?: string;
1086
+ limit?: number;
1087
+ offset?: number;
1088
+ active?: boolean;
1089
+ closed?: boolean;
1090
+ }
1091
+ export interface PolymarketGetMarketArgs {
1092
+ conditionId?: string;
1093
+ slug?: string;
1094
+ }
1095
+ export interface PolymarketGetEventsArgs {
1096
+ tag?: string;
1097
+ limit?: number;
1098
+ offset?: number;
1099
+ active?: boolean;
1100
+ closed?: boolean;
1101
+ }
1102
+ export interface PolymarketGetPriceArgs {
1103
+ tokenId: string;
1104
+ }
1105
+ export interface PolymarketGetOrderbookArgs {
1106
+ tokenId: string;
1107
+ }
1108
+ export interface PolymarketPlaceOrderArgs {
1109
+ tokenId: string;
1110
+ price: number;
1111
+ size: number;
1112
+ side: string;
1113
+ type?: string;
1114
+ expiration?: number;
1115
+ }
1116
+ export interface PolymarketExecuteOrderArgs {
1117
+ orderPayload: any;
1118
+ }
1119
+ export interface PolymarketCancelOrderArgs {
1120
+ orderId: string;
1121
+ }
1122
+ export interface PolymarketExecuteCancelOrderArgs {
1123
+ orderId: string;
1124
+ }
1125
+ export interface PolymarketRefreshOrderArgs {
1126
+ tokenId: string;
1127
+ price: number;
1128
+ size: number;
1129
+ side: string;
1130
+ type?: string;
1131
+ expiration?: number;
1132
+ }
1133
+ export interface PolymarketGetOrdersArgs {
1134
+ market?: string;
1135
+ limit?: number;
1136
+ offset?: number;
1137
+ }
1138
+ export interface PolymarketGetTradesArgs {
1139
+ market?: string;
1140
+ limit?: number;
1141
+ offset?: number;
1142
+ }
1143
+ export interface PolymarketGetBuilderLeaderboardArgs {
1144
+ period?: string;
1145
+ limit?: number;
1146
+ }
1147
+ export interface PolymarketGetBuilderVolumeArgs {
1148
+ startDate?: string;
1149
+ endDate?: string;
1150
+ }
1151
+ export interface PolymarketDiscoverExtendedArgs {
1152
+ query: string;
1153
+ limit?: number;
1154
+ }
1155
+ export interface PolymarketExecuteExtendedArgs {
1156
+ operationId: string;
1157
+ pathParams?: any;
1158
+ queryParams?: any;
1159
+ body?: any;
1160
+ }
1068
1161
  export interface FlowsCreateFlowData {
1069
1162
  id: string;
1070
1163
  title: string;
@@ -2655,6 +2748,17 @@ export interface JupiterRefreshSwapData {
2655
2748
  routeStepCount: number;
2656
2749
  }
2657
2750
  export type JupiterRefreshSwapResult = AdapterResultBase<JupiterRefreshSwapData>;
2751
+ export interface JupiterLaunchTokenData {
2752
+ type: 'pending_transaction';
2753
+ transaction: string;
2754
+ mint: string;
2755
+ signerWallet: string;
2756
+ expiresAt: string;
2757
+ tokenName: string;
2758
+ tokenSymbol: string;
2759
+ imageUrl: string;
2760
+ }
2761
+ export type JupiterLaunchTokenResult = AdapterResultBase<JupiterLaunchTokenData>;
2658
2762
  export interface CryptoGetPriceData {
2659
2763
  tokenAddress: string;
2660
2764
  chain: 'evm' | 'svm';
@@ -3366,14 +3470,14 @@ Time flow with inline code:
3366
3470
  {
3367
3471
  title: "Daily Report",
3368
3472
  schedule: "0 9 * * *",
3369
- code: "async (ctx) => { await ctx.mirra.telegram.sendMessage({...}); return { done: true }; }"
3473
+ code: "export async function handler(event, context, mirra) { await mirra.telegram.sendMessage({...}); return { done: true }; }"
3370
3474
  }
3371
3475
 
3372
3476
  Event flow with eventType shorthand:
3373
3477
  {
3374
3478
  title: "Handle Messages",
3375
3479
  eventType: "telegram.message",
3376
- code: "async (event, ctx) => { return { handled: true }; }"
3480
+ code: "export async function handler(event, context, mirra) { return { handled: true }; }"
3377
3481
  }
3378
3482
 
3379
3483
  Event flow with existing script:
@@ -4788,6 +4892,24 @@ declare function createJupiterAdapter(sdk: MirraSDK): {
4788
4892
  * @returns Promise<JupiterRefreshSwapResult> Typed response with IDE autocomplete
4789
4893
  */
4790
4894
  refreshSwap: (args: JupiterRefreshSwapArgs) => Promise<JupiterRefreshSwapResult>;
4895
+ /**
4896
+ * Launch a new token on Solana via Jupiter Studio. Creates a DBC (Dynamic Bonding Curve) pool. The user must have uploaded a token image in this conversation — pass the image URL provided in the chat. Returns a pending_transaction for the user to sign. FLAT structure.
4897
+ * @param args.tokenName - Name of the token
4898
+ * @param args.tokenSymbol - Token ticker symbol
4899
+ * @param args.tokenDescription - Description for the token metadata (optional)
4900
+ * @param args.tokenImageUrl - URL of the uploaded token image (from user message)
4901
+ * @param args.quoteMint - Quote token mint address. Defaults to USDC (EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v). Can also use SOL or JUP mint. (optional)
4902
+ * @param args.initialMarketCap - Initial market cap in quote token units (default: 16000 for meme preset) (optional)
4903
+ * @param args.migrationMarketCap - Market cap threshold for graduation/migration (default: 69000 for meme preset) (optional)
4904
+ * @param args.antiSniping - Enable anti-sniping protection (default: false) (optional)
4905
+ * @param args.feeBps - Creator trading fee in basis points: 100 (1%) or 200 (2%). Default: 100 (optional)
4906
+ * @param args.isLpLocked - Lock LP tokens (default: true) (optional)
4907
+ * @param args.website - Project website URL for token metadata (optional)
4908
+ * @param args.twitter - Twitter/X URL for token metadata (optional)
4909
+ * @param args.telegram - Telegram URL for token metadata (optional)
4910
+ * @returns Promise<JupiterLaunchTokenResult> Typed response with IDE autocomplete
4911
+ */
4912
+ launchToken: (args: JupiterLaunchTokenArgs) => Promise<JupiterLaunchTokenResult>;
4791
4913
  };
4792
4914
  /**
4793
4915
  * Crypto Adapter
@@ -5307,6 +5429,126 @@ declare function createTunnelAdapter(sdk: MirraSDK): {
5307
5429
  */
5308
5430
  list: (args?: {}) => Promise<any>;
5309
5431
  };
5432
+ /**
5433
+ * Polymarket Adapter
5434
+ * Category: crypto
5435
+ */
5436
+ declare function createPolymarketAdapter(sdk: MirraSDK): {
5437
+ /**
5438
+ * Search and list Polymarket prediction markets. Returns active and resolved markets with current pricing, volume, and outcome data from the Gamma API. Use the query parameter to search by question text, or filter by category tag, active/closed status. Results are paginated.
5439
+ * @param args.query - Search query to filter markets by question text (matched against slug) (optional)
5440
+ * @param args.tag - Filter by category tag (e.g., "politics", "crypto", "sports", "science") (optional)
5441
+ * @param args.limit - Maximum number of markets to return (default: 25, max: 100) (optional)
5442
+ * @param args.offset - Offset for pagination (default: 0) (optional)
5443
+ * @param args.active - If true, return only active/open markets (optional)
5444
+ * @param args.closed - If true, return only closed/resolved markets (optional)
5445
+ */
5446
+ getMarkets: (args: PolymarketGetMarketsArgs) => Promise<any>;
5447
+ /**
5448
+ * Get detailed information for a specific Polymarket prediction market. Lookup by conditionId (the unique market identifier on the CTF contract) or by slug (the URL-friendly market name). Returns full market details including current pricing, volume, liquidity, and outcome probabilities.
5449
+ * @param args.conditionId - The condition ID of the market (hex string, e.g., "0xabc123...") (optional)
5450
+ * @param args.slug - The market slug (URL-friendly name, alternative to conditionId) (optional)
5451
+ */
5452
+ getMarket: (args: PolymarketGetMarketArgs) => Promise<any>;
5453
+ /**
5454
+ * List Polymarket events, which are groups of related prediction markets. For example, a "2024 US Election" event may contain multiple markets for different races. Events include aggregated volume/liquidity and a list of child markets with their individual outcome prices.
5455
+ * @param args.tag - Filter by category tag (e.g., "politics", "crypto", "sports") (optional)
5456
+ * @param args.limit - Maximum number of events to return (default: 25, max: 100) (optional)
5457
+ * @param args.offset - Offset for pagination (default: 0) (optional)
5458
+ * @param args.active - If true, return only active events (optional)
5459
+ * @param args.closed - If true, return only closed/resolved events (optional)
5460
+ */
5461
+ getEvents: (args: PolymarketGetEventsArgs) => Promise<any>;
5462
+ /**
5463
+ * Get the current midpoint price for a specific market outcome token on the Polymarket CLOB. The tokenId is the unique identifier for one side of a binary market outcome (e.g., the "Yes" token or "No" token). Prices range from 0.00 to 1.00, representing the implied probability.
5464
+ * @param args.tokenId - The token ID of the outcome to price (available from market.outcomes or market data)
5465
+ */
5466
+ getPrice: (args: PolymarketGetPriceArgs) => Promise<any>;
5467
+ /**
5468
+ * Get the current orderbook depth for a market outcome token on the Polymarket CLOB. Returns sorted bid and ask arrays with price/size at each level, plus computed midpoint and spread. Useful for assessing liquidity and slippage before placing orders.
5469
+ * @param args.tokenId - The token ID of the outcome (available from market data)
5470
+ */
5471
+ getOrderbook: (args: PolymarketGetOrderbookArgs) => Promise<any>;
5472
+ /**
5473
+ * Creates an action proposal for user approval. Validates that CLOB credentials exist, fetches live market price/spread for context, and saves an ActionProposal to the database. Server signs and submits the order on approval. Returns status "pending" with requiresAction: true.
5474
+ * @param args.tokenId - The token ID of the outcome to trade (from market data)
5475
+ * @param args.price - Order price between 0.01 and 0.99 (implied probability)
5476
+ * @param args.size - Order size in number of shares (denominated in USDC)
5477
+ * @param args.side - Order side: "BUY" to buy outcome shares, "SELL" to sell held shares
5478
+ * @param args.type - Order type: "GTC" (Good Til Cancelled, default), "GTD" (Good Til Date), "FOK" (Fill Or Kill), "FAK" (Fill And Kill) (optional)
5479
+ * @param args.expiration - Unix timestamp expiration for GTD orders only (optional)
5480
+ */
5481
+ placeOrder: (args: PolymarketPlaceOrderArgs) => Promise<any>;
5482
+ /**
5483
+ * Executes a previously approved order using server-stored CLOB credentials. Called automatically when user approves a placeOrder proposal. Signs the order server-side with HMAC-SHA256 and submits to the Polymarket CLOB API with optional Builder attribution headers.
5484
+ * @param args.orderPayload - The order payload from placeOrder: { tokenId, price, size, side, type, expiration }
5485
+ */
5486
+ executeOrder: (args: PolymarketExecuteOrderArgs) => Promise<any>;
5487
+ /**
5488
+ * Creates an action proposal to cancel an existing order. Validates that CLOB credentials exist and saves an ActionProposal to the database. Server signs and submits the cancellation on approval. Returns status "pending" with requiresAction: true.
5489
+ * @param args.orderId - The ID of the order to cancel (from getOrders or placeOrder result)
5490
+ */
5491
+ cancelOrder: (args: PolymarketCancelOrderArgs) => Promise<any>;
5492
+ /**
5493
+ * Executes a previously approved cancel using server-stored CLOB credentials. Called automatically when user approves a cancelOrder proposal. Signs the cancel request server-side and submits to the Polymarket CLOB API.
5494
+ * @param args.orderId - The ID of the order to cancel
5495
+ */
5496
+ executeCancelOrder: (args: PolymarketExecuteCancelOrderArgs) => Promise<any>;
5497
+ /**
5498
+ * Rebuild an expired order proposal with fresh market data. Use this when a pending order from placeOrder has expired and the user still wants to place the trade. Creates a new ActionProposal with updated currentPrice and a new expiration. Same parameters as placeOrder.
5499
+ * @param args.tokenId - The token ID of the outcome to trade
5500
+ * @param args.price - Order price between 0.01 and 0.99
5501
+ * @param args.size - Order size in number of shares
5502
+ * @param args.side - Order side: "BUY" or "SELL"
5503
+ * @param args.type - Order type: "GTC" (default), "GTD", "FOK", "FAK" (optional)
5504
+ * @param args.expiration - Unix timestamp expiration for GTD orders (optional)
5505
+ */
5506
+ refreshOrder: (args: PolymarketRefreshOrderArgs) => Promise<any>;
5507
+ /**
5508
+ * Get active orders for the authenticated user on the Polymarket CLOB. Returns open/pending orders with current fill status. Requires server-side CLOB credentials (read-only). Can be filtered by market condition ID.
5509
+ * @param args.market - Filter by market condition ID to see orders for a specific market (optional)
5510
+ * @param args.limit - Maximum number of orders to return (default: 25, max: 100) (optional)
5511
+ * @param args.offset - Offset for pagination (default: 0) (optional)
5512
+ */
5513
+ getOrders: (args: PolymarketGetOrdersArgs) => Promise<any>;
5514
+ /**
5515
+ * Get current prediction market positions for the authenticated user. Shows all held outcome token positions with average entry price, current price, and computed P&L. Requires the user's wallet address and CLOB credentials.
5516
+ */
5517
+ getPositions: (args?: {}) => Promise<any>;
5518
+ /**
5519
+ * Get trade history for the authenticated user. Returns completed trades with execution prices, sizes, fees, and on-chain transaction hashes. Can be filtered by market.
5520
+ * @param args.market - Filter by market condition ID (optional)
5521
+ * @param args.limit - Maximum number of trades to return (default: 25, max: 100) (optional)
5522
+ * @param args.offset - Offset for pagination (default: 0) (optional)
5523
+ */
5524
+ getTrades: (args: PolymarketGetTradesArgs) => Promise<any>;
5525
+ /**
5526
+ * Get the Polymarket Builder program leaderboard rankings. Shows top builders by volume and trade count for a given period. Requires Builder API credentials configured on the server.
5527
+ * @param args.period - Time period for rankings: "daily", "weekly", "monthly", or omit for all-time (optional)
5528
+ * @param args.limit - Maximum number of entries to return (default: 25, max: 100) (optional)
5529
+ */
5530
+ getBuilderLeaderboard: (args: PolymarketGetBuilderLeaderboardArgs) => Promise<any>;
5531
+ /**
5532
+ * Get volume time-series data for the Builder program. Shows daily volume and trade count attributed to the builder. Requires Builder API credentials.
5533
+ * @param args.startDate - Start date in ISO 8601 format (e.g., "2024-06-01") (optional)
5534
+ * @param args.endDate - End date in ISO 8601 format (e.g., "2024-06-30") (optional)
5535
+ */
5536
+ getBuilderVolume: (args: PolymarketGetBuilderVolumeArgs) => Promise<any>;
5537
+ /**
5538
+ * Search Polymarket API for available operations beyond core tools
5539
+ * @param args.query - Describe what you want to do (e.g., "add label to card")
5540
+ * @param args.limit - Max results to return (default 5) (optional)
5541
+ */
5542
+ discoverExtended: (args: PolymarketDiscoverExtendedArgs) => Promise<any>;
5543
+ /**
5544
+ * Execute a Polymarket API operation by operationId
5545
+ * @param args.operationId - The operationId from discoverExtended results
5546
+ * @param args.pathParams - Path parameters, e.g., { id: "abc123" } (optional)
5547
+ * @param args.queryParams - Query string parameters (optional)
5548
+ * @param args.body - Request body for POST/PUT/PATCH operations (optional)
5549
+ */
5550
+ executeExtended: (args: PolymarketExecuteExtendedArgs) => Promise<any>;
5551
+ };
5310
5552
  export declare const generatedAdapters: {
5311
5553
  flows: typeof createFlowsAdapter;
5312
5554
  user: typeof createUserAdapter;
@@ -5331,6 +5573,7 @@ export declare const generatedAdapters: {
5331
5573
  mirraMessaging: typeof createMirraMessagingAdapter;
5332
5574
  moltbook: typeof createMoltbookAdapter;
5333
5575
  tunnel: typeof createTunnelAdapter;
5576
+ polymarket: typeof createPolymarketAdapter;
5334
5577
  };
5335
5578
  export {};
5336
5579
  //# sourceMappingURL=adapters.d.ts.map