@@ -759,6 +759,7 @@ type MaxLiquidationBonusVariation {
759759type Mutation {
760760 """Top up a balance for a user or yourself on the fork"""
761761 forkTopUp (request : ForkTopUpRequest ! ): ForkTopUpResponse !
762+ swap (request : SwapRequest ! ): SwapExecutionPlan !
762763}
763764
764765type NativeAmount {
@@ -885,6 +886,29 @@ type PermitTypedDataResponse {
885886 message : PermitMessageData !
886887}
887888
889+ type PositionAmount {
890+ reserve : ReserveInfo
891+ amount : Erc20Amount !
892+ }
893+
894+ type PositionSwapAdapterContractApproval {
895+ byTransaction : TransactionRequest
896+ bySignature : TypedData
897+ }
898+
899+ union PositionSwapApproval = PositionSwapAdapterContractApproval | PositionSwapPositionManagerApproval
900+
901+ type PositionSwapByIntentApprovalsRequired {
902+ quote : SwapQuote !
903+ approvals : [PositionSwapApproval ! ]!
904+ preview : PreviewUserPosition !
905+ }
906+
907+ type PositionSwapPositionManagerApproval {
908+ byTransaction : TransactionRequest
909+ bySignature : TypedData
910+ }
911+
888912type PreContractActionRequired {
889913 """The transaction requires a pre-contract action first"""
890914 transaction : TransactionRequest !
@@ -896,6 +920,58 @@ type PreContractActionRequired {
896920 originalTransaction : TransactionRequest !
897921}
898922
923+ input PrepareBorrowSwapRequest @oneOf {
924+ market : PrepareMarketDebtSwapInput
925+ limit : PrepareLimitDebtSwapInput
926+ fromQuote : PrepareFromQuoteDebtSwapInput
927+ }
928+
929+ union PrepareBorrowSwapResult = PositionSwapByIntentApprovalsRequired
930+
931+ input PrepareFromQuoteDebtSwapInput {
932+ quoteId : SwapQuoteId !
933+ newSellAmount : BigDecimal
934+ newBuyAmount : BigDecimal
935+ newSlippage : BigDecimal
936+ newReceiver : EvmAddress
937+ user : EvmAddress !
938+ }
939+
940+ input PrepareFromQuoteRepayWithCollateralInput {
941+ quoteId : SwapQuoteId !
942+ newSellAmount : BigDecimal
943+ newBuyAmount : BigDecimal
944+ newSlippage : BigDecimal
945+ newReceiver : EvmAddress
946+ user : EvmAddress !
947+ }
948+
949+ input PrepareFromQuoteSupplySwapInput {
950+ quoteId : SwapQuoteId !
951+ newSellAmount : BigDecimal !
952+ newBuyAmount : BigDecimal !
953+ slippage : BigDecimal
954+ user : EvmAddress !
955+ }
956+
957+ input PrepareFromQuoteWithdrawAndSwapInput {
958+ quoteId : SwapQuoteId !
959+ newSellAmount : BigDecimal
960+ newBuyAmount : BigDecimal
961+ newSlippage : BigDecimal
962+ newReceiver : EvmAddress
963+ user : EvmAddress !
964+ }
965+
966+ input PrepareLimitDebtSwapInput {
967+ quoteId : SwapQuoteId !
968+ sellPosition : UserBorrowItemId !
969+ newSellAmount : BigDecimal !
970+ buyReserve : ReserveId !
971+ newBuyAmount : BigDecimal !
972+ user : EvmAddress !
973+ }
974+
899975input PrepareLimitOrderSwapInput {
900976 quoteId : SwapQuoteId !
901977 newSellAmount : BigDecimal
@@ -906,6 +982,40 @@ input PrepareLimitOrderSwapInput {
906982 newReceiver : EvmAddress
907983}
908984
985+ input PrepareLimitRepayWithCollateralInput {
986+ quoteId : SwapQuoteId !
987+ repayPosition : UserBorrowItemId !
988+ newSellAmount : BigDecimal !
989+ supplyPosition : UserSupplyItemId !
990+ newBuyAmount : BigDecimal !
991+ user : EvmAddress !
992+ }
993+
994+ input PrepareLimitSupplySwapInput {
995+ quoteId : SwapQuoteId !
996+ sellPosition : UserSupplyItemId !
997+ newSellAmount : BigDecimal !
998+ buyReserve : ReserveId !
999+ newBuyAmount : BigDecimal !
1000+ user : EvmAddress !
1001+ }
1002+
1003+ input PrepareLimitWithdrawAndSwapInput {
1004+ quoteId : SwapQuoteId !
1005+ withdrawPosition : UserSupplyItemId !
1006+ newSellAmount : BigDecimal !
1007+ buyToken : TokenInput !
1008+ newBuyAmount : BigDecimal !
1009+ user : EvmAddress !
1010+ }
1011+
1012+ input PrepareMarketDebtSwapInput {
1013+ debtPosition : UserBorrowItemId !
1014+ buyReserve : ReserveId !
1015+ amount : BigDecimal !
1016+ user : EvmAddress !
1017+ }
1018+
9091019input PrepareMarketOrderSwapInput {
9101020 chainId : ChainId !
9111021 buy : TokenInput !
@@ -916,6 +1026,55 @@ input PrepareMarketOrderSwapInput {
9161026 receiver : EvmAddress
9171027}
9181028
1029+ input PrepareMarketRepayWithCollateralInput {
1030+ debtPosition : UserBorrowItemId !
1031+ RepayWithReserve : ReserveId !
1032+ amount : BigDecimal !
1033+ user : EvmAddress !
1034+ }
1035+
1036+ input PrepareMarketSupplySwapInput {
1037+ sellPosition : UserSupplyItemId !
1038+ buyReserve : ReserveId !
1039+ amount : BigDecimal !
1040+ user : EvmAddress !
1041+ }
1042+
1043+ input PrepareMarketWithdrawAndSwapInput {
1044+ position : UserSupplyItemId !
1045+ buyReserve : ReserveId !
1046+ amount : BigDecimal !
1047+ user : EvmAddress !
1048+ }
1049+
1050+ input PreparePositionSwapRequest {
1051+ quoteId : SwapQuoteId !
1052+
1053+ """postHook adapter signature - can be approved via transaction"""
1054+ adapterContractSignature : Signature
1055+
1056+ """position manager signature - can be approved via transaction"""
1057+ positionManagerSignature : Signature
1058+ }
1059+
1060+ union PreparePositionSwapResult = SwapByIntent
1061+
1062+ input PrepareRepayWithSupplyRequest @oneOf {
1063+ market : PrepareMarketRepayWithCollateralInput
1064+ limit : PrepareLimitRepayWithCollateralInput
1065+ fromQuote : PrepareFromQuoteRepayWithCollateralInput
1066+ }
1067+
1068+ union PrepareRepayWithSupplyResult = PositionSwapByIntentApprovalsRequired
1069+
1070+ input PrepareSupplySwapRequest @oneOf {
1071+ market : PrepareMarketSupplySwapInput
1072+ limit : PrepareLimitSupplySwapInput
1073+ fromQuote : PrepareFromQuoteSupplySwapInput
1074+ }
1075+
1076+ union PrepareSupplySwapResult = PositionSwapByIntentApprovalsRequired
1077+
9191078input PrepareSwapCancelRequest {
9201079 id : SwapId !
9211080}
@@ -924,12 +1083,20 @@ type PrepareSwapCancelResult {
9241083 data : CancelSwapTypedData !
9251084}
9261085
927- input PrepareSwapRequest @oneOf {
1086+ union PrepareSwapResult = SwapByIntent | SwapByIntentWithApprovalRequired | SwapByTransaction | InsufficientBalanceError
1087+
1088+ input PrepareTokenSwapRequest @oneOf {
9281089 market : PrepareMarketOrderSwapInput
9291090 limit : PrepareLimitOrderSwapInput
9301091}
9311092
932- union PrepareSwapResult = SwapByIntent | SwapByIntentWithApprovalRequired | SwapByTransaction | InsufficientBalanceError
1093+ input PrepareWithdrawSwapRequest @oneOf {
1094+ market : PrepareMarketWithdrawAndSwapInput
1095+ limit : PrepareLimitWithdrawAndSwapInput
1096+ fromQuote : PrepareFromQuoteWithdrawAndSwapInput
1097+ }
1098+
1099+ union PrepareWithdrawSwapResult = PositionSwapByIntentApprovalsRequired
9331100
9341101input PreviewAction @oneOf {
9351102 supply : SupplyRequest
@@ -938,6 +1105,10 @@ input PreviewAction @oneOf {
9381105 withdraw : WithdrawRequest
9391106 setUserSuppliesAsCollateral : SetUserSuppliesAsCollateralRequest
9401107 updateUserPositionConditions : UpdateUserPositionConditionsRequest
1108+ supplySwap : PrepareSupplySwapRequest
1109+ borrowSwap : PrepareBorrowSwapRequest
1110+ repayWithSupply : PrepareRepayWithSupplyRequest
1111+ withdrawSwap : PrepareWithdrawSwapRequest
9411112}
9421113
9431114input PreviewRequest {
@@ -1037,8 +1208,12 @@ type Query {
10371208 hasProcessedKnownTransaction (request : HasProcessedKnownTransactionRequest ! ): Boolean !
10381209 activities (request : ActivitiesRequest ! ): PaginatedActivitiesResult !
10391210 swapQuote (request : SwapQuoteRequest ! ): SwapQuote !
1040- prepareSwap (request : PrepareSwapRequest ! ): PrepareSwapResult !
1041- swap (request : SwapRequest ! ): SwapExecutionPlan !
1211+ supplySwapQuote (request : PrepareSupplySwapRequest ! ): PrepareSupplySwapResult !
1212+ borrowSwapQuote (request : PrepareBorrowSwapRequest ! ): PrepareBorrowSwapResult !
1213+ repayWithSupplyQuote (request : PrepareRepayWithSupplyRequest ! ): PrepareRepayWithSupplyResult !
1214+ withdrawSwapQuote (request : PrepareWithdrawSwapRequest ! ): PrepareWithdrawSwapResult !
1215+ preparePositionSwap (request : PreparePositionSwapRequest ! ): PreparePositionSwapResult !
1216+ prepareSwap (request : PrepareTokenSwapRequest ! ): PrepareSwapResult !
10421217 swapStatus (request : SwapStatusRequest ! ): SwapStatus !
10431218 userSwaps (request : UserSwapsRequest ! ): PaginatedUserSwapsResult !
10441219 prepareSwapCancel (request : PrepareSwapCancelRequest ! ): PrepareSwapCancelResult !
@@ -1456,6 +1631,8 @@ input SupplyRequest {
14561631 sender : EvmAddress !
14571632}
14581633
1634+ union SwapAmount = PositionAmount | NativeAmount | Erc20Amount
1635+
14591636type SwapApprovalRequired {
14601637 approval : TransactionRequest !
14611638 originalTransaction : SwapTransactionRequest !
@@ -1509,10 +1686,10 @@ type SwapExpired {
15091686
15101687type SwapFulfilled {
15111688 txHash : String !
1512- desiredSell : TokenAmount !
1513- desiredBuy : TokenAmount !
1514- sold : TokenAmount !
1515- bought : TokenAmount !
1689+ desiredSell : SwapAmount !
1690+ desiredBuy : SwapAmount !
1691+ sold : SwapAmount !
1692+ bought : SwapAmount !
15161693 createdAt : DateTime !
15171694 fulfilledAt : DateTime !
15181695 explorerLink : String !
@@ -1531,8 +1708,8 @@ type SwapOpen {
15311708 createdAt : DateTime !
15321709 deadline : DateTime !
15331710 explorerLink : String !
1534- desiredSell : TokenAmount !
1535- desiredBuy : TokenAmount !
1711+ desiredSell : SwapAmount !
1712+ desiredBuy : SwapAmount !
15361713}
15371714
15381715type SwapPendingSignature {
@@ -1701,6 +1878,13 @@ type TypeField {
17011878 type : String !
17021879}
17031880
1881+ type TypedData {
1882+ types : JSON !
1883+ primaryType : String !
1884+ domain : DomainData !
1885+ message : JSON !
1886+ }
1887+
17041888input UpdateUserPositionConditionsRequest {
17051889 userPositionId : UserPositionId !
17061890 update : UserPositionConditionsUpdate !
@@ -2211,4 +2395,4 @@ input WithdrawReserveAmountInput @oneOf {
22112395
22122396 """The erc20 amount input"""
22132397 erc20 : AmountInput
2214- }
2398+ }
0 commit comments