Skip to main content

@cowprotocol/cow-sdk

Namespacesโ€‹

Enumerationsโ€‹

Classesโ€‹

Interfacesโ€‹

Type Aliasesโ€‹

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:47


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


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.
latestSettlementBlock?numberThe latest block on which a settlement has been processed. NOTE: Under certain conditions it is possible for a settlement to have been mined as part of block but not have yet been processed.
orders?AuctionOrder[]The solvable orders included in the auction.
prices?AuctionPrices-

Defined inโ€‹

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


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-
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.
receiverAddress | nullsee OrderParameters::receiver
sellAmountTokenAmountsee OrderParameters::sellAmount
sellTokenAddresssee OrderParameters::sellToken
sellTokenBalanceSellTokenSourcesee OrderParameters::sellTokenBalance
signatureSignature-
uidUID-
userFeeTokenAmountsee OrderParameters::feeAmount
validTonumbersee OrderParameters::validTo

Defined inโ€‹

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


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:14


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


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


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:64


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:24


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.
executedFeeAmountBigUintThe total amount of fees that have been executed for this order.
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?BigUint | nullSurplus 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:19


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โ€‹

NameType
factornumber
maxVolumeFactornumber

Defined inโ€‹

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


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


ProtocolAppDataโ€‹

ฦฌ ProtocolAppData: Object

Defined inโ€‹

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


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
callData?CallDataTransaction calldata that is executed on-chain if the settlement is executed.
clearingPrices?Record<string, BigUint>The prices of tokens for settled user orders as passed to the settlement contract.
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.
uninternalizedCallData?CallDataFull calldata as generated from the original solver output. It can be different from the executed transaction if part of the settlements are internalised (use internal liquidity in lieu of trading against on-chain liquidity). This field is omitted in case it coincides with callData.

Defined inโ€‹

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


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.
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:15


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:11


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:13


BUY_ETH_ADDRESSโ€‹

โ€ข Const BUY_ETH_ADDRESS: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"

Defined inโ€‹

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


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:51


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:36


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:41


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:80


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


ENVS_LISTโ€‹

โ€ข Const ENVS_LIST: CowEnv[]

The list of available environments.

Defined inโ€‹

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


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:46


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


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:47


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:36


TWAP_ADDRESSโ€‹

โ€ข Const TWAP_ADDRESS: "0x6cF1e9cA41f7611dEf408122793c358a3d11E5a5"

Defined inโ€‹

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


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


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


getBlockInfoโ€‹

โ–ธ getBlockInfo(provider): Promise<BlockInfo>

Parametersโ€‹

NameType
providerProvider

Returnsโ€‹

Promise<BlockInfo>

Defined inโ€‹

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


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


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:29


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:17

โ–ธ 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:18


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


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