import { Permission } from "./index-CLa7bsge.mjs"; //#region src/swaps/types.d.ts /** * Chain IDs where the CowOrderSigner contract is deployed. * This is a subset of chains supported by cow-sdk. * * TODO: Deploy CowOrderSigner contracts to these additional cow-sdk chains: * - LENS (232) * - */ declare enum SupportedChainId { MAINNET = 1, GNOSIS_CHAIN = 100, ARBITRUM_ONE = 42161, BASE = 8453, AVALANCHE = 43114, POLYGON = 137, BNB = 56, PLASMA = 9745, LINEA = 59144, SEPOLIA = 11155111, } interface SellOrderRequest { kind: "sell"; sellAmountBeforeFee: bigint; } interface BuyOrderRequest { kind: "buy"; buyAmountAfterFee: bigint; } /** * Request parameters for getting a CowSwap quote. */ type QuoteRequest = (SellOrderRequest | BuyOrderRequest) & { sellToken: `0x${string}`; buyToken: `0x${string}`; receiver?: `0x${string}` | null; validTo?: number; partiallyFillable?: boolean; sellTokenBalance?: "erc20" | "external" | "internal"; buyTokenBalance?: "erc20" | "internal"; priceQuality?: "fast" | "optimal"; chainId: SupportedChainId; rolesModifier: `0x${string}`; roleKey: `0x${string}`; /** Address of the avatar (Safe) the rolesModifier is attached to. Used as the order's `from`. */ avatar: `0x${string}`; /** Address of the rolesModifier owner. Used to resolve the partner fee license. */ owner: `0x${string}`; }; /** * Quote returned by getCowQuote, used as input for signCowOrder and postCowOrder. */ type Quote = { sellToken: `0x${string}`; buyToken: `0x${string}`; receiver: `0x${string}`; sellAmount: string; buyAmount: string; validTo: number; appData: string; appDataHash: string; networkCostsAmount: string; kind: "sell" | "buy"; partiallyFillable: boolean; sellTokenBalance: "erc20" | "external" | "internal"; buyTokenBalance: "erc20" | "internal"; from: `0x${string}`; chainId: SupportedChainId; rolesModifier: `0x${string}`; roleKey: `0x${string}`; }; /** * Advanced options for getCowQuote. */ interface AdvancedOptions { appCode?: string; environment?: string; } //#endregion //#region src/swaps/allowCowOrderSigning.d.ts /** * Returns permissions allowing the avatar to sign the specified CowSwap orders. * * When "native" is specified in the sell or buy arrays, the function automatically: * - Replaces "native" with the chain's wrapped native token (e.g., WETH) for order signing * - Adds WETH.deposit() permission when native is in sell (to wrap native tokens before selling) * - Adds WETH.withdraw() permission when native is in buy (to unwrap received tokens) */ declare const allowCowOrderSigning: ({ chainId, sell, buy, receiver, approveAllowance, buyAllowance, sellAllowance, allowBalancerBalanceAccess }: { /** The chain ID where the swap will be executed. */ chainId: SupportedChainId; sell: (`0x${string}` | "native")[]; buy: (`0x${string}` | "native")[]; /** Defaults to the avatar of the Roles Modifier. */ receiver?: `0x${string}`; /** Allowance key to restrict approve amounts across sell tokens. If not provided, infinite approvals are allowed. */ approveAllowance?: `0x${string}`; /** Allowance key to restrict buy amount within allowance. If not provided, no buy amount restriction is applied. */ buyAllowance?: `0x${string}`; /** Allowance key to restrict sell amount within allowance. If not provided, no sell amount restriction is applied. */ sellAllowance?: `0x${string}`; /** If set to true, swaps can withdraw and deposit Balancer internal token balances of the avatar. */ allowBalancerBalanceAccess?: boolean; }) => Permission[]; //#endregion //#region src/swaps/getCowQuote.d.ts /** * Gets a quote for a CowSwap order. The result can be used as input for `signCowOrder` and `postCowOrder`. */ declare const getCowQuote: (quoteRequest: QuoteRequest, advancedOptions?: AdvancedOptions) => Promise; //#endregion //#region src/swaps/encodeSignOrder.d.ts /** Encodes a signOrder call to the CowswapOrderSigner contract */ declare const encodeSignOrder: (quote: Quote) => `0x${string}`; //#endregion //#region src/swaps/signCowOrder.d.ts /** * Encodes the call to the Roles Modifier to make the avatar sign the given CowSwap order. * Should be used in conjunction with `postCowOrder`. */ declare const signCowOrder: (quote: Quote) => { to: `0x${string}`; data: `0x${string}`; value: 0; chainId: SupportedChainId; }; //#endregion //#region src/swaps/postCowOrder.d.ts /** * Posts a CowSwap order to the Cow order book API. * Should be used in conjunction with `signCowOrder`. * @returns A promise that resolves to the orderId */ declare const postCowOrder: (quote: Quote) => Promise; //#endregion export { type AdvancedOptions, type Quote, type QuoteRequest, SupportedChainId, allowCowOrderSigning, encodeSignOrder, getCowQuote, postCowOrder, signCowOrder }; //# sourceMappingURL=swaps.d.mts.map