Skip to content

Commit 1e2db0d

Browse files
fix: update types and imports in aptos sdk
Co-Authored-By: Connor Prussin <[email protected]>
1 parent 1e27bdb commit 1e2db0d

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

target_chains/aptos/sdk/js/src/AptosPriceServiceConnection.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
PriceServiceConnection,
33
HexString,
4+
PriceFeed,
45
} from "@pythnetwork/price-service-sdk";
56
import { BCS } from "aptos";
67
import { Buffer } from "buffer";
@@ -14,9 +15,12 @@ export class AptosPriceServiceConnection extends PriceServiceConnection {
1415
* @returns Array of price update data.
1516
*/
1617
async getPriceFeedsUpdateData(priceIds: HexString[]): Promise<number[][]> {
17-
// Fetch the latest price feed update VAAs from the price service
18-
const latestVaas = await this.getLatestVaas(priceIds);
19-
return latestVaas.map((vaa) => Array.from(Buffer.from(vaa, "base64")));
18+
// Fetch the latest price feeds from the price service
19+
const priceFeeds: PriceFeed[] = await this.getLatestPriceFeeds(priceIds);
20+
return priceFeeds
21+
.map((feed: PriceFeed) => feed.getVAA())
22+
.filter((vaa: string | undefined): vaa is string => vaa !== undefined)
23+
.map((vaa: string) => Array.from(Buffer.from(vaa, "base64")));
2024
}
2125

2226
/**
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { AptosPriceServiceConnection } from "./AptosPriceServiceConnection";
1+
export { AptosPriceServiceConnection } from "./AptosPriceServiceConnection.js";
22

33
export {
44
DurationInMs,
@@ -7,4 +7,4 @@ export {
77
PriceFeed,
88
PriceServiceConnectionConfig,
99
UnixTimestamp,
10-
} from "@pythnetwork/price-service-client";
10+
} from "@pythnetwork/price-service-sdk";

0 commit comments

Comments
 (0)