Skip to main content

@cowprotocol/cow-sdk

Namespaces

Enumerations

Classes

Interfaces

Type Aliases

AccountAddress

Ƭ AccountAddress: `0x${string}`

Defined in

external/cow-sdk/src/trading/types.ts:18


Address

Ƭ Address: string

20 byte Ethereum address encoded as a hex with 0x prefix.

Defined in

external/cow-sdk/src/order-book/generated/models/Address.ts:8


ApiBaseUrls

Ƭ ApiBaseUrls: Record<SupportedChainId, string>

Defined in

external/cow-sdk/src/common/configs.ts:49


AppData

Ƭ AppData: string

The string encoding of a JSON object representing some appData. The format of the JSON expected in the appData field is defined here.

Defined in

external/cow-sdk/src/order-book/generated/models/AppData.ts:11


AppDataHash

Ƭ AppDataHash: string

32 bytes encoded as hex with 0x prefix. It's expected to be the hash of the stringified JSON object representing the appData.

Defined in

external/cow-sdk/src/order-book/generated/models/AppDataHash.ts:10


AppDataObject

Ƭ AppDataObject: Object

An appData document that is registered with the API.

Type declaration

NameType
fullAppData?AppData

Defined in

external/cow-sdk/src/order-book/generated/models/AppDataObject.ts:10


AppDataRootSchema

Ƭ AppDataRootSchema: latest.AppDataRootSchema

Defined in

external/cow-sdk/src/trading/types.ts:140


Auction

Ƭ Auction: Object

A batch auction for solving.

Type declaration

NameTypeDescription
block?numberThe block number for the auction. Orders and prices are guaranteed to be valid on this block. Proposed settlements should be valid for this block as well.
id?numberThe unique identifier of the auction. Increment whenever the backend creates a new auction.
orders?AuctionOrder[]The solvable orders included in the auction.
prices?AuctionPrices-
surplusCapturingJitOrderOwners?Address[]List of addresses on whose surplus will count towards the objective value of their solution (unlike other orders that were created by the solver).

Defined in

external/cow-sdk/src/order-book/generated/models/Auction.ts:13


AuctionOrder

Ƭ AuctionOrder: Object

A solvable order included in the current batch auction. Contains the data forwarded to solvers for solving.

Type declaration

NameTypeDescription
appDataAppDataHash-
buyAmountTokenAmountsee OrderParameters::buyAmount
buyTokenAddresssee OrderParameters::buyToken
buyTokenBalanceBuyTokenDestinationsee OrderParameters::buyTokenBalance
classOrderClass-
createdstringCreation time of the order. Denominated in epoch seconds.
executedTokenAmountCurrently executed amount of sell/buy token, depending on the order kind.
kindOrderKindsee OrderParameters::kind
ownerAddress-
partiallyFillablebooleansee OrderParameters::partiallyFillable
postInteractionsInteractionData[]The post-interactions that need to be executed after the execution of the order.
preInteractionsInteractionData[]The pre-interactions that need to be executed before the first execution of the order.
protocolFeesFeePolicy[]The fee policies that are used to compute the protocol fees for this order.
quote?QuoteA winning quote.
receiverAddress | nullsee OrderParameters::receiver
sellAmountTokenAmountsee OrderParameters::sellAmount
sellTokenAddresssee OrderParameters::sellToken
sellTokenBalanceSellTokenSourcesee OrderParameters::sellTokenBalance
signatureSignature-
uidUID-
validTonumbersee OrderParameters::validTo

Defined in

external/cow-sdk/src/order-book/generated/models/AuctionOrder.ts:22


AuctionPrices

Ƭ AuctionPrices: Record<string, BigUint>

The reference prices for all traded tokens in the auction as a mapping from token addresses to a price denominated in native token (i.e. 1e18 represents a token that trades one to one with the native token). These prices are used for solution competition for computing surplus and converting fees to native token.

Defined in

external/cow-sdk/src/order-book/generated/models/AuctionPrices.ts:11


BigUint

Ƭ BigUint: string

A big unsigned integer encoded in decimal.

Defined in

external/cow-sdk/src/order-book/generated/models/BigUint.ts:8


BlockInfo

Ƭ BlockInfo: Object

Type declaration

NameType
blockNumbernumber
blockTimestampnumber

Defined in

external/cow-sdk/src/composable/types.ts:102


CallData

Ƭ CallData: string

Some calldata sent to a contract in a transaction encoded as a hex with 0x prefix.

Defined in

external/cow-sdk/src/order-book/generated/models/CallData.ts:8


CompetitionAuction

Ƭ CompetitionAuction: Object

The components that describe a batch auction for the solver competition.

Type declaration

NameTypeDescription
orders?UID[]The UIDs of the orders included in the auction.
prices?AuctionPrices-

Defined in

external/cow-sdk/src/order-book/generated/models/CompetitionAuction.ts:12


CompetitionOrderStatus

Ƭ CompetitionOrderStatus: Object

Type declaration

NameTypeDescription
typetype-
value?{ executedAmounts?: ExecutedAmounts ; solver: string }[]A list of solvers who participated in the latest competition, sorted by score in ascending order, where the last element is the winner. The presence of executed amounts defines whether the solver provided a solution for the desired order.

Defined in

external/cow-sdk/src/order-book/generated/models/CompetitionOrderStatus.ts:7

external/cow-sdk/src/order-book/generated/models/CompetitionOrderStatus.ts:25


ConditionalOrderParams

Ƭ ConditionalOrderParams: Object

Type declaration

NameType
handlerstring
saltstring
staticInputstring

Defined in

external/cow-sdk/src/composable/types.ts:13


ConditionalOrderRegistry

Ƭ ConditionalOrderRegistry: Record<string, FromParams<unknown, unknown>>

Defined in

external/cow-sdk/src/composable/ConditionalOrderFactory.ts:5


ContextFactory

Ƭ ContextFactory: Object

A factory and it's arguments that are called at transaction mining time to generate the context for a conditional order(s).

This allows to support the case where conditional orders may want to commence validity at the time of transaction mining, like in the case of a TWAP executed by a DAO or Safe that takes a reasonable amount of time to aggregate signatures or collect votes.

Remarks

This is used in conjunction with setRootWithContext or createWithContext.

