Skip to content

Commit 7b09213

Browse files
committed
Create empty tx files && fix backend format to fetch the price of pyth to 'solana'
1 parent 7613ba5 commit 7b09213

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

backend/controllers/controller.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const PYTH_URLS = [
1414
const pythRequestBody = {
1515
symbols: ["Crypto.ADA/USD"],
1616
properties: ["price", "confidence", "exponent", "publisherCount"],
17-
formats: ["leEcdsa"],
17+
formats: ["solana"],
1818
channel: "fixed_rate@200ms",
1919
parsed: true,
2020
jsonBinaryEncoding: "hex",
@@ -64,7 +64,7 @@ export const getADAPriceFromPyth = async (req: Request, res: Response) => {
6464
confidence,
6565
publishers: feed.publisherCount,
6666
timestamp,
67-
leEcdsaPayload: data.leEcdsa?.data ?? null,
67+
solanaPayload: data.solana?.data ?? null,
6868
});
6969

7070
} catch (error: any) {
@@ -115,7 +115,7 @@ export const getADAPriceRangeFromPyth = async (req: Request, res: Response) => {
115115
fetchWithFallback("/price", {
116116
symbols: ["Crypto.ADA/USD"],
117117
properties: ["price", "confidence", "exponent"],
118-
formats: ["leEcdsa"],
118+
formats: ["solana"],
119119
channel: "fixed_rate@200ms",
120120
parsed: true,
121121
jsonBinaryEncoding: "hex",
@@ -174,7 +174,7 @@ export const getADAPriceHistoryFromPyth = async (req: Request, res: Response) =>
174174
const data = await fetchWithFallback("/price", {
175175
symbols: ["Crypto.ADA/USD"],
176176
properties: ["price", "confidence", "exponent", "publisherCount"],
177-
formats: ["leEcdsa"],
177+
formats: ["solana"],
178178
channel: "fixed_rate@200ms",
179179
parsed: true,
180180
jsonBinaryEncoding: "hex",
@@ -193,7 +193,7 @@ export const getADAPriceHistoryFromPyth = async (req: Request, res: Response) =>
193193
publishers: feed.publisherCount,
194194
timestamp_requested: new Date(Number(timestamp) * 1000).toISOString(),
195195
timestamp_actual: timestamp_iso,
196-
leEcdsaPayload: data.leEcdsa?.data ?? null,
196+
solanaPayload: data.solana?.data ?? null,
197197
});
198198

199199
} catch (error: any) {

frontend/src/tx/burn.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// TODO: implement buildBurnTx

frontend/src/tx/liquidate.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// TODO: implement buildLiquidateTx

frontend/src/tx/mint.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function getScript() {
4949
*
5050
* @param wallet Connected CIP-30 browser wallet (MeshSDK BrowserWallet)
5151
* @param adaToDeposit ADA amount the user wants to deposit (in lovelaces)
52-
* @param pythHex Signed Pyth price message (leEcdsaPayload from backend)
52+
* @param pythHex Signed Pyth price message (solanaPayload from backend)
5353
* @param adaUsdPrice Current ADA/USD price as a float (e.g. 0.70)
5454
* @param blockfrostKey Blockfrost preprod project ID
5555
* @returns Submitted transaction hash
@@ -99,9 +99,8 @@ export async function buildMintTx(
9999
const mintRedeemer = mConStr0([]);
100100

101101
// Pyth withdraw redeemer — List<ByteArray> with the signed price message.
102-
// NOTE: the on-chain Pyth library expects the Solana wire format (magic b9011a82).
103-
// The backend currently returns leEcdsaPayload — swap to solana format
104-
// once the backend requests formats: ["solana"].
102+
// The backend now returns solanaPayload (Solana wire format, magic b9011a82),
103+
// which is what the on-chain Pyth library expects.
105104
const pythRedeemer = mList([mBytes(pythHex)]);
106105

107106
const col = collateral[0];

0 commit comments

Comments
 (0)