insertAt function

MoveCallBuilder insertAt({
  1. required dynamic arguments,
  2. String? package,
})

Insert an exact Pyth Lazer spot observation keyed by its exact millisecond envelope timestamp. Aborts EInsertTimestampNotExactMillisecond if the envelope timestamp is not a whole millisecond, so the exact-history key is an unambiguous millisecond a consumer can look up by equality. Aborts ESettlementCarryExceedsWindow if Pyth generated the price more than constants::max_settlement_carry_ms before that envelope, so a long-carried price cannot claim a settlement key. This does not mutate latest. The first lane-valid raw observation owns the key and cannot be replaced, even if its normalized projection is unavailable.

Implementation

MoveCallBuilder insertAt({required dynamic arguments, String? package}) {
  final packageAddress = package ?? '@local-pkg/propbook';
  return (tx) => tx.moveCall(
        '$packageAddress::pyth_feed::insert_at',
        arguments: normalizeMoveArguments(tx, arguments,
            [null, null, '0x2::clock::Clock'], ['feed', 'update']),
      );
}