@cowprotocol/cow-sdk
Namespacesโ
Enumerationsโ
- BuyTokenDestination
- DurationType
- EcdsaSigningScheme
- OrderClass
- OrderKind
- OrderQuoteSideKindBuy
- OrderQuoteSideKindSell
- OrderStatus
- PollResultCode
- PriceQuality
- ProofLocation
- SellTokenSource
- SigningScheme
- StartTimeValue
- SupportedChainId
Classesโ
- ConditionalOrder
- ConditionalOrderFactory
- CowError
- CowShedHooks
- Multiplexer
- OrderBookApi
- OrderBookApiError
- OrderSigningUtils
- SubgraphApi
- Twap
Interfacesโ
- ApiContext
- ConditionalOrderArguments
- EnrichedOrder
- FetchParams
- ICoWShedCall
- ICoWShedOptions
- IpfsConfig
- IsNotValid
- IsValid
- PollResultDontTryAgain
- PollResultSuccess
- PollResultTryAtEpoch
- PollResultTryNextBlock
- PollResultTryOnBlock
- PollResultUnexpectedError
- QuoteAmountsAndCosts
- RequestOptions
- SignOrderCancellationParams
- SignOrderCancellationsParams
- SignOrderParams
- TwapData
- TwapStruct
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: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โ
Name | Type |
---|---|
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โ
Name | Type | Description |
---|---|---|
block? | number | The 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? | number | The unique identifier of the auction. Increment whenever the backend creates a new auction. |
latestSettlementBlock? | number | The 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 | - |
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โ
Name | Type | Description |
---|---|---|
appData | AppDataHash | - |
buyAmount | TokenAmount | see OrderParameters::buyAmount |
buyToken | Address | see OrderParameters::buyToken |
buyTokenBalance | BuyTokenDestination | see OrderParameters::buyTokenBalance |
class | OrderClass | - |
created | string | Creation time of the order. Denominated in epoch seconds. |
executed | TokenAmount | Currently executed amount of sell/buy token, depending on the order kind. |
kind | OrderKind | see OrderParameters::kind |
owner | Address | - |
partiallyFillable | boolean | see OrderParameters::partiallyFillable |
postInteractions | InteractionData [] | The post-interactions that need to be executed after the execution of the order. |
preInteractions | InteractionData [] | The pre-interactions that need to be executed before the first execution of the order. |
protocolFees | FeePolicy [] | The fee policies that are used to compute the protocol fees for this order. |
quote? | Quote | A winning quote. |
receiver | Address | null | see OrderParameters::receiver |
sellAmount | TokenAmount | see OrderParameters::sellAmount |
sellToken | Address | see OrderParameters::sellToken |
sellTokenBalance | SellTokenSource | see OrderParameters::sellTokenBalance |
signature | Signature | - |
uid | UID | - |
validTo | number | see 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: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โ
Name | Type |
---|---|
blockNumber | number |
blockTimestamp | number |
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โ
Name | Type | Description |
---|---|---|
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โ
Name | Type | Description |
---|---|---|
type | type | - |
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:23
ConditionalOrderParamsโ
ฦฌ ConditionalOrderParams: Object
Type declarationโ
Name | Type |
---|---|
handler | string |
salt | string |
staticInput | string |
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โ
Name | Type |
---|---|
address | string |
factoryArgs? | { args : unknown [] ; argsType : string [] } |
factoryArgs.args | unknown [] |
factoryArgs.argsType | string [] |
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โ
Name | Type | Description |
---|---|---|
refundTxHash | TransactionHash | null | Specifies in which transaction the order was refunded. If this field is null the order was not yet refunded. |
userValidTo | number | Describes 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โ
Name | Type |
---|---|
buy | BigUint |
sell | BigUint |
Defined inโ
external/cow-sdk/src/order-book/generated/models/ExecutedAmounts.ts:7
ExecutedProtocolFeeโ
ฦฌ ExecutedProtocolFee: Object
Type declarationโ
Name | Type | Description |
---|---|---|
amount? | TokenAmount | Fee amount taken |
policy? | FeePolicy | - |
token? | Address | The token in which the fee is taken |
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โ
Name | Type |
---|---|
params | ConditionalOrderParams |
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โ
Name | Type |
---|---|
limit? | number |
offset? | number |
owner | Address |
Defined inโ
external/cow-sdk/src/order-book/api.ts:68
InteractionDataโ
ฦฌ InteractionData: Object
Type declarationโ
Name | Type | Description |
---|---|---|
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โ
Name | Type | Description |
---|---|---|
price? | number | Estimated price of the token. |
Defined inโ
external/cow-sdk/src/order-book/generated/models/NativePriceResponse.ts:9
OnchainOrderDataโ
ฦฌ OnchainOrderData: Object
Type declarationโ
Name | Type | Description |
---|---|---|
placementError? | placementError | Describes 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. |
sender | Address | If 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โ
Name | Type | Description |
---|---|---|
signature | EcdsaSignature | OrderCancellation signed by owner |
signingScheme | EcdsaSigningScheme | - |
Defined inโ
external/cow-sdk/src/order-book/generated/models/OrderCancellation.ts:13
OrderCancellationErrorโ
ฦฌ OrderCancellationError: Object
Type declarationโ
Name | Type |
---|---|
description | string |
errorType | errorType |
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โ
Name | Type | Description |
---|---|---|
orderUids? | UID [] | UIDs of orders to cancel. |
signature | EcdsaSignature | OrderCancellation signed by the owner. |
signingScheme | EcdsaSigningScheme | - |
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โ
Name | Type | Description |
---|---|---|
appData | AppData | AppDataHash | This field comes in two forms for backward compatibility. The hash form will eventually stop being accepted. |
appDataHash? | AppDataHash | null | May 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. |
buyAmount | TokenAmount | see OrderParameters::buyAmount |
buyToken | Address | see OrderParameters::buyToken |
buyTokenBalance? | BuyTokenDestination | see OrderParameters::buyTokenBalance |
feeAmount | TokenAmount | see OrderParameters::feeAmount |
from? | Address | null | If 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. |
kind | OrderKind | see OrderParameters::kind |
partiallyFillable | boolean | see OrderParameters::partiallyFillable |
quoteId? | number | null | Orders 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 | null | see OrderParameters::receiver |
sellAmount | TokenAmount | see OrderParameters::sellAmount |
sellToken | Address | see OrderParameters::sellToken |
sellTokenBalance? | SellTokenSource | see OrderParameters::sellTokenBalance |
signature | Signature | - |
signingScheme | SigningScheme | - |
validTo | number | see 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โ
Name | Type | Description |
---|---|---|
availableBalance? | TokenAmount | null | Unused field that is currently always set to null and will be removed in the future. Deprecated |
class | OrderClass | - |
creationDate | string | Creation time of the order. Encoded as ISO 8601 UTC. |
ethflowData? | EthflowData | - |
executedBuyAmount | BigUint | The total amount of buyToken that has been executed for this order. |
executedFeeAmount | BigUint | The total amount of fees that have been executed for this order. |
executedSellAmount | BigUint | The total amount of sellToken that has been executed for this order including fees. |
executedSellAmountBeforeFees | BigUint | The total amount of sellToken that has been executed for this order without fees. |
executedSurplusFee? | BigUint | null | Surplus fee that the limit order was executed with. |
fullAppData? | string | null | Full appData , which the contract-level appData is a hash of. See OrderCreation for more information. |
fullFeeAmount? | TokenAmount | Amount that the signed fee would be without subsidies. |
invalidated | boolean | Has this order been invalidated? |
isLiquidityOrder? | boolean | Liquidity 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? | OnchainOrderData | There is some data only available for orders that are placed on-chain. This data can be found in this object. |
onchainUser? | Address | This 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. |
owner | Address | - |
status | OrderStatus | Order status. |
uid | UID | - |
Defined inโ
external/cow-sdk/src/order-book/generated/models/OrderMetaData.ts:19
OrderParametersโ
ฦฌ OrderParameters: Object
Order parameters.
Type declarationโ
Name | Type | Description |
---|---|---|
appData | AppDataHash | - |
buyAmount | TokenAmount | Amount of buyToken to be bought in atoms. |
buyToken | Address | ERC-20 token to be bought. |
buyTokenBalance? | BuyTokenDestination | - |
feeAmount | TokenAmount | feeRatio * sellAmount + minimal_fee in atoms. |
kind | OrderKind | The kind is either a buy or sell order. |
partiallyFillable | boolean | Is the order fill-or-kill or partially fillable? |
receiver? | Address | null | An optional Ethereum address to receive the proceeds of the trade instead of the owner (i.e. the order signer). |
sellAmount | TokenAmount | Amount of sellToken to be sold in atoms. |
sellToken | Address | ERC-20 token to be sold. |
sellTokenBalance? | SellTokenSource | - |
signingScheme? | SigningScheme | - |
validTo | number | Unix 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โ
Name | Type |
---|---|
description | string |
errorType | errorType |
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โ
Name | Type | Description |
---|---|---|
expiration | string | Expiration date of the offered fee. Order service might not accept the fee after this expiration date. Encoded as ISO 8601 UTC. |
from? | Address | - |
id? | number | Quote ID linked to a quote to enable providing more metadata when analysing order slippage. |
quote | OrderParameters | - |
verified | boolean | Whether 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โ
Name | Type |
---|---|
chainId | SupportedChainId |
owner | string |
provider | providers.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โ
Name | Type |
---|---|
proofs | ProofWithParams [] |
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โ
Name | Type |
---|---|
description | string |
errorType | errorType |
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โ
Name | Type | Description |
---|---|---|
factor | number | - |
maxVolumeFactor | number | - |
quote | Quote | The best quote received. |
Defined inโ
external/cow-sdk/src/order-book/generated/models/PriceImprovement.ts:10
ProofStructโ
ฦฌ ProofStruct: Object
A struct for a proof that can be used with setRoot
and setRootWithContext
on a
ComposableCoW-enabled Safe.
Type declarationโ
Name | Type |
---|---|
data | string | "0x" |
location | ProofLocation |
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โ
Name | Type |
---|---|
params | ConditionalOrderParams |
proof | string [] |
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
Quoteโ
ฦฌ Quote: Object
A calculated order quote.
Type declarationโ
Name | Type | Description |
---|---|---|
buyAmount? | TokenAmount | The amount of the buy token. |
fee? | TokenAmount | The amount that needs to be paid, denominated in the sell token. |
sellAmount? | TokenAmount | The amount of the sell token. |
Defined inโ
external/cow-sdk/src/order-book/generated/models/Quote.ts:11
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โ
Name | Type |
---|---|
signature | string |
signingScheme | EcdsaSigningScheme |
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โ
Name | Type | Description |
---|---|---|
auction? | CompetitionAuction | - |
auctionId? | number | The ID of the auction the competition info is for. |
competitionSimulationBlock? | number | - |
gasPrice? | number | Gas price used for ranking solutions. |
liquidityCollectedBlock? | number | - |
solutions? | SolverSettlement [] | Maps from solver name to object describing that solver's settlement. |
transactionHash? | TransactionHash | null | The 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โ
Name | Type | Description |
---|---|---|
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? | number | The total objective value used for ranking solutions. |
orders? | { executedAmount? : BigUint ; id? : UID }[] | Touched orders. |
score? | BigUint | null | The score of the current auction as defined in CIP-20. It is null for old auctions. |
solver? | string | Name of the solver. |
solverAddress? | string | The 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โ
Name | Type |
---|---|
factor | number |
maxVolumeFactor | number |
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โ
Name | Type | Description |
---|---|---|
totalSurplus? | string | The 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โ
Name | Type | Description |
---|---|---|
blockNumber | number | Block in which trade occurred. |
buyAmount | TokenAmount | Total amount of buyToken received in this trade. |
buyToken | Address | Address of token bought. |
executedProtocolFees? | ExecutedProtocolFee [] | Executed protocol fees for this trade, together with the fee policies used. Listed in the order they got applied. |
logIndex | number | Index in which transaction was included in block. |
orderUid | UID | UID of the order matched by this trade. |
owner | Address | Address of trader. |
sellAmount | TokenAmount | Total amount of sellToken that has been executed for this trade (including fees). |
sellAmountBeforeFees | BigUint | The total amount of sellToken that has been executed for this order without fees. |
sellToken | Address | Address of token sold. |
txHash | TransactionHash | null | Transaction 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โ
Name | Type | Description |
---|---|---|
appData | string | Meta-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. |
buyToken | string | which token to buy |
receiver | string | who to send the tokens to |
sellToken | string | which 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โ
Name | Type |
---|---|
factor | number |
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
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: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โ
Name | Type |
---|---|
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โ
Name | Type |
---|---|
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
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
ORDER_BOOK_PROD_CONFIGโ
โข Const
ORDER_BOOK_PROD_CONFIG: ApiBaseUrls
An object containing production environment base URLs for each supported chainId
.
See
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
SUBGRAPH_PROD_CONFIGโ
โข Const
SUBGRAPH_PROD_CONFIG: SubgraphApiBaseUrls
CoW Protocol Production Subgraph API configuration.
See
- https://api.thegraph.com/subgraphs/name/cowprotocol/cow
- https://api.thegraph.com/subgraphs/name/cowprotocol/cow-gc
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
- https://api.thegraph.com/subgraphs/name/cowprotocol/cow-staging
- https://api.thegraph.com/subgraphs/name/cowprotocol/cow-gc-staging
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
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โ
Name | Type |
---|---|
address | string |
amount | BigNumber |
Returnsโ
string
Defined inโ
external/cow-sdk/src/composable/utils.ts:21
createSetDomainVerifierTxโ
โธ createSetDomainVerifierTx(domain
, verifier
): string
Parametersโ
Name | Type |
---|---|
domain | string |
verifier | string |
Returnsโ
string
Defined inโ
external/cow-sdk/src/composable/utils.ts:44
decodeParamsโ
โธ decodeParams(encoded
): ConditionalOrderParams
Decode the ConditionalOrderParams
for the conditional order.
Parametersโ
Name | Type | Description |
---|---|---|
encoded | string | The encoded conditional order. |
Returnsโ
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โ
Name | Type | Description |
---|---|---|
params | ConditionalOrderParams | The 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โ
Name | Type |
---|---|
epoch | number |
Returnsโ
string
Defined inโ
external/cow-sdk/src/composable/utils.ts:97
fromStructToOrderโ
โธ fromStructToOrder(order
): Order
Parametersโ
Name | Type |
---|---|
order | DataStruct |
Returnsโ
Order
Defined inโ
external/cow-sdk/src/composable/utils.ts:135
getBlockInfoโ
โธ getBlockInfo(provider
): Promise
<BlockInfo
>
Parametersโ
Name | Type |
---|---|
provider | Provider |
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โ
Name | Type |
---|---|
safe | string |
domain | string |
chainId | SupportedChainId |
provider | Provider |
Returnsโ
Promise
<string
>
Defined inโ
external/cow-sdk/src/composable/utils.ts:31
getQuoteAmountsAndCostsโ
โธ getQuoteAmountsAndCosts(params
): QuoteAmountsAndCosts
Parametersโ
Name | Type |
---|---|
params | Params |
Returnsโ
Defined inโ
external/cow-sdk/src/order-book/quoteAmountsAndCostsUtils.ts:14
isComposableCowโ
โธ isComposableCow(handler
, chainId
): boolean
Parametersโ
Name | Type |
---|---|
handler | string |
chainId | SupportedChainId |
Returnsโ
boolean
Defined inโ
external/cow-sdk/src/composable/utils.ts:27
isExtensibleFallbackHandlerโ
โธ isExtensibleFallbackHandler(handler
, chainId
): boolean
Parametersโ
Name | Type |
---|---|
handler | string |
chainId | SupportedChainId |
Returnsโ
boolean
Defined inโ
external/cow-sdk/src/composable/utils.ts:23
isValidAbiโ
โธ isValidAbi(types
, values
): boolean
Helper method for validating ABI types.
Parametersโ
Name | Type | Description |
---|---|---|
types | readonly (string | ParamType )[] | ABI types to validate against. |
values | any [] | 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โ
Name | Type |
---|---|
address | string |
Returnsโ
Record
<SupportedChainId
, string
>
Defined inโ
external/cow-sdk/src/common/consts.ts:32
mapSupportedNetworksโ
โธ mapSupportedNetworks<T
>(value
): Record
<SupportedChainId
, T
>
Type parametersโ
Name |
---|
T |
Parametersโ
Name | Type |
---|---|
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โ
Name | Type |
---|---|
value | T |
Returnsโ
Record
<SupportedChainId
, T
>
Defined inโ
external/cow-sdk/src/common/consts.ts:21
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โ
Name | Type | Description |
---|---|---|
baseUrl | string | The base URL of the API. |
ยซdestructuredยป | FetchParams | - |
rateLimiter | RateLimiter | The rate limiter to use. |
backoffOpts | Partial <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โ
Name | Type | Description |
---|---|---|
data | TwapData | As passed by the consumer of the API. |
Returnsโ
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โ
Name | Type |
---|---|
struct | TwapStruct |
Returnsโ
A formatted struct as expected by the smart contract.
Defined inโ
external/cow-sdk/src/composable/orderTypes/Twap.ts:580