apinow-sdk 0.28.3 → 0.29.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 +5 -5
- package/dist/index.d.ts +35 -6
- package/dist/index.js +7 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -210,7 +210,7 @@ program
|
|
|
210
210
|
.requiredOption('--description <desc>', 'Description')
|
|
211
211
|
.option('--method <method>', 'HTTP method', 'POST')
|
|
212
212
|
.option('--price <usdc>', 'USDC price per call', '0.01')
|
|
213
|
-
.option('--splits <json>', 'Splits JSON array
|
|
213
|
+
.option('--splits <json>', 'Splits JSON array. Each entry: {address, [basisPoints|amount|percent], label?, tokenAddress?}. Resolved basisPoints must sum to 10000.')
|
|
214
214
|
.option('-k, --key <privateKey>', 'Wallet private key')
|
|
215
215
|
.action(async (opts) => {
|
|
216
216
|
try {
|
|
@@ -245,7 +245,7 @@ program
|
|
|
245
245
|
.option('--url <url>', 'New URL')
|
|
246
246
|
.option('--price <usdc>', 'New USDC price')
|
|
247
247
|
.option('--status <status>', 'New status')
|
|
248
|
-
.option('--splits <json>', 'Splits JSON array
|
|
248
|
+
.option('--splits <json>', 'Splits JSON array (entries accept basisPoints|amount|percent). Changing splits redeploys the splitter contract (V2 is immutable).')
|
|
249
249
|
.option('-k, --key <privateKey>', 'Wallet private key')
|
|
250
250
|
.action(async (id, opts) => {
|
|
251
251
|
try {
|
|
@@ -495,7 +495,7 @@ program
|
|
|
495
495
|
.option('--graph <json>', 'Graph JSON (nodes + outputNode)')
|
|
496
496
|
.option('--prompt <prompt>', 'AI prompt to generate workflow')
|
|
497
497
|
.option('--price <usdc>', 'Total price', '0.10')
|
|
498
|
-
.option('--splits <json>', 'Splits JSON array
|
|
498
|
+
.option('--splits <json>', 'Splits JSON array. Each entry: {address, [basisPoints|amount|percent], label?, tokenAddress?}.')
|
|
499
499
|
.option('-k, --key <privateKey>', 'Wallet private key')
|
|
500
500
|
.action(async (opts) => {
|
|
501
501
|
try {
|
|
@@ -529,7 +529,7 @@ program
|
|
|
529
529
|
.option('--description <desc>', 'New description (7-day cooldown)')
|
|
530
530
|
.option('--status <status>', 'New status')
|
|
531
531
|
.option('--price <usdc>', 'New total price — auto-bumps version')
|
|
532
|
-
.option('--splits <json>', 'Splits JSON array
|
|
532
|
+
.option('--splits <json>', 'Splits JSON array (entries accept basisPoints|amount|percent). Auto-bumps version; redeploys splitter if structurally changed.')
|
|
533
533
|
.option('--changelog <msg>', 'Label for the auto-created version snapshot')
|
|
534
534
|
.option('-k, --key <privateKey>', 'Wallet private key')
|
|
535
535
|
.action(async (id, opts) => {
|
|
@@ -654,7 +654,7 @@ program
|
|
|
654
654
|
.description('Create a new version of a workflow (graph/price/splits)')
|
|
655
655
|
.option('--graph <json>', 'Graph JSON (inherits current if omitted)')
|
|
656
656
|
.option('--price <usdc>', 'Total price')
|
|
657
|
-
.option('--splits <json>', 'Splits JSON array')
|
|
657
|
+
.option('--splits <json>', 'Splits JSON array (entries accept basisPoints|amount|percent)')
|
|
658
658
|
.option('--changelog <msg>', 'Changelog message')
|
|
659
659
|
.option('--no-default', 'Create as non-default (keeps current version active)')
|
|
660
660
|
.option('-k, --key <privateKey>', 'Wallet private key')
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const APINOW_SDK_VERSION = "0.
|
|
1
|
+
export declare const APINOW_SDK_VERSION = "0.29.0";
|
|
2
2
|
export interface CallOptions {
|
|
3
3
|
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
4
4
|
body?: Record<string, any>;
|
|
@@ -51,6 +51,29 @@ export interface SplitConfig {
|
|
|
51
51
|
tokenAddress?: string;
|
|
52
52
|
recipientAddress?: string;
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* A single split entry as accepted by the workflow write endpoints
|
|
56
|
+
* (create / update / new version). Specify EXACTLY ONE of
|
|
57
|
+
* `basisPoints`, `amount`, or `percent` — the backend normalizes to
|
|
58
|
+
* basis points against the workflow's `totalPrice`:
|
|
59
|
+
*
|
|
60
|
+
* { address, basisPoints: 3000 } // 30.00 %
|
|
61
|
+
* { address, amount: "0.05" } // USDC dollars
|
|
62
|
+
* { address, percent: 30 } // 30.00 %
|
|
63
|
+
*
|
|
64
|
+
* The array as a whole must still sum to 10000 bps (100%). Mix and match
|
|
65
|
+
* per entry; amount / percent are just convenience forms so you don't
|
|
66
|
+
* have to compute bps manually.
|
|
67
|
+
*/
|
|
68
|
+
export interface SplitInput {
|
|
69
|
+
address: string;
|
|
70
|
+
label?: string;
|
|
71
|
+
tokenAddress?: string;
|
|
72
|
+
recipientAddress?: string;
|
|
73
|
+
basisPoints?: number;
|
|
74
|
+
amount?: number | string;
|
|
75
|
+
percent?: number | string;
|
|
76
|
+
}
|
|
54
77
|
/**
|
|
55
78
|
* Thrown by authed writes when the backend returns a non-2xx. Exposes status
|
|
56
79
|
* code and parsed JSON body so callers can branch on e.g. 429 cooldowns
|
|
@@ -143,7 +166,7 @@ export declare function createClient(config: ApinowConfig): {
|
|
|
143
166
|
exampleQuery?: any;
|
|
144
167
|
exampleOutput?: any;
|
|
145
168
|
docsUrl?: string;
|
|
146
|
-
splits?:
|
|
169
|
+
splits?: SplitInput[];
|
|
147
170
|
}): Promise<any>;
|
|
148
171
|
getEndpoint(id: string): Promise<any>;
|
|
149
172
|
/**
|
|
@@ -163,7 +186,7 @@ export declare function createClient(config: ApinowConfig): {
|
|
|
163
186
|
tokenSymbol?: string;
|
|
164
187
|
}>;
|
|
165
188
|
status?: string;
|
|
166
|
-
splits?:
|
|
189
|
+
splits?: SplitInput[];
|
|
167
190
|
querySchema?: any;
|
|
168
191
|
responseSchema?: any;
|
|
169
192
|
exampleQuery?: any;
|
|
@@ -190,6 +213,12 @@ export declare function createClient(config: ApinowConfig): {
|
|
|
190
213
|
* Get workflow details by ID.
|
|
191
214
|
*/
|
|
192
215
|
getWorkflow(workflowId: string): Promise<any>;
|
|
216
|
+
/**
|
|
217
|
+
* Create a workflow. `splits` accepts either `SplitConfig[]`
|
|
218
|
+
* (`basisPoints`) or the more ergonomic `SplitInput[]` — mix and
|
|
219
|
+
* match `basisPoints | amount | percent` per entry. The server
|
|
220
|
+
* normalizes to basis points against `totalPrice`.
|
|
221
|
+
*/
|
|
193
222
|
createWorkflow(config: {
|
|
194
223
|
name?: string;
|
|
195
224
|
description?: string;
|
|
@@ -205,7 +234,7 @@ export declare function createClient(config: ApinowConfig): {
|
|
|
205
234
|
};
|
|
206
235
|
prompt?: string;
|
|
207
236
|
totalPrice?: string;
|
|
208
|
-
splits?:
|
|
237
|
+
splits?: SplitInput[];
|
|
209
238
|
chain?: string;
|
|
210
239
|
}): Promise<any>;
|
|
211
240
|
/**
|
|
@@ -220,7 +249,7 @@ export declare function createClient(config: ApinowConfig): {
|
|
|
220
249
|
description?: string;
|
|
221
250
|
status?: string;
|
|
222
251
|
totalPrice?: string;
|
|
223
|
-
splits?:
|
|
252
|
+
splits?: SplitInput[];
|
|
224
253
|
graph?: {
|
|
225
254
|
nodes: any[];
|
|
226
255
|
outputNode: string;
|
|
@@ -263,7 +292,7 @@ export declare function createClient(config: ApinowConfig): {
|
|
|
263
292
|
outputMapping?: any;
|
|
264
293
|
};
|
|
265
294
|
totalPrice?: string;
|
|
266
|
-
splits?:
|
|
295
|
+
splits?: SplitInput[];
|
|
267
296
|
mermaidDiagram?: string;
|
|
268
297
|
executionMode?: "balanced" | "optimistic" | "settle_first";
|
|
269
298
|
changelog?: string;
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { x402Client, wrapFetchWithPayment } from '@x402/fetch';
|
|
|
2
2
|
import { registerExactEvmScheme } from '@x402/evm/exact/client';
|
|
3
3
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
4
4
|
const APINOW_BASE = 'https://www.apinow.fun';
|
|
5
|
-
export const APINOW_SDK_VERSION = '0.
|
|
5
|
+
export const APINOW_SDK_VERSION = '0.29.0';
|
|
6
6
|
/**
|
|
7
7
|
* Default base URL. In a browser we prefer the current origin so that
|
|
8
8
|
* signed-auth writes stay same-origin and don't hit a CORS preflight
|
|
@@ -301,6 +301,12 @@ export function createClient(config) {
|
|
|
301
301
|
throw new Error(`Failed to get workflow: ${res.status}`);
|
|
302
302
|
return res.json();
|
|
303
303
|
},
|
|
304
|
+
/**
|
|
305
|
+
* Create a workflow. `splits` accepts either `SplitConfig[]`
|
|
306
|
+
* (`basisPoints`) or the more ergonomic `SplitInput[]` — mix and
|
|
307
|
+
* match `basisPoints | amount | percent` per entry. The server
|
|
308
|
+
* normalizes to basis points against `totalPrice`.
|
|
309
|
+
*/
|
|
304
310
|
async createWorkflow(config) {
|
|
305
311
|
return authedJson(`${baseUrl}/api/workflows`, {
|
|
306
312
|
method: 'POST',
|
package/package.json
CHANGED