Skip to content

Commit 28f26a9

Browse files
v14.1.4 (#35)
1 parent ad7a6c9 commit 28f26a9

File tree

7 files changed

+26
-110
lines changed

7 files changed

+26
-110
lines changed

.coverage

0 Bytes
Binary file not shown.

README.md

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Solana Agent Kit provides a growing library of plugins that enhance your Solana
1616

1717
* Solana Transfer - Transfer Solana tokens between the agent's wallet and the destination wallet
1818
* Solana Ultra - Swap Solana tokens using Jupiter Ultra API with automatic slippage, priority fees, and transaction landing
19-
* Solana DFlow Swap - Fast token swaps using DFlow API with platform fees
19+
* Solana DFlow Swap - Fast token swaps using DFlow API
2020
* Jupiter Trigger - Create, cancel, and manage limit orders using Jupiter Trigger API
2121
* Jupiter Recurring - Create, cancel, and manage DCA orders using Jupiter Recurring API
2222
* Jupiter Holdings - Get token holdings with USD values for any wallet
@@ -26,7 +26,7 @@ Solana Agent Kit provides a growing library of plugins that enhance your Solana
2626
* Privy Ultra - Swap tokens using Jupiter Ultra with Privy delegated wallets
2727
* Privy Trigger - Create and manage limit orders with Privy delegated wallets
2828
* Privy Recurring - Create and manage DCA orders with Privy delegated wallets
29-
* Privy DFlow Swap - Fast token swaps using DFlow API with Privy delegated wallets and platform fees
29+
* Privy DFlow Swap - Fast token swaps using DFlow API with Privy delegated wallets
3030
* Privy Wallet Address - Get the wallet address of a Privy delegated wallet
3131
* Privy Create User - Create a new Privy user with a linked Telegram account (for bot-first flows)
3232
* Privy Create Wallet - Create a Solana wallet for a Privy user with optional bot delegation
@@ -102,15 +102,15 @@ By default, Jupiter Ultra provides gasless swaps when the user has < 0.01 SOL an
102102

103103
### Solana DFlow Swap
104104

105-
This plugin enables Solana Agent to swap tokens using DFlow's Swap API with a Solana keypair. DFlow offers faster swaps compared to Jupiter Ultra with competitive rates and supports platform fees for monetization.
105+
This plugin enables Solana Agent to swap tokens using DFlow's Swap API with a Solana keypair. DFlow offers faster swaps compared to Jupiter Ultra with competitive rates.
106+
107+
**Note:** Platform fees are not supported with DFlow. Use Solana Ultra (Jupiter) if you need to collect fees on swaps.
106108

107109
```python
108110
config = {
109111
"tools": {
110112
"solana_dflow_swap": {
111113
"private_key": "my-private-key", # Required - base58 string
112-
"platform_fee_bps": 50, # Optional - platform fee in basis points (e.g., 50 = 0.5%)
113-
"fee_account": "your-fee-token-account", # Optional - token account to receive platform fees
114114
"payer_private_key": "payer-private-key", # Optional - for gasless/sponsored transactions
115115
"rpc_url": "https://api.mainnet-beta.solana.com", # Optional - RPC URL (defaults to mainnet)
116116
},
@@ -120,12 +120,8 @@ config = {
120120

121121
**Features:**
122122
- **Fast Swaps**: DFlow typically executes faster than Jupiter Ultra
123-
- **Platform Fees**: Collect fees on swaps (in basis points) paid to your fee account
124123
- **Gasless Transactions**: Optionally sponsor gas fees for users via `payer_private_key`
125124

126-
**Platform Fee Setup:**
127-
To collect platform fees, you need to create a token account for the output token and provide it as `fee_account`. The `platform_fee_bps` specifies the fee amount (e.g., 50 = 0.5%).
128-
129125
### Jupiter Trigger
130126

131127
This plugin enables Solana Agent to create, cancel, and manage limit orders using Jupiter's Trigger API. It's a smart tool that handles the full lifecycle of limit orders with a single action parameter.
@@ -363,7 +359,9 @@ config = {
363359

364360
### Privy DFlow Swap
365361

366-
This plugin enables Solana Agent to swap tokens using DFlow's Swap API with Privy delegated wallets. DFlow offers faster swaps compared to Jupiter Ultra with competitive rates and supports platform fees for monetization.
362+
This plugin enables Solana Agent to swap tokens using DFlow's Swap API with Privy delegated wallets. DFlow offers faster swaps compared to Jupiter Ultra with competitive rates.
363+
364+
**Note:** Platform fees are not supported with DFlow. Use Privy Ultra (Jupiter) if you need to collect fees on swaps.
367365

368366
Transactions are signed via Privy and sent via your configured RPC (Helius recommended) for reliable blockhash handling and priority fees.
369367

@@ -375,8 +373,6 @@ config = {
375373
"app_secret": "your-privy-app-secret", # Required - your Privy application secret
376374
"signing_key": "wallet-auth:your-signing-key", # Required - your Privy wallet authorization signing key
377375
"rpc_url": "https://mainnet.helius-rpc.com/?api-key=YOUR_KEY", # Required - Helius recommended for priority fees
378-
"platform_fee_bps": 50, # Optional - platform fee in basis points (e.g., 50 = 0.5%)
379-
"fee_account": "your-fee-token-account", # Optional - token account to receive platform fees
380376
"payer_private_key": "payer-private-key", # Optional - for gasless/sponsored transactions
381377
},
382378
},
@@ -385,17 +381,13 @@ config = {
385381

386382
**Features:**
387383
- **Fast Swaps**: DFlow typically executes faster than Jupiter Ultra
388-
- **Platform Fees**: Collect fees on swaps (in basis points) paid to your fee account
389384
- **Privy Delegated Wallets**: Seamless user experience with embedded wallets
390385
- **Helius Priority Fees**: Uses Helius priority fee estimation for reliable transaction landing
391386
- **Gasless Transactions**: Optionally sponsor gas fees for users via `payer_private_key`
392387

393388
**RPC URL (Required):**
394389
Helius RPC is strongly recommended (`https://mainnet.helius-rpc.com/?api-key=YOUR_KEY`). Helius provides priority fee estimation and better blockhash handling, which significantly improves transaction success rates. Get a free API key at [helius.dev](https://helius.dev).
395390

396-
**Platform Fee Setup:**
397-
To collect platform fees, you need to create a token account for the output token and provide it as `fee_account`. The `platform_fee_bps` specifies the fee amount (e.g., 50 = 0.5%).
398-
399391
### Privy Wallet Address
400392

401393
This plugin enables Solana Agent to get the wallet address of a Privy delegated wallet.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "sakit"
3-
version = "14.1.3"
3+
version = "14.1.4"
44
description = "Solana Agent Kit"
55
authors = ["Bevan Hunt <bevan@bevanhunt.com>"]
66
license = "MIT"

sakit/privy_dflow_swap.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
"""
2-
DFlow Swap tool for Privy embedded wallets.
1+
"""DFlow Swap tool for Privy embedded wallets.
32
43
Enables fast token swaps using DFlow's Swap API via Privy delegated wallets.
54
Uses the official Privy Python SDK for wallet operations.
65
7-
DFlow offers faster swaps compared to Jupiter Ultra with similar liquidity
8-
and supports platform fees for monetization.
6+
DFlow offers faster swaps compared to Jupiter Ultra with similar liquidity.
97
108
Transactions are signed via Privy's signTransaction and sent via Helius RPC
119
for priority fees and reliable blockhash handling.
10+
11+
Note: Platform fees are not supported. Use Jupiter Ultra (privy_ultra) if you
12+
need to collect fees on swaps.
1213
"""
1314

1415
import base64
@@ -207,9 +208,6 @@ def __init__(self, registry: Optional[ToolRegistry] = None):
207208
self._app_id: Optional[str] = None
208209
self._app_secret: Optional[str] = None
209210
self._signing_key: Optional[str] = None
210-
self._platform_fee_bps: Optional[int] = None
211-
self._fee_account: Optional[str] = None
212-
self._referral_account: Optional[str] = None
213211
self._payer_private_key: Optional[str] = None
214212
self._rpc_url: Optional[str] = None
215213

@@ -249,9 +247,6 @@ def configure(self, config: Dict[str, Any]) -> None:
249247
self._app_id = tool_cfg.get("app_id")
250248
self._app_secret = tool_cfg.get("app_secret")
251249
self._signing_key = tool_cfg.get("signing_key")
252-
self._platform_fee_bps = tool_cfg.get("platform_fee_bps")
253-
self._fee_account = tool_cfg.get("fee_account")
254-
self._referral_account = tool_cfg.get("referral_account")
255250
self._payer_private_key = tool_cfg.get("payer_private_key")
256251
# RPC URL for sending transactions (Helius recommended for priority fees)
257252
self._rpc_url = tool_cfg.get("rpc_url")
@@ -306,10 +301,6 @@ async def execute( # pragma: no cover
306301
amount=int(amount),
307302
user_public_key=public_key,
308303
slippage_bps=slippage_bps if slippage_bps > 0 else None,
309-
platform_fee_bps=self._platform_fee_bps,
310-
platform_fee_mode="outputMint",
311-
fee_account=self._fee_account,
312-
referral_account=self._referral_account,
313304
sponsor=sponsor,
314305
)
315306

@@ -386,7 +377,6 @@ async def execute( # pragma: no cover
386377
"input_mint": order_result.input_mint,
387378
"output_mint": order_result.output_mint,
388379
"price_impact": order_result.price_impact_pct,
389-
"platform_fee": order_result.platform_fee,
390380
"execution_mode": order_result.execution_mode,
391381
"message": f"Swap successful! Signature: {signature}",
392382
}

sakit/solana_dflow_swap.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
"""
2-
DFlow Swap tool for Solana wallets.
1+
"""DFlow Swap tool for Solana wallets.
32
43
Enables fast token swaps using DFlow's Swap API with a Solana keypair.
5-
DFlow offers faster swaps compared to Jupiter Ultra with similar liquidity
6-
and supports platform fees for monetization.
4+
DFlow offers faster swaps compared to Jupiter Ultra with similar liquidity.
5+
6+
Note: Platform fees are not supported. Use Jupiter Ultra (solana_ultra) if you
7+
need to collect fees on swaps.
78
"""
89

910
import base64
@@ -77,9 +78,6 @@ def __init__(self, registry: Optional[ToolRegistry] = None):
7778
registry=registry,
7879
)
7980
self._private_key: Optional[str] = None
80-
self._platform_fee_bps: Optional[int] = None
81-
self._fee_account: Optional[str] = None
82-
self._referral_account: Optional[str] = None
8381
self._payer_private_key: Optional[str] = None
8482
self._rpc_url: Optional[str] = None
8583