Type declaration

NameType
addressstring
factoryArgs?{ args: unknown[] ; argsType: string[] }
factoryArgs.argsunknown[]
factoryArgs.argsTypestring[]

Defined in

external/cow-sdk/src/composable/types.ts:44


CowEnv

Ƭ CowEnv: "prod" | "staging"

The environment to use for the Cow API.

Defined in

external/cow-sdk/src/common/configs.ts:35


DurationOfPart

Ƭ DurationOfPart: { durationType: AUTO } | { duration: BigNumber ; durationType: LIMIT_DURATION }

Defined in

external/cow-sdk/src/composable/orderTypes/Twap.ts:138


EcdsaSignature

Ƭ EcdsaSignature: string

65 bytes encoded as hex with 0x prefix. r || s || v from the spec.

Defined in

external/cow-sdk/src/order-book/generated/models/EcdsaSignature.ts:8


EthflowData

Ƭ EthflowData: Object

Provides the additional data for ethflow orders.

Type declaration

NameTypeDescription
refundTxHashTransactionHash | nullSpecifies in which transaction the order was refunded. If this field is null the order was not yet refunded.
userValidTonumberDescribes the validTo of an order ethflow order. NOTE: For ethflow orders, the validTo encoded in the smart contract is type(uint256).max.

Defined in

external/cow-sdk/src/order-book/generated/models/EthflowData.ts:10


ExecutedAmounts

Ƭ ExecutedAmounts: Object

Type declaration

NameType
buyBigUint
sellBigUint

Defined in

external/cow-sdk/src/order-book/generated/models/ExecutedAmounts.ts:7


ExecutedProtocolFee

Ƭ ExecutedProtocolFee: Object

Type declaration

NameType
amount?TokenAmount
policy?FeePolicy
token?Address

Defined in

external/cow-sdk/src/order-book/generated/models/ExecutedProtocolFee.ts:9


FeePolicy

Ƭ FeePolicy: Surplus | Volume | PriceImprovement

Defines the ways to calculate the protocol fee.

Defined in

external/cow-sdk/src/order-book/generated/models/FeePolicy.ts:12


FromParams

Ƭ FromParams<D, S>: (params: ConditionalOrderParams) => ConditionalOrder<D, S>

Type parameters

Name
D
S

Type declaration

▸ (params): ConditionalOrder<D, S>

Parameters
NameType
paramsConditionalOrderParams
Returns

ConditionalOrder<D, S>

Defined in

external/cow-sdk/src/composable/ConditionalOrderFactory.ts:4


GetOrdersRequest

Ƭ GetOrdersRequest: Object

The parameters for the getOrders request.

Type declaration

NameType
limit?number
offset?number
ownerAddress

Defined in

external/cow-sdk/src/order-book/api.ts:68


InteractionData

Ƭ InteractionData: Object

Type declaration

NameTypeDescription
call_data?CallData[]The call data to be used for the interaction.
target?Address-
value?TokenAmount-

Defined in

external/cow-sdk/src/order-book/generated/models/InteractionData.ts:9


IsValidResult

Ƭ IsValidResult: IsValid | IsNotValid

Defined in

external/cow-sdk/src/composable/types.ts:164


NativePriceResponse

Ƭ NativePriceResponse: Object

The estimated native price for the token

Type declaration

NameTypeDescription
price?numberEstimated price of the token.

Defined in

external/cow-sdk/src/order-book/generated/models/NativePriceResponse.ts:9


OnchainOrderData

Ƭ OnchainOrderData: Object

Type declaration

NameTypeDescription
placementError?placementErrorDescribes the error, if the order placement was not successful. This could happen, for example, if the validTo is too high, or no valid quote was found or generated.
senderAddressIf orders are placed as on-chain orders, the owner of the order might be a smart contract, but not the user placing the order. The actual user will be provided in this field.

Defined in

external/cow-sdk/src/order-book/generated/models/OnchainOrderData.ts:7

external/cow-sdk/src/order-book/generated/models/OnchainOrderData.ts:20


Order

Ƭ Order: OrderCreation & OrderMetaData

Defined in

external/cow-sdk/src/order-book/generated/models/Order.ts:8


OrderCancellation

Ƭ OrderCancellation: Object

EIP-712 signature of struct OrderCancellation(bytes orderUid) from the order's owner.

Type declaration

NameTypeDescription
signatureEcdsaSignatureOrderCancellation signed by owner
signingSchemeEcdsaSigningScheme-

Defined in

external/cow-sdk/src/order-book/generated/models/OrderCancellation.ts:13


OrderCancellationError

Ƭ OrderCancellationError: Object

Type declaration

NameType
descriptionstring
errorTypeerrorType

Defined in

external/cow-sdk/src/order-book/generated/models/OrderCancellationError.ts:5

external/cow-sdk/src/order-book/generated/models/OrderCancellationError.ts:10


OrderCancellations

Ƭ OrderCancellations: Object

EIP-712 signature of struct OrderCancellations { orderUid: bytes[] } from the order's owner.

Type declaration

NameTypeDescription
orderUids?UID[]UIDs of orders to cancel.
signatureEcdsaSignatureOrderCancellation signed by the owner.
signingSchemeEcdsaSigningScheme-

Defined in

external/cow-sdk/src/order-book/generated/models/OrderCancellations.ts:13


OrderCreation

Ƭ OrderCreation: Object

Data a user provides when creating a new order.

Type declaration

NameTypeDescription
appDataAppData | AppDataHashThis field comes in two forms for backward compatibility. The hash form will eventually stop being accepted.
appDataHash?AppDataHash | nullMay be set for debugging purposes. If set, this field is compared to what the backend internally calculates as the app data hash based on the contents of appData. If the hash does not match, an error is returned. If this field is set, then appData MUST be a string encoding of a JSON object.
buyAmountTokenAmountsee OrderParameters::buyAmount
buyTokenAddresssee OrderParameters::buyToken
buyTokenBalance?BuyTokenDestinationsee OrderParameters::buyTokenBalance
feeAmountTokenAmountsee OrderParameters::feeAmount
from?Address | nullIf set, the backend enforces that this address matches what is decoded as the signer of the signature. This helps catch errors with invalid signature encodings as the backend might otherwise silently work with an unexpected address that for example does not have any balance.
kindOrderKindsee OrderParameters::kind
partiallyFillablebooleansee OrderParameters::partiallyFillable
quoteId?number | nullOrders can optionally include a quote ID. This way the order can be linked to a quote and enable providing more metadata when analysing order slippage.
receiver?Address | nullsee OrderParameters::receiver
sellAmountTokenAmountsee OrderParameters::sellAmount
sellTokenAddresssee OrderParameters::sellToken
sellTokenBalance?SellTokenSourcesee OrderParameters::sellTokenBalance
signatureSignature-
signingSchemeSigningScheme-
validTonumbersee OrderParameters::validTo

