@paybox-sh/sdk 0.8.0 → 0.8.2

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 CHANGED
@@ -37,9 +37,10 @@ around it.
37
37
  paybox login # device-code OAuth, then provision a key
38
38
  paybox login --no-provision # OAuth only, skip the key step
39
39
  paybox login --key pbx_live_… # personal API key instead (no OAuth)
40
- paybox login --signing-key pbxk1.… # supply the signing key non-interactively
40
+ PAYBOX_SIGNING_KEY=pbxk1.… paybox login # supply the signing key non-interactively
41
41
 
42
42
  paybox credentials # list usable credentials
43
+ # `--credential <id>` below is the `credential.id` from that list, not the wallet name.
43
44
  paybox pay --credential <id> --merchant Acme --url https://acme.com --amount 1999
44
45
  paybox secret --credential <id> --purpose "deploy" # one-time token
45
46
  paybox secret --credential <id> --raw # raw value (grant-gated)
package/SKILL.md CHANGED
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  name: PayBox CLI setup
3
+ version: 0.8.3
3
4
  description: >-
4
5
  Install and log in to the PayBox CLI (@paybox-sh/sdk) so an agent can pay,
5
6
  sign, and hold wallet, card, and secret credentials on the user's behalf. Use
@@ -9,6 +10,10 @@ description: >-
9
10
 
10
11
  # PayBox CLI setup
11
12
 
13
+ The human and agent guide is `https://docs.paybox.sh` (start at
14
+ getting-started and connect/mcp). This file is only the CLI film. Grok
15
+ (grok.com) and Grok Bots are different hosts; do not treat one as the other.
16
+
12
17
  The user asks to install PayBox. Two things need them: they approve wallet
13
18
  access with a passkey, and they paste one signing key. Everything else is yours,
14
19
  and they should not see it happen.
@@ -19,6 +24,13 @@ and they should not see it happen.
19
24
  npm install -g @paybox-sh/sdk