@@ -113,9 +111,6 @@ def configure(self, config: Dict[str, Any]) -> None:
113111
super().configure(config)
114112
tool_cfg = config.get("tools", {}).get("solana_dflow_swap", {})
115113
self._private_key = tool_cfg.get("private_key")
116-
self._platform_fee_bps = tool_cfg.get("platform_fee_bps")
117-
self._fee_account = tool_cfg.get("fee_account")
118-
self._referral_account = tool_cfg.get("referral_account")
119114
self._payer_private_key = tool_cfg.get("payer_private_key")
120115
self._rpc_url = tool_cfg.get("rpc_url") or DEFAULT_RPC_URL
121116

@@ -150,10 +145,6 @@ async def execute(
150145
amount=amount,
151146
user_public_key=user_pubkey,
152147
slippage_bps=slippage_bps if slippage_bps > 0 else None,
153-
platform_fee_bps=self._platform_fee_bps,
154-
platform_fee_mode="outputMint",
155-
fee_account=self._fee_account,
156-
referral_account=self._referral_account,
157148
sponsor=sponsor,
158149
)
159150

@@ -191,7 +182,6 @@ async def execute(
191182
"input_mint": order_result.input_mint,
192183
"output_mint": order_result.output_mint,
193184
"price_impact": order_result.price_impact_pct,
194-
"platform_fee": order_result.platform_fee,
195185
"execution_mode": order_result.execution_mode,
196186
"message": f"Swap successful! Signature: {signature}",
197187
}

