Skip to content

Commit

Permalink
Merge pull request #308 from reservoirprotocol/fix/exact-output-bug
Browse files Browse the repository at this point in the history
Fix exact output bug
  • Loading branch information
pedromcunha authored Oct 17, 2024
2 parents b146244 + 2134530 commit d3cce34
Show file tree
Hide file tree
Showing 14 changed files with 556 additions and 107 deletions.
6 changes: 6 additions & 0 deletions .changeset/rude-buckets-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@reservoir0x/relay-sdk': patch
'@reservoir0x/relay-kit-ui': patch
---

Replace exact_output with expected_output tradeType
4 changes: 2 additions & 2 deletions demo/pages/hooks/usePrice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const UsePrice: NextPage = () => {
const [destinationCurrency, setDestinationCurrency] =
useState<string>(zeroAddress)
const [recipient, setRecipient] = useState<string | undefined>()
const [tradeType, setTradeType] = useState<'EXACT_INPUT' | 'EXACT_OUTPUT'>(
const [tradeType, setTradeType] = useState<'EXACT_INPUT' | 'EXPECTED_OUTPUT'>(
'EXACT_INPUT'
)
const [source, setSource] = useState<string | undefined>()
Expand Down Expand Up @@ -120,7 +120,7 @@ const UsePrice: NextPage = () => {
}}
>
<option value="EXACT_INPUT">EXACT_INPUT</option>
<option value="EXACT_OUTPUT">EXACT_OUTPUT</option>
<option value="EXPECTED_OUTPUT">EXPECTED_OUTPUT</option>
</select>
</div>
<div>
Expand Down
6 changes: 3 additions & 3 deletions demo/pages/hooks/useQuote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const UseQuote: NextPage = () => {
const [originCurrency, setOriginCurrency] = useState<string>('')
const [destinationCurrency, setDestinationCurrency] = useState<string>('')
const [recipient, setRecipient] = useState<string | undefined>()
const [tradeType, setTradeType] = useState<'EXACT_INPUT' | 'EXACT_OUTPUT'>(
'EXACT_INPUT'
const [tradeType, setTradeType] = useState<'EXACT_INPUT' | 'EXPECTED_OUTPUT'>(
'EXPECTED_OUTPUT'
)
const [source, setSource] = useState<string | undefined>()
const [useExternalLiquidity, setUseExternalLiquidity] =
Expand Down Expand Up @@ -125,7 +125,7 @@ const UseQuote: NextPage = () => {
}}
>
<option value="EXACT_INPUT">EXACT_INPUT</option>
<option value="EXACT_OUTPUT">EXACT_OUTPUT</option>
<option value="EXPECTED_OUTPUT">EXPECTED_OUTPUT</option>
</select>
</div>
<div>
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/sdk/actions/bridge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const BridgeActionPage: NextPage = () => {
currency,
toCurrency: currency,
recipient: recipient ? (recipient as Address) : undefined,
tradeType: useExactInput ? 'EXACT_INPUT' : 'EXACT_OUTPUT',
tradeType: useExactInput ? 'EXACT_INPUT' : 'EXPECTED_OUTPUT',
options: {
usePermit: usePermit,
useExternalLiquidity: canonical
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/sdk/actions/getBridgeQuote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const GetBridgeQuotePage: NextPage = () => {
currency,
toCurrency: zeroAddress,
recipient: recipient ? (recipient as Address) : undefined,
tradeType: useExactInput ? 'EXACT_INPUT' : 'EXACT_OUTPUT'
tradeType: useExactInput ? 'EXACT_INPUT' : 'EXPECTED_OUTPUT'
})
setResponse(quote)
}}
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/sdk/actions/getPrice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const GetPricePage: NextPage = () => {
originCurrency,
destinationCurrency,
recipient: recipient ? (recipient as Address) : undefined,
tradeType: useExactInput ? 'EXACT_INPUT' : 'EXACT_OUTPUT'
tradeType: useExactInput ? 'EXACT_INPUT' : 'EXPECTED_OUTPUT'
})
setResponse(price)
}}
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/sdk/actions/getSwapQuote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const GetSwapQuote: NextPage = () => {
amount,
currency: fromCurrency,
recipient: recipient ? (recipient as Address) : undefined,
tradeType: useExactOuput ? 'EXACT_OUTPUT' : 'EXACT_INPUT'
tradeType: useExactOuput ? 'EXPECTED_OUTPUT' : 'EXACT_INPUT'
})
setResponse(quote)
}}
Expand Down
9 changes: 7 additions & 2 deletions packages/sdk/src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,21 @@ export const routes = [
"/execute/permits",
"/quote",
"/price",
"/execute/user-op/{chainId}",
"/lives",
"/intents/status",
"/intents/quote",
"/intents/status/v2",
"/intents/quote",
"/intents/quote/v2",
"/requests/{requestId}/signature",
"/requests",
"/requests/v2",
"/transactions/index",
"/transactions/status",
"/conduit/install",
"/prices/rates",
"/currencies/v1",
"/currencies/token/price"
"/tokenlist",
"/currencies/token/price",
"/provision/chain"
];
2 changes: 1 addition & 1 deletion packages/sdk/src/types/RelayChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type Erc20Currencies = NonNullable<
paths['/chains']['get']['responses']['200']['content']['application/json']['chains']
>['0']['erc20Currencies']

export type ChainVM = 'evm' | 'svm'
export type ChainVM = 'evm' | 'svm' | 'bvm'

export type RelayChain = {
id: number
Expand Down
Loading

0 comments on commit d3cce34

Please sign in to comment.