@moonpay/cli 1.42.3 → 1.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-7VEPX3MI.js +58 -0
- package/dist/{chunk-CZBP5SWH.js → chunk-HKDLPDJU.js} +1 -1
- package/dist/chunk-IBLWQCA2.js +2 -0
- package/dist/{chunk-MCGWSURV.js → chunk-V4NDQ53W.js} +2 -2
- package/dist/{client-UU6HOLZW.js → client-S2OYW27G.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/{ledger-4JQMU5VU.js → ledger-MQBFDQFZ.js} +2 -2
- package/dist/{mcp-2OBRKJQM.js → mcp-Q4CQRNQ2.js} +1 -1
- package/dist/{store-WLZTRNZF.js → store-FO6TZ6MZ.js} +1 -1
- package/package.json +1 -1
- package/skills/moonpay-buy-the-dip/SKILL.md +160 -0
- package/skills/moonpay-take-profit-ladder/SKILL.md +154 -0
- package/skills/moonpay-trading-automation/SKILL.md +22 -7
- package/skills/moonpay-trailing-stop/SKILL.md +153 -0
- package/dist/chunk-XI74ZHHN.js +0 -2
- package/dist/chunk-YKOTBUL3.js +0 -58
|
@@ -40,7 +40,7 @@ AMOUNT=5
|
|
|
40
40
|
|
|
41
41
|
# --- Execute ---
|
|
42
42
|
log "SWAP: $AMOUNT $FROM_TOKEN -> $TO_TOKEN on $CHAIN"
|
|
43
|
-
RESULT=$("$MP"
|
|
43
|
+
RESULT=$("$MP" --json token swap \
|
|
44
44
|
--wallet "$WALLET" --chain "$CHAIN" \
|
|
45
45
|
--from-token "$FROM_TOKEN" --from-amount "$AMOUNT" \
|
|
46
46
|
--to-token "$TO_TOKEN" 2>&1) || {
|
|
@@ -51,11 +51,23 @@ log "OK: $RESULT"
|
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
Key points:
|
|
54
|
-
- `mp
|
|
54
|
+
- `mp --json` outputs single-line JSON, ideal for `jq` parsing
|
|
55
55
|
- Use `$(which mp)` and store as `MP` — cron/launchd have minimal PATH
|
|
56
56
|
- Wallet names only in scripts — `mp` handles keychain decryption at runtime
|
|
57
57
|
- If the user gives token names/symbols, resolve to addresses first with `mp token search`
|
|
58
58
|
|
|
59
|
+
## Pre-built strategy skills
|
|
60
|
+
|
|
61
|
+
For three common strategies, prefer the dedicated skills over rolling your own:
|
|
62
|
+
|
|
63
|
+
- **moonpay-trailing-stop** — Sell automatically if price drops X% from its peak.
|
|
64
|
+
- **moonpay-take-profit-ladder** — Sell in chunks at preset price targets, hold the runner.
|
|
65
|
+
- **moonpay-buy-the-dip** — Buy a fixed USD amount when 24h drawdown exceeds a threshold, with a cooldown.
|
|
66
|
+
|
|
67
|
+
Each one comes with a verified shell-script template, the right cron cadence, and notes on common pitfalls. The patterns below (DCA, generic limit order, generic stop loss) are still the right starting point for strategies that don't fit those three.
|
|
68
|
+
|
|
69
|
+
If the user is on the **MoonPay Agents desktop app**, recommend using its in-app automation panel instead of generating a shell script — the app provides a persistent chat session that holds strategy state across fires (high-water-mark, fired rungs, last-fire timestamp) without a separate `state.json` file. The shell-script + cron pattern below is the right choice for headless / server / CI contexts where the app isn't running.
|
|
70
|
+
|
|
59
71
|
## DCA (Dollar-Cost Averaging)
|
|
60
72
|
|
|
61
73
|
"Buy $5 of SOL every day at 9am"
|
|
@@ -137,7 +149,7 @@ TARGET_PRICE=80
|
|
|
137
149
|
SCRIPT_NAME="limit-buy-sol"
|
|
138
150
|
|
|
139
151
|
# --- Check price ---
|
|
140
|
-
PRICE=$("$MP"
|
|
152
|
+
PRICE=$("$MP" --json token retrieve --token "$TOKEN" --chain "$CHAIN" | jq -r '.marketData.price')
|
|
141
153
|
|
|
142
154
|
if [ -z "$PRICE" ] || [ "$PRICE" = "null" ]; then
|
|
143
155
|
log "LIMIT $SCRIPT_NAME: price fetch failed, skipping"
|
|
@@ -147,7 +159,7 @@ fi
|
|
|
147
159
|
# --- Compare ---
|
|
148
160
|
if (( $(echo "$PRICE < $TARGET_PRICE" | bc -l) )); then
|
|
149
161
|
log "LIMIT $SCRIPT_NAME: price $PRICE < $TARGET_PRICE — executing buy"
|
|
150
|
-
RESULT=$("$MP"
|
|
162
|
+
RESULT=$("$MP" --json token swap \
|
|
151
163
|
--wallet "$WALLET" --chain "$CHAIN" \
|
|
152
164
|
--from-token "$BUY_WITH" --from-amount "$BUY_AMOUNT" \
|
|
153
165
|
--to-token "$TOKEN" 2>&1) || {
|
|
@@ -186,16 +198,16 @@ TRIGGER_PRICE=70
|
|
|
186
198
|
SCRIPT_NAME="stop-loss-sol"
|
|
187
199
|
|
|
188
200
|
# --- Check price ---
|
|
189
|
-
PRICE=$("$MP"
|
|
201
|
+
PRICE=$("$MP" --json token retrieve --token "$SELL_TOKEN" --chain "$CHAIN" | jq -r '.marketData.price')
|
|
190
202
|
|
|
191
203
|
if (( $(echo "$PRICE < $TRIGGER_PRICE" | bc -l) )); then
|
|
192
204
|
# Get current balance to sell all
|
|
193
|
-
BALANCE=$("$MP"
|
|
205
|
+
BALANCE=$("$MP" --json token balance list --wallet "$WALLET" --chain "$CHAIN" \
|
|
194
206
|
| jq -r --arg addr "$SELL_TOKEN" '.items[] | select(.address == $addr) | .balance.amount')
|
|
195
207
|
|
|
196
208
|
if [ -n "$BALANCE" ] && (( $(echo "$BALANCE > 0" | bc -l) )); then
|
|
197
209
|
log "STOP-LOSS $SCRIPT_NAME: price $PRICE < $TRIGGER_PRICE — selling $BALANCE"
|
|
198
|
-
RESULT=$("$MP"
|
|
210
|
+
RESULT=$("$MP" --json token swap \
|
|
199
211
|
--wallet "$WALLET" --chain "$CHAIN" \
|
|
200
212
|
--from-token "$SELL_TOKEN" --from-amount "$BALANCE" \
|
|
201
213
|
--to-token "$TO_TOKEN" 2>&1) || {
|
|
@@ -270,6 +282,9 @@ fi
|
|
|
270
282
|
|
|
271
283
|
## Related skills
|
|
272
284
|
|
|
285
|
+
- **moonpay-trailing-stop** — Mechanical trailing stop with shipped reference script
|
|
286
|
+
- **moonpay-take-profit-ladder** — Laddered partial sells at preset price targets
|
|
287
|
+
- **moonpay-buy-the-dip** — Conditional buy on drawdown with cooldown
|
|
273
288
|
- **moonpay-swap-tokens** — Swap and bridge command syntax
|
|
274
289
|
- **moonpay-check-wallet** — Check balances before setting up automation
|
|
275
290
|
- **moonpay-discover-tokens** — Research tokens and resolve addresses
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: moonpay-trailing-stop
|
|
3
|
+
description: Run a trailing stop on one position — sell automatically if the price drops a fixed % from its peak since you started watching. Mechanical execution, no overrides.
|
|
4
|
+
tags: [trading, automation, stop-loss]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Trailing stop
|
|
8
|
+
|
|
9
|
+
## Goal
|
|
10
|
+
|
|
11
|
+
Watch a single position and automatically sell it into a stable (USDC by default) if its price falls a fixed percent from the high-water-mark recorded since the strategy started. The whole point is mechanical execution — never widen the stop because "it'll come back."
|
|
12
|
+
|
|
13
|
+
This skill works in two contexts:
|
|
14
|
+
- **Inside an automation harness** (the MoonPay Agents desktop app): chat session memory holds the high-water-mark across fires.
|
|
15
|
+
- **Headless via cron / launchd**: a JSON file at `~/.config/moonpay/state/trailing-stop-<id>.json` holds the same state.
|
|
16
|
+
|
|
17
|
+
The decision logic is identical; only the persistence layer differs.
|
|
18
|
+
|
|
19
|
+
## Prerequisites
|
|
20
|
+
|
|
21
|
+
- `mp` authenticated: `mp user retrieve`
|
|
22
|
+
- The target position is held in a wallet `mp wallet list` knows about
|
|
23
|
+
- `jq` installed: `which jq`
|
|
24
|
+
|
|
25
|
+
## Configuration
|
|
26
|
+
|
|
27
|
+
Required inputs to capture on first run (ask the user, then persist):
|
|
28
|
+
|
|
29
|
+
| Field | Notes |
|
|
30
|
+
|---|---|
|
|
31
|
+
| `token` | Token address. Resolve from a ticker with `mp token search --query <ticker> --chain <chain>` |
|
|
32
|
+
| `chain` | e.g. `solana`, `ethereum`, `base` |
|
|
33
|
+
| `wallet` | Wallet name (the local label, not the address) |
|
|
34
|
+
| `trailing_pct` | Percent drop from peak that triggers the sell. Default: 12 |
|
|
35
|
+
| `sell_into` | Token address to sell into. Default: USDC on the same chain |
|
|
36
|
+
| `entry_price` | Optional — original cost basis if known. Used only for PnL reporting at exit |
|
|
37
|
+
| `hwm` | Initial high-water-mark = current price at first fire |
|
|
38
|
+
| `closed` | Boolean. False until the stop fires. After it fires, the strategy stops watching |
|
|
39
|
+
|
|
40
|
+
## Per-fire workflow
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
1. If `closed`: log "position already closed" and exit.
|
|
44
|
+
2. price = mp --json token retrieve --token $TOKEN --chain $CHAIN | jq '.marketData.price'
|
|
45
|
+
3. balance = mp --json token balance list --wallet $WALLET_ADDR --chain $CHAIN
|
|
46
|
+
| jq --arg t $TOKEN '.items[] | select(.address==$t) | .balance.amount'
|
|
47
|
+
4. If balance is null or 0: mark closed=true, log "no position, stopping", exit.
|
|
48
|
+
5. If price > hwm: hwm = price. Log "new HWM $price (drawdown 0.00%)". Exit.
|
|
49
|
+
6. drawdown_pct = (hwm - price) / hwm * 100
|
|
50
|
+
7. If drawdown_pct >= trailing_pct: EXECUTE THE SELL (full balance). Log fill.
|
|
51
|
+
Mark closed=true. Optional: report PnL vs entry_price if known.
|
|
52
|
+
8. Else: log "holding — price $price, HWM $hwm, drawdown $drawdown_pct%, gap to trigger $(trailing_pct - drawdown_pct)%". Exit.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The sell command:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
mp --json token swap \
|
|
59
|
+
--wallet "$WALLET" \
|
|
60
|
+
--chain "$CHAIN" \
|
|
61
|
+
--from-token "$TOKEN" \
|
|
62
|
+
--from-amount "$BALANCE" \
|
|
63
|
+
--to-token "$SELL_INTO"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Schedule
|
|
67
|
+
|
|
68
|
+
A 15-minute interval is the right balance for most positions:
|
|
69
|
+
- Cron: `*/15 * * * * /path/to/script.sh # moonpay:trailing-stop-<id>`
|
|
70
|
+
- Launchd: `<key>StartInterval</key><integer>900</integer>`
|
|
71
|
+
|
|
72
|
+
For volatile small-caps, drop to `*/5`. For large caps you're not actively trading, hourly is enough.
|
|
73
|
+
|
|
74
|
+
## Headless reference script
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
#!/bin/bash
|
|
78
|
+
set -euo pipefail
|
|
79
|
+
MP="$(which mp)"
|
|
80
|
+
ID="trailing-stop-sol-main" # unique per strategy
|
|
81
|
+
STATE="$HOME/.config/moonpay/state/${ID}.json"
|
|
82
|
+
LOG="$HOME/.config/moonpay/logs/trading.log"
|
|
83
|
+
mkdir -p "$(dirname "$STATE")" "$(dirname "$LOG")"
|
|
84
|
+
log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $ID $*" >> "$LOG"; }
|
|
85
|
+
|
|
86
|
+
# --- Config (fill these in once) ---
|
|
87
|
+
TOKEN="So11111111111111111111111111111111111111112" # SOL (WSOL mint)
|
|
88
|
+
CHAIN="solana"
|
|
89
|
+
WALLET="main"
|
|
90
|
+
WALLET_ADDR="<address from mp wallet list>"
|
|
91
|
+
TRAILING_PCT=12
|
|
92
|
+
SELL_INTO="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" # USDC
|
|
93
|
+
|
|
94
|
+
# --- Load state (initialize on first run) ---
|
|
95
|
+
if [ ! -f "$STATE" ]; then
|
|
96
|
+
PRICE=$("$MP" --json token retrieve --token "$TOKEN" --chain "$CHAIN" | jq '.marketData.price')
|
|
97
|
+
echo "{\"hwm\": $PRICE, \"closed\": false}" > "$STATE"
|
|
98
|
+
log "initialized hwm=$PRICE"
|
|
99
|
+
fi
|
|
100
|
+
CLOSED=$(jq -r '.closed' "$STATE")
|
|
101
|
+
HWM=$(jq -r '.hwm' "$STATE")
|
|
102
|
+
[ "$CLOSED" = "true" ] && { log "already closed, exit"; exit 0; }
|
|
103
|
+
|
|
104
|
+
# --- Check price + balance ---
|
|
105
|
+
PRICE=$("$MP" --json token retrieve --token "$TOKEN" --chain "$CHAIN" | jq '.marketData.price')
|
|
106
|
+
BALANCE=$("$MP" --json token balance list --wallet "$WALLET_ADDR" --chain "$CHAIN" \
|
|
107
|
+
| jq --arg t "$TOKEN" '[.items[] | select(.address==$t) | .balance.amount][0] // 0')
|
|
108
|
+
|
|
109
|
+
if (( $(echo "$BALANCE <= 0" | bc -l) )); then
|
|
110
|
+
jq '.closed = true' "$STATE" > "$STATE.tmp" && mv "$STATE.tmp" "$STATE"
|
|
111
|
+
log "no position, marked closed"; exit 0
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
# --- Decide ---
|
|
115
|
+
if (( $(echo "$PRICE > $HWM" | bc -l) )); then
|
|
116
|
+
jq --argjson p "$PRICE" '.hwm = $p' "$STATE" > "$STATE.tmp" && mv "$STATE.tmp" "$STATE"
|
|
117
|
+
log "new HWM $PRICE"
|
|
118
|
+
exit 0
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
DRAWDOWN_PCT=$(echo "scale=4; ($HWM - $PRICE) / $HWM * 100" | bc -l)
|
|
122
|
+
TRIGGER=$(echo "$DRAWDOWN_PCT >= $TRAILING_PCT" | bc -l)
|
|
123
|
+
if [ "$TRIGGER" = "1" ]; then
|
|
124
|
+
log "TRIGGER: drawdown ${DRAWDOWN_PCT}% >= ${TRAILING_PCT}% — selling $BALANCE"
|
|
125
|
+
RESULT=$("$MP" --json token swap \
|
|
126
|
+
--wallet "$WALLET" --chain "$CHAIN" \
|
|
127
|
+
--from-token "$TOKEN" --from-amount "$BALANCE" \
|
|
128
|
+
--to-token "$SELL_INTO" 2>&1) || { log "SELL FAILED: $RESULT"; exit 1; }
|
|
129
|
+
log "SELL OK: $RESULT"
|
|
130
|
+
jq '.closed = true' "$STATE" > "$STATE.tmp" && mv "$STATE.tmp" "$STATE"
|
|
131
|
+
else
|
|
132
|
+
log "holding — price $PRICE hwm $HWM drawdown ${DRAWDOWN_PCT}%"
|
|
133
|
+
fi
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Inside an automation harness
|
|
137
|
+
|
|
138
|
+
When this skill runs inside the MoonPay Agents desktop app, the harness provides a single resumed chat session — no state file needed. The agent persists `hwm` and `closed` in conversation memory and follows the same decision logic. The body of the in-app automation is a thin pointer to this skill.
|
|
139
|
+
|
|
140
|
+
## Common pitfalls
|
|
141
|
+
|
|
142
|
+
- **Hard-coding the SOL mint as `...111`**. The wrapped SOL mint ends in `112`. Resolve via `mp token search --query SOL --chain solana` if unsure.
|
|
143
|
+
- **Skipping the balance check**. If the user manually sells the position between fires, the sell command will fail with insufficient balance. Always check balance first; mark closed and exit if zero.
|
|
144
|
+
- **Widening the stop after a loss**. The strategy is defined by mechanical execution. If you find yourself wanting to override, the strategy isn't for this position.
|
|
145
|
+
- **Not naming the cron entry**. Always tag scheduled entries with `# moonpay:trailing-stop-<id>` so they can be listed and removed cleanly.
|
|
146
|
+
|
|
147
|
+
## Related skills
|
|
148
|
+
|
|
149
|
+
- **moonpay-trading-automation** — Shell-script + cron/launchd patterns for headless automation
|
|
150
|
+
- **moonpay-take-profit-ladder** — Companion strategy for partial-sell-on-the-way-up
|
|
151
|
+
- **moonpay-discover-tokens** — Resolve tickers to token addresses
|
|
152
|
+
- **moonpay-swap-tokens** — Underlying swap command syntax
|
|
153
|
+
- **moonpay-check-wallet** — Position size lookup
|
package/dist/chunk-XI74ZHHN.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
import{f as vt,g as yt,j as Pt,m as Ct,n as kt,o as It,p as At}from"./chunk-CZBP5SWH.js";var n=class extends Error{constructor(r,i,u){super(r);this.status=i;this.toolName=u;this.name="MoonPayError"}},c=class extends n{constructor(t="Authentication required"){super(t,401),this.name="AuthError"}},o=class extends n{constructor(t="Rate limit exceeded"){super(t,429),this.name="RateLimitError"}},l=class extends n{constructor(t,r){super(t,400,r),this.name="ValidationError"}},s=class extends n{constructor(t){super(`Tool not found: ${t}`,404,t),this.name="ToolNotFoundError"}},p=class extends n{constructor(t,r){super(`Tool "${t}" has been renamed to "${r}"`,410,t),this.name="ToolRenamedError",this.newName=r}};var Mt="https://agents.moonpay.com",Rt=6e4,h=class{constructor(t={}){this.baseUrl=(t.baseUrl??Mt).replace(/\/$/,""),this.auth=t.auth??{type:"none"},this.timeout=t.timeout??Rt,this.headers=t.headers??{}}async _call(t,r){let i=`${this.baseUrl}/api/tools/${encodeURIComponent(t)}`,u=await this.buildHeaders(),a=await fetch(i,{method:"POST",headers:u,body:JSON.stringify(r),signal:AbortSignal.timeout(this.timeout)});if(a.status===401&&this.auth.type==="bearer"&&this.auth.refreshToken)try{let gt=await this.auth.refreshToken();u.Authorization=`Bearer ${gt}`,a=await fetch(i,{method:"POST",headers:u,body:JSON.stringify(r),signal:AbortSignal.timeout(this.timeout)})}catch{throw new c("Token refresh failed")}return this.handleResponse(a,t)}async buildHeaders(){let t={"Content-Type":"application/json",...this.headers};if(this.auth.type==="bearer"){let r=await this.auth.getToken();r&&(t.Authorization=`Bearer ${r}`)}return t}async handleResponse(t,r){if(t.ok)return t.json();let i;try{i=await t.json()}catch{i={error:t.statusText}}let u=i?.error??i?.message,a=typeof u=="string"?u:u?JSON.stringify(u):`Request failed with status ${t.status}`;switch(t.status){case 400:throw new l(a,r);case 401:throw new c(a);case 404:throw new s(r);case 410:throw new p(r,i?.newName??"unknown");case 429:throw new o(a);default:throw new n(a,t.status,r)}}};var _=class{constructor(t){this.client=t}build(t){return this.client._call("card_delegation_approve_transaction_build",t)}},O=class{constructor(t){this.client=t}get transaction(){return new _(this.client)}},v=class{constructor(t){this.client=t}build(t){return this.client._call("card_delegation_revoke_transaction_build",t)}},P=class{constructor(t){this.client=t}get transaction(){return new v(this.client)}},C=class{constructor(t){this.client=t}retrieve(t){return this.client._call("card_delegation_token_retrieve",t)}},k=class{constructor(t){this.client=t}get approve(){return new O(this.client)}get revoke(){return new P(this.client)}get token(){return new C(this.client)}},I=class{constructor(t){this.client=t}check(t){return this.client._call("card_onboarding_check",t)}finish(t){return this.client._call("card_onboarding_finish",t)}start(t){return this.client._call("card_onboarding_start",t)}},g=class{constructor(t){this.client=t}list(t){return this.client._call("card_transaction_list",t)}},y=class{constructor(t){this.client=t}retrieve(t){return this.client._call("card_user_retrieve",t)}},A=class{constructor(t){this.client=t}check(t){return this.client._call("card_wallet_check",t)}link(t){return this.client._call("card_wallet_link",t)}list(t){return this.client._call("card_wallet_list",t)}unlink(t){return this.client._call("card_wallet_unlink",t)}},M=class{constructor(t){this.client=t}get delegation(){return new k(this.client)}get onboarding(){return new I(this.client)}get transaction(){return new g(this.client)}get user(){return new y(this.client)}get wallet(){return new A(this.client)}create(t){return this.client._call("card_create",t)}freeze(t){return this.client._call("card_freeze",t)}retrieve(t){return this.client._call("card_retrieve",t)}reveal(t){return this.client._call("card_reveal",t)}unfreeze(t){return this.client._call("card_unfreeze",t)}},R=class{constructor(t){this.client=t}list(t){return this.client._call("chain_list",t)}retrieve(t){return this.client._call("chain_retrieve",t)}},f=class{constructor(t){this.client=t}create(t){return this.client._call("cli_activation_create",t)}update(t){return this.client._call("cli_activation_update",t)}},w=class{constructor(t){this.client=t}get activation(){return new f(this.client)}},T=class{constructor(t){this.client=t}add(t){return this.client._call("commerce_cart_add",t)}remove(t){return this.client._call("commerce_cart_remove",t)}retrieve(t){return this.client._call("commerce_cart_retrieve",t)}update(t){return this.client._call("commerce_cart_update",t)}},L=class{constructor(t){this.client=t}pay(t){return this.client._call("commerce_checkout_pay",t)}start(t){return this.client._call("commerce_checkout_start",t)}},V=class{constructor(t){this.client=t}retrieve(t){return this.client._call("commerce_product_retrieve",t)}search(t){return this.client._call("commerce_product_search",t)}},x=class{constructor(t){this.client=t}list(t){return this.client._call("commerce_store_list",t)}retrieve(t){return this.client._call("commerce_store_retrieve",t)}},b=class{constructor(t){this.client=t}get cart(){return new T(this.client)}get checkout(){return new L(this.client)}get product(){return new V(this.client)}get store(){return new x(this.client)}search(t){return this.client._call("commerce_search",t)}},S=class{constructor(t){this.client=t}list(t){return this.client._call("deposit_transaction_list",t)}},B=class{constructor(t){this.client=t}get transaction(){return new S(this.client)}create(t){return this.client._call("deposit_create",t)}retrieve(t){return this.client._call("deposit_retrieve",t)}},U=class{constructor(t){this.client=t}create(t){return this.client._call("feedback_create",t)}},W=class{constructor(t){this.client=t}buy(t){return this.client._call("gateway_buy",t)}search(t){return this.client._call("gateway_search",t)}},D=class{constructor(t){this.client=t}list(t){return this.client._call("prediction-market_activity_list",t)}},E=class{constructor(t){this.client=t}retrieve(t){return this.client._call("prediction-market_market_event_retrieve",t)}},F=class{constructor(t){this.client=t}list(t){return this.client._call("prediction-market_market_price_history_list",t)}},z=class{constructor(t){this.client=t}get history(){return new F(this.client)}retrieve(t){return this.client._call("prediction-market_market_price_retrieve",t)}},H=class{constructor(t){this.client=t}list(t){return this.client._call("prediction-market_market_tag_list",t)}},$=class{constructor(t){this.client=t}list(t){return this.client._call("prediction-market_market_trending_list",t)}},G=class{constructor(t){this.client=t}get event(){return new E(this.client)}get price(){return new z(this.client)}get tag(){return new H(this.client)}get trending(){return new $(this.client)}search(t){return this.client._call("prediction-market_market_search",t)}},K=class{constructor(t){this.client=t}retrieve(t){return this.client._call("prediction-market_pnl_retrieve",t)}},j=class{constructor(t){this.client=t}buy(t){return this.client._call("prediction-market_position_buy",t)}list(t){return this.client._call("prediction-market_position_list",t)}redeem(t){return this.client._call("prediction-market_position_redeem",t)}sell(t){return this.client._call("prediction-market_position_sell",t)}},J=class{constructor(t){this.client=t}list(t){return this.client._call("prediction-market_trade_list",t)}},q=class{constructor(t){this.client=t}create(t){return this.client._call("prediction-market_user_create",t)}},Q=class{constructor(t){this.client=t}get activity(){return new D(this.client)}get market(){return new G(this.client)}get pnl(){return new K(this.client)}get position(){return new j(this.client)}get trade(){return new J(this.client)}get user(){return new q(this.client)}},X=class{constructor(t){this.client=t}build(t){return this.client._call("swaps_transaction_build",t)}},Y=class{constructor(t){this.client=t}get transaction(){return new X(this.client)}},Z=class{constructor(t){this.client=t}list(t){return this.client._call("token_balance_list",t)}},N=class{constructor(t){this.client=t}list(t){return this.client._call("token_holder_list",t)}},tt=class{constructor(t){this.client=t}list(t){return this.client._call("token_ohlcv_list",t)}},et=class{constructor(t){this.client=t}list(t){return this.client._call("token_trending_list",t)}},rt=class{constructor(t){this.client=t}get balance(){return new Z(this.client)}get holder(){return new N(this.client)}get ohlcv(){return new tt(this.client)}get trending(){return new et(this.client)}check(t){return this.client._call("token_check",t)}retrieve(t){return this.client._call("token_retrieve",t)}search(t){return this.client._call("token_search",t)}},nt=class{constructor(t){this.client=t}list(t){return this.client._call("transaction_list",t)}prepare(t){return this.client._call("transaction_prepare",t)}register(t){return this.client._call("transaction_register",t)}retrieve(t){return this.client._call("transaction_retrieve",t)}send(t){return this.client._call("transaction_send",t)}},it=class{constructor(t){this.client=t}retrieve(t){return this.client._call("user_retrieve",t)}},ut=class{constructor(t){this.client=t}accept(t){return this.client._call("virtual-account_agreement_accept",t)}list(t){return this.client._call("virtual-account_agreement_list",t)}},at=class{constructor(t){this.client=t}delete(t){return this.client._call("virtual-account_bank-account_delete",t)}list(t){return this.client._call("virtual-account_bank-account_list",t)}register(t){return this.client._call("virtual-account_bank-account_register",t)}retrieve(t){return this.client._call("virtual-account_bank-account_retrieve",t)}},ct=class{constructor(t){this.client=t}continue(t){return this.client._call("virtual-account_kyc_continue",t)}restart(t){return this.client._call("virtual-account_kyc_restart",t)}},ot=class{constructor(t){this.client=t}cancel(t){return this.client._call("virtual-account_offramp_cancel",t)}create(t){return this.client._call("virtual-account_offramp_create",t)}initiate(t){return this.client._call("virtual-account_offramp_initiate",t)}list(t){return this.client._call("virtual-account_offramp_list",t)}retrieve(t){return this.client._call("virtual-account_offramp_retrieve",t)}update(t){return this.client._call("virtual-account_offramp_update",t)}},lt=class{constructor(t){this.client=t}create(t){return this.client._call("virtual-account_onramp_payment_create",t)}retrieve(t){return this.client._call("virtual-account_onramp_payment_retrieve",t)}},st=class{constructor(t){this.client=t}get payment(){return new lt(this.client)}cancel(t){return this.client._call("virtual-account_onramp_cancel",t)}create(t){return this.client._call("virtual-account_onramp_create",t)}list(t){return this.client._call("virtual-account_onramp_list",t)}retrieve(t){return this.client._call("virtual-account_onramp_retrieve",t)}update(t){return this.client._call("virtual-account_onramp_update",t)}},pt=class{constructor(t){this.client=t}list(t){return this.client._call("virtual-account_transaction_list",t)}},mt=class{constructor(t){this.client=t}list(t){return this.client._call("virtual-account_wallet_list",t)}register(t){return this.client._call("virtual-account_wallet_register",t)}},ht=class{constructor(t){this.client=t}get agreement(){return new ut(this.client)}get bankAccount(){return new at(this.client)}get kyc(){return new ct(this.client)}get offramp(){return new ot(this.client)}get onramp(){return new st(this.client)}get transaction(){return new pt(this.client)}get wallet(){return new mt(this.client)}create(t){return this.client._call("virtual-account_create",t)}retrieve(t){return this.client._call("virtual-account_retrieve",t)}},dt=class{constructor(t){this.client=t}list(t){return this.client._call("wallet_activity_list",t)}},_t=class{constructor(t){this.client=t}retrieve(t){return this.client._call("wallet_pnl_retrieve",t)}},Ot=class{constructor(t){this.client=t}get activity(){return new dt(this.client)}get pnl(){return new _t(this.client)}discover(t){return this.client._call("wallet_discover",t)}},m=class extends h{constructor(t={}){super(t)}get card(){return new M(this)}get chain(){return new R(this)}get cli(){return new w(this)}get commerce(){return new b(this)}get deposit(){return new B(this)}get feedback(){return new U(this)}get gateway(){return new W(this)}get predictionMarket(){return new Q(this)}get swaps(){return new Y(this)}get token(){return new rt(this)}get transaction(){return new nt(this)}get user(){return new it(this)}get virtualAccount(){return new ht(this)}get wallet(){return new Ot(this)}buy(t){return this._call("buy",t)}login(t){return this._call("login",t)}refresh(t){return this._call("refresh",t)}verify(t){return this._call("verify",t)}};At();yt();var d=null;function ft(){return d||(d=new m({baseUrl:Ct(),auth:{type:"bearer",getToken:It,refreshToken:async()=>{let e=Pt();if(!e?.refreshToken)throw new Error("No refresh token available");return(await kt(e)).accessToken}},headers:vt()})),d}var Ft=new Proxy({},{get(e,t){return Reflect.get(ft(),t)}});function zt(){d=null}export{m as a,Ft as b,zt as c};
|