@lombard.finance/sdk-agent 0.1.0 → 0.2.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/tools.cjs CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";const i=require("@lombard.finance/sdk"),m=require("viem"),w=require("viem/chains"),d=require("zod"),pt=require("zod-to-json-schema");function ut(){return{...i.getLbtcContractAddresses(i.Env.testnet),...i.getLbtcContractAddresses(i.Env.prod)}}const C=[{symbol:"LBTC",aliases:["Lombard BTC","Lombard staked Bitcoin","lbtc"],name:"Lombard BTC",description:"Yield-bearing receipt token for native BTC staked via Babylon. 1 LBTC is always worth slightly more than 1 BTC and grows over time as Babylon yield accrues. The exchange rate is never 1:1 — always fetch with get_exchange_rate.",isLombardIssued:!0,isYieldBearing:!0,decimals:8,addresses:ut()},{symbol:"BTC.b",aliases:["BTCb","BTC dot b","btc.b","Lombard cross-chain BTC"],name:"BTC.b",description:"Lombard's cross-chain wrapped Bitcoin token. Bridged BTC, NOT yield-bearing. Use BTC.b when the user wants wrapped BTC on an EVM chain without yield exposure.",isLombardIssued:!0,isYieldBearing:!1,decimals:8,addresses:{},notes:"Per-chain BTC.b contract addresses are resolved on demand via the SDK's getTokenContractInfo(Token.BTCb, chainId, env). Call get_token_info with chainId+address for verification."},{symbol:"BTCe",aliases:["Bitcoin Earn token","Bitcoin Earn vault share","BTCE","btce"],name:"Bitcoin Earn vault share (BTCe)",description:"ERC4626 wrapper share token for the Bitcoin Earn vault. Holding BTCe is how users participate in Bitcoin Earn yield; deposits via prepare_deploy_to_vault mint BTCe, withdrawals via prepare_vault_withdrawal burn it.",isLombardIssued:!0,isYieldBearing:!0,decimals:8,addresses:{...i.BTCE_VAULT_CONTRACTS},notes:"BTCe wraps the underlying Veda share (LBTCv) 1:1 today; convertToAssets() is the authoritative conversion if the ratio ever changes."}];function se(t){if(!t)return;const e=t.trim().toLowerCase();for(const a of C)if(a.symbol.toLowerCase()===e||a.aliases.some(s=>s.toLowerCase()===e))return a}function re(t,e){if(!e)return;const a=e.toLowerCase();for(const s of C){const r=s.addresses[t];if(r&&r.toLowerCase()===a)return s}}function oe(){return["# Lombard asset glossary","","These are the canonical Lombard-related assets. Use these names verbatim. If a user asks about an asset not listed here, call get_token_info to look it up before saying you don't know.","",...C.map(e=>{const a=[e.isLombardIssued?"Lombard-issued":"third-party",e.isYieldBearing?"yield-bearing":"not yield-bearing"].join(", ");return`- **${e.symbol}** (${e.name}; ${a}; ${e.decimals} decimals) — ${e.description}`})].join(`
2
- `)}const ht=oe(),Y={[w.mainnet.id]:{chain:w.mainnet,chainId:i.ChainId.ethereum,env:i.Env.prod,name:"Ethereum"},[w.sepolia.id]:{chain:w.sepolia,chainId:i.ChainId.sepolia,env:i.Env.testnet,name:"Sepolia"},[w.base.id]:{chain:w.base,chainId:i.ChainId.base,env:i.Env.prod,name:"Base"},[w.baseSepolia.id]:{chain:w.baseSepolia,chainId:i.ChainId.baseSepoliaTestnet,env:i.Env.testnet,name:"Base Sepolia"}};function u(t){const e=Y[t];if(!e){const a=Object.keys(Y).join(", ");throw new Error(`Unsupported chain ID: ${t}. Supported: ${a}`)}return e}const b=d.z.string().regex(/^0x[a-fA-F0-9]{40}$/,"Invalid EVM address"),g=d.z.string().regex(/^\d+(\.\d+)?$/,"Must be a numeric string").refine(t=>parseFloat(t)>0&&parseFloat(t)<1e3,"Amount must be positive and under 1000"),ne="Chain ID. Default to the user's connected chain (provided in your wallet context) unless they specify a different one. Supported: 1=Ethereum, 11155111=Sepolia, 8453=Base, 84532=Base Sepolia.",y=d.z.number().describe(ne),h=d.z.object({address:b.describe("EVM wallet address (0x...)"),chainId:y}),k=d.z.object({chainId:d.z.number().optional().describe("Chain ID for environment resolution (optional)")}),S=d.z.object({amount:g.describe("Amount of BTC.b to stake (e.g. '0.1')"),chainId:y}),_=d.z.object({amount:g.describe("Amount of LBTC to unstake"),outputAsset:d.z.enum(["BTC","BTCb"]).describe("Output: BTC (cross-chain) or BTCb (same chain)"),recipient:d.z.string().optional().describe("Destination address (required for BTC output)"),chainId:y}),I=h,L=d.z.object({chainId:d.z.number().optional().describe("Chain ID to filter strategies (optional, returns all if omitted)")}),E=h,M=d.z.object({amount:g.describe("Amount of LBTC to deploy"),chainId:y}),G=d.z.object({}),$=d.z.object({amount:g.describe("Amount of vault shares to withdraw"),address:b.describe("EVM wallet address requesting the withdrawal. Used to check for an existing active withdrawal (only one is allowed per user per vault)."),chainId:y}),x=d.z.object({depositTxHash:d.z.string().min(1).describe("The BTC deposit transaction hash to claim"),address:b.describe("EVM wallet address that owns the deposit"),chainId:y}),D=d.z.object({amount:g.describe("Amount of BTC.b to redeem for native BTC"),recipient:d.z.string().describe("Bitcoin destination address for the redeemed BTC. MUST be a valid Bitcoin address for the network (bc1.../1.../3... mainnet; tb1.../m.../n.../2... testnet). Ask the user for this explicitly — never infer from prior context."),chainId:y}),K=d.z.object({query:d.z.string().optional().describe("Free-text token name or symbol (e.g. 'BTCe', 'LBTC', 'Bitcoin Earn vault share')."),address:d.z.string().optional().describe("Optional contract address (0x...). When provided, chainId is required too."),chainId:d.z.number().optional().describe("Chain ID for an address-based lookup.")}),W=d.z.object({address:b.describe("EVM wallet address that owns the active withdrawal being cancelled."),chainId:y}),mt=d.z.object({address:b.describe("EVM wallet address (0x...)")}),R=d.z.object({category:d.z.string().optional().describe("Filter by category: automated-strategy, borrow-stables, looping, dex-lp, other"),chain:d.z.string().optional().describe("Filter by chain (e.g. Ethereum, Base, Solana)"),protocol:d.z.string().optional().describe("Filter by protocol (e.g. Morpho, Aave, Uniswap)")}),P=d.z.object({tokenAddress:b.describe("ERC-20 token contract address (0x...). Get this from tool results like get_morpho_lbtc_markets, not from memory."),address:b.describe("EVM wallet address to check balance for"),chainId:y}),J=d.z.object({}),V=d.z.string().regex(/^0x[a-fA-F0-9]{64}$/,"Invalid Morpho market ID (must be 0x + 64 hex chars)").describe("Morpho Blue market ID (from get_morpho_lbtc_markets)"),U=d.z.object({marketId:V,amount:g.describe("Amount of LBTC to supply as collateral (e.g. '0.1')"),address:b.describe("EVM wallet address supplying the collateral")}),N=d.z.object({marketId:V,amount:g.describe("Amount of loan asset to borrow (e.g. '100' for 100 USDC)"),address:b.describe("EVM wallet address borrowing the asset")}),F=d.z.object({marketId:V,amount:g.describe("Amount of loan asset to repay (e.g. '1' for 1 USDC)"),address:b.describe("EVM wallet address repaying the debt")}),z=d.z.object({marketId:V,address:b.describe("EVM wallet address to check position for")});function p(t){return pt.zodToJsonSchema(t,{target:"openAi"})}const bt=p(W);p(mt);const B=p(h),ie=p(k),ce=p(S),de=p(_),le=p(I),pe=p(L),ue=p(E),he=p(M),me=p(G),be=p($),fe=p(x),ye=p(R),ge=p(P),Be=p(K),we=p(D),Te=p(J),ve=p(U),Ce=p(N),Ae=p(F),ke=p(z),ft=new Set([11155111,84532]),yt=/^(bc1[a-z0-9]{39,87}|[13][a-km-zA-HJ-NP-Z1-9]{25,34})$/,gt=/^(tb1[a-z0-9]{39,87}|[mn2][a-km-zA-HJ-NP-Z1-9]{25,34})$/;function Se(t,e){if(typeof t!="string")return!1;const a=t.trim();return a.length===0?!1:ft.has(e)?gt.test(a):yt.test(a)}function Z(t){if(typeof t!="string"||!/^\d+(\.\d+)?$/.test(t))return!1;const e=Number(t);return Number.isFinite(e)&&e>0}function Bt(t){const e=[],a=[];if(Z(t.amount)?Number(t.amount)<i.MIN_REDEEM_AMOUNT_BTC&&a.push(`amount ${t.amount} is below the protocol minimum of ${i.MIN_REDEEM_AMOUNT_BTC} LBTC. Network fees may push the practical minimum higher; ask the user to confirm a value at or above ${i.MIN_REDEEM_AMOUNT_BTC}.`):a.push("amount must be a positive numeric string (e.g. '0.5')"),t.outputAsset!=="BTC"&&t.outputAsset!=="BTCb"&&a.push("outputAsset must be either 'BTC' or 'BTCb'"),t.outputAsset==="BTC"&&(typeof t.recipient!="string"||t.recipient.length===0?e.push("recipient"):Se(t.recipient,t.chainId)||a.push("recipient is not a valid Bitcoin address for this network. Mainnet: bc1.../1.../3...; Sepolia/testnet: tb1.../m.../n.../2...")),e.length===0&&a.length===0)return{valid:!0};const s=[];return e.length>0&&s.push(`Ask the user for: ${e.join(", ")}. Do not infer these values from prior context.`),a.length>0&&s.push("Surface the listed errors to the user and re-prompt; do not retry the tool with the same arguments."),{valid:!1,missing:e,errors:a,note:s.join(" ")}}function wt(t){const e=[];return Z(t.amount)?Number(t.amount)<i.MIN_STAKE_AMOUNT_BTC&&e.push(`amount ${t.amount} is below the protocol minimum of ${i.MIN_STAKE_AMOUNT_BTC} BTC.`):e.push("amount must be a positive numeric string (e.g. '0.5')"),e.length===0?{valid:!0}:{valid:!1,missing:[],errors:e,note:"Surface the listed errors to the user and re-prompt; do not retry the tool with the same arguments."}}function Tt(t){const e=[],a=[];if(Z(t.amount)?Number(t.amount)<i.MIN_REDEEM_AMOUNT_BTC&&a.push(`amount ${t.amount} is below the protocol minimum of ${i.MIN_REDEEM_AMOUNT_BTC} BTC. Network fees may push the practical minimum higher.`):a.push("amount must be a positive numeric string (e.g. '0.001')"),typeof t.recipient!="string"||t.recipient.length===0?e.push("recipient"):Se(t.recipient,t.chainId)||a.push("recipient is not a valid Bitcoin address for this network. Mainnet: bc1.../1.../3...; Sepolia/testnet: tb1.../m.../n.../2..."),e.length===0&&a.length===0)return{valid:!0};const s=[];return e.length>0&&s.push(`Ask the user for: ${e.join(", ")}. Do not infer these values from prior context.`),a.length>0&&s.push("Surface the listed errors to the user and re-prompt; do not retry the tool with the same arguments."),{valid:!1,missing:e,errors:a,note:s.join(" ")}}function _e(t){return Z(t.amount)?{valid:!0}:{valid:!1,missing:[],errors:["amount must be a positive numeric string (e.g. '0.5')"],note:"Surface the listed errors to the user and re-prompt; do not retry the tool with the same arguments."}}function vt(t,e){const a=(e==null?void 0:e.mainnet)??process.env.LOMBARD_PARTNER_ID??"lombardtest1",s=(e==null?void 0:e.testnet)??process.env.LOMBARD_TESTNET_PARTNER_ID??"test1";return t===i.Env.testnet?s:a}const T="0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",O=i.getLbtcContractAddresses(i.Env.prod)[i.ChainId.ethereum],Ct="https://api.morpho.org/graphql",At=1e4,X={name:"marketParams",type:"tuple",components:[{name:"loanToken",type:"address"},{name:"collateralToken",type:"address"},{name:"oracle",type:"address"},{name:"irm",type:"address"},{name:"lltv",type:"uint256"}]},kt=[{name:"supplyCollateral",type:"function",stateMutability:"nonpayable",inputs:[X,{name:"assets",type:"uint256"},{name:"onBehalf",type:"address"},{name:"data",type:"bytes"}],outputs:[]}],St=[{name:"borrow",type:"function",stateMutability:"nonpayable",inputs:[X,{name:"assets",type:"uint256"},{name:"shares",type:"uint256"},{name:"onBehalf",type:"address"},{name:"receiver",type:"address"}],outputs:[{name:"assetsBorrowed",type:"uint256"},{name:"sharesBorrowed",type:"uint256"}]}],ae=[{name:"position",type:"function",stateMutability:"view",inputs:[{name:"id",type:"bytes32"},{name:"user",type:"address"}],outputs:[{name:"supplyShares",type:"uint256"},{name:"borrowShares",type:"uint128"},{name:"collateral",type:"uint128"}]},{name:"market",type:"function",stateMutability:"view",inputs:[{name:"id",type:"bytes32"}],outputs:[{name:"totalSupplyAssets",type:"uint128"},{name:"totalSupplyShares",type:"uint128"},{name:"totalBorrowAssets",type:"uint128"},{name:"totalBorrowShares",type:"uint128"},{name:"lastUpdate",type:"uint128"},{name:"fee",type:"uint128"}]}],_t=[{name:"repay",type:"function",stateMutability:"nonpayable",inputs:[X,{name:"assets",type:"uint256"},{name:"shares",type:"uint256"},{name:"onBehalf",type:"address"},{name:"data",type:"bytes"}],outputs:[{name:"assetsRepaid",type:"uint256"},{name:"sharesRepaid",type:"uint256"}]}],It=[{name:"price",type:"function",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint256"}]}],Lt=10n**36n,Et=10n**18n,Mt=.8;function $t({collateralRaw:t,borrowAssetsRaw:e,oraclePrice:a,lltvRaw:s}){const r=Number(m.formatUnits(s,18));if(t===0n)return{currentLtv:0,lltv:r,healthStatus:e>0n?"Bad debt":"Empty"};if(e===0n)return{currentLtv:0,lltv:r,healthStatus:"Collateral only (no borrows)"};if(a===0n)return{currentLtv:0,lltv:r,healthStatus:"Unknown (oracle unavailable)"};const o=t*a/Lt,n=e*Et/o,c=Number(m.formatUnits(n,18)),l=r*Mt;let f;return c<l?f="Healthy":c<r?f="At risk":f="Liquidatable",{currentLtv:c,lltv:r,healthStatus:f}}const xt=`{
1
+ "use strict";const i=require("@lombard.finance/sdk"),m=require("viem"),w=require("viem/chains"),d=require("zod"),Bt=require("zod-to-json-schema");function Tt(){return{...i.getLbtcContractAddresses(i.Env.testnet),...i.getLbtcContractAddresses(i.Env.prod)}}const C=[{symbol:"LBTC",aliases:["Lombard BTC","Lombard staked Bitcoin","lbtc"],name:"Lombard BTC",description:"Yield-bearing receipt token for native BTC staked via Babylon. 1 LBTC is always worth slightly more than 1 BTC and grows over time as Babylon yield accrues. The exchange rate is never 1:1 — always fetch with get_exchange_rate.",isLombardIssued:!0,isYieldBearing:!0,decimals:8,addresses:Tt()},{symbol:"BTC.b",aliases:["BTCb","BTC dot b","btc.b","Lombard cross-chain BTC"],name:"BTC.b",description:"Lombard's cross-chain wrapped Bitcoin token. Bridged BTC, NOT yield-bearing. Use BTC.b when the user wants wrapped BTC on an EVM chain without yield exposure.",isLombardIssued:!0,isYieldBearing:!1,decimals:8,addresses:{},notes:"Per-chain BTC.b contract addresses are resolved on demand via the SDK's getTokenContractInfo(Token.BTCb, chainId, env). Call get_token_info with chainId+address for verification."},{symbol:"BTCe",aliases:["Bitcoin Earn token","Bitcoin Earn vault share","BTCE","btce"],name:"Bitcoin Earn vault share (BTCe)",description:"ERC4626 wrapper share token for the Bitcoin Earn vault. Holding BTCe is how users participate in Bitcoin Earn yield; deposits via prepare_deploy_to_vault mint BTCe, withdrawals via prepare_vault_withdrawal burn it.",isLombardIssued:!0,isYieldBearing:!0,decimals:8,addresses:{...i.BTCE_VAULT_CONTRACTS},notes:"BTCe wraps the underlying Veda share (LBTCv) 1:1 today; convertToAssets() is the authoritative conversion if the ratio ever changes."}];function oe(t){if(!t)return;const e=t.trim().toLowerCase();for(const a of C)if(a.symbol.toLowerCase()===e||a.aliases.some(s=>s.toLowerCase()===e))return a}function ne(t,e){if(!e)return;const a=e.toLowerCase();for(const s of C){const o=s.addresses[t];if(o&&o.toLowerCase()===a)return s}}function ie(){return["# Lombard asset glossary","","These are the canonical Lombard-related assets. Use these names verbatim. If a user asks about an asset not listed here, call get_token_info to look it up before saying you don't know.","",...C.map(e=>{const a=[e.isLombardIssued?"Lombard-issued":"third-party",e.isYieldBearing?"yield-bearing":"not yield-bearing"].join(", ");return`- **${e.symbol}** (${e.name}; ${a}; ${e.decimals} decimals) — ${e.description}`})].join(`
2
+ `)}const wt=ie(),G={[w.mainnet.id]:{chain:w.mainnet,chainId:i.ChainId.ethereum,env:i.Env.prod,name:"Ethereum"},[w.sepolia.id]:{chain:w.sepolia,chainId:i.ChainId.sepolia,env:i.Env.testnet,name:"Sepolia"},[w.base.id]:{chain:w.base,chainId:i.ChainId.base,env:i.Env.prod,name:"Base"},[w.baseSepolia.id]:{chain:w.baseSepolia,chainId:i.ChainId.baseSepoliaTestnet,env:i.Env.testnet,name:"Base Sepolia"}};function p(t){const e=G[t];if(!e){const a=Object.keys(G).join(", ");throw new Error(`Unsupported chain ID: ${t}. Supported: ${a}`)}return e}const b=d.z.string().regex(/^0x[a-fA-F0-9]{40}$/,"Invalid EVM address"),B=d.z.string().regex(/^\d+(\.\d+)?$/,"Must be a numeric string").refine(t=>parseFloat(t)>0&&parseFloat(t)<1e3,"Amount must be positive and under 1000"),ce="Chain ID. Default to the user's connected chain (provided in your wallet context) unless they specify a different one. Supported: 1=Ethereum, 11155111=Sepolia, 8453=Base, 84532=Base Sepolia.",g=d.z.number().describe(ce),h=d.z.object({address:b.describe("EVM wallet address (0x...)"),chainId:g}),S=d.z.object({chainId:d.z.number().optional().describe("Chain ID for environment resolution (optional)")}),L=d.z.object({amount:B.describe("Amount of BTC.b to stake (e.g. '0.1')"),chainId:g}),I=d.z.object({amount:B.describe("Amount of LBTC to convert to native BTC"),recipient:d.z.string().describe("Bitcoin destination address. MUST be a valid Bitcoin address for the network (bc1.../1.../3... mainnet; tb1.../m.../n.../2... testnet). Ask the user for this explicitly, never infer from prior context."),chainId:g}),E=d.z.object({amount:B.describe("Amount of LBTC to convert to BTC.b on the same chain"),chainId:g}),x=h,M=d.z.object({chainId:d.z.number().optional().describe("Chain ID to filter strategies (optional, returns all if omitted)")}),$=h,P=d.z.object({amount:B.describe("Amount of LBTC to deploy"),chainId:g}),J=d.z.object({}),D=d.z.object({amount:B.describe("Amount of vault shares to withdraw"),address:b.describe("EVM wallet address requesting the withdrawal. Used to check for an existing active withdrawal (only one is allowed per user per vault)."),chainId:g}),R=d.z.object({depositTxHash:d.z.string().min(1).describe("The BTC deposit transaction hash to claim"),address:b.describe("EVM wallet address that owns the deposit"),chainId:g}),N=d.z.object({amount:B.describe("Amount of BTC.b to redeem for native BTC"),recipient:d.z.string().describe("Bitcoin destination address for the redeemed BTC. MUST be a valid Bitcoin address for the network (bc1.../1.../3... mainnet; tb1.../m.../n.../2... testnet). Ask the user for this explicitly — never infer from prior context."),chainId:g}),X=d.z.object({query:d.z.string().optional().describe("Free-text token name or symbol (e.g. 'BTCe', 'LBTC', 'Bitcoin Earn vault share')."),address:d.z.string().optional().describe("Optional contract address (0x...). When provided, chainId is required too."),chainId:d.z.number().optional().describe("Chain ID for an address-based lookup.")}),K=d.z.object({address:b.describe("EVM wallet address that owns the active withdrawal being cancelled."),chainId:g}),A=d.z.object({address:b.describe("EVM wallet address (0x...)")}),F=d.z.object({category:d.z.string().optional().describe("Filter by category: automated-strategy, borrow-stables, looping, dex-lp, other"),chain:d.z.string().optional().describe("Filter by chain (e.g. Ethereum, Base, Solana)"),protocol:d.z.string().optional().describe("Filter by protocol (e.g. Morpho, Aave, Uniswap)")}),U=d.z.object({tokenAddress:b.describe("ERC-20 token contract address (0x...). Get this from tool results like get_morpho_lbtc_markets, not from memory."),address:b.describe("EVM wallet address to check balance for"),chainId:g}),Q=d.z.object({}),j=d.z.string().regex(/^0x[a-fA-F0-9]{64}$/,"Invalid Morpho market ID (must be 0x + 64 hex chars)").describe("Morpho Blue market ID (from get_morpho_lbtc_markets)"),z=d.z.object({marketId:j,amount:B.describe("Amount of LBTC to supply as collateral (e.g. '0.1')"),address:b.describe("EVM wallet address supplying the collateral")}),O=d.z.object({marketId:j,amount:B.describe("Amount of loan asset to borrow (e.g. '100' for 100 USDC)"),address:b.describe("EVM wallet address borrowing the asset")}),q=d.z.object({marketId:j,amount:B.describe("Amount of loan asset to repay (e.g. '1' for 1 USDC)"),address:b.describe("EVM wallet address repaying the debt")}),V=d.z.object({marketId:j,address:b.describe("EVM wallet address to check position for")});function u(t){return Bt.zodToJsonSchema(t,{target:"openAi"})}const vt=u(K),de=u(A),T=u(h),le=u(S),pe=u(L),ue=u(I),he=u(E),me=u(x),be=u(M),fe=u($),ge=u(P),ye=u(J),Be=u(D),Te=u(R),we=u(F),ve=u(U),Ae=u(X),Ce=u(N),ke=u(Q),_e=u(z),Se=u(O),Le=u(q),Ie=u(V),At=new Set([11155111,84532]),Ct=/^(bc1[a-z0-9]{39,87}|[13][a-km-zA-HJ-NP-Z1-9]{25,34})$/,kt=/^(tb1[a-z0-9]{39,87}|[mn2][a-km-zA-HJ-NP-Z1-9]{25,34})$/;function Ee(t,e){if(typeof t!="string")return!1;const a=t.trim();return a.length===0?!1:At.has(e)?kt.test(a):Ct.test(a)}function k(t){if(typeof t!="string"||!/^\d+(\.\d+)?$/.test(t))return!1;const e=Number(t);return Number.isFinite(e)&&e>0}function _t(t){const e=[],a=[];if(k(t.amount)?Number(t.amount)<i.MIN_REDEEM_AMOUNT_BTC&&a.push(`amount ${t.amount} is below the protocol minimum of ${i.MIN_REDEEM_AMOUNT_BTC} LBTC. Network fees may push the practical minimum higher; ask the user to confirm a value at or above ${i.MIN_REDEEM_AMOUNT_BTC}.`):a.push("amount must be a positive numeric string (e.g. '0.5')"),typeof t.recipient!="string"||t.recipient.length===0?e.push("recipient"):Ee(t.recipient,t.chainId)||a.push("recipient is not a valid Bitcoin address for this network. Mainnet: bc1.../1.../3...; Sepolia/testnet: tb1.../m.../n.../2..."),e.length===0&&a.length===0)return{valid:!0};const s=[];return e.length>0&&s.push(`Ask the user for: ${e.join(", ")}. Do not infer these values from prior context.`),a.length>0&&s.push("Surface the listed errors to the user and re-prompt; do not retry the tool with the same arguments."),{valid:!1,missing:e,errors:a,note:s.join(" ")}}function St(t){const e=[];return k(t.amount)?Number(t.amount)<i.MIN_REDEEM_AMOUNT_BTC&&e.push(`amount ${t.amount} is below the protocol minimum of ${i.MIN_REDEEM_AMOUNT_BTC} LBTC.`):e.push("amount must be a positive numeric string (e.g. '0.5')"),e.length===0?{valid:!0}:{valid:!1,missing:[],errors:e,note:"Surface the listed errors to the user and re-prompt; do not retry the tool with the same arguments."}}function Lt(t){const e=[];return k(t.amount)?Number(t.amount)<i.MIN_STAKE_AMOUNT_BTC&&e.push(`amount ${t.amount} is below the protocol minimum of ${i.MIN_STAKE_AMOUNT_BTC} BTC.`):e.push("amount must be a positive numeric string (e.g. '0.5')"),e.length===0?{valid:!0}:{valid:!1,missing:[],errors:e,note:"Surface the listed errors to the user and re-prompt; do not retry the tool with the same arguments."}}function It(t){const e=[],a=[];if(k(t.amount)?Number(t.amount)<i.MIN_REDEEM_AMOUNT_BTC&&a.push(`amount ${t.amount} is below the protocol minimum of ${i.MIN_REDEEM_AMOUNT_BTC} BTC. Network fees may push the practical minimum higher.`):a.push("amount must be a positive numeric string (e.g. '0.001')"),typeof t.recipient!="string"||t.recipient.length===0?e.push("recipient"):Ee(t.recipient,t.chainId)||a.push("recipient is not a valid Bitcoin address for this network. Mainnet: bc1.../1.../3...; Sepolia/testnet: tb1.../m.../n.../2..."),e.length===0&&a.length===0)return{valid:!0};const s=[];return e.length>0&&s.push(`Ask the user for: ${e.join(", ")}. Do not infer these values from prior context.`),a.length>0&&s.push("Surface the listed errors to the user and re-prompt; do not retry the tool with the same arguments."),{valid:!1,missing:e,errors:a,note:s.join(" ")}}function xe(t){return k(t.amount)?{valid:!0}:{valid:!1,missing:[],errors:["amount must be a positive numeric string (e.g. '0.5')"],note:"Surface the listed errors to the user and re-prompt; do not retry the tool with the same arguments."}}function Et(t,e){const a=(e==null?void 0:e.mainnet)??process.env.LOMBARD_PARTNER_ID??"lombardtest1",s=(e==null?void 0:e.testnet)??process.env.LOMBARD_TESTNET_PARTNER_ID??"test1";return t===i.Env.testnet?s:a}const v="0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",Z=i.getLbtcContractAddresses(i.Env.prod)[i.ChainId.ethereum],xt="https://api.morpho.org/graphql",Mt=1e4,ee={name:"marketParams",type:"tuple",components:[{name:"loanToken",type:"address"},{name:"collateralToken",type:"address"},{name:"oracle",type:"address"},{name:"irm",type:"address"},{name:"lltv",type:"uint256"}]},$t=[{name:"supplyCollateral",type:"function",stateMutability:"nonpayable",inputs:[ee,{name:"assets",type:"uint256"},{name:"onBehalf",type:"address"},{name:"data",type:"bytes"}],outputs:[]}],Pt=[{name:"borrow",type:"function",stateMutability:"nonpayable",inputs:[ee,{name:"assets",type:"uint256"},{name:"shares",type:"uint256"},{name:"onBehalf",type:"address"},{name:"receiver",type:"address"}],outputs:[{name:"assetsBorrowed",type:"uint256"},{name:"sharesBorrowed",type:"uint256"}]}],re=[{name:"position",type:"function",stateMutability:"view",inputs:[{name:"id",type:"bytes32"},{name:"user",type:"address"}],outputs:[{name:"supplyShares",type:"uint256"},{name:"borrowShares",type:"uint128"},{name:"collateral",type:"uint128"}]},{name:"market",type:"function",stateMutability:"view",inputs:[{name:"id",type:"bytes32"}],outputs:[{name:"totalSupplyAssets",type:"uint128"},{name:"totalSupplyShares",type:"uint128"},{name:"totalBorrowAssets",type:"uint128"},{name:"totalBorrowShares",type:"uint128"},{name:"lastUpdate",type:"uint128"},{name:"fee",type:"uint128"}]}],Dt=[{name:"repay",type:"function",stateMutability:"nonpayable",inputs:[ee,{name:"assets",type:"uint256"},{name:"shares",type:"uint256"},{name:"onBehalf",type:"address"},{name:"data",type:"bytes"}],outputs:[{name:"assetsRepaid",type:"uint256"},{name:"sharesRepaid",type:"uint256"}]}],Rt=[{name:"price",type:"function",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint256"}]}],Nt=10n**36n,Ft=10n**18n,Ut=.8;function zt({collateralRaw:t,borrowAssetsRaw:e,oraclePrice:a,lltvRaw:s}){const o=Number(m.formatUnits(s,18));if(t===0n)return{currentLtv:0,lltv:o,healthStatus:e>0n?"Bad debt":"Empty"};if(e===0n)return{currentLtv:0,lltv:o,healthStatus:"Collateral only (no borrows)"};if(a===0n)return{currentLtv:0,lltv:o,healthStatus:"Unknown (oracle unavailable)"};const r=t*a/Nt,n=e*Ft/r,c=Number(m.formatUnits(n,18)),l=o*Ut;let f;return c<l?f="Healthy":c<o?f="At risk":f="Liquidatable",{currentLtv:c,lltv:o,healthStatus:f}}const Ot=`{
3
3
  markets(where: {
4
- collateralAssetAddress_in: ["${O}"],
4
+ collateralAssetAddress_in: ["${Z}"],
5
5
  chainId_in: [1]
6
6
  }) {
7
7
  items {
@@ -20,7 +20,7 @@
20
20
  }
21
21
  }
22
22
  }
23
- }`;function j(t){return`{
23
+ }`;function W(t){return`{
24
24
  marketByUniqueKey(uniqueKey: "${t}", chainId: 1) {
25
25
  marketId: uniqueKey
26
26
  loanAsset { symbol address decimals }
@@ -36,4 +36,4 @@
36
36
  utilization
37
37
  }
38
38
  }
39
- }`}async function A(t){var s;const e=await fetch(Ct,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:t})});if(!e.ok)throw new Error(`Morpho API returned ${e.status}`);const a=await e.json();if((s=a.errors)!=null&&s.length)throw new Error(`Morpho API error: ${a.errors[0].message}`);return a.data}function Dt(t){const e=t.state.supplyAssetsUsd;return{marketId:t.marketId,loanAsset:t.loanAsset.symbol,loanAssetAddress:t.loanAsset.address,collateralAsset:t.collateralAsset.symbol,collateralAssetAddress:t.collateralAsset.address,supplyApy:`${(t.state.supplyApy*100).toFixed(2)}%`,borrowApy:`${(t.state.borrowApy*100).toFixed(2)}%`,tvlUsd:`$${e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toFixed(0)}`,utilization:`${(t.state.utilization*100).toFixed(1)}%`,lltv:`${(Number(t.lltv)/1e18*100).toFixed(0)}%`,description:`Borrow ${t.loanAsset.symbol} against LBTC collateral (${(t.state.supplyApy*100).toFixed(2)}% supply APY, ${(Number(t.lltv)/1e18*100).toFixed(0)}% LLTV)`}}const Ie={name:"get_morpho_lbtc_markets",description:"List Morpho Blue lending markets where LBTC is used as collateral. Returns market IDs, loan assets, supply/borrow APYs, TVL, and utilization. Use this to find markets where users can supply LBTC as collateral to borrow other assets.",parameters:Te,schema:J,execute:async t=>{try{const a=(await A(xt)).markets.items.filter(s=>s.state.supplyAssetsUsd>=At).sort((s,r)=>r.state.supplyAssetsUsd-s.state.supplyAssetsUsd).map(Dt);return{markets:a,note:a.length>0?`Found ${a.length} active Morpho markets with LBTC collateral on Ethereum mainnet. Supply LBTC as collateral to borrow the loan asset.`:"No active Morpho markets found for LBTC."}}catch(e){return{markets:[],note:"",error:e instanceof Error?e.message:"Failed to fetch Morpho markets"}}}},Le={name:"prepare_morpho_supply_collateral",description:"Prepare transactions to supply LBTC as collateral to a Morpho Blue market. Returns two unsigned transactions: (1) ERC-20 approve for the Morpho contract, and (2) supplyCollateral call. The user's wallet signs both.",parameters:ve,schema:U,execute:async t=>{const{marketId:e,amount:a,address:s}=U.parse(t);try{const o=(await A(j(e))).marketByUniqueKey;if(!o)return{action:"error",marketId:e,description:"",error:`Market ${e} not found on Morpho.`};if(o.collateralAsset.address.toLowerCase()!==O.toLowerCase())return{action:"error",marketId:e,description:"",error:`This market uses ${o.collateralAsset.symbol} as collateral, not LBTC.`};const n=m.parseUnits(a,i.BTC_DECIMALS),c=m.encodeFunctionData({abi:m.erc20Abi,functionName:"approve",args:[T,n]}),l={loanToken:o.loanAsset.address,collateralToken:o.collateralAsset.address,oracle:o.oracleAddress,irm:o.irmAddress,lltv:BigInt(o.lltv)},f=m.encodeFunctionData({abi:kt,functionName:"supplyCollateral",args:[l,n,s,"0x"]});return{action:"sdk_execute",method:"morpho.supplyCollateral",params:{chainId:1,transactions:[{to:O,data:c,label:`Approve Morpho to spend ${a} LBTC`},{to:T,data:f,label:`Supply ${a} LBTC as collateral to ${o.loanAsset.symbol}/LBTC market`}]},marketId:e,description:`Supply ${a} LBTC as collateral to the ${o.loanAsset.symbol}/LBTC Morpho market (${(Number(o.lltv)/1e18*100).toFixed(0)}% LLTV, ${(o.state.supplyApy*100).toFixed(2)}% supply APY). This requires two transactions: approve + supply.`}}catch(r){return{action:"error",marketId:e,description:"",error:r instanceof Error?r.message:"Failed to prepare Morpho supply"}}}},Ee={name:"prepare_morpho_borrow",description:"Prepare a transaction to borrow from a Morpho Blue market where the user has LBTC collateral. The user must have already supplied LBTC as collateral to this market. Returns an unsigned borrow transaction for the user's wallet to sign.",parameters:Ce,schema:N,execute:async t=>{const{marketId:e,amount:a,address:s}=N.parse(t);try{const o=(await A(j(e))).marketByUniqueKey;if(!o)return{action:"error",marketId:e,description:"",error:`Market ${e} not found on Morpho.`};const n=m.parseUnits(a,o.loanAsset.decimals),c={loanToken:o.loanAsset.address,collateralToken:o.collateralAsset.address,oracle:o.oracleAddress,irm:o.irmAddress,lltv:BigInt(o.lltv)},l=m.encodeFunctionData({abi:St,functionName:"borrow",args:[c,n,0n,s,s]});return{action:"sdk_execute",method:"morpho.borrow",params:{chainId:1,transactions:[{to:T,data:l,label:`Borrow ${a} ${o.loanAsset.symbol} from ${o.loanAsset.symbol}/LBTC market`}]},marketId:e,description:`Borrow ${a} ${o.loanAsset.symbol} against your LBTC collateral on the ${o.loanAsset.symbol}/LBTC Morpho market (${(o.state.borrowApy*100).toFixed(2)}% borrow APY).`}}catch(r){return{action:"error",marketId:e,description:"",error:r instanceof Error?r.message:"Failed to prepare Morpho borrow"}}}},Me={name:"prepare_morpho_repay",description:"Prepare transactions to repay borrowed assets on a Morpho Blue market. Returns two unsigned transactions: (1) ERC-20 approve for the Morpho contract, and (2) repay call. The user must have the loan asset in their wallet.",parameters:Ae,schema:F,execute:async t=>{const{marketId:e,amount:a,address:s}=F.parse(t);try{const o=(await A(j(e))).marketByUniqueKey;if(!o)return{action:"error",marketId:e,description:"",error:`Market ${e} not found on Morpho.`};const n=m.parseUnits(a,o.loanAsset.decimals),c=m.encodeFunctionData({abi:m.erc20Abi,functionName:"approve",args:[T,n]}),l={loanToken:o.loanAsset.address,collateralToken:o.collateralAsset.address,oracle:o.oracleAddress,irm:o.irmAddress,lltv:BigInt(o.lltv)},f=m.encodeFunctionData({abi:_t,functionName:"repay",args:[l,n,0n,s,"0x"]});return{action:"sdk_execute",method:"morpho.repay",params:{chainId:1,transactions:[{to:o.loanAsset.address,data:c,label:`Approve Morpho to spend ${a} ${o.loanAsset.symbol}`},{to:T,data:f,label:`Repay ${a} ${o.loanAsset.symbol} on ${o.loanAsset.symbol}/LBTC market`}]},marketId:e,description:`Repay ${a} ${o.loanAsset.symbol} on the ${o.loanAsset.symbol}/${o.collateralAsset.symbol} Morpho market. This requires two transactions: approve + repay.`}}catch(r){return{action:"error",marketId:e,description:"",error:r instanceof Error?r.message:"Failed to prepare Morpho repay"}}}},$e={name:"get_morpho_position",description:"Get the user's position in a Morpho Blue market: collateral deposited, amount borrowed, current LTV, and health status. Returns token addresses for use with get_token_balance.",parameters:ke,schema:z,execute:async t=>{const{marketId:e,address:a}=z.parse(t),s={collateral:"0",borrowAssets:"0",loanAsset:"",loanAssetAddress:"",collateralAsset:"LBTC",collateralAssetAddress:O,lltv:"",currentLtv:"0%",healthStatus:"No position"};try{const o=(await A(j(e))).marketByUniqueKey;if(!o)return{...s,error:`Market ${e} not found.`};const n=u(1),c=i.makePublicClient({chainId:n.chainId,env:n.env}),[l,f,st]=await Promise.all([c.readContract({address:T,abi:ae,functionName:"position",args:[e,a]}),c.readContract({address:T,abi:ae,functionName:"market",args:[e]}),c.readContract({address:o.oracleAddress,abi:It,functionName:"price"})]),Q=l[2],rt=l[1],ot=f[2],ee=f[3],te=ee>0n?rt*ot/ee:0n,nt=m.formatUnits(Q,i.BTC_DECIMALS),it=m.formatUnits(te,o.loanAsset.decimals),{currentLtv:ct,lltv:dt,healthStatus:lt}=$t({collateralRaw:Q,borrowAssetsRaw:te,oraclePrice:st,lltvRaw:BigInt(o.lltv)});return{collateral:nt,borrowAssets:it,loanAsset:o.loanAsset.symbol,loanAssetAddress:o.loanAsset.address,collateralAsset:o.collateralAsset.symbol,collateralAssetAddress:o.collateralAsset.address,lltv:`${(dt*100).toFixed(0)}%`,currentLtv:`${(ct*100).toFixed(1)}%`,healthStatus:lt}}catch(r){return{...s,error:r instanceof Error?r.message:"Failed to fetch Morpho position"}}}};function v(t,e,a){return Promise.race([t,new Promise((s,r)=>setTimeout(()=>r(new Error(`${a} timed out after ${e}ms`)),e))])}async function q(t,e,a){const s=u(a),r=await v(i.getTokenContractInfo(t,s.chainId,s.env),1e4,"getTokenContractInfo"),o=i.makePublicClient({chainId:s.chainId,env:s.env}),n=await v(o.readContract({address:r.address,abi:[{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]}],functionName:"balanceOf",args:[e]}),1e4,`${t}.balanceOf on ${s.name}`),c="decimals"in r&&typeof r.decimals=="number"?r.decimals:8;return m.formatUnits(n,c)}const xe={name:"get_lbtc_balance",description:"Check the LBTC balance for a wallet address on a given chain.",parameters:B,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),{name:s}=u(a);try{return{balance:await q(i.Token.LBTC,e,a),token:"LBTC",chain:s,address:e}}catch(r){return{balance:"",token:"LBTC",chain:s,address:e,error:r instanceof Error?r.message:"Failed to fetch LBTC balance"}}}},De={name:"get_btcb_balance",description:"Check the BTC.b (cross-chain Bitcoin) balance for a wallet address on a given chain.",parameters:B,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),{name:s}=u(a);try{return{balance:await q(i.Token.BTCb,e,a),token:"BTC.b",chain:s,address:e}}catch(r){return{balance:"",token:"BTC.b",chain:s,address:e,error:r instanceof Error?r.message:"Failed to fetch BTC.b balance"}}}},Re={name:"get_exchange_rate",description:"Get the current LBTC/BTC exchange rate and minimum stake amount. LBTC accrues staking yield over time, so 1 LBTC is worth slightly more than 1 BTC.",parameters:ie,schema:k,execute:async t=>{const{chainId:e}=k.parse(t);try{const a=i.Env.prod,[s,r]=await Promise.all([i.getExchangeRatio({env:a}),i.getLBTCExchangeRate({env:a})]),o=s.LBTC;if(!(o!=null&&o.BTCTokenRatio)||!(o!=null&&o.tokenBTCRatio))throw new Error("Exchange ratio data unavailable");const n=String(o.BTCTokenRatio),c=String(o.tokenBTCRatio);return{lbtcToBtc:n,btcToLbtc:c,minStakeAmountBtc:i.fromSatoshi(r.minAmount).toString(),description:`1 LBTC = ${n} BTC. 1 BTC = ${c} LBTC. Min stake: ${i.fromSatoshi(r.minAmount)} BTC.`}}catch(a){return{lbtcToBtc:"",btcToLbtc:"",minStakeAmountBtc:"",description:"",error:a instanceof Error?a.message:"Failed to fetch exchange rate"}}}},Pe={name:"get_deposit_status",description:"Check the status of all deposits for an address. Shows pending, claimable, and claimed deposits.",parameters:B,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),{env:s}=u(a),r=await i.getDepositsByAddress({address:e,env:s});return r.length===0?{deposits:[],message:"No deposits found"}:{totalDeposits:r.length,deposits:r.map(o=>{var l;const n=i.getDepositStatus(o),c=i.getDepositStatusDisplay(n);return{txHash:o.txHash,amount:(l=o.amount)==null?void 0:l.toString(),status:n,statusLabel:c.label,description:c.description,requiresAction:c.requiresAction,rawPayload:o.rawPayload||null,proofSignature:o.proof||null}})}}},Ue={name:"get_unstake_status",description:"Check the status of all unstake/redeem operations for an address.",parameters:B,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),{env:s}=u(a),r=await i.getUnstakesByAddress({address:e,env:s});return r.length===0?{unstakes:[],message:"No unstakes found"}:{totalUnstakes:r.length,unstakes:r.map(o=>{var n;return{txHash:o.txHash,amount:(n=o.amount)==null?void 0:n.toString(),payoutStatus:o.payoutTxStatus,payoutTxHash:o.payoutTxHash||null}})}}},Ne={name:"get_balance",description:"Check both LBTC and BTC.b balances for a wallet on a given chain in a single call.",parameters:le,schema:I,execute:async t=>{const{address:e,chainId:a}=I.parse(t),s=u(a),[r,o]=await Promise.all([q(i.Token.LBTC,e,a).catch(n=>n instanceof Error?`error: ${n.message}`:"error"),q(i.Token.BTCb,e,a).catch(n=>n instanceof Error?`error: ${n.message}`:"error")]);return{lbtc:r,btcb:o,chain:s.name,address:e}}},H=[{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{name:"decimals",type:"function",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint8"}]},{name:"symbol",type:"function",stateMutability:"view",inputs:[],outputs:[{name:"",type:"string"}]}],Fe={name:"get_token_info",description:"Look up a Lombard-related asset by symbol, alias, or contract address. Returns the canonical name, description, decimals, and per-chain contract addresses. Use this whenever the user mentions a token you're not sure about (BTCe, LBTCv, etc.) before telling them you don't recognize it.",parameters:Be,schema:K,execute:async t=>{const e=C.map(s=>s.symbol),a=s=>{const r={};for(const[o,n]of Object.entries(s.addresses))n&&(r[o]=n);return{symbol:s.symbol,name:s.name,description:s.description,decimals:s.decimals,isLombardIssued:s.isLombardIssued,isYieldBearing:s.isYieldBearing,addresses:r,...s.notes?{notes:s.notes}:{}}};if(t.address&&typeof t.chainId=="number"){const s=re(t.chainId,t.address);return s?{found:!0,asset:a(s),note:`Address ${t.address} on chainId ${t.chainId} is ${s.symbol}.`}:{found:!1,suggestions:e,note:`Address ${t.address} on chainId ${t.chainId} is not a Lombard-issued asset.`}}if(t.query){const s=se(t.query);return s?{found:!0,asset:a(s),note:`Resolved "${t.query}" to ${s.symbol}.`}:{found:!1,suggestions:e,note:`"${t.query}" is not a known Lombard asset. Known symbols: ${e.join(", ")}.`}}return{found:!1,suggestions:e,note:"Provide a `query` (symbol/name) or both `address` and `chainId`."}}},ze={name:"get_token_balance",description:"Check the balance of any ERC-20 token for a wallet address. Requires the token contract address (0x...). Get addresses from other tool results (e.g. loanAsset.address from get_morpho_lbtc_markets). Reads symbol and decimals directly from the contract. Use this for tokens beyond LBTC and BTC.b.",parameters:ge,schema:P,execute:async t=>{const{tokenAddress:e,address:a,chainId:s}=P.parse(t),r=u(s),o=i.makePublicClient({chainId:r.chainId,env:r.env});try{const[n,c,l]=await Promise.all([o.readContract({address:e,abi:H,functionName:"balanceOf",args:[a]}),o.readContract({address:e,abi:H,functionName:"decimals"}),o.readContract({address:e,abi:H,functionName:"symbol"})]);return{balance:m.formatUnits(n,c),symbol:l,tokenAddress:e,chain:r.name}}catch(n){return{balance:"",symbol:"",tokenAddress:e,chain:r.name,error:n instanceof Error?n.message:"Failed to read token balance"}}}},Oe={name:"get_strategies",description:"List available yield strategies where LBTC can be deployed for additional yield. Currently includes Bitcoin Earn (passive vault yield). Returns name, chain, APY, and TVL.",parameters:pe,schema:L,execute:async t=>{const{chainId:e}=L.parse(t),a=i.Env.prod;try{const[s,r]=await Promise.all([i.getEarnApy({env:a}),i.getEarnTVL({env:a})]),o=s.length>0?s[s.length-1]:null;return{strategies:[{vault:"Bitcoin Earn",chain:"Ethereum",apy:o?`${(parseFloat(String(o.apy))*100).toFixed(2)}%`:"N/A",tvlBtc:r.btcBalance.toFixed(4)}]}}catch{return{strategies:[],error:"Unable to fetch vault data"}}}},Rt=process.env.LOMBARD_BFF_URL||"https://bff.prod.lombard-fi.com",qe={name:"get_opportunities",description:"List LBTC and BTC.b DeFi opportunities across protocols and chains. Includes borrow-stables, looping, DEX LP, automated strategies, and more. Filter by category (borrow-stables, looping, dex-lp, automated-strategy, other), chain, or protocol.",parameters:ye,schema:R,execute:async t=>{const{category:e,chain:a,protocol:s}=R.parse(t);try{const r=[];e&&r.push(`category=${encodeURIComponent(e)}`),a&&r.push(`chain=${encodeURIComponent(a)}`),s&&r.push(`protocol=${encodeURIComponent(s)}`);const o=r.length>0?`?${r.join("&")}`:"",n=await fetch(`${Rt}/opportunities-api${o}`);if(!n.ok)throw new Error(`BFF returned ${n.status}`);return{opportunities:(await n.json()).opportunities}}catch(r){return{opportunities:[],error:r instanceof Error?r.message:"Failed to fetch opportunities"}}}},Ve={name:"get_deposit_btc_address",description:"Get or generate a BTC deposit address for a wallet. Users send native BTC to this address to receive LBTC on the specified EVM chain. If no address exists yet, returns instructions to generate one (requires a wallet signature).",parameters:ue,schema:E,execute:async t=>{const{address:e,chainId:a}=E.parse(t),s=u(a);try{return{btcAddress:await i.getDepositBtcAddress({address:e,chainId:s.chainId,env:s.env,partnerId:vt(s.env)}),chain:s.name,note:"Send BTC to this address. Once confirmed and notarized, use get_deposit_status to track progress and claim your LBTC."}}catch{return{btcAddress:null,chain:s.name,action:"generate_deposit_address",note:"No deposit address exists yet. To generate one, a wallet signature is required. Click the button below to sign and generate your BTC deposit address."}}}},Ze={name:"check_fee_authorization",description:"Check if a valid fee authorization signature exists for staking. On Ethereum/Sepolia, fee auth (EIP-712) is required before generating a BTC deposit address. On other chains, an address confirmation is required instead.",parameters:B,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),s=u(a);if(i.requiresAutoMintFee(s.chainId))try{const o=await v(i.getNetworkFeeSignature({address:e,chainId:s.chainId,env:s.env}),1e4,"getNetworkFeeSignature"),n=o.hasSignature&&new Date(o.expirationDate).getTime()>Date.now();return{chain:s.name,requiresFeeAuth:!0,hasValidSignature:n,expirationDate:o.hasSignature?o.expirationDate:null,note:n?"Fee authorization is valid. Ready to generate deposit address.":"Fee authorization is needed before generating a deposit address."}}catch{return{chain:s.name,requiresFeeAuth:!0,hasValidSignature:!1,expirationDate:null,note:"Fee authorization is needed before generating a deposit address."}}return{chain:s.name,requiresFeeAuth:!1,hasValidSignature:!1,expirationDate:null,note:"This chain requires an address confirmation signature (not fee auth). The signing will happen when generating the deposit address."}}},je={name:"prepare_btc_deposit",description:"Prepare a native BTC -> LBTC deposit address. Use this when the user wants LBTC (yield-bearing). The wallet will prompt for fee authorization (Ethereum/Sepolia) or an address confirmation (other chains), then a unique BTC deposit address is generated.",parameters:B,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),s=u(a);return{action:"sdk_execute",method:"btc.generateDepositAddress",params:{address:e,chainId:s.chainId},description:`Generate a BTC deposit address for ${e} on ${s.name}. The deposit will mint LBTC. Your wallet will prompt you to sign an authorization.`}}},He={name:"prepare_btc_to_btcb_deposit",description:"Prepare a native BTC -> BTC.b deposit address. Use this when the user wants BTC.b (cross-chain wrapped Bitcoin, NOT yield-bearing). Distinct flow from prepare_btc_deposit (which produces LBTC). The wallet will prompt for the required authorization, then a unique BTC deposit address is generated that mints BTC.b on the destination EVM chain.",parameters:B,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),s=u(a);return{action:"sdk_execute",method:"btc.generateBtcbDepositAddress",params:{address:e,chainId:s.chainId},description:`Generate a BTC -> BTC.b deposit address for ${e} on ${s.name}. The deposit will mint BTC.b on the destination EVM chain. Your wallet will prompt you to sign an authorization.`}}},Ye={name:"prepare_stake",description:"Prepare a BTC.b → LBTC stake. Returns transaction parameters for the user's wallet to sign, or a validation failure listing what to ask the user for.",parameters:ce,schema:S,execute:async t=>{const e=S.safeParse(t);if(!e.success)return{valid:!1,missing:[],errors:e.error.issues.map(n=>n.message),note:"Surface the listed errors to the user and re-prompt with valid input."};const a=wt(e.data);if(!a.valid)return a;const{amount:s,chainId:r}=e.data,o=u(r);return{valid:!0,action:"sdk_execute",method:"evm.stake",params:{amount:s,chainId:o.chainId,assetIn:"BTCb",assetOut:"LBTC"},description:`Stake ${s} BTC.b to receive LBTC on ${o.name}`}}},We={name:"prepare_unstake",description:"Prepare an LBTC unstake. When outputAsset is 'BTC', the user MUST supply a Bitcoin destination address — do not infer or fill it from prior context. Returns either prepared transaction parameters or a validation failure listing what to ask the user for.",parameters:de,schema:_,execute:async t=>{const e=_.safeParse(t);if(!e.success)return{valid:!1,missing:[],errors:e.error.issues.map(l=>l.message),note:"Surface the listed errors to the user and re-prompt with valid input."};const a=Bt(e.data);if(!a.valid)return a;const{amount:s,outputAsset:r,recipient:o,chainId:n}=e.data,c=u(n);return{valid:!0,action:"sdk_execute",method:"evm.unstake",params:{amount:s,outputAsset:r,recipient:o,chainId:c.chainId},description:`Unstake ${s} LBTC to ${r} on ${c.name}`}}},Ge={name:"prepare_redeem_btcb",description:"Prepare a redemption of BTC.b for native BTC. Distinct from prepare_unstake (which operates on LBTC). The user MUST supply a Bitcoin destination address — do not infer or fill it from prior context. Returns either prepared transaction parameters or a validation failure listing what to ask the user for.",parameters:we,schema:D,execute:async t=>{const e=D.safeParse(t);if(!e.success)return{valid:!1,missing:[],errors:e.error.issues.map(c=>c.message),note:"Surface the listed errors to the user and re-prompt with valid input."};const a=Tt(e.data);if(!a.valid)return a;const{amount:s,recipient:r,chainId:o}=e.data,n=u(o);return{valid:!0,action:"sdk_execute",method:"evm.redeemBtcb",params:{amount:s,recipient:r,chainId:n.chainId},description:`Redeem ${s} BTC.b to native BTC on ${n.name}. Destination: ${r}.`}}},Ke={name:"prepare_deploy_to_vault",description:"Prepare a transaction to deploy LBTC into Bitcoin Earn. Returns prepared transaction parameters or a validation failure.",parameters:he,schema:M,execute:async t=>{const e=M.safeParse(t);if(!e.success)return{valid:!1,missing:[],errors:e.error.issues.map(n=>n.message),note:"Surface the listed errors to the user and re-prompt with valid input."};const a=_e(e.data);if(!a.valid)return a;const{amount:s,chainId:r}=e.data,o=u(r);return{valid:!0,action:"sdk_execute",method:"evm.deploy",params:{amount:s,chainId:o.chainId,token:"LBTC"},description:`Deploy ${s} LBTC to Bitcoin Earn on ${o.name}`}}},Je={name:"prepare_vault_withdrawal",description:"Prepare a withdrawal from Bitcoin Earn. Only one active withdrawal is allowed per user per vault — this tool checks first and refuses if one is already queued, returning its details so you can offer the user prepare_cancel_withdrawal. On success, returns prepared transaction parameters.",parameters:be,schema:$,execute:async t=>{const e=$.safeParse(t);if(!e.success)return{valid:!1,missing:[],errors:e.error.issues.map(c=>c.message),note:"Surface the listed errors to the user and re-prompt with valid input."};const a=_e(e.data);if(!a.valid)return a;const{amount:s,address:r,chainId:o}=e.data,n=u(o);try{const l=(await v(i.getEarnWithdrawals({account:r,chainId:n.chainId,env:n.env}),15e3,"getEarnWithdrawals")).open[0];if(l)return{valid:!1,missing:[],errors:[`An active withdrawal already exists for ${r} on ${n.name}: ${l.shareAmount.toString()} shares queued (request tx ${l.txHash}). Only one active withdrawal is allowed per vault.`],note:`Tell the user about the existing withdrawal (shareAmount=${l.shareAmount.toString()}, txHash=${l.txHash}, deadline=${l.deadline}) and ask whether they want to cancel it via prepare_cancel_withdrawal before queuing a new one. Do not retry prepare_vault_withdrawal until they confirm.`}}catch(c){return{valid:!1,missing:[],errors:[c instanceof Error?`Could not verify active withdrawals: ${c.message}`:"Could not verify active withdrawals."],note:"The active-withdrawal check failed. Tell the user this is a backend issue, suggest they run get_vault_withdrawals manually to confirm no active withdrawal exists, and only proceed with prepare_vault_withdrawal after they confirm."}}return{valid:!0,action:"sdk_execute",method:"evm.withdrawFromVault",params:{amount:s,chainId:n.chainId},description:`Withdraw ${s} shares from Bitcoin Earn on ${n.name}. Withdrawals are queued and may take time to process.`}}},Xe={name:"get_lbtc_apy",description:"Get the current LBTC base staking APY (annual percentage yield). Returns both the base and effective APY for LBTC staking.",parameters:me,schema:G,execute:async()=>{try{const t=await v(i.getApy({env:i.Env.prod}),1e4,"getApy"),e=t.baseApy.multipliedBy(100).toFixed(2),a=t.effectiveApy.multipliedBy(100).toFixed(2);return{baseApy:t.baseApy.toString(),effectiveApy:t.effectiveApy.toString(),description:`LBTC base staking APY: ${e}%. Effective APY (with compounding/incentives): ${a}%.`}}catch(t){return{baseApy:"",effectiveApy:"",description:"",error:t instanceof Error?t.message:"Failed to fetch LBTC APY"}}}},Qe={name:"get_vault_positions",description:"Get a user's Bitcoin Earn positions including shares held and their estimated LBTC value. Currently supports Bitcoin Earn on Ethereum mainnet.",parameters:B,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),s=u(a);try{const r=await v(i.getEarnPosition({address:e,chainId:s.chainId}),1e4,"getEarnPosition");return{shares:r.totalShares.toString(),shareValue:r.exchangeRate.toString(),estimatedLbtcValue:r.position.toString(),vault:"Bitcoin Earn",chain:s.name}}catch(r){return{shares:"",shareValue:"",estimatedLbtcValue:"",vault:"Bitcoin Earn",chain:s.name,error:r instanceof Error?r.message:"Failed to fetch vault positions"}}}},et={name:"prepare_claim_deposit",description:"Prepare a transaction to claim (mint) LBTC from a notarized BTC deposit. Checks if the deposit is claimable and returns the transaction parameters for wallet signing.",parameters:fe,schema:x,execute:async t=>{const{depositTxHash:e,address:a,chainId:s}=x.parse(t),r=u(s),n=(await i.getDepositsByAddress({address:a,env:r.env})).find(l=>l.txHash===e);if(!n)return{action:"error",method:"",params:{depositTxHash:e,rawPayload:"",proofSignature:"",chainId:r.chainId},description:"",error:"Could not find a deposit with this transaction hash for the given address. Use get_deposit_status to verify the transaction hash."};const c=i.getDepositStatus(n);if(c!=="claimable"){const l=i.getDepositStatusDisplay(c);return{action:"error",method:"",params:{depositTxHash:e,rawPayload:"",proofSignature:"",chainId:r.chainId},description:"",error:`Deposit is not claimable. Current status: ${l.label}. ${l.description}`}}return{action:"sdk_execute",method:"evm.claimDeposit",params:{depositTxHash:e,rawPayload:n.rawPayload,proofSignature:n.proof,chainId:r.chainId},description:`Claim LBTC from deposit ${e.slice(0,10)}... on ${r.name}. Your wallet will prompt you to sign the mint transaction.`}}},tt={name:"prepare_cancel_withdrawal",description:"Cancel an active Bitcoin Earn withdrawal that has not yet been processed. Looks up the user's active withdrawal first; refuses if none exists, includes its details in the description if one does, then returns the cancel transaction parameters.",parameters:bt,schema:W,execute:async t=>{const e=W.safeParse(t);if(!e.success)return{valid:!1,missing:[],errors:e.error.issues.map(n=>n.message),note:"Surface the listed errors to the user and re-prompt with valid input."};const{address:a,chainId:s}=e.data,r=u(s);let o="";try{const c=(await v(i.getEarnWithdrawals({account:a,chainId:r.chainId,env:r.env}),15e3,"getEarnWithdrawals")).open[0];if(!c)return{valid:!1,missing:[],errors:[`No active withdrawal found for ${a} on ${r.name}. There is nothing to cancel.`],note:"Tell the user there is no active withdrawal to cancel. If they think there should be, suggest get_vault_withdrawals to inspect their full withdrawal history."};o=` Active withdrawal: ${c.shareAmount.toString()} shares (request tx ${c.txHash}, deadline ${c.deadline}).`}catch(n){return{valid:!1,missing:[],errors:[n instanceof Error?`Could not verify active withdrawals before cancelling: ${n.message}`:"Could not verify active withdrawals before cancelling."],note:"Backend issue. Ask the user to retry in a moment, or to verify via get_vault_withdrawals first."}}return{valid:!0,action:"sdk_execute",method:"evm.cancelWithdrawal",params:{chainId:r.chainId},description:`Cancel pending Bitcoin Earn withdrawal on ${r.name}.${o} Your wallet will prompt you to sign the cancellation transaction.`}}},at=[xe,De,Ne,ze,Fe,Re,Pe,Ue,Oe,qe,Ve,Ze,je,He,Ye,We,Ge,Ke,Je,tt,Xe,Qe,et,Ie,Le,Ee,Me,$e],Pt=Object.fromEntries(at.map(t=>[t.name,t]));exports.AddressAndChainSchema=B;exports.AddressAndChainZod=h;exports.BalanceSchema=le;exports.BalanceZod=I;exports.CHAIN_ID_DESCRIPTION=ne;exports.ClaimDepositSchema=fe;exports.ClaimDepositZod=x;exports.DeployToVaultSchema=he;exports.DeployToVaultZod=M;exports.DepositBtcSchema=ue;exports.DepositBtcZod=E;exports.ExchangeRateSchema=ie;exports.ExchangeRateZod=k;exports.LOMBARD_ASSETS=C;exports.LOMBARD_ASSETS_GLOSSARY=ht;exports.LbtcApySchema=me;exports.LbtcApyZod=G;exports.MorphoBorrowSchema=Ce;exports.MorphoBorrowZod=N;exports.MorphoLbtcMarketsSchema=Te;exports.MorphoLbtcMarketsZod=J;exports.MorphoPositionSchema=ke;exports.MorphoPositionZod=z;exports.MorphoRepaySchema=Ae;exports.MorphoRepayZod=F;exports.MorphoSupplyCollateralSchema=ve;exports.MorphoSupplyCollateralZod=U;exports.OpportunitiesSchema=ye;exports.OpportunitiesZod=R;exports.RedeemBtcbSchema=we;exports.RedeemBtcbZod=D;exports.SUPPORTED_CHAINS=Y;exports.StakeSchema=ce;exports.StakeZod=S;exports.StrategiesSchema=pe;exports.StrategiesZod=L;exports.TokenBalanceSchema=ge;exports.TokenBalanceZod=P;exports.TokenInfoSchema=Be;exports.TokenInfoZod=K;exports.UnstakeSchema=de;exports.UnstakeZod=_;exports.VaultWithdrawalSchema=be;exports.VaultWithdrawalZod=$;exports.allTools=at;exports.amount=g;exports.buildAssetGlossary=oe;exports.chainId=y;exports.checkFeeAuthorization=Ze;exports.evmAddress=b;exports.getBalance=Ne;exports.getBtcbBalance=De;exports.getChainConfig=u;exports.getDepositBtcAddress=Ve;exports.getDepositStatusTool=Pe;exports.getExchangeRate=Re;exports.getLbtcApy=Xe;exports.getLbtcBalance=xe;exports.getMorphoLbtcMarkets=Ie;exports.getMorphoPosition=$e;exports.getOpportunities=qe;exports.getStrategies=Oe;exports.getTokenBalance=ze;exports.getTokenInfo=Fe;exports.getUnstakeStatusTool=Ue;exports.getVaultPositions=Qe;exports.prepareBtcDeposit=je;exports.prepareBtcToBtcbDeposit=He;exports.prepareCancelWithdrawal=tt;exports.prepareClaimDeposit=et;exports.prepareDeployToVault=Ke;exports.prepareMorphoBorrow=Ee;exports.prepareMorphoRepay=Me;exports.prepareMorphoSupplyCollateral=Le;exports.prepareRedeemBtcb=Ge;exports.prepareStake=Ye;exports.prepareUnstake=We;exports.prepareVaultWithdrawal=Je;exports.resolveAssetByAddress=re;exports.resolveAssetByName=se;exports.toolsByName=Pt;
39
+ }`}async function _(t){var s;const e=await fetch(xt,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:t})});if(!e.ok)throw new Error(`Morpho API returned ${e.status}`);const a=await e.json();if((s=a.errors)!=null&&s.length)throw new Error(`Morpho API error: ${a.errors[0].message}`);return a.data}function qt(t){const e=t.state.supplyAssetsUsd;return{marketId:t.marketId,loanAsset:t.loanAsset.symbol,loanAssetAddress:t.loanAsset.address,collateralAsset:t.collateralAsset.symbol,collateralAssetAddress:t.collateralAsset.address,supplyApy:`${(t.state.supplyApy*100).toFixed(2)}%`,borrowApy:`${(t.state.borrowApy*100).toFixed(2)}%`,tvlUsd:`$${e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toFixed(0)}`,utilization:`${(t.state.utilization*100).toFixed(1)}%`,lltv:`${(Number(t.lltv)/1e18*100).toFixed(0)}%`,description:`Borrow ${t.loanAsset.symbol} against LBTC collateral (${(t.state.supplyApy*100).toFixed(2)}% supply APY, ${(Number(t.lltv)/1e18*100).toFixed(0)}% LLTV)`}}const Me={name:"get_morpho_lbtc_markets",description:"List Morpho Blue lending markets where LBTC is used as collateral. Returns market IDs, loan assets, supply/borrow APYs, TVL, and utilization. Use this to find markets where users can supply LBTC as collateral to borrow other assets.",parameters:ke,schema:Q,execute:async t=>{try{const a=(await _(Ot)).markets.items.filter(s=>s.state.supplyAssetsUsd>=Mt).sort((s,o)=>o.state.supplyAssetsUsd-s.state.supplyAssetsUsd).map(qt);return{markets:a,note:a.length>0?`Found ${a.length} active Morpho markets with LBTC collateral on Ethereum mainnet. Supply LBTC as collateral to borrow the loan asset.`:"No active Morpho markets found for LBTC."}}catch(e){return{markets:[],note:"",error:e instanceof Error?e.message:"Failed to fetch Morpho markets"}}}},$e={name:"prepare_morpho_supply_collateral",description:"Prepare transactions to supply LBTC as collateral to a Morpho Blue market. Returns two unsigned transactions: (1) ERC-20 approve for the Morpho contract, and (2) supplyCollateral call. The user's wallet signs both.",parameters:_e,schema:z,execute:async t=>{const{marketId:e,amount:a,address:s}=z.parse(t);try{const r=(await _(W(e))).marketByUniqueKey;if(!r)return{action:"error",marketId:e,description:"",error:`Market ${e} not found on Morpho.`};if(r.collateralAsset.address.toLowerCase()!==Z.toLowerCase())return{action:"error",marketId:e,description:"",error:`This market uses ${r.collateralAsset.symbol} as collateral, not LBTC.`};const n=m.parseUnits(a,i.BTC_DECIMALS),c=m.encodeFunctionData({abi:m.erc20Abi,functionName:"approve",args:[v,n]}),l={loanToken:r.loanAsset.address,collateralToken:r.collateralAsset.address,oracle:r.oracleAddress,irm:r.irmAddress,lltv:BigInt(r.lltv)},f=m.encodeFunctionData({abi:$t,functionName:"supplyCollateral",args:[l,n,s,"0x"]});return{action:"sdk_execute",method:"morpho.supplyCollateral",params:{chainId:1,transactions:[{to:Z,data:c,label:`Approve Morpho to spend ${a} LBTC`},{to:v,data:f,label:`Supply ${a} LBTC as collateral to ${r.loanAsset.symbol}/LBTC market`}]},marketId:e,description:`Supply ${a} LBTC as collateral to the ${r.loanAsset.symbol}/LBTC Morpho market (${(Number(r.lltv)/1e18*100).toFixed(0)}% LLTV, ${(r.state.supplyApy*100).toFixed(2)}% supply APY). This requires two transactions: approve + supply.`}}catch(o){return{action:"error",marketId:e,description:"",error:o instanceof Error?o.message:"Failed to prepare Morpho supply"}}}},Pe={name:"prepare_morpho_borrow",description:"Prepare a transaction to borrow from a Morpho Blue market where the user has LBTC collateral. The user must have already supplied LBTC as collateral to this market. Returns an unsigned borrow transaction for the user's wallet to sign.",parameters:Se,schema:O,execute:async t=>{const{marketId:e,amount:a,address:s}=O.parse(t);try{const r=(await _(W(e))).marketByUniqueKey;if(!r)return{action:"error",marketId:e,description:"",error:`Market ${e} not found on Morpho.`};const n=m.parseUnits(a,r.loanAsset.decimals),c={loanToken:r.loanAsset.address,collateralToken:r.collateralAsset.address,oracle:r.oracleAddress,irm:r.irmAddress,lltv:BigInt(r.lltv)},l=m.encodeFunctionData({abi:Pt,functionName:"borrow",args:[c,n,0n,s,s]});return{action:"sdk_execute",method:"morpho.borrow",params:{chainId:1,transactions:[{to:v,data:l,label:`Borrow ${a} ${r.loanAsset.symbol} from ${r.loanAsset.symbol}/LBTC market`}]},marketId:e,description:`Borrow ${a} ${r.loanAsset.symbol} against your LBTC collateral on the ${r.loanAsset.symbol}/LBTC Morpho market (${(r.state.borrowApy*100).toFixed(2)}% borrow APY).`}}catch(o){return{action:"error",marketId:e,description:"",error:o instanceof Error?o.message:"Failed to prepare Morpho borrow"}}}},De={name:"prepare_morpho_repay",description:"Prepare transactions to repay borrowed assets on a Morpho Blue market. Returns two unsigned transactions: (1) ERC-20 approve for the Morpho contract, and (2) repay call. The user must have the loan asset in their wallet.",parameters:Le,schema:q,execute:async t=>{const{marketId:e,amount:a,address:s}=q.parse(t);try{const r=(await _(W(e))).marketByUniqueKey;if(!r)return{action:"error",marketId:e,description:"",error:`Market ${e} not found on Morpho.`};const n=m.parseUnits(a,r.loanAsset.decimals),c=m.encodeFunctionData({abi:m.erc20Abi,functionName:"approve",args:[v,n]}),l={loanToken:r.loanAsset.address,collateralToken:r.collateralAsset.address,oracle:r.oracleAddress,irm:r.irmAddress,lltv:BigInt(r.lltv)},f=m.encodeFunctionData({abi:Dt,functionName:"repay",args:[l,n,0n,s,"0x"]});return{action:"sdk_execute",method:"morpho.repay",params:{chainId:1,transactions:[{to:r.loanAsset.address,data:c,label:`Approve Morpho to spend ${a} ${r.loanAsset.symbol}`},{to:v,data:f,label:`Repay ${a} ${r.loanAsset.symbol} on ${r.loanAsset.symbol}/LBTC market`}]},marketId:e,description:`Repay ${a} ${r.loanAsset.symbol} on the ${r.loanAsset.symbol}/${r.collateralAsset.symbol} Morpho market. This requires two transactions: approve + repay.`}}catch(o){return{action:"error",marketId:e,description:"",error:o instanceof Error?o.message:"Failed to prepare Morpho repay"}}}},Re={name:"get_morpho_position",description:"Get the user's position in a Morpho Blue market: collateral deposited, amount borrowed, current LTV, and health status. Returns token addresses for use with get_token_balance.",parameters:Ie,schema:V,execute:async t=>{const{marketId:e,address:a}=V.parse(t),s={collateral:"0",borrowAssets:"0",loanAsset:"",loanAssetAddress:"",collateralAsset:"LBTC",collateralAssetAddress:Z,lltv:"",currentLtv:"0%",healthStatus:"No position"};try{const r=(await _(W(e))).marketByUniqueKey;if(!r)return{...s,error:`Market ${e} not found.`};const n=p(1),c=i.makePublicClient({chainId:n.chainId,env:n.env}),[l,f,pt]=await Promise.all([c.readContract({address:v,abi:re,functionName:"position",args:[e,a]}),c.readContract({address:v,abi:re,functionName:"market",args:[e]}),c.readContract({address:r.oracleAddress,abi:Rt,functionName:"price"})]),te=l[2],ut=l[1],ht=f[2],ae=f[3],se=ae>0n?ut*ht/ae:0n,mt=m.formatUnits(te,i.BTC_DECIMALS),bt=m.formatUnits(se,r.loanAsset.decimals),{currentLtv:ft,lltv:gt,healthStatus:yt}=zt({collateralRaw:te,borrowAssetsRaw:se,oraclePrice:pt,lltvRaw:BigInt(r.lltv)});return{collateral:mt,borrowAssets:bt,loanAsset:r.loanAsset.symbol,loanAssetAddress:r.loanAsset.address,collateralAsset:r.collateralAsset.symbol,collateralAssetAddress:r.collateralAsset.address,lltv:`${(gt*100).toFixed(0)}%`,currentLtv:`${(ft*100).toFixed(1)}%`,healthStatus:yt}}catch(o){return{...s,error:o instanceof Error?o.message:"Failed to fetch Morpho position"}}}};function y(t,e,a){return Promise.race([t,new Promise((s,o)=>setTimeout(()=>o(new Error(`${a} timed out after ${e}ms`)),e))])}async function H(t,e,a){const s=p(a),o=await y(i.getTokenContractInfo(t,s.chainId,s.env),1e4,"getTokenContractInfo"),r=i.makePublicClient({chainId:s.chainId,env:s.env}),n=await y(r.readContract({address:o.address,abi:[{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]}],functionName:"balanceOf",args:[e]}),1e4,`${t}.balanceOf on ${s.name}`),c="decimals"in o&&typeof o.decimals=="number"?o.decimals:8;return m.formatUnits(n,c)}const Ne={name:"get_lbtc_balance",description:"Check the LBTC balance for a wallet address on a given chain.",parameters:T,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),{name:s}=p(a);try{return{balance:await H(i.Token.LBTC,e,a),token:"LBTC",chain:s,address:e}}catch(o){return{balance:"",token:"LBTC",chain:s,address:e,error:o instanceof Error?o.message:"Failed to fetch LBTC balance"}}}},Fe={name:"get_btcb_balance",description:"Check the BTC.b (cross-chain Bitcoin) balance for a wallet address on a given chain.",parameters:T,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),{name:s}=p(a);try{return{balance:await H(i.Token.BTCb,e,a),token:"BTC.b",chain:s,address:e}}catch(o){return{balance:"",token:"BTC.b",chain:s,address:e,error:o instanceof Error?o.message:"Failed to fetch BTC.b balance"}}}},Ue={name:"get_exchange_rate",description:"Get the current LBTC/BTC exchange rate and minimum stake amount. LBTC accrues staking yield over time, so 1 LBTC is worth slightly more than 1 BTC.",parameters:le,schema:S,execute:async t=>{const{chainId:e}=S.parse(t);try{const a=i.Env.prod,[s,o]=await Promise.all([i.getExchangeRatio({env:a}),i.getLBTCExchangeRate({env:a})]),r=s.LBTC;if(!(r!=null&&r.BTCTokenRatio)||!(r!=null&&r.tokenBTCRatio))throw new Error("Exchange ratio data unavailable");const n=String(r.BTCTokenRatio),c=String(r.tokenBTCRatio);return{lbtcToBtc:n,btcToLbtc:c,minStakeAmountBtc:i.fromSatoshi(o.minAmount).toString(),description:`1 LBTC = ${n} BTC. 1 BTC = ${c} LBTC. Min stake: ${i.fromSatoshi(o.minAmount)} BTC.`}}catch(a){return{lbtcToBtc:"",btcToLbtc:"",minStakeAmountBtc:"",description:"",error:a instanceof Error?a.message:"Failed to fetch exchange rate"}}}},ze={name:"get_deposit_status",description:"Check the status of all deposits for an address. Shows pending, claimable, and claimed deposits.",parameters:T,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),{env:s}=p(a),o=await i.getDepositsByAddress({address:e,env:s});return o.length===0?{deposits:[],message:"No deposits found"}:{totalDeposits:o.length,deposits:o.map(r=>{var l;const n=i.getDepositStatus(r),c=i.getDepositStatusDisplay(n);return{txHash:r.txHash,amount:(l=r.amount)==null?void 0:l.toString(),status:n,statusLabel:c.label,description:c.description,requiresAction:c.requiresAction,rawPayload:r.rawPayload||null,proofSignature:r.proof||null}})}}},Oe={name:"get_redemption_status",description:"Check the status of all unstake/redeem operations for an address.",parameters:T,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),{env:s}=p(a),o=await i.getUnstakesByAddress({address:e,env:s});return o.length===0?{unstakes:[],message:"No unstakes found"}:{totalUnstakes:o.length,unstakes:o.map(r=>{var n;return{txHash:r.txHash,amount:(n=r.amount)==null?void 0:n.toString(),payoutStatus:r.payoutTxStatus,payoutTxHash:r.payoutTxHash||null}})}}},qe={name:"get_balance",description:"Check both LBTC and BTC.b balances for a wallet on a given chain in a single call.",parameters:me,schema:x,execute:async t=>{const{address:e,chainId:a}=x.parse(t),s=p(a),[o,r]=await Promise.all([H(i.Token.LBTC,e,a).catch(n=>n instanceof Error?`error: ${n.message}`:"error"),H(i.Token.BTCb,e,a).catch(n=>n instanceof Error?`error: ${n.message}`:"error")]);return{lbtc:o,btcb:r,chain:s.name,address:e}}},Y=[{name:"balanceOf",type:"function",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{name:"decimals",type:"function",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint8"}]},{name:"symbol",type:"function",stateMutability:"view",inputs:[],outputs:[{name:"",type:"string"}]}],Ve={name:"get_token_info",description:"Look up a Lombard-related asset by symbol, alias, or contract address. Returns the canonical name, description, decimals, and per-chain contract addresses. Use this whenever the user mentions a token you're not sure about (BTCe, LBTCv, etc.) before telling them you don't recognize it.",parameters:Ae,schema:X,execute:async t=>{const e=C.map(s=>s.symbol),a=s=>{const o={};for(const[r,n]of Object.entries(s.addresses))n&&(o[r]=n);return{symbol:s.symbol,name:s.name,description:s.description,decimals:s.decimals,isLombardIssued:s.isLombardIssued,isYieldBearing:s.isYieldBearing,addresses:o,...s.notes?{notes:s.notes}:{}}};if(t.address&&typeof t.chainId=="number"){const s=ne(t.chainId,t.address);return s?{found:!0,asset:a(s),note:`Address ${t.address} on chainId ${t.chainId} is ${s.symbol}.`}:{found:!1,suggestions:e,note:`Address ${t.address} on chainId ${t.chainId} is not a Lombard-issued asset.`}}if(t.query){const s=oe(t.query);return s?{found:!0,asset:a(s),note:`Resolved "${t.query}" to ${s.symbol}.`}:{found:!1,suggestions:e,note:`"${t.query}" is not a known Lombard asset. Known symbols: ${e.join(", ")}.`}}return{found:!1,suggestions:e,note:"Provide a `query` (symbol/name) or both `address` and `chainId`."}}},Ze={name:"get_token_balance",description:"Check the balance of any ERC-20 token for a wallet address. Requires the token contract address (0x...). Get addresses from other tool results (e.g. loanAsset.address from get_morpho_lbtc_markets). Reads symbol and decimals directly from the contract. Use this for tokens beyond LBTC and BTC.b.",parameters:ve,schema:U,execute:async t=>{const{tokenAddress:e,address:a,chainId:s}=U.parse(t),o=p(s),r=i.makePublicClient({chainId:o.chainId,env:o.env});try{const[n,c,l]=await Promise.all([r.readContract({address:e,abi:Y,functionName:"balanceOf",args:[a]}),r.readContract({address:e,abi:Y,functionName:"decimals"}),r.readContract({address:e,abi:Y,functionName:"symbol"})]);return{balance:m.formatUnits(n,c),symbol:l,tokenAddress:e,chain:o.name}}catch(n){return{balance:"",symbol:"",tokenAddress:e,chain:o.name,error:n instanceof Error?n.message:"Failed to read token balance"}}}},He={name:"get_earn_strategies",description:"List available yield strategies where LBTC can be deployed for additional yield. Currently includes Bitcoin Earn (passive vault yield). Returns name, chain, APY, and TVL.",parameters:be,schema:M,execute:async t=>{const{chainId:e}=M.parse(t),a=i.Env.prod;try{const[s,o]=await Promise.all([i.getEarnApy({env:a}),i.getEarnTVL({env:a})]),r=s.length>0?s[s.length-1]:null;return{strategies:[{vault:"Bitcoin Earn",chain:"Ethereum",apy:r?`${(parseFloat(String(r.apy))*100).toFixed(2)}%`:"N/A",tvlBtc:o.btcBalance.toFixed(4)}]}}catch{return{strategies:[],error:"Unable to fetch vault data"}}}},Vt=process.env.LOMBARD_BFF_URL||"https://bff.prod.lombard-fi.com",je={name:"get_lbtc_defi_opportunities",description:"List LBTC and BTC.b DeFi opportunities across protocols and chains. Includes borrow-stables, looping, DEX LP, automated strategies, and more. Filter by category (borrow-stables, looping, dex-lp, automated-strategy, other), chain, or protocol.",parameters:we,schema:F,execute:async t=>{const{category:e,chain:a,protocol:s}=F.parse(t);try{const o=[];e&&o.push(`category=${encodeURIComponent(e)}`),a&&o.push(`chain=${encodeURIComponent(a)}`),s&&o.push(`protocol=${encodeURIComponent(s)}`);const r=o.length>0?`?${o.join("&")}`:"",n=await fetch(`${Vt}/opportunities-api${r}`);if(!n.ok)throw new Error(`BFF returned ${n.status}`);return{opportunities:(await n.json()).opportunities}}catch(o){return{opportunities:[],error:o instanceof Error?o.message:"Failed to fetch opportunities"}}}},We={name:"get_deposit_btc_address",description:"Get or generate a BTC deposit address for a wallet. Users send native BTC to this address to receive LBTC on the specified EVM chain. If no address exists yet, returns instructions to generate one (requires a wallet signature).",parameters:fe,schema:$,execute:async t=>{const{address:e,chainId:a}=$.parse(t),s=p(a);try{return{btcAddress:await i.getDepositBtcAddress({address:e,chainId:s.chainId,env:s.env,partnerId:Et(s.env)}),chain:s.name,note:"Send BTC to this address. Once confirmed and notarized, use get_deposit_status to track progress and claim your LBTC."}}catch{return{btcAddress:null,chain:s.name,action:"generate_deposit_address",note:"No deposit address exists yet. To generate one, a wallet signature is required. Click the button below to sign and generate your BTC deposit address."}}}},Ye={name:"check_fee_authorization",description:"Check if a valid fee authorization signature exists for staking. On Ethereum/Sepolia, fee auth (EIP-712) is required before generating a BTC deposit address. On other chains, an address confirmation is required instead.",parameters:T,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),s=p(a);if(i.requiresAutoMintFee(s.chainId))try{const r=await y(i.getNetworkFeeSignature({address:e,chainId:s.chainId,env:s.env}),1e4,"getNetworkFeeSignature"),n=r.hasSignature&&new Date(r.expirationDate).getTime()>Date.now();return{chain:s.name,requiresFeeAuth:!0,hasValidSignature:n,expirationDate:r.hasSignature?r.expirationDate:null,note:n?"Fee authorization is valid. Ready to generate deposit address.":"Fee authorization is needed before generating a deposit address."}}catch{return{chain:s.name,requiresFeeAuth:!0,hasValidSignature:!1,expirationDate:null,note:"Fee authorization is needed before generating a deposit address."}}return{chain:s.name,requiresFeeAuth:!1,hasValidSignature:!1,expirationDate:null,note:"This chain requires an address confirmation signature (not fee auth). The signing will happen when generating the deposit address."}}},Ge={name:"prepare_btc_to_lbtc_deposit",description:"Prepare a native BTC -> LBTC deposit address. Use this when the user wants LBTC (yield-bearing). The wallet will prompt for fee authorization (Ethereum/Sepolia) or an address confirmation (other chains), then a unique BTC deposit address is generated.",parameters:T,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),s=p(a);return{action:"sdk_execute",method:"btc.generateLbtcDepositAddress",params:{address:e,chainId:s.chainId},description:`Generate a BTC deposit address for ${e} on ${s.name}. The deposit will mint LBTC. Your wallet will prompt you to sign an authorization.`}}},Ke={name:"prepare_btc_to_btcb_deposit",description:"Prepare a native BTC -> BTC.b deposit address. Use this when the user wants BTC.b (cross-chain wrapped Bitcoin, NOT yield-bearing). Distinct flow from prepare_btc_to_lbtc_deposit (which produces LBTC). The wallet will prompt for the required authorization, then a unique BTC deposit address is generated that mints BTC.b on the destination EVM chain.",parameters:T,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),s=p(a);return{action:"sdk_execute",method:"btc.generateBtcbDepositAddress",params:{address:e,chainId:s.chainId},description:`Generate a BTC -> BTC.b deposit address for ${e} on ${s.name}. The deposit will mint BTC.b on the destination EVM chain. Your wallet will prompt you to sign an authorization.`}}},Je={name:"prepare_btcb_to_lbtc_stake",description:"Prepare a BTC.b → LBTC stake. Returns transaction parameters for the user's wallet to sign, or a validation failure listing what to ask the user for.",parameters:pe,schema:L,execute:async t=>{const e=L.safeParse(t);if(!e.success)return{valid:!1,missing:[],errors:e.error.issues.map(n=>n.message),note:"Surface the listed errors to the user and re-prompt with valid input."};const a=Lt(e.data);if(!a.valid)return a;const{amount:s,chainId:o}=e.data,r=p(o);return{valid:!0,action:"sdk_execute",method:"evm.btcbToLbtc",params:{amount:s,chainId:r.chainId,assetIn:"BTCb",assetOut:"LBTC"},description:`Stake ${s} BTC.b to receive LBTC on ${r.name}`}}},Xe={name:"prepare_lbtc_to_btc",description:"Prepare a cross-chain LBTC redemption to native Bitcoin. The user MUST supply a Bitcoin destination address — do not infer or fill it from prior context. Returns either prepared transaction parameters or a validation failure listing what to ask the user for. For LBTC → BTC.b on the same EVM chain, use prepare_lbtc_to_btcb instead.",parameters:ue,schema:I,execute:async t=>{const e=I.safeParse(t);if(!e.success)return{valid:!1,missing:[],errors:e.error.issues.map(c=>c.message),note:"Surface the listed errors to the user and re-prompt with valid input."};const a=_t(e.data);if(!a.valid)return a;const{amount:s,recipient:o,chainId:r}=e.data,n=p(r);return{valid:!0,action:"sdk_execute",method:"evm.lbtcToBtc",params:{amount:s,recipient:o,chainId:n.chainId},description:`Redeem ${s} LBTC to native BTC on ${n.name}. Destination: ${o}.`}}},Qe={name:"prepare_lbtc_to_btcb",description:"Prepare a same-chain LBTC → BTC.b redemption. No Bitcoin recipient address is needed; the BTC.b is credited to the caller's wallet on the same EVM chain. For LBTC → native BTC, use prepare_lbtc_to_btc.",parameters:he,schema:E,execute:async t=>{const e=E.safeParse(t);if(!e.success)return{valid:!1,missing:[],errors:e.error.issues.map(n=>n.message),note:"Surface the listed errors to the user and re-prompt with valid input."};const a=St(e.data);if(!a.valid)return a;const{amount:s,chainId:o}=e.data,r=p(o);return{valid:!0,action:"sdk_execute",method:"evm.lbtcToBtcb",params:{amount:s,chainId:r.chainId},description:`Redeem ${s} LBTC to BTC.b on ${r.name} (same chain).`}}},et={name:"prepare_redeem_btcb",description:"Prepare a redemption of BTC.b for native BTC. Distinct from prepare_unstake (which operates on LBTC). The user MUST supply a Bitcoin destination address — do not infer or fill it from prior context. Returns either prepared transaction parameters or a validation failure listing what to ask the user for.",parameters:Ce,schema:N,execute:async t=>{const e=N.safeParse(t);if(!e.success)return{valid:!1,missing:[],errors:e.error.issues.map(c=>c.message),note:"Surface the listed errors to the user and re-prompt with valid input."};const a=It(e.data);if(!a.valid)return a;const{amount:s,recipient:o,chainId:r}=e.data,n=p(r);return{valid:!0,action:"sdk_execute",method:"evm.btcbToBtc",params:{amount:s,recipient:o,chainId:n.chainId},description:`Redeem ${s} BTC.b to native BTC on ${n.name}. Destination: ${o}.`}}},tt={name:"prepare_earn_deposit",description:"Prepare a transaction to deploy LBTC into Bitcoin Earn. Returns prepared transaction parameters or a validation failure.",parameters:ge,schema:P,execute:async t=>{const e=P.safeParse(t);if(!e.success)return{valid:!1,missing:[],errors:e.error.issues.map(n=>n.message),note:"Surface the listed errors to the user and re-prompt with valid input."};const a=xe(e.data);if(!a.valid)return a;const{amount:s,chainId:o}=e.data,r=p(o);return{valid:!0,action:"sdk_execute",method:"evm.earnDeposit",params:{amount:s,chainId:r.chainId,token:"LBTC"},description:`Deploy ${s} LBTC to Bitcoin Earn on ${r.name}`}}},at={name:"prepare_earn_withdrawal",description:"Prepare a withdrawal from Bitcoin Earn. Only one active withdrawal is allowed per user per vault — this tool checks first and refuses if one is already queued, returning its details so you can offer the user prepare_cancel_earn_withdrawal. On success, returns prepared transaction parameters.",parameters:Be,schema:D,execute:async t=>{const e=D.safeParse(t);if(!e.success)return{valid:!1,missing:[],errors:e.error.issues.map(c=>c.message),note:"Surface the listed errors to the user and re-prompt with valid input."};const a=xe(e.data);if(!a.valid)return a;const{amount:s,address:o,chainId:r}=e.data,n=p(r);try{const l=(await y(i.getEarnWithdrawals({account:o,chainId:n.chainId,env:n.env}),15e3,"getEarnWithdrawals")).open[0];if(l)return{valid:!1,missing:[],errors:[`An active withdrawal already exists for ${o} on ${n.name}: ${l.shareAmount.toString()} shares queued (request tx ${l.txHash}). Only one active withdrawal is allowed per vault.`],note:`Tell the user about the existing withdrawal (shareAmount=${l.shareAmount.toString()}, txHash=${l.txHash}, deadline=${l.deadline}) and ask whether they want to cancel it via prepare_cancel_earn_withdrawal before queuing a new one. Do not retry prepare_earn_withdrawal until they confirm.`}}catch(c){return{valid:!1,missing:[],errors:[c instanceof Error?`Could not verify active withdrawals: ${c.message}`:"Could not verify active withdrawals."],note:"The active-withdrawal check failed. Tell the user this is a backend issue, suggest they run get_earn_withdrawals manually to confirm no active withdrawal exists, and only proceed with prepare_earn_withdrawal after they confirm."}}return{valid:!0,action:"sdk_execute",method:"evm.earnWithdrawal",params:{amount:s,chainId:n.chainId},description:`Withdraw ${s} shares from Bitcoin Earn on ${n.name}. Withdrawals are queued and may take time to process.`}}},st={name:"get_lbtc_apy",description:"Get the current LBTC base staking APY (annual percentage yield). Returns both the base and effective APY for LBTC staking.",parameters:ye,schema:J,execute:async()=>{try{const t=await y(i.getApy({env:i.Env.prod}),1e4,"getApy"),e=t.baseApy.multipliedBy(100).toFixed(2),a=t.effectiveApy.multipliedBy(100).toFixed(2);return{baseApy:t.baseApy.toString(),effectiveApy:t.effectiveApy.toString(),description:`LBTC base staking APY: ${e}%. Effective APY (with compounding/incentives): ${a}%.`}}catch(t){return{baseApy:"",effectiveApy:"",description:"",error:t instanceof Error?t.message:"Failed to fetch LBTC APY"}}}},rt={name:"get_earn_positions",description:"Get a user's Bitcoin Earn positions including shares held and their estimated LBTC value. Currently supports Bitcoin Earn on Ethereum mainnet.",parameters:T,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),s=p(a);try{const o=await y(i.getEarnPosition({address:e,chainId:s.chainId}),1e4,"getEarnPosition");return{shares:o.totalShares.toString(),shareValue:o.exchangeRate.toString(),estimatedLbtcValue:o.position.toString(),vault:"Bitcoin Earn",chain:s.name}}catch(o){return{shares:"",shareValue:"",estimatedLbtcValue:"",vault:"Bitcoin Earn",chain:s.name,error:o instanceof Error?o.message:"Failed to fetch vault positions"}}}},ot={name:"prepare_claim_lbtc_deposit",description:"Prepare a transaction to claim (mint) LBTC from a notarized BTC deposit. Checks if the deposit is claimable and returns the transaction parameters for wallet signing.",parameters:Te,schema:R,execute:async t=>{const{depositTxHash:e,address:a,chainId:s}=R.parse(t),o=p(s),n=(await i.getDepositsByAddress({address:a,env:o.env})).find(l=>l.txHash===e);if(!n)return{action:"error",method:"",params:{depositTxHash:e,rawPayload:"",proofSignature:"",chainId:o.chainId},description:"",error:"Could not find a deposit with this transaction hash for the given address. Use get_deposit_status to verify the transaction hash."};const c=i.getDepositStatus(n);if(c!=="claimable"){const l=i.getDepositStatusDisplay(c);return{action:"error",method:"",params:{depositTxHash:e,rawPayload:"",proofSignature:"",chainId:o.chainId},description:"",error:`Deposit is not claimable. Current status: ${l.label}. ${l.description}`}}return{action:"sdk_execute",method:"evm.claimLbtcDeposit",params:{depositTxHash:e,rawPayload:n.rawPayload,proofSignature:n.proof,chainId:o.chainId},description:`Claim LBTC from deposit ${e.slice(0,10)}... on ${o.name}. Your wallet will prompt you to sign the mint transaction.`}}},nt={name:"prepare_cancel_earn_withdrawal",description:"Cancel an active Bitcoin Earn withdrawal that has not yet been processed. Looks up the user's active withdrawal first; refuses if none exists, includes its details in the description if one does, then returns the cancel transaction parameters.",parameters:vt,schema:K,execute:async t=>{const e=K.safeParse(t);if(!e.success)return{valid:!1,missing:[],errors:e.error.issues.map(n=>n.message),note:"Surface the listed errors to the user and re-prompt with valid input."};const{address:a,chainId:s}=e.data,o=p(s);let r="";try{const c=(await y(i.getEarnWithdrawals({account:a,chainId:o.chainId,env:o.env}),15e3,"getEarnWithdrawals")).open[0];if(!c)return{valid:!1,missing:[],errors:[`No active withdrawal found for ${a} on ${o.name}. There is nothing to cancel.`],note:"Tell the user there is no active withdrawal to cancel. If they think there should be, suggest get_earn_withdrawals to inspect their full withdrawal history."};r=` Active withdrawal: ${c.shareAmount.toString()} shares (request tx ${c.txHash}, deadline ${c.deadline}).`}catch(n){return{valid:!1,missing:[],errors:[n instanceof Error?`Could not verify active withdrawals before cancelling: ${n.message}`:"Could not verify active withdrawals before cancelling."],note:"Backend issue. Ask the user to retry in a moment, or to verify via get_earn_withdrawals first."}}return{valid:!0,action:"sdk_execute",method:"evm.cancelEarnWithdrawal",params:{chainId:o.chainId},description:`Cancel pending Bitcoin Earn withdrawal on ${o.name}.${r} Your wallet will prompt you to sign the cancellation transaction.`}}},it={name:"get_earn_withdrawals",description:"Get all vault withdrawals for an address, including open (pending), fulfilled, cancelled, and expired withdrawals.",parameters:T,schema:h,execute:async t=>{const{address:e,chainId:a}=h.parse(t),s=p(a);try{const o=await y(i.getEarnWithdrawals({account:e,chainId:s.chainId,env:s.env}),15e3,"getEarnWithdrawals");return{withdrawals:{open:o.open.map(r=>({txHash:r.txHash,shareAmount:r.shareAmount.toString(),deadline:r.deadline,timestamp:r.timestamp})),fulfilled:o.fulfilled.map(r=>{var n;return{txHash:r.txHash,shareAmount:r.shareAmount.toString(),amount:((n=r.amount)==null?void 0:n.toString())??"unknown",fulfilledTxHash:r.fulfilledTxHash??null}}),cancelled:o.cancelled.map(r=>({txHash:r.txHash,shareAmount:r.shareAmount.toString(),timestamp:r.timestamp})),expired:o.expired.map(r=>({txHash:r.txHash,shareAmount:r.shareAmount.toString(),timestamp:r.timestamp}))},chain:s.name}}catch(o){return{withdrawals:{open:[],fulfilled:[],cancelled:[],expired:[]},chain:s.name,error:o instanceof Error?o.message:"Failed to fetch vault withdrawals"}}}},ct={name:"get_lux_points",description:"Get the Lux reward points for a wallet address. Returns the current season's points including holding, protocol, referral, and badge points.",parameters:de,schema:A,execute:async t=>{const{address:e}=A.parse(t);try{const a=await y(i.getPointsByAddress({address:e,env:i.Env.prod,season:2}),1e4,"getPointsByAddress");return{points:{totalPoints:a.totalPoints,holdingPoints:a.holdingPoints,protocolPoints:a.protocolPoints,referralPoints:a.referralPoints,badgesPoints:a.badgesPoints,protocolPointsBreakdown:a.protocolPointsBreakdown},season:2}}catch(a){return{points:{totalPoints:0,holdingPoints:0,protocolPoints:0,referralPoints:0,badgesPoints:0,protocolPointsBreakdown:{}},season:2,error:a instanceof Error?a.message:"Failed to fetch Lux points"}}}},dt={name:"get_positions_summary",description:"Get an aggregated portfolio summary for a wallet address, including total BTC value, profit/loss, and a breakdown of individual positions (holdings and DeFi).",parameters:de,schema:A,execute:async t=>{const{address:e}=A.parse(t);try{const a=await y(i.getPositionsSummary({account:e,env:i.Env.prod}),1e4,"getPositionsSummary");return{btcPriceUsd:a.btcPrice.price.toString(),btcValue:a.btcValue.toString(),btcPnl:a.btcPnl.toString(),positions:a.snapshot.map(s=>({token:s.token,type:s.type,balance:s.balance.toString(),pnl:s.pnl.toString(),rate:s.rate.toString()})),lastUpdated:a.lastUpdated.toISOString(),inProgress:a.inProgress}}catch(a){return{btcPriceUsd:"",btcValue:"",btcPnl:"",positions:[],lastUpdated:"",inProgress:!1,error:a instanceof Error?a.message:"Failed to fetch positions summary"}}}},lt=[Ne,Fe,qe,Ze,Ve,Ue,ze,Oe,He,je,We,Ye,Ge,Ke,Je,Xe,Qe,et,tt,at,nt,st,rt,ot,Me,$e,Pe,De,Re,it,ct,dt],Zt=Object.fromEntries(lt.map(t=>[t.name,t]));exports.AddressAndChainSchema=T;exports.AddressAndChainZod=h;exports.BalanceSchema=me;exports.BalanceZod=x;exports.CHAIN_ID_DESCRIPTION=ce;exports.ClaimDepositSchema=Te;exports.ClaimDepositZod=R;exports.DeployToVaultSchema=ge;exports.DeployToVaultZod=P;exports.DepositBtcSchema=fe;exports.DepositBtcZod=$;exports.ExchangeRateSchema=le;exports.ExchangeRateZod=S;exports.LOMBARD_ASSETS=C;exports.LOMBARD_ASSETS_GLOSSARY=wt;exports.LbtcApySchema=ye;exports.LbtcApyZod=J;exports.LbtcToBtcSchema=ue;exports.LbtcToBtcZod=I;exports.LbtcToBtcbSchema=he;exports.LbtcToBtcbZod=E;exports.MorphoBorrowSchema=Se;exports.MorphoBorrowZod=O;exports.MorphoLbtcMarketsSchema=ke;exports.MorphoLbtcMarketsZod=Q;exports.MorphoPositionSchema=Ie;exports.MorphoPositionZod=V;exports.MorphoRepaySchema=Le;exports.MorphoRepayZod=q;exports.MorphoSupplyCollateralSchema=_e;exports.MorphoSupplyCollateralZod=z;exports.OpportunitiesSchema=we;exports.OpportunitiesZod=F;exports.RedeemBtcbSchema=Ce;exports.RedeemBtcbZod=N;exports.SUPPORTED_CHAINS=G;exports.StakeSchema=pe;exports.StakeZod=L;exports.StrategiesSchema=be;exports.StrategiesZod=M;exports.TokenBalanceSchema=ve;exports.TokenBalanceZod=U;exports.TokenInfoSchema=Ae;exports.TokenInfoZod=X;exports.VaultWithdrawalSchema=Be;exports.VaultWithdrawalZod=D;exports.allTools=lt;exports.amount=B;exports.buildAssetGlossary=ie;exports.chainId=g;exports.checkFeeAuthorization=Ye;exports.evmAddress=b;exports.getBalance=qe;exports.getBtcbBalance=Fe;exports.getChainConfig=p;exports.getDepositBtcAddress=We;exports.getDepositStatusTool=ze;exports.getEarnPositions=rt;exports.getEarnStrategiesTool=He;exports.getEarnWithdrawalsTool=it;exports.getExchangeRate=Ue;exports.getLbtcApy=st;exports.getLbtcBalance=Ne;exports.getLbtcDefiOpportunitiesTool=je;exports.getLuxPoints=ct;exports.getMorphoLbtcMarkets=Me;exports.getMorphoPosition=Re;exports.getPositionsSummaryTool=dt;exports.getRedemptionStatusTool=Oe;exports.getTokenBalance=Ze;exports.getTokenInfo=Ve;exports.prepareBtcToBtcbDeposit=Ke;exports.prepareBtcToLbtcDeposit=Ge;exports.prepareBtcbToLbtcStake=Je;exports.prepareCancelEarnWithdrawal=nt;exports.prepareClaimLbtcDeposit=ot;exports.prepareEarnDeposit=tt;exports.prepareEarnWithdrawal=at;exports.prepareLbtcToBtc=Xe;exports.prepareLbtcToBtcb=Qe;exports.prepareMorphoBorrow=Pe;exports.prepareMorphoRepay=De;exports.prepareMorphoSupplyCollateral=$e;exports.prepareRedeemBtcb=et;exports.resolveAssetByAddress=ne;exports.resolveAssetByName=oe;exports.toolsByName=Zt;
package/dist/tools.d.ts CHANGED
@@ -53,7 +53,7 @@ export declare const getDepositStatusTool: ToolDefinition<{
53
53
  address: string;
54
54
  chainId: number;
55
55
  }>;
56
- export declare const getUnstakeStatusTool: ToolDefinition<{
56
+ export declare const getRedemptionStatusTool: ToolDefinition<{
57
57
  address: string;
58
58
  chainId: number;
59
59
  }>;
@@ -102,7 +102,7 @@ export declare const getTokenBalance: ToolDefinition<{
102
102
  chain: string;
103
103
  error?: string;
104
104
  }>;
105
- export declare const getStrategies: ToolDefinition<{
105
+ export declare const getEarnStrategiesTool: ToolDefinition<{
106
106
  chainId?: number;
107
107
  }, {
108
108
  strategies: Array<{
@@ -113,7 +113,7 @@ export declare const getStrategies: ToolDefinition<{
113
113
  }>;
114
114
  error?: string;
115
115
  }>;
116
- export declare const getOpportunities: ToolDefinition<{
116
+ export declare const getLbtcDefiOpportunitiesTool: ToolDefinition<{
117
117
  category?: string;
118
118
  chain?: string;
119
119
  protocol?: string;
@@ -151,7 +151,7 @@ export declare const checkFeeAuthorization: ToolDefinition<{
151
151
  expirationDate: string | null;
152
152
  note: string;
153
153
  }>;
154
- export declare const prepareBtcDeposit: ToolDefinition<{
154
+ export declare const prepareBtcToLbtcDeposit: ToolDefinition<{
155
155
  address: string;
156
156
  chainId: number;
157
157
  }, {
@@ -175,14 +175,17 @@ export declare const prepareBtcToBtcbDeposit: ToolDefinition<{
175
175
  };
176
176
  description: string;
177
177
  }>;
178
- export declare const prepareStake: ToolDefinition<{
178
+ export declare const prepareBtcbToLbtcStake: ToolDefinition<{
179
179
  amount: string;
180
180
  chainId: number;
181
181
  }, PreparedTx | ValidationFailure>;
182
- export declare const prepareUnstake: ToolDefinition<{
182
+ export declare const prepareLbtcToBtc: ToolDefinition<{
183
+ amount: string;
184
+ recipient: string;
185
+ chainId: number;
186
+ }, PreparedTx | ValidationFailure>;
187
+ export declare const prepareLbtcToBtcb: ToolDefinition<{
183
188
  amount: string;
184
- outputAsset: string;
185
- recipient?: string;
186
189
  chainId: number;
187
190
  }, PreparedTx | ValidationFailure>;
188
191
  export declare const prepareRedeemBtcb: ToolDefinition<{
@@ -190,11 +193,11 @@ export declare const prepareRedeemBtcb: ToolDefinition<{
190
193
  recipient: string;
191
194
  chainId: number;
192
195
  }, PreparedTx | ValidationFailure>;
193
- export declare const prepareDeployToVault: ToolDefinition<{
196
+ export declare const prepareEarnDeposit: ToolDefinition<{
194
197
  amount: string;
195
198
  chainId: number;
196
199
  }, PreparedTx | ValidationFailure>;
197
- export declare const prepareVaultWithdrawal: ToolDefinition<{
200
+ export declare const prepareEarnWithdrawal: ToolDefinition<{
198
201
  amount: string;
199
202
  address: string;
200
203
  chainId: number;
@@ -205,7 +208,7 @@ export declare const getLbtcApy: ToolDefinition<Record<string, never>, {
205
208
  description: string;
206
209
  error?: string;
207
210
  }>;
208
- export declare const getVaultPositions: ToolDefinition<{
211
+ export declare const getEarnPositions: ToolDefinition<{
209
212
  address: string;
210
213
  chainId: number;
211
214
  }, {
@@ -216,7 +219,7 @@ export declare const getVaultPositions: ToolDefinition<{
216
219
  chain: string;
217
220
  error?: string;
218
221
  }>;
219
- export declare const prepareClaimDeposit: ToolDefinition<{
222
+ export declare const prepareClaimLbtcDeposit: ToolDefinition<{
220
223
  depositTxHash: string;
221
224
  address: string;
222
225
  chainId: number;
@@ -232,11 +235,11 @@ export declare const prepareClaimDeposit: ToolDefinition<{
232
235
  description: string;
233
236
  error?: string;
234
237
  }>;
235
- export declare const prepareCancelWithdrawal: ToolDefinition<{
238
+ export declare const prepareCancelEarnWithdrawal: ToolDefinition<{
236
239
  address: string;
237
240
  chainId: number;
238
241
  }, PreparedTx | ValidationFailure>;
239
- export declare const getVaultWithdrawalsTool: ToolDefinition<{
242
+ export declare const getEarnWithdrawalsTool: ToolDefinition<{
240
243
  address: string;
241
244
  chainId: number;
242
245
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["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