tests/test_privy_dflow_swap_tool.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ def test_configure_sets_credentials(self):
6565
"app_id": "test_app_id",
6666
"app_secret": "test_app_secret",
6767
"signing_key": "test_signing_key",
68-
"platform_fee_bps": 50,
69-
"fee_account": "FeeAccount123",
68+
"payer_private_key": "payer_key",
69+
"rpc_url": "https://custom-rpc.com",
7070
}
7171
}
7272
}
@@ -76,8 +76,8 @@ def test_configure_sets_credentials(self):
7676
assert tool._app_id == "test_app_id"
7777
assert tool._app_secret == "test_app_secret"
7878
assert tool._signing_key == "test_signing_key"
79-
assert tool._platform_fee_bps == 50
80-
assert tool._fee_account == "FeeAccount123"
79+
assert tool._payer_private_key == "payer_key"
80+
assert tool._rpc_url == "https://custom-rpc.com"
8181

8282

8383
class TestPrivyDFlowSwapToolExecute:
@@ -96,8 +96,7 @@ def configured_tool(self):
9696
"signing_key": "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg"
9797
+ "A" * 43
9898
+ "=",
99-
"platform_fee_bps": 50,
100-
"fee_account": "FeeAccount123",
99+
"rpc_url": "https://api.mainnet-beta.solana.com",
101100
}
102101
}
103102
}

tests/test_solana_dflow_swap_tool.py

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ def test_configure_sets_credentials(self):
6969
"tools": {
7070
"solana_dflow_swap": {
7171
"private_key": "test_private_key",
72-
"platform_fee_bps": 50,
73-
"fee_account": "FeeAccount123",
74-
"referral_account": "RefAccount123",
7572
"payer_private_key": "payer_key",
7673
"rpc_url": "https://custom-rpc.com",
7774
}
@@ -81,9 +78,6 @@ def test_configure_sets_credentials(self):
8178
tool.configure(config)
8279

8380
assert tool._private_key == "test_private_key"
84-
assert tool._platform_fee_bps == 50
85-
assert tool._fee_account == "FeeAccount123"
86-
assert tool._referral_account == "RefAccount123"
8781
assert tool._payer_private_key == "payer_key"
8882
assert tool._rpc_url == "https://custom-rpc.com"
8983

@@ -214,15 +208,15 @@ def test_plugin_configure(self):
214208
"tools": {
215209
"solana_dflow_swap": {
216210
"private_key": "test_private_key",
217-
"platform_fee_bps": 100,
211+
"payer_private_key": "payer_key",
218212
}
219213
}
220214
}
221215
plugin.configure(config)
222216

223217
tool = plugin.get_tools()[0]
224218
assert tool._private_key == "test_private_key"
225-
assert tool._platform_fee_bps == 100
219+
assert tool._payer_private_key == "payer_key"
226220

227221

228222
class TestSignDFlowTransaction:
@@ -469,55 +463,6 @@ async def test_execute_with_slippage_bps(self):
469463
call_kwargs = mock_dflow_instance.get_order.call_args.kwargs
470464
assert call_kwargs.get("slippage_bps") == 100
471465

472-
@pytest.mark.asyncio
473-
async def test_execute_with_platform_fees(self):
474-
"""Should pass platform fee configuration."""
475-
tool = SolanaDFlowSwapTool()
476-
tool._private_key = "5MaiiCavjCmn9Hs1o3eznqDEhRwxo7pXiAYez7keQUviUkauRiTMD8DrESdrNjN8zd9mTmVhRvBJeg5vhyvgrAhG"
477-
tool._rpc_url = "https://api.mainnet-beta.solana.com"
478-
tool._platform_fee_bps = 50
479-
tool._fee_account = "FeeAccount123"
480-
tool._referral_account = "RefAccount123"
481-
482-
with (
483-
patch("sakit.solana_dflow_swap.DFlowSwap") as MockDFlow,
484-
patch("sakit.solana_dflow_swap._sign_dflow_transaction") as mock_sign,
485-
patch.object(
486-
tool, "_send_transaction", new_callable=AsyncMock
487-
) as mock_send,
488-
):
489-
mock_dflow_instance = MagicMock()
490-
mock_order_result = MagicMock(
491-
success=True,
492-
transaction="dHJhbnNhY3Rpb24=",
493-
in_amount="1000000000",
494-
out_amount="50000000",
495-
min_out_amount="49500000",
496-
input_mint="So11111111111111111111111111111111111111112",
497-
output_mint="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
498-
price_impact_pct="0.1",
499-
platform_fee="100",
500-
execution_mode="direct",
501-
error=None,
502-
)
503-
mock_dflow_instance.get_order = AsyncMock(return_value=mock_order_result)
504-
MockDFlow.return_value = mock_dflow_instance
505-
506-
mock_sign.return_value = "c2lnbmVkX3R4"
507-
mock_send.return_value = "5abc123def456"
508-
509-
await tool.execute(
510-
input_mint="So11111111111111111111111111111111111111112",
511-
output_mint="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
512-
amount=1000000000,
513-
)
514-
515-
# Verify fee config was passed
516-
call_kwargs = mock_dflow_instance.get_order.call_args.kwargs
517-
assert call_kwargs.get("platform_fee_bps") == 50
518-
assert call_kwargs.get("fee_account") == "FeeAccount123"
519-
assert call_kwargs.get("referral_account") == "RefAccount123"
520-
521466
@pytest.mark.asyncio
522467
async def test_execute_exception_handling(self):
523468
"""Should handle exceptions gracefully."""

0 commit comments

Comments
 (0)