Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump openapi #200

Merged
merged 2 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cowprotocol/cow-sdk",
"version": "5.0.0",
"version": "5.1.0",
"license": "(MIT OR Apache-2.0)",
"files": [
"/dist"
Expand All @@ -27,7 +27,7 @@
"prepare": "npm run build",
"prepublishOnly": "npm test && npm run lint",
"graphql:codegen": "graphql-codegen --config graphql-codegen.yml",
"swagger:codegen": " openapi --input https://raw.githubusercontent.com/cowprotocol/services/v2.227.1/crates/orderbook/openapi.yml --output src/order-book/generated --exportServices false --exportCore false",
"swagger:codegen": " openapi --input https://raw.githubusercontent.com/cowprotocol/services/v2.245.1/crates/orderbook/openapi.yml --output src/order-book/generated --exportServices false --exportCore false",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not getting from latest from master the openapi?

Copy link
Contributor Author

@mfw78 mfw78 Feb 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind, I'm only following the convention that was here previously.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think is nice that we use the latest. If swagger becomes autogenerated, and this uses the latest, we will notice when there's unmapped errors if we touch the lib

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm almost sure I suggested to use release rather than master to have a better control/tracking of where the current version comes from.
If pointing to a branch, it's harder to tell which commit was used as a reference.

If we don't want to use a release, should we use a commit on main branch instead?
This way the update is intentional and clear.

Copy link
Contributor

@anxolin anxolin Feb 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with pointing to a version, I actually think is safer and agree with it being more reproducible.
My only concern is, we won't remember to update from time to time, if this doesn't bother us on commit.

One alternative is to make a check if we use the latest version.

"typechain:codegen": "typechain --target ethers-v5 --out-dir ./src/composable/generated './abi/*.json'"
},
"dependencies": {
Expand Down
5 changes: 5 additions & 0 deletions src/order-book/generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type { AppData } from './models/AppData';
export type { AppDataHash } from './models/AppDataHash';
export type { AppDataObject } from './models/AppDataObject';
export type { Auction } from './models/Auction';
export type { AuctionOrder } from './models/AuctionOrder';
export type { AuctionPrices } from './models/AuctionPrices';
export type { BigUint } from './models/BigUint';
export { BuyTokenDestination } from './models/BuyTokenDestination';
Expand All @@ -15,6 +16,8 @@ export type { CompetitionAuction } from './models/CompetitionAuction';
export type { EcdsaSignature } from './models/EcdsaSignature';
export { EcdsaSigningScheme } from './models/EcdsaSigningScheme';
export type { EthflowData } from './models/EthflowData';
export type { FeePolicy } from './models/FeePolicy';
export type { InteractionData } from './models/InteractionData';
export type { NativePriceResponse } from './models/NativePriceResponse';
export { OnchainOrderData } from './models/OnchainOrderData';
export type { Order } from './models/Order';
Expand Down Expand Up @@ -44,8 +47,10 @@ export type { Signature } from './models/Signature';
export { SigningScheme } from './models/SigningScheme';
export type { SolverCompetitionResponse } from './models/SolverCompetitionResponse';
export type { SolverSettlement } from './models/SolverSettlement';
export type { Surplus } from './models/Surplus';
export type { TokenAmount } from './models/TokenAmount';
export type { TotalSurplus } from './models/TotalSurplus';
export type { Trade } from './models/Trade';
export type { TransactionHash } from './models/TransactionHash';
export type { UID } from './models/UID';
export type { Volume } from './models/Volume';
4 changes: 2 additions & 2 deletions src/order-book/generated/models/Auction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* tslint:disable */
/* eslint-disable */

import type { AuctionOrder } from './AuctionOrder';
import type { AuctionPrices } from './AuctionPrices';
import type { Order } from './Order';

/**
* A batch auction for solving.
Expand Down Expand Up @@ -33,7 +33,7 @@ export type Auction = {
* The solvable orders included in the auction.
*
*/
orders?: Array<Order>;
orders?: Array<AuctionOrder>;
prices?: AuctionPrices;
};

92 changes: 92 additions & 0 deletions src/order-book/generated/models/AuctionOrder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { Address } from './Address';
import type { AppDataHash } from './AppDataHash';
import type { BuyTokenDestination } from './BuyTokenDestination';
import type { FeePolicy } from './FeePolicy';
import type { InteractionData } from './InteractionData';
import type { OrderClass } from './OrderClass';
import type { OrderKind } from './OrderKind';
import type { SellTokenSource } from './SellTokenSource';
import type { Signature } from './Signature';
import type { TokenAmount } from './TokenAmount';
import type { UID } from './UID';

/**
* A solvable order included in the current batch auction. Contains the data forwarded to solvers for solving.
*
*/
export type AuctionOrder = {
uid: UID;
/**
* see `OrderParameters::sellToken`
*/
sellToken: Address;
/**
* see `OrderParameters::buyToken`
*/
buyToken: Address;
/**
* see `OrderParameters::sellAmount`
*/
sellAmount: TokenAmount;
/**
* see `OrderParameters::buyAmount`
*/
buyAmount: TokenAmount;
/**
* see `OrderParameters::feeAmount`
*/
userFee: TokenAmount;
/**
* see `OrderParameters::validTo`
*/
validTo: number;
/**
* see `OrderParameters::kind`
*/
kind: OrderKind;
/**
* see `OrderParameters::receiver`
*/
receiver: Address | null;
owner: Address;
/**
* see `OrderParameters::partiallyFillable`
*/
partiallyFillable: boolean;
/**
* Currently executed amount of sell/buy token, depending on the order kind.
*
*/
executed: TokenAmount;
/**
* The pre-interactions that need to be executed before the first execution of the order.
*
*/
preInteractions: Array<InteractionData>;
/**
* The post-interactions that need to be executed after the execution of the order.
*
*/
postInteractions: Array<InteractionData>;
/**
* see `OrderParameters::sellTokenBalance`
*/
sellTokenBalance: SellTokenSource;
/**
* see `OrderParameters::buyTokenBalance`
*/
buyTokenBalance: BuyTokenDestination;
class: OrderClass;
appData: AppDataHash;
signature: Signature;
/**
* The fee policies that are used to compute the protocol fees for this order.
*
*/
protocolFees: Array<FeePolicy>;
};

