@goplausible/openclaw-algorand-plugin 1.3.0 → 1.4.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.
@@ -2,7 +2,7 @@
2
2
  "id": "openclaw-algorand-plugin",
3
3
  "name": "Algorand Integration",
4
4
  "description": "Algorand blockchain integration with MCP and skills — by GoPlausible",
5
- "version": "1.3.0",
5
+ "version": "1.4.0",
6
6
  "skills": [
7
7
  "skills/algorand-development",
8
8
  "skills/algorand-typescript",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goplausible/openclaw-algorand-plugin",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -710,6 +710,7 @@ DEX-aggregated swaps across Tinyman V2, Pact, and Folks with smart order routing
710
710
  "network": "mainnet"
711
711
  }
712
712
  ```
713
+ - **`type`**: `"fixed-input"` = `amount` is the input (spend exactly this much); `"fixed-output"` = `amount` is the output (receive exactly this much). See **Swap Type Rules** below.
713
714
  - **Returns**: `expectedOutput`, `inputAmount`, `usdIn`, `usdOut`, `userPriceImpact`, `route`, `flattenedRoute`, `requiredAppOptIns`, `protocolFees`
714
715
 
715
716
  ### api_haystack_execute_swap
@@ -728,8 +729,23 @@ DEX-aggregated swaps across Tinyman V2, Pact, and Folks with smart order routing
728
729
  "network": "mainnet"
729
730
  }
730
731
  ```
732
+ - **`type`**: `"fixed-input"` = `amount` is the input (spend exactly this much); `"fixed-output"` = `amount` is the output (receive exactly this much). See **Swap Type Rules** below.
731
733
  - **Returns**: `status`, `confirmedRound`, `txIds`, `signer`, `nickname`, quote details, `summary` (inputAmount, outputAmount, totalFees, transactionCount)
732
734
 
735
+ ### Swap Type Rules
736
+
737
+ > **CRITICAL**: The `type` parameter determines which side of the swap is exact. Getting this wrong means the user spends more or receives less than intended.
738
+
739
+ | User intent | type | amount is | fromASAID | toASAID |
740
+ |-------------|------|-----------|-----------|---------|
741
+ | "Buy 10 ALGO with USDC" | `fixed-output` | 10000000 (output) | USDC | ALGO |
742
+ | "Buy USDC for 10 ALGO" | `fixed-input` | 10000000 (input) | ALGO | USDC |
743
+ | "Swap 5 USDC to ALGO" | `fixed-input` | 5000000 (input) | USDC | ALGO |
744
+ | "I want exactly 100 USDC" | `fixed-output` | 100000000 (output) | ALGO | USDC |
745
+
746
+ - **"Buy X of Y"** → `fixed-output`, amount = X in base units of Y, toASAID = Y
747
+ - **"Swap/sell/use X of Y"** → `fixed-input`, amount = X in base units of Y, fromASAID = Y
748
+
733
749
  ### api_haystack_needs_optin
734
750
  - **Purpose**: Check if an address needs to opt into an asset before swapping
735
751
  - **Parameters**: `{ "address": "ALGO_ADDRESS", "assetId": 31566704, "network": "mainnet" }`
@@ -402,6 +402,16 @@ api_tinyman_get_pool {
402
402
 
403
403
  Best-price swap across multiple DEXes (Tinyman V2, Pact, Folks). For detailed reference, see the **haystack-router-interaction** skill.
404
404
 
405
+ ### CRITICAL: fixed-input vs fixed-output
406
+
407
+ | User says | type | amount is | fromASAID | toASAID |
408
+ |-----------|------|-----------|-----------|---------|
409
+ | "Swap 10 ALGO for USDC" | `fixed-input` | 10000000 (input — spend exactly 10 ALGO) | 0 (ALGO) | 31566704 (USDC) |
410
+ | "Buy 10 ALGO with USDC" | `fixed-output` | 10000000 (output — receive exactly 10 ALGO) | 31566704 (USDC) | 0 (ALGO) |
411
+
412
+ - **"Buy X of Y"** → `fixed-output`, amount = X in base units of Y, toASAID = Y
413
+ - **"Swap/sell/use X of Y"** → `fixed-input`, amount = X in base units of Y, fromASAID = Y
414
+
405
415
  ### Step 1: Check wallet
406
416
  ```
407
417
  wallet_get_info { "network": "mainnet" }
@@ -421,24 +431,41 @@ wallet_optin_asset { "assetId": 31566704, "network": "mainnet" }
421
431
  ```
422
432
 
423
433
  ### Step 3: Get a quote (show user before executing)
434
+
435
+ **Example A — "Swap 10 ALGO for USDC" (fixed-input):**
424
436
  ```
425
437
  api_haystack_get_swap_quote {
426
438
  "fromASAID": 0,
427
439
  "toASAID": 31566704,
428
- "amount": 1000000,
440
+ "amount": 10000000,
429
441
  "type": "fixed-input",
430
442
  "address": "[wallet_address]",
431
443
  "network": "mainnet"
432
444
  }
433
445
  ```
434
- > Present to user: expected output, USD values, route, price impact.
446
+
447
+ **Example B — "Buy 10 ALGO with USDC" (fixed-output):**
448
+ ```
449
+ api_haystack_get_swap_quote {
450
+ "fromASAID": 31566704,
451
+ "toASAID": 0,
452
+ "amount": 10000000,
453
+ "type": "fixed-output",
454
+ "address": "[wallet_address]",
455
+ "network": "mainnet"
456
+ }
457
+ ```
458
+ > Present to user: expected output (or estimated input), USD values, route, price impact.
435
459
 
436
460
  ### Step 4: Execute swap (after user confirms)
461
+
462
+ Use the **same `type`, `fromASAID`, `toASAID`, and `amount`** as the quote:
437
463
  ```
438
464
  api_haystack_execute_swap {
439
465
  "fromASAID": 0,
440
466
  "toASAID": 31566704,
441
- "amount": 1000000,
467
+ "amount": 10000000,
468
+ "type": "fixed-input",
442
469
  "slippage": 1,
443
470
  "network": "mainnet"
444
471
  }
@@ -56,11 +56,23 @@ The SDK is the **only** supported integration path. Do not call the API directly
56
56
 
57
57
  - **Amounts** are always in base units (microAlgos for ALGO, smallest unit for ASAs)
58
58
  - **ASA IDs**: 0 = ALGO, 31566704 = USDC, etc.
59
- - **Quote types**: `fixed-input` (default) specify input amount; `fixed-output` specify desired output
60
- - **Slippage**: Percentage tolerance on output (e.g., 1 = 1%). Applied to the final output, not individual hops
59
+ - **Slippage**: Percentage tolerance on output (e.g., 1 = 1%). Applied to the final output, not individual hops.
60
+ - **Quote types**: `fixed-input` (default) specify input amount; `fixed-output` specify desired output.
61
61
  - **Routing**: Supports multi-hop and parallel (combo) swaps for optimal pricing
62
62
  - **Middleware**: Plugin system for custom pre/post-swap transactions (e.g., auto opt-out)
63
63
 
64
+ ### fixed-input vs fixed-output
65
+
66
+ | Type | `amount` specifies | Other side | Example |
67
+ |------|-------------------|------------|---------|
68
+ | `fixed-input` (default) | Input (what you send) | Estimated output | "Swap 10 ALGO for USDC" — spend exactly 10 ALGO |
69
+ | `fixed-output` | Output (what you get) | Estimated input | "Buy 10 ALGO with USDC" — receive exactly 10 ALGO |
70
+
71
+ - **"Buy X of Y"** → `fixed-output`, amount = X in base units of Y, toASAID = Y
72
+ - **"Swap/sell/use X of Y"** → `fixed-input`, amount = X in base units of Y, fromASAID = Y
73
+ - **"I want exactly X of Y"** → `fixed-output`, amount = X in base units of Y, toASAID = Y
74
+ - The `amount` field always refers to the **fixed side** — never the estimated side
75
+
64
76
  ## Reference Files
65
77
 
66
78
  Read the appropriate file based on the task:
@@ -122,10 +122,39 @@ Step 4: User confirms → Execute
122
122
 
123
123
  - **Amounts** are always in base units (microAlgos for ALGO, smallest unit for ASAs)
124
124
  - **ASA IDs**: 0 = ALGO, 31566704 = USDC, etc.
125
+ - **Slippage**: Percentage tolerance on output (e.g., 1 = 1%). Applied to the final output, not individual hops.
125
126
  - **Quote types**: `fixed-input` (default) — specify input amount; `fixed-output` — specify desired output
126
- - **Slippage**: Percentage tolerance on output (e.g., 1 = 1%). Applied to the final output, not individual hops
127
127
  - **Routing**: Supports multi-hop and parallel (combo) swaps for optimal pricing
128
128
 
129
+ ## CRITICAL: fixed-input vs fixed-output — Choosing the Correct Swap Type
130
+
131
+ The `type` parameter determines which side of the swap is exact. Getting this wrong means the user spends more or receives less than intended. **Parse the user's intent carefully.**
132
+
133
+ | Type | Meaning | `amount` specifies | The other side is | Use when |
134
+ |------|---------|-------------------|-------------------|----------|
135
+ | `fixed-input` | Spend exactly this much | **Input** amount (what you send) | Estimated (output varies) | "Swap 10 ALGO for USDC", "Sell 10 ALGO", "Use 10 ALGO to buy USDC" |
136
+ | `fixed-output` | Receive exactly this much | **Output** amount (what you get) | Estimated (input varies) | "Buy 10 ALGO with USDC", "I want exactly 5 USDC", "Get me 10 ALGO" |
137
+
138
+ ### Mapping User Intent — Examples
139
+
140
+ | User says | Type | fromASAID | toASAID | amount | Why |
141
+ |-----------|------|-----------|---------|--------|-----|
142
+ | "Buy 10 ALGO with USDC" | `fixed-output` | 31566704 (USDC) | 0 (ALGO) | 10000000 | User wants **exactly 10 ALGO** out |
143
+ | "Buy USDC for 10 ALGO" | `fixed-input` | 0 (ALGO) | 31566704 (USDC) | 10000000 | User wants to **spend exactly 10 ALGO** |
144
+ | "Swap 5 USDC to ALGO" | `fixed-input` | 31566704 (USDC) | 0 (ALGO) | 5000000 | User wants to **spend exactly 5 USDC** |
145
+ | "I want exactly 100 USDC" | `fixed-output` | 0 (ALGO) | 31566704 (USDC) | 100000000 | User wants **exactly 100 USDC** out |
146
+ | "Sell 10 ALGO" | `fixed-input` | 0 (ALGO) | 31566704 (USDC) | 10000000 | User wants to **spend exactly 10 ALGO** |
147
+ | "Get me 10 ALGO" | `fixed-output` | 31566704 (USDC) | 0 (ALGO) | 10000000 | User wants **exactly 10 ALGO** out |
148
+
149
+ ### Rules
150
+
151
+ 1. **"Buy X of Y"** → `fixed-output`, amount = X (in base units of Y), toASAID = Y
152
+ 2. **"Swap/sell/use X of Y for Z"** → `fixed-input`, amount = X (in base units of Y), fromASAID = Y
153
+ 3. **"I want exactly X of Y"** → `fixed-output`, amount = X (in base units of Y), toASAID = Y
154
+ 4. **When ambiguous, ask the user**: "Do you want to spend exactly X or receive exactly X?"
155
+ 5. **The `amount` field always refers to the fixed side** — input amount for `fixed-input`, output amount for `fixed-output`
156
+ 6. **Always show the quote** before executing so the user can verify the estimated other side
157
+
129
158
  ## Reference Files
130
159
 
131
160
  Read the appropriate file based on the task: