@ixo/asks-mcp 2.0.0 → 2.1.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.
Files changed (2) hide show
  1. package/dist/asks-mcp.mjs +61 -4
  2. package/package.json +1 -1
package/dist/asks-mcp.mjs CHANGED
@@ -266879,6 +266879,51 @@ var init_takeBack = __esm({
266879
266879
  }
266880
266880
  });
266881
266881
 
266882
+ // ../../app/lib/cashout/words.ts
266883
+ function waysFor(list7, country) {
266884
+ const shown2 = list7;
266885
+ const fits = STRIPE_COUNTRIES.has(country) ? "stripe_bank" : "yellowcard_bank";
266886
+ const bank = shown2.filter((one) => one.method.endsWith("_bank")).sort((a, b) => Number(b.enabled !== false) - Number(a.enabled !== false) || Number(b.method === fits) - Number(a.method === fits))[0];
266887
+ return shown2.filter((one) => !one.method.endsWith("_bank") || one === bank);
266888
+ }
266889
+ var STRIPE_COUNTRIES;
266890
+ var init_words = __esm({
266891
+ "../../app/lib/cashout/words.ts"() {
266892
+ "use strict";
266893
+ STRIPE_COUNTRIES = new Set("AT BE BG CY CZ DE DK EE ES FI FR GR HR HU IE IS IT LI LT LU LV MT NL NO PL PT RO SE SI SK US GB CA CH".split(" "));
266894
+ }
266895
+ });
266896
+
266897
+ // ../../app/lib/payee.ts
266898
+ var init_payee = __esm({
266899
+ "../../app/lib/payee.ts"() {
266900
+ "use strict";
266901
+ }
266902
+ });
266903
+
266904
+ // ../../app/lib/cashout/client.ts
266905
+ var init_client2 = __esm({
266906
+ "../../app/lib/cashout/client.ts"() {
266907
+ "use strict";
266908
+ init_payee();
266909
+ }
266910
+ });
266911
+
266912
+ // ../../app/lib/cashout/yellowcard.ts
266913
+ async function ycRate(url4, country, fetchImpl = (input, init) => fetch(input, init)) {
266914
+ const response = await fetchImpl(`${url4.replace(/\/+$/, "")}/countries?ramp=offramp&limits=true`).catch(() => null);
266915
+ if (!response?.ok) return null;
266916
+ const body = await response.json().catch(() => null);
266917
+ const one = body?.limits?.[country.toUpperCase()];
266918
+ return one?.currency && typeof one.rate === "number" && one.rate > 0 ? { currency: one.currency, rate: one.rate } : null;
266919
+ }
266920
+ var init_yellowcard = __esm({
266921
+ "../../app/lib/cashout/yellowcard.ts"() {
266922
+ "use strict";
266923
+ init_client2();
266924
+ }
266925
+ });
266926
+
266882
266927
  // src/cashout.ts
266883
266928
  var cashout_exports = {};
