client-aftermath-ts-sdk
Version:
Client Aftermath TypeScript SDK
26 lines (25 loc) • 1.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.OracleApiCasting = void 0;
const utils_1 = require("../../../general/utils");
const iFixedUtils_1 = require("../../../general/utils/iFixedUtils");
class OracleApiCasting {
}
exports.OracleApiCasting = OracleApiCasting;
// =========================================================================
// Events
// =========================================================================
OracleApiCasting.updatedPriceFeedEventFromOnChain = (eventOnChain) => {
const fields = eventOnChain.parsedJson;
return {
priceFeedId: utils_1.Helpers.addLeadingZeroesToType(fields.price_feed_storage_id),
sourceWrapperId: utils_1.Helpers.addLeadingZeroesToType(fields.source_wrapper_id),
oldPrice: iFixedUtils_1.IFixedUtils.numberFromIFixed(BigInt(fields.old_price)),
oldTimestamp: Number(fields.old_timestamp),
newPrice: iFixedUtils_1.IFixedUtils.numberFromIFixed(BigInt(fields.new_price)),
newTimestamp: Number(fields.new_timestamp),
timestamp: eventOnChain.timestampMs,
txnDigest: eventOnChain.id.txDigest,
type: eventOnChain.type,
};
};