apinow-sdk 0.18.0 → 0.19.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.
package/dist/cli.js CHANGED
@@ -416,6 +416,7 @@ program
416
416
  .option('--graph <json>', 'Graph JSON (nodes + outputNode)')
417
417
  .option('--prompt <prompt>', 'AI prompt to generate workflow')
418
418
  .option('--price <usdc>', 'Total price', '0.10')
419
+ .option('--splits <json>', 'Splits JSON array [{address, basisPoints, label?, tokenAddress?}]')
419
420
  .option('-k, --key <privateKey>', 'Wallet private key')
420
421
  .action(async (opts) => {
421
422
  try {
@@ -427,6 +428,8 @@ program
427
428
  body.graph = JSON.parse(opts.graph);
428
429
  if (opts.prompt)
429
430
  body.prompt = opts.prompt;
431
+ if (opts.splits)
432
+ body.splits = JSON.parse(opts.splits);
430
433
  const data = await fetchJson(`${API_BASE}/api/workflows`, {
431
434
  method: 'POST',
432
435
  headers: walletHeaders(address),
@@ -622,6 +625,10 @@ program
622
625
  .description('Create a markup workflow that wraps an existing endpoint')
623
626
  .option('--markup <percent>', 'Markup percentage', '20')
624
627
  .option('--name <name>', 'Workflow name')
628
+ .option('--token-buy-percent <percent>', 'Percent of markup allocated to token buy')
629
+ .option('--token-buy-recipient <wallet>', 'Wallet to receive token buy USDC')
630
+ .option('--token-buy-ca <address>', 'Token contract address (default: $APINOW)')
631
+ .option('--markup-recipient <wallet>', 'Wallet to receive markup USDC')
625
632
  .option('-k, --key <privateKey>', 'Wallet private key')
626
633
  .action(async (endpointId, opts) => {
627
634
  try {
@@ -629,7 +636,16 @@ program
629
636
  const body = { endpointId, markupPercent: Number(opts.markup) };
630
637
  if (opts.name)
631
638
  body.workflowName = opts.name;
632
- console.error(`Creating markup workflow (${opts.markup}%)…`);
639
+ if (opts.tokenBuyPercent)
640
+ body.tokenBuyPercent = Number(opts.tokenBuyPercent);
641
+ if (opts.tokenBuyRecipient)
642
+ body.tokenBuyRecipient = opts.tokenBuyRecipient;
643
+ if (opts.tokenBuyCa)
644
+ body.tokenBuyCA = opts.tokenBuyCa;
645
+ if (opts.markupRecipient)
646
+ body.markupRecipient = opts.markupRecipient;
647
+ const tbLabel = opts.tokenBuyPercent ? ` + ${opts.tokenBuyPercent}% token buy` : '';
648
+ console.error(`Creating markup workflow (${opts.markup}%${tbLabel})…`);
633
649
  const data = await fetchJson(`${API_BASE}/api/user-factory/markup`, {
634
650
  method: 'POST',
635
651
  headers: walletHeaders(address),
@@ -640,6 +656,8 @@ program
640
656
  console.log(` ID: ${w.workflowId}`);
641
657
  console.log(` Base: $${w.basePrice} USDC`);
642
658
  console.log(` Markup: ${w.markupPercent}%`);
659
+ if (w.tokenBuyPercent)
660
+ console.log(` Token Buy: ${w.tokenBuyPercent}% of markup`);
643
661
  console.log(` Total: $${w.totalPrice} USDC`);
644
662
  console.log(` View: https://apinow.fun${w.viewUrl}\n`);
645
663
  }
package/dist/index.d.ts CHANGED
@@ -86,6 +86,7 @@ export declare function createClient(config: ApinowConfig): {
86
86
  address: string;
87
87
  basisPoints: number;
88
88
  label?: string;
89
+ tokenAddress?: string;
89
90
  }>;
90
91
  chain?: string;
91
92
  }): Promise<any>;
@@ -134,11 +135,16 @@ export declare function createClient(config: ApinowConfig): {
134
135
  }): Promise<any>;
135
136
  /**
136
137
  * Create a markup workflow wrapping an existing endpoint.
138
+ * Optionally allocate a portion of the markup to a token buy split.
137
139
  */
138
140
  factoryMarkup(opts: {
139
141
  endpointId: string;
140
142
  markupPercent?: number;
141
143
  workflowName?: string;
144
+ tokenBuyPercent?: number;
145
+ tokenBuyRecipient?: string;
146
+ tokenBuyCA?: string;
147
+ markupRecipient?: string;
142
148
  }): Promise<any>;
143
149
  /**
144
150
  * Test-call an endpoint without payment (free, server-side LLM call).
package/dist/index.js CHANGED
@@ -241,6 +241,7 @@ export function createClient(config) {
241
241
  },
242
242
  /**
243
243
  * Create a markup workflow wrapping an existing endpoint.
244
+ * Optionally allocate a portion of the markup to a token buy split.
244
245
  */
245
246
  async factoryMarkup(opts) {
246
247
  const res = await fetch(`${baseUrl}/api/user-factory/markup`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apinow-sdk",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Pay-per-call API SDK & CLI for APINow.fun — endpoints + workflows, wraps x402 so you don't have to",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",