Defined in

external/cow-sdk/src/order-book/generated/models/OrderCreation.ts:18


OrderMetaData

Ƭ OrderMetaData: Object

Extra order data that is returned to users when querying orders but not provided by users when creating orders.

Type declaration

NameTypeDescription
availableBalance?TokenAmount | nullUnused field that is currently always set to null and will be removed in the future. Deprecated
classOrderClass-
creationDatestringCreation time of the order. Encoded as ISO 8601 UTC.
ethflowData?EthflowData-
executedBuyAmountBigUintThe total amount of buyToken that has been executed for this order.
executedFee?BigUintTotal fee charged for execution of the order. Contains network fee and protocol fees.
executedFeeAmountBigUintThe total amount of fees that have been executed for this order.
executedFeeToken?AddressToken the executed fee was captured in.
executedSellAmountBigUintThe total amount of sellToken that has been executed for this order including fees.
executedSellAmountBeforeFeesBigUintThe total amount of sellToken that has been executed for this order without fees.
executedSurplusFee?BigUintSurplus fee that the limit order was executed with.
fullAppData?string | nullFull appData, which the contract-level appData is a hash of. See OrderCreation for more information.
fullFeeAmount?TokenAmountAmount that the signed fee would be without subsidies.
invalidatedbooleanHas this order been invalidated?
isLiquidityOrder?booleanLiquidity orders are functionally the same as normal smart contract orders but are not placed with the intent of actively getting traded. Instead they facilitate the trade of normal orders by allowing them to be matched against liquidity orders which uses less gas and can have better prices than external liquidity. As such liquidity orders will only be used in order to improve settlement of normal orders. They should not be expected to be traded otherwise and should not expect to get surplus.
onchainOrderData?OnchainOrderDataThere is some data only available for orders that are placed on-chain. This data can be found in this object.
onchainUser?AddressThis represents the actual trader of an on-chain order. ### ethflow orders In this case, the owner would be the EthFlow contract and not the actual trader.
ownerAddress-
statusOrderStatusOrder status.
uidUID-

Defined in

external/cow-sdk/src/order-book/generated/models/OrderMetaData.ts:18


OrderParameters

Ƭ OrderParameters: Object

Order parameters.

Type declaration

NameTypeDescription
appDataAppDataHash-
buyAmountTokenAmountAmount of buyToken to be bought in atoms.
buyTokenAddressERC-20 token to be bought.
buyTokenBalance?BuyTokenDestination-
feeAmountTokenAmountfeeRatio * sellAmount + minimal_fee in atoms.
kindOrderKindThe kind is either a buy or sell order.
partiallyFillablebooleanIs the order fill-or-kill or partially fillable?
receiver?Address | nullAn optional Ethereum address to receive the proceeds of the trade instead of the owner (i.e. the order signer).
sellAmountTokenAmountAmount of sellToken to be sold in atoms.
sellTokenAddressERC-20 token to be sold.
sellTokenBalance?SellTokenSource-
signingScheme?SigningScheme-
validTonumberUnix timestamp (uint32) until which the order is valid.

Defined in

external/cow-sdk/src/order-book/generated/models/OrderParameters.ts:16


OrderPostError

Ƭ OrderPostError: Object

Type declaration

NameType
descriptionstring
errorTypeerrorType

Defined in

external/cow-sdk/src/order-book/generated/models/OrderPostError.ts:5

external/cow-sdk/src/order-book/generated/models/OrderPostError.ts:10


OrderQuoteRequest

Ƭ OrderQuoteRequest: OrderQuoteSide & OrderQuoteValidity & { appData?: AppData | AppDataHash ; appDataHash?: AppDataHash ; buyToken: Address ; buyTokenBalance?: BuyTokenDestination ; from: Address ; onchainOrder?: any ; priceQuality?: PriceQuality ; receiver?: Address | null ; sellToken: Address ; sellTokenBalance?: SellTokenSource ; signingScheme?: SigningScheme }

Request fee and price quote.

Defined in

external/cow-sdk/src/order-book/generated/models/OrderQuoteRequest.ts:18


OrderQuoteResponse

Ƭ OrderQuoteResponse: Object

An order quoted by the backend that can be directly signed and submitted to the order creation backend.

Type declaration

NameTypeDescription
expirationstringExpiration date of the offered fee. Order service might not accept the fee after this expiration date. Encoded as ISO 8601 UTC.
from?Address-
id?numberQuote ID linked to a quote to enable providing more metadata when analysing order slippage.
quoteOrderParameters-
verifiedbooleanWhether it was possible to verify that the quoted amounts are accurate using a simulation.

Defined in

external/cow-sdk/src/order-book/generated/models/OrderQuoteResponse.ts:13


OrderQuoteSide

Ƭ OrderQuoteSide: { kind: OrderQuoteSideKindSell ; sellAmountBeforeFee: TokenAmount } | { kind: OrderQuoteSideKindSell ; sellAmountAfterFee: TokenAmount } | { buyAmountAfterFee: TokenAmount ; kind: OrderQuoteSideKindBuy }

The buy or sell side when quoting an order.

Defined in

external/cow-sdk/src/order-book/generated/models/OrderQuoteSide.ts:12


OrderQuoteValidity

Ƭ OrderQuoteValidity: { validTo?: number } | { validFor?: number }

The validity for the order.

Defined in

external/cow-sdk/src/order-book/generated/models/OrderQuoteValidity.ts:8


Orders

Ƭ Orders: Record<string, ConditionalOrder<unknown, unknown>>

Defined in