20
25
  ```
21
26
 
27
+ Then confirm what you got: `paybox --json version` reports the version and
28
+ `binary`, the path that answered. Two things go wrong here and both are quiet.
29
+ If the command is not found, the global prefix is not on this shell's `PATH`;
30
+ `npm prefix -g` gives you that prefix, and the binary sits in its `bin`. If
31
+ `binary` is under a different prefix, an older `paybox` sits earlier on `PATH`
32
+ and will keep answering every command you run.
33
+
22
34
  The CLI runs wherever you run it, which is often not the user's own machine.
23
35
  That is fine: login uses an OAuth device-code grant, so the browser that
24
36
  approves does not have to be the one the CLI can reach.
@@ -27,6 +39,10 @@ Never delete or overwrite an existing config directory. To isolate a run from
27
39
  credentials the user already has, point `PAYBOX_CONFIG_DIR` at a fresh
28
40
  directory.
29
41
 
42
+ Give each parallel run its own directory too. Commands sharing one config race
43
+ each other's token refresh, and the loser fails with `refresh token has already
44
+ been used`. Retry that one command once; do not run `login` again.
45
+
30
46
  ## Log in
31
47
 
32
48
  Run this once, in the same turn the user asks:
@@ -37,6 +53,11 @@ paybox login
37
53
 
38
54
  Add `--base-url` and `--app-url` for an environment other than the default.
39
55
 
56
+ If a config directory already exists, check `paybox --json whoami` first. When
57
+ `canSign` is already `true`, setup is done: do not run `login`, and do not send
58
+ the authorize link or the key field again. A second authorize link in one chat
59
+ reads as a setup that failed.
60
+
40
61
  The command drives the whole flow itself. Do not reimplement any of it: it
41
62
  registers a client, starts device authorization, prints a verification URL and a
42
63
  short user code, tries to open that URL locally, polls until the user approves,
@@ -55,8 +76,8 @@ Send that link even though the CLI also tries to open a browser. When the CLI
55
76
  is not on the user's machine, that local open is useless or invisible, and your
56
77
  message is the only way they reach the page.
57
78
 
58
- The user approves in the browser. They should not open the link in a native
59
- PayBox mobile app; that path cannot complete a device-code approval.
79
+ The user approves in the browser. If the link opens the PayBox mobile app and
80
+ errors instead, have them open it in a browser.
60
81
 
61
82
  Then wait. The poll is the continue signal. Do not ask the user to type `done`,
62
83
  confirm, or send a screenshot, and do not end your turn while login is running.
@@ -69,9 +90,10 @@ After approval, login opens the signing-key page and prompts for the key.
69
90
  Present a **masked input** for the `pbxk1.` value and write what the user gives
70
91
  you to that prompt's stdin.
71
92
 
72
- Pass it through the prompt, never as `login --signing-key <value>` on the
73
- command line: an argument lands in shell history and is visible to anyone who
74
- can list processes.
93
+ Pass it through the prompt, or set `PAYBOX_SIGNING_KEY` before running `login`
94
+ when nothing is attached to stdin. Never pass it as `login --signing-key <value>`
95
+ on the command line: an argument lands in shell history and is visible to anyone
96
+ who can list processes.
75
97
 
76
98
  Do not ask the user to click the signing-key link, it is already open. Do not
77
99
  show the key field before that page has opened, and do not open it twice.
@@ -103,10 +125,52 @@ to act on, send nothing.
103
125
 
104
126
  Match the user's language. Default to English unless they write otherwise.
105
127
 
106
- Once `canSign` is `true`, show them what they now have: `paybox --json
107
- credentials` for the granted wallets, then `paybox --json portfolio --address
108
- <wallet>` for balances. Render a compact table, never addresses or raw JSON. The
109
- CLI cannot create wallets; it uses what the user granted during authorization.
128
+ ## Once setup is done
129
+
130
+ The silence rules above are about setup, and end here.
131
+
132
+ Show them what they now have: `paybox --json credentials` for the granted
133
+ wallets, then `paybox --json portfolio --address <wallet>` for balances. Every
134
+ `--credential` takes the `credential.id` from that list; a wallet's name is not
135
+ an id and the command will refuse it. Render a compact table, never addresses or
136
+ raw JSON. The CLI cannot create wallets; it uses what the user granted during
137
+ authorization.
138
+
139
+ When you run several operations at once, report each one where the user is
140
+ watching, as it lands, with its request id. Each spends real money on its own,
141
+ and one combined summary at the end leaves nobody able to tell which transaction
142
+ came from which request.
143
+
144
+ After that table, do two things with plugins. Do not treat Welcome as a
145
+ catalog index. There may be tens or thousands.
146
+
147
+ 1. Send them to enable plugins on the web: a markdown link labeled
148
+ **Plugins** to `https://app.paybox.sh/plugins`. That is the PayBox
149
+ app, not a host Settings → Plugins screen. Ask them to turn on what
150
+ they want to use, then say when they are back.
151
+
152
+ 2. Then call `discover_plugins` with `status` `enabled`, no `query`, and
153
+ a small `limit`. That page is what they have on, not the store. From
154
+ those plugins plus the portfolio, suggest a few concrete next moves
155
+ (about six, not one row per plugin). Use each result's `name` and
156
+ contract. Be specific: amounts, which wallet UUID, which market or
157
+ vault from the contract. Mix two enabled plugins in one suggestion
158
+ when that serves the same goal (for example fund or swap, then put
159
+ the result to work). If nothing is enabled, skip the suggestion list
160
+ and stay on the Plugins link.
161
+
162
+ When they name a plugin or a job, search: `discover_plugins` with `query`
163
+ set to what they asked, `status` `enabled` if they already turned it on,
164
+ then page with `next_cursor` only while the current page has no match.
165
+ Official plugin money uses MCP: `get_contract` with `contract_uri`
166
+ unchanged → `use_plugin` with that contract's `plugin_id`, `tool_id`,
167
+ and `input`. Do not invent a `paybox <plugin>` command; only use CLI
168
+ groups that `paybox --help` already lists. Enabled plugin tools may also
169
+ appear on `tools/list`. Plugin money always pauses for passkey.
170
+
171
+ If prod MCP (`https://api.paybox.sh/mcp`) is `unreachable` or `needsAuth` while
172
+ `paybox --json whoami` still works, say that. Do not send the human to Settings.
173
+ Do not switch to staging. Do not report the dollar as sent.
110
174
 
