Skip to content

Commit

Permalink
Upgrade getSolverCapacity method to use config/v2 api
Browse files Browse the repository at this point in the history
  • Loading branch information
ted-palmer committed May 22, 2024
1 parent aff5ec5 commit 0243ce7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions demo/pages/sdk/actions/getSolverCapacity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const GetSolverCapcityPage: NextPage = () => {
zora.id.toString()
)
const [originChainId, setOriginChainId] = useState<string>(base.id.toString())
const [currency, setCurrency] = useState<string>(zeroAddress)
const [currency, setCurrency] = useState<string>('eth')
const [user, setUser] = useState<string>(zeroAddress)
const { data: wallet } = useWalletClient()
const [response, setResponse] = useState<GetConfigResponse | null>(null)
Expand Down Expand Up @@ -82,8 +82,8 @@ const GetSolverCapcityPage: NextPage = () => {
const solverCapacity = await getClient()?.actions.getSolverCapacity({
destinationChainId,
originChainId,
user: zeroAddress,
currency: zeroAddress
user: user,
currency: currency as any
})
setResponse(solverCapacity)
}}
Expand Down
10 changes: 5 additions & 5 deletions packages/sdk/src/actions/getSolverCapacity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ export type GetConfigQueryParams = Required<
>
> &
Omit<
NonNullable<paths['/config']['get']['parameters']['query']>,
NonNullable<paths['/config/v2']['get']['parameters']['query']>,
'originChainId' | 'destinationChainId'
>

export type GetConfigResponse =
paths['/config']['get']['responses']['200']['content']['application/json']
paths['/config/v2']['get']['responses']['200']['content']['application/json']

export async function getSolverCapacity(
data: GetConfigQueryParams,
Expand All @@ -28,12 +28,12 @@ export async function getSolverCapacity(
throw new Error('Client not initialized')
}

// Fallback to zero address if user or currency are not provided
// Fallback to zero address if user is not provided
data.user = data.user || zeroAddress
data.currency = data.currency || zeroAddress
data.currency = data.currency

const response = await axiosInstance.get<GetConfigResponse>(
`${client.baseApiUrl}/config`,
`${client.baseApiUrl}/config/v2`,
{ params: data }
)

Expand Down

0 comments on commit 0243ce7

Please sign in to comment.