From e227665341eeff50ba21a3a48877989442f07318 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Tue, 19 Nov 2024 19:27:35 +0500 Subject: [PATCH 01/31] feat: trade api getQuote --- apps/api/src/app/inversify.config.ts | 6 + .../slippageTolerance.ts | 12 +- .../src/app/routes/__chainId/trade/README.md | 19 + .../app/routes/__chainId/trade/getQuote.ts | 64 ++ .../src/app/routes/__chainId/trade/schemas.ts | 40 + .../trade/serializeQuoteAmountsAndCosts.ts | 32 + .../LimitOrderAdvancedSettings.ts | 228 +++++ .../tradingSchemas/LimitTradeParameters.ts | 90 ++ .../tradingSchemas/QuoteResultsSerialized.ts | 684 ++++++++++++++ .../trade/tradingSchemas/QuoterParameters.ts | 30 + .../tradingSchemas/SwapAdvancedSettings.ts | 334 +++++++ .../trade/tradingSchemas/TradeParameters.ts | 79 ++ apps/api/src/app/schemas.ts | 15 +- .../src/TradingService/TradingService.ts | 16 + libs/services/src/index.ts | 3 +- package.json | 5 +- yarn.lock | 860 ++++++++++++++---- 17 files changed, 2343 insertions(+), 174 deletions(-) create mode 100644 apps/api/src/app/routes/__chainId/trade/README.md create mode 100644 apps/api/src/app/routes/__chainId/trade/getQuote.ts create mode 100644 apps/api/src/app/routes/__chainId/trade/schemas.ts create mode 100644 apps/api/src/app/routes/__chainId/trade/serializeQuoteAmountsAndCosts.ts create mode 100644 apps/api/src/app/routes/__chainId/trade/tradingSchemas/LimitOrderAdvancedSettings.ts create mode 100644 apps/api/src/app/routes/__chainId/trade/tradingSchemas/LimitTradeParameters.ts create mode 100644 apps/api/src/app/routes/__chainId/trade/tradingSchemas/QuoteResultsSerialized.ts create mode 100644 apps/api/src/app/routes/__chainId/trade/tradingSchemas/QuoterParameters.ts create mode 100644 apps/api/src/app/routes/__chainId/trade/tradingSchemas/SwapAdvancedSettings.ts create mode 100644 apps/api/src/app/routes/__chainId/trade/tradingSchemas/TradeParameters.ts create mode 100644 libs/services/src/TradingService/TradingService.ts diff --git a/apps/api/src/app/inversify.config.ts b/apps/api/src/app/inversify.config.ts index 831d594c..ad7f18d0 100644 --- a/apps/api/src/app/inversify.config.ts +++ b/apps/api/src/app/inversify.config.ts @@ -39,12 +39,14 @@ import { SlippageServiceMain, TokenHolderService, TokenHolderServiceMain, + TradingService, UsdService, UsdServiceMain, simulationServiceSymbol, slippageServiceSymbol, tokenHolderServiceSymbol, usdServiceSymbol, + tradingServiceSymbol } from '@cowprotocol/services'; import ms from 'ms'; @@ -176,6 +178,10 @@ function getApiContainer(): Container { .bind(simulationServiceSymbol) .to(SimulationService); + apiContainer + .bind(tradingServiceSymbol) + .to(TradingService); + return apiContainer; } diff --git a/apps/api/src/app/routes/__chainId/markets/__baseTokenAddress-__quoteTokenAddress/slippageTolerance.ts b/apps/api/src/app/routes/__chainId/markets/__baseTokenAddress-__quoteTokenAddress/slippageTolerance.ts index 12073ebf..66315f1f 100644 --- a/apps/api/src/app/routes/__chainId/markets/__baseTokenAddress-__quoteTokenAddress/slippageTolerance.ts +++ b/apps/api/src/app/routes/__chainId/markets/__baseTokenAddress-__quoteTokenAddress/slippageTolerance.ts @@ -3,7 +3,7 @@ import { slippageServiceSymbol, VolatilityDetails, } from '@cowprotocol/services'; -import { ChainIdSchema, ETHEREUM_ADDRESS_PATTERN } from '../../../../schemas'; +import { ChainIdSchema, ETHEREUM_ADDRESS_PATTERN, SlippageSchema } from '../../../../schemas'; import { FastifyPluginAsync } from 'fastify'; import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { apiContainer } from '../../../../inversify.config'; @@ -52,15 +52,7 @@ const successSchema = { required: ['slippageBps'], additionalProperties: false, properties: { - slippageBps: { - title: 'Slippage tolerance in basis points', - description: - 'Slippage tolerance in basis points. One basis point is equivalent to 0.01% (1/100th of a percent)', - type: 'number', - examples: [50, 100, 200], - minimum: 0, - maximum: 10000, - }, + slippageBps: SlippageSchema, }, } as const satisfies JSONSchema; diff --git a/apps/api/src/app/routes/__chainId/trade/README.md b/apps/api/src/app/routes/__chainId/trade/README.md new file mode 100644 index 00000000..8d30240a --- /dev/null +++ b/apps/api/src/app/routes/__chainId/trade/README.md @@ -0,0 +1,19 @@ +# Example + +```ts +fetch('http://127.0.0.1:8080/1/trade/getQuote', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ + trader: { + account: '0xfb3c7eb936cAA12B5A884d612393969A557d4307', + appCode: 'test1', + chainId: 1, + }, + params: { + kind: 'sell', + sellToken: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + buyToken: "0xdef1ca1fb7fbcdc777520aa7f396b4e015f497ab", + sellTokenDecimals: 18, + buyTokenDecimals: 18, + amount: '12000000000000000' + } +})}) +``` \ No newline at end of file diff --git a/apps/api/src/app/routes/__chainId/trade/getQuote.ts b/apps/api/src/app/routes/__chainId/trade/getQuote.ts new file mode 100644 index 00000000..9118c6a8 --- /dev/null +++ b/apps/api/src/app/routes/__chainId/trade/getQuote.ts @@ -0,0 +1,64 @@ +import { FastifyPluginAsync } from 'fastify'; + +import { FromSchema } from 'json-schema-to-ts'; +import { apiContainer } from '../../../inversify.config'; +import { + TradingService, + tradingServiceSymbol +} from '@cowprotocol/services'; + +import { serializeQuoteAmountsAndCosts } from './serializeQuoteAmountsAndCosts'; +import { bodySchema, errorSchema, routeSchema, successSchema } from './schemas'; + + +type RouteSchema = FromSchema; +type SuccessSchema = FromSchema; +type BodySchema = FromSchema; +type ErrorSchema = FromSchema; + +const tradingService: TradingService = apiContainer.get( + tradingServiceSymbol +); + +const root: FastifyPluginAsync = async (fastify): Promise => { + fastify.post<{ + Params: RouteSchema; + Reply: SuccessSchema | ErrorSchema; + Body: BodySchema; + }>( + '/getQuote', + { + schema: { + body: bodySchema, + response: { + '2XX': successSchema, + '400': errorSchema, + }, + }, + }, + async function (request, reply) { + const { chainId } = request.params; + + const { trader, params } = request.body + + try { + const result = await tradingService.getQuote( + { + ...trader as Parameters[0], + chainId + }, + params as Parameters[1] + ); + + reply.send({ + ...result, + amountsAndCosts: serializeQuoteAmountsAndCosts(result.amountsAndCosts) + }); + } catch (e) { + reply.code(500).send({ message: (e as Error).message }); + } + } + ); +}; + +export default root; \ No newline at end of file diff --git a/apps/api/src/app/routes/__chainId/trade/schemas.ts b/apps/api/src/app/routes/__chainId/trade/schemas.ts new file mode 100644 index 00000000..7975fa8c --- /dev/null +++ b/apps/api/src/app/routes/__chainId/trade/schemas.ts @@ -0,0 +1,40 @@ +import { ChainIdSchema } from '../../../schemas'; +import { JSONSchema } from 'json-schema-to-ts'; + +import QuoterParametersSchema from './tradingSchemas/QuoterParameters'; +import TradeParametersSchema from './tradingSchemas/TradeParameters'; +import QuoteResultsSchema from './tradingSchemas/QuoteResultsSerialized'; + +export const routeSchema = { + type: 'object', + required: ['chainId'], + additionalProperties: false, + properties: { + chainId: ChainIdSchema, + }, +} as const satisfies JSONSchema; + +export const bodySchema = { + type: 'object', + required: ['trader'], + additionalProperties: false, + properties: { + trader: QuoterParametersSchema, + params: TradeParametersSchema + }, +} as const satisfies JSONSchema; + +export const successSchema = QuoteResultsSchema; + +export const errorSchema = { + type: 'object', + required: ['message'], + additionalProperties: false, + properties: { + message: { + title: 'Message', + description: 'Message describing the error.', + type: 'string', + }, + }, +} as const satisfies JSONSchema; \ No newline at end of file diff --git a/apps/api/src/app/routes/__chainId/trade/serializeQuoteAmountsAndCosts.ts b/apps/api/src/app/routes/__chainId/trade/serializeQuoteAmountsAndCosts.ts new file mode 100644 index 00000000..04a61d06 --- /dev/null +++ b/apps/api/src/app/routes/__chainId/trade/serializeQuoteAmountsAndCosts.ts @@ -0,0 +1,32 @@ +import { QuoteAmountsAndCosts } from '@cowprotocol/cow-sdk'; + +export function serializeQuoteAmountsAndCosts(value: QuoteAmountsAndCosts): QuoteAmountsAndCosts { + const { costs: { networkFee, partnerFee } } = value + + return { + ...value, + costs: { + ...value.costs, + networkFee: { + ...networkFee, + amountInSellCurrency: networkFee.amountInSellCurrency.toString(), + amountInBuyCurrency: networkFee.amountInBuyCurrency.toString() + }, + partnerFee: { + ...partnerFee, + amount: partnerFee.amount.toString() + } + }, + beforeNetworkCosts: serializeAmounts(value.beforeNetworkCosts), + afterNetworkCosts: serializeAmounts(value.afterNetworkCosts), + afterPartnerFees: serializeAmounts(value.afterPartnerFees), + afterSlippage: serializeAmounts(value.afterSlippage) + } +} + +function serializeAmounts(value: {sellAmount: bigint; buyAmount: bigint}): {sellAmount: string; buyAmount: string} { + return { + sellAmount: value.sellAmount.toString(), + buyAmount: value.buyAmount.toString() + } +} diff --git a/apps/api/src/app/routes/__chainId/trade/tradingSchemas/LimitOrderAdvancedSettings.ts b/apps/api/src/app/routes/__chainId/trade/tradingSchemas/LimitOrderAdvancedSettings.ts new file mode 100644 index 00000000..e3a18f2c --- /dev/null +++ b/apps/api/src/app/routes/__chainId/trade/tradingSchemas/LimitOrderAdvancedSettings.ts @@ -0,0 +1,228 @@ +export default { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "appData": { + "type": "object", + "properties": { + "appCode": { + "type": "string", + "description": "The code identifying the CLI, UI, service generating the order." + }, + "environment": { + "type": "string", + "description": "Environment from which the order came from." + }, + "metadata": { + "type": "object", + "properties": { + "signer": { + "type": "string", + "description": "The address of the trader who signs the CoW Swap order. This field should normally be omitted; it is recommended to use it if the signer is a smart-contract wallet using EIP-1271 signatures." + }, + "referrer": { + "type": "object", + "properties": { + "address": { + "type": "string" + } + }, + "required": [ + "address" + ], + "additionalProperties": false + }, + "utm": { + "type": "object", + "properties": { + "utmSource": { + "type": "string", + "description": "Tracks in which medium the traffic originated from (twitter, facebook, etc.)" + }, + "utmMedium": { + "type": "string", + "description": "Tracks in which medium the traffic originated from (mail, CPC, social, etc.)" + }, + "utmCampaign": { + "type": "string", + "description": "Track the performance of a specific campaign" + }, + "utmContent": { + "type": "string", + "description": "Track which link was clicked" + }, + "utmTerm": { + "type": "string", + "description": "Track which keyword term a website visitor came from" + } + }, + "additionalProperties": false + }, + "quote": { + "type": "object", + "properties": { + "slippageBips": { + "type": "number", + "description": "Slippage tolerance that was applied to the order to get the limit price. Expressed in Basis Points (BPS). One basis point is equivalent to 0.01% (1/100th of a percent)" + }, + "smartSlippage": { + "type": "boolean", + "description": "Whether the given slippageBips used is originated from a Smart slippage suggestion" + } + }, + "required": [ + "slippageBips" + ], + "additionalProperties": false + }, + "orderClass": { + "type": "object", + "properties": { + "orderClass": { + "type": "string", + "enum": [ + "market", + "limit", + "liquidity", + "twap" + ], + "description": "Indicator of the order class." + } + }, + "required": [ + "orderClass" + ], + "additionalProperties": false + }, + "hooks": { + "type": "object", + "properties": { + "version": { + "type": "string", + "description": "Semantic versioning of document." + }, + "pre": { + "type": "array", + "items": { + "type": "object", + "properties": { + "target": { + "type": "string", + "description": "The contract to call for the hook" + }, + "callData": { + "type": "string", + "description": "The calldata to use when calling the hook" + }, + "gasLimit": { + "type": "string", + "description": "The gas limit (in gas units) for the hook" + }, + "dappId": { + "type": "string", + "description": "CoW Swap has an interface that allows dApps to build hooks for orders. This field is used to identify the dApp that has built the hook." + } + }, + "required": [ + "target", + "callData", + "gasLimit" + ], + "additionalProperties": false + }, + "description": "CoW Hooks to call before an order executes" + }, + "post": { + "type": "array", + "items": { + "type": "object", + "properties": { + "target": { + "type": "string", + "description": "The contract to call for the hook" + }, + "callData": { + "type": "string", + "description": "The calldata to use when calling the hook" + }, + "gasLimit": { + "type": "string", + "description": "The gas limit (in gas units) for the hook" + }, + "dappId": { + "type": "string", + "description": "CoW Swap has an interface that allows dApps to build hooks for orders. This field is used to identify the dApp that has built the hook." + } + }, + "required": [ + "target", + "callData", + "gasLimit" + ], + "additionalProperties": false + }, + "description": "CoW Hooks to call after an order executes" + } + }, + "additionalProperties": false, + "description": "Optional Pre and Post order interaction hooks attached to a single order" + }, + "widget": { + "type": "object", + "properties": { + "appCode": { + "type": "string", + "description": "The code identifying the UI powering the widget" + }, + "environment": { + "type": "string", + "description": "Environment from which the order came from." + } + }, + "required": [ + "appCode" + ], + "additionalProperties": false + }, + "partnerFee": { + "type": "object", + "properties": { + "bps": { + "type": "number", + "description": "The fee in basis points (BPS) to be paid to the partner. One basis point is equivalent to 0.01% (1/100th of a percent)" + }, + "recipient": { + "type": "string", + "description": "The Ethereum address of the partner to receive the fee." + } + }, + "required": [ + "bps", + "recipient" + ], + "additionalProperties": false + }, + "replacedOrder": { + "type": "object", + "properties": { + "uid": { + "type": "string", + "description": "The replaced order UID." + } + }, + "required": [ + "uid" + ], + "additionalProperties": false + } + }, + "additionalProperties": false, + "description": "Each metadata will specify one aspect of the order." + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "definitions": {} +} as const \ No newline at end of file diff --git a/apps/api/src/app/routes/__chainId/trade/tradingSchemas/LimitTradeParameters.ts b/apps/api/src/app/routes/__chainId/trade/tradingSchemas/LimitTradeParameters.ts new file mode 100644 index 00000000..32f68bb6 --- /dev/null +++ b/apps/api/src/app/routes/__chainId/trade/tradingSchemas/LimitTradeParameters.ts @@ -0,0 +1,90 @@ +export default { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "kind": { + "type": "string", + "enum": [ + "buy", + "sell" + ], + "description": "Is this order a buy or sell?" + }, + "sellToken": { + "type": "string", + "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + }, + "sellTokenDecimals": { + "type": "number" + }, + "buyToken": { + "type": "string", + "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + }, + "buyTokenDecimals": { + "type": "number" + }, + "env": { + "type": "string", + "enum": [ + "prod", + "staging" + ], + "description": "The environment to use for the Cow API." + }, + "partiallyFillable": { + "type": "boolean" + }, + "slippageBps": { + "type": "number" + }, + "receiver": { + "type": "string" + }, + "validFor": { + "type": "number" + }, + "partnerFee": { + "type": "object", + "properties": { + "bps": { + "type": "number", + "description": "The fee in basis points (BPS) to be paid to the partner. One basis point is equivalent to 0.01% (1/100th of a percent)" + }, + "recipient": { + "type": "string", + "description": "The Ethereum address of the partner to receive the fee." + } + }, + "required": [ + "bps", + "recipient" + ], + "additionalProperties": false + }, + "sellAmount": { + "type": "string" + }, + "buyAmount": { + "type": "string" + }, + "quoteId": { + "type": "number" + }, + "validTo": { + "type": "number" + } + }, + "required": [ + "buyAmount", + "buyToken", + "buyTokenDecimals", + "kind", + "quoteId", + "sellAmount", + "sellToken", + "sellTokenDecimals" + ], + "additionalProperties": false, + "definitions": {} +} as const \ No newline at end of file diff --git a/apps/api/src/app/routes/__chainId/trade/tradingSchemas/QuoteResultsSerialized.ts b/apps/api/src/app/routes/__chainId/trade/tradingSchemas/QuoteResultsSerialized.ts new file mode 100644 index 00000000..7eb1d0e4 --- /dev/null +++ b/apps/api/src/app/routes/__chainId/trade/tradingSchemas/QuoteResultsSerialized.ts @@ -0,0 +1,684 @@ +export default { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "tradeParameters": { + "type": "object", + "additionalProperties": false, + "properties": { + "env": { + "type": "string", + "enum": [ + "prod", + "staging" + ], + "description": "The environment to use for the Cow API." + }, + "partiallyFillable": { + "type": "boolean" + }, + "slippageBps": { + "type": "number" + }, + "receiver": { + "type": "string" + }, + "validFor": { + "type": "number" + }, + "partnerFee": { + "type": "object", + "properties": { + "bps": { + "type": "number", + "description": "The fee in basis points (BPS) to be paid to the partner. One basis point is equivalent to 0.01% (1/100th of a percent)" + }, + "recipient": { + "type": "string", + "description": "The Ethereum address of the partner to receive the fee." + } + }, + "required": [ + "bps", + "recipient" + ], + "additionalProperties": false + }, + "kind": { + "type": "string", + "enum": [ + "buy", + "sell" + ], + "description": "Is this order a buy or sell?" + }, + "sellToken": { + "type": "string", + "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + }, + "sellTokenDecimals": { + "type": "number" + }, + "buyToken": { + "type": "string", + "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + }, + "buyTokenDecimals": { + "type": "number" + }, + "amount": { + "type": "string" + } + }, + "required": [ + "amount", + "buyToken", + "buyTokenDecimals", + "kind", + "sellToken", + "sellTokenDecimals" + ] + }, + "amountsAndCosts": { + "type": "object", + "properties": { + "isSell": { + "type": "boolean" + }, + "costs": { + "type": "object", + "properties": { + "networkFee": { + "type": "object", + "properties": { + "amountInSellCurrency": { + "type": "string" + }, + "amountInBuyCurrency": { + "type": "string" + } + }, + "required": [ + "amountInSellCurrency", + "amountInBuyCurrency" + ], + "additionalProperties": false + }, + "partnerFee": { + "type": "object", + "properties": { + "amount": { + "type": "string" + }, + "bps": { + "type": "number" + } + }, + "required": [ + "amount", + "bps" + ], + "additionalProperties": false + } + }, + "required": [ + "networkFee", + "partnerFee" + ], + "additionalProperties": false + }, + "beforeNetworkCosts": { + "type": "object", + "properties": { + "sellAmount": { + "type": "string" + }, + "buyAmount": { + "type": "string" + } + }, + "required": [ + "sellAmount", + "buyAmount" + ], + "additionalProperties": false + }, + "afterNetworkCosts": { + "type": "object", + "properties": { + "sellAmount": { + "type": "string" + }, + "buyAmount": { + "type": "string" + } + }, + "required": [ + "sellAmount", + "buyAmount" + ], + "additionalProperties": false + }, + "afterPartnerFees": { + "type": "object", + "properties": { + "sellAmount": { + "type": "string" + }, + "buyAmount": { + "type": "string" + } + }, + "required": [ + "sellAmount", + "buyAmount" + ], + "additionalProperties": false + }, + "afterSlippage": { + "type": "object", + "properties": { + "sellAmount": { + "type": "string" + }, + "buyAmount": { + "type": "string" + } + }, + "required": [ + "sellAmount", + "buyAmount" + ], + "additionalProperties": false + } + }, + "required": [ + "isSell", + "costs", + "beforeNetworkCosts", + "afterNetworkCosts", + "afterPartnerFees", + "afterSlippage" + ], + "additionalProperties": false, + "description": "CoW Protocol quote has amounts (sell/buy) and costs (network fee), there is also partner fees. Besides that, CoW Protocol supports both sell and buy orders and the fees and costs are calculated differently.\n\nThe order of adding fees and costs is as follows: 1. Network fee is always added to the sell amount 2. Partner fee is added to the surplus amount (sell amount for sell-orders, buy amount for buy-orders)\n\nFor sell-orders the partner fee is subtracted from the buy amount after network costs. For buy-orders the partner fee is added on top of the sell amount after network costs." + }, + "orderToSign": { + "type": "object", + "additionalProperties": false, + "properties": { + "receiver": { + "type": "string" + }, + "sellToken": { + "type": "string", + "description": "ERC-20 token to be sold." + }, + "buyToken": { + "type": "string", + "description": "ERC-20 token to be bought." + }, + "sellAmount": { + "type": "string", + "description": "Amount of `sellToken` to be sold in atoms." + }, + "buyAmount": { + "type": "string", + "description": "Amount of `buyToken` to be bought in atoms." + }, + "validTo": { + "type": "number", + "description": "Unix timestamp (`uint32`) until which the order is valid." + }, + "appData": { + "type": "string", + "description": "32 bytes encoded as hex with `0x` prefix. It's expected to be the hash of the stringified JSON object representing the `appData`." + }, + "feeAmount": { + "type": "string", + "description": "feeRatio * sellAmount + minimal_fee in atoms." + }, + "kind": { + "type": "string", + "enum": [ + "buy", + "sell" + ], + "description": "The kind is either a buy or sell order." + }, + "partiallyFillable": { + "type": "boolean", + "description": "Is the order fill-or-kill or partially fillable?" + }, + "sellTokenBalance": { + "type": "string", + "enum": [ + "erc20", + "internal", + "external" + ], + "description": "Where should the `sellToken` be drawn from?" + }, + "buyTokenBalance": { + "type": "string", + "enum": [ + "erc20", + "internal" + ], + "description": "Where should the `buyToken` be transferred to?" + }, + "signingScheme": { + "type": "string", + "enum": [ + "eip712", + "ethsign", + "presign", + "eip1271" + ], + "description": "How was the order signed?" + } + }, + "required": [ + "appData", + "buyAmount", + "buyToken", + "feeAmount", + "kind", + "partiallyFillable", + "receiver", + "sellAmount", + "sellToken", + "validTo" + ], + "description": "Unsigned order intent to be placed." + }, + "quoteResponse": { + "type": "object", + "properties": { + "quote": { + "type": "object", + "properties": { + "sellToken": { + "type": "string", + "description": "ERC-20 token to be sold." + }, + "buyToken": { + "type": "string", + "description": "ERC-20 token to be bought." + }, + "receiver": { + "anyOf": [ + { + "type": "string", + "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + }, + { + "type": "null" + } + ], + "description": "An optional Ethereum address to receive the proceeds of the trade instead of the owner (i.e. the order signer)." + }, + "sellAmount": { + "type": "string", + "description": "Amount of `sellToken` to be sold in atoms." + }, + "buyAmount": { + "type": "string", + "description": "Amount of `buyToken` to be bought in atoms." + }, + "validTo": { + "type": "number", + "description": "Unix timestamp (`uint32`) until which the order is valid." + }, + "appData": { + "type": "string", + "description": "32 bytes encoded as hex with `0x` prefix. It's expected to be the hash of the stringified JSON object representing the `appData`." + }, + "feeAmount": { + "type": "string", + "description": "feeRatio * sellAmount + minimal_fee in atoms." + }, + "kind": { + "type": "string", + "enum": [ + "buy", + "sell" + ], + "description": "The kind is either a buy or sell order." + }, + "partiallyFillable": { + "type": "boolean", + "description": "Is the order fill-or-kill or partially fillable?" + }, + "sellTokenBalance": { + "type": "string", + "enum": [ + "erc20", + "internal", + "external" + ], + "description": "Where should the `sellToken` be drawn from?" + }, + "buyTokenBalance": { + "type": "string", + "enum": [ + "erc20", + "internal" + ], + "description": "Where should the `buyToken` be transferred to?" + }, + "signingScheme": { + "type": "string", + "enum": [ + "eip712", + "ethsign", + "presign", + "eip1271" + ], + "description": "How was the order signed?" + } + }, + "required": [ + "sellToken", + "buyToken", + "sellAmount", + "buyAmount", + "validTo", + "appData", + "feeAmount", + "kind", + "partiallyFillable" + ], + "additionalProperties": false, + "description": "Order parameters." + }, + "from": { + "type": "string", + "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + }, + "expiration": { + "type": "string", + "description": "Expiration date of the offered fee. Order service might not accept the fee after this expiration date. Encoded as ISO 8601 UTC." + }, + "id": { + "type": "number", + "description": "Quote ID linked to a quote to enable providing more metadata when analysing order slippage." + }, + "verified": { + "type": "boolean", + "description": "Whether it was possible to verify that the quoted amounts are accurate using a simulation." + } + }, + "required": [ + "quote", + "expiration", + "verified" + ], + "additionalProperties": false, + "description": "An order quoted by the backend that can be directly signed and submitted to the order creation backend." + }, + "appDataInfo": { + "type": "object", + "properties": { + "doc": { + "type": "object", + "properties": { + "version": { + "type": "string", + "description": "Semantic versioning of document." + }, + "appCode": { + "type": "string", + "description": "The code identifying the CLI, UI, service generating the order." + }, + "environment": { + "type": "string", + "description": "Environment from which the order came from." + }, + "metadata": { + "type": "object", + "properties": { + "signer": { + "type": "string", + "description": "The address of the trader who signs the CoW Swap order. This field should normally be omitted; it is recommended to use it if the signer is a smart-contract wallet using EIP-1271 signatures." + }, + "referrer": { + "type": "object", + "properties": { + "address": { + "type": "string" + } + }, + "required": [ + "address" + ], + "additionalProperties": false + }, + "utm": { + "type": "object", + "properties": { + "utmSource": { + "type": "string", + "description": "Tracks in which medium the traffic originated from (twitter, facebook, etc.)" + }, + "utmMedium": { + "type": "string", + "description": "Tracks in which medium the traffic originated from (mail, CPC, social, etc.)" + }, + "utmCampaign": { + "type": "string", + "description": "Track the performance of a specific campaign" + }, + "utmContent": { + "type": "string", + "description": "Track which link was clicked" + }, + "utmTerm": { + "type": "string", + "description": "Track which keyword term a website visitor came from" + } + }, + "additionalProperties": false + }, + "quote": { + "type": "object", + "properties": { + "slippageBips": { + "type": "number", + "description": "Slippage tolerance that was applied to the order to get the limit price. Expressed in Basis Points (BPS). One basis point is equivalent to 0.01% (1/100th of a percent)" + }, + "smartSlippage": { + "type": "boolean", + "description": "Whether the given slippageBips used is originated from a Smart slippage suggestion" + } + }, + "required": [ + "slippageBips" + ], + "additionalProperties": false + }, + "orderClass": { + "type": "object", + "properties": { + "orderClass": { + "type": "string", + "enum": [ + "market", + "limit", + "liquidity", + "twap" + ], + "description": "Indicator of the order class." + } + }, + "required": [ + "orderClass" + ], + "additionalProperties": false + }, + "hooks": { + "type": "object", + "properties": { + "version": { + "type": "string", + "description": "Semantic versioning of document." + }, + "pre": { + "type": "array", + "items": { + "type": "object", + "properties": { + "target": { + "type": "string", + "description": "The contract to call for the hook" + }, + "callData": { + "type": "string", + "description": "The calldata to use when calling the hook" + }, + "gasLimit": { + "type": "string", + "description": "The gas limit (in gas units) for the hook" + }, + "dappId": { + "type": "string", + "description": "CoW Swap has an interface that allows dApps to build hooks for orders. This field is used to identify the dApp that has built the hook." + } + }, + "required": [ + "target", + "callData", + "gasLimit" + ], + "additionalProperties": false + }, + "description": "CoW Hooks to call before an order executes" + }, + "post": { + "type": "array", + "items": { + "type": "object", + "properties": { + "target": { + "type": "string", + "description": "The contract to call for the hook" + }, + "callData": { + "type": "string", + "description": "The calldata to use when calling the hook" + }, + "gasLimit": { + "type": "string", + "description": "The gas limit (in gas units) for the hook" + }, + "dappId": { + "type": "string", + "description": "CoW Swap has an interface that allows dApps to build hooks for orders. This field is used to identify the dApp that has built the hook." + } + }, + "required": [ + "target", + "callData", + "gasLimit" + ], + "additionalProperties": false + }, + "description": "CoW Hooks to call after an order executes" + } + }, + "additionalProperties": false, + "description": "Optional Pre and Post order interaction hooks attached to a single order" + }, + "widget": { + "type": "object", + "properties": { + "appCode": { + "type": "string", + "description": "The code identifying the UI powering the widget" + }, + "environment": { + "type": "string", + "description": "Environment from which the order came from." + } + }, + "required": [ + "appCode" + ], + "additionalProperties": false + }, + "partnerFee": { + "type": "object", + "properties": { + "bps": { + "type": "number", + "description": "The fee in basis points (BPS) to be paid to the partner. One basis point is equivalent to 0.01% (1/100th of a percent)" + }, + "recipient": { + "type": "string", + "description": "The Ethereum address of the partner to receive the fee." + } + }, + "required": [ + "bps", + "recipient" + ], + "additionalProperties": false + }, + "replacedOrder": { + "type": "object", + "properties": { + "uid": { + "type": "string", + "description": "The replaced order UID." + } + }, + "required": [ + "uid" + ], + "additionalProperties": false + } + }, + "additionalProperties": false, + "description": "Each metadata will specify one aspect of the order." + } + }, + "required": [ + "version", + "metadata" + ], + "additionalProperties": false, + "description": "Metadata JSON document for adding information to orders." + }, + "fullAppData": { + "type": "string" + }, + "appDataKeccak256": { + "type": "string" + }, + "env": { + "type": "string", + "enum": [ + "prod", + "staging" + ], + "description": "The environment to use for the Cow API." + } + }, + "required": [ + "doc", + "fullAppData", + "appDataKeccak256" + ], + "additionalProperties": false + } + }, + "required": [ + "tradeParameters", + "amountsAndCosts", + "orderToSign", + "quoteResponse", + "appDataInfo" + ], + "additionalProperties": false, + "definitions": {} +} as const \ No newline at end of file diff --git a/apps/api/src/app/routes/__chainId/trade/tradingSchemas/QuoterParameters.ts b/apps/api/src/app/routes/__chainId/trade/tradingSchemas/QuoterParameters.ts new file mode 100644 index 00000000..2aecc86d --- /dev/null +++ b/apps/api/src/app/routes/__chainId/trade/tradingSchemas/QuoterParameters.ts @@ -0,0 +1,30 @@ +export default { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "properties": { + "account": { + "type": "string" + }, + "chainId": { + "type": "number", + "enum": [ + 1, + 100, + 42161, + 8453, + 11155111 + ], + "description": "Supported chains and their `chainId` for the SDK." + }, + "appCode": { + "type": "string" + } + }, + "required": [ + "account", + "appCode", + "chainId" + ], + "definitions": {} +} as const \ No newline at end of file diff --git a/apps/api/src/app/routes/__chainId/trade/tradingSchemas/SwapAdvancedSettings.ts b/apps/api/src/app/routes/__chainId/trade/tradingSchemas/SwapAdvancedSettings.ts new file mode 100644 index 00000000..248c3307 --- /dev/null +++ b/apps/api/src/app/routes/__chainId/trade/tradingSchemas/SwapAdvancedSettings.ts @@ -0,0 +1,334 @@ +export default { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "quoteRequest": { + "type": "object", + "properties": { + "sellAmountBeforeFee": { + "type": "string", + "description": "The total amount that is available for the order. From this value, the fee is deducted and the buy amount is calculated." + }, + "validTo": { + "type": "number", + "description": "Unix timestamp (`uint32`) until which the order is valid." + }, + "sellToken": { + "type": "string", + "description": "ERC-20 token to be sold" + }, + "buyToken": { + "type": "string", + "description": "ERC-20 token to be bought" + }, + "receiver": { + "anyOf": [ + { + "type": "string", + "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + }, + { + "type": "null" + } + ], + "description": "An optional address to receive the proceeds of the trade instead of the `owner` (i.e. the order signer)." + }, + "appData": { + "anyOf": [ + { + "type": "string", + "description": "The string encoding of a JSON object representing some `appData`. The format of the JSON expected in the `appData` field is defined [here](https://github.com/cowprotocol/app-data)." + }, + { + "type": "string", + "description": "32 bytes encoded as hex with `0x` prefix. It's expected to be the hash of the stringified JSON object representing the `appData`." + } + ], + "description": "AppData which will be assigned to the order. Expects either a string JSON doc as defined on [AppData](https://github.com/cowprotocol/app-data) or a hex encoded string for backwards compatibility. When the first format is used, it's possible to provide the derived appDataHash field." + }, + "appDataHash": { + "type": "string", + "description": "The hash of the stringified JSON appData doc. If present, `appData` field must be set with the aforementioned data where this hash is derived from. In case they differ, the call will fail." + }, + "sellTokenBalance": { + "type": "string", + "enum": [ + "erc20", + "internal", + "external" + ], + "description": "Where should the `sellToken` be drawn from?" + }, + "buyTokenBalance": { + "type": "string", + "enum": [ + "erc20", + "internal" + ], + "description": "Where should the `buyToken` be transferred to?" + }, + "from": { + "type": "string", + "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + }, + "priceQuality": { + "type": "string", + "enum": [ + "fast", + "optimal", + "verified" + ], + "description": "How good should the price estimate be?\n\nFast: The price estimate is chosen among the fastest N price estimates. Optimal: The price estimate is chosen among all price estimates. Verified: The price estimate is chosen among all verified/simulated price estimates.\n\n**NOTE**: Orders are supposed to be created from `verified` or `optimal` price estimates." + }, + "signingScheme": { + "type": "string", + "enum": [ + "eip712", + "ethsign", + "presign", + "eip1271" + ], + "description": "How was the order signed?" + }, + "onchainOrder": { + "description": "Flag to signal whether the order is intended for on-chain order placement. Only valid for non ECDSA-signed orders.\"" + }, + "validFor": { + "type": "number", + "description": "Number (`uint32`) of seconds that the order should be valid for." + }, + "sellAmountAfterFee": { + "type": "string", + "description": "The `sellAmount` for the order." + }, + "buyAmountAfterFee": { + "type": "string", + "description": "The `buyAmount` for the order." + } + }, + "additionalProperties": false + }, + "appData": { + "type": "object", + "properties": { + "appCode": { + "type": "string", + "description": "The code identifying the CLI, UI, service generating the order." + }, + "environment": { + "type": "string", + "description": "Environment from which the order came from." + }, + "metadata": { + "type": "object", + "properties": { + "signer": { + "type": "string", + "description": "The address of the trader who signs the CoW Swap order. This field should normally be omitted; it is recommended to use it if the signer is a smart-contract wallet using EIP-1271 signatures." + }, + "referrer": { + "type": "object", + "properties": { + "address": { + "type": "string" + } + }, + "required": [ + "address" + ], + "additionalProperties": false + }, + "utm": { + "type": "object", + "properties": { + "utmSource": { + "type": "string", + "description": "Tracks in which medium the traffic originated from (twitter, facebook, etc.)" + }, + "utmMedium": { + "type": "string", + "description": "Tracks in which medium the traffic originated from (mail, CPC, social, etc.)" + }, + "utmCampaign": { + "type": "string", + "description": "Track the performance of a specific campaign" + }, + "utmContent": { + "type": "string", + "description": "Track which link was clicked" + }, + "utmTerm": { + "type": "string", + "description": "Track which keyword term a website visitor came from" + } + }, + "additionalProperties": false + }, + "quote": { + "type": "object", + "properties": { + "slippageBips": { + "type": "number", + "description": "Slippage tolerance that was applied to the order to get the limit price. Expressed in Basis Points (BPS). One basis point is equivalent to 0.01% (1/100th of a percent)" + }, + "smartSlippage": { + "type": "boolean", + "description": "Whether the given slippageBips used is originated from a Smart slippage suggestion" + } + }, + "required": [ + "slippageBips" + ], + "additionalProperties": false + }, + "orderClass": { + "type": "object", + "properties": { + "orderClass": { + "type": "string", + "enum": [ + "market", + "limit", + "liquidity", + "twap" + ], + "description": "Indicator of the order class." + } + }, + "required": [ + "orderClass" + ], + "additionalProperties": false + }, + "hooks": { + "type": "object", + "properties": { + "version": { + "type": "string", + "description": "Semantic versioning of document." + }, + "pre": { + "type": "array", + "items": { + "type": "object", + "properties": { + "target": { + "type": "string", + "description": "The contract to call for the hook" + }, + "callData": { + "type": "string", + "description": "The calldata to use when calling the hook" + }, + "gasLimit": { + "type": "string", + "description": "The gas limit (in gas units) for the hook" + }, + "dappId": { + "type": "string", + "description": "CoW Swap has an interface that allows dApps to build hooks for orders. This field is used to identify the dApp that has built the hook." + } + }, + "required": [ + "target", + "callData", + "gasLimit" + ], + "additionalProperties": false + }, + "description": "CoW Hooks to call before an order executes" + }, + "post": { + "type": "array", + "items": { + "type": "object", + "properties": { + "target": { + "type": "string", + "description": "The contract to call for the hook" + }, + "callData": { + "type": "string", + "description": "The calldata to use when calling the hook" + }, + "gasLimit": { + "type": "string", + "description": "The gas limit (in gas units) for the hook" + }, + "dappId": { + "type": "string", + "description": "CoW Swap has an interface that allows dApps to build hooks for orders. This field is used to identify the dApp that has built the hook." + } + }, + "required": [ + "target", + "callData", + "gasLimit" + ], + "additionalProperties": false + }, + "description": "CoW Hooks to call after an order executes" + } + }, + "additionalProperties": false, + "description": "Optional Pre and Post order interaction hooks attached to a single order" + }, + "widget": { + "type": "object", + "properties": { + "appCode": { + "type": "string", + "description": "The code identifying the UI powering the widget" + }, + "environment": { + "type": "string", + "description": "Environment from which the order came from." + } + }, + "required": [ + "appCode" + ], + "additionalProperties": false + }, + "partnerFee": { + "type": "object", + "properties": { + "bps": { + "type": "number", + "description": "The fee in basis points (BPS) to be paid to the partner. One basis point is equivalent to 0.01% (1/100th of a percent)" + }, + "recipient": { + "type": "string", + "description": "The Ethereum address of the partner to receive the fee." + } + }, + "required": [ + "bps", + "recipient" + ], + "additionalProperties": false + }, + "replacedOrder": { + "type": "object", + "properties": { + "uid": { + "type": "string", + "description": "The replaced order UID." + } + }, + "required": [ + "uid" + ], + "additionalProperties": false + } + }, + "additionalProperties": false, + "description": "Each metadata will specify one aspect of the order." + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false, + "definitions": {} +} as const \ No newline at end of file diff --git a/apps/api/src/app/routes/__chainId/trade/tradingSchemas/TradeParameters.ts b/apps/api/src/app/routes/__chainId/trade/tradingSchemas/TradeParameters.ts new file mode 100644 index 00000000..eb4c4fb5 --- /dev/null +++ b/apps/api/src/app/routes/__chainId/trade/tradingSchemas/TradeParameters.ts @@ -0,0 +1,79 @@ +export default { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "additionalProperties": false, + "properties": { + "env": { + "type": "string", + "enum": [ + "prod", + "staging" + ], + "description": "The environment to use for the Cow API." + }, + "partiallyFillable": { + "type": "boolean" + }, + "slippageBps": { + "type": "number" + }, + "receiver": { + "type": "string" + }, + "validFor": { + "type": "number" + }, + "partnerFee": { + "type": "object", + "properties": { + "bps": { + "type": "number", + "description": "The fee in basis points (BPS) to be paid to the partner. One basis point is equivalent to 0.01% (1/100th of a percent)" + }, + "recipient": { + "type": "string", + "description": "The Ethereum address of the partner to receive the fee." + } + }, + "required": [ + "bps", + "recipient" + ], + "additionalProperties": false + }, + "kind": { + "type": "string", + "enum": [ + "buy", + "sell" + ], + "description": "Is this order a buy or sell?" + }, + "sellToken": { + "type": "string", + "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + }, + "sellTokenDecimals": { + "type": "number" + }, + "buyToken": { + "type": "string", + "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + }, + "buyTokenDecimals": { + "type": "number" + }, + "amount": { + "type": "string" + } + }, + "required": [ + "amount", + "buyToken", + "buyTokenDecimals", + "kind", + "sellToken", + "sellTokenDecimals" + ], + "definitions": {} +} as const \ No newline at end of file diff --git a/apps/api/src/app/schemas.ts b/apps/api/src/app/schemas.ts index 26241be4..b2c99ce6 100644 --- a/apps/api/src/app/schemas.ts +++ b/apps/api/src/app/schemas.ts @@ -7,11 +7,22 @@ export const ChainIdSchema = { type: 'integer', } as const; +export const ETHEREUM_ADDRESS_PATTERN = '^0x[a-fA-F0-9]{40}$' as const; + export const AddressSchema = { title: 'Address', description: 'Ethereum address.', type: 'string', - pattern: '^0x[a-fA-F0-9]{40}$', + pattern: ETHEREUM_ADDRESS_PATTERN, } as const; -export const ETHEREUM_ADDRESS_PATTERN = '^0x[a-fA-F0-9]{40}$'; + +export const SlippageSchema = { + title: 'Slippage tolerance in basis points', + description: + 'Slippage tolerance in basis points. One basis point is equivalent to 0.01% (1/100th of a percent)', + type: 'number', + examples: [50, 100, 200], + minimum: 0, + maximum: 10000, +} as const; \ No newline at end of file diff --git a/libs/services/src/TradingService/TradingService.ts b/libs/services/src/TradingService/TradingService.ts new file mode 100644 index 00000000..17d0d06c --- /dev/null +++ b/libs/services/src/TradingService/TradingService.ts @@ -0,0 +1,16 @@ +import { injectable } from 'inversify'; +import { getQuote, TradeParameters, SwapAdvancedSettings, QuoteResults } from '@cowprotocol/cow-sdk'; + +export const tradingServiceSymbol = Symbol.for('TradingServiceSymbol'); + +@injectable() +export class TradingService { + + async getQuote( + trader: Parameters[1], + params: TradeParameters, + advancedSettings?: SwapAdvancedSettings + ): Promise { + return getQuote(params, trader, advancedSettings).then(({result}) => result); + } +} diff --git a/libs/services/src/index.ts b/libs/services/src/index.ts index b33a27ce..1fd68e4e 100644 --- a/libs/services/src/index.ts +++ b/libs/services/src/index.ts @@ -3,7 +3,6 @@ export * from './SlippageService/SlippageServiceMain'; export * from './SlippageService/SlippageServiceMock'; export * from './UsdService/UsdService'; - export * from './TokenHolderService/TokenHolderService'; - export * from './SimulationService/SimulationService'; +export * from './TradingService/TradingService'; diff --git a/package.json b/package.json index ce719d43..0297708d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@cowprotocol/root", + "name": "@cowprotocol/bff", "description": "Backend for frontend is a series of backend services and libraries that enhance user experience for the frontend", "version": "0.0.0", "license": "MIT", @@ -25,7 +25,7 @@ "private": true, "dependencies": { "@cowprotocol/cms": "^0.3.0-RC.4", - "@cowprotocol/cow-sdk": "5.2.0", + "@cowprotocol/cow-sdk": "5.8.0-RC.1", "@fastify/autoload": "~5.7.1", "@fastify/caching": "^8.3.0", "@fastify/cors": "^8.2.1", @@ -52,7 +52,6 @@ "ms": "^2.1.3", "mustache": "^4.2.0", "node-cache": "^5.1.2", - "node-fetch": "^3.3.2", "node-telegram-bot-api": "^0.65.1", "openapi-fetch": "^0.10.2", "pg": "^8.11.1", diff --git a/yarn.lock b/yarn.lock index f2ada16e..1ff50540 100644 --- a/yarn.lock +++ b/yarn.lock @@ -18,7 +18,7 @@ "@adraffy/ens-normalize@1.10.0": version "1.10.0" - resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz#d2a39395c587e092d77cbbc80acf956a54f38bf7" + resolved "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz" integrity sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q== "@ampproject/remapping@^2.2.0": @@ -29,6 +29,11 @@ "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" +"@assemblyscript/loader@^0.9.4": + version "0.9.4" + resolved "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.9.4.tgz" + integrity sha512-HazVq9zwTVwGmqdwYzu7WyQ6FQVZ7SwET0KKQuKm55jD0IfUpZgN0OPIiZG3zV1iSrVYcN0bdwLRXI/VNCYsUA== + "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.22.5": version "7.22.5" resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.5.tgz" @@ -38,7 +43,7 @@ "@babel/code-frame@^7.22.13": version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.24.7.tgz#882fd9e09e8ee324e496bd040401c6f046ef4465" + resolved "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.24.7.tgz" integrity sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA== dependencies: "@babel/highlight" "^7.24.7" @@ -255,7 +260,7 @@ "@babel/helper-validator-identifier@^7.24.7": version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz#75b889cfaf9e35c2aaf42cf0d72c8e91719251db" + resolved "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.24.7.tgz" integrity sha512-rR+PBcQ1SMQDDyF6X0wxtG8QyLCgUB0eRAGguqRLfkCA87l7yAP7ehq8SNj96OOGTO8OBV70KhuFYcIkHXOg0w== "@babel/helper-validator-option@^7.22.5": @@ -293,7 +298,7 @@ "@babel/highlight@^7.24.7": version "7.24.7" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.24.7.tgz#a05ab1df134b286558aae0ed41e6c5f731bf409d" + resolved "https://registry.npmjs.org/@babel/highlight/-/highlight-7.24.7.tgz" integrity sha512-EStJpq4OuY8xYfhGVXngigBJRWxftKX9ksiGDnmlY3o7B/V7KIAc9X4oiK87uPJSc/vs5L869bem5fhZa8caZw== dependencies: "@babel/helper-validator-identifier" "^7.24.7" @@ -1078,24 +1083,36 @@ resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== +"@cowprotocol/app-data@^2.1.0": + version "2.3.0" + resolved "https://registry.npmjs.org/@cowprotocol/app-data/-/app-data-2.3.0.tgz" + integrity sha512-wClmhKUAEVEgt9o7+ZLvV5AT/LP2ySMfPwveyy1Nwd762m8djaIddZ5cbex6iBROyOHEmk+9x9rcn8sUHXQ4Ww== + dependencies: + ajv "^8.11.0" + cross-fetch "^3.1.5" + ipfs-only-hash "^4.0.0" + json-stringify-deterministic "^1.0.8" + multiformats "^9.6.4" + "@cowprotocol/cms@^0.3.0-RC.4": version "0.3.0-RC.4" - resolved "https://registry.yarnpkg.com/@cowprotocol/cms/-/cms-0.3.0-RC.4.tgz#cfe28820f88e555891c8fc555814beaf6ba14d46" + resolved "https://registry.npmjs.org/@cowprotocol/cms/-/cms-0.3.0-RC.4.tgz" integrity sha512-6E1D36xaC8Cpecuu1atDGFr8XmNQwcSef8xv5q9/uS11lW150HjiEYeGBr7IObeky5OS2st5zpY0Ll8FOgReZA== dependencies: openapi-fetch "^0.9.3" -"@cowprotocol/contracts@^1.4.0": - version "1.4.0" - resolved "https://registry.npmjs.org/@cowprotocol/contracts/-/contracts-1.4.0.tgz" - integrity sha512-XLs3SlPmXD4lbiWIO7mxxuCn1eE5isuO6EUlE1cj17HqN/wukDAN0xXYPx6umOH/XdjGS33miMiPHELEyY9siw== +"@cowprotocol/contracts@^1.6.0": + version "1.6.0" + resolved "https://registry.npmjs.org/@cowprotocol/contracts/-/contracts-1.6.0.tgz" + integrity sha512-+UKhYRzkvnqqviBru5D3btTLYc743n0O5YTG+wpYwGl4fb7VNKBkFHe28C5Mf1DF/kOfmqfu+0IAvX9Vuq5Dqw== -"@cowprotocol/cow-sdk@5.2.0": - version "5.2.0" - resolved "https://registry.npmjs.org/@cowprotocol/cow-sdk/-/cow-sdk-5.2.0.tgz" - integrity sha512-7AWWEM4uyKDHyBoivAEkgULpI+mVZ4thMQXRM/CB8hW5MrnGxq6ONJECrq2k7uAiHrn9i2kdPjCwSPxKayVY8Q== +"@cowprotocol/cow-sdk@5.8.0-RC.1": + version "5.8.0-RC.1" + resolved "https://registry.npmjs.org/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.1.tgz" + integrity sha512-qGEw3ebJnT3lI1nJ0b8/yak2FAhMe1oWXPJyh3wCVhWuzCTNms/NTUa00J3m7ic526xbN27ksvTHTYbUI5wVXA== dependencies: - "@cowprotocol/contracts" "^1.4.0" + "@cowprotocol/app-data" "^2.1.0" + "@cowprotocol/contracts" "^1.6.0" "@ethersproject/abstract-signer" "^5.7.0" "@openzeppelin/merkle-tree" "^1.0.5" cross-fetch "^3.1.5" @@ -1757,7 +1774,7 @@ "@fastify/caching@^8.3.0": version "8.3.0" - resolved "https://registry.yarnpkg.com/@fastify/caching/-/caching-8.3.0.tgz#0954aa996424c49aade8f63bbbe5acb89a921662" + resolved "https://registry.npmjs.org/@fastify/caching/-/caching-8.3.0.tgz" integrity sha512-wxlQS2C9omy7+Aq33XDaHJWO0wF3DH2QFBD/ZHMJnWbL2buUDsjzCNg0TbSbEMHyFi/NiryYYAXVCoFCD7nFTA== dependencies: abstract-cache "^1.0.1" @@ -1808,7 +1825,7 @@ "@fastify/redis@^6.2.0": version "6.2.0" - resolved "https://registry.yarnpkg.com/@fastify/redis/-/redis-6.2.0.tgz#6da1f272846200e666749be26ac968788c698802" + resolved "https://registry.npmjs.org/@fastify/redis/-/redis-6.2.0.tgz" integrity sha512-0M4oTYRJz/ETPdfXvs/ToFI0ZNFjrz1jYFxEr+wHgnW6hswDsLDs+gxLMff2cb5Fegg3siG4hJzhmvvpvqqqbA== dependencies: fastify-plugin "^4.0.0" @@ -1907,7 +1924,7 @@ "@ioredis/commands@^1.1.1": version "1.2.0" - resolved "https://registry.yarnpkg.com/@ioredis/commands/-/commands-1.2.0.tgz#6d61b3097470af1fdbbe622795b8921d42018e11" + resolved "https://registry.npmjs.org/@ioredis/commands/-/commands-1.2.0.tgz" integrity sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg== "@istanbuljs/load-nyc-config@^1.0.0": @@ -2148,9 +2165,9 @@ integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== "@jridgewell/sourcemap-codec@^1.4.10": - version "1.4.15" - resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz" - integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== + version "1.5.0" + resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== "@jridgewell/trace-mapping@0.3.9": version "0.3.9" @@ -2215,6 +2232,11 @@ resolved "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.14.2.tgz" integrity sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug== +"@multiformats/base-x@^4.0.1": + version "4.0.1" + resolved "https://registry.npmjs.org/@multiformats/base-x/-/base-x-4.0.1.tgz" + integrity sha512-eMk0b9ReBbV23xXU693TAIrLyeO5iTgBZGSJfpqriG8UkYvr/hC9u9pyMlAakDNHWmbhMZCDs6KQO0jzKD8OTw== + "@nicolo-ribaudo/semver-v6@^6.3.3": version "6.3.3" resolved "https://registry.npmjs.org/@nicolo-ribaudo/semver-v6/-/semver-v6-6.3.3.tgz" @@ -2222,14 +2244,14 @@ "@noble/curves@1.4.0": version "1.4.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.4.0.tgz#f05771ef64da724997f69ee1261b2417a49522d6" + resolved "https://registry.npmjs.org/@noble/curves/-/curves-1.4.0.tgz" integrity sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg== dependencies: "@noble/hashes" "1.4.0" "@noble/curves@^1.4.0", "@noble/curves@~1.4.0": version "1.4.2" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.4.2.tgz#40309198c76ed71bc6dbf7ba24e81ceb4d0d1fe9" + resolved "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz" integrity sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw== dependencies: "@noble/hashes" "1.4.0" @@ -2241,7 +2263,7 @@ "@noble/hashes@1.4.0", "@noble/hashes@^1.4.0", "@noble/hashes@~1.4.0": version "1.4.0" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" + resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz" integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== "@noble/secp256k1@1.7.1", "@noble/secp256k1@~1.7.0": @@ -2713,9 +2735,62 @@ dependencies: esquery "^1.4.0" +"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz" + integrity sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ== + +"@protobufjs/base64@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz" + integrity sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg== + +"@protobufjs/codegen@^2.0.4": + version "2.0.4" + resolved "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz" + integrity sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg== + +"@protobufjs/eventemitter@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz" + integrity sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q== + +"@protobufjs/fetch@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz" + integrity sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ== + dependencies: + "@protobufjs/aspromise" "^1.1.1" + "@protobufjs/inquire" "^1.1.0" + +"@protobufjs/float@^1.0.2": + version "1.0.2" + resolved "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz" + integrity sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ== + +"@protobufjs/inquire@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz" + integrity sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q== + +"@protobufjs/path@^1.1.2": + version "1.1.2" + resolved "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz" + integrity sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA== + +"@protobufjs/pool@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz" + integrity sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw== + +"@protobufjs/utf8@^1.1.0": + version "1.1.0" + resolved "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz" + integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw== + "@redocly/ajv@^8.11.0": version "8.11.0" - resolved "https://registry.yarnpkg.com/@redocly/ajv/-/ajv-8.11.0.tgz#2fad322888dc0113af026e08fceb3e71aae495ae" + resolved "https://registry.npmjs.org/@redocly/ajv/-/ajv-8.11.0.tgz" integrity sha512-9GWx27t7xWhDIR02PA18nzBdLcKQRgc46xNQvjFkrYk4UOmvKhJ/dawwiX0cCOeetN5LcaaiqQbVOWYK62SGHw== dependencies: fast-deep-equal "^3.1.1" @@ -2725,12 +2800,12 @@ "@redocly/config@^0.6.2": version "0.6.2" - resolved "https://registry.yarnpkg.com/@redocly/config/-/config-0.6.2.tgz#b5180ccb407673ee048b818c3be9a4f9d0636a64" + resolved "https://registry.npmjs.org/@redocly/config/-/config-0.6.2.tgz" integrity sha512-c3K5u64eMnr2ootPcpEI0ioIRLE8QP8ptvLxG9MwAmb2sU8HMRfVwXDU3AZiMVY2w4Ts0mDc+Xv4HTIk8DRqFw== "@redocly/openapi-core@^1.16.0": version "1.17.1" - resolved "https://registry.yarnpkg.com/@redocly/openapi-core/-/openapi-core-1.17.1.tgz#d18c5223e5b578d64d789c4101b96cbb589162dc" + resolved "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.17.1.tgz" integrity sha512-PQxDLLNk5cBatJBBxvfk49HFw/nVozw1XZ6Dw/GX0Tviq+WxeEjEuLAKfnLVvb5L0wgs4TNmVG4Y+JyofSPu1A== dependencies: "@redocly/ajv" "^8.11.0" @@ -2792,7 +2867,7 @@ "@scure/base@~1.1.6": version "1.1.7" - resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.7.tgz#fe973311a5c6267846aa131bc72e96c5d40d2b30" + resolved "https://registry.npmjs.org/@scure/base/-/base-1.1.7.tgz" integrity sha512-PPNYBslrLNNUQ/Yad37MHYsNQtK67EhWb6WtSvNLLPo7SdVZgkUjD6Dg+5On7zNwmskf8OX7I7Nx5oN+MIWE0g== "@scure/bip32@1.1.5": @@ -2806,7 +2881,7 @@ "@scure/bip32@1.4.0": version "1.4.0" - resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.4.0.tgz#4e1f1e196abedcef395b33b9674a042524e20d67" + resolved "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz" integrity sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg== dependencies: "@noble/curves" "~1.4.0" @@ -2823,7 +2898,7 @@ "@scure/bip39@1.3.0": version "1.3.0" - resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.3.0.tgz#0f258c16823ddd00739461ac31398b4e7d6a18c3" + resolved "https://registry.npmjs.org/@scure/bip39/-/bip39-1.3.0.tgz" integrity sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ== dependencies: "@noble/hashes" "~1.4.0" @@ -2935,7 +3010,7 @@ "@types/bignumber.js@^5.0.0": version "5.0.0" - resolved "https://registry.yarnpkg.com/@types/bignumber.js/-/bignumber.js-5.0.0.tgz#d9f1a378509f3010a3255e9cc822ad0eeb4ab969" + resolved "https://registry.npmjs.org/@types/bignumber.js/-/bignumber.js-5.0.0.tgz" integrity sha512-0DH7aPGCClywOFaxxjE6UwpN2kQYe9LwuDQMv+zYA97j5GkOMo8e66LYT+a8JYU7jfmUFRZLa9KycxHDsKXJCA== dependencies: bignumber.js "*" @@ -2989,14 +3064,24 @@ resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz" integrity sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA== +"@types/long@^4.0.1": + version "4.0.2" + resolved "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz" + integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA== + +"@types/minimist@^1.2.0": + version "1.2.5" + resolved "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz" + integrity sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag== + "@types/ms@^0.7.34": version "0.7.34" - resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.34.tgz#10964ba0dee6ac4cd462e2795b6bebd407303433" + resolved "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz" integrity sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g== "@types/mustache@^4.2.5": version "4.2.5" - resolved "https://registry.yarnpkg.com/@types/mustache/-/mustache-4.2.5.tgz#9129f0d6857f976e00e171bbb3460e4b702f84ef" + resolved "https://registry.npmjs.org/@types/mustache/-/mustache-4.2.5.tgz" integrity sha512-PLwiVvTBg59tGFL/8VpcGvqOu3L4OuveNvPi0EYbWchRdEVP++yRUXJPFl+CApKEq13017/4Nf7aQ5lTtHUNsA== "@types/node-telegram-bot-api@^0.64.6": @@ -3007,20 +3092,25 @@ "@types/node" "*" "@types/request" "*" -"@types/node@*": - version "18.19.32" - resolved "https://registry.npmjs.org/@types/node/-/node-18.19.32.tgz" - integrity sha512-2bkg93YBSDKk8DLmmHnmj/Rwr18TLx7/n+I23BigFwgexUJoMHZOd8X1OFxuF/W3NN0S2W2E5sVabI5CPinNvA== - dependencies: - undici-types "~5.26.4" - -"@types/node@^20.14.11": +"@types/node@*", "@types/node@^20.14.11": version "20.14.11" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.11.tgz#09b300423343460455043ddd4d0ded6ac579b74b" + resolved "https://registry.npmjs.org/@types/node/-/node-20.14.11.tgz" integrity sha512-kprQpL8MMeszbz6ojB5/tU8PLN4kesnN8Gjzw349rDlNgsSzg90lAVj3llK99Dh7JON+t9AuscPPFW6mPbTnSA== dependencies: undici-types "~5.26.4" +"@types/node@>=13.7.0": + version "22.9.0" + resolved "https://registry.npmjs.org/@types/node/-/node-22.9.0.tgz" + integrity sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ== + dependencies: + undici-types "~6.19.8" + +"@types/normalize-package-data@^2.4.0": + version "2.4.4" + resolved "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz" + integrity sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA== + "@types/parse-json@^4.0.0": version "4.0.0" resolved "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz" @@ -3274,7 +3364,7 @@ abitype@1.0.5: version "1.0.5" - resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.5.tgz#29d0daa3eea867ca90f7e4123144c1d1270774b6" + resolved "https://registry.npmjs.org/abitype/-/abitype-1.0.5.tgz" integrity sha512-YzDhti7cjlfaBhHutMaboYB21Ha3rXR9QTkNJFzYC4kC8YclaiwPBBBJY8ejFdu2wnJeZCVZSMlQJ7fi8S6hsw== abort-controller@^3.0.0: @@ -3286,14 +3376,14 @@ abort-controller@^3.0.0: abstract-cache-redis@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/abstract-cache-redis/-/abstract-cache-redis-2.0.0.tgz#ae7e215f0b7dd92cd266797f2702a52be6d3d37f" + resolved "https://registry.npmjs.org/abstract-cache-redis/-/abstract-cache-redis-2.0.0.tgz" integrity sha512-RlEniQUnIFCnh7U9S4kdDM7/uhpkl8KH5EdFplH7ntwze4voH8VhvaLXwc0mKQqL/daO9X6qULh8bWpgNrUtGg== dependencies: ioredis "^4.26.0" abstract-cache@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/abstract-cache/-/abstract-cache-1.0.1.tgz#136151becf5c32e0ea27f78728d073d8fe07932a" + resolved "https://registry.npmjs.org/abstract-cache/-/abstract-cache-1.0.1.tgz" integrity sha512-EfUeMhRUbG5bVVbrSY/ogLlFXoyfMAPxMlSP7wrEqH53d+59r2foVy9a5KjmprLKFLOfPQCNKEfpBN/nQ76chw== dependencies: clone "^2.1.1" @@ -3316,9 +3406,9 @@ acorn-walk@^8.1.1: integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== acorn@^8.4.1, acorn@^8.9.0: - version "8.11.3" - resolved "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz" - integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== + version "8.14.0" + resolved "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz" + integrity sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA== address@^1.0.1: version "1.2.2" @@ -3332,7 +3422,7 @@ aes-js@3.0.0: agent-base@^7.0.2: version "7.1.1" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.1.tgz#bdbded7dfb096b751a2a087eeeb9664725b2e317" + resolved "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz" integrity sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA== dependencies: debug "^4.3.4" @@ -3498,6 +3588,11 @@ arraybuffer.prototype.slice@^1.0.3: is-array-buffer "^3.0.4" is-shared-array-buffer "^1.0.2" +arrify@^1.0.1: + version "1.0.1" + resolved "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz" + integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA== + asn1@~0.2.3: version "0.2.6" resolved "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz" @@ -3698,7 +3793,7 @@ big.js@^5.2.2: bignumber.js@*, bignumber.js@^9.1.2: version "9.1.2" - resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" + resolved "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz" integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== binary-extensions@^2.0.0: @@ -3723,6 +3818,20 @@ bl@^4.0.3: inherits "^2.0.4" readable-stream "^3.4.0" +bl@^5.0.0: + version "5.1.0" + resolved "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz" + integrity sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ== + dependencies: + buffer "^6.0.3" + inherits "^2.0.4" + readable-stream "^3.4.0" + +blakejs@^1.1.0: + version "1.2.1" + resolved "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz" + integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== + bluebird@^3.5.0: version "3.7.2" resolved "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz" @@ -3843,6 +3952,15 @@ callsites@^3.0.0: resolved "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== +camelcase-keys@^6.2.2: + version "6.2.2" + resolved "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz" + integrity sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg== + dependencies: + camelcase "^5.3.1" + map-obj "^4.0.0" + quick-lru "^4.0.1" + camelcase@^5.3.1: version "5.3.1" resolved "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz" @@ -3905,6 +4023,16 @@ ci-info@^3.2.0: resolved "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz" integrity sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw== +cids@^1.0.0, cids@^1.1.5, cids@^1.1.6: + version "1.1.9" + resolved "https://registry.npmjs.org/cids/-/cids-1.1.9.tgz" + integrity sha512-l11hWRfugIcbGuTZwAM5PwpjPPjyb6UZOGwlHSnOBV5o07XhQ4gNpBN67FbODvpjyHtd+0Xs6KNvUcGBiDRsdg== + dependencies: + multibase "^4.0.1" + multicodec "^3.0.1" + multihashes "^4.0.1" + uint8arrays "^3.0.0" + cjs-module-lexer@^1.0.0: version "1.2.3" resolved "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz" @@ -3954,7 +4082,7 @@ cliui@^8.0.1: clone@2.x, clone@^2.1.1: version "2.1.2" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" + resolved "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz" integrity sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w== close-with-grace@^1.1.0: @@ -3964,7 +4092,7 @@ close-with-grace@^1.1.0: cluster-key-slot@^1.1.0: version "1.1.2" - resolved "https://registry.yarnpkg.com/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz#88ddaa46906e303b5de30d3153b7d9fe0a0c19ac" + resolved "https://registry.npmjs.org/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz" integrity sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA== co@^4.6.0: @@ -4003,7 +4131,7 @@ color-name@~1.1.4: colorette@^1.2.0: version "1.4.0" - resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.4.0.tgz#5190fbb87276259a86ad700bff2c6d6faa3fca40" + resolved "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz" integrity sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g== colorette@^2.0.7: @@ -4156,11 +4284,6 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" -data-uri-to-buffer@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e" - integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A== - data-view-buffer@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz" @@ -4219,6 +4342,19 @@ debug@^3.2.7: dependencies: ms "^2.1.1" +decamelize-keys@^1.1.0: + version "1.1.1" + resolved "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz" + integrity sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg== + dependencies: + decamelize "^1.1.0" + map-obj "^1.0.0" + +decamelize@^1.1.0, decamelize@^1.2.0: + version "1.2.0" + resolved "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz" + integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== + decimal.js-light@^2.5.0: version "2.5.1" resolved "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz" @@ -4274,12 +4410,12 @@ delayed-stream@~1.0.0: denque@^1.1.0: version "1.5.1" - resolved "https://registry.yarnpkg.com/denque/-/denque-1.5.1.tgz#07f670e29c9a78f8faecb2566a1e2c11929c5cbf" + resolved "https://registry.npmjs.org/denque/-/denque-1.5.1.tgz" integrity sha512-XwE+iZ4D6ZUB7mfYRMb5wByE8L74HCn30FBN7sWnXksWc1LO1bPDl67pBR9o/kC4z/xSNAwkMYcGgqDV3BE3Hw== denque@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/denque/-/denque-2.1.0.tgz#e93e1a6569fb5e66f16a3c2a2964617d349d6ab1" + resolved "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz" integrity sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw== depd@2.0.0: @@ -4410,6 +4546,11 @@ env-schema@^5.0.0: dotenv "^16.0.0" dotenv-expand "^9.0.0" +err-code@^3.0.0, err-code@^3.0.1: + version "3.0.1" + resolved "https://registry.npmjs.org/err-code/-/err-code-3.0.1.tgz" + integrity sha512-GiaH0KJUewYok+eeY05IIgjtAe4Yltygk9Wqp1V5yVWLdhf0hYZchRjNIT9bb0mSwRcIusT3cx7PJUf3zEIfUA== + error-ex@^1.3.1: version "1.3.2" resolved "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz" @@ -4851,7 +4992,7 @@ fast-copy@^3.0.0: fast-copy@^3.0.2: version "3.0.2" - resolved "https://registry.yarnpkg.com/fast-copy/-/fast-copy-3.0.2.tgz#59c68f59ccbcac82050ba992e0d5c389097c9d35" + resolved "https://registry.npmjs.org/fast-copy/-/fast-copy-3.0.2.tgz" integrity sha512-dl0O9Vhju8IrcLndv2eU4ldt1ftXMqqfgN4H1cpmGV7P6jeB9FwpN9a2c8DPGE1Ys88rNUJVYDHq73CGAGOPfQ== fast-decode-uri-component@^1.0.1: @@ -4932,7 +5073,7 @@ fast-uri@^2.0.0, fast-uri@^2.1.0: "fastify-caching-deprecated@npm:fastify-caching@6.2.0": version "6.2.0" - resolved "https://registry.yarnpkg.com/fastify-caching/-/fastify-caching-6.2.0.tgz#6a7649509c709005098268595c3056082ca769b5" + resolved "https://registry.npmjs.org/fastify-caching/-/fastify-caching-6.2.0.tgz" integrity sha512-JftadkAz/VvWiKqY98Kjmlp3o8ZiTOMmcd0P7XLzBiNmQdAX3mQR4s+YiEm0AWxDmmVaLVPfvuCne1AwbGtvPg== dependencies: abstract-cache "^1.0.1" @@ -4941,7 +5082,7 @@ fast-uri@^2.0.0, fast-uri@^2.1.0: fastify-caching@^6.3.0: version "6.3.0" - resolved "https://registry.yarnpkg.com/fastify-caching/-/fastify-caching-6.3.0.tgz#1d758cf89b71e9ee810ef68a9b3a6a78cea46d09" + resolved "https://registry.npmjs.org/fastify-caching/-/fastify-caching-6.3.0.tgz" integrity sha512-/oQZcaPuNXe6gv2wm5MNWGVATBD8yxSRX/SPM4zHQbxdJZpux/kDd9y6m47iG9dzrznN2sYkDHap836V0KveGw== dependencies: fastify-caching-deprecated "npm:fastify-caching@6.2.0" @@ -4972,7 +5113,7 @@ fastify-cli@^5.7.1: fastify-plugin@^3.0.0: version "3.0.1" - resolved "https://registry.yarnpkg.com/fastify-plugin/-/fastify-plugin-3.0.1.tgz#79e84c29f401020f38b524f59f2402103fd21ed2" + resolved "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-3.0.1.tgz" integrity sha512-qKcDXmuZadJqdTm6vlCqioEbyewF60b/0LOFCcYN1B6BIZGlYJumWWOYs70SFYLDAH4YqdE1cxH/RKMG7rFxgA== fastify-plugin@^4.0.0, fastify-plugin@^4.5.0, fastify-plugin@~4.5.0: @@ -5020,14 +5161,6 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" -fetch-blob@^3.1.2, fetch-blob@^3.1.4: - version "3.2.0" - resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9" - integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ== - dependencies: - node-domexception "^1.0.0" - web-streams-polyfill "^3.0.3" - figures@3.2.0: version "3.2.0" resolved "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz" @@ -5163,13 +5296,6 @@ form-data@~2.3.2: combined-stream "^1.0.6" mime-types "^2.1.12" -formdata-polyfill@^4.0.10: - version "4.0.10" - resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423" - integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g== - dependencies: - fetch-blob "^3.1.2" - forwarded@0.2.0, forwarded@^0.2.0: version "0.2.0" resolved "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz" @@ -5424,6 +5550,19 @@ graphql@^16.3.0: resolved "https://registry.npmjs.org/graphql/-/graphql-16.8.1.tgz" integrity sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw== +hamt-sharding@^2.0.0: + version "2.0.1" + resolved "https://registry.npmjs.org/hamt-sharding/-/hamt-sharding-2.0.1.tgz" + integrity sha512-vnjrmdXG9dDs1m/H4iJ6z0JFI2NtgsW5keRkTcM85NGak69Mkf5PHUqBz+Xs0T4sg0ppvj9O5EGAJo40FTxmmA== + dependencies: + sparse-array "^1.3.1" + uint8arrays "^3.0.0" + +hard-rejection@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz" + integrity sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA== + harmony-reflect@^1.4.6: version "1.6.2" resolved "https://registry.npmjs.org/harmony-reflect/-/harmony-reflect-1.6.2.tgz" @@ -5505,7 +5644,7 @@ help-me@^4.0.1: help-me@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/help-me/-/help-me-5.0.0.tgz#b1ebe63b967b74060027c2ac61f9be12d354a6f6" + resolved "https://registry.npmjs.org/help-me/-/help-me-5.0.0.tgz" integrity sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg== highlight.js@^10.7.1: @@ -5522,6 +5661,18 @@ hmac-drbg@^1.0.1: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" +hosted-git-info@^2.1.4: + version "2.8.9" + resolved "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz" + integrity sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw== + +hosted-git-info@^4.0.1: + version "4.1.0" + resolved "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz" + integrity sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA== + dependencies: + lru-cache "^6.0.0" + html-escaper@^2.0.0: version "2.0.2" resolved "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz" @@ -5549,7 +5700,7 @@ http-signature@~1.3.6: https-proxy-agent@^7.0.4: version "7.0.5" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz#9e8b5013873299e11fab6fd548405da2d6c602b2" + resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz" integrity sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw== dependencies: agent-base "^7.0.2" @@ -5603,9 +5754,14 @@ imurmurhash@^0.1.4: resolved "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz" integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== +indent-string@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz" + integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== + index-to-position@^0.1.2: version "0.1.2" - resolved "https://registry.yarnpkg.com/index-to-position/-/index-to-position-0.1.2.tgz#e11bfe995ca4d8eddb1ec43274488f3c201a7f09" + resolved "https://registry.npmjs.org/index-to-position/-/index-to-position-0.1.2.tgz" integrity sha512-MWDKS3AS1bGCHLBA2VLImJz42f7bJh8wQsTGCzI3j519/CASStoDONUBVz2I/VID0MpiX3SGSnbOD2xUalbE5g== inflight@^1.0.4: @@ -5621,6 +5777,15 @@ inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, i resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== +interface-ipld-format@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/interface-ipld-format/-/interface-ipld-format-1.0.1.tgz" + integrity sha512-WV/ar+KQJVoQpqRDYdo7YPGYIUHJxCuOEhdvsRpzLqoOIVCqPKdMMYmsLL1nCRsF3yYNio+PAJbCKiv6drrEAg== + dependencies: + cids "^1.1.6" + multicodec "^3.0.1" + multihashes "^4.0.2" + internal-slot@^1.0.7: version "1.0.7" resolved "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz" @@ -5632,12 +5797,12 @@ internal-slot@^1.0.7: inversify@^6.0.2: version "6.0.2" - resolved "https://registry.yarnpkg.com/inversify/-/inversify-6.0.2.tgz#dc7fa0348213d789d35ffb719dea9685570989c7" + resolved "https://registry.npmjs.org/inversify/-/inversify-6.0.2.tgz" integrity sha512-i9m8j/7YIv4mDuYXUAcrpKPSaju/CIly9AHK5jvCBeoiM/2KEsuCQTTP+rzSWWpLYWRukdXFSl6ZTk2/uumbiA== ioredis@^4.26.0: version "4.28.5" - resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-4.28.5.tgz#5c149e6a8d76a7f8fa8a504ffc85b7d5b6797f9f" + resolved "https://registry.npmjs.org/ioredis/-/ioredis-4.28.5.tgz" integrity sha512-3GYo0GJtLqgNXj4YhrisLaNNvWSNwSS2wS4OELGfGxH8I69+XfNdnmV1AyN+ZqMh0i7eX+SWjrwFKDBDgfBC1A== dependencies: cluster-key-slot "^1.1.0" @@ -5654,7 +5819,7 @@ ioredis@^4.26.0: ioredis@^5.0.0, ioredis@^5.4.1: version "5.4.1" - resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-5.4.1.tgz#1c56b70b759f01465913887375ed809134296f40" + resolved "https://registry.npmjs.org/ioredis/-/ioredis-5.4.1.tgz" integrity sha512-2YZsvl7jopIa1gaePkeMtd9rAcSjOOjPtpcLlOeusyO+XH2SK5ZcT+UCrElPP+WVIInh2TzeI4XW9ENaSLVVHA== dependencies: "@ioredis/commands" "^1.1.1" @@ -5672,6 +5837,55 @@ ipaddr.js@1.9.1: resolved "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz" integrity sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g== +ipfs-only-hash@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/ipfs-only-hash/-/ipfs-only-hash-4.0.0.tgz" + integrity sha512-TE1DZCvfw8i3gcsTq3P4TFx3cKFJ3sluu/J3XINkJhIN9OwJgNMqKA+WnKx6ByCb1IoPXsTp1KM7tupElb6SyA== + dependencies: + ipfs-unixfs-importer "^7.0.1" + meow "^9.0.0" + +ipfs-unixfs-importer@^7.0.1: + version "7.0.3" + resolved "https://registry.npmjs.org/ipfs-unixfs-importer/-/ipfs-unixfs-importer-7.0.3.tgz" + integrity sha512-qeFOlD3AQtGzr90sr5Tq1Bi8pT5Nr2tSI8z310m7R4JDYgZc6J1PEZO3XZQ8l1kuGoqlAppBZuOYmPEqaHcVQQ== + dependencies: + bl "^5.0.0" + cids "^1.1.5" + err-code "^3.0.1" + hamt-sharding "^2.0.0" + ipfs-unixfs "^4.0.3" + ipld-dag-pb "^0.22.2" + it-all "^1.0.5" + it-batch "^1.0.8" + it-first "^1.0.6" + it-parallel-batch "^1.0.9" + merge-options "^3.0.4" + multihashing-async "^2.1.0" + rabin-wasm "^0.1.4" + uint8arrays "^2.1.2" + +ipfs-unixfs@^4.0.3: + version "4.0.3" + resolved "https://registry.npmjs.org/ipfs-unixfs/-/ipfs-unixfs-4.0.3.tgz" + integrity sha512-hzJ3X4vlKT8FQ3Xc4M1szaFVjsc1ZydN+E4VQ91aXxfpjFn9G2wsMo1EFdAXNq/BUnN5dgqIOMP5zRYr3DTsAw== + dependencies: + err-code "^3.0.1" + protobufjs "^6.10.2" + +ipld-dag-pb@^0.22.2: + version "0.22.3" + resolved "https://registry.npmjs.org/ipld-dag-pb/-/ipld-dag-pb-0.22.3.tgz" + integrity sha512-dfG5C5OVAR4FEP7Al2CrHWvAyIM7UhAQrjnOYOIxXGQz5NlEj6wGX0XQf6Ru6or1na6upvV3NQfstapQG8X2rg== + dependencies: + cids "^1.0.0" + interface-ipld-format "^1.0.0" + multicodec "^3.0.1" + multihashing-async "^2.0.0" + protobufjs "^6.10.2" + stable "^0.1.8" + uint8arrays "^2.0.5" + is-array-buffer@^3.0.4: version "3.0.4" resolved "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.4.tgz" @@ -5719,6 +5933,13 @@ is-core-module@^2.1.0, is-core-module@^2.11.0: dependencies: has "^1.0.3" +is-core-module@^2.13.0, is-core-module@^2.5.0: + version "2.15.1" + resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.15.1.tgz" + integrity sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ== + dependencies: + hasown "^2.0.2" + is-data-view@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.1.tgz" @@ -5777,11 +5998,16 @@ is-number@^7.0.0: resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== -is-plain-obj@^1.1: +is-plain-obj@^1.1, is-plain-obj@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" + resolved "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz" integrity sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg== +is-plain-obj@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz" + integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== + is-regex@^1.1.4: version "1.1.4" resolved "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz" @@ -5869,7 +6095,7 @@ isexe@^2.0.0: isows@1.0.4: version "1.0.4" - resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.4.tgz#810cd0d90cc4995c26395d2aa4cfa4037ebdf061" + resolved "https://registry.npmjs.org/isows/-/isows-1.0.4.tgz" integrity sha512-hEzjY+x9u9hPmBom9IIAqdJCwNLax+xrPb51vEPpERoFlIxgmZcHzsT5jKG06nvInKOBGvReAVz80Umed5CczQ== isstream@~0.1.2: @@ -5919,6 +6145,28 @@ istanbul-reports@^3.1.3: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" +it-all@^1.0.5: + version "1.0.6" + resolved "https://registry.npmjs.org/it-all/-/it-all-1.0.6.tgz" + integrity sha512-3cmCc6Heqe3uWi3CVM/k51fa/XbMFpQVzFoDsV0IZNHSQDyAXl3c4MjHkFX5kF3922OGj7Myv1nSEUgRtcuM1A== + +it-batch@^1.0.8, it-batch@^1.0.9: + version "1.0.9" + resolved "https://registry.npmjs.org/it-batch/-/it-batch-1.0.9.tgz" + integrity sha512-7Q7HXewMhNFltTsAMdSz6luNhyhkhEtGGbYek/8Xb/GiqYMtwUmopE1ocPSiJKKp3rM4Dt045sNFoUu+KZGNyA== + +it-first@^1.0.6: + version "1.0.7" + resolved "https://registry.npmjs.org/it-first/-/it-first-1.0.7.tgz" + integrity sha512-nvJKZoBpZD/6Rtde6FXqwDqDZGF1sCADmr2Zoc0hZsIvnE449gRFnGctxDf09Bzc/FWnHXAdaHVIetY6lrE0/g== + +it-parallel-batch@^1.0.9: + version "1.0.11" + resolved "https://registry.npmjs.org/it-parallel-batch/-/it-parallel-batch-1.0.11.tgz" + integrity sha512-UWsWHv/kqBpMRmyZJzlmZeoAMA0F3SZr08FBdbhtbe+MtoEBgr/ZUAKrnenhXCBrsopy76QjRH2K/V8kNdupbQ== + dependencies: + it-batch "^1.0.9" + jake@^10.8.5: version "10.8.7" resolved "https://registry.npmjs.org/jake/-/jake-10.8.7.tgz" @@ -6300,7 +6548,7 @@ joycon@^3.1.1: js-levenshtein@^1.1.6: version "1.1.6" - resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" + resolved "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz" integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g== js-sha3@0.8.0, js-sha3@^0.8.0: @@ -6391,6 +6639,11 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== +json-stringify-deterministic@^1.0.8: + version "1.0.12" + resolved "https://registry.npmjs.org/json-stringify-deterministic/-/json-stringify-deterministic-1.0.12.tgz" + integrity sha512-q3PN0lbUdv0pmurkBNdJH3pfFvOTL/Zp0lquqpvcjfKzt6Y0j49EPHAmVHCAS4Ceq/Y+PejWTzyiVpoY71+D6g== + json-stringify-safe@~5.0.1: version "5.0.1" resolved "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" @@ -6437,6 +6690,11 @@ just-performance@4.3.0: resolved "https://registry.npmjs.org/just-performance/-/just-performance-4.3.0.tgz" integrity sha512-L7RjvtJsL0QO8xFs5wEoDDzzJwoiowRw6Rn/GnvldlchS2JQr9wFYPiwZcDfrbbujEKqKN0tvENdbjXdYhDp5Q== +kind-of@^6.0.3: + version "6.0.3" + resolved "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz" + integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== + kleur@^3.0.3: version "3.0.3" resolved "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz" @@ -6513,12 +6771,12 @@ lodash.debounce@^4.0.8: lodash.defaults@^4.2.0: version "4.2.0" - resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" + resolved "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz" integrity sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ== lodash.flatten@^4.4.0: version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f" + resolved "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz" integrity sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g== lodash.get@^4.4.2: @@ -6528,7 +6786,7 @@ lodash.get@^4.4.2: lodash.isarguments@^3.1.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" + resolved "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz" integrity sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg== lodash.isequal@^4.5.0: @@ -6551,6 +6809,11 @@ lodash@^4.17.15, lodash@^4.17.21, lodash@~4.17.15: resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== +long@^4.0.0: + version "4.0.0" + resolved "https://registry.npmjs.org/long/-/long-4.0.0.tgz" + integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz" @@ -6567,7 +6830,7 @@ lru-cache@^6.0.0: lru_map@^0.3.3: version "0.3.3" - resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd" + resolved "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz" integrity sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ== make-dir@^3.0.0: @@ -6594,18 +6857,53 @@ makeerror@1.0.12: dependencies: tmpl "1.0.5" +map-obj@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz" + integrity sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg== + +map-obj@^4.0.0: + version "4.3.0" + resolved "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz" + integrity sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ== + media-typer@0.3.0: version "0.3.0" resolved "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz" integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== +meow@^9.0.0: + version "9.0.0" + resolved "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz" + integrity sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ== + dependencies: + "@types/minimist" "^1.2.0" + camelcase-keys "^6.2.2" + decamelize "^1.2.0" + decamelize-keys "^1.1.0" + hard-rejection "^2.1.0" + minimist-options "4.1.0" + normalize-package-data "^3.0.0" + read-pkg-up "^7.0.1" + redent "^3.0.0" + trim-newlines "^3.0.0" + type-fest "^0.18.0" + yargs-parser "^20.2.3" + merge-options@^1.0.0: version "1.0.1" - resolved "https://registry.yarnpkg.com/merge-options/-/merge-options-1.0.1.tgz#2a64b24457becd4e4dc608283247e94ce589aa32" + resolved "https://registry.npmjs.org/merge-options/-/merge-options-1.0.1.tgz" integrity sha512-iuPV41VWKWBIOpBsjoxjDZw8/GbSfZ2mk7N1453bwMrfzdrIk7EzBd+8UVR6rkw67th7xnk9Dytl3J+lHPdxvg== dependencies: is-plain-obj "^1.1" +merge-options@^3.0.4: + version "3.0.4" + resolved "https://registry.npmjs.org/merge-options/-/merge-options-3.0.4.tgz" + integrity sha512-2Sug1+knBjkaMsMgf1ctR1Ujx+Ayku4EdJN4Z+C2+JzoeF7A3OZ9KM2GY0CpQS51NR61LTurMJrRKPhSs3ZRTQ== + dependencies: + is-plain-obj "^2.1.0" + merge-stream@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz" @@ -6651,6 +6949,11 @@ mimic-fn@^2.1.0: resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== +min-indent@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz" + integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== + minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz" @@ -6689,7 +6992,16 @@ minimatch@^9.0.0: dependencies: brace-expansion "^2.0.1" -minimist@^1.2.0, minimist@^1.2.6: +minimist-options@4.1.0: + version "4.1.0" + resolved "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz" + integrity sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A== + dependencies: + arrify "^1.0.1" + is-plain-obj "^1.1.0" + kind-of "^6.0.3" + +minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6: version "1.2.8" resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== @@ -6726,9 +7038,55 @@ muggle-string@^0.3.1: resolved "https://registry.npmjs.org/muggle-string/-/muggle-string-0.3.1.tgz" integrity sha512-ckmWDJjphvd/FvZawgygcUeQCxzvohjFO5RxTjj4eq8kw359gFF3E1brjfI+viLMxss5JrHTDRHZvu2/tuy0Qg== +multibase@^4.0.1: + version "4.0.6" + resolved "https://registry.npmjs.org/multibase/-/multibase-4.0.6.tgz" + integrity sha512-x23pDe5+svdLz/k5JPGCVdfn7Q5mZVMBETiC+ORfO+sor9Sgs0smJzAjfTbM5tckeCqnaUuMYoz+k3RXMmJClQ== + dependencies: + "@multiformats/base-x" "^4.0.1" + +multicodec@^3.0.1: + version "3.2.1" + resolved "https://registry.npmjs.org/multicodec/-/multicodec-3.2.1.tgz" + integrity sha512-+expTPftro8VAW8kfvcuNNNBgb9gPeNYV9dn+z1kJRWF2vih+/S79f2RVeIwmrJBUJ6NT9IUPWnZDQvegEh5pw== + dependencies: + uint8arrays "^3.0.0" + varint "^6.0.0" + +multiformats@^9.4.2, multiformats@^9.6.4: + version "9.9.0" + resolved "https://registry.npmjs.org/multiformats/-/multiformats-9.9.0.tgz" + integrity sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg== + +multihashes@^4.0.1, multihashes@^4.0.2: + version "4.0.3" + resolved "https://registry.npmjs.org/multihashes/-/multihashes-4.0.3.tgz" + integrity sha512-0AhMH7Iu95XjDLxIeuCOOE4t9+vQZsACyKZ9Fxw2pcsRmlX4iCn1mby0hS0bb+nQOVpdQYWPpnyusw4da5RPhA== + dependencies: + multibase "^4.0.1" + uint8arrays "^3.0.0" + varint "^5.0.2" + +multihashing-async@^2.0.0, multihashing-async@^2.1.0: + version "2.1.4" + resolved "https://registry.npmjs.org/multihashing-async/-/multihashing-async-2.1.4.tgz" + integrity sha512-sB1MiQXPSBTNRVSJc2zM157PXgDtud2nMFUEIvBrsq5Wv96sUclMRK/ecjoP1T/W61UJBqt4tCTwMkUpt2Gbzg== + dependencies: + blakejs "^1.1.0" + err-code "^3.0.0" + js-sha3 "^0.8.0" + multihashes "^4.0.1" + murmurhash3js-revisited "^3.0.0" + uint8arrays "^3.0.0" + +murmurhash3js-revisited@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/murmurhash3js-revisited/-/murmurhash3js-revisited-3.0.0.tgz" + integrity sha512-/sF3ee6zvScXMb1XFJ8gDsSnY+X8PbOyjIuBhtgis10W2Jx4ZjIhikUCIF9c4gpJxVnQIsPAFrSwTCuAjicP6g== + mustache@^4.2.0: version "4.2.0" - resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.2.0.tgz#e5892324d60a12ec9c2a73359edca52972bf6f64" + resolved "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz" integrity sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ== mz@^2.4.0: @@ -6742,7 +7100,7 @@ mz@^2.4.0: nanoid@^3.3.7: version "3.3.7" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" + resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz" integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== natural-compare-lite@^1.4.0: @@ -6762,19 +7120,14 @@ node-addon-api@^3.2.1: node-cache@^5.1.2: version "5.1.2" - resolved "https://registry.yarnpkg.com/node-cache/-/node-cache-5.1.2.tgz#f264dc2ccad0a780e76253a694e9fd0ed19c398d" + resolved "https://registry.npmjs.org/node-cache/-/node-cache-5.1.2.tgz" integrity sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg== dependencies: clone "2.x" -node-domexception@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" - integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== - node-fetch@^2.6.1: version "2.7.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== dependencies: whatwg-url "^5.0.0" @@ -6786,15 +7139,6 @@ node-fetch@^2.6.12: dependencies: whatwg-url "^5.0.0" -node-fetch@^3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.2.tgz#d1e889bacdf733b4ff3b2b243eb7a12866a0b78b" - integrity sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA== - dependencies: - data-uri-to-buffer "^4.0.0" - fetch-blob "^3.1.4" - formdata-polyfill "^4.0.10" - node-gyp-build@^4.3.0: version "4.6.0" resolved "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz" @@ -6825,6 +7169,26 @@ node-telegram-bot-api@^0.65.1: mime "^1.6.0" pump "^2.0.0" +normalize-package-data@^2.5.0: + version "2.5.0" + resolved "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== + dependencies: + hosted-git-info "^2.1.4" + resolve "^1.10.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-package-data@^3.0.0: + version "3.0.3" + resolved "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz" + integrity sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA== + dependencies: + hosted-git-info "^4.0.1" + is-core-module "^2.5.0" + semver "^7.3.4" + validate-npm-package-license "^3.0.1" + normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" @@ -6999,7 +7363,7 @@ open@^8.4.0: openapi-fetch@^0.10.2: version "0.10.2" - resolved "https://registry.yarnpkg.com/openapi-fetch/-/openapi-fetch-0.10.2.tgz#2c16bda62cf182ba780a9d94818294731de0b2d6" + resolved "https://registry.npmjs.org/openapi-fetch/-/openapi-fetch-0.10.2.tgz" integrity sha512-GCzgKIZchnxZRnztiOlRTKk9tQT0NHvs5MNXYFtOwG7xaj1iCJOGDsTLbn/2QUP37PjGTT890qERFjvmjxzQMg== dependencies: openapi-typescript-helpers "^0.0.9" @@ -7023,12 +7387,12 @@ openapi-typescript-helpers@^0.0.8: openapi-typescript-helpers@^0.0.9: version "0.0.9" - resolved "https://registry.yarnpkg.com/openapi-typescript-helpers/-/openapi-typescript-helpers-0.0.9.tgz#bb20cc0b79bf56d4a31a96477d7b2c8d33b9c836" + resolved "https://registry.npmjs.org/openapi-typescript-helpers/-/openapi-typescript-helpers-0.0.9.tgz" integrity sha512-BO2TvIDAO/FPVKz1Nj2gy+pUOHfaoENdK5UP3H0Jbh0VXBf3dwYMs58ZwOjiezrbHA2LamdquoyQgahTPvIxGA== openapi-typescript@^7.0.2: version "7.0.2" - resolved "https://registry.yarnpkg.com/openapi-typescript/-/openapi-typescript-7.0.2.tgz#9e50f8388dbeed87984f340149e6f853e5d77d0f" + resolved "https://registry.npmjs.org/openapi-typescript/-/openapi-typescript-7.0.2.tgz" integrity sha512-BBrYEf0YdW31Ernd07cD/qHoalSuiiUQvy+rHvU/1Iz9WbcFpRsIXrnfEnrEuiGTRuKCG6cDQCrxNK/rbwQRLg== dependencies: "@redocly/openapi-core" "^1.16.0" @@ -7079,7 +7443,7 @@ p-locate@^4.1.0: p-map@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175" + resolved "https://registry.npmjs.org/p-map/-/p-map-2.1.0.tgz" integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw== p-try@^2.0.0: @@ -7111,7 +7475,7 @@ parse-json@^5.0.0, parse-json@^5.2.0: parse-json@^8.1.0: version "8.1.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-8.1.0.tgz#91cdc7728004e955af9cb734de5684733b24a717" + resolved "https://registry.npmjs.org/parse-json/-/parse-json-8.1.0.tgz" integrity sha512-rum1bPifK5SSar35Z6EKZuYPJx85pkNaFrxBK3mwdfSJ1/WKbYrjoW/zTPSjRRamfmVX1ACBIdFAO0VRErW/EA== dependencies: "@babel/code-frame" "^7.22.13" @@ -7233,6 +7597,11 @@ picocolors@^1.0.0: resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz" integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== +picocolors@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" + integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== + picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz" @@ -7248,7 +7617,7 @@ pino-abstract-transport@^1.0.0, pino-abstract-transport@v1.0.0: pino-pretty@^11.2.2: version "11.2.2" - resolved "https://registry.yarnpkg.com/pino-pretty/-/pino-pretty-11.2.2.tgz#5e8ec69b31e90eb187715af07b1d29a544e60d39" + resolved "https://registry.npmjs.org/pino-pretty/-/pino-pretty-11.2.2.tgz" integrity sha512-2FnyGir8nAJAqD3srROdrF1J5BIcMT4nwj7hHSc60El6Uxlym00UbCCd8pYIterstVBFlMyF1yFV8XdGIPbj4A== dependencies: colorette "^2.0.7" @@ -7329,7 +7698,7 @@ pkg-up@^3.1.0: pluralize@^8.0.0: version "8.0.0" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1" + resolved "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz" integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== possible-typed-array-names@^1.0.0: @@ -7338,13 +7707,13 @@ possible-typed-array-names@^1.0.0: integrity sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q== postcss@^8.4.27: - version "8.4.38" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.38.tgz#b387d533baf2054288e337066d81c6bee9db9e0e" - integrity sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A== + version "8.4.49" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.49.tgz#4ea479048ab059ab3ae61d082190fabfd994fe19" + integrity sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA== dependencies: nanoid "^3.3.7" - picocolors "^1.0.0" - source-map-js "^1.2.0" + picocolors "^1.1.1" + source-map-js "^1.2.1" postgres-array@~2.0.0: version "2.0.0" @@ -7394,7 +7763,7 @@ process-nextick-args@~2.0.0: process-warning@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/process-warning/-/process-warning-1.0.0.tgz#980a0b25dc38cd6034181be4b7726d89066b4616" + resolved "https://registry.npmjs.org/process-warning/-/process-warning-1.0.0.tgz" integrity sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q== process-warning@^2.0.0: @@ -7415,6 +7784,25 @@ prompts@^2.0.1: kleur "^3.0.3" sisteransi "^1.0.5" +protobufjs@^6.10.2: + version "6.11.4" + resolved "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.4.tgz" + integrity sha512-5kQWPaJHi1WoCpjTGszzQ32PG2F4+wRY6BmAT4Vfw56Q2FZ4YZzK20xUYQH4YkfehY1e6QSICrJquM6xXZNcrw== + dependencies: + "@protobufjs/aspromise" "^1.1.2" + "@protobufjs/base64" "^1.1.2" + "@protobufjs/codegen" "^2.0.4" + "@protobufjs/eventemitter" "^1.1.0" + "@protobufjs/fetch" "^1.1.0" + "@protobufjs/float" "^1.0.2" + "@protobufjs/inquire" "^1.1.0" + "@protobufjs/path" "^1.1.2" + "@protobufjs/pool" "^1.1.0" + "@protobufjs/utf8" "^1.1.0" + "@types/long" "^4.0.1" + "@types/node" ">=13.7.0" + long "^4.0.0" + proxy-addr@^2.0.7: version "2.0.7" resolved "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz" @@ -7481,9 +7869,26 @@ quick-format-unescaped@^4.0.3: resolved "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz" integrity sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg== +quick-lru@^4.0.1: + version "4.0.1" + resolved "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz" + integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== + +rabin-wasm@^0.1.4: + version "0.1.5" + resolved "https://registry.npmjs.org/rabin-wasm/-/rabin-wasm-0.1.5.tgz" + integrity sha512-uWgQTo7pim1Rnj5TuWcCewRDTf0PEFTSlaUjWP4eY9EbLV9em08v89oCz/WO+wRxpYuO36XEHp4wgYQnAgOHzA== + dependencies: + "@assemblyscript/loader" "^0.9.4" + bl "^5.0.0" + debug "^4.3.1" + minimist "^1.2.5" + node-fetch "^2.6.1" + readable-stream "^3.6.0" + random-bytes@~1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/random-bytes/-/random-bytes-1.0.0.tgz#4f68a1dc0ae58bd3fb95848c30324db75d64360b" + resolved "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz" integrity sha512-iv7LhNVO047HzYR3InF6pUcUsPQiHTM1Qal51DcGSuZFBil1aBBWG5eHPNek7bvILMaYJ/8RU1e8w1AMdHmLQQ== react-is@^18.0.0: @@ -7491,6 +7896,25 @@ react-is@^18.0.0: resolved "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz" integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== +read-pkg-up@^7.0.1: + version "7.0.1" + resolved "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz" + integrity sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg== + dependencies: + find-up "^4.1.0" + read-pkg "^5.2.0" + type-fest "^0.8.1" + +read-pkg@^5.2.0: + version "5.2.0" + resolved "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz" + integrity sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg== + dependencies: + "@types/normalize-package-data" "^2.4.0" + normalize-package-data "^2.5.0" + parse-json "^5.0.0" + type-fest "^0.6.0" + "readable-stream@1.x >=1.1.9": version "1.1.14" resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz" @@ -7546,19 +7970,27 @@ real-require@^0.2.0: resolved "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz" integrity sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg== +redent@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz" + integrity sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg== + dependencies: + indent-string "^4.0.0" + strip-indent "^3.0.0" + redis-commands@1.7.0: version "1.7.0" - resolved "https://registry.yarnpkg.com/redis-commands/-/redis-commands-1.7.0.tgz#15a6fea2d58281e27b1cd1acfb4b293e278c3a89" + resolved "https://registry.npmjs.org/redis-commands/-/redis-commands-1.7.0.tgz" integrity sha512-nJWqw3bTFy21hX/CPKHth6sfhZbdiHP6bTawSgQBlKOVRG7EZkfHbbHwQJnrE4vsQf0CMNE+3gJ4Fmm16vdVlQ== redis-errors@^1.0.0, redis-errors@^1.2.0: version "1.2.0" - resolved "https://registry.yarnpkg.com/redis-errors/-/redis-errors-1.2.0.tgz#eb62d2adb15e4eaf4610c04afe1529384250abad" + resolved "https://registry.npmjs.org/redis-errors/-/redis-errors-1.2.0.tgz" integrity sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w== redis-parser@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/redis-parser/-/redis-parser-3.0.0.tgz#b66d828cdcafe6b4b8a428a7def4c6bcac31c8b4" + resolved "https://registry.npmjs.org/redis-parser/-/redis-parser-3.0.0.tgz" integrity sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A== dependencies: redis-errors "^1.0.0" @@ -7575,7 +8007,7 @@ reflect-metadata@^0.1.13: reflect-metadata@^0.2.2: version "0.2.2" - resolved "https://registry.yarnpkg.com/reflect-metadata/-/reflect-metadata-0.2.2.tgz#400c845b6cba87a21f2c65c4aeb158f4fa4d9c5b" + resolved "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz" integrity sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q== regenerate-unicode-properties@^10.1.0: @@ -7685,6 +8117,15 @@ resolve.exports@^2.0.0: resolved "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz" integrity sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg== +resolve@^1.10.0: + version "1.22.8" + resolved "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + resolve@^1.12.0, resolve@^1.14.2, resolve@^1.20.0, resolve@~1.22.1: version "1.22.2" resolved "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz" @@ -7740,9 +8181,9 @@ rollup@*: fsevents "~2.3.2" rollup@^3.27.1: - version "3.29.4" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.29.4.tgz#4d70c0f9834146df8705bfb69a9a19c9e1109981" - integrity sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw== + version "3.29.5" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.29.5.tgz#8a2e477a758b520fb78daf04bca4c522c1da8a54" + integrity sha512-GVsDdsbJzzy4S/v3dqWPJ7EfvZJfCHiDqe80IyrF59LYuP+e6U1LJoUqeuqRbwAWoMNoXivMNeNAOf5E22VA1w== optionalDependencies: fsevents "~2.3.2" @@ -7816,6 +8257,11 @@ secure-json-parse@^2.4.0, secure-json-parse@^2.5.0: resolved "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.7.0.tgz" integrity sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw== +"semver@2 || 3 || 4 || 5": + version "5.7.2" + resolved "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz" + integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== + semver@7.3.4: version "7.3.4" resolved "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz" @@ -7835,6 +8281,11 @@ semver@^6.0.0, semver@^6.3.0: resolved "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@^7.3.4: + version "7.6.3" + resolved "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz" + integrity sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A== + semver@~7.3.0: version "7.3.8" resolved "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz" @@ -7933,7 +8384,7 @@ sonic-boom@^3.0.0, sonic-boom@^3.1.0: sonic-boom@^4.0.1: version "4.0.1" - resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-4.0.1.tgz#515b7cef2c9290cb362c4536388ddeece07aed30" + resolved "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.0.1.tgz" integrity sha512-hTSD/6JMLyT4r9zeof6UtuBDpjJ9sO08/nmS5djaA9eozT9oOlNdpXSnzcgj4FTqpk3nkLrs61l4gip9r1HCrQ== dependencies: atomic-sleep "^1.0.0" @@ -7943,10 +8394,10 @@ source-map-js@^1.0.2: resolved "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz" integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== -source-map-js@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af" - integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg== +source-map-js@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.1.tgz#1ce5650fddd87abc099eda37dcff024c2667ae46" + integrity sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA== source-map-support@0.5.13: version "0.5.13" @@ -7969,11 +8420,42 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: resolved "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +sparse-array@^1.3.1: + version "1.3.2" + resolved "https://registry.npmjs.org/sparse-array/-/sparse-array-1.3.2.tgz" + integrity sha512-ZT711fePGn3+kQyLuv1fpd3rNSkNF8vd5Kv2D+qnOANeyKs3fx6bUMGWRPvgTTcYV64QMqZKZwcuaQSP3AZ0tg== + spawn-command@^0.0.2-1: version "0.0.2-1" resolved "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz" integrity sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg== +spdx-correct@^3.0.0: + version "3.2.0" + resolved "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz" + integrity sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA== + dependencies: + spdx-expression-parse "^3.0.0" + spdx-license-ids "^3.0.0" + +spdx-exceptions@^2.1.0: + version "2.5.0" + resolved "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz" + integrity sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w== + +spdx-expression-parse@^3.0.0: + version "3.0.1" + resolved "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz" + integrity sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + +spdx-license-ids@^3.0.0: + version "3.0.20" + resolved "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.20.tgz" + integrity sha512-jg25NiDV/1fLtSgEgyvVyDunvaNHbuwF9lfNV17gSmPFAlYzdfNBlLtLzXTevwkPj7DhGbmN9VnmJIgLnhvaBw== + split2@^3.0.0: version "3.2.2" resolved "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz" @@ -8006,6 +8488,11 @@ sshpk@^1.14.1: safer-buffer "^2.0.2" tweetnacl "~0.14.0" +stable@^0.1.8: + version "0.1.8" + resolved "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz" + integrity sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w== + stack-utils@^2.0.3: version "2.0.6" resolved "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz" @@ -8015,7 +8502,7 @@ stack-utils@^2.0.3: standard-as-callback@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/standard-as-callback/-/standard-as-callback-2.1.0.tgz#8953fc05359868a77b5b9739a665c5977bb7df45" + resolved "https://registry.npmjs.org/standard-as-callback/-/standard-as-callback-2.1.0.tgz" integrity sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A== statuses@2.0.1: @@ -8129,6 +8616,13 @@ strip-final-newline@^2.0.0: resolved "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== +strip-indent@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz" + integrity sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ== + dependencies: + min-indent "^1.0.0" + strip-json-comments@^3.1.0, strip-json-comments@^3.1.1, strip-json-comments@~3.1.1: version "3.1.1" resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz" @@ -8166,7 +8660,7 @@ supports-color@^8.0.0, supports-color@^8.1.0: supports-color@^9.4.0: version "9.4.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-9.4.0.tgz#17bfcf686288f531db3dea3215510621ccb55954" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-9.4.0.tgz" integrity sha512-VL+lNrEoIXww1coLPOmiEmK/0sGigko5COxI09KzHc2VJXJsQ37UaQ+8quuxjDeA7+KnLGTWRyOXSLLR2Wb4jw== supports-preserve-symlinks-flag@^1.0.0: @@ -8304,6 +8798,11 @@ tree-kill@^1.2.2: resolved "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz" integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== +trim-newlines@^3.0.0: + version "3.0.1" + resolved "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz" + integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw== + ts-algebra@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/ts-algebra/-/ts-algebra-1.2.0.tgz" @@ -8340,7 +8839,7 @@ ts-jest@^29.1.0: ts-node@10.9.1: version "10.9.1" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" + resolved "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz" integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== dependencies: "@cspotcode/source-map-support" "^0.8.0" @@ -8412,6 +8911,11 @@ type-detect@4.0.8: resolved "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== +type-fest@^0.18.0: + version "0.18.1" + resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz" + integrity sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw== + type-fest@^0.20.2: version "0.20.2" resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz" @@ -8422,9 +8926,19 @@ type-fest@^0.21.3: resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz" integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== +type-fest@^0.6.0: + version "0.6.0" + resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz" + integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg== + +type-fest@^0.8.1: + version "0.8.1" + resolved "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz" + integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== + type-fest@^4.7.1: version "4.21.0" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.21.0.tgz#2eec399d9bda4ac686286314d07c6675fef3fdd8" + resolved "https://registry.npmjs.org/type-fest/-/type-fest-4.21.0.tgz" integrity sha512-ADn2w7hVPcK6w1I0uWnM//y1rLXZhzB9mr0a3OirzclKF1Wp6VzevUmzz/NRAWunOT6E8HrnpGY7xOfc6K57fA== type-is@^1.6.18: @@ -8526,7 +9040,7 @@ typeorm@^0.3.11, typeorm@^0.3.17: typescript@^5.5.3: version "5.5.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.3.tgz#e1b0a3c394190838a0b168e771b0ad56a0af0faa" + resolved "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz" integrity sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ== typescript@~5.0.4: @@ -8546,11 +9060,25 @@ typical@^5.2.0: uid-safe@^2.1.5: version "2.1.5" - resolved "https://registry.yarnpkg.com/uid-safe/-/uid-safe-2.1.5.tgz#2b3d5c7240e8fc2e58f8aa269e5ee49c0857bd3a" + resolved "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz" integrity sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA== dependencies: random-bytes "~1.0.0" +uint8arrays@^2.0.5, uint8arrays@^2.1.2: + version "2.1.10" + resolved "https://registry.npmjs.org/uint8arrays/-/uint8arrays-2.1.10.tgz" + integrity sha512-Q9/hhJa2836nQfEJSZTmr+pg9+cDJS9XEAp7N2Vg5MzL3bK/mkMVfjscRGYruP9jNda6MAdf4QD/y78gSzkp6A== + dependencies: + multiformats "^9.4.2" + +uint8arrays@^3.0.0: + version "3.1.1" + resolved "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.1.tgz" + integrity sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg== + dependencies: + multiformats "^9.4.2" + unbox-primitive@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz" @@ -8566,6 +9094,11 @@ undici-types@~5.26.4: resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz" integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== +undici-types@~6.19.8: + version "6.19.8" + resolved "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz" + integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw== + undici@^5.19.1: version "5.22.1" resolved "https://registry.npmjs.org/undici/-/undici-5.22.1.tgz" @@ -8668,11 +9201,29 @@ v8-to-istanbul@^9.0.1: "@types/istanbul-lib-coverage" "^2.0.1" convert-source-map "^1.6.0" +validate-npm-package-license@^3.0.1: + version "3.0.4" + resolved "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz" + integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== + dependencies: + spdx-correct "^3.0.0" + spdx-expression-parse "^3.0.0" + validator@^13.7.0: version "13.9.0" resolved "https://registry.npmjs.org/validator/-/validator-13.9.0.tgz" integrity sha512-B+dGG8U3fdtM0/aNK4/X8CXq/EcxU2WPrPEkJGslb47qyHsxmbggTWK0yEA4qnYVNF+nxNlN88o14hIcPmSIEA== +varint@^5.0.2: + version "5.0.2" + resolved "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz" + integrity sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow== + +varint@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz" + integrity sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg== + vary@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz" @@ -8689,7 +9240,7 @@ verror@1.10.0: viem@^2.18.4: version "2.18.4" - resolved "https://registry.yarnpkg.com/viem/-/viem-2.18.4.tgz#6af97b68141faa68f624b7cded4956065432a078" + resolved "https://registry.npmjs.org/viem/-/viem-2.18.4.tgz" integrity sha512-JGdN+PgBnZMbm7fc9o0SfHvL0CKyfrlhBUtaz27V+PeHO43Kgc9Zd4WyIbM8Brafq4TvVcnriRFW/FVGOzwEJw== dependencies: "@adraffy/ens-normalize" "1.10.0" @@ -8728,9 +9279,9 @@ vite-tsconfig-paths@^4.2.0: tsconfck "^2.1.0" vite@^4.3.9: - version "4.5.3" - resolved "https://registry.yarnpkg.com/vite/-/vite-4.5.3.tgz#d88a4529ea58bae97294c7e2e6f0eab39a50fb1a" - integrity sha512-kQL23kMeX92v3ph7IauVkXkikdDRsYMGTVl5KY2E9OY4ONLvkHf04MDTbnfo6NKxZiDLWzVpP5oTa8hQD8U3dg== + version "4.5.5" + resolved "https://registry.yarnpkg.com/vite/-/vite-4.5.5.tgz#639b9feca5c0a3bfe3c60cb630ef28bf219d742e" + integrity sha512-ifW3Lb2sMdX+WU91s3R0FyQlAyLxOzCSCP37ujw0+r5POeHPwe6udWVIElKQq8gk3t7b8rkmvqC6IHBpCff4GQ== dependencies: esbuild "^0.18.10" postcss "^8.4.27" @@ -8762,14 +9313,9 @@ walker@^1.0.6, walker@^1.0.8: dependencies: makeerror "1.0.12" -web-streams-polyfill@^3.0.3: - version "3.3.3" - resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b" - integrity sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw== - webauthn-p256@0.0.5: version "0.0.5" - resolved "https://registry.yarnpkg.com/webauthn-p256/-/webauthn-p256-0.0.5.tgz#0baebd2ba8a414b21cc09c0d40f9dd0be96a06bd" + resolved "https://registry.npmjs.org/webauthn-p256/-/webauthn-p256-0.0.5.tgz" integrity sha512-drMGNWKdaixZNobeORVIqq7k5DsRC9FnG201K2QjeOoQLmtSDaSsVZdkg6n5jUALJKcAG++zBPJXmv6hy0nWFg== dependencies: "@noble/curves" "^1.4.0" @@ -8854,7 +9400,7 @@ ws@7.4.6: ws@8.17.1: version "8.17.1" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" + resolved "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz" integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ== ws@^8.4.2: @@ -8884,7 +9430,7 @@ yallist@^4.0.0: yaml-ast-parser@0.0.43: version "0.0.43" - resolved "https://registry.yarnpkg.com/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz#e8a23e6fb4c38076ab92995c5dca33f3d3d7c9bb" + resolved "https://registry.npmjs.org/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz" integrity sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A== yaml@^1.7.2: @@ -8902,7 +9448,7 @@ yargs-parser@21.1.1, yargs-parser@^21.0.1, yargs-parser@^21.1.1: resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== -yargs-parser@^20.2.2: +yargs-parser@^20.2.2, yargs-parser@^20.2.3: version "20.2.9" resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== From ef4b64b61940505c3afcb4337f62675fd302172e Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Wed, 20 Nov 2024 12:33:39 +0500 Subject: [PATCH 02/31] refactor: copy trading schemas from sdk --- .../src/app/routes/__chainId/trade/schemas.ts | 6 +- .../LimitOrderAdvancedSettings.ts | 0 .../tradingSchemas/LimitTradeParameters.ts | 0 .../tradingSchemas/QuoteResultsSerialized.ts | 0 .../tradingSchemas/QuoterParameters.ts | 0 .../tradingSchemas/SwapAdvancedSettings.ts | 0 .../tradingSchemas/TradeParameters.ts | 0 package.json | 6 +- yarn.lock | 199 ++++++++++++++++++ 9 files changed, 206 insertions(+), 5 deletions(-) rename apps/api/src/{app/routes/__chainId/trade => }/tradingSchemas/LimitOrderAdvancedSettings.ts (100%) rename apps/api/src/{app/routes/__chainId/trade => }/tradingSchemas/LimitTradeParameters.ts (100%) rename apps/api/src/{app/routes/__chainId/trade => }/tradingSchemas/QuoteResultsSerialized.ts (100%) rename apps/api/src/{app/routes/__chainId/trade => }/tradingSchemas/QuoterParameters.ts (100%) rename apps/api/src/{app/routes/__chainId/trade => }/tradingSchemas/SwapAdvancedSettings.ts (100%) rename apps/api/src/{app/routes/__chainId/trade => }/tradingSchemas/TradeParameters.ts (100%) diff --git a/apps/api/src/app/routes/__chainId/trade/schemas.ts b/apps/api/src/app/routes/__chainId/trade/schemas.ts index 7975fa8c..ef20fa57 100644 --- a/apps/api/src/app/routes/__chainId/trade/schemas.ts +++ b/apps/api/src/app/routes/__chainId/trade/schemas.ts @@ -1,9 +1,9 @@ import { ChainIdSchema } from '../../../schemas'; import { JSONSchema } from 'json-schema-to-ts'; -import QuoterParametersSchema from './tradingSchemas/QuoterParameters'; -import TradeParametersSchema from './tradingSchemas/TradeParameters'; -import QuoteResultsSchema from './tradingSchemas/QuoteResultsSerialized'; +import QuoterParametersSchema from '../../../../tradingSchemas/QuoterParameters'; +import TradeParametersSchema from '../../../../tradingSchemas/TradeParameters'; +import QuoteResultsSchema from '../../../../tradingSchemas/QuoteResultsSerialized'; export const routeSchema = { type: 'object', diff --git a/apps/api/src/app/routes/__chainId/trade/tradingSchemas/LimitOrderAdvancedSettings.ts b/apps/api/src/tradingSchemas/LimitOrderAdvancedSettings.ts similarity index 100% rename from apps/api/src/app/routes/__chainId/trade/tradingSchemas/LimitOrderAdvancedSettings.ts rename to apps/api/src/tradingSchemas/LimitOrderAdvancedSettings.ts diff --git a/apps/api/src/app/routes/__chainId/trade/tradingSchemas/LimitTradeParameters.ts b/apps/api/src/tradingSchemas/LimitTradeParameters.ts similarity index 100% rename from apps/api/src/app/routes/__chainId/trade/tradingSchemas/LimitTradeParameters.ts rename to apps/api/src/tradingSchemas/LimitTradeParameters.ts diff --git a/apps/api/src/app/routes/__chainId/trade/tradingSchemas/QuoteResultsSerialized.ts b/apps/api/src/tradingSchemas/QuoteResultsSerialized.ts similarity index 100% rename from apps/api/src/app/routes/__chainId/trade/tradingSchemas/QuoteResultsSerialized.ts rename to apps/api/src/tradingSchemas/QuoteResultsSerialized.ts diff --git a/apps/api/src/app/routes/__chainId/trade/tradingSchemas/QuoterParameters.ts b/apps/api/src/tradingSchemas/QuoterParameters.ts similarity index 100% rename from apps/api/src/app/routes/__chainId/trade/tradingSchemas/QuoterParameters.ts rename to apps/api/src/tradingSchemas/QuoterParameters.ts diff --git a/apps/api/src/app/routes/__chainId/trade/tradingSchemas/SwapAdvancedSettings.ts b/apps/api/src/tradingSchemas/SwapAdvancedSettings.ts similarity index 100% rename from apps/api/src/app/routes/__chainId/trade/tradingSchemas/SwapAdvancedSettings.ts rename to apps/api/src/tradingSchemas/SwapAdvancedSettings.ts diff --git a/apps/api/src/app/routes/__chainId/trade/tradingSchemas/TradeParameters.ts b/apps/api/src/tradingSchemas/TradeParameters.ts similarity index 100% rename from apps/api/src/app/routes/__chainId/trade/tradingSchemas/TradeParameters.ts rename to apps/api/src/tradingSchemas/TradeParameters.ts diff --git a/package.json b/package.json index 0297708d..80fe49cc 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,9 @@ "compose:up": "yarn docker-build:affected && docker-compose up", "swagger": "ts-node scripts/fetchCoingeckoSwagger", "gen:types": "npx openapi-typescript", - "postinstall": "yarn gen:types", - "test:api:slippage": "node apps/api/scripts/test-slippage.js" + "postinstall": "yarn gen:types && yarn trading:generateSchemas", + "test:api:slippage": "node apps/api/scripts/test-slippage.js", + "trading:generateSchemas": "cp -R node_modules/@cowprotocol/cow-sdk/dist/schemas/trading apps/api/src/tradingSchemas" }, "private": true, "dependencies": { @@ -94,6 +95,7 @@ "pino-pretty": "^11.2.2", "prettier": "^2.6.2", "ts-jest": "^29.1.0", + "ts-json-schema-generator": "^2.3.0", "ts-node": "10.9.1", "typechain": "^8.2.0", "typescript": "^5.5.3", diff --git a/yarn.lock b/yarn.lock index 1ff50540..0a430935 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1927,6 +1927,18 @@ resolved "https://registry.npmjs.org/@ioredis/commands/-/commands-1.2.0.tgz" integrity sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg== +"@isaacs/cliui@^8.0.2": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" + integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== + dependencies: + string-width "^5.1.2" + string-width-cjs "npm:string-width@^4.2.0" + strip-ansi "^7.0.1" + strip-ansi-cjs "npm:strip-ansi@^6.0.1" + wrap-ansi "^8.1.0" + wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" + "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz" @@ -2735,6 +2747,11 @@ dependencies: esquery "^1.4.0" +"@pkgjs/parseargs@^0.11.0": + version "0.11.0" + resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" + integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== + "@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": version "1.1.2" resolved "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz" @@ -3059,6 +3076,11 @@ expect "^29.0.0" pretty-format "^29.0.0" +"@types/json-schema@^7.0.15": + version "7.0.15" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== + "@types/json-schema@^7.0.9": version "7.0.12" resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz" @@ -3481,6 +3503,11 @@ ansi-regex@^5.0.1: resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== +ansi-regex@^6.0.1: + version "6.1.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.1.0.tgz#95ec409c69619d6cb1b8b34f14b660ef28ebd654" + integrity sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA== + ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz" @@ -3500,6 +3527,11 @@ ansi-styles@^5.0.0: resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz" integrity sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA== +ansi-styles@^6.1.0: + version "6.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" + integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== + any-promise@^1.0.0: version "1.3.0" resolved "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz" @@ -4176,6 +4208,11 @@ commander@^10.0.0: resolved "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz" integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== +commander@^12.0.0: + version "12.1.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-12.1.0.tgz#01423b36f501259fdaac4d0e4d60c96c991585d3" + integrity sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA== + commist@^3.0.0: version "3.2.0" resolved "https://registry.npmjs.org/commist/-/commist-3.2.0.tgz" @@ -4268,6 +4305,15 @@ cross-fetch@^3.1.5: dependencies: node-fetch "^2.6.12" +cross-spawn@^7.0.0: + version "7.0.6" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.6.tgz#8a58fe78f00dcd70c370451759dfbfaf03e8ee9f" + integrity sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz" @@ -4480,6 +4526,11 @@ duplexer@^0.1.1: resolved "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz" integrity sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg== +eastasianwidth@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" + integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== + ecc-jsbn@~0.1.1: version "0.1.2" resolved "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz" @@ -4523,6 +4574,11 @@ emoji-regex@^8.0.0: resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== +emoji-regex@^9.2.2: + version "9.2.2" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" + integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== + end-of-stream@^1.1.0, end-of-stream@^1.4.1, end-of-stream@^1.4.4: version "1.4.4" resolved "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz" @@ -5255,6 +5311,14 @@ for-each@^0.3.3: dependencies: is-callable "^1.1.3" +foreground-child@^3.1.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.3.0.tgz#0ac8644c06e431439f8561db8ecf29a7b5519c77" + integrity sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg== + dependencies: + cross-spawn "^7.0.0" + signal-exit "^4.0.1" + forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz" @@ -5459,6 +5523,18 @@ glob@7.1.7: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^10.3.12: + version "10.4.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.4.5.tgz#f4d9f0b90ffdbab09c9d77f5f29b4262517b0956" + integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg== + dependencies: + foreground-child "^3.1.0" + jackspeak "^3.1.2" + minimatch "^9.0.4" + minipass "^7.1.2" + package-json-from-dist "^1.0.0" + path-scurry "^1.11.1" + glob@^7.1.3, glob@^7.1.4: version "7.2.3" resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" @@ -6167,6 +6243,15 @@ it-parallel-batch@^1.0.9: dependencies: it-batch "^1.0.9" +jackspeak@^3.1.2: + version "3.4.3" + resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a" + integrity sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw== + dependencies: + "@isaacs/cliui" "^8.0.2" + optionalDependencies: + "@pkgjs/parseargs" "^0.11.0" + jake@^10.8.5: version "10.8.7" resolved "https://registry.npmjs.org/jake/-/jake-10.8.7.tgz" @@ -6814,6 +6899,11 @@ long@^4.0.0: resolved "https://registry.npmjs.org/long/-/long-4.0.0.tgz" integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== +lru-cache@^10.2.0: + version "10.4.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" + integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz" @@ -6992,6 +7082,13 @@ minimatch@^9.0.0: dependencies: brace-expansion "^2.0.1" +minimatch@^9.0.4: + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== + dependencies: + brace-expansion "^2.0.1" + minimist-options@4.1.0: version "4.1.0" resolved "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz" @@ -7006,6 +7103,11 @@ minimist@^1.2.0, minimist@^1.2.5, minimist@^1.2.6: resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz" integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" + integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== + mkdirp@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz" @@ -7451,6 +7553,11 @@ p-try@^2.0.0: resolved "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +package-json-from-dist@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz#4f1471a010827a86f94cfd9b0727e36d267de505" + integrity sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw== + packet-reader@1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/packet-reader/-/packet-reader-1.0.0.tgz" @@ -7524,6 +7631,14 @@ path-parse@^1.0.6, path-parse@^1.0.7: resolved "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-scurry@^1.11.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.1.tgz#7960a668888594a0720b12a911d1a742ab9f11d2" + integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA== + dependencies: + lru-cache "^10.2.0" + minipass "^5.0.0 || ^6.0.2 || ^7.0.0" + path-type@^4.0.0: version "4.0.0" resolved "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz" @@ -8242,6 +8357,11 @@ safe-stable-stringify@^2.3.1: resolved "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz" integrity sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g== +safe-stable-stringify@^2.4.3: + version "2.5.0" + resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz#4ca2f8e385f2831c432a719b108a3bf7af42a1dd" + integrity sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA== + safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz" @@ -8365,6 +8485,11 @@ signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== +signal-exit@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" + integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== + sisteransi@^1.0.5: version "1.0.5" resolved "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz" @@ -8538,6 +8663,15 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" @@ -8547,6 +8681,15 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" +string-width@^5.0.1, string-width@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" + integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== + dependencies: + eastasianwidth "^0.2.0" + emoji-regex "^9.2.2" + strip-ansi "^7.0.1" + string.prototype.trim@^1.2.9: version "1.2.9" resolved "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.9.tgz" @@ -8594,6 +8737,13 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz" @@ -8601,6 +8751,13 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" +strip-ansi@^7.0.1: + version "7.1.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" + integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== + dependencies: + ansi-regex "^6.0.1" + strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz" @@ -8837,6 +8994,20 @@ ts-jest@^29.1.0: semver "^7.5.3" yargs-parser "^21.0.1" +ts-json-schema-generator@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/ts-json-schema-generator/-/ts-json-schema-generator-2.3.0.tgz#d533027cdb13b625acba0a3e931a4ba88f0e44ad" + integrity sha512-t4lBQAwZc0sOJq9LJt3NgbznIcslVnm0JeEMFq8qIRklpMRY8jlYD0YmnRWbqBKANxkby91P1XanSSlSOFpUmg== + dependencies: + "@types/json-schema" "^7.0.15" + commander "^12.0.0" + glob "^10.3.12" + json5 "^2.2.3" + normalize-path "^3.0.0" + safe-stable-stringify "^2.4.3" + tslib "^2.6.2" + typescript "^5.4.5" + ts-node@10.9.1: version "10.9.1" resolved "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz" @@ -8880,6 +9051,11 @@ tslib@^2.1.0, tslib@^2.3.0, tslib@^2.4.0, tslib@^2.5.0: resolved "https://registry.npmjs.org/tslib/-/tslib-2.6.0.tgz" integrity sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA== +tslib@^2.6.2: + version "2.8.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" + integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== + tsutils@^3.21.0: version "3.21.0" resolved "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz" @@ -9038,6 +9214,11 @@ typeorm@^0.3.11, typeorm@^0.3.17: uuid "^9.0.0" yargs "^17.6.2" +typescript@^5.4.5: + version "5.6.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b" + integrity sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw== + typescript@^5.5.3: version "5.5.3" resolved "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz" @@ -9371,6 +9552,15 @@ wordwrapjs@^4.0.0: reduce-flatten "^2.0.0" typical "^5.2.0" +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" @@ -9380,6 +9570,15 @@ wrap-ansi@^7.0.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" + integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== + dependencies: + ansi-styles "^6.1.0" + string-width "^5.0.1" + strip-ansi "^7.0.1" + wrappy@1: version "1.0.2" resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" From 1822ead41604c360e32ec9c47b9add06bcef73e4 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Wed, 20 Nov 2024 12:36:58 +0500 Subject: [PATCH 03/31] refactor: move route path --- .../routes/{__chainId/trade => trading}/README.md | 2 +- .../{__chainId/trade => trading}/getQuote.ts | 14 +++----------- .../routes/{__chainId/trade => trading}/schemas.ts | 8 ++++---- .../serializeQuoteAmountsAndCosts.ts | 0 4 files changed, 8 insertions(+), 16 deletions(-) rename apps/api/src/app/routes/{__chainId/trade => trading}/README.md (88%) rename apps/api/src/app/routes/{__chainId/trade => trading}/getQuote.ts (77%) rename apps/api/src/app/routes/{__chainId/trade => trading}/schemas.ts (72%) rename apps/api/src/app/routes/{__chainId/trade => trading}/serializeQuoteAmountsAndCosts.ts (100%) diff --git a/apps/api/src/app/routes/__chainId/trade/README.md b/apps/api/src/app/routes/trading/README.md similarity index 88% rename from apps/api/src/app/routes/__chainId/trade/README.md rename to apps/api/src/app/routes/trading/README.md index 8d30240a..4c423f85 100644 --- a/apps/api/src/app/routes/__chainId/trade/README.md +++ b/apps/api/src/app/routes/trading/README.md @@ -1,7 +1,7 @@ # Example ```ts -fetch('http://127.0.0.1:8080/1/trade/getQuote', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ +fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ trader: { account: '0xfb3c7eb936cAA12B5A884d612393969A557d4307', appCode: 'test1', diff --git a/apps/api/src/app/routes/__chainId/trade/getQuote.ts b/apps/api/src/app/routes/trading/getQuote.ts similarity index 77% rename from apps/api/src/app/routes/__chainId/trade/getQuote.ts rename to apps/api/src/app/routes/trading/getQuote.ts index 9118c6a8..5e4a4b56 100644 --- a/apps/api/src/app/routes/__chainId/trade/getQuote.ts +++ b/apps/api/src/app/routes/trading/getQuote.ts @@ -1,17 +1,15 @@ import { FastifyPluginAsync } from 'fastify'; import { FromSchema } from 'json-schema-to-ts'; -import { apiContainer } from '../../../inversify.config'; +import { apiContainer } from '../../inversify.config'; import { TradingService, tradingServiceSymbol } from '@cowprotocol/services'; import { serializeQuoteAmountsAndCosts } from './serializeQuoteAmountsAndCosts'; -import { bodySchema, errorSchema, routeSchema, successSchema } from './schemas'; +import { bodySchema, errorSchema, successSchema } from './schemas'; - -type RouteSchema = FromSchema; type SuccessSchema = FromSchema; type BodySchema = FromSchema; type ErrorSchema = FromSchema; @@ -22,7 +20,6 @@ const tradingService: TradingService = apiContainer.get( const root: FastifyPluginAsync = async (fastify): Promise => { fastify.post<{ - Params: RouteSchema; Reply: SuccessSchema | ErrorSchema; Body: BodySchema; }>( @@ -37,16 +34,11 @@ const root: FastifyPluginAsync = async (fastify): Promise => { }, }, async function (request, reply) { - const { chainId } = request.params; - const { trader, params } = request.body try { const result = await tradingService.getQuote( - { - ...trader as Parameters[0], - chainId - }, + trader as Parameters[0], params as Parameters[1] ); diff --git a/apps/api/src/app/routes/__chainId/trade/schemas.ts b/apps/api/src/app/routes/trading/schemas.ts similarity index 72% rename from apps/api/src/app/routes/__chainId/trade/schemas.ts rename to apps/api/src/app/routes/trading/schemas.ts index ef20fa57..ec88c2c2 100644 --- a/apps/api/src/app/routes/__chainId/trade/schemas.ts +++ b/apps/api/src/app/routes/trading/schemas.ts @@ -1,9 +1,9 @@ -import { ChainIdSchema } from '../../../schemas'; +import { ChainIdSchema } from '../../schemas'; import { JSONSchema } from 'json-schema-to-ts'; -import QuoterParametersSchema from '../../../../tradingSchemas/QuoterParameters'; -import TradeParametersSchema from '../../../../tradingSchemas/TradeParameters'; -import QuoteResultsSchema from '../../../../tradingSchemas/QuoteResultsSerialized'; +import QuoterParametersSchema from '../../../tradingSchemas/QuoterParameters'; +import TradeParametersSchema from '../../../tradingSchemas/TradeParameters'; +import QuoteResultsSchema from '../../../tradingSchemas/QuoteResultsSerialized'; export const routeSchema = { type: 'object', diff --git a/apps/api/src/app/routes/__chainId/trade/serializeQuoteAmountsAndCosts.ts b/apps/api/src/app/routes/trading/serializeQuoteAmountsAndCosts.ts similarity index 100% rename from apps/api/src/app/routes/__chainId/trade/serializeQuoteAmountsAndCosts.ts rename to apps/api/src/app/routes/trading/serializeQuoteAmountsAndCosts.ts From fdbc4b08e123557381e5a1de906f49868de69379 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Wed, 20 Nov 2024 12:52:51 +0500 Subject: [PATCH 04/31] chore: remove generateSchemas call --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 80fe49cc..b5b3bd00 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "compose:up": "yarn docker-build:affected && docker-compose up", "swagger": "ts-node scripts/fetchCoingeckoSwagger", "gen:types": "npx openapi-typescript", - "postinstall": "yarn gen:types && yarn trading:generateSchemas", + "postinstall": "yarn gen:types", "test:api:slippage": "node apps/api/scripts/test-slippage.js", "trading:generateSchemas": "cp -R node_modules/@cowprotocol/cow-sdk/dist/schemas/trading apps/api/src/tradingSchemas" }, From 53868f19a03d860eb625ac7ed16435ec8b24528d Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Wed, 20 Nov 2024 12:57:59 +0500 Subject: [PATCH 05/31] chore: bump cow-sdk --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index b5b3bd00..37b5c36b 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "private": true, "dependencies": { "@cowprotocol/cms": "^0.3.0-RC.4", - "@cowprotocol/cow-sdk": "5.8.0-RC.1", + "@cowprotocol/cow-sdk": "5.8.0-RC.2", "@fastify/autoload": "~5.7.1", "@fastify/caching": "^8.3.0", "@fastify/cors": "^8.2.1", diff --git a/yarn.lock b/yarn.lock index 0a430935..a52f94e2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1106,10 +1106,10 @@ resolved "https://registry.npmjs.org/@cowprotocol/contracts/-/contracts-1.6.0.tgz" integrity sha512-+UKhYRzkvnqqviBru5D3btTLYc743n0O5YTG+wpYwGl4fb7VNKBkFHe28C5Mf1DF/kOfmqfu+0IAvX9Vuq5Dqw== -"@cowprotocol/cow-sdk@5.8.0-RC.1": - version "5.8.0-RC.1" - resolved "https://registry.npmjs.org/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.1.tgz" - integrity sha512-qGEw3ebJnT3lI1nJ0b8/yak2FAhMe1oWXPJyh3wCVhWuzCTNms/NTUa00J3m7ic526xbN27ksvTHTYbUI5wVXA== +"@cowprotocol/cow-sdk@5.8.0-RC.2": + version "5.8.0-RC.2" + resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.2.tgz#c9fac6f0ebade01cff06a84c68aee27c35bd6b8e" + integrity sha512-Eqpg+H1GnHVwPNLvtX5JxnzM/3vLetdn7m2G5o6bCNFqPnBMbMne+NrEQ4voRTn4v5Y/FS0WD7d+q+CCeQU2dA== dependencies: "@cowprotocol/app-data" "^2.1.0" "@cowprotocol/contracts" "^1.6.0" From e06f0cdb00008cfc056926a76ca23520f9d1e7a3 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Wed, 20 Nov 2024 13:02:26 +0500 Subject: [PATCH 06/31] chore: fux build --- apps/twap/src/app/utils/getApiBaseUrl.ts | 4 +- .../src/app/utils/getConditionalOrderId.ts | 9 +- .../src/gen/coingecko/coingecko-dex-types.ts | 22 +- .../src/gen/coingecko/coingecko-pro-types.ts | 1283 +++++++++-------- .../gen/coingecko/coingecko-public-types.ts | 1257 ++++++++-------- .../repositories/src/gen/cow/cow-api-types.ts | 32 +- 6 files changed, 1332 insertions(+), 1275 deletions(-) diff --git a/apps/twap/src/app/utils/getApiBaseUrl.ts b/apps/twap/src/app/utils/getApiBaseUrl.ts index 2023ecdc..82980035 100644 --- a/apps/twap/src/app/utils/getApiBaseUrl.ts +++ b/apps/twap/src/app/utils/getApiBaseUrl.ts @@ -5,7 +5,9 @@ const COW_API_BASE_URL = 'https://api.cow.fi'; const CHAIN_ID_TO_NAME: Record = { 1: 'mainnet', 100: 'xdai', - '11155111': 'sepolia', + 11155111: 'sepolia', + 8453: 'base', // TODO: check + 42161: 'arbitrum', // TODO: check }; export function getApiBaseUrl(chainId: SupportedChainId): string { diff --git a/apps/twap/src/app/utils/getConditionalOrderId.ts b/apps/twap/src/app/utils/getConditionalOrderId.ts index 49bb9dcd..6ad14641 100644 --- a/apps/twap/src/app/utils/getConditionalOrderId.ts +++ b/apps/twap/src/app/utils/getConditionalOrderId.ts @@ -1,6 +1,5 @@ import { SupportedChainId } from '@cowprotocol/cow-sdk'; import { CurrencyAmount, Token } from '@uniswap/sdk-core'; -import { hexZeroPad } from '@ethersproject/bytes'; import { defaultAbiCoder } from '@ethersproject/abi'; import { keccak256 } from '@ethersproject/keccak256'; @@ -42,9 +41,11 @@ export const TWAP_ORDER_STRUCT = const twapHandlerAddress = '0x910d00a310f7Dc5B29FE73458F47f519be547D3d'; export const TWAP_HANDLER_ADDRESS: Record = { - 1: twapHandlerAddress, - 100: twapHandlerAddress, - '11155111': twapHandlerAddress, + [SupportedChainId.MAINNET]: twapHandlerAddress, + [SupportedChainId.GNOSIS_CHAIN]: twapHandlerAddress, + [SupportedChainId.ARBITRUM_ONE]: twapHandlerAddress, + [SupportedChainId.BASE]: twapHandlerAddress, + [SupportedChainId.SEPOLIA]: twapHandlerAddress, }; export function twapOrderToStruct(order: TWAPOrder): TWAPOrderStruct { diff --git a/libs/repositories/src/gen/coingecko/coingecko-dex-types.ts b/libs/repositories/src/gen/coingecko/coingecko-dex-types.ts index 4996474a..b9b56f79 100644 --- a/libs/repositories/src/gen/coingecko/coingecko-dex-types.ts +++ b/libs/repositories/src/gen/coingecko/coingecko-dex-types.ts @@ -353,7 +353,7 @@ export interface paths { }; /** * Most Recently Updated Tokens List - * @description This endpoint allows you to **query 100 most recently updated tokens info across all networks on GeckoTerminal** + * @description This endpoint allows you to **query 100 most recently updated tokens info of a specific network or across all networks on GeckoTerminal** */ get: operations["tokens-info-recent-updated"]; put?: never; @@ -954,7 +954,7 @@ export interface components { * "https://tether.to/" * ], * "description": "Tether (USDT) is a cryptocurrency with a value meant to mirror the value of the U.S. dollar...", - * "gt_score": 92.66055045871559, + * "gt_score": 92.6605504587156, * "discord_url": null, * "telegram_handle": null, * "twitter_handle": "Tether_to" @@ -995,7 +995,7 @@ export interface components { * "https://weth.io/" * ], * "description": "WETH is the tokenized/packaged form of ETH that you use to pay for items when you interact with Ethereum dApps...", - * "gt_score": 92.66055045871559, + * "gt_score": 92.6605504587156, * "discord_url": null, * "telegram_handle": null, * "twitter_handle": null @@ -1014,7 +1014,7 @@ export interface components { * "https://tether.to/" * ], * "description": "Tether (USDT) is a cryptocurrency with a value meant to mirror the value of the U.S. dollar. ...", - * "gt_score": 92.66055045871559, + * "gt_score": 92.6605504587156, * "discord_url": null, * "telegram_handle": null, * "twitter_handle": "Tether_to" @@ -1036,7 +1036,7 @@ export interface components { * "coingecko_coin_id": "tensor", * "websites": [], * "description": "TNSR is the native token for the Tensor NFT marketplace on Solana.", - * "gt_score": 41.284403669724774, + * "gt_score": 41.2844036697248, * "metadata_updated_at": "2024-04-08T15:59:04Z", * "discord_url": null, * "telegram_handle": null, @@ -1066,7 +1066,7 @@ export interface components { * 3660.85954963415, * 3417.91885296256, * 3660.85954963415, - * 306823.2770311613 + * 306823.277031161 * ], * [ * 1712448000, @@ -1074,7 +1074,7 @@ export interface components { * 3455.28884490954, * 3352.95305060685, * 3454.61590249189, - * 242144.86478418365 + * 242144.864784184 * ], * [ * 1712361600, @@ -1082,7 +1082,7 @@ export interface components { * 3391.19811016133, * 3317.73497182435, * 3362.60273217873, - * 273323.66168293066 + * 273323.661682931 * ] * ] * } @@ -1187,7 +1187,7 @@ export interface operations { path: { /** @description network id
*refers to [/networks](/reference/networks-list) */ network: string; - /** @description token contract address, comma-separated if more than one token contract address, max 30 addresses */ + /** @description token contract address, comma-separated if more than one token contract address,100 addresses */ addresses: string; }; cookie?: never; @@ -1648,8 +1648,10 @@ export interface operations { "tokens-info-recent-updated": { parameters: { query?: { - /** @description attributes to include */ + /** @description Attributes for related resources to include, which will be returned under the top-level 'included' key */ include?: "network"; + /** @description Filter tokens by provided network
*refers to [/networks](/reference/networks-list) */ + network?: string; }; header?: never; path?: never; diff --git a/libs/repositories/src/gen/coingecko/coingecko-pro-types.ts b/libs/repositories/src/gen/coingecko/coingecko-pro-types.ts index 849e600e..f1f8e1e7 100644 --- a/libs/repositories/src/gen/coingecko/coingecko-pro-types.ts +++ b/libs/repositories/src/gen/coingecko/coingecko-pro-types.ts @@ -1047,10 +1047,10 @@ export interface components { current_remaining_monthly_calls?: number; }; /** @example { - * "usd": 67187.33589365664, - * "usd_market_cap": 1317802988326.2493, - * "usd_24h_vol": 31260929299.52484, - * "usd_24h_change": 3.637278946773539, + * "usd": 67187.3358936566, + * "usd_market_cap": 1317802988326.25, + * "usd_24h_vol": 31260929299.5248, + * "usd_24h_change": 3.63727894677354, * "last_updated_at": 1711356300 * } */ SimplePrice: { @@ -1709,7 +1709,7 @@ export interface components { * }, * "last": 69476, * "volume": 20242.03975, - * "cost_to_move_up_usd": 19320706.39585167, + * "cost_to_move_up_usd": 19320706.3958517, * "cost_to_move_down_usd": 16360235.3694131, * "converted_last": { * "btc": 1.000205, @@ -1845,196 +1845,196 @@ export interface components { * }, * "market_data": { * "current_price": { - * "aed": 154530.09108142683, - * "ars": 33947900.26188303, - * "aud": 61738.405695047535, - * "bch": 165.38167494630605, - * "bdt": 4617857.437514718, - * "bhd": 15859.429741917913, - * "bmd": 42074.70715618848, - * "bnb": 134.15687497173963, - * "brl": 204167.47440069792, + * "aed": 154530.091081427, + * "ars": 33947900.261883, + * "aud": 61738.4056950475, + * "bch": 165.381674946306, + * "bdt": 4617857.43751472, + * "bhd": 15859.4297419179, + * "bmd": 42074.7071561885, + * "bnb": 134.15687497174, + * "brl": 204167.474400698, * "btc": 1, - * "cad": 55797.37289517942, - * "chf": 35380.41087410315, - * "clp": 37070945.97434911, - * "cny": 297872.0967829519, - * "czk": 941726.6142466004, - * "dkk": 284202.0244279068, - * "dot": 5078.184550422312, - * "eos": 49611.91197615977, - * "eth": 18.29654321540394, - * "eur": 38057.70863986569, - * "gbp": 33025.65781339986, - * "gel": 113180.96225014742, - * "hkd": 328622.3965080529, - * "huf": 14607917.577557135, - * "idr": 647533950.6044563, - * "ils": 151504.70926336164, - * "inr": 3501412.9510954972, + * "cad": 55797.3728951794, + * "chf": 35380.4108741032, + * "clp": 37070945.9743491, + * "cny": 297872.096782952, + * "czk": 941726.6142466, + * "dkk": 284202.024427907, + * "dot": 5078.18455042231, + * "eos": 49611.9119761598, + * "eth": 18.2965432154039, + * "eur": 38057.7086398657, + * "gbp": 33025.6578133999, + * "gel": 113180.962250147, + * "hkd": 328622.396508053, + * "huf": 14607917.5775571, + * "idr": 647533950.604456, + * "ils": 151504.709263362, + * "inr": 3501412.9510955, * "jpy": 5933586.69083973, - * "krw": 54466970.65490067, - * "kwd": 12928.716014953645, - * "lkr": 13628686.368770933, - * "ltc": 573.6621797872364, - * "mmk": 88364275.74483082, - * "mxn": 714058.2700891062, - * "myr": 193333.27938268633, - * "ngn": 37725865.42452484, - * "nok": 429848.16731742636, + * "krw": 54466970.6549007, + * "kwd": 12928.7160149536, + * "lkr": 13628686.3687709, + * "ltc": 573.662179787236, + * "mmk": 88364275.7448308, + * "mxn": 714058.270089106, + * "myr": 193333.279382686, + * "ngn": 37725865.4245248, + * "nok": 429848.167317426, * "nzd": 66531.8087825235, - * "php": 2330938.6923034303, - * "pkr": 11705926.359806487, - * "pln": 165640.54862662574, - * "rub": 3755167.3612415865, - * "sar": 157780.1518357064, - * "sek": 423808.00650749775, - * "sgd": 55568.065741178136, - * "thb": 1438863.9771500682, - * "try": 1240206.6063985475, - * "twd": 1291001.3807622658, - * "uah": 1599892.6750505993, - * "usd": 42074.70715618848, - * "vef": 4212.940427549151, - * "vnd": 1021106970.8227047, - * "xag": 1768.3279940253694, - * "xau": 20.39613504103393, - * "xdr": 31351.757663898043, - * "xlm": 324963.64104682615, - * "xrp": 67529.86361098202, - * "yfi": 5.116942760598554, - * "zar": 769994.6998914372, - * "bits": 1000195.713931052, - * "link": 2709.6608365050256, - * "sats": 100019571.3931052 + * "php": 2330938.69230343, + * "pkr": 11705926.3598065, + * "pln": 165640.548626626, + * "rub": 3755167.36124159, + * "sar": 157780.151835706, + * "sek": 423808.006507498, + * "sgd": 55568.0657411781, + * "thb": 1438863.97715007, + * "try": 1240206.60639855, + * "twd": 1291001.38076227, + * "uah": 1599892.6750506, + * "usd": 42074.7071561885, + * "vef": 4212.94042754915, + * "vnd": 1021106970.8227, + * "xag": 1768.32799402537, + * "xau": 20.3961350410339, + * "xdr": 31351.757663898, + * "xlm": 324963.641046826, + * "xrp": 67529.863610982, + * "yfi": 5.11694276059855, + * "zar": 769994.699891437, + * "bits": 1000195.71393105, + * "link": 2709.66083650503, + * "sats": 100019571.393105 * }, * "market_cap": { * "aed": 3022434823129.84, - * "ars": 663982757051427.4, - * "aud": 1207533794818.6636, - * "bch": 3239927812.6139565, - * "bdt": 90320099015790.61, - * "bhd": 310192612917.6729, - * "bmd": 822933961870.5416, - * "bnb": 2629923038.0492373, - * "brl": 3993286227042.8438, + * "ars": 663982757051427, + * "aud": 1207533794818.66, + * "bch": 3239927812.61396, + * "bdt": 90320099015790.6, + * "bhd": 310192612917.673, + * "bmd": 822933961870.542, + * "bnb": 2629923038.04924, + * "brl": 3993286227042.84, * "btc": 19584275, - * "cad": 1091498460326.9937, - * "chf": 692169755329.3134, - * "clp": 725066019537891.1, - * "cny": 5826043276458.686, - * "czk": 18419113668076.95, - * "dkk": 5558672032246.961, - * "dot": 99489102293.36188, - * "eos": 971966018054.8785, - * "eth": 358260658.6305346, - * "eur": 744365987728.8765, - * "gbp": 645995753662.7186, - * "gel": 2213692357431.7495, - * "hkd": 6427484562491.774, - * "huf": 285714442221834.44, + * "cad": 1091498460326.99, + * "chf": 692169755329.313, + * "clp": 725066019537891, + * "cny": 5826043276458.69, + * "czk": 18419113668077, + * "dkk": 5558672032246.96, + * "dot": 99489102293.3619, + * "eos": 971966018054.879, + * "eth": 358260658.630535, + * "eur": 744365987728.877, + * "gbp": 645995753662.719, + * "gel": 2213692357431.75, + * "hkd": 6427484562491.77, + * "huf": 285714442221834, * "idr": 12665035966583838, - * "ils": 2963261756601.5366, - * "inr": 68483700226206.57, - * "jpy": 116054283764084.62, - * "krw": 1065312701660273.2, - * "kwd": 252871147803.5803, - * "lkr": 266561780855891.12, - * "ltc": 11241964101.69766, + * "ils": 2963261756601.54, + * "inr": 68483700226206.6, + * "jpy": 116054283764085, + * "krw": 1065312701660270, + * "kwd": 252871147803.58, + * "lkr": 266561780855891, + * "ltc": 11241964101.6977, * "mmk": 1728305874039080, - * "mxn": 13966176853697.344, - * "myr": 3781381554795.1514, - * "ngn": 737875507571602.2, - * "nok": 8407346818129.712, - * "nzd": 1301287369358.7278, - * "php": 45590539841760.11, - * "pkr": 228954757091481.3, - * "pln": 3239742879771.195, - * "rub": 73446851159342.03, - * "sar": 3086002357014.532, + * "mxn": 13966176853697.3, + * "myr": 3781381554795.15, + * "ngn": 737875507571602, + * "nok": 8407346818129.71, + * "nzd": 1301287369358.73, + * "php": 45590539841760.1, + * "pkr": 228954757091481, + * "pln": 3239742879771.2, + * "rub": 73446851159342, + * "sar": 3086002357014.53, * "sek": 8289208064431.51, - * "sgd": 1086848883442.4248, - * "thb": 28142561489813.086, - * "try": 24257046694416.734, - * "twd": 25250535365752.875, + * "sgd": 1086848883442.42, + * "thb": 28142561489813.1, + * "try": 24257046694416.7, + * "twd": 25250535365752.9, * "uah": 31292101755089.6, - * "usd": 822933961870.5416, - * "vef": 82400377602.09746, + * "usd": 822933961870.542, + * "vef": 82400377602.0975, * "vnd": 19971704184972804, - * "xag": 34586507200.34415, - * "xau": 398925467.35636365, - * "xdr": 613205127018.0251, - * "xlm": 6366989968394.301, - * "xrp": 1322171541704.1318, - * "yfi": 100197984.57701135, - * "zar": 15060230523975.951, - * "bits": 19587833186725.145, - * "link": 53027090934.88813, - * "sats": 1958783318672514.8 + * "xag": 34586507200.3442, + * "xau": 398925467.356364, + * "xdr": 613205127018.025, + * "xlm": 6366989968394.3, + * "xrp": 1322171541704.13, + * "yfi": 100197984.577011, + * "zar": 15060230523976, + * "bits": 19587833186725.1, + * "link": 53027090934.8881, + * "sats": 1958783318672510 * }, * "total_volume": { - * "aed": 91203312150.08063, - * "ars": 20035974370796.53, - * "aud": 36437868164.37399, - * "bch": 97607892.53714487, - * "bdt": 2725449072027.6714, + * "aed": 91203312150.0806, + * "ars": 20035974370796.5, + * "aud": 36437868164.374, + * "bch": 97607892.5371449, + * "bdt": 2725449072027.67, * "bhd": 9360199758.84335, - * "bmd": 24832397519.050613, - * "bnb": 79179085.83047172, - * "brl": 120499184128.79588, - * "btc": 590313.2604817993, - * "cad": 32931483969.88901, - * "chf": 20881438911.782093, - * "clp": 21879188925189.88, - * "cny": 175803441475.87073, - * "czk": 555804929370.7711, - * "dkk": 167735395521.93146, - * "dot": 2997133098.5874844, + * "bmd": 24832397519.0506, + * "bnb": 79179085.8304717, + * "brl": 120499184128.796, + * "btc": 590313.260481799, + * "cad": 32931483969.889, + * "chf": 20881438911.7821, + * "clp": 21879188925189.9, + * "cny": 175803441475.871, + * "czk": 555804929370.771, + * "dkk": 167735395521.931, + * "dot": 2997133098.58748, * "eos": 29280838849.3072, - * "eth": 10798578.648754122, - * "eur": 22461574030.714294, - * "gbp": 19491668952.230877, + * "eth": 10798578.6487541, + * "eur": 22461574030.7143, + * "gbp": 19491668952.2309, * "gel": 66799149326.2464, - * "hkd": 193952199202.66922, - * "huf": 8621560094639.218, - * "idr": 382173081057940.94, - * "ils": 89417738606.47363, - * "inr": 2066526047518.001, - * "jpy": 3501989517686.002, - * "krw": 32146283560336.594, - * "kwd": 7630499109.653902, + * "hkd": 193952199202.669, + * "huf": 8621560094639.22, + * "idr": 382173081057941, + * "ils": 89417738606.4736, + * "inr": 2066526047518, + * "jpy": 3501989517686, + * "krw": 32146283560336.6, + * "kwd": 7630499109.6539, * "lkr": 8043620037935.51, - * "ltc": 338574128.0917383, - * "mmk": 52152396774457.34, - * "mxn": 421435584775.31195, - * "myr": 114104866600.03775, - * "ngn": 22265720911481.547, - * "nok": 253695421433.0574, - * "nzd": 39266923884.12937, - * "php": 1375714772890.6108, - * "pkr": 6908811405778.086, - * "pln": 97760679200.94873, - * "rub": 2216291329580.8867, - * "sar": 93121490696.43959, - * "sek": 250130532110.01724, - * "sgd": 32796147403.410156, - * "thb": 849214282675.6979, - * "try": 731967149325.9987, - * "twd": 761946110895.6648, - * "uah": 944253057952.1875, - * "usd": 24832397519.050613, - * "vef": 2486467963.582537, - * "vnd": 602655037260633.8, - * "xag": 1043663204.3259426, - * "xau": 12037753.021334978, - * "xdr": 18503736849.33296, - * "xlm": 191792809959.6043, - * "xrp": 39855973598.82108, - * "yfi": 3020008.107049232, - * "zar": 454449139819.0017, - * "bits": 590313260481.7993, - * "link": 1599235730.4856293, - * "sats": 59031326048179.93 + * "ltc": 338574128.091738, + * "mmk": 52152396774457.3, + * "mxn": 421435584775.312, + * "myr": 114104866600.038, + * "ngn": 22265720911481.5, + * "nok": 253695421433.057, + * "nzd": 39266923884.1294, + * "php": 1375714772890.61, + * "pkr": 6908811405778.09, + * "pln": 97760679200.9487, + * "rub": 2216291329580.89, + * "sar": 93121490696.4396, + * "sek": 250130532110.017, + * "sgd": 32796147403.4102, + * "thb": 849214282675.698, + * "try": 731967149325.999, + * "twd": 761946110895.665, + * "uah": 944253057952.188, + * "usd": 24832397519.0506, + * "vef": 2486467963.58254, + * "vnd": 602655037260634, + * "xag": 1043663204.32594, + * "xau": 12037753.021335, + * "xdr": 18503736849.333, + * "xlm": 191792809959.604, + * "xrp": 39855973598.8211, + * "yfi": 3020008.10704923, + * "zar": 454449139819.002, + * "bits": 590313260481.799, + * "link": 1599235730.48563, + * "sats": 59031326048179.9 * } * }, * "community_data": { @@ -2156,41 +2156,41 @@ export interface components { * ], * [ * 1711929600000, - * 71246.95144060145 + * 71246.9514406015 * ], * [ * 1711983682000, - * 68887.74951585678 + * 68887.7495158568 * ] * ] */ prices?: number[][]; /** @example [ * [ * 1711843200000, - * 1370247487960.0945 + * 1370247487960.09 * ], * [ * 1711929600000, - * 1401370211582.3662 + * 1401370211582.37 * ], * [ * 1711983682000, - * 1355701979725.1584 + * 1355701979725.16 * ] * ] */ market_caps?: number[][]; /** @example [ * [ * 1711843200000, - * 16408802301.837431 + * 16408802301.8374 * ], * [ * 1711929600000, - * 19723005998.21497 + * 19723005998.215 * ], * [ * 1711983682000, - * 30137418199.643093 + * 30137418199.6431 * ] * ] */ total_volumes?: number[][]; @@ -2199,45 +2199,45 @@ export interface components { /** @example [ * [ * 1704067241331, - * 42261.04061756689 + * 42261.0406175669 * ], * [ * 1704070847420, - * 42493.27640875459 + * 42493.2764087546 * ], * [ * 1704074443652, - * 42654.07310665941 + * 42654.0731066594 * ] * ] */ prices?: number[][]; /** @example [ * [ * 1704067241331, - * 827596236151.1959 + * 827596236151.196 * ], * [ * 1704070847420, - * 831531023621.4114 + * 831531023621.411 * ], * [ * 1704074443652, - * 835499399014.9323 + * 835499399014.932 * ] * ] */ market_caps?: number[][]; /** @example [ * [ * 1704067241331, - * 14305769170.949772 + * 14305769170.9498 * ], * [ * 1704070847420, - * 14130205376.17086 + * 14130205376.1709 * ], * [ * 1704074443652, - * 13697382902.24235 + * 13697382902.2424 * ] * ] */ total_volumes?: number[][]; @@ -2274,21 +2274,12 @@ export interface components { * "chain_identifier": 137, * "name": "Polygon POS", * "shortname": "MATIC", - * "native_coin_id": "matic-network" - * }, - * { - * "id": "ethereum", - * "chain_identifier": 1, - * "name": "Ethereum", - * "shortname": "Ethereum", - * "native_coin_id": "ethereum" - * }, - * { - * "id": "stargaze", - * "chain_identifier": null, - * "name": "Stargaze", - * "shortname": "", - * "native_coin_id": "stargaze" + * "native_coin_id": "matic-network", + * "image": { + * "thumb": "https://coin-images.coingecko.com/asset_platforms/images/15/thumb/polygon_pos.png?1706606645", + * "small": "https://coin-images.coingecko.com/asset_platforms/images/15/small/polygon_pos.png?1706606645", + * "large": "https://coin-images.coingecko.com/asset_platforms/images/15/large/polygon_pos.png?1706606645" + * } * } * ] */ AssetPlatforms: { @@ -2302,6 +2293,8 @@ export interface components { shortname?: string; /** @description chain native coin id */ native_coin_id?: string; + /** @description image of the asset platform */ + image?: string; }; /** @example { * "name": "CoinGecko", @@ -2370,30 +2363,21 @@ export interface components { * { * "id": "layer-1", * "name": "Layer 1 (L1)", - * "market_cap": 2061406861196.135, + * "market_cap": 2061406861196.14, * "market_cap_change_24h": -0.66091235190398, * "content": "", + * "top_3_coins_id": [ + * "bitcoin", + * "ethereum", + * "binancecoin" + * ], * "top_3_coins": [ * "https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1696501400", * "https://assets.coingecko.com/coins/images/279/small/ethereum.png?1696501628", * "https://assets.coingecko.com/coins/images/825/small/bnb-icon2_2x.png?1696501970" * ], - * "volume_24h": 61146432400.17392, + * "volume_24h": 61146432400.1739, * "updated_at": "2024-04-06T08:25:46.402Z" - * }, - * { - * "id": "smart-contract-platform", - * "name": "Smart Contract Platform", - * "market_cap": 744929499224.6548, - * "market_cap_change_24h": -0.584411329310148, - * "content": "Smart contract platforms are usually blockchains that host smart contracts or decentralized applications...", - * "top_3_coins": [ - * "https://assets.coingecko.com/coins/images/279/small/ethereum.png?1696501628", - * "https://assets.coingecko.com/coins/images/825/small/bnb-icon2_2x.png?1696501970", - * "https://assets.coingecko.com/coins/images/4128/small/solana.png?1696504756" - * ], - * "volume_24h": 30987638383.630726, - * "updated_at": "2024-04-06T08:25:33.203Z" * } * ] */ Categories: { @@ -2407,7 +2391,9 @@ export interface components { market_cap_change_24h?: number; /** @description category description */ content?: string; - /** @description top 3 coins in the category */ + /** @description ids of top 3 coins in the category */ + top_3_coins_id?: string[]; + /** @description images of top 3 coins in the category */ top_3_coins?: string[]; /** @description category volume in 24 hours */ volume_24h?: number; @@ -2426,8 +2412,8 @@ export interface components { * "has_trading_incentive": false, * "trust_score": 10, * "trust_score_rank": 1, - * "trade_volume_24h_btc": 51075.62712838519, - * "trade_volume_24h_btc_normalized": 47765.58866374526 + * "trade_volume_24h_btc": 51075.6271283852, + * "trade_volume_24h_btc_normalized": 47765.5886637453 * }, * { * "id": "gdax", @@ -2440,8 +2426,8 @@ export interface components { * "has_trading_incentive": false, * "trust_score": 10, * "trust_score_rank": 2, - * "trade_volume_24h_btc": 37443.72996076475, - * "trade_volume_24h_btc_normalized": 37443.72996076475 + * "trade_volume_24h_btc": 37443.7299607648, + * "trade_volume_24h_btc_normalized": 37443.7299607648 * } * ] */ Exchanges: { @@ -2510,8 +2496,8 @@ export interface components { * "alert_notice": "", * "trust_score": 9, * "trust_score_rank": 6, - * "trade_volume_24h_btc": 207319.13377261316, - * "trade_volume_24h_btc_normalized": 81673.29712441542, + * "trade_volume_24h_btc": 207319.133772613, + * "trade_volume_24h_btc_normalized": 81673.2971244154, * "tickers": [ * { * "base": "BTC", @@ -2524,7 +2510,7 @@ export interface components { * }, * "last": 69476, * "volume": 20242.03975, - * "cost_to_move_up_usd": 19320706.39585167, + * "cost_to_move_up_usd": 19320706.3958517, * "cost_to_move_down_usd": 16360235.3694131, * "converted_last": { * "btc": 1.000205, @@ -2614,14 +2600,14 @@ export interface components { * "symbol": "ETHUSDT", * "index_id": "ETH", * "price": "3395.91", - * "price_percentage_change_24h": 1.5274069068216003, + * "price_percentage_change_24h": 1.5274069068216, * "contract_type": "perpetual", * "index": 3393.5342, * "basis": -0.0523015571479482, * "spread": 0.01, * "funding_rate": -0.007182, * "open_interest": 9327998764.66, - * "volume_24h": 392642535.23212117, + * "volume_24h": 392642535.232121, * "last_traded_at": 1712467658, * "expired_at": null * }, @@ -2630,14 +2616,14 @@ export interface components { * "symbol": "BTC-PERPUSDT", * "index_id": "BTC", * "price": "69434.1", - * "price_percentage_change_24h": 2.040579301057485, + * "price_percentage_change_24h": 2.04057930105749, * "contract_type": "perpetual", * "index": 69407.5, - * "basis": -0.0005763032738348229, + * "basis": -0.000576303273834822, * "spread": 0.01, * "funding_rate": 0.012, * "open_interest": 7690212057.6, - * "volume_24h": 132888173.54699957, + * "volume_24h": 132888173.547, * "last_traded_at": 1712467920, * "expired_at": null * } @@ -2748,7 +2734,7 @@ export interface components { * "index_basis_percentage": -0.071, * "bid_ask_spread": 0.000217533173808922, * "funding_rate": 0.005, - * "open_interest_usd": 28102263.99977152, + * "open_interest_usd": 28102263.9997715, * "h24_volume": 2679284723, * "converted_volume": { * "btc": "888.799603175094638929930629459045946", @@ -2846,6 +2832,7 @@ export interface components { * "image": { * "small": "https://assets.coingecko.com/nft_contracts/images/38/small/da64989d9762c8a61b3c65917edfdf97.png?1707287183" * }, + * "banner_image": "https://coin-images.coingecko.com/nft_contracts/images/20/bored-ape-yacht-club-banner.png?1708416120", * "description": "Pudgy Penguins is a collection of 8,888 unique NFTs featuring cute cartoon penguins, which are generated from a collection of 150 different hand-drawn traits.", * "native_currency": "ethereum", * "native_currency_symbol": "ETH", @@ -2863,16 +2850,16 @@ export interface components { * }, * "floor_price_in_usd_24h_percentage_change": 1.07067, * "floor_price_24h_percentage_change": { - * "usd": 1.070670607177908, - * "native_currency": 1.214574898785425 + * "usd": 1.07067060717791, + * "native_currency": 1.21457489878543 * }, * "market_cap_24h_percentage_change": { - * "usd": 1.0706706071776666, - * "native_currency": -0.4048582995951417 + * "usd": 1.07067060717767, + * "native_currency": -0.404858299595142 * }, * "volume_24h_percentage_change": { - * "usd": -3.1983377669874073, - * "native_currency": -1.801855313900942 + * "usd": -3.19833776698741, + * "native_currency": -1.80185531390094 * }, * "number_of_unique_addresses": 4752, * "number_of_unique_addresses_24h_percentage_change": 0.08425, @@ -2880,7 +2867,7 @@ export interface components { * "total_supply": 8888, * "one_day_sales": 36, * "one_day_sales_24h_percentage_change": -2.7027027027027, - * "one_day_average_sale_price": 11.941194388888889, + * "one_day_average_sale_price": 11.9411943888889, * "one_day_average_sale_price_24h_percentage_change": 0.925870927379588, * "links": { * "homepage": "https://www.pudgypenguins.com/", @@ -2888,24 +2875,24 @@ export interface components { * "discord": "https://discord.gg/pudgypenguins" * }, * "floor_price_7d_percentage_change": { - * "usd": -18.00149482623651, - * "native_currency": -13.793103448275861 + * "usd": -18.0014948262365, + * "native_currency": -13.7931034482759 * }, * "floor_price_14d_percentage_change": { - * "usd": -8.632353394310407, - * "native_currency": -8.619051100226626 + * "usd": -8.63235339431041, + * "native_currency": -8.61905110022663 * }, * "floor_price_30d_percentage_change": { - * "usd": -14.376564931440935, - * "native_currency": -0.7779012541673281 + * "usd": -14.3765649314409, + * "native_currency": -0.777901254167328 * }, * "floor_price_60d_percentage_change": { - * "usd": 15.27797587032817, + * "usd": 15.2779758703282, * "native_currency": -18.0327868852459 * }, * "floor_price_1y_percentage_change": { * "usd": 429.5685372855, - * "native_currency": 196.20853080568722 + * "native_currency": 196.208530805687 * }, * "explorers": [ * { @@ -2916,7 +2903,20 @@ export interface components { * "name": "Ethplorer", * "link": "https://ethplorer.io/address/0xBd3531dA5CF5857e7CfAA92426877b022e612cf8" * } - * ] + * ], + * "user_favorites_count": 3660, + * "ath": { + * "native_currency": 22.9, + * "usd": 67535 + * }, + * "ath_change_percentage": { + * "native_currency": -59.825327510917, + * "usd": -64.3396788440525 + * }, + * "ath_date": { + * "native_currency": "2024-02-17T09:25:05.056Z", + * "usd": "2024-02-29T11:45:08.150Z" + * } * } */ NFTData: { /** @description nft collection id */ @@ -2933,6 +2933,10 @@ export interface components { image?: { small?: string; }; + /** @description nft collection banner image url */ + banner_image?: { + small?: string; + }; /** @description nft collection description */ description?: string; /** @description nft collection native currency */ @@ -3022,6 +3026,25 @@ export interface components { name?: string; link?: string; }[]; + /** @description nft collection user favorites count */ + user_favorites_count?: number; + /** @description nft collection all time highs */ + ath?: { + native_currency?: number; + usd?: number; + }; + /** @description nft collection all time highs change percentage */ + ath_change_percentage?: { + native_currency?: number; + usd?: number; + }; + /** @description nft collection all time highs date */ + ath_date?: { + /** Format: date-time */ + native_currency?: string; + /** Format: date-time */ + usd?: string; + }; }; /** @example [ * { @@ -3050,16 +3073,16 @@ export interface components { * }, * "floor_price_in_usd_24h_percentage_change": 8.27604, * "floor_price_24h_percentage_change": { - * "usd": 8.276036095552893, - * "native_currency": 1.627709265442404 + * "usd": 8.27603609555289, + * "native_currency": 1.6277092654424 * }, * "market_cap_24h_percentage_change": { - * "usd": 8.276036095552811, - * "native_currency": 1.627709265442404 + * "usd": 8.27603609555281, + * "native_currency": 1.6277092654424 * }, * "volume_24h_percentage_change": { - * "usd": 32.68767488214406, - * "native_currency": 24.54043325089837 + * "usd": 32.6876748821441, + * "native_currency": 24.5404332508984 * }, * "number_of_unique_addresses": 4756, * "number_of_unique_addresses_24h_percentage_change": 0.10524, @@ -3067,7 +3090,7 @@ export interface components { * "total_supply": 8888, * "one_day_sales": 33, * "one_day_sales_24h_percentage_change": 22.2222222222222, - * "one_day_average_sale_price": 12.19299902909091, + * "one_day_average_sale_price": 12.1929990290909, * "one_day_average_sale_price_24h_percentage_change": 1.8967181143714 * } * ] */ @@ -3145,11 +3168,11 @@ export interface components { * "floor_price_usd": [ * [ * 1626912000000, - * 90.16757646534482 + * 90.1675764653448 * ], * [ * 1626998400000, - * 97.32160550000182 + * 97.3216055000018 * ], * [ * 1627084800000, @@ -3173,7 +3196,7 @@ export interface components { * "h24_volume_usd": [ * [ * 1626912000000, - * 2860.115525480738 + * 2860.11552548074 * ], * [ * 1626998400000, @@ -3181,7 +3204,7 @@ export interface components { * ], * [ * 1627084800000, - * 925.4082790669777 + * 925.408279066978 * ] * ], * "h24_volume_native": [ @@ -3201,15 +3224,15 @@ export interface components { * "market_cap_usd": [ * [ * 1626912000000, - * 33281860.868135665 + * 33281860.8681357 * ], * [ * 1626998400000, - * 38474832.81210672 + * 38474832.8121067 * ], * [ * 1627084800000, - * 44827378.86746599 + * 44827378.867466 * ] * ], * "market_cap_native": [ @@ -3514,74 +3537,74 @@ export interface components { * "small": "https://assets.coingecko.com/coins/images/28470/small/MTLOGO.png?1696527464", * "large": "https://assets.coingecko.com/coins/images/28470/large/MTLOGO.png?1696527464", * "slug": "moon-tropica", - * "price_btc": 0.0005301634743332989, + * "price_btc": 0.000530163474333298, * "score": 0, * "data": { - * "price": 36.97171180169754, + * "price": 36.9717118016975, * "price_btc": "0.000530163474333299", * "price_change_percentage_24h": { - * "aed": -4.044674476087556, - * "ars": -4.049900089458546, - * "aud": -4.049900089458019, - * "bch": -2.3756796248748864, - * "bdt": -4.049900089458495, - * "bhd": -4.169270133964371, - * "bmd": -4.049900089458533, - * "bnb": -3.4734695990217044, - * "brl": -4.0499000894584745, - * "btc": -5.9858537505924625, - * "cad": -4.049900089458477, + * "aed": -4.04467447608756, + * "ars": -4.04990008945855, + * "aud": -4.04990008945802, + * "bch": -2.37567962487489, + * "bdt": -4.0499000894585, + * "bhd": -4.16927013396437, + * "bmd": -4.04990008945853, + * "bnb": -3.4734695990217, + * "brl": -4.04990008945847, + * "btc": -5.98585375059246, + * "cad": -4.04990008945848, * "chf": -4.04990008945855, - * "clp": -5.025675567567188, - * "cny": -4.049900089458403, - * "czk": -4.049900089458641, - * "dkk": -4.049900089458638, - * "dot": -5.982387795212445, + * "clp": -5.02567556756719, + * "cny": -4.0499000894584, + * "czk": -4.04990008945864, + * "dkk": -4.04990008945864, + * "dot": -5.98238779521245, * "eos": -5.74405098071799, - * "eth": -5.0568944511997085, - * "eur": -4.096616197526041, - * "gbp": -4.049900089458471, - * "gel": -4.049900089458967, - * "hkd": -4.0499000894585215, - * "huf": -4.053877164508182, - * "idr": -4.049900089458211, - * "ils": -4.4092202121097746, - * "inr": -4.049900089458557, - * "jpy": -4.049900089459048, - * "krw": -4.049900089458465, - * "kwd": -4.120414696850362, - * "lkr": -4.049900089458902, - * "ltc": -5.293413388383373, - * "mmk": -4.049900089458767, - * "mxn": -4.0499000894591966, - * "myr": -4.049900089458715, - * "ngn": -4.049900089458488, - * "nok": -4.0499000894585375, - * "nzd": -4.049900089458602, - * "php": -4.049900089458442, - * "pkr": -4.049900089458451, - * "pln": -4.049900089458555, - * "rub": -4.049900089458471, - * "sar": -4.049900089458411, - * "sek": -4.049900089458544, - * "sgd": -4.049900089458575, - * "thb": -4.041056870708535, - * "try": -4.049900089458374, - * "twd": -4.0499000894584665, + * "eth": -5.05689445119971, + * "eur": -4.09661619752604, + * "gbp": -4.04990008945847, + * "gel": -4.04990008945897, + * "hkd": -4.04990008945852, + * "huf": -4.05387716450818, + * "idr": -4.04990008945821, + * "ils": -4.40922021210977, + * "inr": -4.04990008945856, + * "jpy": -4.04990008945905, + * "krw": -4.04990008945847, + * "kwd": -4.12041469685036, + * "lkr": -4.0499000894589, + * "ltc": -5.29341338838337, + * "mmk": -4.04990008945877, + * "mxn": -4.0499000894592, + * "myr": -4.04990008945872, + * "ngn": -4.04990008945849, + * "nok": -4.04990008945854, + * "nzd": -4.0499000894586, + * "php": -4.04990008945844, + * "pkr": -4.04990008945845, + * "pln": -4.04990008945856, + * "rub": -4.04990008945847, + * "sar": -4.04990008945841, + * "sek": -4.04990008945854, + * "sgd": -4.04990008945858, + * "thb": -4.04105687070854, + * "try": -4.04990008945837, + * "twd": -4.04990008945847, * "uah": -4.17945939929411, - * "usd": -4.049900089458533, - * "vef": -4.049900089458404, - * "vnd": -4.049900089458679, - * "xag": -4.062083010251626, - * "xau": -4.049900089458423, - * "xdr": -4.049900089458524, - * "xlm": -4.124939249003918, - * "xrp": -4.481270699934758, + * "usd": -4.04990008945853, + * "vef": -4.0499000894584, + * "vnd": -4.04990008945868, + * "xag": -4.06208301025163, + * "xau": -4.04990008945842, + * "xdr": -4.04990008945852, + * "xlm": -4.12493924900392, + * "xrp": -4.48127069993476, * "yfi": -4.04427366181248, * "zar": -4.0499000894588, - * "bits": -5.9858537505924465, - * "link": -5.120058065995313, - * "sats": -5.9858537505924545 + * "bits": -5.98585375059245, + * "link": -5.12005806599531, + * "sats": -5.98585375059245 * }, * "market_cap": "$99,703,583", * "market_cap_btc": "1428.83459310001", @@ -3603,73 +3626,73 @@ export interface components { * "small": "https://assets.coingecko.com/coins/images/12493/small/GALA_token_image_-_200PNG.png?1709725869", * "large": "https://assets.coingecko.com/coins/images/12493/large/GALA_token_image_-_200PNG.png?1709725869", * "slug": "gala", - * "price_btc": 8.995385509920279e-7, + * "price_btc": 8.99538550992028e-7, * "score": 1, * "data": { - * "price": 0.06273061361614252, + * "price": 0.0627306136161425, * "price_btc": "0.000000899538550992028", * "price_change_percentage_24h": { - * "aed": 9.607800289428866, - * "ars": 9.601831178453207, + * "aed": 9.60780028942887, + * "ars": 9.60183117845321, * "aud": 9.60183117845384, - * "bch": 11.467421966306494, - * "bdt": 9.601831178453276, - * "bhd": 9.465477224909796, - * "bmd": 9.601831178453173, - * "bnb": 10.223428485128215, - * "brl": 9.601831178453361, - * "btc": 7.387458257241243, - * "cad": 9.601831178453283, - * "chf": 9.601831178453216, - * "clp": 8.487222863095175, - * "cny": 9.601831178453274, - * "czk": 9.601831178453118, - * "dkk": 9.601831178453255, - * "dot": 7.376880264270369, - * "eos": 7.628589329562328, - * "eth": 8.451082207534835, - * "eur": 9.548468326361439, - * "gbp": 9.601831178453317, - * "gel": 9.601831178452892, - * "hkd": 9.601831178453269, - * "huf": 9.597288247194557, - * "idr": 9.601831178452711, - * "ils": 9.191387172052512, - * "inr": 9.601831178453226, - * "jpy": 9.601831178453017, - * "krw": 9.601831178453276, - * "kwd": 9.521283788693184, - * "lkr": 9.601831178453256, - * "ltc": 8.065248250452148, - * "mmk": 9.601831178452926, - * "mxn": 9.601831178453205, - * "myr": 9.601831178453285, - * "ngn": 9.601831178453272, - * "nok": 9.601831178453201, + * "bch": 11.4674219663065, + * "bdt": 9.60183117845328, + * "bhd": 9.4654772249098, + * "bmd": 9.60183117845317, + * "bnb": 10.2234284851282, + * "brl": 9.60183117845336, + * "btc": 7.38745825724124, + * "cad": 9.60183117845328, + * "chf": 9.60183117845322, + * "clp": 8.48722286309518, + * "cny": 9.60183117845327, + * "czk": 9.60183117845312, + * "dkk": 9.60183117845326, + * "dot": 7.37688026427037, + * "eos": 7.62858932956233, + * "eth": 8.45108220753484, + * "eur": 9.54846832636144, + * "gbp": 9.60183117845332, + * "gel": 9.60183117845289, + * "hkd": 9.60183117845327, + * "huf": 9.59728824719456, + * "idr": 9.60183117845271, + * "ils": 9.19138717205251, + * "inr": 9.60183117845323, + * "jpy": 9.60183117845302, + * "krw": 9.60183117845328, + * "kwd": 9.52128378869318, + * "lkr": 9.60183117845326, + * "ltc": 8.06524825045215, + * "mmk": 9.60183117845293, + * "mxn": 9.60183117845321, + * "myr": 9.60183117845329, + * "ngn": 9.60183117845327, + * "nok": 9.6018311784532, * "nzd": 9.60183117845338, - * "php": 9.601831178453331, - * "pkr": 9.601831178452992, - * "pln": 9.601831178453399, - * "rub": 9.601831178453267, - * "sar": 9.601831178453297, - * "sek": 9.601831178453194, - * "sgd": 9.601831178453194, + * "php": 9.60183117845333, + * "pkr": 9.60183117845299, + * "pln": 9.6018311784534, + * "rub": 9.60183117845327, + * "sar": 9.6018311784533, + * "sek": 9.60183117845319, + * "sgd": 9.60183117845319, * "thb": 9.61193260585552, * "try": 9.60183117845312, - * "twd": 9.601831178452995, - * "uah": 9.453838236106627, - * "usd": 9.601831178453173, - * "vef": 9.601831178453372, + * "twd": 9.601831178453, + * "uah": 9.45383823610663, + * "usd": 9.60183117845317, + * "vef": 9.60183117845337, * "vnd": 9.60183117845306, - * "xag": 9.587914877904465, - * "xau": 9.601831178453322, - * "xdr": 9.601831178453349, - * "xlm": 9.491125969692098, - * "xrp": 8.997673436109869, - * "yfi": 9.544091113766347, + * "xag": 9.58791487790447, + * "xau": 9.60183117845332, + * "xdr": 9.60183117845335, + * "xlm": 9.4911259696921, + * "xrp": 8.99767343610987, + * "yfi": 9.54409111376635, * "zar": 9.6018311784527, - * "bits": 7.387458257241251, - * "link": 8.376626532676953, + * "bits": 7.38745825724125, + * "link": 8.37662653267695, * "sats": 7.38745825724125 * }, * "market_cap": "$2,365,621,969", @@ -3679,7 +3702,7 @@ export interface components { * "sparkline": "https://www.coingecko.com/coins/12493/sparkline.svg", * "content": { * "title": "What is GALA?", - * "description": "Gala is a blockchain gaming ecosystem. Gamers can explore different type of games and have their experiences interact across each other on the Gala platform. The GALA token is the utility token and primary medium of exchange of the ecosystem. Game items are represented as NFTs on the Ethereum blockchain and users can trade them on all marketplaces." + * "description": "Gala is a blockchain gaming ecosystem. Gamers can explore different type of games and have their experiences interact across each other on the Gala platform. The GALA token is the utility token and primary medium of exchange of the ecosystem. Game items are represented as NFTs on the Ethereum blockchain and users can trade them on all marketplaces." * } * } * } @@ -3727,77 +3750,77 @@ export interface components { * { * "id": 251, * "name": "Solana Meme Coins", - * "market_cap_1h_change": 1.4453764946553134, + * "market_cap_1h_change": 1.44537649465531, * "slug": "solana-meme-coins", * "coins_count": 79, * "data": { - * "market_cap": 8237562936.011124, - * "market_cap_btc": 118852.27622489528, - * "total_volume": 1207846273.3244412, - * "total_volume_btc": 17426.911336459012, + * "market_cap": 8237562936.01112, + * "market_cap_btc": 118852.276224895, + * "total_volume": 1207846273.32444, + * "total_volume_btc": 17426.911336459, * "market_cap_change_percentage_24h": { - * "aed": 14.230396523539737, - * "ars": 14.224569755904016, - * "aud": 14.224175671448258, - * "bch": 10.54444640788801, - * "bdt": 14.22417567144842, - * "bhd": 14.082071130168746, - * "bmd": 14.224175671448535, - * "bnb": 12.624477239332412, - * "brl": 14.221695576046988, - * "btc": 11.84681099262996, - * "cad": 14.232580997300973, - * "chf": 14.224175671448508, - * "clp": 13.062559896881549, - * "cny": 14.217858661401426, - * "czk": 14.224175671448577, - * "dkk": 14.224175671448444, - * "dot": 10.696648493582588, - * "eos": 10.12173144446242, - * "eth": 11.884759639001178, - * "eur": 14.168562295958932, - * "gbp": 14.224175671448489, - * "gel": 14.224175671449085, - * "hkd": 14.224175671448705, - * "huf": 14.21944114673665, - * "idr": 14.224175671448897, - * "ils": 13.796421611262415, - * "inr": 14.224175671448592, - * "jpy": 14.224175671448288, - * "krw": 14.224175671448533, - * "kwd": 14.140231278377183, + * "aed": 14.2303965235397, + * "ars": 14.224569755904, + * "aud": 14.2241756714483, + * "bch": 10.544446407888, + * "bdt": 14.2241756714484, + * "bhd": 14.0820711301687, + * "bmd": 14.2241756714485, + * "bnb": 12.6244772393324, + * "brl": 14.221695576047, + * "btc": 11.84681099263, + * "cad": 14.232580997301, + * "chf": 14.2241756714485, + * "clp": 13.0625598968815, + * "cny": 14.2178586614014, + * "czk": 14.2241756714486, + * "dkk": 14.2241756714484, + * "dot": 10.6966484935826, + * "eos": 10.1217314444624, + * "eth": 11.8847596390012, + * "eur": 14.1685622959589, + * "gbp": 14.2241756714485, + * "gel": 14.2241756714491, + * "hkd": 14.2241756714487, + * "huf": 14.2194411467367, + * "idr": 14.2241756714489, + * "ils": 13.7964216112624, + * "inr": 14.2241756714486, + * "jpy": 14.2241756714483, + * "krw": 14.2241756714485, + * "kwd": 14.1402312783772, * "lkr": 14.2241756714485, - * "ltc": 8.642866877624703, - * "mmk": 14.224175671448963, - * "mxn": 14.224175671448078, - * "myr": 14.224175671448464, - * "ngn": 14.224175671448572, - * "nok": 14.224175671448524, - * "nzd": 14.22417567144808, - * "php": 14.224175671448599, - * "pkr": 14.224175671448386, - * "pln": 14.206825106648202, - * "rub": 14.224175671448602, - * "sar": 14.224175671448705, - * "sek": 14.224175671448574, - * "sgd": 14.224175671448508, - * "thb": 14.234703116161398, - * "try": 14.224175671448606, - * "twd": 14.224175671448991, - * "uah": 14.06994127898445, - * "usd": 14.224175671448535, - * "vef": 14.224175671448553, - * "vnd": 14.224175671448933, - * "xag": 14.209672465238517, - * "xau": 14.224175671448783, - * "xdr": 14.224175671448712, - * "xlm": 11.83204356427227, - * "xrp": 12.417240014724353, - * "yfi": 12.795491855495357, - * "zar": 14.224175671448144, - * "bits": 11.846810992629957, - * "link": 11.65665127230344, - * "sats": 11.846810992629955 + * "ltc": 8.6428668776247, + * "mmk": 14.224175671449, + * "mxn": 14.2241756714481, + * "myr": 14.2241756714485, + * "ngn": 14.2241756714486, + * "nok": 14.2241756714485, + * "nzd": 14.2241756714481, + * "php": 14.2241756714486, + * "pkr": 14.2241756714484, + * "pln": 14.2068251066482, + * "rub": 14.2241756714486, + * "sar": 14.2241756714487, + * "sek": 14.2241756714486, + * "sgd": 14.2241756714485, + * "thb": 14.2347031161614, + * "try": 14.2241756714486, + * "twd": 14.224175671449, + * "uah": 14.0699412789845, + * "usd": 14.2241756714485, + * "vef": 14.2241756714486, + * "vnd": 14.2241756714489, + * "xag": 14.2096724652385, + * "xau": 14.2241756714488, + * "xdr": 14.2241756714487, + * "xlm": 11.8320435642723, + * "xrp": 12.4172400147244, + * "yfi": 12.7954918554954, + * "zar": 14.2241756714481, + * "bits": 11.84681099263, + * "link": 11.6566512723034, + * "sats": 11.84681099263 * }, * "sparkline": "https://www.coingecko.com/categories/25211443/sparkline.svg" * } @@ -3805,77 +3828,77 @@ export interface components { * { * "id": 327, * "name": "Gaming Platform", - * "market_cap_1h_change": 1.1050692959116248, + * "market_cap_1h_change": 1.10506929591162, * "slug": "gaming-platform", * "coins_count": 20, * "data": { - * "market_cap": 3665275001.853747, - * "market_cap_btc": 52882.90728027729, + * "market_cap": 3665275001.85375, + * "market_cap_btc": 52882.9072802773, * "total_volume": 218189404.503211, - * "total_volume_btc": 3148.0557508090187, + * "total_volume_btc": 3148.05575080902, * "market_cap_change_percentage_24h": { - * "aed": 5.953195292443641, - * "ars": 5.947790735793044, - * "aud": 5.947425206927055, + * "aed": 5.95319529244364, + * "ars": 5.94779073579304, + * "aud": 5.94742520692706, * "bch": 2.53433127439418, - * "bdt": 5.947425206927214, - * "bhd": 5.815617643683333, - * "bmd": 5.9474252069273215, - * "bnb": 4.4636418572644425, - * "brl": 5.945124820686694, - * "btc": 3.742325760876501, - * "cad": 5.955221477960618, - * "chf": 5.947425206927288, - * "clp": 4.869980789651604, - * "cny": 5.941565931116702, - * "czk": 5.947425206927346, - * "dkk": 5.947425206927227, - * "dot": 2.675504708088687, - * "eos": 2.1422464840411943, - * "eth": 3.7775246261734994, - * "eur": 5.895841609098276, + * "bdt": 5.94742520692721, + * "bhd": 5.81561764368333, + * "bmd": 5.94742520692732, + * "bnb": 4.46364185726444, + * "brl": 5.94512482068669, + * "btc": 3.7423257608765, + * "cad": 5.95522147796062, + * "chf": 5.94742520692729, + * "clp": 4.8699807896516, + * "cny": 5.9415659311167, + * "czk": 5.94742520692735, + * "dkk": 5.94742520692723, + * "dot": 2.67550470808869, + * "eos": 2.14224648404119, + * "eth": 3.7775246261735, + * "eur": 5.89584160909828, * "gbp": 5.94742520692727, - * "gel": 5.947425206927817, - * "hkd": 5.947425206927471, - * "huf": 5.943033748640541, - * "idr": 5.9474252069276545, - * "ils": 5.550666455707389, + * "gel": 5.94742520692782, + * "hkd": 5.94742520692747, + * "huf": 5.94303374864054, + * "idr": 5.94742520692765, + * "ils": 5.55066645570739, * "inr": 5.94742520692736, * "jpy": 5.94742520692707, - * "krw": 5.947425206927302, + * "krw": 5.9474252069273, * "kwd": 5.86956347359295, * "lkr": 5.94742520692729, - * "ltc": 0.7705413072238989, - * "mmk": 5.947425206927696, - * "mxn": 5.947425206926885, - * "myr": 5.947425206927239, - * "ngn": 5.947425206927365, - * "nok": 5.9474252069272895, - * "nzd": 5.947425206926885, - * "php": 5.947425206927361, - * "pkr": 5.947425206927167, - * "pln": 5.931331874183391, + * "ltc": 0.770541307223899, + * "mmk": 5.9474252069277, + * "mxn": 5.94742520692689, + * "myr": 5.94742520692724, + * "ngn": 5.94742520692737, + * "nok": 5.94742520692729, + * "nzd": 5.94742520692689, + * "php": 5.94742520692736, + * "pkr": 5.94742520692717, + * "pln": 5.93133187418339, * "rub": 5.94742520692736, - * "sar": 5.947425206927473, - * "sek": 5.9474252069273605, - * "sgd": 5.947425206927288, - * "thb": 5.957189826849315, - * "try": 5.947425206927379, - * "twd": 5.947425206927743, - * "uah": 5.804366728598461, - * "usd": 5.9474252069273215, + * "sar": 5.94742520692747, + * "sek": 5.94742520692736, + * "sgd": 5.94742520692729, + * "thb": 5.95718982684932, + * "try": 5.94742520692738, + * "twd": 5.94742520692774, + * "uah": 5.80436672859846, + * "usd": 5.94742520692732, * "vef": 5.94742520692733, * "vnd": 5.94742520692767, - * "xag": 5.933972911507694, - * "xau": 5.947425206927534, - * "xdr": 5.947425206927486, - * "xlm": 3.7286283890002943, - * "xrp": 4.2714211629570755, - * "yfi": 4.622264654484985, - * "zar": 5.9474252069269395, - * "bits": 3.742325760876498, - * "link": 3.5659451249189047, - * "sats": 3.742325760876507 + * "xag": 5.93397291150769, + * "xau": 5.94742520692753, + * "xdr": 5.94742520692749, + * "xlm": 3.72862838900029, + * "xrp": 4.27142116295708, + * "yfi": 4.62226465448499, + * "zar": 5.94742520692694, + * "bits": 3.7423257608765, + * "link": 3.5659451249189, + * "sats": 3.74232576087651 * }, * "sparkline": "https://www.coingecko.com/categories/25211410/sparkline.svg" * } @@ -3995,146 +4018,146 @@ export interface components { * "ended_icos": 3376, * "markets": 1046, * "total_market_cap": { - * "btc": 39003738.08471593, - * "eth": 803832137.2075309, - * "ltc": 26721173267.535767, - * "bch": 3981159931.513415, + * "btc": 39003738.0847159, + * "eth": 803832137.207531, + * "ltc": 26721173267.5358, + * "bch": 3981159931.51342, * "bnb": 4670513150.58714, - * "eos": 2641998753398.4077, - * "xrp": 4567762968374.063, - * "xlm": 21049307801356.547, - * "link": 153517938957.19897, - * "dot": 315120726481.16595, - * "yfi": 324671967.6108449, - * "usd": 2721226850772.6313, - * "aed": 9993705609462.484, - * "ars": 2341775032921961.5, - * "aud": 4135040261091.559, - * "bdt": 298245137607204.1, - * "bhd": 1024582727718.6569, - * "bmd": 2721226850772.6313, - * "brl": 13785980136430.713, - * "cad": 3698283351542.5464, - * "chf": 2454228235855.375, - * "clp": 2557393918759367.5, - * "cny": 19681001075527.992, - * "czk": 63568675602103.72, - * "dkk": 18728571677757.562, - * "eur": 2508293570926.523, - * "gbp": 2153208842849.7563, - * "gel": 7292887960070.655, - * "hkd": 21307070180207.188, + * "eos": 2641998753398.41, + * "xrp": 4567762968374.06, + * "xlm": 21049307801356.5, + * "link": 153517938957.199, + * "dot": 315120726481.166, + * "yfi": 324671967.610845, + * "usd": 2721226850772.63, + * "aed": 9993705609462.48, + * "ars": 2341775032921960, + * "aud": 4135040261091.56, + * "bdt": 298245137607204, + * "bhd": 1024582727718.66, + * "bmd": 2721226850772.63, + * "brl": 13785980136430.7, + * "cad": 3698283351542.55, + * "chf": 2454228235855.38, + * "clp": 2557393918759370, + * "cny": 19681001075528, + * "czk": 63568675602103.7, + * "dkk": 18728571677757.6, + * "eur": 2508293570926.52, + * "gbp": 2153208842849.76, + * "gel": 7292887960070.66, + * "hkd": 21307070180207.2, * "huf": 979811947048335, * "idr": 43234171898362830, - * "ils": 10201683535213.324, - * "inr": 226670207147326.38, - * "jpy": 412551596711385.75, + * "ils": 10201683535213.3, + * "inr": 226670207147326, + * "jpy": 412551596711386, * "krw": 3677112086909555, - * "kwd": 836219405108.1758, - * "lkr": 812593109477405.5, + * "kwd": 836219405108.176, + * "lkr": 812593109477406, * "mmk": 5706555839881336, - * "mxn": 44773978111872.44, - * "myr": 12919024474043.053, + * "mxn": 44773978111872.4, + * "myr": 12919024474043.1, * "ngn": 3522998071018357, - * "nok": 29197131372679.86, - * "nzd": 4524820631515.687, + * "nok": 29197131372679.9, + * "nzd": 4524820631515.69, * "php": 153994230206450, - * "pkr": 755251422720380.5, - * "pln": 10747177948492.383, - * "rub": 251732363568358.97, - * "sar": 10207395390373.113, - * "sek": 29054498267296.645, - * "sgd": 3672056167154.7974, - * "thb": 99649147572586.36, - * "try": 87273829665781.25, - * "twd": 87422678053291.61, - * "uah": 105534042826571.94, - * "vef": 272476444567.86353, + * "pkr": 755251422720381, + * "pln": 10747177948492.4, + * "rub": 251732363568359, + * "sar": 10207395390373.1, + * "sek": 29054498267296.6, + * "sgd": 3672056167154.8, + * "thb": 99649147572586.4, + * "try": 87273829665781.3, + * "twd": 87422678053291.6, + * "uah": 105534042826572, + * "vef": 272476444567.864, * "vnd": 67937284004880150, - * "zar": 50878778428895.97, - * "xdr": 2052425485204.5413, + * "zar": 50878778428896, + * "xdr": 2052425485204.54, * "xag": 99002369095.9216, - * "xau": 1167950564.3516145, - * "bits": 39003738084715.93, - * "sats": 3900373808471593.5 + * "xau": 1167950564.35161, + * "bits": 39003738084715.9, + * "sats": 3900373808471590 * }, * "total_volume": { * "btc": 993675.225562481, - * "eth": 20478757.151921887, - * "ltc": 680759567.6148158, - * "bch": 101425662.95452334, - * "bnb": 118987908.24412876, - * "eos": 67308643636.075134, - * "xrp": 116370202467.68745, - * "xlm": 536260797157.8833, - * "link": 3911085965.397742, - * "dot": 8028144848.205925, - * "yfi": 8271476.183867172, - * "usd": 69327091133.54892, - * "aed": 254603742187.9583, + * "eth": 20478757.1519219, + * "ltc": 680759567.614816, + * "bch": 101425662.954523, + * "bnb": 118987908.244129, + * "eos": 67308643636.0751, + * "xrp": 116370202467.687, + * "xlm": 536260797157.883, + * "link": 3911085965.39774, + * "dot": 8028144848.20593, + * "yfi": 8271476.18386717, + * "usd": 69327091133.5489, + * "aed": 254603742187.958, * "ars": 59660021021604.7, - * "aud": 105345981331.98444, + * "aud": 105345981331.984, * "bdt": 7598215425943.58, - * "bhd": 26102689718.14816, - * "bmd": 69327091133.54892, - * "brl": 351217283120.7607, - * "cad": 94218983205.04971, - * "chf": 62524924932.79855, - * "clp": 65153216175224.445, - * "cny": 501401253914.27954, - * "czk": 1619501647007.038, - * "dkk": 477136772017.5372, - * "eur": 63902315579.43983, - * "gbp": 54856031438.69647, - * "gel": 185796604237.91116, - * "hkd": 542827657221.1319, - * "huf": 24962090950805.31, - * "idr": 1101451492157040.8, - * "ils": 259902273109.11288, - * "inr": 5774743147085.059, - * "jpy": 10510333651301.709, - * "krw": 93679615385638.72, - * "kwd": 21303868469.883915, - * "lkr": 20701955274048.176, - * "mmk": 145382556642718.72, - * "mxn": 1140680226674.9573, - * "myr": 329130365156.52313, - * "ngn": 89753343519839.38, - * "nok": 743838091608.2996, - * "nzd": 115276185884.68079, - * "php": 3923220156574.6226, - * "pkr": 19241094948336.27, - * "pln": 273799512470.6537, - * "rub": 6413236921211.558, - * "sar": 260047790673.40265, - * "sek": 740204312126.5353, + * "bhd": 26102689718.1482, + * "bmd": 69327091133.5489, + * "brl": 351217283120.761, + * "cad": 94218983205.0497, + * "chf": 62524924932.7986, + * "clp": 65153216175224.4, + * "cny": 501401253914.28, + * "czk": 1619501647007.04, + * "dkk": 477136772017.537, + * "eur": 63902315579.4398, + * "gbp": 54856031438.6965, + * "gel": 185796604237.911, + * "hkd": 542827657221.132, + * "huf": 24962090950805.3, + * "idr": 1101451492157040, + * "ils": 259902273109.113, + * "inr": 5774743147085.06, + * "jpy": 10510333651301.7, + * "krw": 93679615385638.7, + * "kwd": 21303868469.8839, + * "lkr": 20701955274048.2, + * "mmk": 145382556642719, + * "mxn": 1140680226674.96, + * "myr": 329130365156.523, + * "ngn": 89753343519839.4, + * "nok": 743838091608.3, + * "nzd": 115276185884.681, + * "php": 3923220156574.62, + * "pkr": 19241094948336.3, + * "pln": 273799512470.654, + * "rub": 6413236921211.56, + * "sar": 260047790673.403, + * "sek": 740204312126.535, * "sgd": 93550808700.7045, - * "thb": 2538702546310.5654, - * "try": 2223423872616.704, - * "twd": 2227215995174.6167, - * "uah": 2688628550997.977, - * "vef": 6941721635.202251, - * "vnd": 1730798106094996.5, - * "zar": 1296208622923.966, - * "xdr": 52288433291.474365, - * "xag": 2522224952.6170354, - * "xau": 29755187.514519222, + * "thb": 2538702546310.57, + * "try": 2223423872616.7, + * "twd": 2227215995174.62, + * "uah": 2688628550997.98, + * "vef": 6941721635.20225, + * "vnd": 1730798106095000, + * "zar": 1296208622923.97, + * "xdr": 52288433291.4744, + * "xag": 2522224952.61704, + * "xau": 29755187.5145192, * "bits": 993675225562.481, * "sats": 99367522556248.1 * }, * "market_cap_percentage": { - * "btc": 50.446526323358434, - * "eth": 14.922806691821144, - * "usdt": 3.9290064119981887, - * "bnb": 3.2939520356345176, - * "sol": 2.9507480132815944, - * "usdc": 1.2092204926353505, - * "xrp": 1.2052348104116084, - * "steth": 1.1830926679376446, - * "doge": 1.0577856035454278, - * "ada": 0.7659872946940993 + * "btc": 50.4465263233584, + * "eth": 14.9228066918211, + * "usdt": 3.92900641199819, + * "bnb": 3.29395203563452, + * "sol": 2.95074801328159, + * "usdc": 1.20922049263535, + * "xrp": 1.20523481041161, + * "steth": 1.18309266793764, + * "doge": 1.05778560354543, + * "ada": 0.765987294694099 * }, - * "market_cap_change_percentage_24h_usd": 1.721795060602718, + * "market_cap_change_percentage_24h_usd": 1.72179506060272, * "updated_at": 1712512855 * } * } */ @@ -4178,7 +4201,7 @@ export interface components { * "trading_volume_24h": "5046503746.288261648853195485635", * "defi_dominance": "3.8676503084614763642371703099489945457095080090859886", * "top_coin_name": "Lido Staked Ether", - * "top_coin_defi_dominance": 30.589442518868005 + * "top_coin_defi_dominance": 30.589442518868 * } * } */ GlobalDeFi: { diff --git a/libs/repositories/src/gen/coingecko/coingecko-public-types.ts b/libs/repositories/src/gen/coingecko/coingecko-public-types.ts index d1b44801..a9123b06 100644 --- a/libs/repositories/src/gen/coingecko/coingecko-public-types.ts +++ b/libs/repositories/src/gen/coingecko/coingecko-public-types.ts @@ -733,10 +733,10 @@ export interface components { gecko_says?: string; }; /** @example { - * "usd": 67187.33589365664, - * "usd_market_cap": 1317802988326.2493, - * "usd_24h_vol": 31260929299.52484, - * "usd_24h_change": 3.637278946773539, + * "usd": 67187.3358936566, + * "usd_market_cap": 1317802988326.25, + * "usd_24h_vol": 31260929299.5248, + * "usd_24h_change": 3.63727894677354, * "last_updated_at": 1711356300 * } */ SimplePrice: { @@ -1347,7 +1347,7 @@ export interface components { * }, * "last": 69476, * "volume": 20242.03975, - * "cost_to_move_up_usd": 19320706.39585167, + * "cost_to_move_up_usd": 19320706.3958517, * "cost_to_move_down_usd": 16360235.3694131, * "converted_last": { * "btc": 1.000205, @@ -1483,196 +1483,196 @@ export interface components { * }, * "market_data": { * "current_price": { - * "aed": 154530.09108142683, - * "ars": 33947900.26188303, - * "aud": 61738.405695047535, - * "bch": 165.38167494630605, - * "bdt": 4617857.437514718, - * "bhd": 15859.429741917913, - * "bmd": 42074.70715618848, - * "bnb": 134.15687497173963, - * "brl": 204167.47440069792, + * "aed": 154530.091081427, + * "ars": 33947900.261883, + * "aud": 61738.4056950475, + * "bch": 165.381674946306, + * "bdt": 4617857.43751472, + * "bhd": 15859.4297419179, + * "bmd": 42074.7071561885, + * "bnb": 134.15687497174, + * "brl": 204167.474400698, * "btc": 1, - * "cad": 55797.37289517942, - * "chf": 35380.41087410315, - * "clp": 37070945.97434911, - * "cny": 297872.0967829519, - * "czk": 941726.6142466004, - * "dkk": 284202.0244279068, - * "dot": 5078.184550422312, - * "eos": 49611.91197615977, - * "eth": 18.29654321540394, - * "eur": 38057.70863986569, - * "gbp": 33025.65781339986, - * "gel": 113180.96225014742, - * "hkd": 328622.3965080529, - * "huf": 14607917.577557135, - * "idr": 647533950.6044563, - * "ils": 151504.70926336164, - * "inr": 3501412.9510954972, + * "cad": 55797.3728951794, + * "chf": 35380.4108741032, + * "clp": 37070945.9743491, + * "cny": 297872.096782952, + * "czk": 941726.6142466, + * "dkk": 284202.024427907, + * "dot": 5078.18455042231, + * "eos": 49611.9119761598, + * "eth": 18.2965432154039, + * "eur": 38057.7086398657, + * "gbp": 33025.6578133999, + * "gel": 113180.962250147, + * "hkd": 328622.396508053, + * "huf": 14607917.5775571, + * "idr": 647533950.604456, + * "ils": 151504.709263362, + * "inr": 3501412.9510955, * "jpy": 5933586.69083973, - * "krw": 54466970.65490067, - * "kwd": 12928.716014953645, - * "lkr": 13628686.368770933, - * "ltc": 573.6621797872364, - * "mmk": 88364275.74483082, - * "mxn": 714058.2700891062, - * "myr": 193333.27938268633, - * "ngn": 37725865.42452484, - * "nok": 429848.16731742636, + * "krw": 54466970.6549007, + * "kwd": 12928.7160149536, + * "lkr": 13628686.3687709, + * "ltc": 573.662179787236, + * "mmk": 88364275.7448308, + * "mxn": 714058.270089106, + * "myr": 193333.279382686, + * "ngn": 37725865.4245248, + * "nok": 429848.167317426, * "nzd": 66531.8087825235, - * "php": 2330938.6923034303, - * "pkr": 11705926.359806487, - * "pln": 165640.54862662574, - * "rub": 3755167.3612415865, - * "sar": 157780.1518357064, - * "sek": 423808.00650749775, - * "sgd": 55568.065741178136, - * "thb": 1438863.9771500682, - * "try": 1240206.6063985475, - * "twd": 1291001.3807622658, - * "uah": 1599892.6750505993, - * "usd": 42074.70715618848, - * "vef": 4212.940427549151, - * "vnd": 1021106970.8227047, - * "xag": 1768.3279940253694, - * "xau": 20.39613504103393, - * "xdr": 31351.757663898043, - * "xlm": 324963.64104682615, - * "xrp": 67529.86361098202, - * "yfi": 5.116942760598554, - * "zar": 769994.6998914372, - * "bits": 1000195.713931052, - * "link": 2709.6608365050256, - * "sats": 100019571.3931052 + * "php": 2330938.69230343, + * "pkr": 11705926.3598065, + * "pln": 165640.548626626, + * "rub": 3755167.36124159, + * "sar": 157780.151835706, + * "sek": 423808.006507498, + * "sgd": 55568.0657411781, + * "thb": 1438863.97715007, + * "try": 1240206.60639855, + * "twd": 1291001.38076227, + * "uah": 1599892.6750506, + * "usd": 42074.7071561885, + * "vef": 4212.94042754915, + * "vnd": 1021106970.8227, + * "xag": 1768.32799402537, + * "xau": 20.3961350410339, + * "xdr": 31351.757663898, + * "xlm": 324963.641046826, + * "xrp": 67529.863610982, + * "yfi": 5.11694276059855, + * "zar": 769994.699891437, + * "bits": 1000195.71393105, + * "link": 2709.66083650503, + * "sats": 100019571.393105 * }, * "market_cap": { * "aed": 3022434823129.84, - * "ars": 663982757051427.4, - * "aud": 1207533794818.6636, - * "bch": 3239927812.6139565, - * "bdt": 90320099015790.61, - * "bhd": 310192612917.6729, - * "bmd": 822933961870.5416, - * "bnb": 2629923038.0492373, - * "brl": 3993286227042.8438, + * "ars": 663982757051427, + * "aud": 1207533794818.66, + * "bch": 3239927812.61396, + * "bdt": 90320099015790.6, + * "bhd": 310192612917.673, + * "bmd": 822933961870.542, + * "bnb": 2629923038.04924, + * "brl": 3993286227042.84, * "btc": 19584275, - * "cad": 1091498460326.9937, - * "chf": 692169755329.3134, - * "clp": 725066019537891.1, - * "cny": 5826043276458.686, - * "czk": 18419113668076.95, - * "dkk": 5558672032246.961, - * "dot": 99489102293.36188, - * "eos": 971966018054.8785, - * "eth": 358260658.6305346, - * "eur": 744365987728.8765, - * "gbp": 645995753662.7186, - * "gel": 2213692357431.7495, - * "hkd": 6427484562491.774, - * "huf": 285714442221834.44, + * "cad": 1091498460326.99, + * "chf": 692169755329.313, + * "clp": 725066019537891, + * "cny": 5826043276458.69, + * "czk": 18419113668077, + * "dkk": 5558672032246.96, + * "dot": 99489102293.3619, + * "eos": 971966018054.879, + * "eth": 358260658.630535, + * "eur": 744365987728.877, + * "gbp": 645995753662.719, + * "gel": 2213692357431.75, + * "hkd": 6427484562491.77, + * "huf": 285714442221834, * "idr": 12665035966583838, - * "ils": 2963261756601.5366, - * "inr": 68483700226206.57, - * "jpy": 116054283764084.62, - * "krw": 1065312701660273.2, - * "kwd": 252871147803.5803, - * "lkr": 266561780855891.12, - * "ltc": 11241964101.69766, + * "ils": 2963261756601.54, + * "inr": 68483700226206.6, + * "jpy": 116054283764085, + * "krw": 1065312701660270, + * "kwd": 252871147803.58, + * "lkr": 266561780855891, + * "ltc": 11241964101.6977, * "mmk": 1728305874039080, - * "mxn": 13966176853697.344, - * "myr": 3781381554795.1514, - * "ngn": 737875507571602.2, - * "nok": 8407346818129.712, - * "nzd": 1301287369358.7278, - * "php": 45590539841760.11, - * "pkr": 228954757091481.3, - * "pln": 3239742879771.195, - * "rub": 73446851159342.03, - * "sar": 3086002357014.532, + * "mxn": 13966176853697.3, + * "myr": 3781381554795.15, + * "ngn": 737875507571602, + * "nok": 8407346818129.71, + * "nzd": 1301287369358.73, + * "php": 45590539841760.1, + * "pkr": 228954757091481, + * "pln": 3239742879771.2, + * "rub": 73446851159342, + * "sar": 3086002357014.53, * "sek": 8289208064431.51, - * "sgd": 1086848883442.4248, - * "thb": 28142561489813.086, - * "try": 24257046694416.734, - * "twd": 25250535365752.875, + * "sgd": 1086848883442.42, + * "thb": 28142561489813.1, + * "try": 24257046694416.7, + * "twd": 25250535365752.9, * "uah": 31292101755089.6, - * "usd": 822933961870.5416, - * "vef": 82400377602.09746, + * "usd": 822933961870.542, + * "vef": 82400377602.0975, * "vnd": 19971704184972804, - * "xag": 34586507200.34415, - * "xau": 398925467.35636365, - * "xdr": 613205127018.0251, - * "xlm": 6366989968394.301, - * "xrp": 1322171541704.1318, - * "yfi": 100197984.57701135, - * "zar": 15060230523975.951, - * "bits": 19587833186725.145, - * "link": 53027090934.88813, - * "sats": 1958783318672514.8 + * "xag": 34586507200.3442, + * "xau": 398925467.356364, + * "xdr": 613205127018.025, + * "xlm": 6366989968394.3, + * "xrp": 1322171541704.13, + * "yfi": 100197984.577011, + * "zar": 15060230523976, + * "bits": 19587833186725.1, + * "link": 53027090934.8881, + * "sats": 1958783318672510 * }, * "total_volume": { - * "aed": 91203312150.08063, - * "ars": 20035974370796.53, - * "aud": 36437868164.37399, - * "bch": 97607892.53714487, - * "bdt": 2725449072027.6714, + * "aed": 91203312150.0806, + * "ars": 20035974370796.5, + * "aud": 36437868164.374, + * "bch": 97607892.5371449, + * "bdt": 2725449072027.67, * "bhd": 9360199758.84335, - * "bmd": 24832397519.050613, - * "bnb": 79179085.83047172, - * "brl": 120499184128.79588, - * "btc": 590313.2604817993, - * "cad": 32931483969.88901, - * "chf": 20881438911.782093, - * "clp": 21879188925189.88, - * "cny": 175803441475.87073, - * "czk": 555804929370.7711, - * "dkk": 167735395521.93146, - * "dot": 2997133098.5874844, + * "bmd": 24832397519.0506, + * "bnb": 79179085.8304717, + * "brl": 120499184128.796, + * "btc": 590313.260481799, + * "cad": 32931483969.889, + * "chf": 20881438911.7821, + * "clp": 21879188925189.9, + * "cny": 175803441475.871, + * "czk": 555804929370.771, + * "dkk": 167735395521.931, + * "dot": 2997133098.58748, * "eos": 29280838849.3072, - * "eth": 10798578.648754122, - * "eur": 22461574030.714294, - * "gbp": 19491668952.230877, + * "eth": 10798578.6487541, + * "eur": 22461574030.7143, + * "gbp": 19491668952.2309, * "gel": 66799149326.2464, - * "hkd": 193952199202.66922, - * "huf": 8621560094639.218, - * "idr": 382173081057940.94, - * "ils": 89417738606.47363, - * "inr": 2066526047518.001, - * "jpy": 3501989517686.002, - * "krw": 32146283560336.594, - * "kwd": 7630499109.653902, + * "hkd": 193952199202.669, + * "huf": 8621560094639.22, + * "idr": 382173081057941, + * "ils": 89417738606.4736, + * "inr": 2066526047518, + * "jpy": 3501989517686, + * "krw": 32146283560336.6, + * "kwd": 7630499109.6539, * "lkr": 8043620037935.51, - * "ltc": 338574128.0917383, - * "mmk": 52152396774457.34, - * "mxn": 421435584775.31195, - * "myr": 114104866600.03775, - * "ngn": 22265720911481.547, - * "nok": 253695421433.0574, - * "nzd": 39266923884.12937, - * "php": 1375714772890.6108, - * "pkr": 6908811405778.086, - * "pln": 97760679200.94873, - * "rub": 2216291329580.8867, - * "sar": 93121490696.43959, - * "sek": 250130532110.01724, - * "sgd": 32796147403.410156, - * "thb": 849214282675.6979, - * "try": 731967149325.9987, - * "twd": 761946110895.6648, - * "uah": 944253057952.1875, - * "usd": 24832397519.050613, - * "vef": 2486467963.582537, - * "vnd": 602655037260633.8, - * "xag": 1043663204.3259426, - * "xau": 12037753.021334978, - * "xdr": 18503736849.33296, - * "xlm": 191792809959.6043, - * "xrp": 39855973598.82108, - * "yfi": 3020008.107049232, - * "zar": 454449139819.0017, - * "bits": 590313260481.7993, - * "link": 1599235730.4856293, - * "sats": 59031326048179.93 + * "ltc": 338574128.091738, + * "mmk": 52152396774457.3, + * "mxn": 421435584775.312, + * "myr": 114104866600.038, + * "ngn": 22265720911481.5, + * "nok": 253695421433.057, + * "nzd": 39266923884.1294, + * "php": 1375714772890.61, + * "pkr": 6908811405778.09, + * "pln": 97760679200.9487, + * "rub": 2216291329580.89, + * "sar": 93121490696.4396, + * "sek": 250130532110.017, + * "sgd": 32796147403.4102, + * "thb": 849214282675.698, + * "try": 731967149325.999, + * "twd": 761946110895.665, + * "uah": 944253057952.188, + * "usd": 24832397519.0506, + * "vef": 2486467963.58254, + * "vnd": 602655037260634, + * "xag": 1043663204.32594, + * "xau": 12037753.021335, + * "xdr": 18503736849.333, + * "xlm": 191792809959.604, + * "xrp": 39855973598.8211, + * "yfi": 3020008.10704923, + * "zar": 454449139819.002, + * "bits": 590313260481.799, + * "link": 1599235730.48563, + * "sats": 59031326048179.9 * } * }, * "community_data": { @@ -1794,41 +1794,41 @@ export interface components { * ], * [ * 1711929600000, - * 71246.95144060145 + * 71246.9514406015 * ], * [ * 1711983682000, - * 68887.74951585678 + * 68887.7495158568 * ] * ] */ prices?: number[][]; /** @example [ * [ * 1711843200000, - * 1370247487960.0945 + * 1370247487960.09 * ], * [ * 1711929600000, - * 1401370211582.3662 + * 1401370211582.37 * ], * [ * 1711983682000, - * 1355701979725.1584 + * 1355701979725.16 * ] * ] */ market_caps?: number[][]; /** @example [ * [ * 1711843200000, - * 16408802301.837431 + * 16408802301.8374 * ], * [ * 1711929600000, - * 19723005998.21497 + * 19723005998.215 * ], * [ * 1711983682000, - * 30137418199.643093 + * 30137418199.6431 * ] * ] */ total_volumes?: number[][]; @@ -1837,45 +1837,45 @@ export interface components { /** @example [ * [ * 1704067241331, - * 42261.04061756689 + * 42261.0406175669 * ], * [ * 1704070847420, - * 42493.27640875459 + * 42493.2764087546 * ], * [ * 1704074443652, - * 42654.07310665941 + * 42654.0731066594 * ] * ] */ prices?: number[][]; /** @example [ * [ * 1704067241331, - * 827596236151.1959 + * 827596236151.196 * ], * [ * 1704070847420, - * 831531023621.4114 + * 831531023621.411 * ], * [ * 1704074443652, - * 835499399014.9323 + * 835499399014.932 * ] * ] */ market_caps?: number[][]; /** @example [ * [ * 1704067241331, - * 14305769170.949772 + * 14305769170.9498 * ], * [ * 1704070847420, - * 14130205376.17086 + * 14130205376.1709 * ], * [ * 1704074443652, - * 13697382902.24235 + * 13697382902.2424 * ] * ] */ total_volumes?: number[][]; @@ -1912,21 +1912,12 @@ export interface components { * "chain_identifier": 137, * "name": "Polygon POS", * "shortname": "MATIC", - * "native_coin_id": "matic-network" - * }, - * { - * "id": "ethereum", - * "chain_identifier": 1, - * "name": "Ethereum", - * "shortname": "Ethereum", - * "native_coin_id": "ethereum" - * }, - * { - * "id": "stargaze", - * "chain_identifier": null, - * "name": "Stargaze", - * "shortname": "", - * "native_coin_id": "stargaze" + * "native_coin_id": "matic-network", + * "image": { + * "thumb": "https://coin-images.coingecko.com/asset_platforms/images/15/thumb/polygon_pos.png?1706606645", + * "small": "https://coin-images.coingecko.com/asset_platforms/images/15/small/polygon_pos.png?1706606645", + * "large": "https://coin-images.coingecko.com/asset_platforms/images/15/large/polygon_pos.png?1706606645" + * } * } * ] */ AssetPlatforms: { @@ -1940,6 +1931,8 @@ export interface components { shortname?: string; /** @description chain native coin id */ native_coin_id?: string; + /** @description image of the asset platform */ + image?: string; }; /** @example [ * { @@ -1961,30 +1954,21 @@ export interface components { * { * "id": "layer-1", * "name": "Layer 1 (L1)", - * "market_cap": 2061406861196.135, + * "market_cap": 2061406861196.14, * "market_cap_change_24h": -0.66091235190398, * "content": "", + * "top_3_coins_id": [ + * "bitcoin", + * "ethereum", + * "binancecoin" + * ], * "top_3_coins": [ * "https://assets.coingecko.com/coins/images/1/small/bitcoin.png?1696501400", * "https://assets.coingecko.com/coins/images/279/small/ethereum.png?1696501628", * "https://assets.coingecko.com/coins/images/825/small/bnb-icon2_2x.png?1696501970" * ], - * "volume_24h": 61146432400.17392, + * "volume_24h": 61146432400.1739, * "updated_at": "2024-04-06T08:25:46.402Z" - * }, - * { - * "id": "smart-contract-platform", - * "name": "Smart Contract Platform", - * "market_cap": 744929499224.6548, - * "market_cap_change_24h": -0.584411329310148, - * "content": "Smart contract platforms are usually blockchains that host smart contracts or decentralized applications...", - * "top_3_coins": [ - * "https://assets.coingecko.com/coins/images/279/small/ethereum.png?1696501628", - * "https://assets.coingecko.com/coins/images/825/small/bnb-icon2_2x.png?1696501970", - * "https://assets.coingecko.com/coins/images/4128/small/solana.png?1696504756" - * ], - * "volume_24h": 30987638383.630726, - * "updated_at": "2024-04-06T08:25:33.203Z" * } * ] */ Categories: { @@ -1998,7 +1982,9 @@ export interface components { market_cap_change_24h?: number; /** @description category description */ content?: string; - /** @description top 3 coins in the category */ + /** @description ids of top 3 coins in the category */ + top_3_coins_id?: string[]; + /** @description images of top 3 coins in the category */ top_3_coins?: string[]; /** @description category volume in 24 hours */ volume_24h?: number; @@ -2017,8 +2003,8 @@ export interface components { * "has_trading_incentive": false, * "trust_score": 10, * "trust_score_rank": 1, - * "trade_volume_24h_btc": 51075.62712838519, - * "trade_volume_24h_btc_normalized": 47765.58866374526 + * "trade_volume_24h_btc": 51075.6271283852, + * "trade_volume_24h_btc_normalized": 47765.5886637453 * }, * { * "id": "gdax", @@ -2031,8 +2017,8 @@ export interface components { * "has_trading_incentive": false, * "trust_score": 10, * "trust_score_rank": 2, - * "trade_volume_24h_btc": 37443.72996076475, - * "trade_volume_24h_btc_normalized": 37443.72996076475 + * "trade_volume_24h_btc": 37443.7299607648, + * "trade_volume_24h_btc_normalized": 37443.7299607648 * } * ] */ Exchanges: { @@ -2101,8 +2087,8 @@ export interface components { * "alert_notice": "", * "trust_score": 9, * "trust_score_rank": 6, - * "trade_volume_24h_btc": 207319.13377261316, - * "trade_volume_24h_btc_normalized": 81673.29712441542, + * "trade_volume_24h_btc": 207319.133772613, + * "trade_volume_24h_btc_normalized": 81673.2971244154, * "tickers": [ * { * "base": "BTC", @@ -2115,7 +2101,7 @@ export interface components { * }, * "last": 69476, * "volume": 20242.03975, - * "cost_to_move_up_usd": 19320706.39585167, + * "cost_to_move_up_usd": 19320706.3958517, * "cost_to_move_down_usd": 16360235.3694131, * "converted_last": { * "btc": 1.000205, @@ -2205,14 +2191,14 @@ export interface components { * "symbol": "ETHUSDT", * "index_id": "ETH", * "price": "3395.91", - * "price_percentage_change_24h": 1.5274069068216003, + * "price_percentage_change_24h": 1.5274069068216, * "contract_type": "perpetual", * "index": 3393.5342, * "basis": -0.0523015571479482, * "spread": 0.01, * "funding_rate": -0.007182, * "open_interest": 9327998764.66, - * "volume_24h": 392642535.23212117, + * "volume_24h": 392642535.232121, * "last_traded_at": 1712467658, * "expired_at": null * }, @@ -2221,14 +2207,14 @@ export interface components { * "symbol": "BTC-PERPUSDT", * "index_id": "BTC", * "price": "69434.1", - * "price_percentage_change_24h": 2.040579301057485, + * "price_percentage_change_24h": 2.04057930105749, * "contract_type": "perpetual", * "index": 69407.5, - * "basis": -0.0005763032738348229, + * "basis": -0.000576303273834822, * "spread": 0.01, * "funding_rate": 0.012, * "open_interest": 7690212057.6, - * "volume_24h": 132888173.54699957, + * "volume_24h": 132888173.547, * "last_traded_at": 1712467920, * "expired_at": null * } @@ -2339,7 +2325,7 @@ export interface components { * "index_basis_percentage": -0.071, * "bid_ask_spread": 0.000217533173808922, * "funding_rate": 0.005, - * "open_interest_usd": 28102263.99977152, + * "open_interest_usd": 28102263.9997715, * "h24_volume": 2679284723, * "converted_volume": { * "btc": "888.799603175094638929930629459045946", @@ -2437,6 +2423,7 @@ export interface components { * "image": { * "small": "https://assets.coingecko.com/nft_contracts/images/38/small/da64989d9762c8a61b3c65917edfdf97.png?1707287183" * }, + * "banner_image": "https://coin-images.coingecko.com/nft_contracts/images/20/bored-ape-yacht-club-banner.png?1708416120", * "description": "Pudgy Penguins is a collection of 8,888 unique NFTs featuring cute cartoon penguins, which are generated from a collection of 150 different hand-drawn traits.", * "native_currency": "ethereum", * "native_currency_symbol": "ETH", @@ -2454,16 +2441,16 @@ export interface components { * }, * "floor_price_in_usd_24h_percentage_change": 1.07067, * "floor_price_24h_percentage_change": { - * "usd": 1.070670607177908, - * "native_currency": 1.214574898785425 + * "usd": 1.07067060717791, + * "native_currency": 1.21457489878543 * }, * "market_cap_24h_percentage_change": { - * "usd": 1.0706706071776666, - * "native_currency": -0.4048582995951417 + * "usd": 1.07067060717767, + * "native_currency": -0.404858299595142 * }, * "volume_24h_percentage_change": { - * "usd": -3.1983377669874073, - * "native_currency": -1.801855313900942 + * "usd": -3.19833776698741, + * "native_currency": -1.80185531390094 * }, * "number_of_unique_addresses": 4752, * "number_of_unique_addresses_24h_percentage_change": 0.08425, @@ -2471,7 +2458,7 @@ export interface components { * "total_supply": 8888, * "one_day_sales": 36, * "one_day_sales_24h_percentage_change": -2.7027027027027, - * "one_day_average_sale_price": 11.941194388888889, + * "one_day_average_sale_price": 11.9411943888889, * "one_day_average_sale_price_24h_percentage_change": 0.925870927379588, * "links": { * "homepage": "https://www.pudgypenguins.com/", @@ -2479,24 +2466,24 @@ export interface components { * "discord": "https://discord.gg/pudgypenguins" * }, * "floor_price_7d_percentage_change": { - * "usd": -18.00149482623651, - * "native_currency": -13.793103448275861 + * "usd": -18.0014948262365, + * "native_currency": -13.7931034482759 * }, * "floor_price_14d_percentage_change": { - * "usd": -8.632353394310407, - * "native_currency": -8.619051100226626 + * "usd": -8.63235339431041, + * "native_currency": -8.61905110022663 * }, * "floor_price_30d_percentage_change": { - * "usd": -14.376564931440935, - * "native_currency": -0.7779012541673281 + * "usd": -14.3765649314409, + * "native_currency": -0.777901254167328 * }, * "floor_price_60d_percentage_change": { - * "usd": 15.27797587032817, + * "usd": 15.2779758703282, * "native_currency": -18.0327868852459 * }, * "floor_price_1y_percentage_change": { * "usd": 429.5685372855, - * "native_currency": 196.20853080568722 + * "native_currency": 196.208530805687 * }, * "explorers": [ * { @@ -2507,7 +2494,20 @@ export interface components { * "name": "Ethplorer", * "link": "https://ethplorer.io/address/0xBd3531dA5CF5857e7CfAA92426877b022e612cf8" * } - * ] + * ], + * "user_favorites_count": 3660, + * "ath": { + * "native_currency": 22.9, + * "usd": 67535 + * }, + * "ath_change_percentage": { + * "native_currency": -59.825327510917, + * "usd": -64.3396788440525 + * }, + * "ath_date": { + * "native_currency": "2024-02-17T09:25:05.056Z", + * "usd": "2024-02-29T11:45:08.150Z" + * } * } */ NFTData: { /** @description nft collection id */ @@ -2524,6 +2524,10 @@ export interface components { image?: { small?: string; }; + /** @description nft collection banner image url */ + banner_image?: { + small?: string; + }; /** @description nft collection description */ description?: string; /** @description nft collection native currency */ @@ -2613,6 +2617,25 @@ export interface components { name?: string; link?: string; }[]; + /** @description nft collection user favorites count */ + user_favorites_count?: number; + /** @description nft collection all time highs */ + ath?: { + native_currency?: number; + usd?: number; + }; + /** @description nft collection all time highs change percentage */ + ath_change_percentage?: { + native_currency?: number; + usd?: number; + }; + /** @description nft collection all time highs date */ + ath_date?: { + /** Format: date-time */ + native_currency?: string; + /** Format: date-time */ + usd?: string; + }; }; /** @example { * "rates": { @@ -2817,74 +2840,74 @@ export interface components { * "small": "https://assets.coingecko.com/coins/images/28470/small/MTLOGO.png?1696527464", * "large": "https://assets.coingecko.com/coins/images/28470/large/MTLOGO.png?1696527464", * "slug": "moon-tropica", - * "price_btc": 0.0005301634743332989, + * "price_btc": 0.000530163474333298, * "score": 0, * "data": { - * "price": 36.97171180169754, + * "price": 36.9717118016975, * "price_btc": "0.000530163474333299", * "price_change_percentage_24h": { - * "aed": -4.044674476087556, - * "ars": -4.049900089458546, - * "aud": -4.049900089458019, - * "bch": -2.3756796248748864, - * "bdt": -4.049900089458495, - * "bhd": -4.169270133964371, - * "bmd": -4.049900089458533, - * "bnb": -3.4734695990217044, - * "brl": -4.0499000894584745, - * "btc": -5.9858537505924625, - * "cad": -4.049900089458477, + * "aed": -4.04467447608756, + * "ars": -4.04990008945855, + * "aud": -4.04990008945802, + * "bch": -2.37567962487489, + * "bdt": -4.0499000894585, + * "bhd": -4.16927013396437, + * "bmd": -4.04990008945853, + * "bnb": -3.4734695990217, + * "brl": -4.04990008945847, + * "btc": -5.98585375059246, + * "cad": -4.04990008945848, * "chf": -4.04990008945855, - * "clp": -5.025675567567188, - * "cny": -4.049900089458403, - * "czk": -4.049900089458641, - * "dkk": -4.049900089458638, - * "dot": -5.982387795212445, + * "clp": -5.02567556756719, + * "cny": -4.0499000894584, + * "czk": -4.04990008945864, + * "dkk": -4.04990008945864, + * "dot": -5.98238779521245, * "eos": -5.74405098071799, - * "eth": -5.0568944511997085, - * "eur": -4.096616197526041, - * "gbp": -4.049900089458471, - * "gel": -4.049900089458967, - * "hkd": -4.0499000894585215, - * "huf": -4.053877164508182, - * "idr": -4.049900089458211, - * "ils": -4.4092202121097746, - * "inr": -4.049900089458557, - * "jpy": -4.049900089459048, - * "krw": -4.049900089458465, - * "kwd": -4.120414696850362, - * "lkr": -4.049900089458902, - * "ltc": -5.293413388383373, - * "mmk": -4.049900089458767, - * "mxn": -4.0499000894591966, - * "myr": -4.049900089458715, - * "ngn": -4.049900089458488, - * "nok": -4.0499000894585375, - * "nzd": -4.049900089458602, - * "php": -4.049900089458442, - * "pkr": -4.049900089458451, - * "pln": -4.049900089458555, - * "rub": -4.049900089458471, - * "sar": -4.049900089458411, - * "sek": -4.049900089458544, - * "sgd": -4.049900089458575, - * "thb": -4.041056870708535, - * "try": -4.049900089458374, - * "twd": -4.0499000894584665, + * "eth": -5.05689445119971, + * "eur": -4.09661619752604, + * "gbp": -4.04990008945847, + * "gel": -4.04990008945897, + * "hkd": -4.04990008945852, + * "huf": -4.05387716450818, + * "idr": -4.04990008945821, + * "ils": -4.40922021210977, + * "inr": -4.04990008945856, + * "jpy": -4.04990008945905, + * "krw": -4.04990008945847, + * "kwd": -4.12041469685036, + * "lkr": -4.0499000894589, + * "ltc": -5.29341338838337, + * "mmk": -4.04990008945877, + * "mxn": -4.0499000894592, + * "myr": -4.04990008945872, + * "ngn": -4.04990008945849, + * "nok": -4.04990008945854, + * "nzd": -4.0499000894586, + * "php": -4.04990008945844, + * "pkr": -4.04990008945845, + * "pln": -4.04990008945856, + * "rub": -4.04990008945847, + * "sar": -4.04990008945841, + * "sek": -4.04990008945854, + * "sgd": -4.04990008945858, + * "thb": -4.04105687070854, + * "try": -4.04990008945837, + * "twd": -4.04990008945847, * "uah": -4.17945939929411, - * "usd": -4.049900089458533, - * "vef": -4.049900089458404, - * "vnd": -4.049900089458679, - * "xag": -4.062083010251626, - * "xau": -4.049900089458423, - * "xdr": -4.049900089458524, - * "xlm": -4.124939249003918, - * "xrp": -4.481270699934758, + * "usd": -4.04990008945853, + * "vef": -4.0499000894584, + * "vnd": -4.04990008945868, + * "xag": -4.06208301025163, + * "xau": -4.04990008945842, + * "xdr": -4.04990008945852, + * "xlm": -4.12493924900392, + * "xrp": -4.48127069993476, * "yfi": -4.04427366181248, * "zar": -4.0499000894588, - * "bits": -5.9858537505924465, - * "link": -5.120058065995313, - * "sats": -5.9858537505924545 + * "bits": -5.98585375059245, + * "link": -5.12005806599531, + * "sats": -5.98585375059245 * }, * "market_cap": "$99,703,583", * "market_cap_btc": "1428.83459310001", @@ -2906,73 +2929,73 @@ export interface components { * "small": "https://assets.coingecko.com/coins/images/12493/small/GALA_token_image_-_200PNG.png?1709725869", * "large": "https://assets.coingecko.com/coins/images/12493/large/GALA_token_image_-_200PNG.png?1709725869", * "slug": "gala", - * "price_btc": 8.995385509920279e-7, + * "price_btc": 8.99538550992028e-7, * "score": 1, * "data": { - * "price": 0.06273061361614252, + * "price": 0.0627306136161425, * "price_btc": "0.000000899538550992028", * "price_change_percentage_24h": { - * "aed": 9.607800289428866, - * "ars": 9.601831178453207, + * "aed": 9.60780028942887, + * "ars": 9.60183117845321, * "aud": 9.60183117845384, - * "bch": 11.467421966306494, - * "bdt": 9.601831178453276, - * "bhd": 9.465477224909796, - * "bmd": 9.601831178453173, - * "bnb": 10.223428485128215, - * "brl": 9.601831178453361, - * "btc": 7.387458257241243, - * "cad": 9.601831178453283, - * "chf": 9.601831178453216, - * "clp": 8.487222863095175, - * "cny": 9.601831178453274, - * "czk": 9.601831178453118, - * "dkk": 9.601831178453255, - * "dot": 7.376880264270369, - * "eos": 7.628589329562328, - * "eth": 8.451082207534835, - * "eur": 9.548468326361439, - * "gbp": 9.601831178453317, - * "gel": 9.601831178452892, - * "hkd": 9.601831178453269, - * "huf": 9.597288247194557, - * "idr": 9.601831178452711, - * "ils": 9.191387172052512, - * "inr": 9.601831178453226, - * "jpy": 9.601831178453017, - * "krw": 9.601831178453276, - * "kwd": 9.521283788693184, - * "lkr": 9.601831178453256, - * "ltc": 8.065248250452148, - * "mmk": 9.601831178452926, - * "mxn": 9.601831178453205, - * "myr": 9.601831178453285, - * "ngn": 9.601831178453272, - * "nok": 9.601831178453201, + * "bch": 11.4674219663065, + * "bdt": 9.60183117845328, + * "bhd": 9.4654772249098, + * "bmd": 9.60183117845317, + * "bnb": 10.2234284851282, + * "brl": 9.60183117845336, + * "btc": 7.38745825724124, + * "cad": 9.60183117845328, + * "chf": 9.60183117845322, + * "clp": 8.48722286309518, + * "cny": 9.60183117845327, + * "czk": 9.60183117845312, + * "dkk": 9.60183117845326, + * "dot": 7.37688026427037, + * "eos": 7.62858932956233, + * "eth": 8.45108220753484, + * "eur": 9.54846832636144, + * "gbp": 9.60183117845332, + * "gel": 9.60183117845289, + * "hkd": 9.60183117845327, + * "huf": 9.59728824719456, + * "idr": 9.60183117845271, + * "ils": 9.19138717205251, + * "inr": 9.60183117845323, + * "jpy": 9.60183117845302, + * "krw": 9.60183117845328, + * "kwd": 9.52128378869318, + * "lkr": 9.60183117845326, + * "ltc": 8.06524825045215, + * "mmk": 9.60183117845293, + * "mxn": 9.60183117845321, + * "myr": 9.60183117845329, + * "ngn": 9.60183117845327, + * "nok": 9.6018311784532, * "nzd": 9.60183117845338, - * "php": 9.601831178453331, - * "pkr": 9.601831178452992, - * "pln": 9.601831178453399, - * "rub": 9.601831178453267, - * "sar": 9.601831178453297, - * "sek": 9.601831178453194, - * "sgd": 9.601831178453194, + * "php": 9.60183117845333, + * "pkr": 9.60183117845299, + * "pln": 9.6018311784534, + * "rub": 9.60183117845327, + * "sar": 9.6018311784533, + * "sek": 9.60183117845319, + * "sgd": 9.60183117845319, * "thb": 9.61193260585552, * "try": 9.60183117845312, - * "twd": 9.601831178452995, - * "uah": 9.453838236106627, - * "usd": 9.601831178453173, - * "vef": 9.601831178453372, + * "twd": 9.601831178453, + * "uah": 9.45383823610663, + * "usd": 9.60183117845317, + * "vef": 9.60183117845337, * "vnd": 9.60183117845306, - * "xag": 9.587914877904465, - * "xau": 9.601831178453322, - * "xdr": 9.601831178453349, - * "xlm": 9.491125969692098, - * "xrp": 8.997673436109869, - * "yfi": 9.544091113766347, + * "xag": 9.58791487790447, + * "xau": 9.60183117845332, + * "xdr": 9.60183117845335, + * "xlm": 9.4911259696921, + * "xrp": 8.99767343610987, + * "yfi": 9.54409111376635, * "zar": 9.6018311784527, - * "bits": 7.387458257241251, - * "link": 8.376626532676953, + * "bits": 7.38745825724125, + * "link": 8.37662653267695, * "sats": 7.38745825724125 * }, * "market_cap": "$2,365,621,969", @@ -2982,7 +3005,7 @@ export interface components { * "sparkline": "https://www.coingecko.com/coins/12493/sparkline.svg", * "content": { * "title": "What is GALA?", - * "description": "Gala is a blockchain gaming ecosystem. Gamers can explore different type of games and have their experiences interact across each other on the Gala platform. The GALA token is the utility token and primary medium of exchange of the ecosystem. Game items are represented as NFTs on the Ethereum blockchain and users can trade them on all marketplaces." + * "description": "Gala is a blockchain gaming ecosystem. Gamers can explore different type of games and have their experiences interact across each other on the Gala platform. The GALA token is the utility token and primary medium of exchange of the ecosystem. Game items are represented as NFTs on the Ethereum blockchain and users can trade them on all marketplaces." * } * } * } @@ -3030,77 +3053,77 @@ export interface components { * { * "id": 251, * "name": "Solana Meme Coins", - * "market_cap_1h_change": 1.4453764946553134, + * "market_cap_1h_change": 1.44537649465531, * "slug": "solana-meme-coins", * "coins_count": 79, * "data": { - * "market_cap": 8237562936.011124, - * "market_cap_btc": 118852.27622489528, - * "total_volume": 1207846273.3244412, - * "total_volume_btc": 17426.911336459012, + * "market_cap": 8237562936.01112, + * "market_cap_btc": 118852.276224895, + * "total_volume": 1207846273.32444, + * "total_volume_btc": 17426.911336459, * "market_cap_change_percentage_24h": { - * "aed": 14.230396523539737, - * "ars": 14.224569755904016, - * "aud": 14.224175671448258, - * "bch": 10.54444640788801, - * "bdt": 14.22417567144842, - * "bhd": 14.082071130168746, - * "bmd": 14.224175671448535, - * "bnb": 12.624477239332412, - * "brl": 14.221695576046988, - * "btc": 11.84681099262996, - * "cad": 14.232580997300973, - * "chf": 14.224175671448508, - * "clp": 13.062559896881549, - * "cny": 14.217858661401426, - * "czk": 14.224175671448577, - * "dkk": 14.224175671448444, - * "dot": 10.696648493582588, - * "eos": 10.12173144446242, - * "eth": 11.884759639001178, - * "eur": 14.168562295958932, - * "gbp": 14.224175671448489, - * "gel": 14.224175671449085, - * "hkd": 14.224175671448705, - * "huf": 14.21944114673665, - * "idr": 14.224175671448897, - * "ils": 13.796421611262415, - * "inr": 14.224175671448592, - * "jpy": 14.224175671448288, - * "krw": 14.224175671448533, - * "kwd": 14.140231278377183, + * "aed": 14.2303965235397, + * "ars": 14.224569755904, + * "aud": 14.2241756714483, + * "bch": 10.544446407888, + * "bdt": 14.2241756714484, + * "bhd": 14.0820711301687, + * "bmd": 14.2241756714485, + * "bnb": 12.6244772393324, + * "brl": 14.221695576047, + * "btc": 11.84681099263, + * "cad": 14.232580997301, + * "chf": 14.2241756714485, + * "clp": 13.0625598968815, + * "cny": 14.2178586614014, + * "czk": 14.2241756714486, + * "dkk": 14.2241756714484, + * "dot": 10.6966484935826, + * "eos": 10.1217314444624, + * "eth": 11.8847596390012, + * "eur": 14.1685622959589, + * "gbp": 14.2241756714485, + * "gel": 14.2241756714491, + * "hkd": 14.2241756714487, + * "huf": 14.2194411467367, + * "idr": 14.2241756714489, + * "ils": 13.7964216112624, + * "inr": 14.2241756714486, + * "jpy": 14.2241756714483, + * "krw": 14.2241756714485, + * "kwd": 14.1402312783772, * "lkr": 14.2241756714485, - * "ltc": 8.642866877624703, - * "mmk": 14.224175671448963, - * "mxn": 14.224175671448078, - * "myr": 14.224175671448464, - * "ngn": 14.224175671448572, - * "nok": 14.224175671448524, - * "nzd": 14.22417567144808, - * "php": 14.224175671448599, - * "pkr": 14.224175671448386, - * "pln": 14.206825106648202, - * "rub": 14.224175671448602, - * "sar": 14.224175671448705, - * "sek": 14.224175671448574, - * "sgd": 14.224175671448508, - * "thb": 14.234703116161398, - * "try": 14.224175671448606, - * "twd": 14.224175671448991, - * "uah": 14.06994127898445, - * "usd": 14.224175671448535, - * "vef": 14.224175671448553, - * "vnd": 14.224175671448933, - * "xag": 14.209672465238517, - * "xau": 14.224175671448783, - * "xdr": 14.224175671448712, - * "xlm": 11.83204356427227, - * "xrp": 12.417240014724353, - * "yfi": 12.795491855495357, - * "zar": 14.224175671448144, - * "bits": 11.846810992629957, - * "link": 11.65665127230344, - * "sats": 11.846810992629955 + * "ltc": 8.6428668776247, + * "mmk": 14.224175671449, + * "mxn": 14.2241756714481, + * "myr": 14.2241756714485, + * "ngn": 14.2241756714486, + * "nok": 14.2241756714485, + * "nzd": 14.2241756714481, + * "php": 14.2241756714486, + * "pkr": 14.2241756714484, + * "pln": 14.2068251066482, + * "rub": 14.2241756714486, + * "sar": 14.2241756714487, + * "sek": 14.2241756714486, + * "sgd": 14.2241756714485, + * "thb": 14.2347031161614, + * "try": 14.2241756714486, + * "twd": 14.224175671449, + * "uah": 14.0699412789845, + * "usd": 14.2241756714485, + * "vef": 14.2241756714486, + * "vnd": 14.2241756714489, + * "xag": 14.2096724652385, + * "xau": 14.2241756714488, + * "xdr": 14.2241756714487, + * "xlm": 11.8320435642723, + * "xrp": 12.4172400147244, + * "yfi": 12.7954918554954, + * "zar": 14.2241756714481, + * "bits": 11.84681099263, + * "link": 11.6566512723034, + * "sats": 11.84681099263 * }, * "sparkline": "https://www.coingecko.com/categories/25211443/sparkline.svg" * } @@ -3108,77 +3131,77 @@ export interface components { * { * "id": 327, * "name": "Gaming Platform", - * "market_cap_1h_change": 1.1050692959116248, + * "market_cap_1h_change": 1.10506929591162, * "slug": "gaming-platform", * "coins_count": 20, * "data": { - * "market_cap": 3665275001.853747, - * "market_cap_btc": 52882.90728027729, + * "market_cap": 3665275001.85375, + * "market_cap_btc": 52882.9072802773, * "total_volume": 218189404.503211, - * "total_volume_btc": 3148.0557508090187, + * "total_volume_btc": 3148.05575080902, * "market_cap_change_percentage_24h": { - * "aed": 5.953195292443641, - * "ars": 5.947790735793044, - * "aud": 5.947425206927055, + * "aed": 5.95319529244364, + * "ars": 5.94779073579304, + * "aud": 5.94742520692706, * "bch": 2.53433127439418, - * "bdt": 5.947425206927214, - * "bhd": 5.815617643683333, - * "bmd": 5.9474252069273215, - * "bnb": 4.4636418572644425, - * "brl": 5.945124820686694, - * "btc": 3.742325760876501, - * "cad": 5.955221477960618, - * "chf": 5.947425206927288, - * "clp": 4.869980789651604, - * "cny": 5.941565931116702, - * "czk": 5.947425206927346, - * "dkk": 5.947425206927227, - * "dot": 2.675504708088687, - * "eos": 2.1422464840411943, - * "eth": 3.7775246261734994, - * "eur": 5.895841609098276, + * "bdt": 5.94742520692721, + * "bhd": 5.81561764368333, + * "bmd": 5.94742520692732, + * "bnb": 4.46364185726444, + * "brl": 5.94512482068669, + * "btc": 3.7423257608765, + * "cad": 5.95522147796062, + * "chf": 5.94742520692729, + * "clp": 4.8699807896516, + * "cny": 5.9415659311167, + * "czk": 5.94742520692735, + * "dkk": 5.94742520692723, + * "dot": 2.67550470808869, + * "eos": 2.14224648404119, + * "eth": 3.7775246261735, + * "eur": 5.89584160909828, * "gbp": 5.94742520692727, - * "gel": 5.947425206927817, - * "hkd": 5.947425206927471, - * "huf": 5.943033748640541, - * "idr": 5.9474252069276545, - * "ils": 5.550666455707389, + * "gel": 5.94742520692782, + * "hkd": 5.94742520692747, + * "huf": 5.94303374864054, + * "idr": 5.94742520692765, + * "ils": 5.55066645570739, * "inr": 5.94742520692736, * "jpy": 5.94742520692707, - * "krw": 5.947425206927302, + * "krw": 5.9474252069273, * "kwd": 5.86956347359295, * "lkr": 5.94742520692729, - * "ltc": 0.7705413072238989, - * "mmk": 5.947425206927696, - * "mxn": 5.947425206926885, - * "myr": 5.947425206927239, - * "ngn": 5.947425206927365, - * "nok": 5.9474252069272895, - * "nzd": 5.947425206926885, - * "php": 5.947425206927361, - * "pkr": 5.947425206927167, - * "pln": 5.931331874183391, + * "ltc": 0.770541307223899, + * "mmk": 5.9474252069277, + * "mxn": 5.94742520692689, + * "myr": 5.94742520692724, + * "ngn": 5.94742520692737, + * "nok": 5.94742520692729, + * "nzd": 5.94742520692689, + * "php": 5.94742520692736, + * "pkr": 5.94742520692717, + * "pln": 5.93133187418339, * "rub": 5.94742520692736, - * "sar": 5.947425206927473, - * "sek": 5.9474252069273605, - * "sgd": 5.947425206927288, - * "thb": 5.957189826849315, - * "try": 5.947425206927379, - * "twd": 5.947425206927743, - * "uah": 5.804366728598461, - * "usd": 5.9474252069273215, + * "sar": 5.94742520692747, + * "sek": 5.94742520692736, + * "sgd": 5.94742520692729, + * "thb": 5.95718982684932, + * "try": 5.94742520692738, + * "twd": 5.94742520692774, + * "uah": 5.80436672859846, + * "usd": 5.94742520692732, * "vef": 5.94742520692733, * "vnd": 5.94742520692767, - * "xag": 5.933972911507694, - * "xau": 5.947425206927534, - * "xdr": 5.947425206927486, - * "xlm": 3.7286283890002943, - * "xrp": 4.2714211629570755, - * "yfi": 4.622264654484985, - * "zar": 5.9474252069269395, - * "bits": 3.742325760876498, - * "link": 3.5659451249189047, - * "sats": 3.742325760876507 + * "xag": 5.93397291150769, + * "xau": 5.94742520692753, + * "xdr": 5.94742520692749, + * "xlm": 3.72862838900029, + * "xrp": 4.27142116295708, + * "yfi": 4.62226465448499, + * "zar": 5.94742520692694, + * "bits": 3.7423257608765, + * "link": 3.5659451249189, + * "sats": 3.74232576087651 * }, * "sparkline": "https://www.coingecko.com/categories/25211410/sparkline.svg" * } @@ -3298,146 +3321,146 @@ export interface components { * "ended_icos": 3376, * "markets": 1046, * "total_market_cap": { - * "btc": 39003738.08471593, - * "eth": 803832137.2075309, - * "ltc": 26721173267.535767, - * "bch": 3981159931.513415, + * "btc": 39003738.0847159, + * "eth": 803832137.207531, + * "ltc": 26721173267.5358, + * "bch": 3981159931.51342, * "bnb": 4670513150.58714, - * "eos": 2641998753398.4077, - * "xrp": 4567762968374.063, - * "xlm": 21049307801356.547, - * "link": 153517938957.19897, - * "dot": 315120726481.16595, - * "yfi": 324671967.6108449, - * "usd": 2721226850772.6313, - * "aed": 9993705609462.484, - * "ars": 2341775032921961.5, - * "aud": 4135040261091.559, - * "bdt": 298245137607204.1, - * "bhd": 1024582727718.6569, - * "bmd": 2721226850772.6313, - * "brl": 13785980136430.713, - * "cad": 3698283351542.5464, - * "chf": 2454228235855.375, - * "clp": 2557393918759367.5, - * "cny": 19681001075527.992, - * "czk": 63568675602103.72, - * "dkk": 18728571677757.562, - * "eur": 2508293570926.523, - * "gbp": 2153208842849.7563, - * "gel": 7292887960070.655, - * "hkd": 21307070180207.188, + * "eos": 2641998753398.41, + * "xrp": 4567762968374.06, + * "xlm": 21049307801356.5, + * "link": 153517938957.199, + * "dot": 315120726481.166, + * "yfi": 324671967.610845, + * "usd": 2721226850772.63, + * "aed": 9993705609462.48, + * "ars": 2341775032921960, + * "aud": 4135040261091.56, + * "bdt": 298245137607204, + * "bhd": 1024582727718.66, + * "bmd": 2721226850772.63, + * "brl": 13785980136430.7, + * "cad": 3698283351542.55, + * "chf": 2454228235855.38, + * "clp": 2557393918759370, + * "cny": 19681001075528, + * "czk": 63568675602103.7, + * "dkk": 18728571677757.6, + * "eur": 2508293570926.52, + * "gbp": 2153208842849.76, + * "gel": 7292887960070.66, + * "hkd": 21307070180207.2, * "huf": 979811947048335, * "idr": 43234171898362830, - * "ils": 10201683535213.324, - * "inr": 226670207147326.38, - * "jpy": 412551596711385.75, + * "ils": 10201683535213.3, + * "inr": 226670207147326, + * "jpy": 412551596711386, * "krw": 3677112086909555, - * "kwd": 836219405108.1758, - * "lkr": 812593109477405.5, + * "kwd": 836219405108.176, + * "lkr": 812593109477406, * "mmk": 5706555839881336, - * "mxn": 44773978111872.44, - * "myr": 12919024474043.053, + * "mxn": 44773978111872.4, + * "myr": 12919024474043.1, * "ngn": 3522998071018357, - * "nok": 29197131372679.86, - * "nzd": 4524820631515.687, + * "nok": 29197131372679.9, + * "nzd": 4524820631515.69, * "php": 153994230206450, - * "pkr": 755251422720380.5, - * "pln": 10747177948492.383, - * "rub": 251732363568358.97, - * "sar": 10207395390373.113, - * "sek": 29054498267296.645, - * "sgd": 3672056167154.7974, - * "thb": 99649147572586.36, - * "try": 87273829665781.25, - * "twd": 87422678053291.61, - * "uah": 105534042826571.94, - * "vef": 272476444567.86353, + * "pkr": 755251422720381, + * "pln": 10747177948492.4, + * "rub": 251732363568359, + * "sar": 10207395390373.1, + * "sek": 29054498267296.6, + * "sgd": 3672056167154.8, + * "thb": 99649147572586.4, + * "try": 87273829665781.3, + * "twd": 87422678053291.6, + * "uah": 105534042826572, + * "vef": 272476444567.864, * "vnd": 67937284004880150, - * "zar": 50878778428895.97, - * "xdr": 2052425485204.5413, + * "zar": 50878778428896, + * "xdr": 2052425485204.54, * "xag": 99002369095.9216, - * "xau": 1167950564.3516145, - * "bits": 39003738084715.93, - * "sats": 3900373808471593.5 + * "xau": 1167950564.35161, + * "bits": 39003738084715.9, + * "sats": 3900373808471590 * }, * "total_volume": { * "btc": 993675.225562481, - * "eth": 20478757.151921887, - * "ltc": 680759567.6148158, - * "bch": 101425662.95452334, - * "bnb": 118987908.24412876, - * "eos": 67308643636.075134, - * "xrp": 116370202467.68745, - * "xlm": 536260797157.8833, - * "link": 3911085965.397742, - * "dot": 8028144848.205925, - * "yfi": 8271476.183867172, - * "usd": 69327091133.54892, - * "aed": 254603742187.9583, + * "eth": 20478757.1519219, + * "ltc": 680759567.614816, + * "bch": 101425662.954523, + * "bnb": 118987908.244129, + * "eos": 67308643636.0751, + * "xrp": 116370202467.687, + * "xlm": 536260797157.883, + * "link": 3911085965.39774, + * "dot": 8028144848.20593, + * "yfi": 8271476.18386717, + * "usd": 69327091133.5489, + * "aed": 254603742187.958, * "ars": 59660021021604.7, - * "aud": 105345981331.98444, + * "aud": 105345981331.984, * "bdt": 7598215425943.58, - * "bhd": 26102689718.14816, - * "bmd": 69327091133.54892, - * "brl": 351217283120.7607, - * "cad": 94218983205.04971, - * "chf": 62524924932.79855, - * "clp": 65153216175224.445, - * "cny": 501401253914.27954, - * "czk": 1619501647007.038, - * "dkk": 477136772017.5372, - * "eur": 63902315579.43983, - * "gbp": 54856031438.69647, - * "gel": 185796604237.91116, - * "hkd": 542827657221.1319, - * "huf": 24962090950805.31, - * "idr": 1101451492157040.8, - * "ils": 259902273109.11288, - * "inr": 5774743147085.059, - * "jpy": 10510333651301.709, - * "krw": 93679615385638.72, - * "kwd": 21303868469.883915, - * "lkr": 20701955274048.176, - * "mmk": 145382556642718.72, - * "mxn": 1140680226674.9573, - * "myr": 329130365156.52313, - * "ngn": 89753343519839.38, - * "nok": 743838091608.2996, - * "nzd": 115276185884.68079, - * "php": 3923220156574.6226, - * "pkr": 19241094948336.27, - * "pln": 273799512470.6537, - * "rub": 6413236921211.558, - * "sar": 260047790673.40265, - * "sek": 740204312126.5353, + * "bhd": 26102689718.1482, + * "bmd": 69327091133.5489, + * "brl": 351217283120.761, + * "cad": 94218983205.0497, + * "chf": 62524924932.7986, + * "clp": 65153216175224.4, + * "cny": 501401253914.28, + * "czk": 1619501647007.04, + * "dkk": 477136772017.537, + * "eur": 63902315579.4398, + * "gbp": 54856031438.6965, + * "gel": 185796604237.911, + * "hkd": 542827657221.132, + * "huf": 24962090950805.3, + * "idr": 1101451492157040, + * "ils": 259902273109.113, + * "inr": 5774743147085.06, + * "jpy": 10510333651301.7, + * "krw": 93679615385638.7, + * "kwd": 21303868469.8839, + * "lkr": 20701955274048.2, + * "mmk": 145382556642719, + * "mxn": 1140680226674.96, + * "myr": 329130365156.523, + * "ngn": 89753343519839.4, + * "nok": 743838091608.3, + * "nzd": 115276185884.681, + * "php": 3923220156574.62, + * "pkr": 19241094948336.3, + * "pln": 273799512470.654, + * "rub": 6413236921211.56, + * "sar": 260047790673.403, + * "sek": 740204312126.535, * "sgd": 93550808700.7045, - * "thb": 2538702546310.5654, - * "try": 2223423872616.704, - * "twd": 2227215995174.6167, - * "uah": 2688628550997.977, - * "vef": 6941721635.202251, - * "vnd": 1730798106094996.5, - * "zar": 1296208622923.966, - * "xdr": 52288433291.474365, - * "xag": 2522224952.6170354, - * "xau": 29755187.514519222, + * "thb": 2538702546310.57, + * "try": 2223423872616.7, + * "twd": 2227215995174.62, + * "uah": 2688628550997.98, + * "vef": 6941721635.20225, + * "vnd": 1730798106095000, + * "zar": 1296208622923.97, + * "xdr": 52288433291.4744, + * "xag": 2522224952.61704, + * "xau": 29755187.5145192, * "bits": 993675225562.481, * "sats": 99367522556248.1 * }, * "market_cap_percentage": { - * "btc": 50.446526323358434, - * "eth": 14.922806691821144, - * "usdt": 3.9290064119981887, - * "bnb": 3.2939520356345176, - * "sol": 2.9507480132815944, - * "usdc": 1.2092204926353505, - * "xrp": 1.2052348104116084, - * "steth": 1.1830926679376446, - * "doge": 1.0577856035454278, - * "ada": 0.7659872946940993 + * "btc": 50.4465263233584, + * "eth": 14.9228066918211, + * "usdt": 3.92900641199819, + * "bnb": 3.29395203563452, + * "sol": 2.95074801328159, + * "usdc": 1.20922049263535, + * "xrp": 1.20523481041161, + * "steth": 1.18309266793764, + * "doge": 1.05778560354543, + * "ada": 0.765987294694099 * }, - * "market_cap_change_percentage_24h_usd": 1.721795060602718, + * "market_cap_change_percentage_24h_usd": 1.72179506060272, * "updated_at": 1712512855 * } * } */ @@ -3481,7 +3504,7 @@ export interface components { * "trading_volume_24h": "5046503746.288261648853195485635", * "defi_dominance": "3.8676503084614763642371703099489945457095080090859886", * "top_coin_name": "Lido Staked Ether", - * "top_coin_defi_dominance": 30.589442518868005 + * "top_coin_defi_dominance": 30.589442518868 * } * } */ GlobalDeFi: { @@ -3854,7 +3877,7 @@ export interface operations { "simple-token-price": { parameters: { query: { - /** @description the contract addresses of tokens, comma-separated if querying more than 1 token's contract address */ + /** @description the contract address of a token */ contract_addresses: string; /** @description target currency of coins, comma-separated if querying more than 1 currency.
*refers to [`/simple/supported_vs_currencies`](/reference/simple-supported-currencies). */ vs_currencies: string; diff --git a/libs/repositories/src/gen/cow/cow-api-types.ts b/libs/repositories/src/gen/cow/cow-api-types.ts index 1c2c8dda..51b476fa 100644 --- a/libs/repositories/src/gen/cow/cow-api-types.ts +++ b/libs/repositories/src/gen/cow/cow-api-types.ts @@ -1280,6 +1280,11 @@ export interface components { sellAmount: components["schemas"]["TokenAmount"]; /** @description see `OrderParameters::buyAmount` */ buyAmount: components["schemas"]["TokenAmount"]; + /** + * @description Creation time of the order. Denominated in epoch seconds. + * @example 123456 + */ + created: string; /** @description see `OrderParameters::validTo` */ validTo: number; /** @description see `OrderParameters::kind` */ @@ -1314,6 +1319,9 @@ export interface components { /** @description The fee policies that are used to compute the protocol fees for this order. * */ protocolFees: components["schemas"]["FeePolicy"][]; + /** @description A winning quote. + * */ + quote?: components["schemas"]["Quote"]; }; /** @description A batch auction for solving. * */ @@ -1354,7 +1362,8 @@ export interface components { CompetitionOrderStatus: { /** @enum {string} */ type: "open" | "scheduled" | "active" | "solved" | "executing" | "traded" | "cancelled"; - /** @description A list of solvers who participated in the latest competition. The presence of executed amounts defines whether the solver provided a solution for the desired order. + /** @description 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. * */ value?: { /** @description Name of the solver. */ @@ -1410,9 +1419,9 @@ export interface components { buyAmount: components["schemas"]["TokenAmount"]; /** @description Transaction hash of the corresponding settlement transaction containing the trade (if available). */ txHash: components["schemas"]["TransactionHash"] | null; - /** @description The fee policies that were used to compute the fees for this trade. Listed in the order they got applied. + /** @description Executed protocol fees for this trade, together with the fee policies used. Listed in the order they got applied. * */ - feePolicies?: components["schemas"]["FeePolicy"][]; + executedProtocolFees?: components["schemas"]["ExecutedProtocolFee"][]; }; /** * @description Unique identifier for the order: 56 bytes encoded as hex with `0x` prefix. @@ -1592,16 +1601,6 @@ export interface components { id?: components["schemas"]["UID"]; executedAmount?: components["schemas"]["BigUint"]; }[]; - /** @description Transaction `calldata` that is executed on-chain if the settlement is executed. */ - callData?: components["schemas"]["CallData"]; - /** @description Full `calldata` as generated from the original solver output. - * - * It can be different from the executed transaction if part of the settlements are internalised - * (use internal liquidity in lieu of trading against on-chain liquidity). - * - * This field is omitted in case it coincides with `callData`. - * */ - uninternalizedCallData?: components["schemas"]["CallData"]; }; /** @description The estimated native price for the token * */ @@ -1649,6 +1648,13 @@ export interface components { }; /** @description Defines the ways to calculate the protocol fee. */ FeePolicy: components["schemas"]["Surplus"] | components["schemas"]["Volume"] | components["schemas"]["PriceImprovement"]; + ExecutedProtocolFee: { + policy?: components["schemas"]["FeePolicy"]; + /** @description Fee amount taken */ + amount?: components["schemas"]["TokenAmount"]; + /** @description The token in which the fee is taken */ + token?: components["schemas"]["Address"]; + }; }; responses: never; parameters: never; From 4443bf17fcacf5643a18fb88b95a98c03866b1d3 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Fri, 22 Nov 2024 13:30:14 +0500 Subject: [PATCH 07/31] chore: up sdk version --- package.json | 4 ++-- yarn.lock | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 37b5c36b..9162c98d 100644 --- a/package.json +++ b/package.json @@ -19,14 +19,14 @@ "compose:up": "yarn docker-build:affected && docker-compose up", "swagger": "ts-node scripts/fetchCoingeckoSwagger", "gen:types": "npx openapi-typescript", - "postinstall": "yarn gen:types", + "postinstall": "yarn gen:types && yarn run trading:generateSchemas", "test:api:slippage": "node apps/api/scripts/test-slippage.js", "trading:generateSchemas": "cp -R node_modules/@cowprotocol/cow-sdk/dist/schemas/trading apps/api/src/tradingSchemas" }, "private": true, "dependencies": { "@cowprotocol/cms": "^0.3.0-RC.4", - "@cowprotocol/cow-sdk": "5.8.0-RC.2", + "@cowprotocol/cow-sdk": "5.8.0-RC.3", "@fastify/autoload": "~5.7.1", "@fastify/caching": "^8.3.0", "@fastify/cors": "^8.2.1", diff --git a/yarn.lock b/yarn.lock index a52f94e2..dfcd9f3d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1083,10 +1083,10 @@ resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@cowprotocol/app-data@^2.1.0": - version "2.3.0" - resolved "https://registry.npmjs.org/@cowprotocol/app-data/-/app-data-2.3.0.tgz" - integrity sha512-wClmhKUAEVEgt9o7+ZLvV5AT/LP2ySMfPwveyy1Nwd762m8djaIddZ5cbex6iBROyOHEmk+9x9rcn8sUHXQ4Ww== +"@cowprotocol/app-data@^2.4.0": + version "2.4.0" + resolved "https://registry.yarnpkg.com/@cowprotocol/app-data/-/app-data-2.4.0.tgz#326e20065161e06308cf0ff429fe9dd2908c1c30" + integrity sha512-aG3CicUdR7jpY5/linxXmpL4axmiUvEwiHlOM0qKO/QdbNSntKNXjSu3r4QtHZ7BUiF1VUkcDVvvFW4D2MA0Rw== dependencies: ajv "^8.11.0" cross-fetch "^3.1.5" @@ -1106,12 +1106,12 @@ resolved "https://registry.npmjs.org/@cowprotocol/contracts/-/contracts-1.6.0.tgz" integrity sha512-+UKhYRzkvnqqviBru5D3btTLYc743n0O5YTG+wpYwGl4fb7VNKBkFHe28C5Mf1DF/kOfmqfu+0IAvX9Vuq5Dqw== -"@cowprotocol/cow-sdk@5.8.0-RC.2": - version "5.8.0-RC.2" - resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.2.tgz#c9fac6f0ebade01cff06a84c68aee27c35bd6b8e" - integrity sha512-Eqpg+H1GnHVwPNLvtX5JxnzM/3vLetdn7m2G5o6bCNFqPnBMbMne+NrEQ4voRTn4v5Y/FS0WD7d+q+CCeQU2dA== +"@cowprotocol/cow-sdk@5.8.0-RC.3": + version "5.8.0-RC.3" + resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.3.tgz#80b4651026f5b79c306ffa59cd330b481b63d677" + integrity sha512-N3jmQqB1exPaKeJE99xYzdK99XB96/QUfEVsfNW3rGFBBI5qDOl82naaxSOQPxikKRTt/CN3nRhHAYs4MgmZ7g== dependencies: - "@cowprotocol/app-data" "^2.1.0" + "@cowprotocol/app-data" "^2.4.0" "@cowprotocol/contracts" "^1.6.0" "@ethersproject/abstract-signer" "^5.7.0" "@openzeppelin/merkle-tree" "^1.0.5" From bc44fcfa559550f54178a05d3eb02851d36f72b7 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Fri, 22 Nov 2024 13:50:44 +0500 Subject: [PATCH 08/31] fix: add getQuote error message parsing --- apps/api/src/app/routes/trading/getQuote.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/api/src/app/routes/trading/getQuote.ts b/apps/api/src/app/routes/trading/getQuote.ts index 5e4a4b56..615db022 100644 --- a/apps/api/src/app/routes/trading/getQuote.ts +++ b/apps/api/src/app/routes/trading/getQuote.ts @@ -9,11 +9,22 @@ import { import { serializeQuoteAmountsAndCosts } from './serializeQuoteAmountsAndCosts'; import { bodySchema, errorSchema, successSchema } from './schemas'; +import type { OrderPostError } from '@cowprotocol/cow-sdk'; type SuccessSchema = FromSchema; type BodySchema = FromSchema; type ErrorSchema = FromSchema; +const isOrderPostError = (e: any): e is OrderPostError => e.errorType && e.description; + +const getErrorMessage = (e: any): string => { + if (e.body && isOrderPostError(e.body)) { + return e.body.description; + } + + return e.message || JSON.stringify(e); +} + const tradingService: TradingService = apiContainer.get( tradingServiceSymbol ); @@ -47,7 +58,9 @@ const root: FastifyPluginAsync = async (fastify): Promise => { amountsAndCosts: serializeQuoteAmountsAndCosts(result.amountsAndCosts) }); } catch (e) { - reply.code(500).send({ message: (e as Error).message }); + const errorMessage = getErrorMessage(e) + console.error('[Trading API] getQuote error', errorMessage) + reply.code(500).send({ message: errorMessage }); } } ); From bded4e01c41e8f3fc4659893664d0f1af33d41df Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Fri, 22 Nov 2024 16:22:46 +0500 Subject: [PATCH 09/31] feat: add orderTypedData to quote response --- .../tradingSchemas/QuoteResultsSerialized.ts | 410 ++++++++++++------ package.json | 4 +- yarn.lock | 8 +- 3 files changed, 290 insertions(+), 132 deletions(-) diff --git a/apps/api/src/tradingSchemas/QuoteResultsSerialized.ts b/apps/api/src/tradingSchemas/QuoteResultsSerialized.ts index 7eb1d0e4..3ded8790 100644 --- a/apps/api/src/tradingSchemas/QuoteResultsSerialized.ts +++ b/apps/api/src/tradingSchemas/QuoteResultsSerialized.ts @@ -79,130 +79,6 @@ export default { "sellTokenDecimals" ] }, - "amountsAndCosts": { - "type": "object", - "properties": { - "isSell": { - "type": "boolean" - }, - "costs": { - "type": "object", - "properties": { - "networkFee": { - "type": "object", - "properties": { - "amountInSellCurrency": { - "type": "string" - }, - "amountInBuyCurrency": { - "type": "string" - } - }, - "required": [ - "amountInSellCurrency", - "amountInBuyCurrency" - ], - "additionalProperties": false - }, - "partnerFee": { - "type": "object", - "properties": { - "amount": { - "type": "string" - }, - "bps": { - "type": "number" - } - }, - "required": [ - "amount", - "bps" - ], - "additionalProperties": false - } - }, - "required": [ - "networkFee", - "partnerFee" - ], - "additionalProperties": false - }, - "beforeNetworkCosts": { - "type": "object", - "properties": { - "sellAmount": { - "type": "string" - }, - "buyAmount": { - "type": "string" - } - }, - "required": [ - "sellAmount", - "buyAmount" - ], - "additionalProperties": false - }, - "afterNetworkCosts": { - "type": "object", - "properties": { - "sellAmount": { - "type": "string" - }, - "buyAmount": { - "type": "string" - } - }, - "required": [ - "sellAmount", - "buyAmount" - ], - "additionalProperties": false - }, - "afterPartnerFees": { - "type": "object", - "properties": { - "sellAmount": { - "type": "string" - }, - "buyAmount": { - "type": "string" - } - }, - "required": [ - "sellAmount", - "buyAmount" - ], - "additionalProperties": false - }, - "afterSlippage": { - "type": "object", - "properties": { - "sellAmount": { - "type": "string" - }, - "buyAmount": { - "type": "string" - } - }, - "required": [ - "sellAmount", - "buyAmount" - ], - "additionalProperties": false - } - }, - "required": [ - "isSell", - "costs", - "beforeNetworkCosts", - "afterNetworkCosts", - "afterPartnerFees", - "afterSlippage" - ], - "additionalProperties": false, - "description": "CoW Protocol quote has amounts (sell/buy) and costs (network fee), there is also partner fees. Besides that, CoW Protocol supports both sell and buy orders and the fees and costs are calculated differently.\n\nThe order of adding fees and costs is as follows: 1. Network fee is always added to the sell amount 2. Partner fee is added to the surplus amount (sell amount for sell-orders, buy amount for buy-orders)\n\nFor sell-orders the partner fee is subtracted from the buy amount after network costs. For buy-orders the partner fee is added on top of the sell amount after network costs." - }, "orderToSign": { "type": "object", "additionalProperties": false, @@ -670,14 +546,296 @@ export default { "appDataKeccak256" ], "additionalProperties": false + }, + "orderTypedData": { + "type": "object", + "properties": { + "domain": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "version": { + "type": "string" + }, + "chainId": { + "type": "number" + }, + "verifyingContract": { + "type": "string" + } + }, + "required": [ + "name", + "version", + "chainId", + "verifyingContract" + ], + "additionalProperties": false + }, + "primaryType": { + "type": "string", + "const": "Order" + }, + "types": { + "type": "object", + "properties": { + "Order": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "required": [ + "name", + "type" + ], + "additionalProperties": false + } + } + }, + "required": [ + "Order" + ], + "additionalProperties": false + }, + "message": { + "type": "object", + "additionalProperties": false, + "properties": { + "receiver": { + "type": "string" + }, + "sellToken": { + "type": "string", + "description": "ERC-20 token to be sold." + }, + "buyToken": { + "type": "string", + "description": "ERC-20 token to be bought." + }, + "sellAmount": { + "type": "string", + "description": "Amount of `sellToken` to be sold in atoms." + }, + "buyAmount": { + "type": "string", + "description": "Amount of `buyToken` to be bought in atoms." + }, + "validTo": { + "type": "number", + "description": "Unix timestamp (`uint32`) until which the order is valid." + }, + "appData": { + "type": "string", + "description": "32 bytes encoded as hex with `0x` prefix. It's expected to be the hash of the stringified JSON object representing the `appData`." + }, + "feeAmount": { + "type": "string", + "description": "feeRatio * sellAmount + minimal_fee in atoms." + }, + "kind": { + "type": "string", + "enum": [ + "buy", + "sell" + ], + "description": "The kind is either a buy or sell order." + }, + "partiallyFillable": { + "type": "boolean", + "description": "Is the order fill-or-kill or partially fillable?" + }, + "sellTokenBalance": { + "type": "string", + "enum": [ + "erc20", + "internal", + "external" + ], + "description": "Where should the `sellToken` be drawn from?" + }, + "buyTokenBalance": { + "type": "string", + "enum": [ + "erc20", + "internal" + ], + "description": "Where should the `buyToken` be transferred to?" + }, + "signingScheme": { + "type": "string", + "enum": [ + "eip712", + "ethsign", + "presign", + "eip1271" + ], + "description": "How was the order signed?" + } + }, + "required": [ + "appData", + "buyAmount", + "buyToken", + "feeAmount", + "kind", + "partiallyFillable", + "receiver", + "sellAmount", + "sellToken", + "validTo" + ], + "description": "Unsigned order intent to be placed." + } + }, + "required": [ + "domain", + "primaryType", + "types", + "message" + ], + "additionalProperties": false + }, + "amountsAndCosts": { + "type": "object", + "properties": { + "isSell": { + "type": "boolean" + }, + "costs": { + "type": "object", + "properties": { + "networkFee": { + "type": "object", + "properties": { + "amountInSellCurrency": { + "type": "string" + }, + "amountInBuyCurrency": { + "type": "string" + } + }, + "required": [ + "amountInSellCurrency", + "amountInBuyCurrency" + ], + "additionalProperties": false + }, + "partnerFee": { + "type": "object", + "properties": { + "amount": { + "type": "string" + }, + "bps": { + "type": "number" + } + }, + "required": [ + "amount", + "bps" + ], + "additionalProperties": false + } + }, + "required": [ + "networkFee", + "partnerFee" + ], + "additionalProperties": false + }, + "beforeNetworkCosts": { + "type": "object", + "properties": { + "sellAmount": { + "type": "string" + }, + "buyAmount": { + "type": "string" + } + }, + "required": [ + "sellAmount", + "buyAmount" + ], + "additionalProperties": false + }, + "afterNetworkCosts": { + "type": "object", + "properties": { + "sellAmount": { + "type": "string" + }, + "buyAmount": { + "type": "string" + } + }, + "required": [ + "sellAmount", + "buyAmount" + ], + "additionalProperties": false + }, + "afterPartnerFees": { + "type": "object", + "properties": { + "sellAmount": { + "type": "string" + }, + "buyAmount": { + "type": "string" + } + }, + "required": [ + "sellAmount", + "buyAmount" + ], + "additionalProperties": false + }, + "afterSlippage": { + "type": "object", + "properties": { + "sellAmount": { + "type": "string" + }, + "buyAmount": { + "type": "string" + } + }, + "required": [ + "sellAmount", + "buyAmount" + ], + "additionalProperties": false + } + }, + "required": [ + "isSell", + "costs", + "beforeNetworkCosts", + "afterNetworkCosts", + "afterPartnerFees", + "afterSlippage" + ], + "additionalProperties": false, + "description": "CoW Protocol quote has amounts (sell/buy) and costs (network fee), there is also partner fees. Besides that, CoW Protocol supports both sell and buy orders and the fees and costs are calculated differently.\n\nThe order of adding fees and costs is as follows: 1. Network fee is always added to the sell amount 2. Partner fee is added to the surplus amount (sell amount for sell-orders, buy amount for buy-orders)\n\nFor sell-orders the partner fee is subtracted from the buy amount after network costs. For buy-orders the partner fee is added on top of the sell amount after network costs." } }, "required": [ - "tradeParameters", "amountsAndCosts", + "appDataInfo", "orderToSign", + "orderTypedData", "quoteResponse", - "appDataInfo" + "tradeParameters" ], "additionalProperties": false, "definitions": {} diff --git a/package.json b/package.json index 9162c98d..58e8cc60 100644 --- a/package.json +++ b/package.json @@ -21,12 +21,12 @@ "gen:types": "npx openapi-typescript", "postinstall": "yarn gen:types && yarn run trading:generateSchemas", "test:api:slippage": "node apps/api/scripts/test-slippage.js", - "trading:generateSchemas": "cp -R node_modules/@cowprotocol/cow-sdk/dist/schemas/trading apps/api/src/tradingSchemas" + "trading:generateSchemas": "cp -R node_modules/@cowprotocol/cow-sdk/dist/schemas/trading/* apps/api/src/tradingSchemas" }, "private": true, "dependencies": { "@cowprotocol/cms": "^0.3.0-RC.4", - "@cowprotocol/cow-sdk": "5.8.0-RC.3", + "@cowprotocol/cow-sdk": "5.8.0-RC.4", "@fastify/autoload": "~5.7.1", "@fastify/caching": "^8.3.0", "@fastify/cors": "^8.2.1", diff --git a/yarn.lock b/yarn.lock index dfcd9f3d..43da6b6e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1106,10 +1106,10 @@ resolved "https://registry.npmjs.org/@cowprotocol/contracts/-/contracts-1.6.0.tgz" integrity sha512-+UKhYRzkvnqqviBru5D3btTLYc743n0O5YTG+wpYwGl4fb7VNKBkFHe28C5Mf1DF/kOfmqfu+0IAvX9Vuq5Dqw== -"@cowprotocol/cow-sdk@5.8.0-RC.3": - version "5.8.0-RC.3" - resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.3.tgz#80b4651026f5b79c306ffa59cd330b481b63d677" - integrity sha512-N3jmQqB1exPaKeJE99xYzdK99XB96/QUfEVsfNW3rGFBBI5qDOl82naaxSOQPxikKRTt/CN3nRhHAYs4MgmZ7g== +"@cowprotocol/cow-sdk@5.8.0-RC.4": + version "5.8.0-RC.4" + resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.4.tgz#8c54f5d1602713be1137d7af8c599a33f471ea98" + integrity sha512-egTA7s0oC07ipszHx7531gfFddpv0Es5TTea63+8v3WQGWAV5nGR+BNCDH7dD+4Jg/HGQ7txujB0ntSgUkVgRg== dependencies: "@cowprotocol/app-data" "^2.4.0" "@cowprotocol/contracts" "^1.6.0" From 7a0b81bded5ca9decc83258bd2a5965d87dff1a8 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Fri, 22 Nov 2024 17:11:30 +0500 Subject: [PATCH 10/31] feat(trading): add postOrder method --- apps/api/src/app/routes/trading/README.md | 39 +++++++++++ apps/api/src/app/routes/trading/getQuote.ts | 22 ++----- apps/api/src/app/routes/trading/postOrder.ts | 58 +++++++++++++++++ apps/api/src/app/routes/trading/schemas.ts | 64 ++++++++++++++----- apps/api/src/app/routes/trading/utils.ts | 11 ++++ .../tradingSchemas/QuoteResultsSerialized.ts | 40 +++++------- .../src/TradingService/TradingService.ts | 46 ++++++++++++- package.json | 2 +- yarn.lock | 8 +-- 9 files changed, 229 insertions(+), 61 deletions(-) create mode 100644 apps/api/src/app/routes/trading/postOrder.ts create mode 100644 apps/api/src/app/routes/trading/utils.ts diff --git a/apps/api/src/app/routes/trading/README.md b/apps/api/src/app/routes/trading/README.md index 4c423f85..ff53c31c 100644 --- a/apps/api/src/app/routes/trading/README.md +++ b/apps/api/src/app/routes/trading/README.md @@ -1,5 +1,6 @@ # Example +### Get quote ```ts fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ trader: { @@ -16,4 +17,42 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont amount: '12000000000000000' } })}) +``` + +### Get quote -> sign -> send + +```ts +(async function() { + const trader = { + account: '0xfb3c7eb936cAA12B5A884d612393969A557d4307', + appCode: 'test1', + chainId: 11155111 + } + const params = { + kind: 'sell', + sellToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14', + buyToken: '0x0625afb445c3b6b7b929342a04a22599fd5dbb59', + sellTokenDecimals: 18, + buyTokenDecimals: 18, + amount: '100000000000000000' + } + + const callApi = (method, body) => fetch('http://127.0.0.1:8080/trading/' + method, { + method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) + }).then(res => res.json()) + + // Get quote + const { quoteResponse, orderTypedData, appDataInfo } = await callApi('getQuote', { trader, params }) + // Connect wallet + const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }) + // Sign order + const signature = await window.ethereum.request({ + method: 'eth_signTypedData_v4', + params: [accounts[0], JSON.stringify(orderTypedData)] + }) + // Send order + const orderId = await callApi('postOrder', { trader, signature, quoteResponse, orderTypedData, appDataInfo }) + + console.log('Order Id:', orderId) +})() ``` \ No newline at end of file diff --git a/apps/api/src/app/routes/trading/getQuote.ts b/apps/api/src/app/routes/trading/getQuote.ts index 615db022..8a09b042 100644 --- a/apps/api/src/app/routes/trading/getQuote.ts +++ b/apps/api/src/app/routes/trading/getQuote.ts @@ -8,23 +8,13 @@ import { } from '@cowprotocol/services'; import { serializeQuoteAmountsAndCosts } from './serializeQuoteAmountsAndCosts'; -import { bodySchema, errorSchema, successSchema } from './schemas'; -import type { OrderPostError } from '@cowprotocol/cow-sdk'; +import { errorSchema, getQuoteBodySchema, getQuoteSuccessSchema } from './schemas'; +import { getErrorMessage } from './utils'; -type SuccessSchema = FromSchema; -type BodySchema = FromSchema; +type SuccessSchema = FromSchema; +type BodySchema = FromSchema; type ErrorSchema = FromSchema; -const isOrderPostError = (e: any): e is OrderPostError => e.errorType && e.description; - -const getErrorMessage = (e: any): string => { - if (e.body && isOrderPostError(e.body)) { - return e.body.description; - } - - return e.message || JSON.stringify(e); -} - const tradingService: TradingService = apiContainer.get( tradingServiceSymbol ); @@ -37,9 +27,9 @@ const root: FastifyPluginAsync = async (fastify): Promise => { '/getQuote', { schema: { - body: bodySchema, + body: getQuoteBodySchema, response: { - '2XX': successSchema, + '2XX': getQuoteSuccessSchema, '400': errorSchema, }, }, diff --git a/apps/api/src/app/routes/trading/postOrder.ts b/apps/api/src/app/routes/trading/postOrder.ts new file mode 100644 index 00000000..6911289c --- /dev/null +++ b/apps/api/src/app/routes/trading/postOrder.ts @@ -0,0 +1,58 @@ +import { FastifyPluginAsync } from 'fastify'; + +import { FromSchema } from 'json-schema-to-ts'; +import { apiContainer } from '../../inversify.config'; +import { + TradingService, + tradingServiceSymbol +} from '@cowprotocol/services'; + +import { errorSchema, postOrderBodySchema, postOrderSuccessSchema } from './schemas'; +import { getErrorMessage } from './utils'; + +type SuccessSchema = FromSchema; +type BodySchema = FromSchema; +type ErrorSchema = FromSchema; + +const tradingService: TradingService = apiContainer.get( + tradingServiceSymbol +); + +const root: FastifyPluginAsync = async (fastify): Promise => { + fastify.post<{ + Reply: SuccessSchema | ErrorSchema; + Body: BodySchema; + }>( + '/postOrder', + { + schema: { + body: postOrderBodySchema, + response: { + '2XX': postOrderSuccessSchema, + '400': errorSchema, + }, + }, + }, + async function (request, reply) { + const { trader, quoteResponse, orderTypedData, appDataInfo, signature } = request.body + + try { + const orderId = await tradingService.postOrder( + trader, + quoteResponse as Parameters[1], + orderTypedData as Parameters[2], + appDataInfo, + signature + ); + + reply.send({ orderId }); + } catch (e) { + const errorMessage = getErrorMessage(e) + console.error('[Trading API] postOrder error', errorMessage) + reply.code(500).send({ message: errorMessage }); + } + } + ); +}; + +export default root; \ No newline at end of file diff --git a/apps/api/src/app/routes/trading/schemas.ts b/apps/api/src/app/routes/trading/schemas.ts index ec88c2c2..59d00131 100644 --- a/apps/api/src/app/routes/trading/schemas.ts +++ b/apps/api/src/app/routes/trading/schemas.ts @@ -1,30 +1,20 @@ -import { ChainIdSchema } from '../../schemas'; import { JSONSchema } from 'json-schema-to-ts'; import QuoterParametersSchema from '../../../tradingSchemas/QuoterParameters'; import TradeParametersSchema from '../../../tradingSchemas/TradeParameters'; import QuoteResultsSchema from '../../../tradingSchemas/QuoteResultsSerialized'; -export const routeSchema = { +export const getQuoteBodySchema = { type: 'object', - required: ['chainId'], - additionalProperties: false, - properties: { - chainId: ChainIdSchema, - }, -} as const satisfies JSONSchema; - -export const bodySchema = { - type: 'object', - required: ['trader'], + required: ['trader', 'params'], additionalProperties: false, properties: { trader: QuoterParametersSchema, params: TradeParametersSchema - }, + } } as const satisfies JSONSchema; -export const successSchema = QuoteResultsSchema; +export const getQuoteSuccessSchema = QuoteResultsSchema; export const errorSchema = { type: 'object', @@ -34,7 +24,49 @@ export const errorSchema = { message: { title: 'Message', description: 'Message describing the error.', - type: 'string', + type: 'string' + } + } +} as const satisfies JSONSchema; + +export const postOrderBodySchema = { + type: 'object', + required: ['trader', 'quoteResponse', 'orderTypedData', 'appDataInfo', 'signature'], + additionalProperties: false, + properties: { + trader: { + type: 'object', + additionalProperties: false, + properties: { + env: TradeParametersSchema.properties.env, + chainId: QuoterParametersSchema.properties.chainId, + account: QuoterParametersSchema.properties.account, + }, + required: [ + 'chainId', + 'account' + ] }, - }, + quoteResponse: QuoteResultsSchema.properties.quoteResponse, + orderTypedData: QuoteResultsSchema.properties.orderTypedData, + appDataInfo: QuoteResultsSchema.properties.appDataInfo, + signature: { + title: 'ECDSA signature of the order', + description: 'Result of eth_signTypedData_v4 with the orderTypedData', + type: 'string' + } + } +} as const satisfies JSONSchema; + +export const postOrderSuccessSchema = { + type: 'object', + required: ['orderId'], + additionalProperties: false, + properties: { + orderId: { + title: 'Order ID', + description: 'Unique identifier for the order, you can search for details of the order in https://explorer.cow.fi using the ID.', + type: 'string' + } + } } as const satisfies JSONSchema; \ No newline at end of file diff --git a/apps/api/src/app/routes/trading/utils.ts b/apps/api/src/app/routes/trading/utils.ts new file mode 100644 index 00000000..10b182c9 --- /dev/null +++ b/apps/api/src/app/routes/trading/utils.ts @@ -0,0 +1,11 @@ +import type { OrderPostError } from '@cowprotocol/cow-sdk'; + +const isOrderPostError = (e: any): e is OrderPostError => e.errorType && e.description; + +export const getErrorMessage = (e: any): string => { + if (e.body && isOrderPostError(e.body)) { + return e.body.description; + } + + return e.message || JSON.stringify(e); +} diff --git a/apps/api/src/tradingSchemas/QuoteResultsSerialized.ts b/apps/api/src/tradingSchemas/QuoteResultsSerialized.ts index 3ded8790..b81cb2a0 100644 --- a/apps/api/src/tradingSchemas/QuoteResultsSerialized.ts +++ b/apps/api/src/tradingSchemas/QuoteResultsSerialized.ts @@ -580,31 +580,25 @@ export default { }, "types": { "type": "object", - "properties": { - "Order": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "type": { - "type": "string" - } + "additionalProperties": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" }, - "required": [ - "name", - "type" - ], - "additionalProperties": false - } + "type": { + "type": "string" + } + }, + "required": [ + "name", + "type" + ], + "additionalProperties": false } - }, - "required": [ - "Order" - ], - "additionalProperties": false + } }, "message": { "type": "object", diff --git a/libs/services/src/TradingService/TradingService.ts b/libs/services/src/TradingService/TradingService.ts index 17d0d06c..5b7d4d7e 100644 --- a/libs/services/src/TradingService/TradingService.ts +++ b/libs/services/src/TradingService/TradingService.ts @@ -1,8 +1,22 @@ import { injectable } from 'inversify'; -import { getQuote, TradeParameters, SwapAdvancedSettings, QuoteResults } from '@cowprotocol/cow-sdk'; +import { + getQuote, + TradeParameters, + SwapAdvancedSettings, + QuoteResults, + OrderBookApi, + SupportedChainId, + CowEnv +} from '@cowprotocol/cow-sdk'; export const tradingServiceSymbol = Symbol.for('TradingServiceSymbol'); +interface TraderParams { + chainId: SupportedChainId + account: string + env?: CowEnv +} + @injectable() export class TradingService { @@ -13,4 +27,34 @@ export class TradingService { ): Promise { return getQuote(params, trader, advancedSettings).then(({result}) => result); } + + async postOrder( + trader: TraderParams, + quoteResponse: QuoteResults['quoteResponse'], + orderTypedData: QuoteResults['orderTypedData'], + appDataInfo: QuoteResults['appDataInfo'], + signature: string + ) { + if (!quoteResponse.id) { + throw new Error('Quote id is required to post order') + } + + if (!quoteResponse.quote.signingScheme) { + throw new Error('Quote signing scheme is required to post order') + } + + const {chainId, account, env} = trader + + const orderBookApi = new OrderBookApi({ chainId, env }) + + return orderBookApi.sendOrder({ + ...orderTypedData.message, + from: account.toLowerCase(), + signature, + signingScheme: quoteResponse.quote.signingScheme, + quoteId: quoteResponse.id, + appData: appDataInfo.fullAppData, + appDataHash: appDataInfo.appDataKeccak256 + }) + } } diff --git a/package.json b/package.json index 58e8cc60..bd3cdbca 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "private": true, "dependencies": { "@cowprotocol/cms": "^0.3.0-RC.4", - "@cowprotocol/cow-sdk": "5.8.0-RC.4", + "@cowprotocol/cow-sdk": "5.8.0-RC.5", "@fastify/autoload": "~5.7.1", "@fastify/caching": "^8.3.0", "@fastify/cors": "^8.2.1", diff --git a/yarn.lock b/yarn.lock index 43da6b6e..e246d274 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1106,10 +1106,10 @@ resolved "https://registry.npmjs.org/@cowprotocol/contracts/-/contracts-1.6.0.tgz" integrity sha512-+UKhYRzkvnqqviBru5D3btTLYc743n0O5YTG+wpYwGl4fb7VNKBkFHe28C5Mf1DF/kOfmqfu+0IAvX9Vuq5Dqw== -"@cowprotocol/cow-sdk@5.8.0-RC.4": - version "5.8.0-RC.4" - resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.4.tgz#8c54f5d1602713be1137d7af8c599a33f471ea98" - integrity sha512-egTA7s0oC07ipszHx7531gfFddpv0Es5TTea63+8v3WQGWAV5nGR+BNCDH7dD+4Jg/HGQ7txujB0ntSgUkVgRg== +"@cowprotocol/cow-sdk@5.8.0-RC.5": + version "5.8.0-RC.5" + resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.5.tgz#041d5386d6493b35fcf83a800982131aae679536" + integrity sha512-/ouvWk7T69Yz6FvHA83tuhB0winc+SbWXRMor+zgs9zc3ZP46k4y5U4ASZ2roEPUbKaNLbdLz+KToTr6RPHwzw== dependencies: "@cowprotocol/app-data" "^2.4.0" "@cowprotocol/contracts" "^1.6.0" From 50de46d4c78454554aba5c947d8b2dbbc7287ddd Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Tue, 26 Nov 2024 13:52:41 +0500 Subject: [PATCH 11/31] feat: get decimals for trade from erc20 repo --- apps/api/src/app/routes/trading/README.md | 4 ---- apps/api/src/app/routes/trading/schemas.ts | 13 +++++++++- libs/repositories/src/const.ts | 2 +- .../src/TradingService/TradingService.ts | 24 ++++++++++++++++--- libs/shared/src/utils.ts | 11 +++++++++ 5 files changed, 45 insertions(+), 9 deletions(-) diff --git a/apps/api/src/app/routes/trading/README.md b/apps/api/src/app/routes/trading/README.md index ff53c31c..d5f280be 100644 --- a/apps/api/src/app/routes/trading/README.md +++ b/apps/api/src/app/routes/trading/README.md @@ -12,8 +12,6 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont kind: 'sell', sellToken: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", buyToken: "0xdef1ca1fb7fbcdc777520aa7f396b4e015f497ab", - sellTokenDecimals: 18, - buyTokenDecimals: 18, amount: '12000000000000000' } })}) @@ -32,8 +30,6 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont kind: 'sell', sellToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14', buyToken: '0x0625afb445c3b6b7b929342a04a22599fd5dbb59', - sellTokenDecimals: 18, - buyTokenDecimals: 18, amount: '100000000000000000' } diff --git a/apps/api/src/app/routes/trading/schemas.ts b/apps/api/src/app/routes/trading/schemas.ts index 59d00131..e6be4fc8 100644 --- a/apps/api/src/app/routes/trading/schemas.ts +++ b/apps/api/src/app/routes/trading/schemas.ts @@ -1,5 +1,7 @@ import { JSONSchema } from 'json-schema-to-ts'; +import { omit } from '@cowprotocol/shared'; + import QuoterParametersSchema from '../../../tradingSchemas/QuoterParameters'; import TradeParametersSchema from '../../../tradingSchemas/TradeParameters'; import QuoteResultsSchema from '../../../tradingSchemas/QuoteResultsSerialized'; @@ -10,7 +12,16 @@ export const getQuoteBodySchema = { additionalProperties: false, properties: { trader: QuoterParametersSchema, - params: TradeParametersSchema + params: { + ...TradeParametersSchema, + properties: omit(TradeParametersSchema.properties, ['sellTokenDecimals', 'buyTokenDecimals']), + required: [ + 'amount', + 'kind', + 'sellToken', + 'buyToken', + ] + } } } as const satisfies JSONSchema; diff --git a/libs/repositories/src/const.ts b/libs/repositories/src/const.ts index c58ce563..b9445ada 100644 --- a/libs/repositories/src/const.ts +++ b/libs/repositories/src/const.ts @@ -1,5 +1,5 @@ import BigNumber from 'bignumber.js'; -import { SupportedChainId } from '../../shared/src/types'; +import { SupportedChainId } from '@cowprotocol/shared'; interface TokenAddressAndDecimals { address: string; diff --git a/libs/services/src/TradingService/TradingService.ts b/libs/services/src/TradingService/TradingService.ts index 5b7d4d7e..387b820b 100644 --- a/libs/services/src/TradingService/TradingService.ts +++ b/libs/services/src/TradingService/TradingService.ts @@ -1,4 +1,4 @@ -import { injectable } from 'inversify'; +import { inject, injectable } from 'inversify'; import { getQuote, TradeParameters, @@ -8,6 +8,7 @@ import { SupportedChainId, CowEnv } from '@cowprotocol/cow-sdk'; +import { Erc20Repository, erc20RepositorySymbol } from '@cowprotocol/repositories'; export const tradingServiceSymbol = Symbol.for('TradingServiceSymbol'); @@ -19,13 +20,30 @@ interface TraderParams { @injectable() export class TradingService { + constructor( + @inject(erc20RepositorySymbol) + private erc20Repository: Erc20Repository + ) { + } async getQuote( trader: Parameters[1], - params: TradeParameters, + params: Omit, advancedSettings?: SwapAdvancedSettings ): Promise { - return getQuote(params, trader, advancedSettings).then(({result}) => result); + const chainId = trader.chainId as number + const sellToken = await this.erc20Repository.get(chainId, params.sellToken); + const buyToken = await this.erc20Repository.get(chainId, params.buyToken); + + if (typeof sellToken?.decimals !== 'number' || typeof buyToken?.decimals !== 'number') { + throw new Error('[TradingService.getQuote] Cannot find tokens decimals') + } + + const sellTokenDecimals = sellToken.decimals + const buyTokenDecimals = buyToken.decimals + + return getQuote({ ...params, sellTokenDecimals, buyTokenDecimals }, trader, advancedSettings) + .then(({result}) => result); } async postOrder( diff --git a/libs/shared/src/utils.ts b/libs/shared/src/utils.ts index 7cfc9aba..57f1d425 100644 --- a/libs/shared/src/utils.ts +++ b/libs/shared/src/utils.ts @@ -41,3 +41,14 @@ export function toSupportedChainId(chain: string | number): SupportedChainId { return chain; } + + +export function omit(object: T, omitKeys: K[]): Omit { + const result = { ...object }; + + for (const key of omitKeys) { + delete result[key]; + } + + return result; +} \ No newline at end of file From e61b80f76c78aed6c87e3f7762960d54b1197bc1 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Tue, 26 Nov 2024 15:46:24 +0500 Subject: [PATCH 12/31] feat(trading): support pre-sign order signing schema --- apps/api/src/app/inversify.config.ts | 26 ++- apps/api/src/app/routes/trading/README.md | 36 +++ apps/api/src/app/routes/trading/postOrder.ts | 4 +- apps/api/src/app/routes/trading/schemas.ts | 29 ++- libs/abis/src/abis/GPv2Settlement.json | 89 +++++++ .../src/generated/custom/GPv2Settlement.ts | 218 ++++++++++++++++++ .../factories/GPv2Settlement__factory.ts | 118 ++++++++++ .../src/generated/custom/factories/index.ts | 1 + libs/abis/src/generated/custom/index.ts | 2 + libs/repositories/src/datasources/viem.ts | 1 - .../src/TradingService/TradingService.ts | 101 +++++++- libs/shared/src/const.ts | 2 + 12 files changed, 603 insertions(+), 24 deletions(-) create mode 100644 libs/abis/src/abis/GPv2Settlement.json create mode 100644 libs/abis/src/generated/custom/GPv2Settlement.ts create mode 100644 libs/abis/src/generated/custom/factories/GPv2Settlement__factory.ts diff --git a/apps/api/src/app/inversify.config.ts b/apps/api/src/app/inversify.config.ts index ad7f18d0..5138911c 100644 --- a/apps/api/src/app/inversify.config.ts +++ b/apps/api/src/app/inversify.config.ts @@ -1,3 +1,7 @@ +import ms from 'ms'; +import { PublicClient } from 'viem'; +import { Container } from 'inversify'; + import { CacheRepository, CacheRepositoryMemory, @@ -27,12 +31,6 @@ import { viemClients, } from '@cowprotocol/repositories'; -const DEFAULT_CACHE_VALUE_SECONDS = ms('2min') / 1000; // 2min cache time by default for values -const DEFAULT_CACHE_NULL_SECONDS = ms('30min') / 1000; // 30min cache time by default for NULL values (when the repository isn't known) - -const CACHE_TOKEN_INFO_SECONDS = ms('24h') / 1000; // 24h - -import { Container } from 'inversify'; import { SimulationService, SlippageService, @@ -48,7 +46,12 @@ import { usdServiceSymbol, tradingServiceSymbol } from '@cowprotocol/services'; -import ms from 'ms'; +import { SupportedChainId } from '@cowprotocol/cow-sdk'; + +const DEFAULT_CACHE_VALUE_SECONDS = ms('2min') / 1000; // 2min cache time by default for values +const DEFAULT_CACHE_NULL_SECONDS = ms('30min') / 1000; // 30min cache time by default for NULL values (when the repository isn't known) + +const CACHE_TOKEN_INFO_SECONDS = ms('24h') / 1000; // 24h function getErc20Repository(cacheRepository: CacheRepository): Erc20Repository { return new Erc20RepositoryCache( @@ -135,6 +138,12 @@ function getTokenHolderRepository( ]); } +function getTradingService( + erc20Repository: Erc20Repository +): TradingService { + return new TradingService(erc20Repository, viemClients as Record); +} + function getApiContainer(): Container { const apiContainer = new Container(); // Repositories @@ -142,6 +151,7 @@ function getApiContainer(): Container { const erc20Repository = getErc20Repository(cacheRepository); const simulationRepository = new SimulationRepositoryTenderly(); const tokenHolderRepository = getTokenHolderRepository(cacheRepository); + const tradingService = getTradingService(erc20Repository) apiContainer .bind(erc20RepositorySymbol) @@ -180,7 +190,7 @@ function getApiContainer(): Container { apiContainer .bind(tradingServiceSymbol) - .to(TradingService); + .toConstantValue(tradingService); return apiContainer; } diff --git a/apps/api/src/app/routes/trading/README.md b/apps/api/src/app/routes/trading/README.md index d5f280be..f1e2edf9 100644 --- a/apps/api/src/app/routes/trading/README.md +++ b/apps/api/src/app/routes/trading/README.md @@ -51,4 +51,40 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont console.log('Order Id:', orderId) })() +``` + +### Smart-contract wallet (pre-sign) + +```ts +(async function() { + const trader = { + account: '0xF568A3a2dfFd73C000E8E475B2D335A4A3818EBa', + appCode: 'test1', + chainId: 11155111 + } + const params = { + kind: 'sell', + sellToken: '0xfff9976782d46cc05630d1f6ebab18b2324d6b14', + buyToken: '0x0625afb445c3b6b7b929342a04a22599fd5dbb59', + amount: '100000000000000000' + } + + const callApi = (method, body) => fetch('http://127.0.0.1:8080/trading/' + method, { + method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) + }).then(res => res.json()) + + // Get quote + const { quoteResponse, orderTypedData, appDataInfo } = await callApi('getQuote', { trader, params }) + // Connect wallet + const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }) + // Sign order + const signature = trader.account + // Send order + const { orderId, preSignTransaction } = await callApi('postOrder', { trader, signature, quoteResponse, orderTypedData, appDataInfo }) + + // ACTION NEEDED: Send from smart-contract wallet + + console.log('Order Id:', orderId) + console.log('preSignTransaction:', preSignTransaction) +})() ``` \ No newline at end of file diff --git a/apps/api/src/app/routes/trading/postOrder.ts b/apps/api/src/app/routes/trading/postOrder.ts index 6911289c..937300c5 100644 --- a/apps/api/src/app/routes/trading/postOrder.ts +++ b/apps/api/src/app/routes/trading/postOrder.ts @@ -37,7 +37,7 @@ const root: FastifyPluginAsync = async (fastify): Promise => { const { trader, quoteResponse, orderTypedData, appDataInfo, signature } = request.body try { - const orderId = await tradingService.postOrder( + const result = await tradingService.postOrder( trader, quoteResponse as Parameters[1], orderTypedData as Parameters[2], @@ -45,7 +45,7 @@ const root: FastifyPluginAsync = async (fastify): Promise => { signature ); - reply.send({ orderId }); + reply.send(result); } catch (e) { const errorMessage = getErrorMessage(e) console.error('[Trading API] postOrder error', errorMessage) diff --git a/apps/api/src/app/routes/trading/schemas.ts b/apps/api/src/app/routes/trading/schemas.ts index e6be4fc8..5d157604 100644 --- a/apps/api/src/app/routes/trading/schemas.ts +++ b/apps/api/src/app/routes/trading/schemas.ts @@ -62,8 +62,8 @@ export const postOrderBodySchema = { orderTypedData: QuoteResultsSchema.properties.orderTypedData, appDataInfo: QuoteResultsSchema.properties.appDataInfo, signature: { - title: 'ECDSA signature of the order', - description: 'Result of eth_signTypedData_v4 with the orderTypedData', + title: 'ECDSA signature of the order OR account address for smart-contracts', + description: 'Result of eth_signTypedData_v4 with the orderTypedData OR the account address for smart-contracts (pre-sign)', type: 'string' } } @@ -78,6 +78,31 @@ export const postOrderSuccessSchema = { title: 'Order ID', description: 'Unique identifier for the order, you can search for details of the order in https://explorer.cow.fi using the ID.', type: 'string' + }, + preSignTransaction: { + type: 'object', + description: 'For smart-contracts, the transaction to be sent to the CoW Protocol Settlement contract to confirm the order.', + required: ['callData', 'gasLimit', 'to', 'value'], + additionalProperties: false, + properties: { + callData: { + title: 'Call data', + type: 'string' + }, + gasLimit: { + title: 'Gas limit', + type: 'string' + }, + to: { + title: 'CoW Protocol Settlement contract address', + type: 'string' + }, + value: { + title: 'Native token value to send', + type: 'string', + const: '0' + }, + } } } } as const satisfies JSONSchema; \ No newline at end of file diff --git a/libs/abis/src/abis/GPv2Settlement.json b/libs/abis/src/abis/GPv2Settlement.json new file mode 100644 index 00000000..da5a9a26 --- /dev/null +++ b/libs/abis/src/abis/GPv2Settlement.json @@ -0,0 +1,89 @@ +[ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract IERC20", + "name": "sellToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "contract IERC20", + "name": "buyToken", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "sellAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "buyAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "feeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "orderUid", + "type": "bytes" + } + ], + "name": "Trade", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "orderUid", + "type": "bytes" + }, + { + "internalType": "bool", + "name": "signed", + "type": "bool" + } + ], + "name": "setPreSignature", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "orderUid", + "type": "bytes" + } + ], + "name": "invalidateOrder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "domainSeparator", + "outputs": [{ "name": "", "type": "bytes32" }], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/libs/abis/src/generated/custom/GPv2Settlement.ts b/libs/abis/src/generated/custom/GPv2Settlement.ts new file mode 100644 index 00000000..eda94798 --- /dev/null +++ b/libs/abis/src/generated/custom/GPv2Settlement.ts @@ -0,0 +1,218 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ +import type { + BaseContract, + BigNumber, + BytesLike, + CallOverrides, + ContractTransaction, + Overrides, + PopulatedTransaction, + Signer, + utils, +} from "ethers"; +import type { + FunctionFragment, + Result, + EventFragment, +} from "@ethersproject/abi"; +import type { Listener, Provider } from "@ethersproject/providers"; +import type { + TypedEventFilter, + TypedEvent, + TypedListener, + OnEvent, +} from "./common"; + +export interface GPv2SettlementInterface extends utils.Interface { + functions: { + "setPreSignature(bytes,bool)": FunctionFragment; + "invalidateOrder(bytes)": FunctionFragment; + "domainSeparator()": FunctionFragment; + }; + + getFunction( + nameOrSignatureOrTopic: + | "setPreSignature" + | "invalidateOrder" + | "domainSeparator" + ): FunctionFragment; + + encodeFunctionData( + functionFragment: "setPreSignature", + values: [BytesLike, boolean] + ): string; + encodeFunctionData( + functionFragment: "invalidateOrder", + values: [BytesLike] + ): string; + encodeFunctionData( + functionFragment: "domainSeparator", + values?: undefined + ): string; + + decodeFunctionResult( + functionFragment: "setPreSignature", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "invalidateOrder", + data: BytesLike + ): Result; + decodeFunctionResult( + functionFragment: "domainSeparator", + data: BytesLike + ): Result; + + events: { + "Trade(address,address,address,uint256,uint256,uint256,bytes)": EventFragment; + }; + + getEvent(nameOrSignatureOrTopic: "Trade"): EventFragment; +} + +export interface TradeEventObject { + owner: string; + sellToken: string; + buyToken: string; + sellAmount: BigNumber; + buyAmount: BigNumber; + feeAmount: BigNumber; + orderUid: string; +} +export type TradeEvent = TypedEvent< + [string, string, string, BigNumber, BigNumber, BigNumber, string], + TradeEventObject +>; + +export type TradeEventFilter = TypedEventFilter; + +export interface GPv2Settlement extends BaseContract { + connect(signerOrProvider: Signer | Provider | string): this; + attach(addressOrName: string): this; + deployed(): Promise; + + interface: GPv2SettlementInterface; + + queryFilter( + event: TypedEventFilter, + fromBlockOrBlockhash?: string | number | undefined, + toBlock?: string | number | undefined + ): Promise>; + + listeners( + eventFilter?: TypedEventFilter + ): Array>; + listeners(eventName?: string): Array; + removeAllListeners( + eventFilter: TypedEventFilter + ): this; + removeAllListeners(eventName?: string): this; + off: OnEvent; + on: OnEvent; + once: OnEvent; + removeListener: OnEvent; + + functions: { + setPreSignature( + orderUid: BytesLike, + signed: boolean, + overrides?: Overrides & { from?: string } + ): Promise; + + invalidateOrder( + orderUid: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + domainSeparator( + overrides?: Overrides & { from?: string } + ): Promise; + }; + + setPreSignature( + orderUid: BytesLike, + signed: boolean, + overrides?: Overrides & { from?: string } + ): Promise; + + invalidateOrder( + orderUid: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + domainSeparator( + overrides?: Overrides & { from?: string } + ): Promise; + + callStatic: { + setPreSignature( + orderUid: BytesLike, + signed: boolean, + overrides?: CallOverrides + ): Promise; + + invalidateOrder( + orderUid: BytesLike, + overrides?: CallOverrides + ): Promise; + + domainSeparator(overrides?: CallOverrides): Promise; + }; + + filters: { + "Trade(address,address,address,uint256,uint256,uint256,bytes)"( + owner?: string | null, + sellToken?: null, + buyToken?: null, + sellAmount?: null, + buyAmount?: null, + feeAmount?: null, + orderUid?: null + ): TradeEventFilter; + Trade( + owner?: string | null, + sellToken?: null, + buyToken?: null, + sellAmount?: null, + buyAmount?: null, + feeAmount?: null, + orderUid?: null + ): TradeEventFilter; + }; + + estimateGas: { + setPreSignature( + orderUid: BytesLike, + signed: boolean, + overrides?: Overrides & { from?: string } + ): Promise; + + invalidateOrder( + orderUid: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + domainSeparator( + overrides?: Overrides & { from?: string } + ): Promise; + }; + + populateTransaction: { + setPreSignature( + orderUid: BytesLike, + signed: boolean, + overrides?: Overrides & { from?: string } + ): Promise; + + invalidateOrder( + orderUid: BytesLike, + overrides?: Overrides & { from?: string } + ): Promise; + + domainSeparator( + overrides?: Overrides & { from?: string } + ): Promise; + }; +} diff --git a/libs/abis/src/generated/custom/factories/GPv2Settlement__factory.ts b/libs/abis/src/generated/custom/factories/GPv2Settlement__factory.ts new file mode 100644 index 00000000..2bbfebda --- /dev/null +++ b/libs/abis/src/generated/custom/factories/GPv2Settlement__factory.ts @@ -0,0 +1,118 @@ +/* Autogenerated file. Do not edit manually. */ +/* tslint:disable */ +/* eslint-disable */ + +import { Contract, Signer, utils } from "ethers"; +import type { Provider } from "@ethersproject/providers"; +import type { + GPv2Settlement, + GPv2SettlementInterface, +} from "../GPv2Settlement"; + +const _abi = [ + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address", + }, + { + indexed: false, + internalType: "contract IERC20", + name: "sellToken", + type: "address", + }, + { + indexed: false, + internalType: "contract IERC20", + name: "buyToken", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "sellAmount", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "buyAmount", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "feeAmount", + type: "uint256", + }, + { + indexed: false, + internalType: "bytes", + name: "orderUid", + type: "bytes", + }, + ], + name: "Trade", + type: "event", + }, + { + inputs: [ + { + internalType: "bytes", + name: "orderUid", + type: "bytes", + }, + { + internalType: "bool", + name: "signed", + type: "bool", + }, + ], + name: "setPreSignature", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { + internalType: "bytes", + name: "orderUid", + type: "bytes", + }, + ], + name: "invalidateOrder", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "domainSeparator", + outputs: [ + { + name: "", + type: "bytes32", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, +] as const; + +export class GPv2Settlement__factory { + static readonly abi = _abi; + static createInterface(): GPv2SettlementInterface { + return new utils.Interface(_abi) as GPv2SettlementInterface; + } + static connect( + address: string, + signerOrProvider: Signer | Provider + ): GPv2Settlement { + return new Contract(address, _abi, signerOrProvider) as GPv2Settlement; + } +} diff --git a/libs/abis/src/generated/custom/factories/index.ts b/libs/abis/src/generated/custom/factories/index.ts index 2adf77e8..b37164fe 100644 --- a/libs/abis/src/generated/custom/factories/index.ts +++ b/libs/abis/src/generated/custom/factories/index.ts @@ -3,4 +3,5 @@ /* eslint-disable */ export { ComposableCoW__factory } from "./ComposableCoW__factory"; export { ExtensibleFallbackHandler__factory } from "./ExtensibleFallbackHandler__factory"; +export { GPv2Settlement__factory } from "./GPv2Settlement__factory"; export { SignatureVerifierMuxer__factory } from "./SignatureVerifierMuxer__factory"; diff --git a/libs/abis/src/generated/custom/index.ts b/libs/abis/src/generated/custom/index.ts index 3a4ca832..6770cacb 100644 --- a/libs/abis/src/generated/custom/index.ts +++ b/libs/abis/src/generated/custom/index.ts @@ -3,8 +3,10 @@ /* eslint-disable */ export type { ComposableCoW } from "./ComposableCoW"; export type { ExtensibleFallbackHandler } from "./ExtensibleFallbackHandler"; +export type { GPv2Settlement } from "./GPv2Settlement"; export type { SignatureVerifierMuxer } from "./SignatureVerifierMuxer"; export * as factories from "./factories"; export { ComposableCoW__factory } from "./factories/ComposableCoW__factory"; export { ExtensibleFallbackHandler__factory } from "./factories/ExtensibleFallbackHandler__factory"; +export { GPv2Settlement__factory } from "./factories/GPv2Settlement__factory"; export { SignatureVerifierMuxer__factory } from "./factories/SignatureVerifierMuxer__factory"; diff --git a/libs/repositories/src/datasources/viem.ts b/libs/repositories/src/datasources/viem.ts index 3039a1ea..b5f423f9 100644 --- a/libs/repositories/src/datasources/viem.ts +++ b/libs/repositories/src/datasources/viem.ts @@ -1,7 +1,6 @@ import { createPublicClient, http, - Client, Chain, PublicClient, webSocket, diff --git a/libs/services/src/TradingService/TradingService.ts b/libs/services/src/TradingService/TradingService.ts index 387b820b..cdb3f9ab 100644 --- a/libs/services/src/TradingService/TradingService.ts +++ b/libs/services/src/TradingService/TradingService.ts @@ -1,28 +1,48 @@ -import { inject, injectable } from 'inversify'; +import { injectable } from 'inversify'; +import { parseAbi, PublicClient } from 'viem'; + import { getQuote, TradeParameters, SwapAdvancedSettings, QuoteResults, OrderBookApi, - SupportedChainId, - CowEnv + SigningScheme, + CowEnv, + COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS, + SupportedChainId } from '@cowprotocol/cow-sdk'; -import { Erc20Repository, erc20RepositorySymbol } from '@cowprotocol/repositories'; +import { Erc20Repository } from '@cowprotocol/repositories'; +import { ETHEREUM_ADDRESS_LENGTH } from '@cowprotocol/shared'; +import { GPv2Settlement__factory } from '@cowprotocol/abis'; export const tradingServiceSymbol = Symbol.for('TradingServiceSymbol'); interface TraderParams { - chainId: SupportedChainId + chainId: number // TODO use SupportedChainId when the hell with local copy of SupportedChainId is solved account: string env?: CowEnv } +export interface PostOrderResult { + orderId: string + preSignTransaction?: { + callData: string + gasLimit: string + to: string + value: '0' + } +} + +const GAS_LIMIT_MARGIN = 20 // 20% +const DEFAULT_GAS_LIMIT = BigInt(150000) +const SettlementInterface = GPv2Settlement__factory.createInterface() + @injectable() export class TradingService { constructor( - @inject(erc20RepositorySymbol) - private erc20Repository: Erc20Repository + private erc20Repository: Erc20Repository, + private viemClients: Record ) { } @@ -52,7 +72,7 @@ export class TradingService { orderTypedData: QuoteResults['orderTypedData'], appDataInfo: QuoteResults['appDataInfo'], signature: string - ) { + ): Promise { if (!quoteResponse.id) { throw new Error('Quote id is required to post order') } @@ -61,18 +81,77 @@ export class TradingService { throw new Error('Quote signing scheme is required to post order') } - const {chainId, account, env} = trader + const { chainId, account, env } = trader const orderBookApi = new OrderBookApi({ chainId, env }) + const isPreSign = signature.length === ETHEREUM_ADDRESS_LENGTH + + const signingScheme = isPreSign + ? SigningScheme.PRESIGN + : quoteResponse.quote.signingScheme - return orderBookApi.sendOrder({ + const orderId = await orderBookApi.sendOrder({ ...orderTypedData.message, from: account.toLowerCase(), signature, - signingScheme: quoteResponse.quote.signingScheme, + signingScheme, quoteId: quoteResponse.id, appData: appDataInfo.fullAppData, appDataHash: appDataInfo.appDataKeccak256 }) + + if (isPreSign) { + return { + orderId, + preSignTransaction: await this.getPreSignTransaction(chainId, trader.account, orderId) + } + } else { + return { orderId } + } + } + + private async getPreSignTransaction( + chainId: SupportedChainId, + account: string, + orderId: string + ): Promise { + const viemClient = this.viemClients[chainId] + + const method = 'setPreSignature' + + const settlementContractAddress = COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS[chainId] as `0x${string}` + const preSignatureCall = SettlementInterface.encodeFunctionData(method, [orderId, true]) + + const gas = await (async () => { + try { + return viemClient.estimateContractGas({ + address: settlementContractAddress, + abi: parseAbi([ + SettlementInterface.getFunction(method).format('full') + ]), + functionName: method, + account: account as `0x${string}`, + args: [orderId, true] + }) + } catch (e) { + return DEFAULT_GAS_LIMIT + } + })() + + return { + callData: preSignatureCall, + gasLimit: this.addGasLimitMargin(gas).toString(), + to: settlementContractAddress, + value: '0' + } + } + + /** + * Returns the gas value plus a margin for unexpected or variable gas costs + * @param value the gas value to pad + */ + private addGasLimitMargin(value: bigint): bigint { + const twentyPercent = value * BigInt(GAS_LIMIT_MARGIN) / BigInt(100); + return value + twentyPercent; } } diff --git a/libs/shared/src/const.ts b/libs/shared/src/const.ts index eab8fa56..792c3e37 100644 --- a/libs/shared/src/const.ts +++ b/libs/shared/src/const.ts @@ -27,3 +27,5 @@ export const ChainNames: Record = { export const AllChainIds: SupportedChainId[] = Object.values(SupportedChainId) .filter((value) => typeof value === 'number') // Filter out non-numeric values .map((value) => value as number); // Map to number + +export const ETHEREUM_ADDRESS_LENGTH = 42 \ No newline at end of file From 5f5ec0fe52bdb366039e52ac5f0081bafe951d18 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Tue, 26 Nov 2024 16:22:37 +0500 Subject: [PATCH 13/31] fix(trading): return decimals for native token --- .../src/TradingService/TradingService.ts | 26 ++++++++++++------- libs/shared/src/const.ts | 2 ++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/libs/services/src/TradingService/TradingService.ts b/libs/services/src/TradingService/TradingService.ts index cdb3f9ab..344d14d4 100644 --- a/libs/services/src/TradingService/TradingService.ts +++ b/libs/services/src/TradingService/TradingService.ts @@ -13,7 +13,7 @@ import { SupportedChainId } from '@cowprotocol/cow-sdk'; import { Erc20Repository } from '@cowprotocol/repositories'; -import { ETHEREUM_ADDRESS_LENGTH } from '@cowprotocol/shared'; +import { ETHEREUM_ADDRESS_LENGTH, NativeCurrencyAddress, NativeCurrencyDecimals } from '@cowprotocol/shared'; import { GPv2Settlement__factory } from '@cowprotocol/abis'; export const tradingServiceSymbol = Symbol.for('TradingServiceSymbol'); @@ -52,15 +52,9 @@ export class TradingService { advancedSettings?: SwapAdvancedSettings ): Promise { const chainId = trader.chainId as number - const sellToken = await this.erc20Repository.get(chainId, params.sellToken); - const buyToken = await this.erc20Repository.get(chainId, params.buyToken); - if (typeof sellToken?.decimals !== 'number' || typeof buyToken?.decimals !== 'number') { - throw new Error('[TradingService.getQuote] Cannot find tokens decimals') - } - - const sellTokenDecimals = sellToken.decimals - const buyTokenDecimals = buyToken.decimals + const sellTokenDecimals = await this.getTokenDecimals(chainId, params.sellToken) + const buyTokenDecimals = await this.getTokenDecimals(chainId, params.buyToken) return getQuote({ ...params, sellTokenDecimals, buyTokenDecimals }, trader, advancedSettings) .then(({result}) => result); @@ -110,6 +104,20 @@ export class TradingService { } } + private async getTokenDecimals(chainId: number, tokenAddress: string): Promise { + if (tokenAddress.toLowerCase() === NativeCurrencyAddress.toLowerCase()) { + return NativeCurrencyDecimals + } else { + const token = await this.erc20Repository.get(chainId, tokenAddress) + + if (typeof token?.decimals !== 'number') { + throw new Error('[TradingService.getQuote] Cannot find tokens decimals, token: ' + tokenAddress) + } + + return token.decimals + } + } + private async getPreSignTransaction( chainId: SupportedChainId, account: string, diff --git a/libs/shared/src/const.ts b/libs/shared/src/const.ts index 792c3e37..ecd3c22f 100644 --- a/libs/shared/src/const.ts +++ b/libs/shared/src/const.ts @@ -7,6 +7,8 @@ import { SupportedChainId } from './types'; export const NativeCurrencyAddress = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'; +export const NativeCurrencyDecimals = 18; + /** * Wrapped native token address. For example, represents WETH in Mainnet and Arbitrum, and wxDAI in Gnosis chain. */ From 9f5eeb2af07f1e3c0f4647aadfd1f16753037d66 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Tue, 26 Nov 2024 18:20:51 +0500 Subject: [PATCH 14/31] feat(trading): method to get eth-flow transaction --- apps/api/src/app/routes/trading/README.md | 38 ++++++ .../routes/trading/getEthFlowTransaction.ts | 59 +++++++++ apps/api/src/app/routes/trading/getQuote.ts | 2 +- .../routes/trading/mapQuoteAmountsAndCosts.ts | 40 +++++++ apps/api/src/app/routes/trading/schemas.ts | 113 +++++++++++++----- .../trading/serializeQuoteAmountsAndCosts.ts | 32 ----- .../repositories/src/gen/cow/cow-api-types.ts | 2 + .../src/TradingService/TradingService.ts | 95 +++++++++------ package.json | 2 +- yarn.lock | 8 +- 10 files changed, 283 insertions(+), 108 deletions(-) create mode 100644 apps/api/src/app/routes/trading/getEthFlowTransaction.ts create mode 100644 apps/api/src/app/routes/trading/mapQuoteAmountsAndCosts.ts delete mode 100644 apps/api/src/app/routes/trading/serializeQuoteAmountsAndCosts.ts diff --git a/apps/api/src/app/routes/trading/README.md b/apps/api/src/app/routes/trading/README.md index f1e2edf9..22a9cc84 100644 --- a/apps/api/src/app/routes/trading/README.md +++ b/apps/api/src/app/routes/trading/README.md @@ -87,4 +87,42 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont console.log('Order Id:', orderId) console.log('preSignTransaction:', preSignTransaction) })() +``` + +### Eth-flow + +```ts +(async function() { + const trader = { + account: '0xfb3c7eb936cAA12B5A884d612393969A557d4307', + appCode: 'test1', + chainId: 11155111 + } + const params = { + kind: 'sell', + sellToken: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', + buyToken: '0x0625afb445c3b6b7b929342a04a22599fd5dbb59', + amount: '100000000000000000' + } + + const callApi = (method, body) => fetch('http://127.0.0.1:8080/trading/' + method, { + method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) + }).then(res => res.json()) + + // Get quote + const { quoteResponse, orderTypedData, appDataInfo, amountsAndCosts, tradeParameters } = await callApi('getQuote', { trader, params }) + // Get transaction + const { orderId, transaction } = await callApi('getEthFlowTransaction', { trader, quoteId: quoteResponse.id, amountsAndCosts, appDataInfo, params: tradeParameters }) + // Connect wallet + const [account] = await window.ethereum.request({ method: 'eth_requestAccounts' }) + // Send transaction + const { callData, gasLimit, to, value } = transaction + const txHash = await window.ethereum.request({ + method: 'eth_sendTransaction', + params: [{ from: account, data: callData, gas: gasLimit, to, value }] + }) + + console.log('txHash:', txHash) + console.log('orderId:', orderId) +})() ``` \ No newline at end of file diff --git a/apps/api/src/app/routes/trading/getEthFlowTransaction.ts b/apps/api/src/app/routes/trading/getEthFlowTransaction.ts new file mode 100644 index 00000000..c90c2a48 --- /dev/null +++ b/apps/api/src/app/routes/trading/getEthFlowTransaction.ts @@ -0,0 +1,59 @@ +import { FastifyPluginAsync } from 'fastify'; + +import { FromSchema } from 'json-schema-to-ts'; +import { apiContainer } from '../../inversify.config'; +import { + TradingService, + tradingServiceSymbol +} from '@cowprotocol/services'; + +import { errorSchema, ethFlowTxBodySchema, ethFlowTxSuccessSchema } from './schemas'; +import { getErrorMessage } from './utils'; +import { deserializeQuoteAmountsAndCosts } from './mapQuoteAmountsAndCosts'; + +type SuccessSchema = FromSchema; +type BodySchema = FromSchema; +type ErrorSchema = FromSchema; + +const tradingService: TradingService = apiContainer.get( + tradingServiceSymbol +); + +const root: FastifyPluginAsync = async (fastify): Promise => { + fastify.post<{ + Reply: SuccessSchema | ErrorSchema; + Body: BodySchema; + }>( + '/getEthFlowTransaction', + { + schema: { + body: ethFlowTxBodySchema, + response: { + '2XX': ethFlowTxSuccessSchema, + '400': errorSchema, + }, + }, + }, + async function (request, reply) { + const { trader, amountsAndCosts, quoteId, params, appDataInfo } = request.body + + try { + const result = await tradingService.getEthFlowTransaction( + trader, + quoteId, + params as Parameters[2], + deserializeQuoteAmountsAndCosts(amountsAndCosts), + appDataInfo, + ); + + reply.send(result); + } catch (e) { + const errorMessage = getErrorMessage(e) + console.error('[Trading API] getEthFlowTransaction error', errorMessage) + reply.code(500).send({ message: errorMessage }); + } + } + ); +}; + +export default root; \ No newline at end of file diff --git a/apps/api/src/app/routes/trading/getQuote.ts b/apps/api/src/app/routes/trading/getQuote.ts index 8a09b042..17e334a4 100644 --- a/apps/api/src/app/routes/trading/getQuote.ts +++ b/apps/api/src/app/routes/trading/getQuote.ts @@ -7,7 +7,7 @@ import { tradingServiceSymbol } from '@cowprotocol/services'; -import { serializeQuoteAmountsAndCosts } from './serializeQuoteAmountsAndCosts'; +import { serializeQuoteAmountsAndCosts } from './mapQuoteAmountsAndCosts'; import { errorSchema, getQuoteBodySchema, getQuoteSuccessSchema } from './schemas'; import { getErrorMessage } from './utils'; diff --git a/apps/api/src/app/routes/trading/mapQuoteAmountsAndCosts.ts b/apps/api/src/app/routes/trading/mapQuoteAmountsAndCosts.ts new file mode 100644 index 00000000..131a8022 --- /dev/null +++ b/apps/api/src/app/routes/trading/mapQuoteAmountsAndCosts.ts @@ -0,0 +1,40 @@ +import { QuoteAmountsAndCosts } from '@cowprotocol/cow-sdk'; + +export function serializeQuoteAmountsAndCosts(value: QuoteAmountsAndCosts): QuoteAmountsAndCosts { + return mapQuoteAmountsAndCosts(value, String) +} + +export function deserializeQuoteAmountsAndCosts(value: QuoteAmountsAndCosts): QuoteAmountsAndCosts { + return mapQuoteAmountsAndCosts(value, BigInt) +} + +function mapQuoteAmountsAndCosts(value: QuoteAmountsAndCosts, mapper: (value: T) => R): QuoteAmountsAndCosts { + const { costs: { networkFee, partnerFee } } = value + + function serializeAmounts(value: {sellAmount: T; buyAmount: T}): {sellAmount: R; buyAmount: R} { + return { + sellAmount: mapper(value.sellAmount), + buyAmount: mapper(value.buyAmount) + } + } + + return { + ...value, + costs: { + ...value.costs, + networkFee: { + ...networkFee, + amountInSellCurrency: mapper(networkFee.amountInSellCurrency), + amountInBuyCurrency: mapper(networkFee.amountInBuyCurrency) + }, + partnerFee: { + ...partnerFee, + amount: mapper(partnerFee.amount) + } + }, + beforeNetworkCosts: serializeAmounts(value.beforeNetworkCosts), + afterNetworkCosts: serializeAmounts(value.afterNetworkCosts), + afterPartnerFees: serializeAmounts(value.afterPartnerFees), + afterSlippage: serializeAmounts(value.afterSlippage) + } +} \ No newline at end of file diff --git a/apps/api/src/app/routes/trading/schemas.ts b/apps/api/src/app/routes/trading/schemas.ts index 5d157604..024925e2 100644 --- a/apps/api/src/app/routes/trading/schemas.ts +++ b/apps/api/src/app/routes/trading/schemas.ts @@ -6,6 +6,44 @@ import QuoterParametersSchema from '../../../tradingSchemas/QuoterParameters'; import TradeParametersSchema from '../../../tradingSchemas/TradeParameters'; import QuoteResultsSchema from '../../../tradingSchemas/QuoteResultsSerialized'; +const TraderParametersSchema = { + type: 'object', + additionalProperties: false, + properties: { + env: TradeParametersSchema.properties.env, + chainId: QuoterParametersSchema.properties.chainId, + account: QuoterParametersSchema.properties.account, + }, + required: [ + 'chainId', + 'account' + ] +} as const + +const TransactionSchema = { + type: 'object', + required: ['callData', 'gasLimit', 'to', 'value'], + additionalProperties: false, + properties: { + callData: { + title: 'Call data', + type: 'string' + }, + gasLimit: { + title: 'Gas limit', + type: 'string' + }, + to: { + title: 'CoW Protocol Settlement contract address', + type: 'string' + }, + value: { + title: 'Native token value to send', + type: 'string' + }, + } +} as const + export const getQuoteBodySchema = { type: 'object', required: ['trader', 'params'], @@ -45,19 +83,7 @@ export const postOrderBodySchema = { required: ['trader', 'quoteResponse', 'orderTypedData', 'appDataInfo', 'signature'], additionalProperties: false, properties: { - trader: { - type: 'object', - additionalProperties: false, - properties: { - env: TradeParametersSchema.properties.env, - chainId: QuoterParametersSchema.properties.chainId, - account: QuoterParametersSchema.properties.account, - }, - required: [ - 'chainId', - 'account' - ] - }, + trader: TraderParametersSchema, quoteResponse: QuoteResultsSchema.properties.quoteResponse, orderTypedData: QuoteResultsSchema.properties.orderTypedData, appDataInfo: QuoteResultsSchema.properties.appDataInfo, @@ -80,29 +106,50 @@ export const postOrderSuccessSchema = { type: 'string' }, preSignTransaction: { - type: 'object', - description: 'For smart-contracts, the transaction to be sent to the CoW Protocol Settlement contract to confirm the order.', - required: ['callData', 'gasLimit', 'to', 'value'], - additionalProperties: false, + ...TransactionSchema, properties: { - callData: { - title: 'Call data', - type: 'string' - }, - gasLimit: { - title: 'Gas limit', - type: 'string' - }, - to: { - title: 'CoW Protocol Settlement contract address', - type: 'string' - }, + ...TransactionSchema.properties, value: { - title: 'Native token value to send', - type: 'string', + ...TransactionSchema.properties.value, const: '0' - }, - } + } + }, + description: 'For smart-contracts, the transaction to be sent to the CoW Protocol Settlement contract to confirm the order.', + } + } +} as const satisfies JSONSchema; + + +export const ethFlowTxBodySchema = { + type: 'object', + required: ['trader', 'params', 'quoteId', 'amountsAndCosts', 'appDataInfo'], + additionalProperties: false, + properties: { + trader: TraderParametersSchema, + params: TradeParametersSchema, + quoteId: { + title: 'Quote ID', + description: 'Unique identifier of the quote.', + type: 'number' + }, + amountsAndCosts: QuoteResultsSchema.properties.amountsAndCosts, + appDataInfo: QuoteResultsSchema.properties.appDataInfo, + } +} as const satisfies JSONSchema; + +export const ethFlowTxSuccessSchema = { + type: 'object', + required: ['orderId'], + additionalProperties: false, + properties: { + orderId: { + title: 'Order ID', + description: 'Unique identifier for the order, you can search for details of the order in https://explorer.cow.fi using the ID.', + type: 'string' + }, + transaction: { + ...TransactionSchema, + description: 'Transaction to be sent to the CoW Protocol Eth-flow contract to create the order.', } } } as const satisfies JSONSchema; \ No newline at end of file diff --git a/apps/api/src/app/routes/trading/serializeQuoteAmountsAndCosts.ts b/apps/api/src/app/routes/trading/serializeQuoteAmountsAndCosts.ts deleted file mode 100644 index 04a61d06..00000000 --- a/apps/api/src/app/routes/trading/serializeQuoteAmountsAndCosts.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { QuoteAmountsAndCosts } from '@cowprotocol/cow-sdk'; - -export function serializeQuoteAmountsAndCosts(value: QuoteAmountsAndCosts): QuoteAmountsAndCosts { - const { costs: { networkFee, partnerFee } } = value - - return { - ...value, - costs: { - ...value.costs, - networkFee: { - ...networkFee, - amountInSellCurrency: networkFee.amountInSellCurrency.toString(), - amountInBuyCurrency: networkFee.amountInBuyCurrency.toString() - }, - partnerFee: { - ...partnerFee, - amount: partnerFee.amount.toString() - } - }, - beforeNetworkCosts: serializeAmounts(value.beforeNetworkCosts), - afterNetworkCosts: serializeAmounts(value.afterNetworkCosts), - afterPartnerFees: serializeAmounts(value.afterPartnerFees), - afterSlippage: serializeAmounts(value.afterSlippage) - } -} - -function serializeAmounts(value: {sellAmount: bigint; buyAmount: bigint}): {sellAmount: string; buyAmount: string} { - return { - sellAmount: value.sellAmount.toString(), - buyAmount: value.buyAmount.toString() - } -} diff --git a/libs/repositories/src/gen/cow/cow-api-types.ts b/libs/repositories/src/gen/cow/cow-api-types.ts index 51b476fa..572cfaad 100644 --- a/libs/repositories/src/gen/cow/cow-api-types.ts +++ b/libs/repositories/src/gen/cow/cow-api-types.ts @@ -379,6 +379,8 @@ export interface paths { * * The block on which the batch was created. * * Prices for all tokens being traded (used for objective value computation). * + * **Note: This endpoint is currently permissioned. Reach out in discord if you need access.** + * */ get: { parameters: { diff --git a/libs/services/src/TradingService/TradingService.ts b/libs/services/src/TradingService/TradingService.ts index 344d14d4..9c323c5a 100644 --- a/libs/services/src/TradingService/TradingService.ts +++ b/libs/services/src/TradingService/TradingService.ts @@ -1,16 +1,18 @@ import { injectable } from 'inversify'; -import { parseAbi, PublicClient } from 'viem'; +import { Chain, Client, PublicClient, Transport } from 'viem'; +import { Web3Provider } from '@ethersproject/providers' import { getQuote, - TradeParameters, SwapAdvancedSettings, QuoteResults, OrderBookApi, SigningScheme, CowEnv, COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS, - SupportedChainId + SupportedChainId, + getEthFlowTransaction, + swapParamsToLimitOrderParams } from '@cowprotocol/cow-sdk'; import { Erc20Repository } from '@cowprotocol/repositories'; import { ETHEREUM_ADDRESS_LENGTH, NativeCurrencyAddress, NativeCurrencyDecimals } from '@cowprotocol/shared'; @@ -36,7 +38,6 @@ export interface PostOrderResult { const GAS_LIMIT_MARGIN = 20 // 20% const DEFAULT_GAS_LIMIT = BigInt(150000) -const SettlementInterface = GPv2Settlement__factory.createInterface() @injectable() export class TradingService { @@ -48,7 +49,7 @@ export class TradingService { async getQuote( trader: Parameters[1], - params: Omit, + params: Omit, advancedSettings?: SwapAdvancedSettings ): Promise { const chainId = trader.chainId as number @@ -104,18 +105,21 @@ export class TradingService { } } - private async getTokenDecimals(chainId: number, tokenAddress: string): Promise { - if (tokenAddress.toLowerCase() === NativeCurrencyAddress.toLowerCase()) { - return NativeCurrencyDecimals - } else { - const token = await this.erc20Repository.get(chainId, tokenAddress) - - if (typeof token?.decimals !== 'number') { - throw new Error('[TradingService.getQuote] Cannot find tokens decimals, token: ' + tokenAddress) - } - - return token.decimals - } + async getEthFlowTransaction( + trader: TraderParams, + quoteId: number, + params: QuoteResults['tradeParameters'], + amountsAndCosts: QuoteResults['amountsAndCosts'], + appDataInfo: QuoteResults['appDataInfo'], + ): Promise> { + const viemClient = this.viemClients[trader.chainId as SupportedChainId] as Client + const provider = this.viemClientToEthersProvider(viemClient) + + return getEthFlowTransaction( + provider.getSigner(trader.account), + appDataInfo.appDataKeccak256, + swapParamsToLimitOrderParams(params, quoteId, amountsAndCosts), + ) } private async getPreSignTransaction( @@ -123,37 +127,43 @@ export class TradingService { account: string, orderId: string ): Promise { - const viemClient = this.viemClients[chainId] - - const method = 'setPreSignature' + const viemClient = this.viemClients[chainId] as Client + const provider = this.viemClientToEthersProvider(viemClient) + const contract = GPv2Settlement__factory.connect(account, provider) const settlementContractAddress = COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS[chainId] as `0x${string}` - const preSignatureCall = SettlementInterface.encodeFunctionData(method, [orderId, true]) - - const gas = await (async () => { - try { - return viemClient.estimateContractGas({ - address: settlementContractAddress, - abi: parseAbi([ - SettlementInterface.getFunction(method).format('full') - ]), - functionName: method, - account: account as `0x${string}`, - args: [orderId, true] - }) - } catch (e) { + const preSignatureCall = contract.interface.encodeFunctionData('setPreSignature', [orderId, true]) + + const gas = await contract.estimateGas.setPreSignature(orderId, true) + .then((res) => BigInt(res.toHexString())) + .catch((error) => { + console.error(error) + return DEFAULT_GAS_LIMIT - } - })() + }) return { callData: preSignatureCall, - gasLimit: this.addGasLimitMargin(gas).toString(), + gasLimit: '0x' + this.addGasLimitMargin(gas).toString(16), to: settlementContractAddress, value: '0' } } + private async getTokenDecimals(chainId: number, tokenAddress: string): Promise { + if (tokenAddress.toLowerCase() === NativeCurrencyAddress.toLowerCase()) { + return NativeCurrencyDecimals + } else { + const token = await this.erc20Repository.get(chainId, tokenAddress) + + if (typeof token?.decimals !== 'number') { + throw new Error('[TradingService.getQuote] Cannot find tokens decimals, token: ' + tokenAddress) + } + + return token.decimals + } + } + /** * Returns the gas value plus a margin for unexpected or variable gas costs * @param value the gas value to pad @@ -162,4 +172,15 @@ export class TradingService { const twentyPercent = value * BigInt(GAS_LIMIT_MARGIN) / BigInt(100); return value + twentyPercent; } + + private viemClientToEthersProvider(client: Client): Web3Provider { + const { chain, transport } = client + const network = { + chainId: chain.id, + name: chain.name, + ensAddress: chain.contracts?.ensRegistry?.address, + } + + return new Web3Provider(transport, network) + } } diff --git a/package.json b/package.json index bd3cdbca..5f962228 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "private": true, "dependencies": { "@cowprotocol/cms": "^0.3.0-RC.4", - "@cowprotocol/cow-sdk": "5.8.0-RC.5", + "@cowprotocol/cow-sdk": "5.8.0-RC.6", "@fastify/autoload": "~5.7.1", "@fastify/caching": "^8.3.0", "@fastify/cors": "^8.2.1", diff --git a/yarn.lock b/yarn.lock index e246d274..f67b91f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1106,10 +1106,10 @@ resolved "https://registry.npmjs.org/@cowprotocol/contracts/-/contracts-1.6.0.tgz" integrity sha512-+UKhYRzkvnqqviBru5D3btTLYc743n0O5YTG+wpYwGl4fb7VNKBkFHe28C5Mf1DF/kOfmqfu+0IAvX9Vuq5Dqw== -"@cowprotocol/cow-sdk@5.8.0-RC.5": - version "5.8.0-RC.5" - resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.5.tgz#041d5386d6493b35fcf83a800982131aae679536" - integrity sha512-/ouvWk7T69Yz6FvHA83tuhB0winc+SbWXRMor+zgs9zc3ZP46k4y5U4ASZ2roEPUbKaNLbdLz+KToTr6RPHwzw== +"@cowprotocol/cow-sdk@5.8.0-RC.6": + version "5.8.0-RC.6" + resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.6.tgz#91b5ca9b5698bbc414cc7c412f8d29cc668e0d80" + integrity sha512-9r95YdpSUxNVXR9KTu+sL5+Fru2Xc9G+QluxUlxyFg8fHsgLFEh2NATrfOLbkeXhXJ8pBzw4bFbKoWAgU3cIfg== dependencies: "@cowprotocol/app-data" "^2.4.0" "@cowprotocol/contracts" "^1.6.0" From f09ba08ddfb4c405553780a3ceb0aea6a4c27072 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Tue, 26 Nov 2024 18:41:12 +0500 Subject: [PATCH 15/31] chore: import util from sdk --- .../routes/trading/mapQuoteAmountsAndCosts.ts | 33 +------------------ package.json | 2 +- yarn.lock | 8 ++--- 3 files changed, 6 insertions(+), 37 deletions(-) diff --git a/apps/api/src/app/routes/trading/mapQuoteAmountsAndCosts.ts b/apps/api/src/app/routes/trading/mapQuoteAmountsAndCosts.ts index 131a8022..425f7185 100644 --- a/apps/api/src/app/routes/trading/mapQuoteAmountsAndCosts.ts +++ b/apps/api/src/app/routes/trading/mapQuoteAmountsAndCosts.ts @@ -1,4 +1,4 @@ -import { QuoteAmountsAndCosts } from '@cowprotocol/cow-sdk'; +import { QuoteAmountsAndCosts, mapQuoteAmountsAndCosts } from '@cowprotocol/cow-sdk'; export function serializeQuoteAmountsAndCosts(value: QuoteAmountsAndCosts): QuoteAmountsAndCosts { return mapQuoteAmountsAndCosts(value, String) @@ -7,34 +7,3 @@ export function serializeQuoteAmountsAndCosts(value: QuoteAmountsAndCosts): Quot export function deserializeQuoteAmountsAndCosts(value: QuoteAmountsAndCosts): QuoteAmountsAndCosts { return mapQuoteAmountsAndCosts(value, BigInt) } - -function mapQuoteAmountsAndCosts(value: QuoteAmountsAndCosts, mapper: (value: T) => R): QuoteAmountsAndCosts { - const { costs: { networkFee, partnerFee } } = value - - function serializeAmounts(value: {sellAmount: T; buyAmount: T}): {sellAmount: R; buyAmount: R} { - return { - sellAmount: mapper(value.sellAmount), - buyAmount: mapper(value.buyAmount) - } - } - - return { - ...value, - costs: { - ...value.costs, - networkFee: { - ...networkFee, - amountInSellCurrency: mapper(networkFee.amountInSellCurrency), - amountInBuyCurrency: mapper(networkFee.amountInBuyCurrency) - }, - partnerFee: { - ...partnerFee, - amount: mapper(partnerFee.amount) - } - }, - beforeNetworkCosts: serializeAmounts(value.beforeNetworkCosts), - afterNetworkCosts: serializeAmounts(value.afterNetworkCosts), - afterPartnerFees: serializeAmounts(value.afterPartnerFees), - afterSlippage: serializeAmounts(value.afterSlippage) - } -} \ No newline at end of file diff --git a/package.json b/package.json index 5f962228..4ef3c139 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "private": true, "dependencies": { "@cowprotocol/cms": "^0.3.0-RC.4", - "@cowprotocol/cow-sdk": "5.8.0-RC.6", + "@cowprotocol/cow-sdk": "5.8.0-RC.7", "@fastify/autoload": "~5.7.1", "@fastify/caching": "^8.3.0", "@fastify/cors": "^8.2.1", diff --git a/yarn.lock b/yarn.lock index f67b91f2..a3facfc5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1106,10 +1106,10 @@ resolved "https://registry.npmjs.org/@cowprotocol/contracts/-/contracts-1.6.0.tgz" integrity sha512-+UKhYRzkvnqqviBru5D3btTLYc743n0O5YTG+wpYwGl4fb7VNKBkFHe28C5Mf1DF/kOfmqfu+0IAvX9Vuq5Dqw== -"@cowprotocol/cow-sdk@5.8.0-RC.6": - version "5.8.0-RC.6" - resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.6.tgz#91b5ca9b5698bbc414cc7c412f8d29cc668e0d80" - integrity sha512-9r95YdpSUxNVXR9KTu+sL5+Fru2Xc9G+QluxUlxyFg8fHsgLFEh2NATrfOLbkeXhXJ8pBzw4bFbKoWAgU3cIfg== +"@cowprotocol/cow-sdk@5.8.0-RC.7": + version "5.8.0-RC.7" + resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.7.tgz#f08d70cf8631033990122725b5bf5ba4afe156bb" + integrity sha512-tN4EVL0EoBXI+bWwqAqAlN1pwrSUhT5Gi+bz/NxnBEZ9f8fDGfqd2/KK3Sq1YqjxHWuRk1MNaC7zzayIG05FZw== dependencies: "@cowprotocol/app-data" "^2.4.0" "@cowprotocol/contracts" "^1.6.0" From 48a9d5b65f97bd8123b249f386abfbbf0239ccbe Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Wed, 27 Nov 2024 16:59:59 +0500 Subject: [PATCH 16/31] refactor: move getPreSignTransaction to sdk --- .../src/TradingService/TradingService.ts | 68 +++++-------------- 1 file changed, 17 insertions(+), 51 deletions(-) diff --git a/libs/services/src/TradingService/TradingService.ts b/libs/services/src/TradingService/TradingService.ts index 9c323c5a..f7c0a28d 100644 --- a/libs/services/src/TradingService/TradingService.ts +++ b/libs/services/src/TradingService/TradingService.ts @@ -9,14 +9,12 @@ import { OrderBookApi, SigningScheme, CowEnv, - COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS, SupportedChainId, getEthFlowTransaction, - swapParamsToLimitOrderParams + swapParamsToLimitOrderParams, getPreSignTransaction } from '@cowprotocol/cow-sdk'; import { Erc20Repository } from '@cowprotocol/repositories'; import { ETHEREUM_ADDRESS_LENGTH, NativeCurrencyAddress, NativeCurrencyDecimals } from '@cowprotocol/shared'; -import { GPv2Settlement__factory } from '@cowprotocol/abis'; export const tradingServiceSymbol = Symbol.for('TradingServiceSymbol'); @@ -36,9 +34,6 @@ export interface PostOrderResult { } } -const GAS_LIMIT_MARGIN = 20 // 20% -const DEFAULT_GAS_LIMIT = BigInt(150000) - @injectable() export class TradingService { constructor( @@ -68,13 +63,8 @@ export class TradingService { appDataInfo: QuoteResults['appDataInfo'], signature: string ): Promise { - if (!quoteResponse.id) { - throw new Error('Quote id is required to post order') - } - - if (!quoteResponse.quote.signingScheme) { - throw new Error('Quote signing scheme is required to post order') - } + if (!quoteResponse.id) throw new Error('Quote id is required to post order') + if (!quoteResponse.quote.signingScheme) throw new Error('Quote signing scheme is required to post order') const { chainId, account, env } = trader @@ -96,10 +86,7 @@ export class TradingService { }) if (isPreSign) { - return { - orderId, - preSignTransaction: await this.getPreSignTransaction(chainId, trader.account, orderId) - } + return this.getPostOrderResultWithPreSignTx(chainId, account, orderId) } else { return { orderId } } @@ -112,8 +99,7 @@ export class TradingService { amountsAndCosts: QuoteResults['amountsAndCosts'], appDataInfo: QuoteResults['appDataInfo'], ): Promise> { - const viemClient = this.viemClients[trader.chainId as SupportedChainId] as Client - const provider = this.viemClientToEthersProvider(viemClient) + const provider = this.viemClientToEthersProvider(trader.chainId) return getEthFlowTransaction( provider.getSigner(trader.account), @@ -122,31 +108,18 @@ export class TradingService { ) } - private async getPreSignTransaction( - chainId: SupportedChainId, - account: string, - orderId: string - ): Promise { - const viemClient = this.viemClients[chainId] as Client - const provider = this.viemClientToEthersProvider(viemClient) - const contract = GPv2Settlement__factory.connect(account, provider) - - const settlementContractAddress = COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS[chainId] as `0x${string}` - const preSignatureCall = contract.interface.encodeFunctionData('setPreSignature', [orderId, true]) - - const gas = await contract.estimateGas.setPreSignature(orderId, true) - .then((res) => BigInt(res.toHexString())) - .catch((error) => { - console.error(error) - - return DEFAULT_GAS_LIMIT - }) + async getPostOrderResultWithPreSignTx(chainId: number, account: string, orderId: string): Promise { + const provider = this.viemClientToEthersProvider(chainId) + const signer = provider.getSigner(account) + const preSignTransaction = await getPreSignTransaction(signer, chainId, account, orderId) return { - callData: preSignatureCall, - gasLimit: '0x' + this.addGasLimitMargin(gas).toString(16), - to: settlementContractAddress, - value: '0' + orderId, + preSignTransaction: { + ...preSignTransaction, + // Just to satisfy typescript. This value is always 0 in preSignTransaction as well + value: '0' + } } } @@ -164,16 +137,9 @@ export class TradingService { } } - /** - * Returns the gas value plus a margin for unexpected or variable gas costs - * @param value the gas value to pad - */ - private addGasLimitMargin(value: bigint): bigint { - const twentyPercent = value * BigInt(GAS_LIMIT_MARGIN) / BigInt(100); - return value + twentyPercent; - } + private viemClientToEthersProvider(chainId: number): Web3Provider { + const client = this.viemClients[chainId as SupportedChainId] as Client - private viemClientToEthersProvider(client: Client): Web3Provider { const { chain, transport } = client const network = { chainId: chain.id, From 49588952f32f7604599c0fa98831a148dbd4e623 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Wed, 27 Nov 2024 17:03:13 +0500 Subject: [PATCH 17/31] chore: make NativeCurrencyDecimals map --- libs/services/src/TradingService/TradingService.ts | 5 +++-- libs/shared/src/const.ts | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libs/services/src/TradingService/TradingService.ts b/libs/services/src/TradingService/TradingService.ts index f7c0a28d..29ed5279 100644 --- a/libs/services/src/TradingService/TradingService.ts +++ b/libs/services/src/TradingService/TradingService.ts @@ -11,7 +11,8 @@ import { CowEnv, SupportedChainId, getEthFlowTransaction, - swapParamsToLimitOrderParams, getPreSignTransaction + swapParamsToLimitOrderParams, + getPreSignTransaction } from '@cowprotocol/cow-sdk'; import { Erc20Repository } from '@cowprotocol/repositories'; import { ETHEREUM_ADDRESS_LENGTH, NativeCurrencyAddress, NativeCurrencyDecimals } from '@cowprotocol/shared'; @@ -125,7 +126,7 @@ export class TradingService { private async getTokenDecimals(chainId: number, tokenAddress: string): Promise { if (tokenAddress.toLowerCase() === NativeCurrencyAddress.toLowerCase()) { - return NativeCurrencyDecimals + return NativeCurrencyDecimals[chainId as keyof typeof NativeCurrencyDecimals] } else { const token = await this.erc20Repository.get(chainId, tokenAddress) diff --git a/libs/shared/src/const.ts b/libs/shared/src/const.ts index ecd3c22f..82e03cae 100644 --- a/libs/shared/src/const.ts +++ b/libs/shared/src/const.ts @@ -7,7 +7,12 @@ import { SupportedChainId } from './types'; export const NativeCurrencyAddress = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'; -export const NativeCurrencyDecimals = 18; +export const NativeCurrencyDecimals: Record = { + [SupportedChainId.MAINNET]: 18, + [SupportedChainId.GNOSIS_CHAIN]: 18, + [SupportedChainId.ARBITRUM_ONE]: 18, + [SupportedChainId.SEPOLIA]: 18, +}; /** * Wrapped native token address. For example, represents WETH in Mainnet and Arbitrum, and wxDAI in Gnosis chain. From c374485b59977d3d840463f90a67b7e15dfa87c3 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Wed, 27 Nov 2024 17:13:24 +0500 Subject: [PATCH 18/31] fix(trading): define signing scheme explicitly --- apps/api/src/app/routes/trading/README.md | 10 +++++++--- apps/api/src/app/routes/trading/postOrder.ts | 3 ++- apps/api/src/app/routes/trading/schemas.ts | 10 +++++++++- libs/services/src/TradingService/TradingService.ts | 12 +++++------- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/apps/api/src/app/routes/trading/README.md b/apps/api/src/app/routes/trading/README.md index 22a9cc84..c4e084ba 100644 --- a/apps/api/src/app/routes/trading/README.md +++ b/apps/api/src/app/routes/trading/README.md @@ -77,10 +77,14 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont const { quoteResponse, orderTypedData, appDataInfo } = await callApi('getQuote', { trader, params }) // Connect wallet const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }) - // Sign order - const signature = trader.account // Send order - const { orderId, preSignTransaction } = await callApi('postOrder', { trader, signature, quoteResponse, orderTypedData, appDataInfo }) + const { orderId, preSignTransaction } = await callApi('postOrder', { + signingScheme: 'presign', // Signal to use pre-signing (smart-contract wallet) + trader, + quoteResponse, + orderTypedData, + appDataInfo + }) // ACTION NEEDED: Send from smart-contract wallet diff --git a/apps/api/src/app/routes/trading/postOrder.ts b/apps/api/src/app/routes/trading/postOrder.ts index 937300c5..540b8f2e 100644 --- a/apps/api/src/app/routes/trading/postOrder.ts +++ b/apps/api/src/app/routes/trading/postOrder.ts @@ -34,7 +34,7 @@ const root: FastifyPluginAsync = async (fastify): Promise => { }, }, async function (request, reply) { - const { trader, quoteResponse, orderTypedData, appDataInfo, signature } = request.body + const { trader, quoteResponse, orderTypedData, appDataInfo, signature, signingScheme } = request.body try { const result = await tradingService.postOrder( @@ -42,6 +42,7 @@ const root: FastifyPluginAsync = async (fastify): Promise => { quoteResponse as Parameters[1], orderTypedData as Parameters[2], appDataInfo, + signingScheme, signature ); diff --git a/apps/api/src/app/routes/trading/schemas.ts b/apps/api/src/app/routes/trading/schemas.ts index 024925e2..5be2b96c 100644 --- a/apps/api/src/app/routes/trading/schemas.ts +++ b/apps/api/src/app/routes/trading/schemas.ts @@ -5,6 +5,7 @@ import { omit } from '@cowprotocol/shared'; import QuoterParametersSchema from '../../../tradingSchemas/QuoterParameters'; import TradeParametersSchema from '../../../tradingSchemas/TradeParameters'; import QuoteResultsSchema from '../../../tradingSchemas/QuoteResultsSerialized'; +import { SigningScheme } from '@cowprotocol/cow-sdk'; const TraderParametersSchema = { type: 'object', @@ -80,13 +81,20 @@ export const errorSchema = { export const postOrderBodySchema = { type: 'object', - required: ['trader', 'quoteResponse', 'orderTypedData', 'appDataInfo', 'signature'], + required: ['trader', 'quoteResponse', 'orderTypedData', 'appDataInfo', 'signingScheme'], additionalProperties: false, properties: { trader: TraderParametersSchema, quoteResponse: QuoteResultsSchema.properties.quoteResponse, orderTypedData: QuoteResultsSchema.properties.orderTypedData, appDataInfo: QuoteResultsSchema.properties.appDataInfo, + signingScheme: { + type: 'string', + enum: Object.values(SigningScheme), + title: 'Signing scheme', + description: 'Signing scheme used to sign the order.', + default: SigningScheme.EIP712, + }, signature: { title: 'ECDSA signature of the order OR account address for smart-contracts', description: 'Result of eth_signTypedData_v4 with the orderTypedData OR the account address for smart-contracts (pre-sign)', diff --git a/libs/services/src/TradingService/TradingService.ts b/libs/services/src/TradingService/TradingService.ts index 29ed5279..4b113004 100644 --- a/libs/services/src/TradingService/TradingService.ts +++ b/libs/services/src/TradingService/TradingService.ts @@ -15,7 +15,7 @@ import { getPreSignTransaction } from '@cowprotocol/cow-sdk'; import { Erc20Repository } from '@cowprotocol/repositories'; -import { ETHEREUM_ADDRESS_LENGTH, NativeCurrencyAddress, NativeCurrencyDecimals } from '@cowprotocol/shared'; +import { NativeCurrencyAddress, NativeCurrencyDecimals } from '@cowprotocol/shared'; export const tradingServiceSymbol = Symbol.for('TradingServiceSymbol'); @@ -62,7 +62,8 @@ export class TradingService { quoteResponse: QuoteResults['quoteResponse'], orderTypedData: QuoteResults['orderTypedData'], appDataInfo: QuoteResults['appDataInfo'], - signature: string + signingScheme: SigningScheme = SigningScheme.EIP712, + _signature?: string ): Promise { if (!quoteResponse.id) throw new Error('Quote id is required to post order') if (!quoteResponse.quote.signingScheme) throw new Error('Quote signing scheme is required to post order') @@ -70,11 +71,8 @@ export class TradingService { const { chainId, account, env } = trader const orderBookApi = new OrderBookApi({ chainId, env }) - const isPreSign = signature.length === ETHEREUM_ADDRESS_LENGTH - - const signingScheme = isPreSign - ? SigningScheme.PRESIGN - : quoteResponse.quote.signingScheme + const signature = _signature || account + const isPreSign = signingScheme === SigningScheme.PRESIGN const orderId = await orderBookApi.sendOrder({ ...orderTypedData.message, From 611715045784bc0d2a0068921d8b917413fbcce1 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Wed, 27 Nov 2024 17:15:54 +0500 Subject: [PATCH 19/31] chore: bump sdk version --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 4ef3c139..ae705d82 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "private": true, "dependencies": { "@cowprotocol/cms": "^0.3.0-RC.4", - "@cowprotocol/cow-sdk": "5.8.0-RC.7", + "@cowprotocol/cow-sdk": "5.8.0-RC.8", "@fastify/autoload": "~5.7.1", "@fastify/caching": "^8.3.0", "@fastify/cors": "^8.2.1", diff --git a/yarn.lock b/yarn.lock index a3facfc5..9a2dedbc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1106,10 +1106,10 @@ resolved "https://registry.npmjs.org/@cowprotocol/contracts/-/contracts-1.6.0.tgz" integrity sha512-+UKhYRzkvnqqviBru5D3btTLYc743n0O5YTG+wpYwGl4fb7VNKBkFHe28C5Mf1DF/kOfmqfu+0IAvX9Vuq5Dqw== -"@cowprotocol/cow-sdk@5.8.0-RC.7": - version "5.8.0-RC.7" - resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.7.tgz#f08d70cf8631033990122725b5bf5ba4afe156bb" - integrity sha512-tN4EVL0EoBXI+bWwqAqAlN1pwrSUhT5Gi+bz/NxnBEZ9f8fDGfqd2/KK3Sq1YqjxHWuRk1MNaC7zzayIG05FZw== +"@cowprotocol/cow-sdk@5.8.0-RC.8": + version "5.8.0-RC.8" + resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.8.tgz#961a55465da8da9a1110ab9d53243e7ed043d2e2" + integrity sha512-ARuL0+ihAyrczvrM8GQ1iGdhp29kMNlly3pvBubU9iDYcjDT6CzNhkg6ut3ZB/5CpeJmGVTUoD2zpqvBjxfDOA== dependencies: "@cowprotocol/app-data" "^2.4.0" "@cowprotocol/contracts" "^1.6.0" From a3ca35a3ce004924871c21fab2864dc19e8a99d0 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Thu, 28 Nov 2024 13:32:34 +0500 Subject: [PATCH 20/31] chore: update schemas --- apps/api/src/app/routes/trading/README.md | 21 ++++++-- .../routes/trading/getEthFlowTransaction.ts | 4 +- apps/api/src/app/routes/trading/schemas.ts | 17 +++--- .../tradingSchemas/LimitTradeParameters.ts | 36 +++++++++---- .../tradingSchemas/QuoteResultsSerialized.ts | 54 +++++++++++-------- .../src/tradingSchemas/QuoterParameters.ts | 3 +- .../api/src/tradingSchemas/TradeParameters.ts | 28 +++++++--- .../src/TradingService/TradingService.ts | 4 +- 8 files changed, 112 insertions(+), 55 deletions(-) diff --git a/apps/api/src/app/routes/trading/README.md b/apps/api/src/app/routes/trading/README.md index c4e084ba..312c21e9 100644 --- a/apps/api/src/app/routes/trading/README.md +++ b/apps/api/src/app/routes/trading/README.md @@ -17,7 +17,7 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont })}) ``` -### Get quote -> sign -> send +### EOA Get quote -> sign -> send ```ts (async function() { @@ -47,7 +47,13 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont params: [accounts[0], JSON.stringify(orderTypedData)] }) // Send order - const orderId = await callApi('postOrder', { trader, signature, quoteResponse, orderTypedData, appDataInfo }) + const orderId = await callApi('postOrder', { + signature, + trader, + quoteResponse, + orderTypedData, + appDataInfo + }) console.log('Order Id:', orderId) })() @@ -116,14 +122,19 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont // Get quote const { quoteResponse, orderTypedData, appDataInfo, amountsAndCosts, tradeParameters } = await callApi('getQuote', { trader, params }) // Get transaction - const { orderId, transaction } = await callApi('getEthFlowTransaction', { trader, quoteId: quoteResponse.id, amountsAndCosts, appDataInfo, params: tradeParameters }) + const { orderId, transaction } = await callApi('getEthFlowTransaction', { + quoteId: quoteResponse.id, + trader, + tradeParameters, + amountsAndCosts, + appDataInfo, + }) // Connect wallet const [account] = await window.ethereum.request({ method: 'eth_requestAccounts' }) // Send transaction - const { callData, gasLimit, to, value } = transaction const txHash = await window.ethereum.request({ method: 'eth_sendTransaction', - params: [{ from: account, data: callData, gas: gasLimit, to, value }] + params: [{ ...transaction, from: account }] }) console.log('txHash:', txHash) diff --git a/apps/api/src/app/routes/trading/getEthFlowTransaction.ts b/apps/api/src/app/routes/trading/getEthFlowTransaction.ts index c90c2a48..5bfe4c96 100644 --- a/apps/api/src/app/routes/trading/getEthFlowTransaction.ts +++ b/apps/api/src/app/routes/trading/getEthFlowTransaction.ts @@ -35,13 +35,13 @@ const root: FastifyPluginAsync = async (fastify): Promise => { }, }, async function (request, reply) { - const { trader, amountsAndCosts, quoteId, params, appDataInfo } = request.body + const { trader, amountsAndCosts, quoteId, tradeParameters, appDataInfo } = request.body try { const result = await tradingService.getEthFlowTransaction( trader, quoteId, - params as Parameters[2], + tradeParameters as Parameters[2], deserializeQuoteAmountsAndCosts(amountsAndCosts), appDataInfo, ); diff --git a/apps/api/src/app/routes/trading/schemas.ts b/apps/api/src/app/routes/trading/schemas.ts index 5be2b96c..9dd9741a 100644 --- a/apps/api/src/app/routes/trading/schemas.ts +++ b/apps/api/src/app/routes/trading/schemas.ts @@ -23,14 +23,14 @@ const TraderParametersSchema = { const TransactionSchema = { type: 'object', - required: ['callData', 'gasLimit', 'to', 'value'], + required: ['data', 'gas', 'to', 'value'], additionalProperties: false, properties: { - callData: { - title: 'Call data', + data: { + title: 'Smart-contract call data', type: 'string' }, - gasLimit: { + gas: { title: 'Gas limit', type: 'string' }, @@ -50,7 +50,10 @@ export const getQuoteBodySchema = { required: ['trader', 'params'], additionalProperties: false, properties: { - trader: QuoterParametersSchema, + trader: { + ...QuoterParametersSchema, + title: 'Information about the trader', + }, params: { ...TradeParametersSchema, properties: omit(TradeParametersSchema.properties, ['sellTokenDecimals', 'buyTokenDecimals']), @@ -130,11 +133,11 @@ export const postOrderSuccessSchema = { export const ethFlowTxBodySchema = { type: 'object', - required: ['trader', 'params', 'quoteId', 'amountsAndCosts', 'appDataInfo'], + required: ['trader', 'tradeParameters', 'quoteId', 'amountsAndCosts', 'appDataInfo'], additionalProperties: false, properties: { trader: TraderParametersSchema, - params: TradeParametersSchema, + tradeParameters: TradeParametersSchema, quoteId: { title: 'Quote ID', description: 'Unique identifier of the quote.', diff --git a/apps/api/src/tradingSchemas/LimitTradeParameters.ts b/apps/api/src/tradingSchemas/LimitTradeParameters.ts index 32f68bb6..2004ceaf 100644 --- a/apps/api/src/tradingSchemas/LimitTradeParameters.ts +++ b/apps/api/src/tradingSchemas/LimitTradeParameters.ts @@ -12,14 +12,14 @@ export default { }, "sellToken": { "type": "string", - "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + "description": "ERC-20 token to be sold." }, "sellTokenDecimals": { "type": "number" }, "buyToken": { "type": "string", - "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + "description": "ERC-20 token to be bought." }, "buyTokenDecimals": { "type": "number" @@ -33,16 +33,28 @@ export default { "description": "The environment to use for the Cow API." }, "partiallyFillable": { - "type": "boolean" + "type": "boolean", + "description": "Is the order fill-or-kill or partially fillable?" }, "slippageBps": { - "type": "number" + "type": "number", + "description": "Slippage tolerance that was applied to the order to get the limit price. Expressed in Basis Points (BPS). One basis point is equivalent to 0.01% (1/100th of a percent)" }, "receiver": { - "type": "string" + "anyOf": [ + { + "type": "string", + "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + }, + { + "type": "null" + } + ], + "description": "An optional Ethereum address to receive the proceeds of the trade instead of the owner (i.e. the order signer)." }, "validFor": { - "type": "number" + "type": "number", + "description": "Unix timestamp (`uint32`) until which the order is valid." }, "partnerFee": { "type": "object", @@ -63,16 +75,20 @@ export default { "additionalProperties": false }, "sellAmount": { - "type": "string" + "type": "string", + "description": "Amount of `sellToken` to be sold in atoms." }, "buyAmount": { - "type": "string" + "type": "string", + "description": "Amount of `buyToken` to be bought in atoms." }, "quoteId": { - "type": "number" + "type": "number", + "description": "Id of the quote to be used for the limit order." }, "validTo": { - "type": "number" + "type": "number", + "description": "Unix timestamp (`uint32`) until which the order is valid." } }, "required": [ diff --git a/apps/api/src/tradingSchemas/QuoteResultsSerialized.ts b/apps/api/src/tradingSchemas/QuoteResultsSerialized.ts index b81cb2a0..c1092c5c 100644 --- a/apps/api/src/tradingSchemas/QuoteResultsSerialized.ts +++ b/apps/api/src/tradingSchemas/QuoteResultsSerialized.ts @@ -15,16 +15,28 @@ export default { "description": "The environment to use for the Cow API." }, "partiallyFillable": { - "type": "boolean" + "type": "boolean", + "description": "Is the order fill-or-kill or partially fillable?" }, "slippageBps": { - "type": "number" + "type": "number", + "description": "Slippage tolerance that was applied to the order to get the limit price. Expressed in Basis Points (BPS). One basis point is equivalent to 0.01% (1/100th of a percent)" }, "receiver": { - "type": "string" + "anyOf": [ + { + "type": "string", + "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + }, + { + "type": "null" + } + ], + "description": "An optional Ethereum address to receive the proceeds of the trade instead of the owner (i.e. the order signer)." }, "validFor": { - "type": "number" + "type": "number", + "description": "Unix timestamp (`uint32`) until which the order is valid." }, "partnerFee": { "type": "object", @@ -54,20 +66,21 @@ export default { }, "sellToken": { "type": "string", - "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + "description": "ERC-20 token to be sold." }, "sellTokenDecimals": { "type": "number" }, "buyToken": { "type": "string", - "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + "description": "ERC-20 token to be bought." }, "buyTokenDecimals": { "type": "number" }, "amount": { - "type": "string" + "type": "string", + "description": "Amount of a token. `uint256` encoded in decimal." } }, "required": [ @@ -77,7 +90,8 @@ export default { "kind", "sellToken", "sellTokenDecimals" - ] + ], + "description": "Trade type, assets, amounts, and optional parameters." }, "orderToSign": { "type": "object", @@ -526,18 +540,12 @@ export default { "description": "Metadata JSON document for adding information to orders." }, "fullAppData": { - "type": "string" + "type": "string", + "description": "The string encoding of a JSON object representing some `appData`. The format of the JSON expected in the `appData` field is defined [here](https://github.com/cowprotocol/app-data)." }, "appDataKeccak256": { - "type": "string" - }, - "env": { "type": "string", - "enum": [ - "prod", - "staging" - ], - "description": "The environment to use for the Cow API." + "description": "32 bytes encoded as hex with `0x` prefix. It's expected to be the hash of the stringified JSON object representing the `appData`." } }, "required": [ @@ -545,7 +553,8 @@ export default { "fullAppData", "appDataKeccak256" ], - "additionalProperties": false + "additionalProperties": false, + "description": "https://github.com/cowprotocol/app-data" }, "orderTypedData": { "type": "object", @@ -572,7 +581,8 @@ export default { "chainId", "verifyingContract" ], - "additionalProperties": false + "additionalProperties": false, + "description": "EIP-712 typed data domain." }, "primaryType": { "type": "string", @@ -596,7 +606,8 @@ export default { "name", "type" ], - "additionalProperties": false + "additionalProperties": false, + "description": "EIP-712 typed data field." } } }, @@ -696,7 +707,8 @@ export default { "types", "message" ], - "additionalProperties": false + "additionalProperties": false, + "description": "EIP-712 typed data for an order." }, "amountsAndCosts": { "type": "object", diff --git a/apps/api/src/tradingSchemas/QuoterParameters.ts b/apps/api/src/tradingSchemas/QuoterParameters.ts index 2aecc86d..3e084276 100644 --- a/apps/api/src/tradingSchemas/QuoterParameters.ts +++ b/apps/api/src/tradingSchemas/QuoterParameters.ts @@ -18,7 +18,8 @@ export default { "description": "Supported chains and their `chainId` for the SDK." }, "appCode": { - "type": "string" + "type": "string", + "description": "The code identifying the CLI, UI, service generating the order." } }, "required": [ diff --git a/apps/api/src/tradingSchemas/TradeParameters.ts b/apps/api/src/tradingSchemas/TradeParameters.ts index eb4c4fb5..b018742e 100644 --- a/apps/api/src/tradingSchemas/TradeParameters.ts +++ b/apps/api/src/tradingSchemas/TradeParameters.ts @@ -12,16 +12,28 @@ export default { "description": "The environment to use for the Cow API." }, "partiallyFillable": { - "type": "boolean" + "type": "boolean", + "description": "Is the order fill-or-kill or partially fillable?" }, "slippageBps": { - "type": "number" + "type": "number", + "description": "Slippage tolerance that was applied to the order to get the limit price. Expressed in Basis Points (BPS). One basis point is equivalent to 0.01% (1/100th of a percent)" }, "receiver": { - "type": "string" + "anyOf": [ + { + "type": "string", + "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + }, + { + "type": "null" + } + ], + "description": "An optional Ethereum address to receive the proceeds of the trade instead of the owner (i.e. the order signer)." }, "validFor": { - "type": "number" + "type": "number", + "description": "Unix timestamp (`uint32`) until which the order is valid." }, "partnerFee": { "type": "object", @@ -51,20 +63,21 @@ export default { }, "sellToken": { "type": "string", - "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + "description": "ERC-20 token to be sold." }, "sellTokenDecimals": { "type": "number" }, "buyToken": { "type": "string", - "description": "20 byte Ethereum address encoded as a hex with `0x` prefix." + "description": "ERC-20 token to be bought." }, "buyTokenDecimals": { "type": "number" }, "amount": { - "type": "string" + "type": "string", + "description": "Amount of a token. `uint256` encoded in decimal." } }, "required": [ @@ -75,5 +88,6 @@ export default { "sellToken", "sellTokenDecimals" ], + "description": "Trade type, assets, amounts, and optional parameters.", "definitions": {} } as const \ No newline at end of file diff --git a/libs/services/src/TradingService/TradingService.ts b/libs/services/src/TradingService/TradingService.ts index 4b113004..51eb6fbd 100644 --- a/libs/services/src/TradingService/TradingService.ts +++ b/libs/services/src/TradingService/TradingService.ts @@ -28,8 +28,8 @@ interface TraderParams { export interface PostOrderResult { orderId: string preSignTransaction?: { - callData: string - gasLimit: string + data: string + gas: string to: string value: '0' } From 81bdf8cf95b02eac382870e33fd1a1f7590aad0f Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Thu, 28 Nov 2024 13:34:45 +0500 Subject: [PATCH 21/31] chore: add advancedSettings to getQuote --- apps/api/src/app/routes/trading/getQuote.ts | 5 +++-- apps/api/src/app/routes/trading/schemas.ts | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/api/src/app/routes/trading/getQuote.ts b/apps/api/src/app/routes/trading/getQuote.ts index 17e334a4..6a52e41f 100644 --- a/apps/api/src/app/routes/trading/getQuote.ts +++ b/apps/api/src/app/routes/trading/getQuote.ts @@ -35,12 +35,13 @@ const root: FastifyPluginAsync = async (fastify): Promise => { }, }, async function (request, reply) { - const { trader, params } = request.body + const { trader, params, advancedSettings } = request.body try { const result = await tradingService.getQuote( trader as Parameters[0], - params as Parameters[1] + params as Parameters[1], + advancedSettings as Parameters[2] ); reply.send({ diff --git a/apps/api/src/app/routes/trading/schemas.ts b/apps/api/src/app/routes/trading/schemas.ts index 9dd9741a..e3bcfe76 100644 --- a/apps/api/src/app/routes/trading/schemas.ts +++ b/apps/api/src/app/routes/trading/schemas.ts @@ -5,6 +5,7 @@ import { omit } from '@cowprotocol/shared'; import QuoterParametersSchema from '../../../tradingSchemas/QuoterParameters'; import TradeParametersSchema from '../../../tradingSchemas/TradeParameters'; import QuoteResultsSchema from '../../../tradingSchemas/QuoteResultsSerialized'; +import SwapAdvancedSettings from '../../../tradingSchemas/SwapAdvancedSettings'; import { SigningScheme } from '@cowprotocol/cow-sdk'; const TraderParametersSchema = { @@ -63,6 +64,10 @@ export const getQuoteBodySchema = { 'sellToken', 'buyToken', ] + }, + advancedSettings: { + ...SwapAdvancedSettings, + } } } as const satisfies JSONSchema; From 8ac2b378f46bdc1d3f06497e303224998f106ff5 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Thu, 28 Nov 2024 13:42:20 +0500 Subject: [PATCH 22/31] chore: simplify trading api params --- apps/api/src/app/routes/trading/README.md | 18 +++++++++--------- apps/api/src/app/routes/trading/postOrder.ts | 6 +++--- apps/api/src/app/routes/trading/schemas.ts | 18 ++++++++++-------- .../src/TradingService/TradingService.ts | 11 ++++------- 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/apps/api/src/app/routes/trading/README.md b/apps/api/src/app/routes/trading/README.md index 312c21e9..0c5aac66 100644 --- a/apps/api/src/app/routes/trading/README.md +++ b/apps/api/src/app/routes/trading/README.md @@ -38,7 +38,7 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont }).then(res => res.json()) // Get quote - const { quoteResponse, orderTypedData, appDataInfo } = await callApi('getQuote', { trader, params }) + const { quoteResponse, orderToSign, orderTypedData, appDataInfo } = await callApi('getQuote', { trader, params }) // Connect wallet const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }) // Sign order @@ -48,10 +48,10 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont }) // Send order const orderId = await callApi('postOrder', { - signature, trader, - quoteResponse, - orderTypedData, + quoteId: quoteResponse.id, + signature, // Add order typed data signature (EIP-712) + orderToSign, appDataInfo }) @@ -80,15 +80,15 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont }).then(res => res.json()) // Get quote - const { quoteResponse, orderTypedData, appDataInfo } = await callApi('getQuote', { trader, params }) + const { quoteResponse, orderToSign, appDataInfo } = await callApi('getQuote', { trader, params }) // Connect wallet const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }) // Send order const { orderId, preSignTransaction } = await callApi('postOrder', { - signingScheme: 'presign', // Signal to use pre-signing (smart-contract wallet) trader, - quoteResponse, - orderTypedData, + quoteId: quoteResponse.id, + signingScheme: 'presign', // Signal to use pre-signing (smart-contract wallet) + orderToSign, appDataInfo }) @@ -123,8 +123,8 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont const { quoteResponse, orderTypedData, appDataInfo, amountsAndCosts, tradeParameters } = await callApi('getQuote', { trader, params }) // Get transaction const { orderId, transaction } = await callApi('getEthFlowTransaction', { - quoteId: quoteResponse.id, trader, + quoteId: quoteResponse.id, tradeParameters, amountsAndCosts, appDataInfo, diff --git a/apps/api/src/app/routes/trading/postOrder.ts b/apps/api/src/app/routes/trading/postOrder.ts index 540b8f2e..95a277f2 100644 --- a/apps/api/src/app/routes/trading/postOrder.ts +++ b/apps/api/src/app/routes/trading/postOrder.ts @@ -34,13 +34,13 @@ const root: FastifyPluginAsync = async (fastify): Promise => { }, }, async function (request, reply) { - const { trader, quoteResponse, orderTypedData, appDataInfo, signature, signingScheme } = request.body + const { trader, quoteId, orderToSign, appDataInfo, signature, signingScheme } = request.body try { const result = await tradingService.postOrder( trader, - quoteResponse as Parameters[1], - orderTypedData as Parameters[2], + quoteId, + orderToSign as Parameters[2], appDataInfo, signingScheme, signature diff --git a/apps/api/src/app/routes/trading/schemas.ts b/apps/api/src/app/routes/trading/schemas.ts index e3bcfe76..0f6055c4 100644 --- a/apps/api/src/app/routes/trading/schemas.ts +++ b/apps/api/src/app/routes/trading/schemas.ts @@ -8,6 +8,12 @@ import QuoteResultsSchema from '../../../tradingSchemas/QuoteResultsSerialized'; import SwapAdvancedSettings from '../../../tradingSchemas/SwapAdvancedSettings'; import { SigningScheme } from '@cowprotocol/cow-sdk'; +const QuoteIdSchema = { + title: 'Quote ID', + description: 'Unique identifier of the quote.', + type: 'number' +} as const + const TraderParametersSchema = { type: 'object', additionalProperties: false, @@ -89,12 +95,12 @@ export const errorSchema = { export const postOrderBodySchema = { type: 'object', - required: ['trader', 'quoteResponse', 'orderTypedData', 'appDataInfo', 'signingScheme'], + required: ['trader', 'quoteId', 'orderToSign', 'appDataInfo', 'signingScheme'], additionalProperties: false, properties: { trader: TraderParametersSchema, - quoteResponse: QuoteResultsSchema.properties.quoteResponse, - orderTypedData: QuoteResultsSchema.properties.orderTypedData, + quoteId: QuoteIdSchema, + orderToSign: QuoteResultsSchema.properties.orderToSign, appDataInfo: QuoteResultsSchema.properties.appDataInfo, signingScheme: { type: 'string', @@ -143,11 +149,7 @@ export const ethFlowTxBodySchema = { properties: { trader: TraderParametersSchema, tradeParameters: TradeParametersSchema, - quoteId: { - title: 'Quote ID', - description: 'Unique identifier of the quote.', - type: 'number' - }, + quoteId: QuoteIdSchema, amountsAndCosts: QuoteResultsSchema.properties.amountsAndCosts, appDataInfo: QuoteResultsSchema.properties.appDataInfo, } diff --git a/libs/services/src/TradingService/TradingService.ts b/libs/services/src/TradingService/TradingService.ts index 51eb6fbd..51caa914 100644 --- a/libs/services/src/TradingService/TradingService.ts +++ b/libs/services/src/TradingService/TradingService.ts @@ -59,15 +59,12 @@ export class TradingService { async postOrder( trader: TraderParams, - quoteResponse: QuoteResults['quoteResponse'], - orderTypedData: QuoteResults['orderTypedData'], + quoteId: number, + orderToSign: QuoteResults['orderToSign'], appDataInfo: QuoteResults['appDataInfo'], signingScheme: SigningScheme = SigningScheme.EIP712, _signature?: string ): Promise { - if (!quoteResponse.id) throw new Error('Quote id is required to post order') - if (!quoteResponse.quote.signingScheme) throw new Error('Quote signing scheme is required to post order') - const { chainId, account, env } = trader const orderBookApi = new OrderBookApi({ chainId, env }) @@ -75,11 +72,11 @@ export class TradingService { const isPreSign = signingScheme === SigningScheme.PRESIGN const orderId = await orderBookApi.sendOrder({ - ...orderTypedData.message, + ...orderToSign, + quoteId, from: account.toLowerCase(), signature, signingScheme, - quoteId: quoteResponse.id, appData: appDataInfo.fullAppData, appDataHash: appDataInfo.appDataKeccak256 }) From c249bcef8a66591c76d57ea3f3b8df383b111a54 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Thu, 28 Nov 2024 17:21:25 +0500 Subject: [PATCH 23/31] chore: update docs --- apps/api/src/app/routes/trading/README.md | 68 ++++++++++++++++++----- 1 file changed, 55 insertions(+), 13 deletions(-) diff --git a/apps/api/src/app/routes/trading/README.md b/apps/api/src/app/routes/trading/README.md index 0c5aac66..7b3ee358 100644 --- a/apps/api/src/app/routes/trading/README.md +++ b/apps/api/src/app/routes/trading/README.md @@ -1,8 +1,33 @@ -# Example +# CoW Trading API -### Get quote -```ts -fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ + +The **CoW Protocol** offers powerful and highly flexible trading capabilities, designed to facilitate complex decentralized finance (DeFi) interactions. However, its flexibility can also make it challenging for developers to interact directly with the protocol. + +This **CoW Trading API** aims to simplify the interaction by abstracting the complexities. It automatically handles critical aspects such as parameter configuration, accurate calculations for token amounts, and signing orders. + +This API functions as a wrapper around the [`@cowprotocol/cow-sdk`](https://github.com/cowprotocol/cow-sdk/blob/feat/swap-for-people/src/trading/README.md), making it easy to integrate CoW trading into your applications. + +--- + +## Core Features +- **Simplified Order Management:** Abstracts the complexity of preparing, signing, and submitting orders. +- **Native Token Support:** Allows trading Ethereum and other native tokens seamlessly. +- **Smart-Contract Wallet Compatibility:** Includes support for wallets using EIP-1271 presigning. +- **Robust Transaction Handling:** Automatically computes necessary amounts and costs for trades. + +--- + +## 1. **Get Quote** + +The `getQuote` method provides a price quote for your desired trade. This includes information necessary to prepare, sign, and submit the order. + +### API Endpoint +**POST** `https://bff.cow.fi/trading/getQuote` + +### Request Example + +```js +fetch('https://bff.cow.fi/trading/getQuote', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ trader: { account: '0xfb3c7eb936cAA12B5A884d612393969A557d4307', appCode: 'test1', @@ -17,9 +42,18 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont })}) ``` -### EOA Get quote -> sign -> send +## 2. Full Trading Flow + +This section demonstrates the complete trading flow, from retrieving a quote to signing and sending an order to the order book. + +### Steps +1. **Get Quote**: Use the getQuote endpoint to retrieve the trade details. +2. **Sign Order**: Connect your wallet and sign the order using EIP-712 typed data. +3. **Submit Order**: Send the signed order to the order book. + +### Code Example -```ts +```js (async function() { const trader = { account: '0xfb3c7eb936cAA12B5A884d612393969A557d4307', @@ -33,7 +67,7 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont amount: '100000000000000000' } - const callApi = (method, body) => fetch('http://127.0.0.1:8080/trading/' + method, { + const callApi = (method, body) => fetch('https://bff.cow.fi/trading/' + method, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) }).then(res => res.json()) @@ -59,9 +93,13 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont })() ``` -### Smart-contract wallet (pre-sign) +## 3. Smart-Contract Wallet (EIP-1271 Pre-signing) -```ts +For smart-contract wallets, orders are signed using the [EIP-1271](https://eips.ethereum.org/EIPS/eip-1271) standard. This involves presigning the order and sending a transaction. + +### Code Example + +```js (async function() { const trader = { account: '0xF568A3a2dfFd73C000E8E475B2D335A4A3818EBa', @@ -75,7 +113,7 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont amount: '100000000000000000' } - const callApi = (method, body) => fetch('http://127.0.0.1:8080/trading/' + method, { + const callApi = (method, body) => fetch('https://bff.cow.fi/trading/' + method, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) }).then(res => res.json()) @@ -99,9 +137,13 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont })() ``` -### Eth-flow +## 4. Trading Native Tokens (ETH Flow) + +To trade Ethereum (native token), use the `getEthFlowTransaction` method, which generates a transaction object for direct submission to the network. + +### Code Example -```ts +```js (async function() { const trader = { account: '0xfb3c7eb936cAA12B5A884d612393969A557d4307', @@ -115,7 +157,7 @@ fetch('http://127.0.0.1:8080/trading/getQuote', {method: 'POST', headers: {'Cont amount: '100000000000000000' } - const callApi = (method, body) => fetch('http://127.0.0.1:8080/trading/' + method, { + const callApi = (method, body) => fetch('https://bff.cow.fi/trading/' + method, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) }).then(res => res.json()) From 15b6ec1bbba9cd8008d62534bb9295d3d01fb090 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Thu, 28 Nov 2024 17:27:35 +0500 Subject: [PATCH 24/31] chore: fix build --- libs/shared/src/const.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/shared/src/const.ts b/libs/shared/src/const.ts index 5e843f71..6acec6b4 100644 --- a/libs/shared/src/const.ts +++ b/libs/shared/src/const.ts @@ -12,6 +12,7 @@ export const NativeCurrencyDecimals: Record = { [SupportedChainId.GNOSIS_CHAIN]: 18, [SupportedChainId.ARBITRUM_ONE]: 18, [SupportedChainId.SEPOLIA]: 18, + [SupportedChainId.BASE]: 18, }; /** From f4bb9fc02e6e5e5d7c3c75c5c124fe9b0e92b61c Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Thu, 28 Nov 2024 17:35:56 +0500 Subject: [PATCH 25/31] chore: fix build --- apps/api/src/app/routes/trading/schemas.ts | 2 +- package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/api/src/app/routes/trading/schemas.ts b/apps/api/src/app/routes/trading/schemas.ts index 0f6055c4..89748dc2 100644 --- a/apps/api/src/app/routes/trading/schemas.ts +++ b/apps/api/src/app/routes/trading/schemas.ts @@ -157,7 +157,7 @@ export const ethFlowTxBodySchema = { export const ethFlowTxSuccessSchema = { type: 'object', - required: ['orderId'], + required: ['orderId', 'transaction'], additionalProperties: false, properties: { orderId: { diff --git a/package.json b/package.json index 9ddfdbc0..612ba42d 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "private": true, "dependencies": { "@cowprotocol/cms": "^0.3.0-RC.4", - "@cowprotocol/cow-sdk": "5.8.0-RC.8", + "@cowprotocol/cow-sdk": "5.8.0-RC.9", "@fastify/autoload": "~5.7.1", "@fastify/caching": "^8.3.0", "@fastify/cors": "^8.2.1", diff --git a/yarn.lock b/yarn.lock index 9a2dedbc..303f5d34 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1106,10 +1106,10 @@ resolved "https://registry.npmjs.org/@cowprotocol/contracts/-/contracts-1.6.0.tgz" integrity sha512-+UKhYRzkvnqqviBru5D3btTLYc743n0O5YTG+wpYwGl4fb7VNKBkFHe28C5Mf1DF/kOfmqfu+0IAvX9Vuq5Dqw== -"@cowprotocol/cow-sdk@5.8.0-RC.8": - version "5.8.0-RC.8" - resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.8.tgz#961a55465da8da9a1110ab9d53243e7ed043d2e2" - integrity sha512-ARuL0+ihAyrczvrM8GQ1iGdhp29kMNlly3pvBubU9iDYcjDT6CzNhkg6ut3ZB/5CpeJmGVTUoD2zpqvBjxfDOA== +"@cowprotocol/cow-sdk@5.8.0-RC.9": + version "5.8.0-RC.9" + resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.9.tgz#31201d387ea98937e8566444910dd8fb7452865e" + integrity sha512-4NBHr9A2fYUX674u0XYPgqnCvO18yd5RCRZajPG3WXZu11swQBjipwqNgf1Sp+W5vDwVefSgnRm9aAdGseEBrg== dependencies: "@cowprotocol/app-data" "^2.4.0" "@cowprotocol/contracts" "^1.6.0" From 3061dda6b67f951e3c0b1d655ff592d540581b9d Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Mon, 2 Dec 2024 21:29:05 +0500 Subject: [PATCH 26/31] chore: rename endpoints --- apps/api/src/app/routes/trading/getEthFlowTransaction.ts | 2 +- apps/api/src/app/routes/trading/getQuote.ts | 2 +- apps/api/src/app/routes/trading/postOrder.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/api/src/app/routes/trading/getEthFlowTransaction.ts b/apps/api/src/app/routes/trading/getEthFlowTransaction.ts index 5bfe4c96..b1863ff7 100644 --- a/apps/api/src/app/routes/trading/getEthFlowTransaction.ts +++ b/apps/api/src/app/routes/trading/getEthFlowTransaction.ts @@ -24,7 +24,7 @@ const root: FastifyPluginAsync = async (fastify): Promise => { Reply: SuccessSchema | ErrorSchema; Body: BodySchema; }>( - '/getEthFlowTransaction', + '/eth-flow-transaction', { schema: { body: ethFlowTxBodySchema, diff --git a/apps/api/src/app/routes/trading/getQuote.ts b/apps/api/src/app/routes/trading/getQuote.ts index 6a52e41f..25708801 100644 --- a/apps/api/src/app/routes/trading/getQuote.ts +++ b/apps/api/src/app/routes/trading/getQuote.ts @@ -24,7 +24,7 @@ const root: FastifyPluginAsync = async (fastify): Promise => { Reply: SuccessSchema | ErrorSchema; Body: BodySchema; }>( - '/getQuote', + '/quote', { schema: { body: getQuoteBodySchema, diff --git a/apps/api/src/app/routes/trading/postOrder.ts b/apps/api/src/app/routes/trading/postOrder.ts index 95a277f2..5b3fa339 100644 --- a/apps/api/src/app/routes/trading/postOrder.ts +++ b/apps/api/src/app/routes/trading/postOrder.ts @@ -23,7 +23,7 @@ const root: FastifyPluginAsync = async (fastify): Promise => { Reply: SuccessSchema | ErrorSchema; Body: BodySchema; }>( - '/postOrder', + '/order', { schema: { body: postOrderBodySchema, From af371ad5fe7d605718787a02703500a1968c8bd2 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Mon, 2 Dec 2024 21:47:31 +0500 Subject: [PATCH 27/31] chore: rename quote endpoint --- apps/api/src/app/routes/trading/getQuote.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/app/routes/trading/getQuote.ts b/apps/api/src/app/routes/trading/getQuote.ts index 25708801..dd25d2c1 100644 --- a/apps/api/src/app/routes/trading/getQuote.ts +++ b/apps/api/src/app/routes/trading/getQuote.ts @@ -24,7 +24,7 @@ const root: FastifyPluginAsync = async (fastify): Promise => { Reply: SuccessSchema | ErrorSchema; Body: BodySchema; }>( - '/quote', + '/quote-requests', { schema: { body: getQuoteBodySchema, From d289f14512729c52be14acff55abe71ff5092024 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Mon, 2 Dec 2024 21:58:54 +0500 Subject: [PATCH 28/31] chore: rename endpoints --- apps/api/src/app/routes/trading/getEthFlowTransaction.ts | 2 +- apps/api/src/app/routes/trading/postOrder.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api/src/app/routes/trading/getEthFlowTransaction.ts b/apps/api/src/app/routes/trading/getEthFlowTransaction.ts index b1863ff7..9fa26b53 100644 --- a/apps/api/src/app/routes/trading/getEthFlowTransaction.ts +++ b/apps/api/src/app/routes/trading/getEthFlowTransaction.ts @@ -24,7 +24,7 @@ const root: FastifyPluginAsync = async (fastify): Promise => { Reply: SuccessSchema | ErrorSchema; Body: BodySchema; }>( - '/eth-flow-transaction', + '/sell-native-currency-requests', { schema: { body: ethFlowTxBodySchema, diff --git a/apps/api/src/app/routes/trading/postOrder.ts b/apps/api/src/app/routes/trading/postOrder.ts index 5b3fa339..62690ddd 100644 --- a/apps/api/src/app/routes/trading/postOrder.ts +++ b/apps/api/src/app/routes/trading/postOrder.ts @@ -23,7 +23,7 @@ const root: FastifyPluginAsync = async (fastify): Promise => { Reply: SuccessSchema | ErrorSchema; Body: BodySchema; }>( - '/order', + '/orders', { schema: { body: postOrderBodySchema, From 40d87dc302136463f1092631df52f7149996dca9 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Tue, 3 Dec 2024 13:53:58 +0500 Subject: [PATCH 29/31] chore: update trading README --- apps/api/src/app/routes/trading/README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/api/src/app/routes/trading/README.md b/apps/api/src/app/routes/trading/README.md index 7b3ee358..68b35052 100644 --- a/apps/api/src/app/routes/trading/README.md +++ b/apps/api/src/app/routes/trading/README.md @@ -19,15 +19,15 @@ This API functions as a wrapper around the [`@cowprotocol/cow-sdk`](https://gith ## 1. **Get Quote** -The `getQuote` method provides a price quote for your desired trade. This includes information necessary to prepare, sign, and submit the order. +The `/quote-requests` method provides a price quote for your desired trade. This includes information necessary to prepare, sign, and submit the order. ### API Endpoint -**POST** `https://bff.cow.fi/trading/getQuote` +**POST** `https://bff.cow.fi/trading/quote-requests` ### Request Example ```js -fetch('https://bff.cow.fi/trading/getQuote', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ +fetch('https://bff.cow.fi/trading/quote-requests', {method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ trader: { account: '0xfb3c7eb936cAA12B5A884d612393969A557d4307', appCode: 'test1', @@ -47,7 +47,7 @@ fetch('https://bff.cow.fi/trading/getQuote', {method: 'POST', headers: {'Content This section demonstrates the complete trading flow, from retrieving a quote to signing and sending an order to the order book. ### Steps -1. **Get Quote**: Use the getQuote endpoint to retrieve the trade details. +1. **Get Quote**: Use the `/quote-requests` endpoint to retrieve the trade details. 2. **Sign Order**: Connect your wallet and sign the order using EIP-712 typed data. 3. **Submit Order**: Send the signed order to the order book. @@ -72,7 +72,7 @@ This section demonstrates the complete trading flow, from retrieving a quote to }).then(res => res.json()) // Get quote - const { quoteResponse, orderToSign, orderTypedData, appDataInfo } = await callApi('getQuote', { trader, params }) + const { quoteResponse, orderToSign, orderTypedData, appDataInfo } = await callApi('quote-requests', { trader, params }) // Connect wallet const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }) // Sign order @@ -81,7 +81,7 @@ This section demonstrates the complete trading flow, from retrieving a quote to params: [accounts[0], JSON.stringify(orderTypedData)] }) // Send order - const orderId = await callApi('postOrder', { + const orderId = await callApi('orders', { trader, quoteId: quoteResponse.id, signature, // Add order typed data signature (EIP-712) @@ -118,11 +118,11 @@ For smart-contract wallets, orders are signed using the [EIP-1271](https://eips. }).then(res => res.json()) // Get quote - const { quoteResponse, orderToSign, appDataInfo } = await callApi('getQuote', { trader, params }) + const { quoteResponse, orderToSign, appDataInfo } = await callApi('quote-requests', { trader, params }) // Connect wallet const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }) // Send order - const { orderId, preSignTransaction } = await callApi('postOrder', { + const { orderId, preSignTransaction } = await callApi('orders', { trader, quoteId: quoteResponse.id, signingScheme: 'presign', // Signal to use pre-signing (smart-contract wallet) @@ -139,7 +139,7 @@ For smart-contract wallets, orders are signed using the [EIP-1271](https://eips. ## 4. Trading Native Tokens (ETH Flow) -To trade Ethereum (native token), use the `getEthFlowTransaction` method, which generates a transaction object for direct submission to the network. +To trade Ethereum (native token), use the `/sell-native-currency-requests` method, which generates a transaction object for direct submission to the network. ### Code Example @@ -162,9 +162,9 @@ To trade Ethereum (native token), use the `getEthFlowTransaction` method, which }).then(res => res.json()) // Get quote - const { quoteResponse, orderTypedData, appDataInfo, amountsAndCosts, tradeParameters } = await callApi('getQuote', { trader, params }) + const { quoteResponse, orderTypedData, appDataInfo, amountsAndCosts, tradeParameters } = await callApi('quote-requests', { trader, params }) // Get transaction - const { orderId, transaction } = await callApi('getEthFlowTransaction', { + const { orderId, transaction } = await callApi('sell-native-currency-requests', { trader, quoteId: quoteResponse.id, tradeParameters, From 8c71a9a877d66b863ccab3e923af3f2c11a4be9d Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Tue, 3 Dec 2024 13:55:48 +0500 Subject: [PATCH 30/31] chore: update trading README --- apps/api/src/app/routes/trading/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/api/src/app/routes/trading/README.md b/apps/api/src/app/routes/trading/README.md index 68b35052..df4482bd 100644 --- a/apps/api/src/app/routes/trading/README.md +++ b/apps/api/src/app/routes/trading/README.md @@ -1,7 +1,7 @@ # CoW Trading API -The **CoW Protocol** offers powerful and highly flexible trading capabilities, designed to facilitate complex decentralized finance (DeFi) interactions. However, its flexibility can also make it challenging for developers to interact directly with the protocol. +The **CoW Protocol** offers powerful and highly flexible trading capabilities, designed to facilitate complex decentralized finance (DeFi) interactions. However, its flexibility can also make it challenging for developers to interact [directly with the protocol](https://api.cow.fi/docs/#/default/post_api_v1_orders). This **CoW Trading API** aims to simplify the interaction by abstracting the complexities. It automatically handles critical aspects such as parameter configuration, accurate calculations for token amounts, and signing orders. From 2116397257e12a45c02b23429c2aa07baf168255 Mon Sep 17 00:00:00 2001 From: shoom3301 Date: Thu, 12 Dec 2024 14:38:32 +0500 Subject: [PATCH 31/31] chore: update deps --- apps/api/src/app/routes/trading/README.md | 2 - .../tradingSchemas/LimitTradeParameters.ts | 1 - .../repositories/src/gen/cow/cow-api-types.ts | 190 ++++++++---------- package.json | 2 +- yarn.lock | 8 +- 5 files changed, 91 insertions(+), 112 deletions(-) diff --git a/apps/api/src/app/routes/trading/README.md b/apps/api/src/app/routes/trading/README.md index df4482bd..d3540473 100644 --- a/apps/api/src/app/routes/trading/README.md +++ b/apps/api/src/app/routes/trading/README.md @@ -119,8 +119,6 @@ For smart-contract wallets, orders are signed using the [EIP-1271](https://eips. // Get quote const { quoteResponse, orderToSign, appDataInfo } = await callApi('quote-requests', { trader, params }) - // Connect wallet - const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' }) // Send order const { orderId, preSignTransaction } = await callApi('orders', { trader, diff --git a/apps/api/src/tradingSchemas/LimitTradeParameters.ts b/apps/api/src/tradingSchemas/LimitTradeParameters.ts index 2004ceaf..fe9b7b01 100644 --- a/apps/api/src/tradingSchemas/LimitTradeParameters.ts +++ b/apps/api/src/tradingSchemas/LimitTradeParameters.ts @@ -96,7 +96,6 @@ export default { "buyToken", "buyTokenDecimals", "kind", - "quoteId", "sellAmount", "sellToken", "sellTokenDecimals" diff --git a/libs/repositories/src/gen/cow/cow-api-types.ts b/libs/repositories/src/gen/cow/cow-api-types.ts index 572cfaad..b0b063a5 100644 --- a/libs/repositories/src/gen/cow/cow-api-types.ts +++ b/libs/repositories/src/gen/cow/cow-api-types.ts @@ -13,7 +13,9 @@ export interface paths { }; get?: never; put?: never; - /** Create a new order. In order to replace an existing order with a new one, the appData must contain a [valid replacement order UID](https://github.com/cowprotocol/app-data/blob/main/src/schemas/v1.1.0.json#L62), then the indicated order is cancelled, and a new one placed. This allows an old order to be cancelled AND a new order to be created in an atomic operation with a single signature. This may be useful for replacing orders when on-chain prices move outside of the original order's limit price. */ + /** Create a new order. In order to replace an existing order with a new one, the appData must contain a [valid replacement order UID](https://github.com/cowprotocol/app-data/blob/main/src/schemas/v1.1.0.json#L62), then the indicated order is cancelled, and a new one placed. + * This allows an old order to be cancelled AND a new order to be created in an atomic operation with a single signature. + * This may be useful for replacing orders when on-chain prices move outside of the original order's limit price. */ post: { parameters: { query?: never; @@ -78,11 +80,7 @@ export interface paths { }; /** * Cancel multiple orders by marking them invalid with a timestamp. - * @description This is a *best effort* cancellation, and might not prevent solvers from - * settling the orders (if the order is part of an in-flight settlement - * transaction for example). Authentication must be provided by an - * [EIP-712](https://eips.ethereum.org/EIPS/eip-712) - * signature of an `OrderCancellations(bytes[] orderUids)` message. + * @description This is a *best effort* cancellation, and might not prevent solvers from settling the orders (if the order is part of an in-flight settlement transaction for example). Authentication must be provided by an [EIP-712](https://eips.ethereum.org/EIPS/eip-712) signature of an `OrderCancellations(bytes[] orderUids)` message. * */ delete: { @@ -178,11 +176,12 @@ export interface paths { /** * Cancel an order by marking it invalid with a timestamp. * @deprecated - * @description The successful deletion might not prevent solvers from settling the order. + * @description The successful deletion might not prevent solvers from settling the + * order. + * * Authentication must be provided by providing an * [EIP-712](https://eips.ethereum.org/EIPS/eip-712) signature of an * `OrderCancellation(bytes orderUid)` message. - * */ delete: { parameters: { @@ -343,9 +342,9 @@ export interface paths { * * ### If `orderUid` is specified: * - * Return all trades related to that `orderUid`. Given that an order may be partially - * fillable, it is possible that an individual order may have *multiple* trades. - * */ + * Return all trades related to that `orderUid`. Given that an order + * may be partially fillable, it is possible that an individual order + * may have *multiple* trades. */ 200: { headers: { [name: string]: unknown; @@ -373,14 +372,15 @@ export interface paths { }; /** * Get the current batch auction. - * @description The current batch auction that solvers should be solving right now. This includes: - * - * * A list of solvable orders. - * * The block on which the batch was created. - * * Prices for all tokens being traded (used for objective value computation). + * @description The current batch auction that solvers should be solving right now. This + * includes: * - * **Note: This endpoint is currently permissioned. Reach out in discord if you need access.** + * * A list of solvable orders. * The block on which the batch was created. + * * Prices for all tokens being traded (used for objective value + * computation). * + * **Note: This endpoint is currently permissioned. Reach out in discord if + * you need access.** */ get: { parameters: { @@ -419,11 +419,12 @@ export interface paths { }; /** * Get orders of one user paginated. - * @description The orders are sorted by their creation date descending (newest orders first). - * To enumerate all orders start with `offset` 0 and keep increasing the `offset` by the total - * number of returned results. When a response contains less than `limit` the last page has - * been reached. + * @description The orders are sorted by their creation date descending (newest orders + * first). * + * To enumerate all orders start with `offset` 0 and keep increasing the + * `offset` by the total number of returned results. When a response + * contains less than `limit` the last page has been reached. */ get: { parameters: { @@ -478,9 +479,11 @@ export interface paths { }; /** * Get native price for the given token. - * @description Price is the exchange rate between the specified token and the network's native currency. - * It represents the amount of native token atoms needed to buy 1 atom of the specified token. + * @description Price is the exchange rate between the specified token and the network's + * native currency. * + * It represents the amount of native token atoms needed to buy 1 atom of + * the specified token. */ get: { parameters: { @@ -544,9 +547,7 @@ export interface paths { put?: never; /** * Quote a price and fee for the specified order parameters. - * @description Given a partial order compute the minimum fee and a price estimate for the order. Return a - * full order that can be used directly for signing, and with an included signature, passed - * directly to the order creation endpoint. + * @description Given a partial order compute the minimum fee and a price estimate for the order. Return a full order that can be used directly for signing, and with an included signature, passed directly to the order creation endpoint. * */ post: { @@ -835,8 +836,7 @@ export interface paths { }; /** * Registers a full `appData` so it can be referenced by `appDataHash`. - * @description Uploads a full `appData` to orderbook so that orders created with the - * corresponding `appDataHash` can be linked to the original full `appData`. + * @description Uploads a full `appData` to orderbook so that orders created with the corresponding `appDataHash` can be linked to the original full `appData`. * */ put: { @@ -975,8 +975,8 @@ export interface paths { * Get the total surplus earned by the user. [UNSTABLE] * @description ### Caution * - * This endpoint is under active development and should NOT be considered stable. - * + * This endpoint is under active development and should NOT be considered + * stable. */ get: { parameters: { @@ -1057,15 +1057,11 @@ export interface components { */ TokenAmount: string; OnchainOrderData: { - /** @description 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. + /** @description 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. * */ sender: components["schemas"]["Address"]; /** - * @description 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. + * @description 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. * * @enum {string} */ @@ -1109,10 +1105,11 @@ export interface components { * * Fast: The price estimate is chosen among the fastest N price estimates. * 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` or `optimal` price estimates. + * Verified: The price estimate is chosen among all verified/simulated + * price estimates. * + * **NOTE**: Orders are supposed to be created from `verified` or `optimal` + * price estimates. * @enum {string} */ PriceQuality: "fast" | "optimal" | "verified"; @@ -1127,8 +1124,7 @@ export interface components { sellToken: components["schemas"]["Address"]; /** @description ERC-20 token to be bought. */ buyToken: components["schemas"]["Address"]; - /** @description An optional Ethereum address to receive the proceeds of the trade instead - * of the owner (i.e. the order signer). + /** @description An optional Ethereum address to receive the proceeds of the trade instead of the owner (i.e. the order signer). * */ receiver?: components["schemas"]["Address"] | null; /** @description Amount of `sellToken` to be sold in atoms. */ @@ -1183,30 +1179,20 @@ export interface components { buyTokenBalance: components["schemas"]["BuyTokenDestination"]; signingScheme: components["schemas"]["SigningScheme"]; signature: components["schemas"]["Signature"]; - /** @description 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. + /** @description 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. * */ from?: components["schemas"]["Address"] | null; - /** @description 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. + /** @description 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. * */ quoteId?: number | null; - /** @description This field comes in two forms for backward compatibility. The hash form will eventually - * stop being accepted. + /** @description This field comes in two forms for backward compatibility. The hash form will eventually stop being accepted. * */ appData: (string & components["schemas"]["AppData"]) | components["schemas"]["AppDataHash"]; - /** @description 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. + /** @description 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. * */ appDataHash?: components["schemas"]["AppDataHash"] | null; }; - ProtocolAppData: Record; - /** @description Extra order data that is returned to users when querying orders but not provided by users - * when creating orders. + /** @description Extra order data that is returned to users when querying orders but not provided by users when creating orders. * */ OrderMetaData: { /** @@ -1240,32 +1226,28 @@ export interface components { status: components["schemas"]["OrderStatus"]; /** @description Amount that the signed fee would be without subsidies. */ fullFeeAmount?: components["schemas"]["TokenAmount"]; - /** @description 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. + /** @description 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. - * */ + * 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. */ isLiquidityOrder?: boolean; ethflowData?: components["schemas"]["EthflowData"]; /** @description 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. * */ onchainUser?: components["schemas"]["Address"]; - /** @description There is some data only available for orders that are placed on-chain. This data - * can be found in this object. + /** @description There is some data only available for orders that are placed on-chain. This data can be found in this object. * */ onchainOrderData?: components["schemas"]["OnchainOrderData"]; /** @description Surplus fee that the limit order was executed with. */ executedSurplusFee?: components["schemas"]["BigUint"] | null; - /** @description Full `appData`, which the contract-level `appData` is a hash of. See `OrderCreation` - * for more information. + /** @description Full `appData`, which the contract-level `appData` is a hash of. See `OrderCreation` for more information. * */ fullAppData?: string | null; }; @@ -1331,14 +1313,11 @@ export interface components { /** @description The unique identifier of the auction. Increment whenever the backend creates a new auction. * */ id?: number; - /** @description 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. + /** @description 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. * */ block?: number; /** @description 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. + * **NOTE**: Under certain conditions it is possible for a settlement to have been mined as part of `block` but not have yet been processed. * */ latestSettlementBlock?: number; /** @description The solvable orders included in the auction. @@ -1364,19 +1343,18 @@ export interface components { CompetitionOrderStatus: { /** @enum {string} */ type: "open" | "scheduled" | "active" | "solved" | "executing" | "traded" | "cancelled"; - /** @description 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. - * */ + /** @description 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. */ value?: { /** @description Name of the solver. */ solver: string; executedAmounts?: components["schemas"]["ExecutedAmounts"]; }[]; }; - /** @description 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. + /** @description 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. * */ AuctionPrices: { [key: string]: components["schemas"]["BigUint"] | undefined; @@ -1426,10 +1404,11 @@ export interface components { executedProtocolFees?: components["schemas"]["ExecutedProtocolFee"][]; }; /** - * @description 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. + * @description 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. * @example 0xff2e2e54d178997f173266817c1e9ed6fee1a1aae4b43971c53b543cffcc2969845c6f5599fbb25dbdd1b9b013daf85c03f3c63763e4bc4a */ UID: string; @@ -1473,8 +1452,7 @@ export interface components { /** @description The buy or sell side when quoting an order. */ OrderQuoteSide: { kind: components["schemas"]["OrderQuoteSideKindSell"]; - /** @description The total amount that is available for the order. From this value, the fee - * is deducted and the buy amount is calculated. + /** @description The total amount that is available for the order. From this value, the fee is deducted and the buy amount is calculated. * */ sellAmountBeforeFee: components["schemas"]["TokenAmount"]; } | { @@ -1509,15 +1487,20 @@ export interface components { * */ receiver?: components["schemas"]["Address"] | null; /** @description AppData which will be assigned to the order. - * Expects either a string JSON doc as defined on [AppData](https://github.com/cowprotocol/app-data) or a - * hex encoded string for backwards compatibility. - * When the first format is used, it's possible to provide the derived appDataHash field. - * */ + * + * Expects either a string JSON doc as defined on + * [AppData](https://github.com/cowprotocol/app-data) or a hex + * encoded string for backwards compatibility. + * + * When the first format is used, it's possible to provide the + * derived appDataHash field. */ appData?: components["schemas"]["AppData"] | components["schemas"]["AppDataHash"]; /** @description The hash of the stringified JSON appData doc. - * If present, `appData` field must be set with the aforementioned data where this hash is derived from. - * In case they differ, the call will fail. - * */ + * + * If present, `appData` field must be set with the aforementioned + * data where this hash is derived from. + * + * In case they differ, the call will fail. */ appDataHash?: components["schemas"]["AppDataHash"]; /** @default erc20 */ sellTokenBalance: components["schemas"]["SellTokenSource"]; @@ -1529,8 +1512,7 @@ export interface components { /** @default eip712 */ signingScheme: components["schemas"]["SigningScheme"]; /** - * @description Flag to signal whether the order is intended for on-chain order placement. Only valid - * for non ECDSA-signed orders." + * @description Flag to signal whether the order is intended for on-chain order placement. Only valid for non ECDSA-signed orders." * * @default false */ @@ -1549,8 +1531,7 @@ export interface components { * @example 1985-03-10T18:35:18.814523Z */ expiration: string; - /** @description Quote ID linked to a quote to enable providing more metadata when analysing - * order slippage. + /** @description Quote ID linked to a quote to enable providing more metadata when analysing order slippage. * */ id?: number; /** @description Whether it was possible to verify that the quoted amounts are accurate using a simulation. @@ -1578,8 +1559,9 @@ export interface components { /** @description Name of the solver. */ solver?: string; /** @description 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. - * */ + * + * This field is missing for old settlements, the zero address has been + * used instead. */ solverAddress?: string; objective?: { /** @description The total objective value used for ranking solutions. */ @@ -1603,6 +1585,8 @@ export interface components { id?: components["schemas"]["UID"]; executedAmount?: components["schemas"]["BigUint"]; }[]; + /** @description whether the solution is a winner (received the right to get executed) or not */ + isWinner?: boolean; }; /** @description The estimated native price for the token * */ @@ -1652,10 +1636,8 @@ export interface components { FeePolicy: components["schemas"]["Surplus"] | components["schemas"]["Volume"] | components["schemas"]["PriceImprovement"]; ExecutedProtocolFee: { policy?: components["schemas"]["FeePolicy"]; - /** @description Fee amount taken */ - amount?: components["schemas"]["TokenAmount"]; - /** @description The token in which the fee is taken */ - token?: components["schemas"]["Address"]; + amount?: unknown & components["schemas"]["TokenAmount"]; + token?: unknown & components["schemas"]["Address"]; }; }; responses: never; diff --git a/package.json b/package.json index 612ba42d..4ffc356d 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "private": true, "dependencies": { "@cowprotocol/cms": "^0.3.0-RC.4", - "@cowprotocol/cow-sdk": "5.8.0-RC.9", + "@cowprotocol/cow-sdk": "5.9.0", "@fastify/autoload": "~5.7.1", "@fastify/caching": "^8.3.0", "@fastify/cors": "^8.2.1", diff --git a/yarn.lock b/yarn.lock index 303f5d34..b34f0dfa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1106,10 +1106,10 @@ resolved "https://registry.npmjs.org/@cowprotocol/contracts/-/contracts-1.6.0.tgz" integrity sha512-+UKhYRzkvnqqviBru5D3btTLYc743n0O5YTG+wpYwGl4fb7VNKBkFHe28C5Mf1DF/kOfmqfu+0IAvX9Vuq5Dqw== -"@cowprotocol/cow-sdk@5.8.0-RC.9": - version "5.8.0-RC.9" - resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.8.0-RC.9.tgz#31201d387ea98937e8566444910dd8fb7452865e" - integrity sha512-4NBHr9A2fYUX674u0XYPgqnCvO18yd5RCRZajPG3WXZu11swQBjipwqNgf1Sp+W5vDwVefSgnRm9aAdGseEBrg== +"@cowprotocol/cow-sdk@5.9.0": + version "5.9.0" + resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.9.0.tgz#565a3c144319868a275d7220d462ee3609499a8c" + integrity sha512-Rpg6jM65X2gUiqC51VV9nWgOfjlstbjk0zKLS6HDIFyKyHYMkee80+Ow63yomX5TYYOhTGUjolKLcLlSGAXS9g== dependencies: "@cowprotocol/app-data" "^2.4.0" "@cowprotocol/contracts" "^1.6.0"