milypay 0.2.0 → 0.2.6
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 +24 -3
- package/dist/index.js +1282 -92
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
package/dist/index.js
CHANGED
|
@@ -1,92 +1,438 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// src/services.ts
|
|
4
|
-
var
|
|
3
|
+
// src/services.generated.ts
|
|
4
|
+
var GENERATED_SERVICES = [
|
|
5
|
+
{
|
|
6
|
+
"id": "au-business/abn",
|
|
7
|
+
"method": "GET",
|
|
8
|
+
"path": "/au-business/abn/{abn}",
|
|
9
|
+
"price": "0.002",
|
|
10
|
+
"description": "Australian business by ABN (entity name, status, type, ACN, GST, business names, location). Source: ABR."
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"id": "au-business/acn",
|
|
14
|
+
"method": "GET",
|
|
15
|
+
"path": "/au-business/acn/{acn}",
|
|
16
|
+
"price": "0.002",
|
|
17
|
+
"description": "Australian business resolved from an ACN. Source: ABR."
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "au-business/search",
|
|
21
|
+
"method": "GET",
|
|
22
|
+
"path": "/au-business/search?name={name}",
|
|
23
|
+
"price": "0.004",
|
|
24
|
+
"description": "ABN name search by business or entity name. Source: ABR."
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "au-company/acn",
|
|
28
|
+
"method": "GET",
|
|
29
|
+
"path": "/au-company/acn/{acn}",
|
|
30
|
+
"price": "0.002",
|
|
31
|
+
"description": "ASIC company by ACN: status, type, class, registration dates, former names. Free open data."
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "au-company/search",
|
|
35
|
+
"method": "GET",
|
|
36
|
+
"path": "/au-company/search?name={name}",
|
|
37
|
+
"price": "0.004",
|
|
38
|
+
"description": "ASIC company name search (current and former names). Free open data."
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": "au-asic-extract/search",
|
|
42
|
+
"method": "GET",
|
|
43
|
+
"path": "/au-asic-extract/search?name={name}",
|
|
44
|
+
"price": "0.005",
|
|
45
|
+
"description": "TEST MODE (Acceleon UAT): ASIC organisation name search. Returns NNIs."
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"id": "au-asic-extract/company",
|
|
49
|
+
"method": "GET",
|
|
50
|
+
"path": "/au-asic-extract/company/{nni}",
|
|
51
|
+
"price": "0.005",
|
|
52
|
+
"description": "TEST MODE (Acceleon UAT): ASIC company details + canPurchase flags."
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"id": "au-asic-extract/business",
|
|
56
|
+
"method": "GET",
|
|
57
|
+
"path": "/au-asic-extract/business/{nni}",
|
|
58
|
+
"price": "0.005",
|
|
59
|
+
"description": "TEST MODE (Acceleon UAT): ASIC business name details."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"id": "POST au-asic-extract/purchase",
|
|
63
|
+
"method": "POST",
|
|
64
|
+
"path": "/au-asic-extract/purchase",
|
|
65
|
+
"price": "0.10",
|
|
66
|
+
"description": "TEST MODE (Acceleon UAT): buy an ASIC extract ({nni,kind,type}); 0.10 current / 0.20 historical. Returns extractId + buyer token. Extract content is dummy UAT data."
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"id": "au-company-report",
|
|
70
|
+
"method": "GET",
|
|
71
|
+
"path": "/au-company-report?acn={acn}",
|
|
72
|
+
"price": "12.00",
|
|
73
|
+
"description": "Official ASIC company extract (directors, office, share capital). Paid DSP only; not in free gov open data."
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"id": "au-address/validate",
|
|
77
|
+
"method": "GET",
|
|
78
|
+
"path": "/au-address/validate?q={address}",
|
|
79
|
+
"price": "0.004",
|
|
80
|
+
"description": "Validate an Australian address against G-NAF. Returns canonical address, GNAF PID, geocode."
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"id": "au-address/search",
|
|
84
|
+
"method": "GET",
|
|
85
|
+
"path": "/au-address/search?q={query}",
|
|
86
|
+
"price": "0.004",
|
|
87
|
+
"description": "Ranked Australian address matches (autocomplete) from G-NAF."
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"id": "au-address/geocode",
|
|
91
|
+
"method": "GET",
|
|
92
|
+
"path": "/au-address/geocode?q={address}",
|
|
93
|
+
"price": "0.004",
|
|
94
|
+
"description": "Latitude and longitude for an Australian address from G-NAF."
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"id": "au-super/abn",
|
|
98
|
+
"method": "GET",
|
|
99
|
+
"path": "/au-super/abn/{abn}",
|
|
100
|
+
"price": "0.002",
|
|
101
|
+
"description": "Super fund lookup by ABN: fund name, status, type, complying status, USIs. Source: ATO."
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"id": "au-weather",
|
|
105
|
+
"method": "GET",
|
|
106
|
+
"path": "/au-weather?q={address}",
|
|
107
|
+
"price": "0.001",
|
|
108
|
+
"description": "Current conditions and forecast for an Australian address (BOM ACCESS-G via Open-Meteo)."
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"id": "au-weather",
|
|
112
|
+
"method": "GET",
|
|
113
|
+
"path": "/au-weather?lat={lat}&lng={lng}",
|
|
114
|
+
"price": "0.001",
|
|
115
|
+
"description": "Current conditions and forecast for an Australian coordinate."
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"id": "au-postage",
|
|
119
|
+
"method": "GET",
|
|
120
|
+
"path": "/au-postage?from={postcode}&to={postcode}&weight={kg}&length={cm}&width={cm}&height={cm}",
|
|
121
|
+
"price": "0.002",
|
|
122
|
+
"description": "Australia Post domestic parcel rates and services between two postcodes."
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"id": "au-postage",
|
|
126
|
+
"method": "GET",
|
|
127
|
+
"path": "/au-postage?country={code}&weight={kg}",
|
|
128
|
+
"price": "0.002",
|
|
129
|
+
"description": "Australia Post international parcel rates and services."
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"id": "au-bsb",
|
|
133
|
+
"method": "GET",
|
|
134
|
+
"path": "/au-bsb/{bsb}",
|
|
135
|
+
"price": "0.002",
|
|
136
|
+
"description": "BSB lookup: bank name, branch, address, state, postcode, and supported payment methods (paper/electronic/high-value). 17,000+ BSBs from AusPayNet."
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"id": "au-bsb/search",
|
|
140
|
+
"method": "GET",
|
|
141
|
+
"path": "/au-bsb/search?q={query}",
|
|
142
|
+
"price": "0.004",
|
|
143
|
+
"description": "Search BSBs by bank name, branch name, or suburb."
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"id": "au-abs/dataflows",
|
|
147
|
+
"method": "GET",
|
|
148
|
+
"path": "/au-abs/dataflows?q={query}",
|
|
149
|
+
"price": "0.002",
|
|
150
|
+
"description": "Search ABS SDMX dataflow catalogue (CPI, labour, ERP, census, \u2026). Source: ABS Data API."
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"id": "au-abs/dataflow",
|
|
154
|
+
"method": "GET",
|
|
155
|
+
"path": "/au-abs/dataflow/{id}",
|
|
156
|
+
"price": "0.002",
|
|
157
|
+
"description": "ABS dataflow structure/metadata by id (e.g. CPI, WPI, RT)."
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"id": "au-abs/data",
|
|
161
|
+
"method": "GET",
|
|
162
|
+
"path": "/au-abs/data/{dataflow}?key={key}&startPeriod={period}",
|
|
163
|
+
"price": "0.005",
|
|
164
|
+
"description": "Fetch ABS series observations (normalised JSON). Source: ABS Data API."
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"id": "au-abs/cpi",
|
|
168
|
+
"method": "GET",
|
|
169
|
+
"path": "/au-abs/cpi?startPeriod={period}",
|
|
170
|
+
"price": "0.003",
|
|
171
|
+
"description": "Headline All groups CPI index (Australia, quarterly) with latest/QoQ/YoY. Catalogue 6401.0."
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"id": "au-energy",
|
|
175
|
+
"method": "GET",
|
|
176
|
+
"path": "/au-energy",
|
|
177
|
+
"price": "0.001",
|
|
178
|
+
"description": "Australian energy products catalogue (NEM electricity; gas/water planned)."
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"id": "au-energy/nem",
|
|
182
|
+
"method": "GET",
|
|
183
|
+
"path": "/au-energy/nem",
|
|
184
|
+
"price": "0.002",
|
|
185
|
+
"description": "Live AEMO NEM wholesale price + demand for all regions (NSW1/QLD1/SA1/TAS1/VIC1)."
|
|
186
|
+
},
|
|
5
187
|
{
|
|
6
|
-
id: "au-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
188
|
+
"id": "au-energy/nem",
|
|
189
|
+
"method": "GET",
|
|
190
|
+
"path": "/au-energy/nem/{region}",
|
|
191
|
+
"price": "0.002",
|
|
192
|
+
"description": "Live AEMO NEM snapshot for one region (NSW1 or NSW, etc)."
|
|
10
193
|
},
|
|
11
194
|
{
|
|
12
|
-
id: "au-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
195
|
+
"id": "au-energy/notices",
|
|
196
|
+
"method": "GET",
|
|
197
|
+
"path": "/au-energy/notices?limit=",
|
|
198
|
+
"price": "0.002",
|
|
199
|
+
"description": "Recent AEMO electricity market notices."
|
|
16
200
|
},
|
|
17
201
|
{
|
|
18
|
-
id: "
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
202
|
+
"id": "domains",
|
|
203
|
+
"method": "GET",
|
|
204
|
+
"path": "/domains",
|
|
205
|
+
"price": "0.001",
|
|
206
|
+
"description": "Domain catalogue (Dynadot x402 register proxy)."
|
|
22
207
|
},
|
|
23
208
|
{
|
|
24
|
-
id: "
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
209
|
+
"id": "domains/check",
|
|
210
|
+
"method": "GET",
|
|
211
|
+
"path": "/domains/check?name=",
|
|
212
|
+
"price": "0.01",
|
|
213
|
+
"description": "Domain availability + registrar cost."
|
|
28
214
|
},
|
|
29
215
|
{
|
|
30
|
-
id: "
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
216
|
+
"id": "domains/quote",
|
|
217
|
+
"method": "GET",
|
|
218
|
+
"path": "/domains/quote?name=&years=",
|
|
219
|
+
"price": "0.01",
|
|
220
|
+
"description": "Domain agent checkout price (cost+markup)."
|
|
34
221
|
},
|
|
35
222
|
{
|
|
36
|
-
id: "
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
223
|
+
"id": "POST domains/register",
|
|
224
|
+
"method": "POST",
|
|
225
|
+
"path": "/domains/register",
|
|
226
|
+
"price": "variable",
|
|
227
|
+
"description": "Register domain after x402 payment for quote amount."
|
|
40
228
|
},
|
|
41
229
|
{
|
|
42
|
-
id: "au-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
230
|
+
"id": "au-rides",
|
|
231
|
+
"method": "GET",
|
|
232
|
+
"path": "/au-rides",
|
|
233
|
+
"price": "0.001",
|
|
234
|
+
"description": "Rides catalogue (Uber quote-only, no booking)."
|
|
46
235
|
},
|
|
47
236
|
{
|
|
48
|
-
id: "au-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
237
|
+
"id": "au-rides/quote",
|
|
238
|
+
"method": "GET",
|
|
239
|
+
"path": "/au-rides/quote?start_lat=&start_lng=&end_lat=&end_lng=",
|
|
240
|
+
"price": "0.01",
|
|
241
|
+
"description": "Uber price estimates between two points (quote only)."
|
|
52
242
|
},
|
|
53
243
|
{
|
|
54
|
-
id: "au-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
244
|
+
"id": "au-rides/eta",
|
|
245
|
+
"method": "GET",
|
|
246
|
+
"path": "/au-rides/eta?start_lat=&start_lng=",
|
|
247
|
+
"price": "0.01",
|
|
248
|
+
"description": "Uber pickup time estimates (quote only)."
|
|
58
249
|
},
|
|
59
250
|
{
|
|
60
|
-
id: "au-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
251
|
+
"id": "au-rides/products",
|
|
252
|
+
"method": "GET",
|
|
253
|
+
"path": "/au-rides/products?lat=&lng=",
|
|
254
|
+
"price": "0.005",
|
|
255
|
+
"description": "Uber products available at a location."
|
|
64
256
|
},
|
|
65
257
|
{
|
|
66
|
-
id: "au-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
258
|
+
"id": "au-phone",
|
|
259
|
+
"method": "GET",
|
|
260
|
+
"path": "/au-phone?number={e164}",
|
|
261
|
+
"price": "0.05",
|
|
262
|
+
"description": "Phone line intel: valid, type, carrier (not personal identity)."
|
|
70
263
|
},
|
|
71
264
|
{
|
|
72
|
-
id: "au-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
265
|
+
"id": "au-check",
|
|
266
|
+
"method": "GET",
|
|
267
|
+
"path": "/au-check",
|
|
268
|
+
"price": "0.001",
|
|
269
|
+
"description": "Checkify extras catalogue (postcode, reverse geo, names, sanctions, checksums)."
|
|
76
270
|
},
|
|
77
271
|
{
|
|
78
|
-
id: "au-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
272
|
+
"id": "au-check/postcode",
|
|
273
|
+
"method": "GET",
|
|
274
|
+
"path": "/au-check/postcode?postcode=",
|
|
275
|
+
"price": "0.01",
|
|
276
|
+
"description": "Suburbs in a postcode (AU/NZ via Checkify)."
|
|
82
277
|
},
|
|
83
278
|
{
|
|
84
|
-
id: "au-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
279
|
+
"id": "au-check/reverse",
|
|
280
|
+
"method": "GET",
|
|
281
|
+
"path": "/au-check/reverse?lat=&lng=",
|
|
282
|
+
"price": "0.01",
|
|
283
|
+
"description": "Reverse geocode nearest address."
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"id": "au-check/suburb",
|
|
287
|
+
"method": "GET",
|
|
288
|
+
"path": "/au-check/suburb?q=",
|
|
289
|
+
"price": "0.005",
|
|
290
|
+
"description": "Suburb autocomplete."
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"id": "au-check/activity",
|
|
294
|
+
"method": "GET",
|
|
295
|
+
"path": "/au-check/activity?q=",
|
|
296
|
+
"price": "0.005",
|
|
297
|
+
"description": "ANZSIC / business activity search."
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"id": "au-check/company-name",
|
|
301
|
+
"method": "GET",
|
|
302
|
+
"path": "/au-check/company-name?name=",
|
|
303
|
+
"price": "0.01",
|
|
304
|
+
"description": "ASIC company name availability."
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"id": "au-check/business-name",
|
|
308
|
+
"method": "GET",
|
|
309
|
+
"path": "/au-check/business-name?name=",
|
|
310
|
+
"price": "0.01",
|
|
311
|
+
"description": "ASIC business name availability."
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
"id": "au-check/sanctions",
|
|
315
|
+
"method": "GET",
|
|
316
|
+
"path": "/au-check/sanctions?name=",
|
|
317
|
+
"price": "0.03",
|
|
318
|
+
"description": "Sanctions screening (11 lists)."
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"id": "au-check/director-id",
|
|
322
|
+
"method": "GET",
|
|
323
|
+
"path": "/au-check/director-id?id=",
|
|
324
|
+
"price": "0.01",
|
|
325
|
+
"description": "Director ID checksum (not live ABRS)."
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"id": "au-check/tfn",
|
|
329
|
+
"method": "GET",
|
|
330
|
+
"path": "/au-check/tfn?tfn=",
|
|
331
|
+
"price": "0.01",
|
|
332
|
+
"description": "TFN checksum (not live ATO)."
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"id": "au-check/email",
|
|
336
|
+
"method": "GET",
|
|
337
|
+
"path": "/au-check/email?email=",
|
|
338
|
+
"price": "0.01",
|
|
339
|
+
"description": "Email validation (format/MX/deliverability)."
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
"id": "au-phone",
|
|
343
|
+
"method": "GET",
|
|
344
|
+
"path": "/au-phone/{e164}",
|
|
345
|
+
"price": "0.05",
|
|
346
|
+
"description": "Phone line intel by path (URL-encode +)."
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
"id": "au-transit/regions",
|
|
350
|
+
"method": "GET",
|
|
351
|
+
"path": "/au-transit/regions",
|
|
352
|
+
"price": "0.001",
|
|
353
|
+
"description": "Australian public transport regions (live GTFS-RT + planned)."
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"id": "au-transit/vehicles",
|
|
357
|
+
"method": "GET",
|
|
358
|
+
"path": "/au-transit/{region}/vehicles",
|
|
359
|
+
"price": "0.003",
|
|
360
|
+
"description": "Live vehicle positions (GTFS-RT). region=seq|sa. Optional routeId, limit."
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"id": "au-transit/trip-updates",
|
|
364
|
+
"method": "GET",
|
|
365
|
+
"path": "/au-transit/{region}/trip-updates",
|
|
366
|
+
"price": "0.003",
|
|
367
|
+
"description": "Live trip delays/ETAs (GTFS-RT). Optional routeId, stopId, limit."
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"id": "au-transit/alerts",
|
|
371
|
+
"method": "GET",
|
|
372
|
+
"path": "/au-transit/{region}/alerts",
|
|
373
|
+
"price": "0.002",
|
|
374
|
+
"description": "Service alerts (GTFS-RT)."
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
"id": "au-transit/summary",
|
|
378
|
+
"method": "GET",
|
|
379
|
+
"path": "/au-transit/{region}/summary",
|
|
380
|
+
"price": "0.002",
|
|
381
|
+
"description": "Feed health counts + sample for a region."
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"id": "au-asic-extract",
|
|
385
|
+
"method": "GET",
|
|
386
|
+
"path": "/au-asic-extract",
|
|
387
|
+
"price": "0",
|
|
388
|
+
"description": "ASIC extract catalogue (Acceleon UAT test mode)."
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
"id": "au-asic-extract/status",
|
|
392
|
+
"method": "GET",
|
|
393
|
+
"path": "/au-asic-extract/status/{id}?token={token}",
|
|
394
|
+
"price": "0",
|
|
395
|
+
"description": "Extract status (buyer token from purchase)."
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"id": "au-asic-extract/extract",
|
|
399
|
+
"method": "GET",
|
|
400
|
+
"path": "/au-asic-extract/extract/{id}?token={token}",
|
|
401
|
+
"price": "0",
|
|
402
|
+
"description": "Download extract JSON / PDF (buyer token from purchase)."
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"id": "ramp/moneygram",
|
|
406
|
+
"method": "GET",
|
|
407
|
+
"path": "/ramp/moneygram",
|
|
408
|
+
"price": "0",
|
|
409
|
+
"description": "MoneyGram funding status (pre-x402 wallet top-up)."
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"id": "POST ramp/moneygram/session",
|
|
413
|
+
"method": "POST",
|
|
414
|
+
"path": "/ramp/moneygram/session",
|
|
415
|
+
"price": "0",
|
|
416
|
+
"description": "Create MoneyGram sandbox session (on-ramp / off-ramp)."
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"id": "status",
|
|
420
|
+
"method": "GET",
|
|
421
|
+
"path": "/status",
|
|
422
|
+
"price": "0",
|
|
423
|
+
"description": "Service health (JSON)."
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
"id": "stats",
|
|
427
|
+
"method": "GET",
|
|
428
|
+
"path": "/stats",
|
|
429
|
+
"price": "0",
|
|
430
|
+
"description": "Usage stats."
|
|
88
431
|
}
|
|
89
432
|
];
|
|
433
|
+
|
|
434
|
+
// src/services.ts
|
|
435
|
+
var SERVICES = GENERATED_SERVICES;
|
|
90
436
|
var DEMO_BASE = "https://milypay.xyz";
|
|
91
437
|
var API_BASE = "https://api.milypay.xyz";
|
|
92
438
|
var DOCS = "https://milypay.xyz/agents.md";
|
|
@@ -142,6 +488,10 @@ function walletHelp() {
|
|
|
142
488
|
].join("\n");
|
|
143
489
|
}
|
|
144
490
|
|
|
491
|
+
// src/version.ts
|
|
492
|
+
var VERSION = "0.2.6";
|
|
493
|
+
var USER_AGENT = `milypay-cli/${VERSION}`;
|
|
494
|
+
|
|
145
495
|
// src/client.ts
|
|
146
496
|
function resolveBase(host, wallet, override) {
|
|
147
497
|
if (override) return override.replace(/\/$/, "");
|
|
@@ -160,12 +510,42 @@ function withHostPath(base, path) {
|
|
|
160
510
|
function log(quiet, msg) {
|
|
161
511
|
if (!quiet) process.stderr.write(msg + "\n");
|
|
162
512
|
}
|
|
163
|
-
|
|
513
|
+
function fundingHintFromBody(body) {
|
|
514
|
+
if (!body || typeof body !== "object") return "";
|
|
515
|
+
const b = body;
|
|
516
|
+
const funding = b.funding;
|
|
517
|
+
const mg = funding?.moneygram;
|
|
518
|
+
if (!mg) return "";
|
|
519
|
+
return [
|
|
520
|
+
"",
|
|
521
|
+
"Underfunded? MoneyGram sandbox can top up USDC (does not settle x402):",
|
|
522
|
+
mg.demoUi ? ` UI: ${mg.demoUi}` : " UI: https://milypay.xyz/fund",
|
|
523
|
+
mg.session ? ` API: POST ${mg.session} {"mode":"on-ramp"}` : " API: POST /ramp/moneygram/session",
|
|
524
|
+
" CLI: milypay fund session"
|
|
525
|
+
].join("\n");
|
|
526
|
+
}
|
|
527
|
+
async function milypayFetch(path, opts2 = { host: "auto" }, init = {}) {
|
|
164
528
|
const wallet = loadWallet();
|
|
165
529
|
let base = resolveBase(opts2.host, wallet, opts2.baseUrl);
|
|
166
530
|
let url = path.startsWith("http") ? path : withHostPath(base, path);
|
|
531
|
+
const method = (init.method || "GET").toUpperCase();
|
|
532
|
+
const headers = {
|
|
533
|
+
accept: "application/json",
|
|
534
|
+
"user-agent": USER_AGENT,
|
|
535
|
+
...init.headers || {}
|
|
536
|
+
};
|
|
537
|
+
let body;
|
|
538
|
+
if (init.body !== void 0 && method !== "GET" && method !== "HEAD") {
|
|
539
|
+
body = typeof init.body === "string" ? init.body : JSON.stringify(init.body);
|
|
540
|
+
if (!headers["content-type"] && !headers["Content-Type"]) {
|
|
541
|
+
headers["content-type"] = "application/json";
|
|
542
|
+
}
|
|
543
|
+
}
|
|
167
544
|
if (wallet && (base.includes("api.milypay.xyz") || opts2.host === "api" || Boolean(opts2.baseUrl))) {
|
|
168
|
-
log(
|
|
545
|
+
log(
|
|
546
|
+
opts2.quiet,
|
|
547
|
+
`\u2192 ${method} ${url} (paying as ${wallet.address.slice(0, 4)}\u2026${wallet.address.slice(-4)})`
|
|
548
|
+
);
|
|
169
549
|
const client = createX402Client({
|
|
170
550
|
wallet: {
|
|
171
551
|
address: wallet.address,
|
|
@@ -175,39 +555,38 @@ async function milypayFetch(path, opts2 = { host: "auto" }) {
|
|
|
175
555
|
rpcUrl: opts2.rpcUrl || process.env.SOLANA_RPC_URL || process.env.HELIUS_RPC_URL || "https://solana-rpc.publicnode.com",
|
|
176
556
|
amount: opts2.maxAmount ?? BigInt(5e7)
|
|
177
557
|
});
|
|
178
|
-
const res2 = await client.fetch(url, {
|
|
179
|
-
headers: { accept: "application/json", "user-agent": "milypay-cli/0.1.0" }
|
|
180
|
-
});
|
|
558
|
+
const res2 = await client.fetch(url, { method, headers, body });
|
|
181
559
|
return { res: res2, base, paid: true };
|
|
182
560
|
}
|
|
183
|
-
log(opts2.quiet, `\u2192 ${url}${wallet ? "" : " (demo / free host)"}`);
|
|
184
|
-
let res = await fetch(url, {
|
|
185
|
-
headers: { accept: "application/json", "user-agent": "milypay-cli/0.1.0" }
|
|
186
|
-
});
|
|
561
|
+
log(opts2.quiet, `\u2192 ${method} ${url}${wallet ? "" : " (demo / free host)"}`);
|
|
562
|
+
let res = await fetch(url, { method, headers, body });
|
|
187
563
|
if (res.status === 402 && !wallet && opts2.host === "auto" && base === API_BASE) {
|
|
188
564
|
base = DEMO_BASE;
|
|
189
565
|
url = withHostPath(base, path);
|
|
190
566
|
log(opts2.quiet, `402 Payment Required \u2014 retrying free demo host`);
|
|
191
|
-
res = await fetch(url, {
|
|
192
|
-
headers: { accept: "application/json", "user-agent": "milypay-cli/0.1.0" }
|
|
193
|
-
});
|
|
567
|
+
res = await fetch(url, { method, headers, body });
|
|
194
568
|
}
|
|
195
569
|
if (res.status === 402 && !wallet) {
|
|
196
|
-
const
|
|
570
|
+
const text = await res.text();
|
|
571
|
+
let parsed = text;
|
|
572
|
+
try {
|
|
573
|
+
parsed = text ? JSON.parse(text) : null;
|
|
574
|
+
} catch {
|
|
575
|
+
}
|
|
197
576
|
const err = new Error(
|
|
198
577
|
[
|
|
199
578
|
"Payment required and no wallet configured.",
|
|
200
579
|
"Set MILYPAY_PRIVATE_KEY (base58 secret) to pay on api.milypay.xyz,",
|
|
201
580
|
"or pass --demo to use the free rate-limited host.",
|
|
202
|
-
|
|
581
|
+
fundingHintFromBody(parsed),
|
|
582
|
+
text ? `Server: ${text.slice(0, 300)}` : ""
|
|
203
583
|
].filter(Boolean).join("\n")
|
|
204
584
|
);
|
|
205
585
|
throw err;
|
|
206
586
|
}
|
|
207
587
|
return { res, base, paid: false };
|
|
208
588
|
}
|
|
209
|
-
async function
|
|
210
|
-
const { res } = await milypayFetch(path, opts2);
|
|
589
|
+
async function parseJsonResponse(res) {
|
|
211
590
|
const text = await res.text();
|
|
212
591
|
let data = text;
|
|
213
592
|
try {
|
|
@@ -216,20 +595,27 @@ async function getJson(path, opts2) {
|
|
|
216
595
|
}
|
|
217
596
|
if (!res.ok) {
|
|
218
597
|
const msg = typeof data === "object" && data && "error" in data ? String(data.error) : text.slice(0, 400);
|
|
219
|
-
|
|
598
|
+
const hint = fundingHintFromBody(data);
|
|
599
|
+
throw new Error(`HTTP ${res.status}: ${msg}${hint}`);
|
|
220
600
|
}
|
|
221
601
|
return data;
|
|
222
602
|
}
|
|
603
|
+
async function getJson(path, opts2) {
|
|
604
|
+
const { res } = await milypayFetch(path, opts2);
|
|
605
|
+
return parseJsonResponse(res);
|
|
606
|
+
}
|
|
607
|
+
async function postJson(path, body, opts2) {
|
|
608
|
+
const { res } = await milypayFetch(path, opts2, { method: "POST", body: body ?? {} });
|
|
609
|
+
return parseJsonResponse(res);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
// src/index.ts
|
|
613
|
+
import { writeFileSync } from "fs";
|
|
223
614
|
|
|
224
615
|
// src/mcp.ts
|
|
225
616
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
226
617
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
227
618
|
import { z } from "zod";
|
|
228
|
-
|
|
229
|
-
// src/version.ts
|
|
230
|
-
var VERSION = "0.2.0";
|
|
231
|
-
|
|
232
|
-
// src/mcp.ts
|
|
233
619
|
function hostFromEnv() {
|
|
234
620
|
const h = (process.env.MILYPAY_HOST || "auto").toLowerCase();
|
|
235
621
|
if (h === "demo" || h === "api" || h === "auto") return h;
|
|
@@ -246,15 +632,14 @@ function opts() {
|
|
|
246
632
|
function digits(s) {
|
|
247
633
|
return s.replace(/\D/g, "");
|
|
248
634
|
}
|
|
635
|
+
var MAX_TEXT = Number(process.env.MILYPAY_MCP_MAX_CHARS || 2e5);
|
|
249
636
|
function ok(data) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
]
|
|
257
|
-
};
|
|
637
|
+
let text = typeof data === "string" ? data : JSON.stringify(data);
|
|
638
|
+
if (text.length > MAX_TEXT) {
|
|
639
|
+
text = text.slice(0, MAX_TEXT) + `
|
|
640
|
+
\u2026[truncated ${text.length - MAX_TEXT} chars; narrow the query (e.g. key=, maxSeries, limit)]`;
|
|
641
|
+
}
|
|
642
|
+
return { content: [{ type: "text", text }] };
|
|
258
643
|
}
|
|
259
644
|
function fail(err) {
|
|
260
645
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -545,7 +930,7 @@ async function startMcpServer() {
|
|
|
545
930
|
"call",
|
|
546
931
|
{
|
|
547
932
|
title: "Raw API call",
|
|
548
|
-
description: "GET an arbitrary Milypay path, e.g. /au-business/abn/
|
|
933
|
+
description: "GET an arbitrary Milypay path, e.g. /au-business/abn/55695484756. Prefer typed tools when possible.",
|
|
549
934
|
inputSchema: {
|
|
550
935
|
path: z.string().describe("API path starting with /, e.g. /au-bsb/012-002")
|
|
551
936
|
}
|
|
@@ -581,6 +966,456 @@ async function startMcpServer() {
|
|
|
581
966
|
]
|
|
582
967
|
})
|
|
583
968
|
);
|
|
969
|
+
server.registerTool(
|
|
970
|
+
"abs_dataflows",
|
|
971
|
+
{
|
|
972
|
+
description: "Search or list ABS (Australian Bureau of Statistics) SDMX dataflows \u2014 CPI, wages, population, census, retail, etc.",
|
|
973
|
+
inputSchema: {
|
|
974
|
+
q: z.string().optional().describe("Search query e.g. CPI, wage, population"),
|
|
975
|
+
limit: z.number().int().min(1).max(200).optional()
|
|
976
|
+
}
|
|
977
|
+
},
|
|
978
|
+
async ({ q, limit }) => {
|
|
979
|
+
const qs = new URLSearchParams();
|
|
980
|
+
if (q) qs.set("q", q);
|
|
981
|
+
if (limit) qs.set("limit", String(limit));
|
|
982
|
+
const path = `/au-abs/dataflows${qs.toString() ? `?${qs}` : ""}`;
|
|
983
|
+
return runJson(path);
|
|
984
|
+
}
|
|
985
|
+
);
|
|
986
|
+
server.registerTool(
|
|
987
|
+
"abs_dataflow",
|
|
988
|
+
{
|
|
989
|
+
description: "ABS dataflow structure/metadata by id (e.g. CPI, WPI, RT).",
|
|
990
|
+
inputSchema: { id: z.string().describe("Dataflow id e.g. CPI") }
|
|
991
|
+
},
|
|
992
|
+
async ({ id }) => runJson(`/au-abs/dataflow/${encodeURIComponent(id)}`)
|
|
993
|
+
);
|
|
994
|
+
server.registerTool(
|
|
995
|
+
"abs_data",
|
|
996
|
+
{
|
|
997
|
+
description: "Fetch ABS statistical series (normalised observations). Prefer a series key + startPeriod.",
|
|
998
|
+
inputSchema: {
|
|
999
|
+
dataflow: z.string().describe("e.g. CPI"),
|
|
1000
|
+
key: z.string().optional().describe("SDMX key e.g. 1.10001.10.50.Q"),
|
|
1001
|
+
startPeriod: z.string().optional().describe("e.g. 2020 or 2020-Q1"),
|
|
1002
|
+
endPeriod: z.string().optional(),
|
|
1003
|
+
maxSeries: z.number().int().min(1).max(200).optional().describe("Max series returned (default 10). Use a specific key for one series.")
|
|
1004
|
+
}
|
|
1005
|
+
},
|
|
1006
|
+
async ({ dataflow, key, startPeriod, endPeriod, maxSeries }) => {
|
|
1007
|
+
const qs = new URLSearchParams();
|
|
1008
|
+
qs.set("maxSeries", String(maxSeries ?? 10));
|
|
1009
|
+
if (key) qs.set("key", key);
|
|
1010
|
+
if (startPeriod) qs.set("startPeriod", startPeriod);
|
|
1011
|
+
if (endPeriod) qs.set("endPeriod", endPeriod);
|
|
1012
|
+
if (!key && !startPeriod) qs.set("startPeriod", "2020");
|
|
1013
|
+
const q = qs.toString();
|
|
1014
|
+
return runJson(`/au-abs/data/${encodeURIComponent(dataflow)}${q ? `?${q}` : ""}`);
|
|
1015
|
+
}
|
|
1016
|
+
);
|
|
1017
|
+
server.registerTool(
|
|
1018
|
+
"abs_cpi",
|
|
1019
|
+
{
|
|
1020
|
+
description: "Headline Australian CPI (All groups, quarterly index) with latest value, QoQ and YoY % change. ABS cat. 6401.0.",
|
|
1021
|
+
inputSchema: {
|
|
1022
|
+
startPeriod: z.string().optional().describe("e.g. 2015")
|
|
1023
|
+
}
|
|
1024
|
+
},
|
|
1025
|
+
async ({ startPeriod }) => {
|
|
1026
|
+
const qs = startPeriod ? `?startPeriod=${encodeURIComponent(startPeriod)}` : "";
|
|
1027
|
+
return runJson(`/au-abs/cpi${qs}`);
|
|
1028
|
+
}
|
|
1029
|
+
);
|
|
1030
|
+
server.registerTool(
|
|
1031
|
+
"transit_regions",
|
|
1032
|
+
{
|
|
1033
|
+
description: "List Australian public transport regions available on Milypay (live GTFS-RT + planned).",
|
|
1034
|
+
inputSchema: {}
|
|
1035
|
+
},
|
|
1036
|
+
async () => runJson("/au-transit/regions")
|
|
1037
|
+
);
|
|
1038
|
+
server.registerTool(
|
|
1039
|
+
"transit_vehicles",
|
|
1040
|
+
{
|
|
1041
|
+
description: "Live public transport vehicle positions (GTFS-RT). region=seq (QLD Translink) or sa (Adelaide).",
|
|
1042
|
+
inputSchema: {
|
|
1043
|
+
region: z.string().describe("seq or sa"),
|
|
1044
|
+
routeId: z.string().optional(),
|
|
1045
|
+
limit: z.number().int().min(1).max(200).optional()
|
|
1046
|
+
}
|
|
1047
|
+
},
|
|
1048
|
+
async ({ region, routeId, limit }) => {
|
|
1049
|
+
const qs = new URLSearchParams();
|
|
1050
|
+
if (routeId) qs.set("routeId", routeId);
|
|
1051
|
+
if (limit) qs.set("limit", String(limit));
|
|
1052
|
+
const q = qs.toString();
|
|
1053
|
+
return runJson(`/au-transit/${encodeURIComponent(region)}/vehicles${q ? `?${q}` : ""}`);
|
|
1054
|
+
}
|
|
1055
|
+
);
|
|
1056
|
+
server.registerTool(
|
|
1057
|
+
"transit_trip_updates",
|
|
1058
|
+
{
|
|
1059
|
+
description: "Live trip delays and stop ETAs (GTFS-RT).",
|
|
1060
|
+
inputSchema: {
|
|
1061
|
+
region: z.string().describe("seq or sa"),
|
|
1062
|
+
routeId: z.string().optional(),
|
|
1063
|
+
stopId: z.string().optional(),
|
|
1064
|
+
limit: z.number().int().min(1).max(150).optional()
|
|
1065
|
+
}
|
|
1066
|
+
},
|
|
1067
|
+
async ({ region, routeId, stopId, limit }) => {
|
|
1068
|
+
const qs = new URLSearchParams();
|
|
1069
|
+
if (routeId) qs.set("routeId", routeId);
|
|
1070
|
+
if (stopId) qs.set("stopId", stopId);
|
|
1071
|
+
if (limit) qs.set("limit", String(limit));
|
|
1072
|
+
const q = qs.toString();
|
|
1073
|
+
return runJson(`/au-transit/${encodeURIComponent(region)}/trip-updates${q ? `?${q}` : ""}`);
|
|
1074
|
+
}
|
|
1075
|
+
);
|
|
1076
|
+
server.registerTool(
|
|
1077
|
+
"transit_alerts",
|
|
1078
|
+
{
|
|
1079
|
+
description: "Public transport service alerts (GTFS-RT).",
|
|
1080
|
+
inputSchema: {
|
|
1081
|
+
region: z.string().describe("seq or sa"),
|
|
1082
|
+
routeId: z.string().optional(),
|
|
1083
|
+
limit: z.number().int().min(1).max(100).optional()
|
|
1084
|
+
}
|
|
1085
|
+
},
|
|
1086
|
+
async ({ region, routeId, limit }) => {
|
|
1087
|
+
const qs = new URLSearchParams();
|
|
1088
|
+
if (routeId) qs.set("routeId", routeId);
|
|
1089
|
+
if (limit) qs.set("limit", String(limit));
|
|
1090
|
+
const q = qs.toString();
|
|
1091
|
+
return runJson(`/au-transit/${encodeURIComponent(region)}/alerts${q ? `?${q}` : ""}`);
|
|
1092
|
+
}
|
|
1093
|
+
);
|
|
1094
|
+
server.registerTool(
|
|
1095
|
+
"transit_summary",
|
|
1096
|
+
{
|
|
1097
|
+
description: "Summary counts of vehicles, trip updates, and alerts for a transit region.",
|
|
1098
|
+
inputSchema: { region: z.string().describe("seq or sa") }
|
|
1099
|
+
},
|
|
1100
|
+
async ({ region }) => runJson(`/au-transit/${encodeURIComponent(region)}/summary`)
|
|
1101
|
+
);
|
|
1102
|
+
server.registerTool(
|
|
1103
|
+
"energy_nem",
|
|
1104
|
+
{
|
|
1105
|
+
description: "Live Australian NEM wholesale electricity price and demand for all regions (AEMO). Returns $/MWh spot, demand MW, generation, interconnectors.",
|
|
1106
|
+
inputSchema: {}
|
|
1107
|
+
},
|
|
1108
|
+
async () => runJson("/au-energy/nem")
|
|
1109
|
+
);
|
|
1110
|
+
server.registerTool(
|
|
1111
|
+
"energy_nem_region",
|
|
1112
|
+
{
|
|
1113
|
+
description: "Live NEM snapshot for one region. region=NSW1|QLD1|SA1|TAS1|VIC1 (or NSW/QLD/SA/TAS/VIC).",
|
|
1114
|
+
inputSchema: { region: z.string().describe("NSW1, VIC1, QLD1, SA1, TAS1") }
|
|
1115
|
+
},
|
|
1116
|
+
async ({ region }) => runJson(`/au-energy/nem/${encodeURIComponent(region)}`)
|
|
1117
|
+
);
|
|
1118
|
+
server.registerTool(
|
|
1119
|
+
"energy_notices",
|
|
1120
|
+
{
|
|
1121
|
+
description: "Recent AEMO National Electricity Market notices (non-conformance, outages, etc).",
|
|
1122
|
+
inputSchema: { limit: z.number().int().min(1).max(50).optional() }
|
|
1123
|
+
},
|
|
1124
|
+
async ({ limit }) => {
|
|
1125
|
+
const q = limit ? `?limit=${limit}` : "";
|
|
1126
|
+
return runJson(`/au-energy/notices${q}`);
|
|
1127
|
+
}
|
|
1128
|
+
);
|
|
1129
|
+
server.registerTool(
|
|
1130
|
+
"lookup_phone",
|
|
1131
|
+
{
|
|
1132
|
+
description: "Phone line intelligence (Twilio): valid, country, line type (mobile/landline/voip), carrier. NOT personal identity or caller name. Accepts E.164 (+61\u2026) or AU 04\u2026",
|
|
1133
|
+
inputSchema: {
|
|
1134
|
+
number: z.string().describe("E.164 phone e.g. +614****5678 or AU mobile 0412345678")
|
|
1135
|
+
}
|
|
1136
|
+
},
|
|
1137
|
+
async ({ number }) => runJson(`/au-phone?number=${encodeURIComponent(number)}`)
|
|
1138
|
+
);
|
|
1139
|
+
server.registerTool(
|
|
1140
|
+
"domains_check",
|
|
1141
|
+
{
|
|
1142
|
+
description: "Check DNS domain availability via Dynadot (x402 catalogue).",
|
|
1143
|
+
inputSchema: { name: z.string() }
|
|
1144
|
+
},
|
|
1145
|
+
async ({ name }) => runJson(`/domains/check?name=${encodeURIComponent(name)}`)
|
|
1146
|
+
);
|
|
1147
|
+
server.registerTool(
|
|
1148
|
+
"domains_quote",
|
|
1149
|
+
{
|
|
1150
|
+
description: "Quote domain registration chargeUsd for x402.",
|
|
1151
|
+
inputSchema: { name: z.string(), years: z.number().optional() }
|
|
1152
|
+
},
|
|
1153
|
+
async ({ name, years }) => runJson(`/domains/quote?name=${encodeURIComponent(name)}&years=${years || 1}`)
|
|
1154
|
+
);
|
|
1155
|
+
server.registerTool(
|
|
1156
|
+
"rides_quote",
|
|
1157
|
+
{
|
|
1158
|
+
description: "Uber ride PRICE estimates only (no booking). start/end lat/lng. Returns product prices and surge.",
|
|
1159
|
+
inputSchema: {
|
|
1160
|
+
start_lat: z.number(),
|
|
1161
|
+
start_lng: z.number(),
|
|
1162
|
+
end_lat: z.number(),
|
|
1163
|
+
end_lng: z.number(),
|
|
1164
|
+
seat_count: z.number().int().min(1).max(10).optional()
|
|
1165
|
+
}
|
|
1166
|
+
},
|
|
1167
|
+
async ({ start_lat, start_lng, end_lat, end_lng, seat_count }) => {
|
|
1168
|
+
const qs = new URLSearchParams({
|
|
1169
|
+
start_lat: String(start_lat),
|
|
1170
|
+
start_lng: String(start_lng),
|
|
1171
|
+
end_lat: String(end_lat),
|
|
1172
|
+
end_lng: String(end_lng)
|
|
1173
|
+
});
|
|
1174
|
+
if (seat_count) qs.set("seat_count", String(seat_count));
|
|
1175
|
+
return runJson(`/au-rides/quote?${qs}`);
|
|
1176
|
+
}
|
|
1177
|
+
);
|
|
1178
|
+
server.registerTool(
|
|
1179
|
+
"rides_eta",
|
|
1180
|
+
{
|
|
1181
|
+
description: "Uber pickup ETA estimates only (no booking).",
|
|
1182
|
+
inputSchema: {
|
|
1183
|
+
start_lat: z.number(),
|
|
1184
|
+
start_lng: z.number(),
|
|
1185
|
+
product_id: z.string().optional()
|
|
1186
|
+
}
|
|
1187
|
+
},
|
|
1188
|
+
async ({ start_lat, start_lng, product_id }) => {
|
|
1189
|
+
const qs = new URLSearchParams({
|
|
1190
|
+
start_lat: String(start_lat),
|
|
1191
|
+
start_lng: String(start_lng)
|
|
1192
|
+
});
|
|
1193
|
+
if (product_id) qs.set("product_id", product_id);
|
|
1194
|
+
return runJson(`/au-rides/eta?${qs}`);
|
|
1195
|
+
}
|
|
1196
|
+
);
|
|
1197
|
+
server.registerTool(
|
|
1198
|
+
"rides_products",
|
|
1199
|
+
{
|
|
1200
|
+
description: "Uber products available at a lat/lng (no booking).",
|
|
1201
|
+
inputSchema: { lat: z.number(), lng: z.number() }
|
|
1202
|
+
},
|
|
1203
|
+
async ({ lat, lng }) => runJson(`/au-rides/products?lat=${encodeURIComponent(String(lat))}&lng=${encodeURIComponent(String(lng))}`)
|
|
1204
|
+
);
|
|
1205
|
+
server.registerTool(
|
|
1206
|
+
"check_postcode",
|
|
1207
|
+
{
|
|
1208
|
+
description: "Suburbs in an AU/NZ postcode (Checkify).",
|
|
1209
|
+
inputSchema: { postcode: z.string(), country: z.string().optional() }
|
|
1210
|
+
},
|
|
1211
|
+
async ({ postcode, country }) => {
|
|
1212
|
+
const qs = new URLSearchParams({ postcode });
|
|
1213
|
+
if (country) qs.set("country", country);
|
|
1214
|
+
return runJson(`/au-check/postcode?${qs}`);
|
|
1215
|
+
}
|
|
1216
|
+
);
|
|
1217
|
+
server.registerTool(
|
|
1218
|
+
"check_company_name",
|
|
1219
|
+
{
|
|
1220
|
+
description: "ASIC company name availability.",
|
|
1221
|
+
inputSchema: { name: z.string() }
|
|
1222
|
+
},
|
|
1223
|
+
async ({ name }) => runJson(`/au-check/company-name?name=${encodeURIComponent(name)}`)
|
|
1224
|
+
);
|
|
1225
|
+
server.registerTool(
|
|
1226
|
+
"check_sanctions",
|
|
1227
|
+
{
|
|
1228
|
+
description: "Sanctions screening against 11 lists. Optional birth_year, country, city.",
|
|
1229
|
+
inputSchema: {
|
|
1230
|
+
name: z.string(),
|
|
1231
|
+
birth_year: z.string().optional(),
|
|
1232
|
+
country: z.string().optional(),
|
|
1233
|
+
city: z.string().optional()
|
|
1234
|
+
}
|
|
1235
|
+
},
|
|
1236
|
+
async ({ name, birth_year, country, city }) => {
|
|
1237
|
+
const qs = new URLSearchParams({ name });
|
|
1238
|
+
if (birth_year) qs.set("birth_year", birth_year);
|
|
1239
|
+
if (country) qs.set("country", country);
|
|
1240
|
+
if (city) qs.set("city", city);
|
|
1241
|
+
return runJson(`/au-check/sanctions?${qs}`);
|
|
1242
|
+
}
|
|
1243
|
+
);
|
|
1244
|
+
server.registerTool(
|
|
1245
|
+
"check_email",
|
|
1246
|
+
{
|
|
1247
|
+
description: "Email format/MX/deliverability (Checkify).",
|
|
1248
|
+
inputSchema: { email: z.string() }
|
|
1249
|
+
},
|
|
1250
|
+
async ({ email }) => runJson(`/au-check/email?email=${encodeURIComponent(email)}`)
|
|
1251
|
+
);
|
|
1252
|
+
server.registerTool(
|
|
1253
|
+
"check_catalogue",
|
|
1254
|
+
{ description: "Checkify extras catalogue (postcode, reverse geo, names, sanctions, checksums).", inputSchema: {} },
|
|
1255
|
+
async () => runJson(`/au-check`)
|
|
1256
|
+
);
|
|
1257
|
+
server.registerTool(
|
|
1258
|
+
"check_reverse",
|
|
1259
|
+
{
|
|
1260
|
+
description: "Reverse geocode a lat/lng to the nearest Australian address (Checkify).",
|
|
1261
|
+
inputSchema: { lat: z.number(), lng: z.number() }
|
|
1262
|
+
},
|
|
1263
|
+
async ({ lat, lng }) => runJson(`/au-check/reverse?${new URLSearchParams({ lat: String(lat), lng: String(lng) })}`)
|
|
1264
|
+
);
|
|
1265
|
+
server.registerTool(
|
|
1266
|
+
"check_suburb",
|
|
1267
|
+
{ description: "Suburb / locality autocomplete (Checkify).", inputSchema: { q: z.string() } },
|
|
1268
|
+
async ({ q }) => runJson(`/au-check/suburb?${new URLSearchParams({ q })}`)
|
|
1269
|
+
);
|
|
1270
|
+
server.registerTool(
|
|
1271
|
+
"check_activity",
|
|
1272
|
+
{ description: "ANZSIC / business activity search (Checkify).", inputSchema: { q: z.string() } },
|
|
1273
|
+
async ({ q }) => runJson(`/au-check/activity?${new URLSearchParams({ q })}`)
|
|
1274
|
+
);
|
|
1275
|
+
server.registerTool(
|
|
1276
|
+
"check_business_name",
|
|
1277
|
+
{ description: "ASIC business name availability.", inputSchema: { name: z.string() } },
|
|
1278
|
+
async ({ name }) => runJson(`/au-check/business-name?${new URLSearchParams({ name })}`)
|
|
1279
|
+
);
|
|
1280
|
+
server.registerTool(
|
|
1281
|
+
"check_director_id",
|
|
1282
|
+
{
|
|
1283
|
+
description: "Director ID checksum (15 digits). Structural validity only, not a live ABRS lookup.",
|
|
1284
|
+
inputSchema: { id: z.string() }
|
|
1285
|
+
},
|
|
1286
|
+
async ({ id }) => runJson(`/au-check/director-id?${new URLSearchParams({ id })}`)
|
|
1287
|
+
);
|
|
1288
|
+
server.registerTool(
|
|
1289
|
+
"check_tfn",
|
|
1290
|
+
{
|
|
1291
|
+
description: "TFN checksum. Structural validity only, not a live ATO lookup.",
|
|
1292
|
+
inputSchema: { tfn: z.string() }
|
|
1293
|
+
},
|
|
1294
|
+
async ({ tfn }) => runJson(`/au-check/tfn?${new URLSearchParams({ tfn })}`)
|
|
1295
|
+
);
|
|
1296
|
+
server.registerTool(
|
|
1297
|
+
"asic_extract_catalogue",
|
|
1298
|
+
{ description: "ASIC extract catalogue and prices (Acceleon UAT test mode).", inputSchema: {} },
|
|
1299
|
+
async () => runJson(`/au-asic-extract`)
|
|
1300
|
+
);
|
|
1301
|
+
server.registerTool(
|
|
1302
|
+
"asic_extract_search",
|
|
1303
|
+
{
|
|
1304
|
+
description: "ASIC organisation name search via Acceleon (UAT test mode). Returns NNIs for details/purchase.",
|
|
1305
|
+
inputSchema: { name: z.string().describe("Organisation name, e.g. milysec") }
|
|
1306
|
+
},
|
|
1307
|
+
async ({ name }) => runJson(`/au-asic-extract/search?${new URLSearchParams({ name })}`)
|
|
1308
|
+
);
|
|
1309
|
+
server.registerTool(
|
|
1310
|
+
"asic_extract_company",
|
|
1311
|
+
{
|
|
1312
|
+
description: "ASIC company details + canPurchase flags by NNI (ACN for companies).",
|
|
1313
|
+
inputSchema: { nni: z.string().describe("NNI / ACN, e.g. 695484756") }
|
|
1314
|
+
},
|
|
1315
|
+
async ({ nni }) => runJson(`/au-asic-extract/company/${digits(nni)}`)
|
|
1316
|
+
);
|
|
1317
|
+
server.registerTool(
|
|
1318
|
+
"asic_extract_business",
|
|
1319
|
+
{
|
|
1320
|
+
description: "ASIC business name details by NNI.",
|
|
1321
|
+
inputSchema: { nni: z.string() }
|
|
1322
|
+
},
|
|
1323
|
+
async ({ nni }) => runJson(`/au-asic-extract/business/${digits(nni)}`)
|
|
1324
|
+
);
|
|
1325
|
+
server.registerTool(
|
|
1326
|
+
"asic_extract_purchase",
|
|
1327
|
+
{
|
|
1328
|
+
description: "Buy an ASIC extract (POST, always paid via x402: 0.10 current / 0.20 historical in UAT test mode). Returns extractId + buyer token. Needs a wallet (MILYPAY_PRIVATE_KEY).",
|
|
1329
|
+
inputSchema: {
|
|
1330
|
+
nni: z.string(),
|
|
1331
|
+
kind: z.enum(["company", "business"]).optional(),
|
|
1332
|
+
type: z.enum(["current", "historical"]).optional()
|
|
1333
|
+
}
|
|
1334
|
+
},
|
|
1335
|
+
async ({ nni, kind, type }) => {
|
|
1336
|
+
try {
|
|
1337
|
+
return ok(
|
|
1338
|
+
await postJson(
|
|
1339
|
+
`/au-asic-extract/purchase`,
|
|
1340
|
+
{ nni: digits(nni), kind: kind || "company", type: type || "current" },
|
|
1341
|
+
opts()
|
|
1342
|
+
)
|
|
1343
|
+
);
|
|
1344
|
+
} catch (e) {
|
|
1345
|
+
return fail(e);
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
);
|
|
1349
|
+
server.registerTool(
|
|
1350
|
+
"asic_extract_status",
|
|
1351
|
+
{
|
|
1352
|
+
description: "Extract status by extractId (buyer token from the purchase response required).",
|
|
1353
|
+
inputSchema: { id: z.string(), token: z.string() }
|
|
1354
|
+
},
|
|
1355
|
+
async ({ id, token }) => runJson(`/au-asic-extract/status/${digits(id)}?${new URLSearchParams({ token })}`)
|
|
1356
|
+
);
|
|
1357
|
+
server.registerTool(
|
|
1358
|
+
"asic_extract_download",
|
|
1359
|
+
{
|
|
1360
|
+
description: "Download a purchased extract as JSON (pdf=true adds pdfBase64). Buyer token required.",
|
|
1361
|
+
inputSchema: { id: z.string(), token: z.string(), pdf: z.boolean().optional() }
|
|
1362
|
+
},
|
|
1363
|
+
async ({ id, token, pdf }) => {
|
|
1364
|
+
const qs = new URLSearchParams({ token });
|
|
1365
|
+
if (pdf) qs.set("pdf", "1");
|
|
1366
|
+
return runJson(`/au-asic-extract/extract/${digits(id)}?${qs}`);
|
|
1367
|
+
}
|
|
1368
|
+
);
|
|
1369
|
+
server.registerTool(
|
|
1370
|
+
"energy_catalogue",
|
|
1371
|
+
{ description: "Australian energy products catalogue.", inputSchema: {} },
|
|
1372
|
+
async () => runJson(`/au-energy`)
|
|
1373
|
+
);
|
|
1374
|
+
server.registerTool(
|
|
1375
|
+
"rides_catalogue",
|
|
1376
|
+
{ description: "Rides catalogue (Uber quote-only, no booking).", inputSchema: {} },
|
|
1377
|
+
async () => runJson(`/au-rides`)
|
|
1378
|
+
);
|
|
1379
|
+
server.registerTool(
|
|
1380
|
+
"domains_catalogue",
|
|
1381
|
+
{ description: "Domain catalogue (Dynadot x402 register proxy).", inputSchema: {} },
|
|
1382
|
+
async () => runJson(`/domains`)
|
|
1383
|
+
);
|
|
1384
|
+
server.registerTool(
|
|
1385
|
+
"service_status",
|
|
1386
|
+
{ description: "Milypay service health, including degraded upstreams.", inputSchema: {} },
|
|
1387
|
+
async () => runJson(`/status`)
|
|
1388
|
+
);
|
|
1389
|
+
server.registerTool(
|
|
1390
|
+
"moneygram_status",
|
|
1391
|
+
{
|
|
1392
|
+
description: "MoneyGram funding status for pre-x402 wallet top-up. MoneyGram does NOT settle x402 \u2014 it funds USDC so you can pay. Demo UI: https://milypay.xyz/fund",
|
|
1393
|
+
inputSchema: {}
|
|
1394
|
+
},
|
|
1395
|
+
async () => runJson(`/ramp/moneygram`)
|
|
1396
|
+
);
|
|
1397
|
+
server.registerTool(
|
|
1398
|
+
"moneygram_session",
|
|
1399
|
+
{
|
|
1400
|
+
description: "Create a MoneyGram Ramps sandbox session. Returns widgetUrl + sessionToken. Open widget to on-ramp USDC into a Solana wallet, then retry paid x402 calls. mode=on-ramp (fund) or off-ramp (cash out).",
|
|
1401
|
+
inputSchema: {
|
|
1402
|
+
mode: z.enum(["on-ramp", "off-ramp"]).optional().describe("on-ramp (default) funds wallet; off-ramp cashes out")
|
|
1403
|
+
}
|
|
1404
|
+
},
|
|
1405
|
+
async ({ mode }) => {
|
|
1406
|
+
try {
|
|
1407
|
+
return ok(
|
|
1408
|
+
await postJson(
|
|
1409
|
+
`/ramp/moneygram/session`,
|
|
1410
|
+
{ mode: mode || "on-ramp" },
|
|
1411
|
+
opts()
|
|
1412
|
+
)
|
|
1413
|
+
);
|
|
1414
|
+
} catch (e) {
|
|
1415
|
+
return fail(e);
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
);
|
|
584
1419
|
const transport = new StdioServerTransport();
|
|
585
1420
|
await server.connect(transport);
|
|
586
1421
|
}
|
|
@@ -607,8 +1442,9 @@ function parseArgs(argv) {
|
|
|
607
1442
|
out.base = argv[++i];
|
|
608
1443
|
out.host = "api";
|
|
609
1444
|
} else if (a === "--rpc") out.rpc = argv[++i];
|
|
610
|
-
else if (a
|
|
611
|
-
|
|
1445
|
+
else if (a === "--") {
|
|
1446
|
+
out._.push(...argv.slice(i + 1));
|
|
1447
|
+
break;
|
|
612
1448
|
} else out._.push(a);
|
|
613
1449
|
}
|
|
614
1450
|
return out;
|
|
@@ -630,7 +1466,7 @@ Usage:
|
|
|
630
1466
|
Commands:
|
|
631
1467
|
mcp Start MCP server (stdio) for Claude/Cursor
|
|
632
1468
|
services List endpoints + prices
|
|
633
|
-
call <path> Raw path, e.g. /au-business/abn/
|
|
1469
|
+
call <path> Raw path, e.g. /au-business/abn/55695484756
|
|
634
1470
|
abn <abn> Business by ABN
|
|
635
1471
|
acn <acn> Business by ACN
|
|
636
1472
|
business search <name> ABN name search
|
|
@@ -644,6 +1480,22 @@ Commands:
|
|
|
644
1480
|
bsb search <query> Search BSBs
|
|
645
1481
|
postage --from <pc> --to <pc> --weight <kg> [--length --width --height]
|
|
646
1482
|
postage --country <cc> --weight <kg>
|
|
1483
|
+
abs dataflows [q] | abs dataflow <id> | abs data <flow> --key <k> [--start p] [--max-series n]
|
|
1484
|
+
cpi [startPeriod] Headline CPI (ABS)
|
|
1485
|
+
transit regions | transit <region> vehicles|trips|alerts|summary [--limit n --route r --stop s]
|
|
1486
|
+
nem [region] | energy notices [n] | energy catalogue
|
|
1487
|
+
phone <number> Phone line intel
|
|
1488
|
+
check <postcode|reverse|suburb|activity|company-name|business-name|sanctions|director-id|tfn|email> <value>
|
|
1489
|
+
asic ASIC extract catalogue (Acceleon, UAT test mode)
|
|
1490
|
+
asic search <name> Organisation search (returns NNIs)
|
|
1491
|
+
asic company|business <nni> Details + purchasable flags
|
|
1492
|
+
asic purchase <nni> [--kind company|business] [--type current|historical] (paid, POST)
|
|
1493
|
+
asic status <id> --token <t> Extract status (buyer token from purchase)
|
|
1494
|
+
asic extract <id> --token <t> [--pdf] [--out file.pdf]
|
|
1495
|
+
status | stats Service health / usage
|
|
1496
|
+
fund|moneygram [status|session] MoneyGram wallet funding (pre-x402)
|
|
1497
|
+
domains check|quote <name> DNS availability / quote
|
|
1498
|
+
rides quote|eta|products \u2026 Uber estimates (quote-only)
|
|
647
1499
|
whoami Show configured wallet
|
|
648
1500
|
help This help
|
|
649
1501
|
|
|
@@ -694,6 +1546,7 @@ function clientOpts(args) {
|
|
|
694
1546
|
async function cmdServices() {
|
|
695
1547
|
const rows = SERVICES.map((s) => ({
|
|
696
1548
|
id: s.id,
|
|
1549
|
+
method: s.method,
|
|
697
1550
|
path: s.path,
|
|
698
1551
|
priceAUD: s.price,
|
|
699
1552
|
description: s.description
|
|
@@ -794,6 +1647,75 @@ async function cmdPostage(rest, args) {
|
|
|
794
1647
|
}
|
|
795
1648
|
print(await getJson(`/au-postage?${qs}`, clientOpts(args)), true);
|
|
796
1649
|
}
|
|
1650
|
+
function flagValue(rest, name) {
|
|
1651
|
+
const i = rest.indexOf(name);
|
|
1652
|
+
return i >= 0 ? rest[i + 1] : void 0;
|
|
1653
|
+
}
|
|
1654
|
+
function positionals(rest, valueFlags) {
|
|
1655
|
+
const out = [];
|
|
1656
|
+
for (let i = 0; i < rest.length; i++) {
|
|
1657
|
+
if (valueFlags.includes(rest[i])) {
|
|
1658
|
+
i++;
|
|
1659
|
+
continue;
|
|
1660
|
+
}
|
|
1661
|
+
if (rest[i].startsWith("--")) continue;
|
|
1662
|
+
out.push(rest[i]);
|
|
1663
|
+
}
|
|
1664
|
+
return out;
|
|
1665
|
+
}
|
|
1666
|
+
async function cmdAsic(rest, args) {
|
|
1667
|
+
const sub = String(rest[0] || "catalogue").toLowerCase();
|
|
1668
|
+
const tail = rest.slice(1);
|
|
1669
|
+
const pos = positionals(tail, ["--token", "--kind", "--type", "--out"]);
|
|
1670
|
+
const o = clientOpts(args);
|
|
1671
|
+
if (sub === "catalogue" || sub === "catalog") {
|
|
1672
|
+
print(await getJson(`/au-asic-extract`, o), true);
|
|
1673
|
+
return;
|
|
1674
|
+
}
|
|
1675
|
+
if (sub === "search") {
|
|
1676
|
+
const name = pos.join(" ");
|
|
1677
|
+
if (!name) throw new Error("Usage: milypay asic search <name>");
|
|
1678
|
+
print(await getJson(`/au-asic-extract/search?${new URLSearchParams({ name })}`, o), true);
|
|
1679
|
+
return;
|
|
1680
|
+
}
|
|
1681
|
+
if (sub === "company" || sub === "business") {
|
|
1682
|
+
const nni = digitsOnly(pos[0] || "");
|
|
1683
|
+
if (!nni) throw new Error(`Usage: milypay asic ${sub} <nni>`);
|
|
1684
|
+
print(await getJson(`/au-asic-extract/${sub}/${nni}`, o), true);
|
|
1685
|
+
return;
|
|
1686
|
+
}
|
|
1687
|
+
if (sub === "purchase" || sub === "buy") {
|
|
1688
|
+
const nni = digitsOnly(pos[0] || "");
|
|
1689
|
+
if (!nni) throw new Error("Usage: milypay asic purchase <nni> [--kind company|business] [--type current|historical]");
|
|
1690
|
+
const kind = (flagValue(tail, "--kind") || "company").toLowerCase();
|
|
1691
|
+
const type = (flagValue(tail, "--type") || "current").toLowerCase();
|
|
1692
|
+
print(await postJson(`/au-asic-extract/purchase`, { nni, kind, type }, o), true);
|
|
1693
|
+
return;
|
|
1694
|
+
}
|
|
1695
|
+
if (sub === "status" || sub === "extract" || sub === "download") {
|
|
1696
|
+
const id = digitsOnly(pos[0] || "");
|
|
1697
|
+
const token = flagValue(tail, "--token") || process.env.MILYPAY_EXTRACT_TOKEN;
|
|
1698
|
+
if (!id || !token) {
|
|
1699
|
+
throw new Error(`Usage: milypay asic ${sub} <extractId> --token <buyer token from purchase>`);
|
|
1700
|
+
}
|
|
1701
|
+
const qs = new URLSearchParams({ token });
|
|
1702
|
+
if (sub === "status") {
|
|
1703
|
+
print(await getJson(`/au-asic-extract/status/${id}?${qs}`, o), true);
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
const out = flagValue(tail, "--out");
|
|
1707
|
+
if (tail.includes("--pdf") || out) qs.set("pdf", "1");
|
|
1708
|
+
const data = await getJson(`/au-asic-extract/extract/${id}?${qs}`, o);
|
|
1709
|
+
if (out && typeof data.pdfBase64 === "string") {
|
|
1710
|
+
writeFileSync(out, Buffer.from(data.pdfBase64, "base64"));
|
|
1711
|
+
delete data.pdfBase64;
|
|
1712
|
+
data.savedPdf = out;
|
|
1713
|
+
}
|
|
1714
|
+
print(data, true);
|
|
1715
|
+
return;
|
|
1716
|
+
}
|
|
1717
|
+
throw new Error("Usage: milypay asic [search|company|business|purchase|status|extract] \u2026");
|
|
1718
|
+
}
|
|
797
1719
|
async function main() {
|
|
798
1720
|
const rawArgv = process.argv.slice(2);
|
|
799
1721
|
if (rawArgv[0] === "mcp") {
|
|
@@ -885,6 +1807,274 @@ async function main() {
|
|
|
885
1807
|
print({ address: w.address, source: w.source, api: API_BASE, demo: DEMO_BASE }, true);
|
|
886
1808
|
break;
|
|
887
1809
|
}
|
|
1810
|
+
case "abs": {
|
|
1811
|
+
const sub = String(args._[1] || "").toLowerCase();
|
|
1812
|
+
if (sub === "dataflows" || sub === "search" || sub === "list") {
|
|
1813
|
+
const q = args._.slice(2).join(" ");
|
|
1814
|
+
const qs = q ? `?q=${encodeURIComponent(q)}` : "";
|
|
1815
|
+
print(await getJson(`/au-abs/dataflows${qs}`, clientOpts(args)), args.json);
|
|
1816
|
+
break;
|
|
1817
|
+
}
|
|
1818
|
+
if (sub === "dataflow" || sub === "meta") {
|
|
1819
|
+
const id = String(args._[2] || "");
|
|
1820
|
+
if (!id) throw new Error("Usage: milypay abs dataflow <id>");
|
|
1821
|
+
print(await getJson(`/au-abs/dataflow/${encodeURIComponent(id)}`, clientOpts(args)), args.json);
|
|
1822
|
+
break;
|
|
1823
|
+
}
|
|
1824
|
+
if (sub === "data") {
|
|
1825
|
+
const flow = String(args._[2] || "");
|
|
1826
|
+
if (!flow) throw new Error("Usage: milypay abs data <dataflow> [--key k] [--start period]");
|
|
1827
|
+
let key = "";
|
|
1828
|
+
let start = "";
|
|
1829
|
+
let maxSeries = "";
|
|
1830
|
+
const rest2 = args._.slice(3);
|
|
1831
|
+
for (let i = 0; i < rest2.length; i++) {
|
|
1832
|
+
if (rest2[i] === "--key") key = String(rest2[++i] || "");
|
|
1833
|
+
else if (rest2[i] === "--start" || rest2[i] === "--start-period") start = String(rest2[++i] || "");
|
|
1834
|
+
else if (rest2[i] === "--max-series") maxSeries = String(rest2[++i] || "");
|
|
1835
|
+
}
|
|
1836
|
+
const qs = new URLSearchParams();
|
|
1837
|
+
if (key) qs.set("key", key);
|
|
1838
|
+
if (start) qs.set("startPeriod", start);
|
|
1839
|
+
if (maxSeries) qs.set("maxSeries", maxSeries);
|
|
1840
|
+
if (!key && !start) qs.set("startPeriod", "2020");
|
|
1841
|
+
const q = qs.toString();
|
|
1842
|
+
print(await getJson(`/au-abs/data/${encodeURIComponent(flow)}${q ? `?${q}` : ""}`, clientOpts(args)), args.json);
|
|
1843
|
+
break;
|
|
1844
|
+
}
|
|
1845
|
+
throw new Error("Usage: milypay abs dataflows|dataflow|data \u2026");
|
|
1846
|
+
}
|
|
1847
|
+
case "cpi": {
|
|
1848
|
+
const start = args._[1] ? String(args._[1]) : "";
|
|
1849
|
+
const qs = start ? `?startPeriod=${encodeURIComponent(start)}` : "";
|
|
1850
|
+
print(await getJson(`/au-abs/cpi${qs}`, clientOpts(args)), args.json);
|
|
1851
|
+
break;
|
|
1852
|
+
}
|
|
1853
|
+
case "transit": {
|
|
1854
|
+
const sub = String(args._[1] || "").toLowerCase();
|
|
1855
|
+
if (sub === "regions" || sub === "list") {
|
|
1856
|
+
print(await getJson(`/au-transit/regions`, clientOpts(args)), args.json);
|
|
1857
|
+
break;
|
|
1858
|
+
}
|
|
1859
|
+
const region = sub;
|
|
1860
|
+
const feedRaw = String(args._[2] || "summary").toLowerCase();
|
|
1861
|
+
const feed = feedRaw === "trips" || feedRaw === "trip" || feedRaw === "trip-updates" ? "trip-updates" : feedRaw === "vehicle" || feedRaw === "vehicles" ? "vehicles" : feedRaw === "alert" || feedRaw === "alerts" ? "alerts" : feedRaw === "summary" ? "summary" : feedRaw;
|
|
1862
|
+
if (!region) throw new Error("Usage: milypay transit regions | transit <seq|sa|vic|nsw> vehicles|trips|alerts|summary [--mode m]");
|
|
1863
|
+
let route = "";
|
|
1864
|
+
let stop = "";
|
|
1865
|
+
let limit = "";
|
|
1866
|
+
let mode = "";
|
|
1867
|
+
const rest2 = args._.slice(3);
|
|
1868
|
+
for (let i = 0; i < rest2.length; i++) {
|
|
1869
|
+
if (rest2[i] === "--route") route = String(rest2[++i] || "");
|
|
1870
|
+
else if (rest2[i] === "--stop") stop = String(rest2[++i] || "");
|
|
1871
|
+
else if (rest2[i] === "--limit") limit = String(rest2[++i] || "");
|
|
1872
|
+
else if (rest2[i] === "--mode") mode = String(rest2[++i] || "");
|
|
1873
|
+
}
|
|
1874
|
+
const qs = new URLSearchParams();
|
|
1875
|
+
if (route) qs.set("routeId", route);
|
|
1876
|
+
if (stop) qs.set("stopId", stop);
|
|
1877
|
+
if (limit) qs.set("limit", limit);
|
|
1878
|
+
if (mode) qs.set("mode", mode);
|
|
1879
|
+
const q = qs.toString();
|
|
1880
|
+
print(
|
|
1881
|
+
await getJson(`/au-transit/${encodeURIComponent(region)}/${feed}${q ? `?${q}` : ""}`, clientOpts(args)),
|
|
1882
|
+
args.json
|
|
1883
|
+
);
|
|
1884
|
+
break;
|
|
1885
|
+
}
|
|
1886
|
+
case "energy":
|
|
1887
|
+
case "nem": {
|
|
1888
|
+
const sub = String(args._[1] || "").toLowerCase();
|
|
1889
|
+
if (sub === "notices" || sub === "notice") {
|
|
1890
|
+
const lim = args._[2] != null ? String(args._[2]) : "";
|
|
1891
|
+
const q = lim ? `?limit=${encodeURIComponent(lim)}` : "";
|
|
1892
|
+
print(await getJson(`/au-energy/notices${q}`, clientOpts(args)), args.json);
|
|
1893
|
+
break;
|
|
1894
|
+
}
|
|
1895
|
+
if (sub === "catalogue" || sub === "catalog" || sub === "products") {
|
|
1896
|
+
print(await getJson(`/au-energy`, clientOpts(args)), args.json);
|
|
1897
|
+
break;
|
|
1898
|
+
}
|
|
1899
|
+
if (!sub || sub === "all" || sub === "summary") {
|
|
1900
|
+
print(await getJson(`/au-energy/nem`, clientOpts(args)), args.json);
|
|
1901
|
+
break;
|
|
1902
|
+
}
|
|
1903
|
+
print(await getJson(`/au-energy/nem/${encodeURIComponent(sub)}`, clientOpts(args)), args.json);
|
|
1904
|
+
break;
|
|
1905
|
+
}
|
|
1906
|
+
case "phone":
|
|
1907
|
+
case "lookup-phone": {
|
|
1908
|
+
const num = String(args._[1] || "");
|
|
1909
|
+
if (!num) throw new Error("Usage: milypay phone +614****5678 (or 0412345678)");
|
|
1910
|
+
print(await getJson(`/au-phone?number=${encodeURIComponent(num)}`, clientOpts(args)), args.json);
|
|
1911
|
+
break;
|
|
1912
|
+
}
|
|
1913
|
+
case "domains":
|
|
1914
|
+
case "domain": {
|
|
1915
|
+
const sub = String(args._[1] || "check").toLowerCase();
|
|
1916
|
+
const name = String(args._[2] || args._[1] || "");
|
|
1917
|
+
if (sub === "catalogue" || sub === "catalog") {
|
|
1918
|
+
print(await getJson(`/domains`, clientOpts(args)), args.json);
|
|
1919
|
+
break;
|
|
1920
|
+
}
|
|
1921
|
+
if (sub === "check" || sub.includes(".") && !["check", "quote", "register"].includes(sub)) {
|
|
1922
|
+
const n = sub.includes(".") ? sub : name;
|
|
1923
|
+
if (!n || !n.includes(".")) throw new Error("Usage: milypay domains check example.com");
|
|
1924
|
+
print(await getJson(`/domains/check?name=${encodeURIComponent(n)}`, clientOpts(args)), args.json);
|
|
1925
|
+
break;
|
|
1926
|
+
}
|
|
1927
|
+
if (sub === "quote") {
|
|
1928
|
+
if (!name.includes(".")) throw new Error("Usage: milypay domains quote example.com [years]");
|
|
1929
|
+
const years = args._[3] || "1";
|
|
1930
|
+
print(await getJson(`/domains/quote?name=${encodeURIComponent(name)}&years=${encodeURIComponent(String(years))}`, clientOpts(args)), args.json);
|
|
1931
|
+
break;
|
|
1932
|
+
}
|
|
1933
|
+
if (sub === "register") {
|
|
1934
|
+
throw new Error("Register via paid API: POST /domains/register with x402 for quote chargeUsd");
|
|
1935
|
+
}
|
|
1936
|
+
throw new Error("Usage: milypay domains check|quote <name>");
|
|
1937
|
+
}
|
|
1938
|
+
case "rides":
|
|
1939
|
+
case "ride":
|
|
1940
|
+
case "uber": {
|
|
1941
|
+
const sub = String(args._[1] || "quote").toLowerCase();
|
|
1942
|
+
if (sub === "catalogue" || sub === "catalog") {
|
|
1943
|
+
print(await getJson(`/au-rides`, clientOpts(args)), args.json);
|
|
1944
|
+
break;
|
|
1945
|
+
}
|
|
1946
|
+
if (sub === "products") {
|
|
1947
|
+
const lat = args._[2];
|
|
1948
|
+
const lng = args._[3];
|
|
1949
|
+
if (lat == null || lng == null) {
|
|
1950
|
+
throw new Error("Usage: milypay rides products <lat> <lng>");
|
|
1951
|
+
}
|
|
1952
|
+
print(
|
|
1953
|
+
await getJson(
|
|
1954
|
+
`/au-rides/products?lat=${encodeURIComponent(String(lat))}&lng=${encodeURIComponent(String(lng))}`,
|
|
1955
|
+
clientOpts(args)
|
|
1956
|
+
),
|
|
1957
|
+
args.json
|
|
1958
|
+
);
|
|
1959
|
+
break;
|
|
1960
|
+
}
|
|
1961
|
+
if (sub === "eta") {
|
|
1962
|
+
const slat = args._[2];
|
|
1963
|
+
const slng = args._[3];
|
|
1964
|
+
if (slat == null || slng == null) {
|
|
1965
|
+
throw new Error("Usage: milypay rides eta <start_lat> <start_lng>");
|
|
1966
|
+
}
|
|
1967
|
+
print(
|
|
1968
|
+
await getJson(
|
|
1969
|
+
`/au-rides/eta?start_lat=${encodeURIComponent(String(slat))}&start_lng=${encodeURIComponent(String(slng))}`,
|
|
1970
|
+
clientOpts(args)
|
|
1971
|
+
),
|
|
1972
|
+
args.json
|
|
1973
|
+
);
|
|
1974
|
+
break;
|
|
1975
|
+
}
|
|
1976
|
+
const off = sub === "quote" ? 2 : 1;
|
|
1977
|
+
const startLat = args._[off];
|
|
1978
|
+
const startLng = args._[off + 1];
|
|
1979
|
+
const endLat = args._[off + 2];
|
|
1980
|
+
const endLng = args._[off + 3];
|
|
1981
|
+
if (startLat == null || startLng == null || endLat == null || endLng == null) {
|
|
1982
|
+
throw new Error(
|
|
1983
|
+
"Usage: milypay rides quote <start_lat> <start_lng> <end_lat> <end_lng>"
|
|
1984
|
+
);
|
|
1985
|
+
}
|
|
1986
|
+
const qs = new URLSearchParams({
|
|
1987
|
+
start_lat: String(startLat),
|
|
1988
|
+
start_lng: String(startLng),
|
|
1989
|
+
end_lat: String(endLat),
|
|
1990
|
+
end_lng: String(endLng)
|
|
1991
|
+
});
|
|
1992
|
+
print(await getJson(`/au-rides/quote?${qs}`, clientOpts(args)), args.json);
|
|
1993
|
+
break;
|
|
1994
|
+
}
|
|
1995
|
+
case "fund":
|
|
1996
|
+
case "moneygram":
|
|
1997
|
+
case "ramp":
|
|
1998
|
+
case "mg": {
|
|
1999
|
+
const sub = String(args._[1] || "status").toLowerCase();
|
|
2000
|
+
if (sub === "status" || sub === "info" || sub === "catalogue") {
|
|
2001
|
+
print(await getJson(`/ramp/moneygram`, clientOpts(args)), args.json);
|
|
2002
|
+
break;
|
|
2003
|
+
}
|
|
2004
|
+
if (sub === "session" || sub === "on" || sub === "on-ramp" || sub === "onramp" || sub === "off" || sub === "off-ramp" || sub === "offramp") {
|
|
2005
|
+
let mode = "on-ramp";
|
|
2006
|
+
if (sub === "off" || sub === "off-ramp" || sub === "offramp") mode = "off-ramp";
|
|
2007
|
+
const modeArg = String(args._[2] || "").toLowerCase();
|
|
2008
|
+
if (modeArg === "off" || modeArg === "off-ramp" || modeArg === "offramp") mode = "off-ramp";
|
|
2009
|
+
if (modeArg === "on" || modeArg === "on-ramp" || modeArg === "onramp") mode = "on-ramp";
|
|
2010
|
+
if (sub === "on" || sub === "on-ramp" || sub === "onramp") mode = "on-ramp";
|
|
2011
|
+
const data = await postJson(`/ramp/moneygram/session`, { mode }, clientOpts(args));
|
|
2012
|
+
print(data, args.json);
|
|
2013
|
+
const widget = data.widgetUrl;
|
|
2014
|
+
if (widget && !args.quiet) {
|
|
2015
|
+
process.stderr.write(`
|
|
2016
|
+
Open widget: ${widget}
|
|
2017
|
+
Demo UI: https://milypay.xyz/fund
|
|
2018
|
+
`);
|
|
2019
|
+
}
|
|
2020
|
+
break;
|
|
2021
|
+
}
|
|
2022
|
+
throw new Error("Usage: milypay fund status|session [on-ramp|off-ramp]");
|
|
2023
|
+
}
|
|
2024
|
+
case "status":
|
|
2025
|
+
print(await getJson(`/status`, clientOpts(args)), true);
|
|
2026
|
+
break;
|
|
2027
|
+
case "stats":
|
|
2028
|
+
print(await getJson(`/stats`, clientOpts(args)), true);
|
|
2029
|
+
break;
|
|
2030
|
+
case "asic":
|
|
2031
|
+
case "asic-extract": {
|
|
2032
|
+
await cmdAsic(args._.slice(1), args);
|
|
2033
|
+
break;
|
|
2034
|
+
}
|
|
2035
|
+
case "check":
|
|
2036
|
+
case "checkify": {
|
|
2037
|
+
const sub = String(args._[1] || "catalogue").toLowerCase();
|
|
2038
|
+
const arg = args._[2];
|
|
2039
|
+
if (sub === "catalogue" || sub === "status" || sub === "help") {
|
|
2040
|
+
print(await getJson(`/au-check`, clientOpts(args)), args.json);
|
|
2041
|
+
break;
|
|
2042
|
+
}
|
|
2043
|
+
if (sub === "reverse") {
|
|
2044
|
+
const lat = args._[2];
|
|
2045
|
+
const lng = args._[3];
|
|
2046
|
+
if (lat == null || lng == null) throw new Error("Usage: milypay check reverse <lat> <lng>");
|
|
2047
|
+
print(
|
|
2048
|
+
await getJson(
|
|
2049
|
+
`/au-check/reverse?lat=${encodeURIComponent(String(lat))}&lng=${encodeURIComponent(String(lng))}`,
|
|
2050
|
+
clientOpts(args)
|
|
2051
|
+
),
|
|
2052
|
+
args.json
|
|
2053
|
+
);
|
|
2054
|
+
break;
|
|
2055
|
+
}
|
|
2056
|
+
const map = {
|
|
2057
|
+
postcode: ["/au-check/postcode", "postcode"],
|
|
2058
|
+
suburb: ["/au-check/suburb", "q"],
|
|
2059
|
+
activity: ["/au-check/activity", "q"],
|
|
2060
|
+
"company-name": ["/au-check/company-name", "name"],
|
|
2061
|
+
"business-name": ["/au-check/business-name", "name"],
|
|
2062
|
+
sanctions: ["/au-check/sanctions", "name"],
|
|
2063
|
+
"director-id": ["/au-check/director-id", "id"],
|
|
2064
|
+
tfn: ["/au-check/tfn", "tfn"],
|
|
2065
|
+
email: ["/au-check/email", "email"]
|
|
2066
|
+
};
|
|
2067
|
+
const spec = map[sub];
|
|
2068
|
+
if (!spec) {
|
|
2069
|
+
throw new Error(
|
|
2070
|
+
"Usage: milypay check <catalogue|postcode|reverse|suburb|activity|company-name|business-name|sanctions|director-id|tfn|email>"
|
|
2071
|
+
);
|
|
2072
|
+
}
|
|
2073
|
+
if (arg == null) throw new Error(`Usage: milypay check ${sub} <value>`);
|
|
2074
|
+
const [path, param] = spec;
|
|
2075
|
+
print(await getJson(`${path}?${param}=${encodeURIComponent(String(arg))}`, clientOpts(args)), args.json);
|
|
2076
|
+
break;
|
|
2077
|
+
}
|
|
888
2078
|
default:
|
|
889
2079
|
throw new Error(`Unknown command: ${cmd}
|
|
890
2080
|
|