forked from Galaxy-KJ/Galaxy-DevKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path05-frontend-blend-health.ts
More file actions
31 lines (24 loc) · 855 Bytes
/
Copy path05-frontend-blend-health.ts
File metadata and controls
31 lines (24 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* Frontend Blend panel example
*
* Demonstrates how to mount BlendPanel and prefill a signer key to
* test borrow/repay flows with live health-factor updates.
*/
import { BlendClient, BlendPanel } from '@galaxy-kj/frontend';
const root = document.getElementById('blend-root');
if (!root) {
throw new Error('Expected #blend-root container');
}
const panel = new BlendPanel(root, new BlendClient({
baseUrl: '/api/v1/defi',
jwt: '<YOUR_JWT>',
}));
// Optional: prefill a known wallet from your test fixtures.
const walletInput = root.querySelector('#blend-wallet') as HTMLInputElement | null;
if (walletInput) {
walletInput.value = 'GBORROWER_TEST_ACCOUNT';
}
// Trigger first load for health-factor baseline.
const refreshButton = root.querySelector('#blend-refresh') as HTMLButtonElement | null;
refreshButton?.click();
void panel;