apinow-sdk 0.29.0 → 0.29.1
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 +0 -6
- package/dist/index.d.ts +1 -16
- package/dist/index.js +1 -14
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -210,7 +210,6 @@ 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. Each entry: {address, [basisPoints|amount|percent], label?, tokenAddress?}. Resolved basisPoints must sum to 10000.')
|
|
214
213
|
.option('-k, --key <privateKey>', 'Wallet private key')
|
|
215
214
|
.action(async (opts) => {
|
|
216
215
|
try {
|
|
@@ -223,8 +222,6 @@ program
|
|
|
223
222
|
httpMethod: opts.method.toUpperCase(),
|
|
224
223
|
paymentOptions: [{ usdAmount: opts.price, amount: opts.price }],
|
|
225
224
|
};
|
|
226
|
-
if (opts.splits)
|
|
227
|
-
body.splits = JSON.parse(opts.splits);
|
|
228
225
|
const data = await fetchJson(`${API_BASE}/api/endpoints`, {
|
|
229
226
|
method: 'POST',
|
|
230
227
|
headers: await walletHeaders(privateKey),
|
|
@@ -245,7 +242,6 @@ program
|
|
|
245
242
|
.option('--url <url>', 'New URL')
|
|
246
243
|
.option('--price <usdc>', 'New USDC price')
|
|
247
244
|
.option('--status <status>', 'New status')
|
|
248
|
-
.option('--splits <json>', 'Splits JSON array (entries accept basisPoints|amount|percent). Changing splits redeploys the splitter contract (V2 is immutable).')
|
|
249
245
|
.option('-k, --key <privateKey>', 'Wallet private key')
|
|
250
246
|
.action(async (id, opts) => {
|
|
251
247
|
try {
|
|
@@ -259,8 +255,6 @@ program
|
|
|
259
255
|
body.status = opts.status;
|
|
260
256
|
if (opts.price)
|
|
261
257
|
body.paymentOptions = [{ usdAmount: opts.price, amount: opts.price }];
|
|
262
|
-
if (opts.splits)
|
|
263
|
-
body.splits = JSON.parse(opts.splits);
|
|
264
258
|
const data = await fetchJson(`${API_BASE}/api/endpoints/${id}`, {
|
|
265
259
|
method: 'PUT',
|
|
266
260
|
headers: await walletHeaders(privateKey),
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const APINOW_SDK_VERSION = "0.29.
|
|
1
|
+
export declare const APINOW_SDK_VERSION = "0.29.1";
|
|
2
2
|
export interface CallOptions {
|
|
3
3
|
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
4
4
|
body?: Record<string, any>;
|
|
@@ -141,13 +141,6 @@ export declare function createClient(config: ApinowConfig): {
|
|
|
141
141
|
* Get public endpoint info (free, no payment).
|
|
142
142
|
*/
|
|
143
143
|
info(namespace: string, endpointName: string): Promise<any>;
|
|
144
|
-
/**
|
|
145
|
-
* Create an endpoint. If `splits` are provided they must sum to exactly
|
|
146
|
-
* `10000` basis points; the server deploys a 0xSplits V2 splitter after
|
|
147
|
-
* creation and stores `splitterAddress` on the endpoint. Non-fatal if
|
|
148
|
-
* the splitter deploy fails — endpoint will exist without one and can be
|
|
149
|
-
* retried via `updateEndpoint({ splits })`.
|
|
150
|
-
*/
|
|
151
144
|
createEndpoint(config: {
|
|
152
145
|
namespace: string;
|
|
153
146
|
endpointName: string;
|
|
@@ -166,15 +159,8 @@ export declare function createClient(config: ApinowConfig): {
|
|
|
166
159
|
exampleQuery?: any;
|
|
167
160
|
exampleOutput?: any;
|
|
168
161
|
docsUrl?: string;
|
|
169
|
-
splits?: SplitInput[];
|
|
170
162
|
}): Promise<any>;
|
|
171
163
|
getEndpoint(id: string): Promise<any>;
|
|
172
|
-
/**
|
|
173
|
-
* Update an endpoint. Changing `splits` (structurally) redeploys the
|
|
174
|
-
* splitter contract (V2 is immutable); the old address is archived on
|
|
175
|
-
* `previousSplitters[]` and the platform drains leftover USDC from it.
|
|
176
|
-
* `splits` must sum to `10000` basis points when non-empty.
|
|
177
|
-
*/
|
|
178
164
|
updateEndpoint(id: string, updates: {
|
|
179
165
|
url?: string;
|
|
180
166
|
description?: string;
|
|
@@ -186,7 +172,6 @@ export declare function createClient(config: ApinowConfig): {
|
|
|
186
172
|
tokenSymbol?: string;
|
|
187
173
|
}>;
|
|
188
174
|
status?: string;
|
|
189
|
-
splits?: SplitInput[];
|
|
190
175
|
querySchema?: any;
|
|
191
176
|
responseSchema?: any;
|
|
192
177
|
exampleQuery?: any;
|
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.29.
|
|
5
|
+
export const APINOW_SDK_VERSION = '0.29.1';
|
|
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
|
|
@@ -226,13 +226,6 @@ export function createClient(config) {
|
|
|
226
226
|
return res.json();
|
|
227
227
|
},
|
|
228
228
|
// ─── Endpoint CRUD ───
|
|
229
|
-
/**
|
|
230
|
-
* Create an endpoint. If `splits` are provided they must sum to exactly
|
|
231
|
-
* `10000` basis points; the server deploys a 0xSplits V2 splitter after
|
|
232
|
-
* creation and stores `splitterAddress` on the endpoint. Non-fatal if
|
|
233
|
-
* the splitter deploy fails — endpoint will exist without one and can be
|
|
234
|
-
* retried via `updateEndpoint({ splits })`.
|
|
235
|
-
*/
|
|
236
229
|
async createEndpoint(config) {
|
|
237
230
|
return authedJson(`${baseUrl}/api/endpoints`, {
|
|
238
231
|
method: 'POST',
|
|
@@ -245,12 +238,6 @@ export function createClient(config) {
|
|
|
245
238
|
throw new Error(`Failed to get endpoint: ${res.status}`);
|
|
246
239
|
return res.json();
|
|
247
240
|
},
|
|
248
|
-
/**
|
|
249
|
-
* Update an endpoint. Changing `splits` (structurally) redeploys the
|
|
250
|
-
* splitter contract (V2 is immutable); the old address is archived on
|
|
251
|
-
* `previousSplitters[]` and the platform drains leftover USDC from it.
|
|
252
|
-
* `splits` must sum to `10000` basis points when non-empty.
|
|
253
|
-
*/
|
|
254
241
|
async updateEndpoint(id, updates) {
|
|
255
242
|
return authedJson(`${baseUrl}/api/endpoints/${id}`, {
|
|
256
243
|
method: 'PUT',
|
package/package.json
CHANGED