external/cow-sdk/src/composable/Multiplexer.ts:15


OwnerContext

Ƭ OwnerContext: Object

Type declaration

NameType
chainIdSupportedChainId
ownerstring
providerproviders.Provider

Defined in

external/cow-sdk/src/composable/types.ts:85


PartialApiContext

Ƭ PartialApiContext: Partial<ApiContext>

Override some properties of the ApiContext.

Defined in

external/cow-sdk/src/common/configs.ts:40


PayloadLocationEmitted

Ƭ PayloadLocationEmitted: Object

Payload for emitting a merkle root to a ComposableCoW-enabled Safe.

If setting ProofLocation.EMITTED, this type should be used as the data in the Proof struct.

Type declaration

NameType
proofsProofWithParams[]

Defined in

external/cow-sdk/src/composable/types.ts:70


PollParams

Ƭ PollParams: OwnerContext & { blockInfo?: BlockInfo ; offchainInput?: string ; orderBookApi: OrderBookApi ; proof?: string[] }

Defined in

external/cow-sdk/src/composable/types.ts:91


PollResult

Ƭ PollResult: PollResultSuccess | PollResultErrors

Defined in

external/cow-sdk/src/composable/types.ts:107


PollResultErrors

Ƭ PollResultErrors: PollResultTryNextBlock | PollResultTryOnBlock | PollResultTryAtEpoch | PollResultUnexpectedError | PollResultDontTryAgain

Defined in

external/cow-sdk/src/composable/types.ts:109


PreSignature

Ƭ PreSignature: string

Empty signature bytes. Used for "presign" signatures.

Defined in

external/cow-sdk/src/order-book/generated/models/PreSignature.ts:8


PriceEstimationError

Ƭ PriceEstimationError: Object

Type declaration

NameType
descriptionstring
errorTypeerrorType

Defined in

external/cow-sdk/src/order-book/generated/models/PriceEstimationError.ts:5

external/cow-sdk/src/order-book/generated/models/PriceEstimationError.ts:10


PriceImprovement

Ƭ PriceImprovement: Object

The protocol fee is taken as a percent of the order price improvement which is a difference between the executed price and the best quote.

Type declaration

NameTypeDescription
factornumber-
maxVolumeFactornumber-
quoteQuoteThe best quote received.

Defined in

external/cow-sdk/src/order-book/generated/models/PriceImprovement.ts:10


PrivateKey

Ƭ PrivateKey: string

Defined in

external/cow-sdk/src/trading/types.ts:17


ProofStruct

Ƭ ProofStruct: Object

A struct for a proof that can be used with setRoot and setRootWithContext on a ComposableCoW-enabled Safe.

Type declaration

NameType
datastring | "0x"
locationProofLocation

Defined in

external/cow-sdk/src/composable/types.ts:58


ProofWithParams

Ƭ ProofWithParams: Object

A proof for a conditional order and it's parameters.

Type declaration

NameType
paramsConditionalOrderParams
proofstring[]

Defined in

external/cow-sdk/src/composable/types.ts:78


Quote

Ƭ Quote: Object

A calculated order quote.

Type declaration

NameTypeDescription
buyAmount?TokenAmountThe amount of the buy token.
fee?TokenAmountThe amount that needs to be paid, denominated in the sell token.
sellAmount?TokenAmountThe amount of the sell token.

Defined in

external/cow-sdk/src/order-book/generated/models/Quote.ts:11


QuoterParameters

Ƭ QuoterParameters: Omit<TraderParameters, "signer"> & { account: AccountAddress }

Defined in

external/cow-sdk/src/trading/types.ts:83


Signature

Ƭ Signature: EcdsaSignature | PreSignature

A signature.

Defined in

external/cow-sdk/src/order-book/generated/models/Signature.ts:11


SigningResult

Ƭ SigningResult: Object

Encoded signature including signing scheme for the order.

Type declaration

NameType
signaturestring
signingSchemeEcdsaSigningScheme

Defined in

external/cow-sdk/src/order-signing/types.ts:13


SolverCompetitionResponse

Ƭ SolverCompetitionResponse: Object

The settlements submitted by every solver for a specific auction. The auctionId corresponds to the id external solvers are provided with.

Type declaration

NameTypeDescription
auction?CompetitionAuction-
auctionId?numberThe ID of the auction the competition info is for.
competitionSimulationBlock?number-
gasPrice?numberGas price used for ranking solutions.
liquidityCollectedBlock?number-
solutions?SolverSettlement[]Maps from solver name to object describing that solver's settlement.
transactionHash?TransactionHash | nullThe hash of the transaction that the winning solution of this info was submitted in.

Defined in

external/cow-sdk/src/order-book/generated/models/SolverCompetitionResponse.ts:15


SolverSettlement

Ƭ SolverSettlement: Object

Type declaration

NameTypeDescription
clearingPrices?Record<string, BigUint>The prices of tokens for settled user orders as passed to the settlement contract.
isWinner?booleanwhether the solution is a winner (received the right to get executed) or not
objective?{ cost?: number ; fees?: number ; gas?: number ; surplus?: number ; total?: number }-
objective.cost?number-
objective.fees?number-
objective.gas?number-
objective.surplus?number-
objective.total?numberThe total objective value used for ranking solutions.
orders?{ executedAmount?: BigUint ; id?: UID }[]Touched orders.
score?BigUint | nullThe score of the current auction as defined in CIP-20. It is null for old auctions.
solver?stringName of the solver.
solverAddress?stringThe address used by the solver to execute the settlement on-chain. This field is missing for old settlements, the zero address has been used instead.

Defined in

external/cow-sdk/src/order-book/generated/models/SolverSettlement.ts:8


StartTime

Ƭ StartTime: { startType: AT_MINING_TIME } | { epoch: BigNumber ; startType: AT_EPOCH }

Defined in

external/cow-sdk/src/composable/orderTypes/Twap.ts:147


Surplus

Ƭ Surplus: Object

The protocol fee is taken as a percent of the surplus.

Type declaration

NameType
factornumber
maxVolumeFactornumber

Defined in

external/cow-sdk/src/order-book/generated/models/Surplus.ts:8


TokenAmount

Ƭ TokenAmount: string

Amount of a token. uint256 encoded in decimal.