266884
266929
  __export(cashout_exports, {
@@ -266887,8 +266932,7 @@ __export(cashout_exports, {
266887
266932
  identityLine: () => identityLine
266888
266933
  });
266889
266934
  function whyOff(one) {
266890
- if (one.enabled === false) return one.reason === "not_in_country" ? "not offered in your country yet" : one.reason === "coming_soon" ? "coming soon" : "busy right now, try later";
266891
- if (one.provider === "yellowcard-worker" || one.method.startsWith("yellowcard")) return "coming soon";
266935
+ if (one.enabled === false) return one.reason === "coming_soon" ? "coming soon" : one.reason === "not_in_country" ? "not in this country" : "busy right now, try later";
266892
266936
  return null;
266893
266937
  }
266894
266938
  async function call2(deps, path, body) {
@@ -266931,7 +266975,7 @@ async function cashOut(deps, input) {
266931
266975
  if (!country || !/^[A-Z]{2}$/.test(country)) return [`You have $${available.toFixed(2)} to cash out.`, kycLine, 'Which country are you in? (Ask the person; then call cash_out with country, like "NG" or "DE".)'].filter(Boolean).join("\n");
266932
266976
  const info = await call2(deps, `/api/cashout/info?country=${country}`);
266933
266977
  if (info.status !== 200) return said3(info);
266934
- const methods = (info.body.methods ?? []).filter((one) => WAYS[one.method]).sort((a, b) => ORDER2.indexOf(a.method) - ORDER2.indexOf(b.method));
266978
+ const methods = waysFor(info.body.methods ?? [], country).filter((one) => WAYS[one.method]).sort((a, b) => ORDER2.indexOf(a.method) - ORDER2.indexOf(b.method));
266935
266979
  const fee = info.body.fee;
266936
266980
  if (!methods.some((one) => !whyOff(one))) return `We can't send money to ${country} yet.`;
266937
266981
  const chosen2 = methods.find((one) => one.method === input.method && !whyOff(one));
@@ -266950,6 +266994,7 @@ async function cashOut(deps, input) {
266950
266994
  if (chosen2.maxUsd && Number(amount3) > Number(chosen2.maxUsd)) return `The largest you can cash out this way is $${chosen2.maxUsd}.`;
266951
266995
  const to = input.to?.trim();
266952
266996
  if (chosen2.fields.includes("address") && !(to && BASE_ADDRESS.test(to))) return "Which Base account should receive it? (Its address starts with 0x; then call cash_out with to.)";
266997
+ if (chosen2.method.startsWith("yellowcard")) return yellowCard(deps, chosen2, country, amount3, input.confirm === true);
266953
266998
  const quote = await signedCall(deps, "quote", { method: chosen2.method, country, amountUsd: amount3 });
266954
266999
  if (quote.status !== 201) return said3(quote);
266955
267000
  const q = quote.body;
@@ -266964,6 +267009,16 @@ async function cashOut(deps, input) {
266964
267009
  if (to) link5.searchParams.set("to", to);
266965
267010
  return [receive, named, `Open this and tap Confirm: ${link5.toString()}`, "Your money leaves only when you confirm there. I sent nothing. (Later, cash_out_status with the id that page shows says where it stands.)"].filter(Boolean).join("\n");
266966
267011
  }
267012
+ async function yellowCard(deps, chosen2, country, amount3, confirm) {
267013
+ const rate = chosen2.flow?.url ? await ycRate(chosen2.flow.url, country, deps.fetch) : null;
267014
+ const about = rate ? `You'll receive about ${rate.currency} ${(Number(amount3) * rate.rate).toFixed(2)}, before Yellow Card's fee (the page shows the exact amount).` : "The page shows what you'll receive in your own money.";
267015
+ if (!confirm) return [`Cash out $${amount3}: ${WAYS[chosen2.method]}.`, about, NAME_LINE, "Nothing is sent yet. To go ahead, call cash_out again with the same answers and confirm: true."].join("\n");
267016
+ const link5 = new URL(`${deps.site.replace(/\/+$/, "")}/me/cash-out`);
267017
+ link5.searchParams.set("method", chosen2.method);
267018
+ link5.searchParams.set("amount", amount3);
267019
+ link5.searchParams.set("country", country);
267020
+ return [about, NAME_LINE, `Open this, pick your ${chosen2.method === "yellowcard_momo" ? "mobile money network and number" : "bank and account number"}, see your quote and tap Confirm: ${link5.toString()}`, "Your money leaves only when you confirm there. I sent nothing."].join("\n");
267021
+ }
266967
267022
  async function cashOutStatus(deps, id) {
266968
267023
  const answer = await signedCall(deps, "status", { id });
266969
267024
  if (answer.status === 404) return `No cash-out "${id}" for you on this network.`;
@@ -267004,6 +267059,8 @@ var init_cashout = __esm({
267004
267059
  "use strict";
267005
267060
  init_accountProof();
267006
267061
  init_inviteProof();
267062
+ init_words();
267063
+ init_yellowcard();
267007
267064
  WAYS = {
267008
267065
  stripe_bank: "To your bank account (through Stripe)",
267009
267066
  yellowcard_bank: "To your bank account (through Yellow Card)",
@@ -292380,7 +292437,7 @@ import { randomBytes as randomBytes7 } from "node:crypto";
292380
292437
  // package.json
292381
292438
  var package_default = {
292382
292439
  name: "@ixo/asks-mcp",
292383
- version: "2.0.0",
292440
+ version: "2.1.0",
292384
292441
  description: "The Openhands Network MCP server: read the board, answer asks, post work and get paid on the ixo chain, with a key of its own on your machine.",
292385
292442
  license: "Apache-2.0",
292386
292443
  repository: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ixo/asks-mcp",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "The Openhands Network MCP server: read the board, answer asks, post work and get paid on the ixo chain, with a key of its own on your machine.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {