@onecraft/wallet 0.0.0-stage → 0.1.145
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/.claude-plugin/marketplace.json +20 -0
- package/.openclaw/AGENTS.md +100 -0
- package/.openclaw/extensions/agent-wallet/README.md +195 -0
- package/.openclaw/extensions/agent-wallet/dist/index.js +2198 -0
- package/.openclaw/extensions/agent-wallet/index.ts +2198 -0
- package/.openclaw/extensions/agent-wallet/openclaw.plugin.json +251 -0
- package/.openclaw/extensions/agent-wallet/package.json +49 -0
- package/.openclaw/extensions/agent-wallet/skills/cards/SKILL.md +211 -0
- package/.openclaw/extensions/agent-wallet/skills/wallet-operator/SKILL.md +30 -0
- package/CHANGELOG.md +1232 -0
- package/LICENSE +104 -0
- package/README.md +193 -2
- package/VERSION +1 -0
- package/agent-wallet/.env.example +63 -0
- package/agent-wallet/AGENTS.md +130 -0
- package/agent-wallet/CARD_VAULT.md +640 -0
- package/agent-wallet/README.md +615 -0
- package/agent-wallet/UPGRADE_COMPATIBILITY.md +66 -0
- package/agent-wallet/agent_wallet/__init__.py +16 -0
- package/agent-wallet/agent_wallet/approval.py +165 -0
- package/agent-wallet/agent_wallet/autonomous_permissions.py +281 -0
- package/agent-wallet/agent_wallet/autonomous_policy.py +305 -0
- package/agent-wallet/agent_wallet/autonomous_session.py +236 -0
- package/agent-wallet/agent_wallet/boot_key_migration.py +155 -0
- package/agent-wallet/agent_wallet/boot_key_recovery.py +57 -0
- package/agent-wallet/agent_wallet/bootstrap.py +194 -0
- package/agent-wallet/agent_wallet/card_catalog.py +243 -0
- package/agent-wallet/agent_wallet/card_runtime_secrets.py +108 -0
- package/agent-wallet/agent_wallet/card_vault.py +331 -0
- package/agent-wallet/agent_wallet/card_vault_cli.py +174 -0
- package/agent-wallet/agent_wallet/card_vault_import.py +65 -0
- package/agent-wallet/agent_wallet/card_vault_keychain.py +239 -0
- package/agent-wallet/agent_wallet/config.py +719 -0
- package/agent-wallet/agent_wallet/connector_cli.py +198 -0
- package/agent-wallet/agent_wallet/connectors/__init__.py +28 -0
- package/agent-wallet/agent_wallet/connectors/catalog.py +68 -0
- package/agent-wallet/agent_wallet/connectors/client.py +308 -0
- package/agent-wallet/agent_wallet/connectors/intent_policy.py +243 -0
- package/agent-wallet/agent_wallet/connectors/manifest.py +192 -0
- package/agent-wallet/agent_wallet/connectors/registry.py +341 -0
- package/agent-wallet/agent_wallet/encrypted_storage.py +314 -0
- package/agent-wallet/agent_wallet/evm_user_wallets.py +910 -0
- package/agent-wallet/agent_wallet/exceptions.py +10 -0
- package/agent-wallet/agent_wallet/file_ops.py +34 -0
- package/agent-wallet/agent_wallet/http_client.py +25 -0
- package/agent-wallet/agent_wallet/kernel_browser.py +479 -0
- package/agent-wallet/agent_wallet/kernel_cli.py +57 -0
- package/agent-wallet/agent_wallet/kernel_gateway.py +95 -0
- package/agent-wallet/agent_wallet/keystore.py +503 -0
- package/agent-wallet/agent_wallet/laso_card_vault.py +246 -0
- package/agent-wallet/agent_wallet/models.py +66 -0
- package/agent-wallet/agent_wallet/morpho_monitor.py +298 -0
- package/agent-wallet/agent_wallet/nonce_registry.py +59 -0
- package/agent-wallet/agent_wallet/openclaw_adapter.py +9129 -0
- package/agent-wallet/agent_wallet/openclaw_cli.py +658 -0
- package/agent-wallet/agent_wallet/openclaw_runtime.py +194 -0
- package/agent-wallet/agent_wallet/plugin_bundle.py +44 -0
- package/agent-wallet/agent_wallet/providers/__init__.py +1 -0
- package/agent-wallet/agent_wallet/providers/bags.py +202 -0
- package/agent-wallet/agent_wallet/providers/dexscreener.py +147 -0
- package/agent-wallet/agent_wallet/providers/evm_activity.py +257 -0
- package/agent-wallet/agent_wallet/providers/evm_portfolio.py +459 -0
- package/agent-wallet/agent_wallet/providers/imd.py +720 -0
- package/agent-wallet/agent_wallet/providers/jupiter.py +519 -0
- package/agent-wallet/agent_wallet/providers/kamino.py +404 -0
- package/agent-wallet/agent_wallet/providers/lifi.py +302 -0
- package/agent-wallet/agent_wallet/providers/solana_rpc.py +447 -0
- package/agent-wallet/agent_wallet/providers/tokenized_stocks.py +189 -0
- package/agent-wallet/agent_wallet/providers/wdk_evm_local.py +346 -0
- package/agent-wallet/agent_wallet/providers/x402.py +1972 -0
- package/agent-wallet/agent_wallet/sealed_keys.py +118 -0
- package/agent-wallet/agent_wallet/solana_stake.py +103 -0
- package/agent-wallet/agent_wallet/solana_tx.py +93 -0
- package/agent-wallet/agent_wallet/spending_limits.py +119 -0
- package/agent-wallet/agent_wallet/telemetry.py +481 -0
- package/agent-wallet/agent_wallet/transaction_policy.py +573 -0
- package/agent-wallet/agent_wallet/update_check.py +190 -0
- package/agent-wallet/agent_wallet/user_wallets.py +573 -0
- package/agent-wallet/agent_wallet/validation.py +31 -0
- package/agent-wallet/agent_wallet/vault_executor.py +456 -0
- package/agent-wallet/agent_wallet/wallet_layer/__init__.py +1 -0
- package/agent-wallet/agent_wallet/wallet_layer/base.py +1204 -0
- package/agent-wallet/agent_wallet/wallet_layer/base58.py +44 -0
- package/agent-wallet/agent_wallet/wallet_layer/factory.py +117 -0
- package/agent-wallet/agent_wallet/wallet_layer/solana.py +5246 -0
- package/agent-wallet/agent_wallet/wallet_layer/wdk_evm.py +2705 -0
- package/agent-wallet/examples/bootstrap_wallet.py +21 -0
- package/agent-wallet/examples/openclaw_runtime_onboarding.py +28 -0
- package/agent-wallet/examples/openclaw_user_wallet_example.py +31 -0
- package/agent-wallet/examples/openclaw_wallet_adapter_example.py +33 -0
- package/agent-wallet/openclaw.plugin.json +118 -0
- package/agent-wallet/pyproject.toml +36 -0
- package/agent-wallet/scripts/bootstrap_openclaw_evm.py +312 -0
- package/agent-wallet/scripts/build_release_bundle.py +210 -0
- package/agent-wallet/scripts/finalize_openclaw_local_wallet_config.py +121 -0
- package/agent-wallet/scripts/install_agent_wallet.py +1357 -0
- package/agent-wallet/scripts/install_openclaw_local_config.py +421 -0
- package/agent-wallet/scripts/install_openclaw_sealed_keys.py +117 -0
- package/agent-wallet/scripts/manage_openclaw_evm_wallet.py +333 -0
- package/agent-wallet/scripts/security_utils.py +37 -0
- package/agent-wallet/scripts/setup_evm_wallet.sh +140 -0
- package/agent-wallet/scripts/switch_openclaw_wallet_network.py +109 -0
- package/agent-wallet/skills/wallet-operator/SKILL.md +157 -0
- package/bin/lib/boot-key.mjs +184 -0
- package/bin/lib/evm-daemon.mjs +389 -0
- package/bin/lib/host-detection.mjs +259 -0
- package/bin/lib/integrations.mjs +578 -0
- package/bin/lib/release-python.mjs +9 -0
- package/bin/lib/update-transaction.mjs +235 -0
- package/bin/openclaw-agent-wallet.mjs +3354 -0
- package/claude-code/plugins/agent-wallet/.claude-plugin/plugin.json +19 -0
- package/claude-code/plugins/agent-wallet/.mcp.json +14 -0
- package/claude-code/plugins/agent-wallet/AGENTLAYER_AGENT_GUIDE.md +282 -0
- package/claude-code/plugins/agent-wallet/README.md +134 -0
- package/claude-code/plugins/agent-wallet/commands/agentlayer-autonomous-approve.md +39 -0
- package/claude-code/plugins/agent-wallet/commands/agentlayer-autonomous-revoke.md +17 -0
- package/claude-code/plugins/agent-wallet/commands/cards.md +129 -0
- package/claude-code/plugins/agent-wallet/commands/guide.md +40 -0
- package/claude-code/plugins/agent-wallet/commands/imd.md +125 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-base.md +60 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-ethereum.md +37 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-evm.md +39 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-setup.md +25 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-sol.md +51 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-statusline.md +34 -0
- package/claude-code/plugins/agent-wallet/commands/x402.md +121 -0
- package/claude-code/plugins/agent-wallet/commands/yield.md +62 -0
- package/claude-code/plugins/agent-wallet/hooks/hooks.json +16 -0
- package/claude-code/plugins/agent-wallet/scripts/bootstrap_backend.sh +136 -0
- package/claude-code/plugins/agent-wallet/scripts/enable_statusline.py +52 -0
- package/claude-code/plugins/agent-wallet/scripts/resolve_wallet_addresses.py +69 -0
- package/claude-code/plugins/agent-wallet/scripts/run_mcp.sh +66 -0
- package/claude-code/plugins/agent-wallet/scripts/wallet_statusline.py +130 -0
- package/claude-code/plugins/agent-wallet/scripts/wallet_statusline_setup.sh +40 -0
- package/claude-code/plugins/agent-wallet/skills/wallet-operator/SKILL.md +21 -0
- package/codex/plugins/agent-wallet/.codex-plugin/plugin.json +37 -0
- package/codex/plugins/agent-wallet/.mcp.json +15 -0
- package/codex/plugins/agent-wallet/README.md +158 -0
- package/codex/plugins/agent-wallet/scripts/run_mcp.sh +47 -0
- package/codex/plugins/agent-wallet/server.py +1797 -0
- package/codex/plugins/agent-wallet/skills/cards/SKILL.md +225 -0
- package/codex/plugins/agent-wallet/skills/imd/SKILL.md +145 -0
- package/codex/plugins/agent-wallet/skills/wallet-base/SKILL.md +56 -0
- package/codex/plugins/agent-wallet/skills/wallet-operator/SKILL.md +85 -0
- package/codex/plugins/agent-wallet/skills/wallet-sol/SKILL.md +29 -0
- package/codex/plugins/agent-wallet/skills/x402/SKILL.md +159 -0
- package/codex/plugins/agent-wallet/skills/yield/SKILL.md +65 -0
- package/connectors/AGENTS.md +37 -0
- package/connectors/DEVELOPER_GUIDE.md +131 -0
- package/connectors/README.md +139 -0
- package/connectors/READ_ONLY_BETA.md +54 -0
- package/connectors/RELEASING.md +48 -0
- package/connectors/conformance/README.md +31 -0
- package/connectors/conformance/package.json +54 -0
- package/connectors/conformance/scripts/sync-license.mjs +3 -0
- package/connectors/conformance/scripts/sync-spec.mjs +16 -0
- package/connectors/conformance/src/cli.ts +43 -0
- package/connectors/conformance/src/index.ts +7 -0
- package/connectors/conformance/src/runner.ts +314 -0
- package/connectors/conformance/src/types.ts +27 -0
- package/connectors/conformance/test/fixtures/invalid-response-identity.json +14 -0
- package/connectors/conformance/test/fixtures/missing-tool-fixture.json +4 -0
- package/connectors/conformance/test/runner.test.mjs +151 -0
- package/connectors/conformance/tsconfig.json +17 -0
- package/connectors/examples/reference-crypto-data/Dockerfile +21 -0
- package/connectors/examples/reference-crypto-data/README.md +51 -0
- package/connectors/examples/reference-crypto-data/conformance.json +11 -0
- package/connectors/examples/reference-crypto-data/connector.json +95 -0
- package/connectors/examples/reference-crypto-data/package.json +21 -0
- package/connectors/examples/reference-crypto-data/railway.toml +9 -0
- package/connectors/examples/reference-crypto-data/src/connector.ts +137 -0
- package/connectors/examples/reference-crypto-data/src/server.ts +13 -0
- package/connectors/examples/reference-crypto-data/test/connector.test.mjs +97 -0
- package/connectors/examples/reference-crypto-data/tsconfig.json +17 -0
- package/connectors/package-lock.json +561 -0
- package/connectors/package.json +19 -0
- package/connectors/scripts/smoke-packed-packages.mjs +121 -0
- package/connectors/sdk-typescript/README.md +47 -0
- package/connectors/sdk-typescript/package.json +49 -0
- package/connectors/sdk-typescript/scripts/sync-license.mjs +3 -0
- package/connectors/sdk-typescript/src/connector.ts +204 -0
- package/connectors/sdk-typescript/src/errors.ts +11 -0
- package/connectors/sdk-typescript/src/http.ts +116 -0
- package/connectors/sdk-typescript/src/index.ts +26 -0
- package/connectors/sdk-typescript/src/types.ts +101 -0
- package/connectors/sdk-typescript/test/sdk.test.mjs +181 -0
- package/connectors/sdk-typescript/tsconfig.json +21 -0
- package/connectors/spec/connector-manifest.schema.json +340 -0
- package/connectors/spec/connector-protocol.md +159 -0
- package/connectors/spec/transaction-intent.schema.json +281 -0
- package/connectors/templates/read-only/.env.example +1 -0
- package/connectors/templates/read-only/Dockerfile +11 -0
- package/connectors/templates/read-only/README.md +33 -0
- package/connectors/templates/read-only/conformance.json +11 -0
- package/connectors/templates/read-only/connector.json +64 -0
- package/connectors/templates/read-only/package.json +21 -0
- package/connectors/templates/read-only/railway.toml +9 -0
- package/connectors/templates/read-only/src/connector.ts +61 -0
- package/connectors/templates/read-only/src/server.ts +14 -0
- package/connectors/templates/read-only/test/connector.test.mjs +62 -0
- package/connectors/templates/read-only/tsconfig.json +17 -0
- package/cursor/plugins/agent-wallet/.cursor-plugin/plugin.json +14 -0
- package/cursor/plugins/agent-wallet/README.md +62 -0
- package/cursor/plugins/agent-wallet/mcp.json +16 -0
- package/cursor/plugins/agent-wallet/scripts/run_mcp.sh +33 -0
- package/cursor/plugins/agent-wallet/server.py +33 -0
- package/cursor/plugins/agent-wallet/skills/cards/SKILL.md +210 -0
- package/cursor/plugins/agent-wallet/skills/wallet-base/SKILL.md +56 -0
- package/cursor/plugins/agent-wallet/skills/wallet-operator/SKILL.md +23 -0
- package/cursor/plugins/agent-wallet/skills/wallet-sol/SKILL.md +29 -0
- package/cursor/plugins/agent-wallet/skills/x402/SKILL.md +130 -0
- package/hermes/plugins/agent_wallet/README.md +54 -0
- package/hermes/plugins/agent_wallet/__init__.py +55 -0
- package/hermes/plugins/agent_wallet/plugin.yaml +9 -0
- package/hermes/plugins/agent_wallet/schemas.py +211 -0
- package/hermes/plugins/agent_wallet/tools.py +622 -0
- package/install-from-github.sh +139 -0
- package/integrations/hedera/treasury-guard/README.md +92 -0
- package/integrations/hedera/treasury-guard/examples/treasury-policy.example.json +9 -0
- package/integrations/hedera/treasury-guard/package-lock.json +880 -0
- package/integrations/hedera/treasury-guard/package.json +8 -0
- package/integrations/hedera/treasury-guard/skills/onecraft-hedera-treasury/SKILL.md +22 -0
- package/integrations/hedera/treasury-guard/src/hedera-mirror-client.mjs +106 -0
- package/integrations/hedera/treasury-guard/src/hedera-signer.mjs +120 -0
- package/integrations/hedera/treasury-guard/src/treasury-cli.mjs +177 -0
- package/integrations/hedera/treasury-guard/src/treasury-policy.mjs +155 -0
- package/mcp/README.md +39 -0
- package/mcp/scripts/run_mcp.sh +37 -0
- package/mcp/server.py +33 -0
- package/package.json +106 -4
- package/scripts/check_release_version.mjs +72 -0
- package/scripts/version_targets.mjs +60 -0
- package/setup.sh +87 -0
- package/wdk-evm-wallet/.env.example +38 -0
- package/wdk-evm-wallet/README.md +254 -0
- package/wdk-evm-wallet/bootstrap.sh +8 -0
- package/wdk-evm-wallet/package-lock.json +2359 -0
- package/wdk-evm-wallet/package.json +43 -0
- package/wdk-evm-wallet/run-local.sh +12 -0
- package/wdk-evm-wallet/src/config.js +461 -0
- package/wdk-evm-wallet/src/imd.js +231 -0
- package/wdk-evm-wallet/src/json.js +35 -0
- package/wdk-evm-wallet/src/local_vault.js +407 -0
- package/wdk-evm-wallet/src/network_state.js +96 -0
- package/wdk-evm-wallet/src/pending_transactions.js +148 -0
- package/wdk-evm-wallet/src/server.js +849 -0
- package/wdk-evm-wallet/src/shutdown.js +63 -0
- package/wdk-evm-wallet/src/wdk_evm_wallet.js +10036 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wdk-evm-wallet",
|
|
3
|
+
"version": "0.1.145",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "Separate EVM wallet service built on Tether WDK.",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"bootstrap": "sh ./bootstrap.sh",
|
|
9
|
+
"start:local": "sh ./run-local.sh",
|
|
10
|
+
"start": "node src/server.js",
|
|
11
|
+
"check": "node --check src/server.js && node --check src/shutdown.js && node --check src/wdk_evm_wallet.js && node --check src/config.js && node --check src/json.js && node --check src/local_vault.js && node --check src/network_state.js && node --check src/imd.js",
|
|
12
|
+
"test:swap-runtime": "node --test --test-concurrency=1 tests/smoke_swap_runtime.mjs",
|
|
13
|
+
"test:aave-runtime": "node --test --test-concurrency=1 tests/smoke_aave_runtime.mjs",
|
|
14
|
+
"test:morpho-runtime": "node --test --test-concurrency=1 tests/smoke_morpho_runtime.mjs",
|
|
15
|
+
"test:lido-runtime": "node --test --test-concurrency=1 tests/smoke_lido_runtime.mjs",
|
|
16
|
+
"test:uniswap-runtime": "node --test --test-concurrency=1 tests/smoke_uniswap_runtime.mjs",
|
|
17
|
+
"test:unit": "node --test tests/unit_uniswap_helpers.mjs",
|
|
18
|
+
"test:identity": "node --test tests/unit_instance_identity.mjs",
|
|
19
|
+
"test:shutdown": "node --test tests/shutdown.test.mjs",
|
|
20
|
+
"test:network-config": "node --test tests/unit_network_config.mjs",
|
|
21
|
+
"test:network-state": "node --test tests/unit_network_state.mjs",
|
|
22
|
+
"test:wallet-network": "node --test tests/unit_wdk_wallet_network.mjs",
|
|
23
|
+
"test:socket-transport": "node --test tests/unit_socket_transport.mjs",
|
|
24
|
+
"test:imd": "node --test tests/unit_imd.mjs",
|
|
25
|
+
"test:morpho-rebalance": "node --test tests/unit_morpho_rebalance.mjs"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@morpho-org/morpho-sdk": "^3.2.0",
|
|
29
|
+
"@morpho-org/wdk-protocol-lending-morpho-evm": "^0.0.5",
|
|
30
|
+
"@tetherto/wdk": "^1.0.0-beta.9",
|
|
31
|
+
"@tetherto/wdk-protocol-lending-aave-evm": "^1.0.0-beta.4",
|
|
32
|
+
"@tetherto/wdk-protocol-swap-velora-evm": "^1.0.0-beta.4",
|
|
33
|
+
"@tetherto/wdk-wallet-evm": "^1.0.0-beta.12",
|
|
34
|
+
"dotenv": "^16.4.5"
|
|
35
|
+
},
|
|
36
|
+
"overrides": {
|
|
37
|
+
"axios": "1.16.1",
|
|
38
|
+
"ethers": "6.16.0",
|
|
39
|
+
"follow-redirects": "1.16.0",
|
|
40
|
+
"viem": "2.50.4",
|
|
41
|
+
"ws": "8.21.0"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
const DEFAULTS = {
|
|
7
|
+
host: "127.0.0.1",
|
|
8
|
+
port: 8081,
|
|
9
|
+
network: "sepolia",
|
|
10
|
+
unlockTimeoutSeconds: 0,
|
|
11
|
+
transport: "socket",
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
// Read this package's version once at module load. Surfaced via /health so the
|
|
15
|
+
// host autostart can detect a stale long-running daemon (old code in memory)
|
|
16
|
+
// after a release and restart it. Falls back to "0.0.0" if package.json is
|
|
17
|
+
// unreadable — a value that will simply look "stale" and trigger a restart.
|
|
18
|
+
function readPackageVersion() {
|
|
19
|
+
try {
|
|
20
|
+
const pkgUrl = new URL("../package.json", import.meta.url);
|
|
21
|
+
const pkg = JSON.parse(fs.readFileSync(pkgUrl, "utf8"));
|
|
22
|
+
const version = String(pkg.version || "").trim();
|
|
23
|
+
return version || "0.0.0";
|
|
24
|
+
} catch {
|
|
25
|
+
return "0.0.0";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const PACKAGE_VERSION = readPackageVersion();
|
|
30
|
+
const DEFAULT_PROVIDER_GATEWAY_URL = "https://agent-layer-production.up.railway.app";
|
|
31
|
+
const ENFORCED_GATEWAY_MAINNETS = new Set(["ethereum", "base", "robinhood", "arc"]);
|
|
32
|
+
|
|
33
|
+
const DEFAULT_NETWORK_PROFILES = {
|
|
34
|
+
ethereum: {
|
|
35
|
+
chainId: 1,
|
|
36
|
+
providerUrl: "https://eth.drpc.org",
|
|
37
|
+
nativeSymbol: "ETH",
|
|
38
|
+
},
|
|
39
|
+
sepolia: {
|
|
40
|
+
chainId: 11155111,
|
|
41
|
+
providerUrl: "https://sepolia.drpc.org",
|
|
42
|
+
nativeSymbol: "ETH",
|
|
43
|
+
},
|
|
44
|
+
base: {
|
|
45
|
+
chainId: 8453,
|
|
46
|
+
providerUrl: "https://mainnet.base.org",
|
|
47
|
+
nativeSymbol: "ETH",
|
|
48
|
+
},
|
|
49
|
+
"base-sepolia": {
|
|
50
|
+
chainId: 84532,
|
|
51
|
+
providerUrl: "https://sepolia.base.org",
|
|
52
|
+
nativeSymbol: "ETH",
|
|
53
|
+
},
|
|
54
|
+
robinhood: {
|
|
55
|
+
chainId: 4663,
|
|
56
|
+
providerUrl: "https://rpc.mainnet.chain.robinhood.com",
|
|
57
|
+
nativeSymbol: "ETH",
|
|
58
|
+
},
|
|
59
|
+
arc: {
|
|
60
|
+
chainId: 5042,
|
|
61
|
+
providerUrl: "https://rpc.mainnet.arc.io",
|
|
62
|
+
nativeSymbol: "USDC",
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Robinhood Chain uses the Universal Router 2.1.1 deployment. Keep this
|
|
67
|
+
// network-specific default separate from the legacy global 2.0 setting so
|
|
68
|
+
// Ethereum and Base retain their existing routers while Robinhood can quote
|
|
69
|
+
// and execute without a local environment override.
|
|
70
|
+
const DEFAULT_UNISWAP_ROUTER_VERSIONS_BY_NETWORK = { robinhood: "2.1.1" };
|
|
71
|
+
|
|
72
|
+
const SUPPORTED_GATEWAY_PROVIDERS = new Set(["auto", "shared", "alchemy"]);
|
|
73
|
+
|
|
74
|
+
function parseProviderMode(value, fallback = "public") {
|
|
75
|
+
const normalized = String(value ?? "").trim().toLowerCase();
|
|
76
|
+
if (!normalized) {
|
|
77
|
+
return fallback;
|
|
78
|
+
}
|
|
79
|
+
if (!["public", "gateway"].includes(normalized)) {
|
|
80
|
+
throw new Error("WDK_EVM_RPC_PROVIDER_MODE must be either 'public' or 'gateway'.");
|
|
81
|
+
}
|
|
82
|
+
return normalized;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function parseGatewayProvider(value, fallback = "alchemy") {
|
|
86
|
+
const normalized = String(value ?? "").trim().toLowerCase();
|
|
87
|
+
if (!normalized) {
|
|
88
|
+
return fallback;
|
|
89
|
+
}
|
|
90
|
+
if (!SUPPORTED_GATEWAY_PROVIDERS.has(normalized)) {
|
|
91
|
+
throw new Error("WDK_EVM_RPC_GATEWAY_PROVIDER must be one of: auto, shared, alchemy.");
|
|
92
|
+
}
|
|
93
|
+
return normalized;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function parseInteger(value, fallback, fieldName) {
|
|
97
|
+
const normalized = String(value ?? "").trim();
|
|
98
|
+
if (!normalized) {
|
|
99
|
+
return fallback;
|
|
100
|
+
}
|
|
101
|
+
const parsed = Number.parseInt(normalized, 10);
|
|
102
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
103
|
+
throw new Error(`${fieldName} must be a positive integer.`);
|
|
104
|
+
}
|
|
105
|
+
return parsed;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// OneCraft's LI.FI integrator fee, a fraction of fromAmount (0.0001 = 0.01%).
|
|
109
|
+
// Capped at 1% so a bad env value can never turn swaps into a large charge.
|
|
110
|
+
export const DEFAULT_LIFI_FEE = "0.0001";
|
|
111
|
+
const MAX_LIFI_FEE = 0.01;
|
|
112
|
+
|
|
113
|
+
function parseLifiFee(value) {
|
|
114
|
+
const normalized = String(value ?? "").trim() || DEFAULT_LIFI_FEE;
|
|
115
|
+
const parsed = Number(normalized);
|
|
116
|
+
if (!/^\d+(\.\d+)?$/.test(normalized) || !Number.isFinite(parsed) || parsed < 0 || parsed > MAX_LIFI_FEE) {
|
|
117
|
+
throw new Error(`LIFI_FEE must be a decimal fraction between 0 and ${MAX_LIFI_FEE}.`);
|
|
118
|
+
}
|
|
119
|
+
return normalized;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function parseNonNegativeInteger(value, fallback, fieldName) {
|
|
123
|
+
const normalized = String(value ?? "").trim();
|
|
124
|
+
if (!normalized) {
|
|
125
|
+
return fallback;
|
|
126
|
+
}
|
|
127
|
+
const parsed = Number.parseInt(normalized, 10);
|
|
128
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
129
|
+
throw new Error(`${fieldName} must be a non-negative integer.`);
|
|
130
|
+
}
|
|
131
|
+
return parsed;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function parseOptionalBigInt(value, fieldName) {
|
|
135
|
+
const normalized = String(value ?? "").trim();
|
|
136
|
+
if (!normalized) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
if (!/^[0-9]+$/.test(normalized)) {
|
|
140
|
+
throw new Error(`${fieldName} must be a base-10 integer string.`);
|
|
141
|
+
}
|
|
142
|
+
return BigInt(normalized);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function resolveOpenClawHome(env) {
|
|
146
|
+
const configured = String(env.OPENCLAW_HOME ?? "").trim();
|
|
147
|
+
if (!configured) {
|
|
148
|
+
return path.join(os.homedir(), ".openclaw");
|
|
149
|
+
}
|
|
150
|
+
if (configured === "~") {
|
|
151
|
+
return os.homedir();
|
|
152
|
+
}
|
|
153
|
+
if (configured.startsWith("~/")) {
|
|
154
|
+
return path.join(os.homedir(), configured.slice(2));
|
|
155
|
+
}
|
|
156
|
+
return configured;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function ensureLocalAuthToken(tokenPath, configuredToken = "") {
|
|
160
|
+
const direct = String(configuredToken ?? "").trim();
|
|
161
|
+
if (direct) {
|
|
162
|
+
return direct;
|
|
163
|
+
}
|
|
164
|
+
fs.mkdirSync(path.dirname(tokenPath), { recursive: true, mode: 0o700 });
|
|
165
|
+
try {
|
|
166
|
+
const existing = fs.readFileSync(tokenPath, "utf8").trim();
|
|
167
|
+
if (existing) {
|
|
168
|
+
fs.chmodSync(tokenPath, 0o600);
|
|
169
|
+
return existing;
|
|
170
|
+
}
|
|
171
|
+
} catch {
|
|
172
|
+
// Generate a new token below.
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const generated = crypto.randomBytes(32).toString("hex");
|
|
176
|
+
fs.writeFileSync(tokenPath, `${generated}\n`, {
|
|
177
|
+
encoding: "utf8",
|
|
178
|
+
mode: 0o600,
|
|
179
|
+
});
|
|
180
|
+
fs.chmodSync(tokenPath, 0o600);
|
|
181
|
+
return generated;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function ensureInstanceId(instanceIdPath, configuredInstanceId = "") {
|
|
185
|
+
const direct = String(configuredInstanceId ?? "").trim();
|
|
186
|
+
if (direct) {
|
|
187
|
+
return direct;
|
|
188
|
+
}
|
|
189
|
+
fs.mkdirSync(path.dirname(instanceIdPath), { recursive: true, mode: 0o700 });
|
|
190
|
+
try {
|
|
191
|
+
const existing = fs.readFileSync(instanceIdPath, "utf8").trim();
|
|
192
|
+
if (existing) {
|
|
193
|
+
fs.chmodSync(instanceIdPath, 0o600);
|
|
194
|
+
return existing;
|
|
195
|
+
}
|
|
196
|
+
} catch {
|
|
197
|
+
// Generate a stable install identity below.
|
|
198
|
+
}
|
|
199
|
+
const generated = crypto.randomUUID();
|
|
200
|
+
fs.writeFileSync(instanceIdPath, generated + "\n", { encoding: "utf8", mode: 0o600 });
|
|
201
|
+
fs.chmodSync(instanceIdPath, 0o600);
|
|
202
|
+
return generated;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function normalizeNetworkKey(value) {
|
|
206
|
+
const normalized = String(value ?? "").trim().toLowerCase();
|
|
207
|
+
const aliases = {
|
|
208
|
+
mainnet: "ethereum",
|
|
209
|
+
eth: "ethereum",
|
|
210
|
+
"eth-mainnet": "ethereum",
|
|
211
|
+
"base-mainnet": "base",
|
|
212
|
+
base_sepolia: "base-sepolia",
|
|
213
|
+
"robinhood-mainnet": "robinhood",
|
|
214
|
+
"arc-mainnet": "arc",
|
|
215
|
+
};
|
|
216
|
+
return aliases[normalized] || normalized;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function parseUniswapRouterVersionsByNetwork(value) {
|
|
220
|
+
const raw = String(value ?? "").trim();
|
|
221
|
+
if (!raw) {
|
|
222
|
+
return { ...DEFAULT_UNISWAP_ROUTER_VERSIONS_BY_NETWORK };
|
|
223
|
+
}
|
|
224
|
+
let parsed;
|
|
225
|
+
try {
|
|
226
|
+
parsed = JSON.parse(raw);
|
|
227
|
+
} catch {
|
|
228
|
+
throw new Error("UNISWAP_ROUTER_VERSION_BY_NETWORK must be a JSON object.");
|
|
229
|
+
}
|
|
230
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
231
|
+
throw new Error("UNISWAP_ROUTER_VERSION_BY_NETWORK must be a JSON object.");
|
|
232
|
+
}
|
|
233
|
+
const normalized = {};
|
|
234
|
+
for (const [network, version] of Object.entries(parsed)) {
|
|
235
|
+
const networkKey = normalizeNetworkKey(network);
|
|
236
|
+
if (!Object.hasOwn(DEFAULT_NETWORK_PROFILES, networkKey)) {
|
|
237
|
+
throw new Error(`UNISWAP_ROUTER_VERSION_BY_NETWORK contains unsupported network '${network}'.`);
|
|
238
|
+
}
|
|
239
|
+
const normalizedVersion = String(version ?? "").trim();
|
|
240
|
+
if (!normalizedVersion) {
|
|
241
|
+
throw new Error(`UNISWAP_ROUTER_VERSION_BY_NETWORK.${network} must be a non-empty string.`);
|
|
242
|
+
}
|
|
243
|
+
normalized[networkKey] = normalizedVersion;
|
|
244
|
+
}
|
|
245
|
+
return { ...DEFAULT_UNISWAP_ROUTER_VERSIONS_BY_NETWORK, ...normalized };
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function joinUrl(base, pathname) {
|
|
249
|
+
const normalizedBase = String(base || "").trim();
|
|
250
|
+
if (!normalizedBase) {
|
|
251
|
+
return "";
|
|
252
|
+
}
|
|
253
|
+
const url = new URL(pathname.replace(/^\//, ""), normalizedBase.endsWith("/") ? normalizedBase : `${normalizedBase}/`);
|
|
254
|
+
return url;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function buildGatewayEvmRpcUrl(baseUrl, network, provider, token) {
|
|
258
|
+
const url = joinUrl(baseUrl, `/v1/evm/rpc/${network}`);
|
|
259
|
+
if (!url) {
|
|
260
|
+
return "";
|
|
261
|
+
}
|
|
262
|
+
if (provider && provider !== "auto") {
|
|
263
|
+
url.searchParams.set("provider", provider);
|
|
264
|
+
}
|
|
265
|
+
if (String(token || "").trim()) {
|
|
266
|
+
url.searchParams.set("token", String(token).trim());
|
|
267
|
+
}
|
|
268
|
+
return url.toString();
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export function loadConfig(env = process.env) {
|
|
272
|
+
const host = String(env.HOST ?? DEFAULTS.host).trim() || DEFAULTS.host;
|
|
273
|
+
const network = normalizeNetworkKey(env.WDK_EVM_NETWORK ?? DEFAULTS.network) || DEFAULTS.network;
|
|
274
|
+
if (!Object.hasOwn(DEFAULT_NETWORK_PROFILES, network)) {
|
|
275
|
+
throw new Error(
|
|
276
|
+
"WDK_EVM_NETWORK must be one of: ethereum, sepolia, base, base-sepolia, robinhood, arc."
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const openClawHome = resolveOpenClawHome(env);
|
|
281
|
+
const dataDir =
|
|
282
|
+
String(env.WDK_EVM_DATA_DIR ?? "").trim() ||
|
|
283
|
+
path.join(openClawHome, "wdk-evm-wallet");
|
|
284
|
+
const transport = String(env.WDK_EVM_TRANSPORT ?? DEFAULTS.transport).trim().toLowerCase() || DEFAULTS.transport;
|
|
285
|
+
if (transport !== "socket" && transport !== "tcp") {
|
|
286
|
+
throw new Error('WDK_EVM_TRANSPORT must be "socket" or "tcp".');
|
|
287
|
+
}
|
|
288
|
+
const socketPath =
|
|
289
|
+
String(env.WDK_EVM_SOCKET_PATH ?? "").trim() || path.join(dataDir, "daemon.sock");
|
|
290
|
+
const authTokenPath =
|
|
291
|
+
String(env.WDK_EVM_LOCAL_TOKEN_PATH ?? "").trim() ||
|
|
292
|
+
path.join(openClawHome, "wdk-evm-wallet", "local-auth-token");
|
|
293
|
+
const instanceIdPath =
|
|
294
|
+
String(env.WDK_EVM_INSTANCE_ID_PATH ?? "").trim() || path.join(dataDir, "instance-id");
|
|
295
|
+
const providerMode = parseProviderMode(env.WDK_EVM_RPC_PROVIDER_MODE, "gateway");
|
|
296
|
+
const providerGatewayUrl =
|
|
297
|
+
String(env.PROVIDER_GATEWAY_URL ?? "").trim() || DEFAULT_PROVIDER_GATEWAY_URL;
|
|
298
|
+
const providerGatewayToken = String(env.PROVIDER_GATEWAY_BEARER_TOKEN ?? "").trim();
|
|
299
|
+
const gatewayProvider = parseGatewayProvider(env.WDK_EVM_RPC_GATEWAY_PROVIDER, "alchemy");
|
|
300
|
+
|
|
301
|
+
function resolveProviderUrl(networkKey, envValue, fallbackUrl) {
|
|
302
|
+
const direct = String(envValue ?? "").trim();
|
|
303
|
+
if (ENFORCED_GATEWAY_MAINNETS.has(networkKey)) {
|
|
304
|
+
const enforcedGatewayUrl = buildGatewayEvmRpcUrl(
|
|
305
|
+
providerGatewayUrl,
|
|
306
|
+
networkKey,
|
|
307
|
+
"alchemy",
|
|
308
|
+
providerGatewayToken
|
|
309
|
+
);
|
|
310
|
+
if (!enforcedGatewayUrl) {
|
|
311
|
+
throw new Error(
|
|
312
|
+
`PROVIDER_GATEWAY_URL is required for ${networkKey} mainnet RPC routing.`
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
return enforcedGatewayUrl;
|
|
316
|
+
}
|
|
317
|
+
if (direct) {
|
|
318
|
+
return direct;
|
|
319
|
+
}
|
|
320
|
+
if (
|
|
321
|
+
providerMode === "gateway" &&
|
|
322
|
+
providerGatewayUrl &&
|
|
323
|
+
["ethereum", "base"].includes(networkKey)
|
|
324
|
+
) {
|
|
325
|
+
return (
|
|
326
|
+
buildGatewayEvmRpcUrl(providerGatewayUrl, networkKey, gatewayProvider, providerGatewayToken) ||
|
|
327
|
+
fallbackUrl
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
return fallbackUrl;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
const networkProfiles = {
|
|
334
|
+
ethereum: {
|
|
335
|
+
...DEFAULT_NETWORK_PROFILES.ethereum,
|
|
336
|
+
providerUrl: resolveProviderUrl(
|
|
337
|
+
"ethereum",
|
|
338
|
+
env.WDK_EVM_ETHEREUM_RPC_URL,
|
|
339
|
+
DEFAULT_NETWORK_PROFILES.ethereum.providerUrl
|
|
340
|
+
),
|
|
341
|
+
},
|
|
342
|
+
sepolia: {
|
|
343
|
+
...DEFAULT_NETWORK_PROFILES.sepolia,
|
|
344
|
+
providerUrl: resolveProviderUrl(
|
|
345
|
+
"sepolia",
|
|
346
|
+
env.WDK_EVM_SEPOLIA_RPC_URL,
|
|
347
|
+
DEFAULT_NETWORK_PROFILES.sepolia.providerUrl
|
|
348
|
+
),
|
|
349
|
+
},
|
|
350
|
+
base: {
|
|
351
|
+
...DEFAULT_NETWORK_PROFILES.base,
|
|
352
|
+
providerUrl: resolveProviderUrl(
|
|
353
|
+
"base",
|
|
354
|
+
env.WDK_EVM_BASE_RPC_URL,
|
|
355
|
+
DEFAULT_NETWORK_PROFILES.base.providerUrl
|
|
356
|
+
),
|
|
357
|
+
},
|
|
358
|
+
"base-sepolia": {
|
|
359
|
+
...DEFAULT_NETWORK_PROFILES["base-sepolia"],
|
|
360
|
+
providerUrl: resolveProviderUrl(
|
|
361
|
+
"base-sepolia",
|
|
362
|
+
env.WDK_EVM_BASE_SEPOLIA_RPC_URL,
|
|
363
|
+
DEFAULT_NETWORK_PROFILES["base-sepolia"].providerUrl
|
|
364
|
+
),
|
|
365
|
+
},
|
|
366
|
+
robinhood: {
|
|
367
|
+
...DEFAULT_NETWORK_PROFILES.robinhood,
|
|
368
|
+
providerUrl: resolveProviderUrl(
|
|
369
|
+
"robinhood",
|
|
370
|
+
env.WDK_EVM_ROBINHOOD_RPC_URL,
|
|
371
|
+
DEFAULT_NETWORK_PROFILES.robinhood.providerUrl
|
|
372
|
+
),
|
|
373
|
+
},
|
|
374
|
+
arc: {
|
|
375
|
+
...DEFAULT_NETWORK_PROFILES.arc,
|
|
376
|
+
providerUrl: resolveProviderUrl(
|
|
377
|
+
"arc",
|
|
378
|
+
env.WDK_EVM_ARC_RPC_URL,
|
|
379
|
+
DEFAULT_NETWORK_PROFILES.arc.providerUrl
|
|
380
|
+
),
|
|
381
|
+
},
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
// Route Uniswap Trading API calls through the provider-gateway by default so the
|
|
385
|
+
// Uniswap key lives only in the gateway (never in a per-release wallet .env). When
|
|
386
|
+
// the base URL points at the gateway we authenticate with the gateway bearer and
|
|
387
|
+
// let the gateway inject x-api-key; an explicit non-gateway base URL falls back to
|
|
388
|
+
// the legacy direct mode (local UNISWAP_API_KEY + x-api-key).
|
|
389
|
+
const gatewayBaseTrimmed = String(providerGatewayUrl || "").replace(/\/+$/, "");
|
|
390
|
+
const uniswapTradingApiBaseUrl =
|
|
391
|
+
String(env.UNISWAP_TRADING_API_BASE_URL ?? "").trim() ||
|
|
392
|
+
(gatewayBaseTrimmed
|
|
393
|
+
? `${gatewayBaseTrimmed}/v1/evm/uniswap`
|
|
394
|
+
: "https://trade-api.gateway.uniswap.org/v1");
|
|
395
|
+
const uniswapViaGateway =
|
|
396
|
+
Boolean(gatewayBaseTrimmed) && uniswapTradingApiBaseUrl.startsWith(gatewayBaseTrimmed);
|
|
397
|
+
const uniswapLiquidityApiBaseUrl =
|
|
398
|
+
String(env.UNISWAP_LIQUIDITY_API_BASE_URL ?? "").trim() ||
|
|
399
|
+
(gatewayBaseTrimmed
|
|
400
|
+
? `${gatewayBaseTrimmed}/v1/evm/uniswap/lp`
|
|
401
|
+
: "https://liquidity.api.uniswap.org");
|
|
402
|
+
const uniswapLiquidityViaGateway =
|
|
403
|
+
Boolean(gatewayBaseTrimmed) && uniswapLiquidityApiBaseUrl.startsWith(gatewayBaseTrimmed);
|
|
404
|
+
|
|
405
|
+
return {
|
|
406
|
+
host,
|
|
407
|
+
port: parseInteger(env.PORT, DEFAULTS.port, "PORT"),
|
|
408
|
+
network,
|
|
409
|
+
openClawHome,
|
|
410
|
+
dataDir,
|
|
411
|
+
instanceId: ensureInstanceId(instanceIdPath, env.WDK_EVM_INSTANCE_ID),
|
|
412
|
+
authRequired: true,
|
|
413
|
+
authTokenPath,
|
|
414
|
+
authToken: ensureLocalAuthToken(authTokenPath, env.WDK_EVM_LOCAL_TOKEN),
|
|
415
|
+
rpcProviderMode: providerMode,
|
|
416
|
+
rpcGatewayUrl: providerGatewayUrl,
|
|
417
|
+
rpcGatewayProvider: gatewayProvider,
|
|
418
|
+
unlockTimeoutSeconds: parseNonNegativeInteger(
|
|
419
|
+
env.WDK_EVM_UNLOCK_TIMEOUT_SECONDS,
|
|
420
|
+
DEFAULTS.unlockTimeoutSeconds,
|
|
421
|
+
"WDK_EVM_UNLOCK_TIMEOUT_SECONDS"
|
|
422
|
+
),
|
|
423
|
+
transferMaxFeeWei: parseOptionalBigInt(
|
|
424
|
+
env.WDK_EVM_TRANSFER_MAX_FEE_WEI,
|
|
425
|
+
"WDK_EVM_TRANSFER_MAX_FEE_WEI"
|
|
426
|
+
),
|
|
427
|
+
morphoApiBaseUrl:
|
|
428
|
+
String(env.MORPHO_API_BASE_URL ?? "").trim() || "https://api.morpho.org/graphql",
|
|
429
|
+
lifiApiBaseUrl: String(env.LIFI_API_BASE_URL ?? "").trim() || "https://li.quest/v1",
|
|
430
|
+
lifiApiKey: String(env.LIFI_API_KEY ?? "").trim(),
|
|
431
|
+
lifiIntegrator: String(env.LIFI_INTEGRATOR ?? "").trim() || "agentlayer",
|
|
432
|
+
lifiFee: parseLifiFee(env.LIFI_FEE),
|
|
433
|
+
lifiDefaultDenyBridges: String(env.LIFI_DEFAULT_DENY_BRIDGES ?? "").trim() || "mayan",
|
|
434
|
+
lidoApiBaseUrl: String(env.LIDO_API_BASE_URL ?? "").trim() || "https://eth-api.lido.fi/v1",
|
|
435
|
+
lidoReferralAddress: String(env.LIDO_REFERRAL_ADDRESS ?? "").trim(),
|
|
436
|
+
uniswapTradingApiBaseUrl,
|
|
437
|
+
uniswapViaGateway,
|
|
438
|
+
uniswapLiquidityApiBaseUrl,
|
|
439
|
+
uniswapLiquidityViaGateway,
|
|
440
|
+
providerGatewayToken,
|
|
441
|
+
uniswapApiKey: String(env.UNISWAP_API_KEY ?? "").trim(),
|
|
442
|
+
uniswapRouterVersion: String(env.UNISWAP_ROUTER_VERSION ?? "").trim() || "2.0",
|
|
443
|
+
uniswapRouterVersionsByNetwork: parseUniswapRouterVersionsByNetwork(
|
|
444
|
+
env.UNISWAP_ROUTER_VERSION_BY_NETWORK
|
|
445
|
+
),
|
|
446
|
+
// 300 bps (3%) default mirrors the Solana swap-intent floor. Active markets
|
|
447
|
+
// (Base re-prices every block) drift during the multi-step preview -> approval
|
|
448
|
+
// -> execute window; a 0.5% floor rejected ordinary drift. The quote
|
|
449
|
+
// fingerprint binds only the swap intent, so this floor — not an exact-output
|
|
450
|
+
// pin — is the real slippage guard. Override per-call or via env for tight swaps.
|
|
451
|
+
uniswapDefaultSlippageBps: parseInteger(
|
|
452
|
+
env.UNISWAP_DEFAULT_SLIPPAGE_BPS,
|
|
453
|
+
300,
|
|
454
|
+
"UNISWAP_DEFAULT_SLIPPAGE_BPS"
|
|
455
|
+
),
|
|
456
|
+
version: PACKAGE_VERSION,
|
|
457
|
+
networkProfiles,
|
|
458
|
+
transport,
|
|
459
|
+
socketPath,
|
|
460
|
+
};
|
|
461
|
+
}
|