-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: sebastianPiekarczyk <sebastian@oazoapps.com>
- Loading branch information
1 parent
6034d72
commit 3b3ab7e
Showing
45 changed files
with
667 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 6 additions & 3 deletions
9
.../earn/portfolio/[wallet_address]/page.tsx → ...p/earn/portfolio/[walletAddress]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
apps/earn-protocol/app/server-handlers/sdk/get-user-positions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { sdkSupportedNetworks } from '@summerfi/app-types' | ||
import { type IArmadaPosition } from '@summerfi/sdk-client-react' | ||
import { Address, getChainInfoByChainId, User, Wallet } from '@summerfi/sdk-common' | ||
|
||
import { backendSDK } from '@/app/server-handlers/sdk/sdk-backend-client' | ||
|
||
export async function getUserPositions({ walletAddress }: { walletAddress: string }) { | ||
try { | ||
const userPositionsAllNetworksCalls = await Promise.all( | ||
sdkSupportedNetworks.map(async (chainId) => { | ||
const chainInfo = getChainInfoByChainId(chainId) | ||
|
||
const wallet = Wallet.createFrom({ | ||
address: Address.createFromEthereum({ | ||
value: walletAddress.toLowerCase(), | ||
}), | ||
}) | ||
const user = User.createFrom({ | ||
chainInfo, | ||
wallet, | ||
}) | ||
|
||
return await backendSDK.armada.users.getUserPositions({ | ||
user, | ||
}) | ||
}), | ||
) | ||
|
||
const positionsList = userPositionsAllNetworksCalls | ||
.filter(Boolean) | ||
.reduce((acc, position) => [...acc, ...position], []) | ||
|
||
return positionsList as IArmadaPosition[] | undefined | ||
} catch (error) { | ||
throw new Error(`Failed to get users positions: ${error}`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 0 additions & 49 deletions
49
apps/earn-protocol/components/layout/VaultOpenView/mocks.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 0 additions & 56 deletions
56
apps/earn-protocol/components/organisms/VaultExposure/mapper.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.