Defined in

external/cow-sdk/src/order-book/generated/models/TokenAmount.ts:8


TotalSurplus

Ƭ TotalSurplus: Object

The total surplus.

Type declaration

NameTypeDescription
totalSurplus?stringThe total surplus.

Defined in

external/cow-sdk/src/order-book/generated/models/TotalSurplus.ts:9


Trade

Ƭ Trade: Object

Trade data such as executed amounts, fees, orderUid and block number.

Type declaration

NameTypeDescription
blockNumbernumberBlock in which trade occurred.
buyAmountTokenAmountTotal amount of buyToken received in this trade.
buyTokenAddressAddress of token bought.
executedProtocolFees?ExecutedProtocolFee[]Executed protocol fees for this trade, together with the fee policies used. Listed in the order they got applied.
logIndexnumberIndex in which transaction was included in block.
orderUidUIDUID of the order matched by this trade.
ownerAddressAddress of trader.
sellAmountTokenAmountTotal amount of sellToken that has been executed for this trade (including fees).
sellAmountBeforeFeesBigUintThe total amount of sellToken that has been executed for this order without fees.
sellTokenAddressAddress of token sold.
txHashTransactionHash | nullTransaction hash of the corresponding settlement transaction containing the trade (if available).

Defined in

external/cow-sdk/src/order-book/generated/models/Trade.ts:16


TransactionHash

Ƭ TransactionHash: string

32 byte digest encoded as a hex with 0x prefix.

Defined in

external/cow-sdk/src/order-book/generated/models/TransactionHash.ts:8


TwapDataBase

Ƭ TwapDataBase: Object

