@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
- TradingSdk
- Twap
Interfaces
- ApiContext
- AppDataInfo
- BuildAppDataParams
- ConditionalOrderArguments
- EnrichedOrder
- EthFlowOrderExistsCallback
- FetchParams
- ICoWShedCall
- ICoWShedOptions
- IpfsConfig
- IsNotValid
- IsValid
- LimitOrderAdvancedSettings
- LimitOrderParameters
- LimitTradeParameters
- LimitTradeParametersFromQuote
- OrderTypedData
- PollResultDontTryAgain
- PollResultSuccess
- PollResultTryAtEpoch
- PollResultTryNextBlock
- PollResultTryOnBlock
- PollResultUnexpectedError
- QuoteAmountsAndCosts
- QuoteAndPost
- QuoteResults
- QuoteResultsSerialized
- RequestOptions
- SignOrderCancellationParams
- SignOrderCancellationsParams
- SignOrderParams
- SwapAdvancedSettings
- SwapParameters
- TradeBaseParameters
- TradeOptionalParameters
- TradeParameters
- TraderParameters
- TransactionParams
- TwapData
- TwapStruct
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
| Name | Type |
|---|---|
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
| 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. |
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: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
| 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:25
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 |
|---|---|
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
| 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: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
| 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. |
executedFee? | BigUint | Total fee charged for execution of the order. Contains network fee and protocol fees. |
executedFeeAmount | BigUint | The total amount of fees that have been executed for this order. |
executedFeeToken? | Address | Token the executed fee was captured in. |
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 | 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:18
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
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
| 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
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
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
| 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. |
isWinner? | boolean | whether 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? | 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: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
| 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
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
| 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
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
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
- 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
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
| Name | Type |
|---|---|
address | string |
amount | BigNumber |
Returns
string
Defined in
external/cow-sdk/src/composable/utils.ts:21
buildAppData
▸ buildAppData(«destructured», advancedParams?): Promise<AppDataInfo>
Parameters
| Name | Type |
|---|---|
«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
| Name | Type |
|---|---|
chainId | SupportedChainId |
order | UnsignedOrder |
checkEthFlowOrderExists? | EthFlowOrderExistsCallback |
env? | CowEnv |
Returns
Promise<string>
Defined in
external/cow-sdk/src/trading/calculateUniqueOrderId.ts:16
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
generateAppDataFromDoc
▸ generateAppDataFromDoc(doc): Promise<Pick<AppDataInfo, "fullAppData" | "appDataKeccak256">>
Parameters
| Name | Type |
|---|---|
doc | AppDataRootSchema |
Returns
Promise<Pick<AppDataInfo, "fullAppData" | "appDataKeccak256">>
Defined in
external/cow-sdk/src/trading/appDataUtils.ts:28
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
getEthFlowTransaction
▸ getEthFlowTransaction(signer, appDataKeccak256, _params, networkCostsAmount?, checkEthFlowOrderExists?): Promise<{ orderId: string ; transaction: TransactionParams }>
Parameters
| Name | Type | Default value |
|---|---|---|
signer | Signer | undefined |
appDataKeccak256 | string | undefined |
_params | LimitTradeParametersFromQuote | undefined |
networkCostsAmount | string | '0' |
checkEthFlowOrderExists? | EthFlowOrderExistsCallback | undefined |
Returns
Promise<{ orderId: string ; transaction: TransactionParams }>
Defined in
external/cow-sdk/src/trading/getEthFlowTransaction.ts:17
getOrderToSign
▸ getOrderToSign(«destructured», limitOrderParams, appDataKeccak256): UnsignedOrder
Parameters
| Name | Type |
|---|---|
«destructured» | OrderToSignParams |
limitOrderParams | LimitTradeParameters |
appDataKeccak256 | string |
Returns
Defined in
external/cow-sdk/src/trading/getOrderToSign.ts:11
getPreSignTransaction
▸ getPreSignTransaction(signer, chainId, account, orderId): Promise<TransactionParams>
Parameters
| Name | Type |
|---|---|
signer | Signer |
chainId | SupportedChainId |
account | string |
orderId | string |
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
| Name | Type |
|---|---|
_tradeParameters | TradeParameters |
trader | QuoterParameters |
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
| Name | Type |
|---|---|
params | Params |
Returns
Defined in
external/cow-sdk/src/order-book/quoteAmountsAndCostsUtils.ts:14
getQuoteWithSigner
▸ getQuoteWithSigner(swapParameters, advancedSettings?, orderBookApi?): Promise<QuoteResultsWithSigner>
Parameters
| Name | Type |
|---|---|
swapParameters | SwapParameters |
advancedSettings? | SwapAdvancedSettings |
orderBookApi? | OrderBookApi |
Returns
Promise<QuoteResultsWithSigner>
Defined in
external/cow-sdk/src/trading/getQuote.ts:139
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
mapQuoteAmountsAndCosts
▸ mapQuoteAmountsAndCosts<T, R>(value, mapper): QuoteAmountsAndCosts<R>
Type parameters
| Name |
|---|
T |
R |
Parameters
| Name | Type |
|---|---|
value | QuoteAmountsAndCosts<T, { buyAmount: T ; sellAmount: T }> |
mapper | (value: T) => R |
Returns
Defined in
external/cow-sdk/src/trading/utils.ts:44
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
postCoWProtocolTrade
▸ postCoWProtocolTrade(orderBookApi, signer, appData, params, networkCostsAmount?): Promise<string>
Parameters
| Name | Type | Default value |
|---|---|---|
orderBookApi | OrderBookApi | undefined |
signer | Signer | undefined |
appData | AppDataInfo | undefined |
params | LimitTradeParameters | undefined |
networkCostsAmount | string | '0' |
Returns
Promise<string>
Defined in
external/cow-sdk/src/trading/postCoWProtocolTrade.ts:10
postLimitOrder
▸ postLimitOrder(params, advancedSettings?, _orderBookApi?): Promise<string>
Parameters
| Name | Type |
|---|---|
params | LimitOrderParameters |
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
| Name | Type | Default value |
|---|---|---|
orderBookApi | OrderBookApi | undefined |
signer | Signer | undefined |
appData | Pick<AppDataInfo, "fullAppData" | "appDataKeccak256"> | undefined |
_params | LimitTradeParametersFromQuote | undefined |
networkCostsAmount | string | '0' |
checkEthFlowOrderExists? | EthFlowOrderExistsCallback | undefined |
Returns
Promise<{ orderId: string ; txHash: string }>
Defined in
external/cow-sdk/src/trading/postSellNativeCurrencyOrder.ts:9
postSwapOrder
▸ postSwapOrder(params, advancedSettings?): Promise<string>
Parameters
| Name | Type |
|---|---|
params | SwapParameters |
advancedSettings? | SwapAdvancedSettings |
Returns
Promise<string>
Defined in
external/cow-sdk/src/trading/postSwapOrder.ts:7
postSwapOrderFromQuote
▸ postSwapOrderFromQuote(«destructured»): Promise<string>
Parameters
| Name | Type |
|---|---|
«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
| 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
swapParamsToLimitOrderParams
▸ swapParamsToLimitOrderParams(params, quoteId, amounts): LimitTradeParametersFromQuote
Parameters
| Name | Type |
|---|---|
params | TradeParameters |
quoteId | number |
amounts | QuoteAmountsAndCosts<bigint, { buyAmount: bigint ; sellAmount: bigint }> |
Returns
Defined in
external/cow-sdk/src/trading/utils.ts:7
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