Merge branch 'main' into feat/OP-4924-add-new-networks

# Conflicts:
#	package.json
This commit is contained in:
Mikhail Gladchenko
2024-01-23 07:45:14 +00:00
5 changed files with 15 additions and 24 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@orionprotocol/sdk",
"version": "0.20.42",
"version": "0.20.45",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@orionprotocol/sdk",
"version": "0.20.42",
"version": "0.20.45",
"hasInstallScript": true,
"license": "ISC",
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.20.43-rc0",
"version": "0.20.43-rc1",
"description": "Orion Protocol SDK",
"main": "./lib/index.cjs",
"module": "./lib/index.js",

View File

@@ -23,27 +23,22 @@ import { generateFeePaymentCall } from "./callGenerators/feePayment.js";
export type Factory = "UniswapV2" | "UniswapV3" | "Curve" | "OrionV2" | "OrionV3";
export type GenerateSwapCalldataWithUnitParams = {
type BaseGenerateSwapCalldataParams = {
amount: BigNumberish;
minReturnAmount: BigNumberish;
initiatorAddress: string;
receiverAddress: string;
matcher: AddressLike,
feeToken: AddressLike,
fee: BigNumberish;
path: ArrayLike<SingleSwap>;
matcher?: AddressLike,
feeToken?: AddressLike,
fee?: BigNumberish;
}
export type GenerateSwapCalldataWithUnitParams = BaseGenerateSwapCalldataParams & {
unit: Unit;
};
export type GenerateSwapCalldataParams = {
amount: BigNumberish;
minReturnAmount: BigNumberish;
initiatorAddress: string;
receiverAddress: string;
path: ArrayLike<SingleSwap>;
matcher: AddressLike,
feeToken: AddressLike,
fee: BigNumberish;
export type GenerateSwapCalldataParams = BaseGenerateSwapCalldataParams & {
exchangeContractAddress: AddressLike;
wethAddress: AddressLike;
curveRegistryAddress: AddressLike;
@@ -347,10 +342,6 @@ async function payFeeToMatcher(
calls: BytesLike[],
swapDescription: LibValidator.SwapDescriptionStruct,
) {
console.log(matcher)
console.log(feeAmount)
console.log(feeToken)
console.log(swapDescription.dstToken)
if (BigInt(feeAmount) !== 0n && feeToken === swapDescription.dstToken) {
const feePaymentCall = generateFeePaymentCall(matcher, feeToken, feeAmount)
calls.push(feePaymentCall)

View File

@@ -8,7 +8,7 @@ import errorSchema from './schemas/errorSchema.js';
import placeAtomicSwapSchema from './schemas/placeAtomicSwapSchema.js';
import { AggregatorWS } from './ws/index.js';
import { atomicSwapHistorySchema } from './schemas/atomicSwapHistorySchema.js';
import type { BasicAuthCredentials, SignedCancelOrderRequest, SignedOrder } from '../../types.js';
import type { BasicAuthCredentials, OrderSource, SignedCancelOrderRequest, SignedOrder } from '../../types.js';
import {
pairConfigSchema, aggregatedOrderbookSchema,
exchangeOrderbookSchema, poolReservesSchema,
@@ -196,8 +196,7 @@ class Aggregator {
isCreateInternalOrder: boolean,
isReversedOrder?: boolean,
partnerId?: string,
fromWidget?: boolean,
source?: 'TERMINAL' | 'SWAP_UI',
source?: OrderSource,
rawExchangeRestrictions?: string | undefined,
) => {
const headers = {
@@ -207,7 +206,6 @@ class Aggregator {
'X-Reverse-Order': isReversedOrder ? 'true' : 'false',
},
...(partnerId !== undefined) && { 'X-Partner-Id': partnerId },
...(fromWidget !== undefined) && { 'X-From-Widget': fromWidget ? 'true' : 'false' },
...(source !== undefined) && { 'X-Source': source },
...this.basicAuthHeaders,
};

View File

@@ -454,3 +454,5 @@ export type AtomicSwap = Partial<
refundTx?: TransactionInfo | undefined
liquidityMigrationTx?: TransactionInfo | undefined
}
export type OrderSource = 'TERMINAL_MARKET' | 'TERMINAL_LIMIT' | 'SWAP_UI' | 'WIDGET';