Base parameters for a TWAP order. Shared by:

  • TwapStruct (modelling the contract's struct used for staticInput).
  • TwapData (modelling the friendly SDK interface).

Type declaration

NameTypeDescription
appDatastringMeta-data associated with the order. Normally would be the keccak256 hash of the document generated in http://github.com/cowprotocol/app-data This hash should have been uploaded to the API https://api.cow.fi/docs/#/default/put_api_v1_app_data__app_data_hash_ and potentially to other data availability protocols like IPFS.
buyTokenstringwhich token to buy
receiverstringwho to send the tokens to
sellTokenstringwhich token to sell

Defined in

external/cow-sdk/src/composable/orderTypes/Twap.ts:41


UID

Ƭ UID: string

Unique identifier for the order: 56 bytes encoded as hex with 0x prefix.

Bytes 0..32 are the order digest, bytes 30..52 the owner address and bytes 52..56 the expiry (validTo) as a uint32 unix epoch timestamp.

Defined in

external/cow-sdk/src/order-book/generated/models/UID.ts:12


UnsignedOrder

Ƭ UnsignedOrder: Omit<OrderParameters, "receiver"> & { receiver: string }

Unsigned order intent to be placed.

Defined in

external/cow-sdk/src/order-signing/types.ts:8


Volume

Ƭ Volume: Object

The protocol fee is taken as a percent of the order volume.

Type declaration

NameType
factornumber

Defined in

external/cow-sdk/src/order-book/generated/models/Volume.ts:8

Variables

ALL_SUPPORTED_CHAIN_IDS

Const ALL_SUPPORTED_CHAIN_IDS: SupportedChainId[]

The list of supported chains.

Defined in

external/cow-sdk/src/common/consts.ts:16


BARN_ETH_FLOW_ADDRESSES

Const BARN_ETH_FLOW_ADDRESSES: Record<SupportedChainId, string>

Defined in

external/cow-sdk/src/common/consts.ts:78


COMPOSABLE_COW

Const COMPOSABLE_COW: "0xfdaFc9d1902f4e0b84f65F49f244b32b31013b74"

Defined in

external/cow-sdk/src/common/consts.ts:5


COMPOSABLE_COW_CONTRACT_ADDRESS

Const COMPOSABLE_COW_CONTRACT_ADDRESS: Record<SupportedChainId, string>

An object containing the addresses of the ComposableCow contracts for each supported chain.

Defined in

external/cow-sdk/src/common/consts.ts:54


CONDITIONAL_ORDER_PARAMS_ABI

Const CONDITIONAL_ORDER_PARAMS_ABI: string[]

Defined in

external/cow-sdk/src/composable/utils.ts:19


COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS

Const COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS: Record<SupportedChainId, string>

An object containing the addresses of the CoW Protocol settlement contracts for each supported chain.

Defined in

external/cow-sdk/src/common/consts.ts:39


COW_PROTOCOL_VAULT_RELAYER_ADDRESS

Const COW_PROTOCOL_VAULT_RELAYER_ADDRESS: Record<SupportedChainId, string>

An object containing the addresses of the CoW Protocol Vault realyer contracts for each supported chain.

Defined in

external/cow-sdk/src/common/consts.ts:44


COW_SHED_712_TYPES

Const COW_SHED_712_TYPES: Object

Type declaration

NameType
Call{ name: string = 'target'; type: string = 'address' }[]
ExecuteHooks{ name: string = 'calls'; type: string = 'Call[]' }[]

Defined in

external/cow-sdk/src/cow-shed/types.ts:30


COW_SHED_FACTORY

Const COW_SHED_FACTORY: "0x00E989b87700514118Fa55326CD1cCE82faebEF6"

Defined in

external/cow-sdk/src/common/consts.ts:7


COW_SHED_IMPLEMENTATION

Const COW_SHED_IMPLEMENTATION: "0x2CFFA8cf11B90C9F437567b86352169dF4009F73"

Defined in

external/cow-sdk/src/common/consts.ts:8


COW_SHED_PROXY_INIT_CODE

Const COW_SHED_PROXY_INIT_CODE: "0x60a034608e57601f61037138819003918201601f19168301916001600160401b038311848410176093578084926040948552833981010312608e57604b602060458360a9565b920160a9565b6080527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc556040516102b490816100bd8239608051818181608f01526101720152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203608e5756fe60806040526004361015610018575b3661019457610194565b6000803560e01c908163025b22bc1461003b575063f851a4400361000e5761010d565b3461010a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010a5773ffffffffffffffffffffffffffffffffffffffff60043581811691828203610106577f0000000000000000000000000000000000000000000000000000000000000000163314600014610101577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8280a280f35b61023d565b8380fd5b80fd5b346101645760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610164576020610146610169565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b600080fd5b333003610101577f000000000000000000000000000000000000000000000000000000000000000090565b60ff7f68df44b1011761f481358c0f49a711192727fb02c377d697bcb0ea8ff8393ac0541615806101ef575b1561023d5760046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b507f400ada75000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000006000351614156101c0565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546000808092368280378136915af43d82803e1561027a573d90f35b3d90fdfea2646970667358221220c7c26ff3040b96a28e96d6d27b743972943aeaef81cc821544c5fe1e24f9b17264736f6c63430008190033"

Defined in

external/cow-sdk/src/cow-shed/proxyInitCode.ts:1


CURRENT_BLOCK_TIMESTAMP_FACTORY_ADDRESS

Const CURRENT_BLOCK_TIMESTAMP_FACTORY_ADDRESS: "0x52eD56Da04309Aca4c3FECC595298d80C2f16BAc"

The address of the CurrentBlockTimestampFactory contract

NOTE: This is used in the event that TWAP's have a t0 of 0.

Defined in

external/cow-sdk/src/composable/orderTypes/Twap.ts:26


DEFAULT_BACKOFF_OPTIONS

Const DEFAULT_BACKOFF_OPTIONS: BackoffOptions

The default backoff options for CoW Protocol's API

See

Backoff configuration: https://www.npmjs.com/package/@insertish/exponential-backoff

Defined in

external/cow-sdk/src/order-book/request.ts:41


DEFAULT_CONDITIONAL_ORDER_REGISTRY

Const DEFAULT_CONDITIONAL_ORDER_REGISTRY: ConditionalOrderRegistry

Defined in

external/cow-sdk/src/composable/orderTypes/index.ts:5


DEFAULT_COW_API_CONTEXT

Const DEFAULT_COW_API_CONTEXT: ApiContext

The default CoW Protocol API context.

Defined in

external/cow-sdk/src/common/configs.ts:86


DEFAULT_IPFS_READ_URI

Const DEFAULT_IPFS_READ_URI: "https://gnosis.mypinata.cloud/ipfs"

Defined in

external/cow-sdk/src/common/ipfs.ts:1


DEFAULT_IPFS_WRITE_URI

Const DEFAULT_IPFS_WRITE_URI: "https://api.pinata.cloud"

Defined in

external/cow-sdk/src/common/ipfs.ts:2


DEFAULT_LIMITER_OPTIONS

Const DEFAULT_LIMITER_OPTIONS: RateLimiterOpts

The default rate limiter options for CoW Protocol's API.

CAUTION: The CoW Protocol OrderBook API is limited to 5 requests per second per IP.

Defined in

external/cow-sdk/src/order-book/request.ts:59


DOMAIN_TYPE

Const DOMAIN_TYPE: Object

Type declaration

NameType
EIP712Domain{ name: string = 'name'; type: string = 'string' }[]

Defined in

external/cow-sdk/src/cow-shed/types.ts:21


ENVS_LIST

Const ENVS_LIST: CowEnv[]

The list of available environments.

Defined in

external/cow-sdk/src/common/configs.ts:81


ETH_ADDRESS

Const ETH_ADDRESS: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"

Defined in

external/cow-sdk/src/common/consts.ts:3


ETH_FLOW_ADDRESSES

Const ETH_FLOW_ADDRESSES: Record<SupportedChainId, string>

An object containing the addresses of ETH flow contracts for each supported chain.

Defined in

external/cow-sdk/src/common/consts.ts:70


EXTENSIBLE_FALLBACK_HANDLER

Const EXTENSIBLE_FALLBACK_HANDLER: "0x2f55e8b20D0B9FEFA187AA7d00B6Cbe563605bF5"

Defined in

external/cow-sdk/src/common/consts.ts:4


EXTENSIBLE_FALLBACK_HANDLER_CONTRACT_ADDRESS

Const EXTENSIBLE_FALLBACK_HANDLER_CONTRACT_ADDRESS: Record<SupportedChainId, string>

An object containing the addresses of the ExtensibleFallbackHandler contracts for each supported chain.

Defined in

external/cow-sdk/src/common/consts.ts:49


MAX_FREQUENCY

Const MAX_FREQUENCY: BigNumber

Defined in

external/cow-sdk/src/composable/orderTypes/Twap.ts:29


MAX_UINT32

Const MAX_UINT32: BigNumber

Defined in

external/cow-sdk/src/composable/orderTypes/Twap.ts:28


MAX_VALID_TO_EPOCH

Const MAX_VALID_TO_EPOCH: 4294967295

Defined in

external/cow-sdk/src/common/consts.ts:86


ORDER_BOOK_PROD_CONFIG

Const ORDER_BOOK_PROD_CONFIG: ApiBaseUrls

An object containing production environment base URLs for each supported chainId.

See

https://api.cow.fi/docs/#/

Defined in

external/cow-sdk/src/order-book/api.ts:38


ORDER_BOOK_STAGING_CONFIG

Const ORDER_BOOK_STAGING_CONFIG: ApiBaseUrls

An object containing staging environment base URLs for each supported chainId.

Defined in

external/cow-sdk/src/order-book/api.ts:49


ORDER_PRIMARY_TYPE

Const ORDER_PRIMARY_TYPE: "Order"

Defined in

external/cow-sdk/src/trading/types.ts:20


SUBGRAPH_PROD_CONFIG

Const SUBGRAPH_PROD_CONFIG: SubgraphApiBaseUrls

CoW Protocol Production Subgraph API configuration.

See

Defined in

external/cow-sdk/src/subgraph/api.ts:24


SUBGRAPH_STAGING_CONFIG

Const SUBGRAPH_STAGING_CONFIG: SubgraphApiBaseUrls

CoW Protocol Staging Subgraph API configuration.

Deprecated

See

Defined in

external/cow-sdk/src/subgraph/api.ts:38


TWAP_ADDRESS

Const TWAP_ADDRESS: "0x6cF1e9cA41f7611dEf408122793c358a3d11E5a5"

Defined in

external/cow-sdk/src/composable/orderTypes/Twap.ts:20


WRAPPED_NATIVE_CURRENCIES

Const WRAPPED_NATIVE_CURRENCIES: Record<SupportedChainId, string>

An object containing the addresses of wrapped native currencies for each supported chain.

Defined in

external/cow-sdk/src/common/consts.ts:59


logPrefix

Const logPrefix: "cow-sdk:"

Defined in

external/cow-sdk/src/common/cow-error.ts:10

Functions

DEFAULT_TOKEN_FORMATTER

DEFAULT_TOKEN_FORMATTER(address, amount): string

Parameters

NameType
addressstring
amountBigNumber

Returns

string

Defined in

external/cow-sdk/src/composable/utils.ts:21


buildAppData

buildAppData(«destructured», advancedParams?): Promise<AppDataInfo>

Parameters

NameType
«destructured»BuildAppDataParams
advancedParams?Partial<Omit<AppDataRootSchema, "version">>

Returns

Promise<AppDataInfo>

Defined in

external/cow-sdk/src/trading/appDataUtils.ts:5


calculateUniqueOrderId

calculateUniqueOrderId(chainId, order, checkEthFlowOrderExists?, env?): Promise<string>

Parameters

NameType
chainIdSupportedChainId
orderUnsignedOrder
checkEthFlowOrderExists?EthFlowOrderExistsCallback
env?CowEnv

Returns

Promise<string>

Defined in

external/cow-sdk/src/trading/calculateUniqueOrderId.ts:16


createSetDomainVerifierTx

createSetDomainVerifierTx(domain, verifier): string

Parameters

NameType
domainstring
verifierstring

Returns

string

Defined in

external/cow-sdk/src/composable/utils.ts:44


decodeParams

decodeParams(encoded): ConditionalOrderParams

Decode the ConditionalOrderParams for the conditional order.

Parameters

NameTypeDescription
encodedstringThe encoded conditional order.

Returns

ConditionalOrderParams

The decoded conditional order.

Defined in

external/cow-sdk/src/composable/utils.ts:68


encodeParams

encodeParams(params): string

Encode the ConditionalOrderParams for the conditional order.

Parameters

NameTypeDescription
paramsConditionalOrderParamsThe ConditionalOrderParams struct representing the conditional order as taken from a merkle tree.

Returns

string

The ABI-encoded conditional order.

See

ConditionalOrderParams

Defined in

external/cow-sdk/src/composable/utils.ts:58


formatEpoch

formatEpoch(epoch): string

Parameters

NameType
epochnumber

Returns

string

Defined in

external/cow-sdk/src/composable/utils.ts:97


fromStructToOrder

fromStructToOrder(order): Order

Parameters

NameType
orderDataStruct

Returns

Order

Defined in

external/cow-sdk/src/composable/utils.ts:135


generateAppDataFromDoc

generateAppDataFromDoc(doc): Promise<Pick<AppDataInfo, "fullAppData" | "appDataKeccak256">>

Parameters

NameType
docAppDataRootSchema

Returns

Promise<Pick<AppDataInfo, "fullAppData" | "appDataKeccak256">>

Defined in

external/cow-sdk/src/trading/appDataUtils.ts:28


getBlockInfo

getBlockInfo(provider): Promise<BlockInfo>

Parameters

NameType
providerProvider

Returns

Promise<BlockInfo>

Defined in

external/cow-sdk/src/composable/utils.ts:88


getCoWShedFactoryInterface

getCoWShedFactoryInterface(): CoWShedFactoryInterface

Returns

CoWShedFactoryInterface

Defined in

external/cow-sdk/src/cow-shed/contracts.ts:16


getCoWShedInterface

getCoWShedInterface(): CoWShedInterface

Returns

CoWShedInterface

Defined in

external/cow-sdk/src/cow-shed/contracts.ts:8


getDomainVerifier

getDomainVerifier(safe, domain, chainId, provider): Promise<string>

Parameters

NameType
safestring
domainstring
chainIdSupportedChainId
providerProvider

Returns

Promise<string>

Defined in

external/cow-sdk/src/composable/utils.ts:31


getEthFlowTransaction

getEthFlowTransaction(signer, appDataKeccak256, _params, networkCostsAmount?, checkEthFlowOrderExists?): Promise<{ orderId: string ; transaction: TransactionParams }>

Parameters

NameTypeDefault value
signerSignerundefined
appDataKeccak256stringundefined
_paramsLimitTradeParametersFromQuoteundefined
networkCostsAmountstring'0'
checkEthFlowOrderExists?EthFlowOrderExistsCallbackundefined

Returns

Promise<{ orderId: string ; transaction: TransactionParams }>

Defined in

external/cow-sdk/src/trading/getEthFlowTransaction.ts:17


getOrderToSign

getOrderToSign(«destructured», limitOrderParams, appDataKeccak256): UnsignedOrder

Parameters

NameType
«destructured»OrderToSignParams
limitOrderParamsLimitTradeParameters
appDataKeccak256string

Returns

UnsignedOrder

Defined in

external/cow-sdk/src/trading/getOrderToSign.ts:11


getPreSignTransaction

getPreSignTransaction(signer, chainId, account, orderId): Promise<TransactionParams>

Parameters

NameType
signerSigner
chainIdSupportedChainId
accountstring
orderIdstring

Returns

Promise<TransactionParams>

Defined in

external/cow-sdk/src/trading/getPreSignTransaction.ts:9


getQuote

getQuote(_tradeParameters, trader, advancedSettings?, _orderBookApi?): Promise<{ orderBookApi: OrderBookApi ; result: QuoteResults }>

Parameters

NameType
_tradeParametersTradeParameters
traderQuoterParameters
advancedSettings?SwapAdvancedSettings
_orderBookApi?OrderBookApi

Returns

Promise<{ orderBookApi: OrderBookApi ; result: QuoteResults }>

Defined in

external/cow-sdk/src/trading/getQuote.ts:39


getQuoteAmountsAndCosts

getQuoteAmountsAndCosts(params): QuoteAmountsAndCosts

Parameters

NameType
paramsParams

Returns

QuoteAmountsAndCosts

Defined in

external/cow-sdk/src/order-book/quoteAmountsAndCostsUtils.ts:14


getQuoteWithSigner

getQuoteWithSigner(swapParameters, advancedSettings?, orderBookApi?): Promise<QuoteResultsWithSigner>

Parameters

NameType
swapParametersSwapParameters
advancedSettings?SwapAdvancedSettings
orderBookApi?OrderBookApi

Returns

Promise<QuoteResultsWithSigner>

Defined in

external/cow-sdk/src/trading/getQuote.ts:139


isComposableCow

isComposableCow(handler, chainId): boolean

Parameters

NameType
handlerstring
chainIdSupportedChainId

Returns

boolean

Defined in

external/cow-sdk/src/composable/utils.ts:27


isExtensibleFallbackHandler

isExtensibleFallbackHandler(handler, chainId): boolean

Parameters

NameType
handlerstring
chainIdSupportedChainId

Returns

boolean

Defined in

external/cow-sdk/src/composable/utils.ts:23


isValidAbi

isValidAbi(types, values): boolean

Helper method for validating ABI types.

Parameters

NameTypeDescription
typesreadonly (string | ParamType)[]ABI types to validate against.
valuesany[]The values to validate.

Returns

boolean

Whether the values are valid ABI for the given types.

Defined in

external/cow-sdk/src/composable/utils.ts:79


mapAddressToSupportedNetworks

mapAddressToSupportedNetworks(address): Record<SupportedChainId, string>

Parameters

NameType
addressstring

Returns

Record<SupportedChainId, string>

Defined in

external/cow-sdk/src/common/consts.ts:32


mapQuoteAmountsAndCosts

mapQuoteAmountsAndCosts<T, R>(value, mapper): QuoteAmountsAndCosts<R>

Type parameters

Name
T
R

Parameters

NameType
valueQuoteAmountsAndCosts<T, { buyAmount: T ; sellAmount: T }>
mapper(value: T) => R

Returns

QuoteAmountsAndCosts<R>

Defined in

external/cow-sdk/src/trading/utils.ts:44


mapSupportedNetworks

mapSupportedNetworks<T>(value): Record<SupportedChainId, T>

Type parameters

Name
T

Parameters

NameType
value(chainId: SupportedChainId) => T

Returns

Record<SupportedChainId, T>

Defined in

external/cow-sdk/src/common/consts.ts:20

mapSupportedNetworks<T>(value): Record<SupportedChainId, T>

Type parameters

Name
T

Parameters

NameType
valueT

Returns

Record<SupportedChainId, T>

Defined in

external/cow-sdk/src/common/consts.ts:21


postCoWProtocolTrade

postCoWProtocolTrade(orderBookApi, signer, appData, params, networkCostsAmount?): Promise<string>

Parameters

NameTypeDefault value
orderBookApiOrderBookApiundefined
signerSignerundefined
appDataAppDataInfoundefined
paramsLimitTradeParametersundefined
networkCostsAmountstring'0'

Returns

Promise<string>

Defined in

external/cow-sdk/src/trading/postCoWProtocolTrade.ts:10


postLimitOrder

postLimitOrder(params, advancedSettings?, _orderBookApi?): Promise<string>

Parameters

NameType
paramsLimitOrderParameters
advancedSettings?LimitOrderAdvancedSettings
_orderBookApi?OrderBookApi

Returns

Promise<string>

Defined in

external/cow-sdk/src/trading/postLimitOrder.ts:8


postSellNativeCurrencyOrder

postSellNativeCurrencyOrder(orderBookApi, signer, appData, _params, networkCostsAmount?, checkEthFlowOrderExists?): Promise<{ orderId: string ; txHash: string }>

Parameters

NameTypeDefault value
orderBookApiOrderBookApiundefined
signerSignerundefined
appDataPick<AppDataInfo, "fullAppData" | "appDataKeccak256">undefined
_paramsLimitTradeParametersFromQuoteundefined
networkCostsAmountstring'0'
checkEthFlowOrderExists?EthFlowOrderExistsCallbackundefined

Returns

Promise<{ orderId: string ; txHash: string }>

Defined in

external/cow-sdk/src/trading/postSellNativeCurrencyOrder.ts:9


postSwapOrder

postSwapOrder(params, advancedSettings?): Promise<string>

Parameters

NameType
paramsSwapParameters
advancedSettings?SwapAdvancedSettings

Returns

Promise<string>

Defined in

external/cow-sdk/src/trading/postSwapOrder.ts:7


postSwapOrderFromQuote

postSwapOrderFromQuote(«destructured»): Promise<string>

Parameters

NameType
«destructured»QuoteResultsWithSigner

Returns

Promise<string>

Defined in

external/cow-sdk/src/trading/postSwapOrder.ts:11


request

request<T>(baseUrl, «destructured», rateLimiter, backoffOpts): Promise<T>

Helper function to make a rate-limited request to an API.

Type parameters

Name
T

Parameters

NameTypeDescription
baseUrlstringThe base URL of the API.
«destructured»FetchParams-
rateLimiterRateLimiterThe rate limiter to use.
backoffOptsPartial<IBackOffOptions>The backoff options to use.

Returns

Promise<T>

The response of the request.

Throws

If the API returns an error or if the request fails.

Defined in

external/cow-sdk/src/order-book/request.ts:104


swapParamsToLimitOrderParams

swapParamsToLimitOrderParams(params, quoteId, amounts): LimitTradeParametersFromQuote

Parameters

NameType
paramsTradeParameters
quoteIdnumber
amountsQuoteAmountsAndCosts<bigint, { buyAmount: bigint ; sellAmount: bigint }>

Returns

LimitTradeParametersFromQuote

Defined in

external/cow-sdk/src/trading/utils.ts:7


transformDataToStruct

transformDataToStruct(data): TwapStruct

Transform parameters into a native struct.

Parameters

NameTypeDescription
dataTwapDataAs passed by the consumer of the API.

Returns

TwapStruct

A formatted struct as expected by the smart contract.

Defined in

external/cow-sdk/src/composable/orderTypes/Twap.ts:538


transformStructToData

transformStructToData(struct): TwapData

Transform parameters into a TWAP order struct.

Parameters

NameType
structTwapStruct

Returns

TwapData

A formatted struct as expected by the smart contract.

Defined in

external/cow-sdk/src/composable/orderTypes/Twap.ts:580