111
175
  ## A setup that went wrong
112
176
 
@@ -146,8 +146,6 @@ async function loginDevice(baseUrl, opts = {}) {
146
146
  token_endpoint_auth_method: "none",
147
147
  grant_types: ["urn:ietf:params:oauth:grant-type:device_code", "refresh_token"],
148
148
  response_types: ["code"],
149
- // Must match (or be a superset of) what we ask for below — the server
150
- // only grants scope that was declared at registration.
151
149
  scope
152
150
  })
153
151
  });
@@ -392,6 +390,22 @@ function buildX402Envelope(typedData, binding, creds) {
392
390
  );
393
391
  return { api_pub: creds.apiPubHex, signed_body, agent_signature };
394
392
  }
393
+ function buildX402SolanaEnvelope(transactionBase64, binding, creds) {
394
+ if (!binding.walletId) {
395
+ throw new Error("PayBox did not supply a wallet id for this payment.");
396
+ }
397
+ if (!binding.keyId || !binding.derivationPath) {
398
+ throw new Error(
399
+ "This wallet isn't provisioned for signing yet (missing key binding). Re-provision it in the PayBox app, then retry."
400
+ );
401
+ }
402
+ const { signed_body, agent_signature } = buildEnvelope(
403
+ solanaSigningPayload(transactionBase64),
404
+ binding,
405
+ creds
406
+ );
407
+ return { api_pub: creds.apiPubHex, signed_body, agent_signature };
408
+ }
395
409
  function buildIssuedAtEnvelope(creds) {
396
410
  const signedBodyBytes = new TextEncoder().encode(
397
411
  JSON.stringify({ issued_at: (/* @__PURE__ */ new Date()).toISOString() })
@@ -538,19 +552,33 @@ function isSolanaRefreshablePlan(plan) {
538
552
  (t) => t.kind === "swap" || t.kind === "prediction_trade" || t.kind === "jupiter_swap"
539
553
  );
540
554
  }
541
- async function refreshSwapPlan(post, requestId, plan) {
555
+ async function refreshPlan(post, requestId) {
542
556
  const r = await post(`/agent/requests/${requestId}/refresh`, {});
543
557
  if (!r || typeof r.plan !== "object" || r.plan === null) {
544
- throw new Error("swap refresh returned no plan");
558
+ throw new Error("refresh returned no plan");
545
559
  }
546
- const refreshed = r.plan;
560
+ return r.plan;
561
+ }
562
+ async function refreshSwapPlan(post, requestId) {
563
+ const refreshed = await refreshPlan(post, requestId);
547
564
  if (!Array.isArray(refreshed.txs) || refreshed.txs.length === 0) {
548
565
  throw new Error("swap refresh returned a plan with no txs");
549
566
  }
550
567
  return refreshed;
551
568
  }
569
+ function isSolanaRailX402(plan) {
570
+ return plan.x402?.rail === "solana";
571
+ }
572
+ async function refreshX402SolanaTx(post, requestId) {
573
+ const refreshed = await refreshPlan(post, requestId);
574
+ const tx = refreshed.solana?.transaction;
575
+ if (typeof tx !== "string" || tx.length === 0) {
576
+ throw new Error("x402 refresh returned a plan with no Solana transaction");
577
+ }
578
+ return tx;
579
+ }
552
580
  async function signSwapRequest(post, requestId, plan, creds) {
553
- const signPlan = isSolanaRefreshablePlan(plan) ? await refreshSwapPlan(post, requestId, plan) : plan;
581
+ const signPlan = isSolanaRefreshablePlan(plan) ? await refreshSwapPlan(post, requestId) : plan;
554
582
  let binding = {
555
583
  walletId: signPlan.binding.wallet_id,
556
584
  keyId: signPlan.binding.key_id ?? "",
@@ -571,7 +599,7 @@ async function signX402Request(post, requestId, plan, creds) {
571
599
  if (binding.walletId && (!binding.keyId || !binding.derivationPath)) {
572
600
  binding = await resolveBinding(post, requestId, creds);
573
601
  }
574
- const envelope = buildX402Envelope(
602
+ const envelope = isSolanaRailX402(plan) ? buildX402SolanaEnvelope(await refreshX402SolanaTx(post, requestId), binding, creds) : buildX402Envelope(
575
603
  plan.typed_data,
576
604
  binding,
577
605
  creds
@@ -586,6 +614,9 @@ function signingResultForResponse(result, response) {
586
614
  const exposesPlan = response.status === "pending_approval" || response.status === "pending_signature";
587
615
  return { ...result, response, plan: exposesPlan ? result.plan : null };
588
616
  }
617
+ function didNotHappen(r) {
618
+ return r?.status === "denied" || r?.status === "error";
619
+ }
589
620
  var PayboxError = class extends Error {
590
621
  constructor(status, body, context) {
591
622
  super(`paybox ${context} failed (${status}): ${body}`);
@@ -605,7 +636,6 @@ var PayboxClient = class _PayboxClient {
605
636
  this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
606
637
  this.fetchImpl = options.fetchImpl ?? fetch;
607
638
  }
608
- /** Build a client from `~/.config/paybox/config.json` + env, with overrides. */
609
639
  static fromConfig(overrides = {}) {
610
640
  const cfg = loadConfig();
611
641
  const client = new _PayboxClient({
@@ -629,7 +659,6 @@ var PayboxClient = class _PayboxClient {
629
659
  return null;
630
660
  }
631
661
  }
632
- /** Whether in-process signing is available (a parseable `pbxk1.` key is set). */
633
662
  get canSign() {
634
663
  return this.signingCreds() !== null;
635
664
  }
@@ -668,19 +697,14 @@ var PayboxClient = class _PayboxClient {
668
697
  return text ? JSON.parse(text) : void 0;
669
698
  }
670
699
  poster = (path, body) => this.request("POST", path, { body });
671
- /** List granted credentials plus the `ungranted` credentials (id, name, kind,
672
- * safe metadata) the user owns but hasn't granted this connector. */
673
700
  listCredentials() {
674
701
  return this.request("GET", "/agent/grants");
675
702
  }
676
- /** Token balances across chains (the `get_portfolio` tool). */
677
703
  getPortfolio(args) {
678
704
  return this.request("GET", "/agent/portfolio", {
679
705
  query: { address: args.address, network_ids: args.networkIds }
680
706
  });
681
707
  }
682
- /** Verify one confirmed Solana transaction's exact wallet/mint effect, then
683
- * read the current balance at or after its slot (`verify_solana_balance`). */
684
708
  verifySolanaBalance(args) {
685
709
  const body = {
686
710
  address: args.address,
@@ -689,7 +713,6 @@ var PayboxClient = class _PayboxClient {
689
713
  };
690
714
  return this.request("POST", "/agent/portfolio/verify-solana-balance", { body });
691
715
  }
692
- /** Charge a card credential (the `request_payment` tool). */
693
716
  requestPayment(args) {
694
717
  const operation = {
695
718
  type: "payment",
@@ -701,7 +724,6 @@ var PayboxClient = class _PayboxClient {
701
724
  };
702
725
  return this.request("POST", "/agent/request", { body: { operation } });
703
726
  }
704
- /** Reveal a secret credential (the `request_secret` tool). */
705
727
  requestSecret(args) {
706
728
  const operation = {
707
729
  type: "secret",
@@ -711,12 +733,6 @@ var PayboxClient = class _PayboxClient {
711
733
  };
712
734
  return this.request("POST", "/agent/request", { body: { operation } });
713
735
  }
714
- /** Sign with a wallet credential (the `request_wallet_sign` tool). Signs
715
- * in-process and returns the completed request when a signing key is set and
716
- * the request clears immediately; otherwise returns the pending response.
717
- * Uses `/agent/wallet-sign`, which echoes the wallet binding only while
718
- * approval or signature is pending so the signer need not resolve it
719
- * separately. Terminal responses carry a null binding. */
720
736
  async requestWalletSign(args, opts = {}) {
721
737
  return this.withExpiryRetry(
722
738
  async () => {
@@ -741,10 +757,6 @@ var PayboxClient = class _PayboxClient {
741
757
  (r) => r
742
758
  );
743
759
  }
744
- /** Swap tokens from a wallet credential (the `request_swap` tool). Returns the
745
- * parked response and its sign-ready plan while approval or signature is
746
- * pending; terminal responses carry a null plan. Signs + submits in-process
747
- * when a signing key is set and the swap cleared immediately. */
748
760
  async requestSwap(args, opts = {}) {
749
761
  return this.withExpiryRetry(
750
762
  async () => {
@@ -757,7 +769,6 @@ var PayboxClient = class _PayboxClient {
757
769
  dst_token: args.dstToken,
758
770
  amount: args.amount,
759
771
  swap_direction: args.swapDirection ?? "exact-amount-in",
760
- // Keep in sync with the request_swap MCP tool default (server side).
761
772
  slippage_bps: args.slippageBps ?? 150,
762
773
  recipient: args.recipient ?? null,
763
774
  value_cents: args.valueCents ?? null
@@ -770,10 +781,6 @@ var PayboxClient = class _PayboxClient {
770
781
  (r) => r.response
771
782
  );
772
783
  }
773
- /** Complete a swap request: optionally wait out a `pending_approval` dwell,
774
- * then sign the plan in-process and submit envelopes. Signing first refreshes
775
- * the parked request via `/agent/requests/{id}/refresh`, so a long approval
776
- * dwell never signs stale bytes. */
777
784
  async completeSwap(result, opts) {
778
785
  const creds = this.signingCreds();
779
786
  if (!(opts.autoSign ?? true) || !creds) {
@@ -797,8 +804,6 @@ var PayboxClient = class _PayboxClient {
797
804
  await this.requestAfterSign(response.request_id, opts.waitForApproval)
798
805
  );
799
806
  }
800
- /** Poll while the request sits in `pending_approval` (the user is approving
801
- * with their passkey); returns the first non-approval state. */
802
807
  async waitWhileApproval(requestId, wait) {
803
808
  const o = typeof wait === "object" ? wait : {};
804
809
  const interval = o.intervalMs ?? 2e3;
@@ -809,25 +814,14 @@ var PayboxClient = class _PayboxClient {
809
814
  await new Promise((res) => setTimeout(res, interval));
810
815
  }
811
816
  }
812
- /** Run an operation and, if it terminates on a server-marked expiry
813
- * (`retryable` on a terminal `error`/`denied`: the window elapsed and nothing
814
- * was signed or spent), re-issue it exactly once (SPE-456). Never loops: the
815
- * second attempt's result is returned as-is. */
816
817
  async withExpiryRetry(run, responseOf) {
817
818
  const first = await run();
818
819
  const r = responseOf(first);
819
- if ((r.status === "error" || r.status === "denied") && r.retryable) {
820
+ if (didNotHappen(r) && r.retryable) {
820
821
  return run();
821
822
  }
822
823
  return first;
823
824
  }
824
- /** Sign a parked request; if the sign/submit call fails, reconcile against the
825
- * authoritative state once (SPE-456). The server leaves a pre-broadcast
826
- * completion failure recoverable — the claim is released and the row stays
827
- * `pending_signature` — so re-sign a still-open request a single time; a
828
- * terminal or already-broadcast row is left as-is for the caller to read (and
829
- * for `withExpiryRetry` to re-issue if it is retryable). Bounded to one extra
830
- * attempt: a second failure propagates. */
831
825
  async signWithReconcile(requestId, sign) {
832
826
  try {
833
827
  await sign();
@@ -837,7 +831,6 @@ var PayboxClient = class _PayboxClient {
837
831
  await sign();
838
832
  }
839
833
  }
840
- /** Discover x402 services with the original array-returning response. */
841
834
  async discoverServices(query, opts = {}) {
842
835
  const result = await this.request("GET", "/agent/services", {
843
836
  query: {
@@ -848,8 +841,6 @@ var PayboxClient = class _PayboxClient {
848
841
  });
849
842
  return result.services;
850
843
  }
851
- /** Discover one bounded page of x402 services. Reuse the returned cursor with
852
- * the same query and network while `has_more` is true. */
853
844
  async discoverServicesPage(query, opts = {}) {
854
845
  return this.request("GET", "/agent/services", {
855
846
  query: {
@@ -861,10 +852,6 @@ var PayboxClient = class _PayboxClient {
861
852
  }
862
853
  });
863
854
  }
864
- /** Pay a paid x402 endpoint from a wallet credential (the `pay_x402` tool,
865
- * header mode). Signs in-process when a signing key is set and the payment
866
- * clears immediately — then the X-PAYMENT header is on the completed
867
- * response's `output.value.x_payment` (replay it on the original request). */
868
855
  async payX402(args, opts = {}) {
869
856
  return this.withExpiryRetry(
870
857
  async () => {
@@ -880,9 +867,6 @@ var PayboxClient = class _PayboxClient {
880
867
  (r) => r.response
881
868
  );
882
869
  }
883
- /** Fetch a paid x402 resource and have paybox pay for it (the `use_service`
884
- * tool, gateway mode): paybox probes the url, pays the 402, re-fetches with the
885
- * payment, and returns the resource's reply on `output.value.response`. */
886
870
  async useService(args, opts = {}) {
887
871
  return this.withExpiryRetry(
888
872
  async () => {
@@ -899,9 +883,6 @@ var PayboxClient = class _PayboxClient {
899
883
  (r) => r.response
900
884
  );
901
885
  }
902
- /** Shared completion for the two x402 entry points: optionally wait out a
903
- * `pending_approval` dwell, then sign the parked typed data in-process and
904
- * return the finished request, exactly like the swap path. */
905
886
  async completeX402(result, opts) {
906
887
  const creds = this.signingCreds();
907
888
  if (!(opts.autoSign ?? true) || !creds) {
@@ -925,20 +906,12 @@ var PayboxClient = class _PayboxClient {
925
906
  await this.requestAfterSign(response.request_id, opts.waitForApproval)
926
907
  );
927
908
  }
928
- /** Claim the usable card credentials of an approved payment (the
929
- * `claim_payment_credentials` tool). One-time: the claim is consumed. */
930
909
  claimPaymentCredentials(requestId) {
931
910
  return this.request("POST", `/agent/requests/${requestId}/credentials`);
932
911
  }
933
- /** Open the account-change flow (the `request_account_change` tool): returns a
934
- * `manage_url` deep link for the USER to open — they update this client's
935
- * access (or add a credential) in their own passkey-gated app session.
936
- * Nothing is parked or applied server-side. */
937
912
  requestAccountChange(note) {
938
913
  return this.request("POST", "/agent/account-change", { body: { note } });
939
914
  }
940
- /** A signed MoonPay checkout URL funding a granted wallet (the `get_buy_link`
941
- * tool). Share the URL with the user; generating it charges nothing. */
942
915
  getBuyLink(args) {
943
916
  return this.request("GET", "/agent/buy-link", {
944
917
  query: {
@@ -949,8 +922,6 @@ var PayboxClient = class _PayboxClient {
949
922
  }
950
923
  });
951
924
  }
952
- // ---- World REST discovery; money tools require the geofenced MCP window. ----
953
- /** Browse World prediction markets (the `world_find_markets` tool). */
954
925
  worldMarkets(args = {}) {
955
926
  return this.request("GET", "/agent/world/markets", {
956
927
  query: {
@@ -963,25 +934,19 @@ var PayboxClient = class _PayboxClient {
963
934
  }
964
935
  });
965
936
  }
966
- /** One World event with its markets (the `world_get_market` tool). Nested
967
- * markets default on, matching the tool — they carry the outcome mint ids
968
- * the orderbook/trade calls need. */
969
937
  worldMarket(eventTicker, withNestedMarkets = true) {
970
938
  return this.request("GET", "/agent/world/market", {
971
939
  query: {
972
940
  event_ticker: eventTicker,
973
- // Omit when true (the server default); send only the explicit opt-out.
974
941
  with_nested_markets: withNestedMarkets ? void 0 : "false"
975
942
  }
976
943
  });
977
944
  }
978
- /** A World market's orderbook (the `world_orderbook` tool). */
979
945
  worldOrderbook(id, byMint = false) {
980
946
  return this.request("GET", "/agent/world/orderbook", {
981
947
  query: { id, by_mint: byMint ? "true" : void 0 }
982
948
  });
983
949
  }
984
- /** A World market's price history (the `world_market_prices` tool). */
985
950
  worldPrices(args) {
986
951
  return this.request("GET", "/agent/world/prices", {
987
952
  query: {
@@ -992,45 +957,30 @@ var PayboxClient = class _PayboxClient {
992
957
  }
993
958
  });
994
959
  }
995
- /** Filter addresses down to World outcome mints (the
996
- * `world_filter_outcome_mints` tool). */
997
960
  worldFilterOutcomeMints(addresses) {
998
961
  return this.request("POST", "/agent/world/filter-outcome-mints", {
999
962
  body: { addresses }
1000
963
  });
1001
964
  }
1002
- /** A wallet's World prediction-market positions: classified `positions` /
1003
- * `settled` entries (each with a `position_result`) plus `settlement_cash`
1004
- * for a settled winner's CASH cash-out (swap CASH to USDC via request_swap).
1005
- * The `world_positions` tool. */
1006
965
  worldPositions(address) {
1007
966
  return this.request("GET", "/agent/world/positions", { query: { address } });
1008
967
  }
1009
- // ---- Hyperliquid plugin (read-only spot discovery) — requires the user to
1010
- // have enabled the `hyperliquid` plugin in the paybox app. ----
1011
- /** Hyperliquid spot markets (the `hyperliquid_markets` tool). */
1012
968
  hyperliquidMarkets() {
1013
969
  return this.request("GET", "/agent/hyperliquid/markets");
1014
970
  }
1015
- /** Hyperliquid spot prices (the `hyperliquid_prices` tool). */
1016
971
  hyperliquidPrices() {
1017
972
  return this.request("GET", "/agent/hyperliquid/prices");
1018
973
  }
1019
- /** Resolve one Hyperliquid token by name (the `hyperliquid_token` tool). */
1020
974
  hyperliquidToken(name) {
1021
975
  return this.request("GET", "/agent/hyperliquid/token", { query: { name } });
1022
976
  }
1023
- /** Poll a request's status (the `get_request` tool). */
1024
977
  getRequest(requestId) {
1025
978
  return this.request("GET", `/agent/requests/${requestId}`);
1026
979
  }
1027
- /** After in-process sign, `--wait` polls through settlement/confirmation;
1028
- * without it, return the first snapshot (the historical no-wait contract). */
1029
980
  requestAfterSign(requestId, wait) {
1030
981
  if (!wait) return this.getRequest(requestId);
1031
982
  return this.waitForRequest(requestId, typeof wait === "object" ? wait : {});
1032
983
  }
1033
- /** Poll until the request leaves a pending state (or the timeout elapses). */
1034
984
  async waitForRequest(requestId, opts = {}) {
1035
985
  const interval = opts.intervalMs ?? 2e3;
1036
986
  const deadline = Date.now() + (opts.timeoutMs ?? 3e5);
@@ -1056,7 +1006,8 @@ export {
1056
1006
  loadConfig,
1057
1007
  saveConfig,
1058
1008
  credsFromToken,
1009
+ didNotHappen,
1059
1010
  PayboxError,
1060
1011
  PayboxClient
1061
1012
  };
1062
- //# sourceMappingURL=chunk-7VW4QMV4.js.map
1013
+ //# sourceMappingURL=chunk-WRPYONXW.js.map