12 changes: 12 additions & 0 deletions src/order-book/generated/models/FeePolicy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { Surplus } from './Surplus';
import type { Volume } from './Volume';

/**
* Defines the ways to calculate the protocol fee.
*/
export type FeePolicy = (Surplus | Volume);

17 changes: 17 additions & 0 deletions src/order-book/generated/models/InteractionData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { Address } from './Address';
import type { CallData } from './CallData';
import type { TokenAmount } from './TokenAmount';

export type InteractionData = {
target?: Address;
value?: TokenAmount;
/**
* The call data to be used for the interaction.
*/
call_data?: Array<CallData>;
};

8 changes: 4 additions & 4 deletions src/order-book/generated/models/OrderPostError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ export namespace OrderPostError {
UNSUPPORTED_ORDER_TYPE = 'UnsupportedOrderType',
INSUFFICIENT_VALID_TO = 'InsufficientValidTo',
EXCESSIVE_VALID_TO = 'ExcessiveValidTo',
TRANSFER_ETH_TO_CONTRACT = 'TransferEthToContract',
INVALID_NATIVE_SELL_TOKEN_SAME_BUY_AND_SELL_TOKEN = 'InvalidNativeSellToken SameBuyAndSellToken',
UNSUPPORTED_SIGNATURE = 'UnsupportedSignature',
INVALID_NATIVE_SELL_TOKEN = 'InvalidNativeSellToken',
SAME_BUY_AND_SELL_TOKEN = 'SameBuyAndSellToken',
UNSUPPORTED_TOKEN = 'UnsupportedToken',
UNSUPPORTED_CUSTOM_INTERACTION_INVALID_APP_DATA = 'UnsupportedCustomInteraction InvalidAppData',
INVALID_APP_DATA = 'InvalidAppData',
APP_DATA_HASH_MISMATCH = 'AppDataHashMismatch',
APPDATA_FROM_MISMATCH = 'AppdataFromMismatch',
}


Expand Down
4 changes: 0 additions & 4 deletions src/order-book/generated/models/OrderQuoteRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ export type OrderQuoteRequest = (OrderQuoteSide & OrderQuoteValidity & {
*
*/
appDataHash?: AppDataHash;
/**
* Is the order fill-or-kill or partially fillable?
*/
partiallyFillable?: boolean;
sellTokenBalance?: SellTokenSource;
buyTokenBalance?: BuyTokenDestination;
from: Address;
Expand Down
5 changes: 5 additions & 0 deletions src/order-book/generated/models/OrderQuoteResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,10 @@ export type OrderQuoteResponse = {
*
*/
id?: number;
/**
* Whether it was possible to verify that the quoted amounts are accurate using a simulation.
*
*/
verified: boolean;
};

2 changes: 1 addition & 1 deletion src/order-book/generated/models/PriceQuality.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Optimal: The price estimate is chosen among all price estimates.
* Verified: The price estimate is chosen among all verified/simulated price estimates.
*
* **NOTE**: Orders are supposed to be created from `verified` price estimates.
* **NOTE**: Orders are supposed to be created from `verified` or `optimal` price estimates.
*
*/
export enum PriceQuality {
Expand Down
2 changes: 0 additions & 2 deletions src/order-book/generated/models/ReplaceOrderError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export namespace ReplaceOrderError {
INSUFFICIENT_VALID_TO = 'InsufficientValidTo',
EXCESSIVE_VALID_TO = 'ExcessiveValidTo',
INVALID_SIGNATURE = 'InvalidSignature',
TRANSFER_ETH_TO_CONTRACT = 'TransferEthToContract',
TRANSFER_SIMULATION_FAILED = 'TransferSimulationFailed',
UNSUPPORTED_TOKEN = 'UnsupportedToken',
WRONG_OWNER = 'WrongOwner',
Expand All @@ -30,7 +29,6 @@ export namespace ReplaceOrderError {
UNSUPPORTED_BUY_TOKEN_DESTINATION = 'UnsupportedBuyTokenDestination',
UNSUPPORTED_SELL_TOKEN_SOURCE = 'UnsupportedSellTokenSource',
UNSUPPORTED_ORDER_TYPE = 'UnsupportedOrderType',
UNSUPPORTED_SIGNATURE = 'UnsupportedSignature',
}


Expand Down
12 changes: 12 additions & 0 deletions src/order-book/generated/models/Surplus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

/**
* The protocol fee is taken as a percent of the surplus.
*/
export type Surplus = {
factor: number;
max_volume_factor: number;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request for backed: camelCase please?

};

11 changes: 11 additions & 0 deletions src/order-book/generated/models/Volume.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

/**
* The protocol fee is taken as a percent of the order volume.
*/
export type Volume = {
factor: number;
};

Loading